Skip to content

Instantly share code, notes, and snippets.

@jarrodthibodeau
jarrodthibodeau / now.json
Created May 2, 2019 21:46
now.json 2.0 static configuration to get your grade on securityheaders.com to an A (only for root path)
{
"version": 2,
"name": "PROJECT_NAME_HERE",
"alias": [
"YOUR_ALIASES_HERE"
],
"routes": [
{
"src": "/",
"headers": {
@timothycosta
timothycosta / UIScrollViewWrapper.swift
Created July 5, 2019 03:25
UIScrollView wrapped for SwiftUI
//
// UIScrollViewWrapper.swift
// lingq-5
//
// Created by Timothy Costa on 2019/07/05.
// Copyright © 2019 timothycosta.com. All rights reserved.
//
import SwiftUI
@nickffox
nickffox / Keyboard.swift
Created August 16, 2019 18:43
Adjusting a SwiftUI View for the Keyboard.
import Combine
final class Keyboard: ObservableObject {
// MARK: - Published Properties
@Published var state: Keyboard.State = .default
// MARK: - Private Properties
@ThatsJustCheesy
ThatsJustCheesy / PreferencesViewController.swift
Last active June 8, 2025 13:09 — forked from mminer/PreferencesViewController.swift
NSTabViewController for preferences window that resizes itself to fit activated tab view.
// Thanks to mminer on GitHub
// https://gist.github.com/mminer/caec00d2165362ff65e9f1f728cecae2
import Cocoa
class PreferencesViewController: NSTabViewController {
private lazy var tabViewSizes: [NSTabViewItem: NSSize] = [:]
private var lastSelectedTabViewItem: NSTabViewItem? = nil
@surpher
surpher / rust_to_swift.md
Last active July 17, 2025 12:48
Building binaries from Rust to iOS/macOS (PactSwift specific)
@alii
alii / ensure-keys.ts
Created August 25, 2021 14:12
Infer object values while strictly specifying keys in TypeScript
/**
* TypeScript currently lacks a way of typing a record of keys only but not values.
* we need this because we want an object of typed keys but we want to leave the values inferred.
* thankfully, we can do this with generics. This function allows the second generic's values to be inferred
* so that our object is fully type safe for hugely complex types, but we can guarantee that all the keys we need exist.
* It's not perfect, but it gets the job done for the time being
*/
export function ensureKeys<T>() {
/**
* Function that returns the value that gets put in, values are type-safely inferred
@hoishing
hoishing / HowTo.md
Last active November 9, 2025 15:25
VSCode keybindings for Xcode

VSCode keybindings for Xcode

  • copy VSCode.idekeybindings to ~/Library/Developer/Xcode/UserData/KeyBindings
  • in Xcode preferences -> key bindings, select VSCode
@msanford1540
msanford1540 / MultiPartFormData.swift
Last active January 28, 2025 10:10
Swift 5/6 Multipart form-data Support
//
// MultiPartFormData.swift
//
import Foundation
/* Example Call site: */
func upload(imageData: Data) async throws {
guard let url = URL(string: "https://example.com/upload") else { return }
var multipartFormData = MultipartFormData()
@itsmikita
itsmikita / macos-iso.md
Last active October 27, 2025 18:15
Extract ISO image from macOS Somona installer
@bdsqqq
bdsqqq / vesper-dark.json
Last active October 29, 2025 18:45
Vesper theme for zed.dev
{
"$schema": "https://zed.dev/schema/themes/v0.1.0.json",
"name": "Vesper",
"author": "Rauno Freiberg",
"themes": [
{
"name": "Vesper",
"appearance": "dark",
"style": {
"border": "#101010",