Skip to content

Instantly share code, notes, and snippets.

"Other developers are just like us - weird"

"If you ever need to deploy Django, you're good. If you know Capistrano and Unicorn they've got rip-offs of all that stuff."

"I think we should all admit we're horrible coders and move on" "We're all drug addicts - we're fighting methods..."

"It's easy to learn to play the guitar and be able to play Bob Dylan and Weezer and never get better."

"This is basically a talk that was given 30 years ago. We just have to keep giving it every few years because young guys come along and forget it."

@imankulov
imankulov / sqlalchemy_with_pydantic.py
Last active March 10, 2025 10:05
Using pydantic models as SQLAlchemy JSON fields (convert beween JSON and pydantic.BaseModel subclasses)
#!/usr/bin/env ipython -i
import datetime
import json
from typing import Optional
import sqlalchemy as sa
from sqlalchemy.orm import declarative_base, sessionmaker
from sqlalchemy.dialects.postgresql import JSONB
from pydantic import BaseModel, Field, parse_obj_as
@divanvisagie
divanvisagie / settings.json
Created May 4, 2020 11:55
VSCode settings
{
"workbench.colorTheme": "Nord",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.configuration.checkProjectSettingsExclusions": false,
"files.autoSave": "afterDelay",
"extensions.ignoreRecommendations": false,
"amVim.bindCtrlCommands": false,
"workbench.settings.editor": "json",
"workbench.editorAssociations": [
@uchcode
uchcode / safariview.swift
Created March 28, 2020 15:55
SwiftUI with UIViewController Design Pattern.
import SwiftUI
import SafariServices
struct DemoView: View, Hostable {
@EnvironmentObject var hostedObject: HostingObject<DemoView>
var address: String = "https://example.com"
func present() { // UIKit code
let safari = SFSafariViewController(url: URL(string: address)!)
@fallroot
fallroot / getAppList.js
Created September 19, 2019 04:08
Get running apps ordered by most recently used first in macOS
ObjC.import('Cocoa')
const windows = ObjC.deepUnwrap($.CGWindowListCopyWindowInfo($.kCGWindowListOptionOnScreenOnly | $.kCGWindowListExcludeDesktopElements, $.kCGNullWindowID))
Array.from(new Set(windows.map(w => w.kCGWindowOwnerName)))
@pudquick
pudquick / 00_notes.md
Last active June 24, 2024 18:54
Discovering variable/constant values in frameworks
@jnewc
jnewc / NotesApp.swift
Last active December 18, 2024 13:41
A notes app written in <100 lines of swift using SwiftUI
import SwiftUI
let dateFormatter = DateFormatter()
struct NoteItem: Codable, Hashable, Identifiable {
let id: Int
let text: String
var date = Date()
var dateText: String {
dateFormatter.dateFormat = "MMM d yyyy, h:mm a"
@paultopia
paultopia / download_file_to_icloud.py
Created December 21, 2018 04:17
download_file_to_icloud.py
# simple pythonista/shortcuts file download to stream big files to disk from the phone
# 1. create a "downloads" directory in your icloud folder in the pythonista app.
# 2. install this shortcut: https://www.icloud.com/shortcuts/d397a0fedef74d29a5b735c371c11f89
# 3. save this script in your local files in pythonista
# then you can long press on a url and have pythonista download it and dump it in icloud.
import shutil, os, requests, sys, uuid
from urllib.parse import urlparse
url = sys.argv[-1]
// import_json_appsscript.js
// https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4
//
// Changelog:
// (Oct. 16 2019) tag: allenyllee-20191016
// 1. Fixed google script error: urlfetchapp - service invoked too many times https://stackoverflow.com/questions/10598179/google-apps-script-urlfetchapp-service-invoked-too-many-times
// (Jul. 16 2018) tag: allenyllee-20180716
// 1. Fixed the issue "If you try to query /arrayA[k]/arrayB[n]/arrayC[m]/.../member, you will always get /arrayA[k]/arrayB[k]/arrayC[k]/.../member."
// (Nov. 30 2017) tag: allenyllee-20171130
// 1. Add the ability to query array elements by using xpath like "/array[n]/member" where "n" is array index
@aparrish
aparrish / spacy_intro.ipynb
Last active March 14, 2025 21:43
NLP Concepts with spaCy. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.