Skip to content

Instantly share code, notes, and snippets.

View gohanlon's full-sized avatar

Galen O’Hanlon gohanlon

  • Portland, OR
  • 01:58 (UTC -08:00)
View GitHub Profile
@Nezteb
Nezteb / elixir-language-server-comparison.md
Last active September 9, 2025 16:14
Elixir Language Server Comparisons

Update 2

As of August 28th, 2025, Expert LSP has been released: https://github.com/elixir-lang/expert

Although still a work in progress, the plan is for the other three LS implementations to be archived. I may try to come up with a new way to track Expert's featureset, but I would probably contribute that back to Expert as documentation.

Update

As of August 15, 2024, it's been announced that the three projects bein compared here will soon merge! See the official Elixir blog post for more details: https://elixir-lang.org/blog/2024/08/15/welcome-elixir-language-server-team/

Swift’s memberwise initializer and the extension dance

Swift's automatically provided memberwise initializer is a powerful feature. However, when an explicit initializer is present, Swift omits its memberwise initializer:

struct Person: Decodable {
  let name: String

  enum CodingKeys: CodingKey {
    case name
@veekaybee
veekaybee / normcore-llm.md
Last active December 7, 2025 16:13
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

@adrienbrault
adrienbrault / llama2-mac-gpu.sh
Last active April 8, 2025 13:49
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM. UPDATE: see https://twitter.com/simonw/status/1691495807319674880?s=20
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
make clean
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
@tgrapperon
tgrapperon / LoadAndNavigateStyle.swift
Last active September 9, 2025 21:39
This gist demonstrates how to achieve a "Load and Navigate" navigation style using `NavigationStack` on iOS 16.
// This file is self contained and can be copy/pasted in place of the `ContentView.swift` in a default iOS 16/macOS 13 app.
import SwiftUI
struct ContentView: View {
@State var path: NavigationPath = .init()
@State var isLoading1: Bool = false
@State var isLoading2: Bool = false
@State var isLoading3: Bool = false
@mattdesl
mattdesl / cli.js
Created September 13, 2022 10:37
colour palette from text prompt using Stable Diffusion https://twitter.com/mattdesl/status/1569457645182152705
/**
* General-purpose NodeJS CLI/API wrapping the Stable-Diffusion python scripts.
*
* Note that this uses an older fork of stable-diffusion
* with the 'txt2img.py' script, and that script was modified to
* support the --outfile command.
*/
var { spawn, exec } = require("child_process");
var path = require("path");
@lukeredpath
lukeredpath / PerceptualImage.swift
Created September 13, 2022 10:15
Perceptual image snapshot strategy
// Taken from https://github.com/pointfreeco/swift-snapshot-testing/pull/628/files
import Foundation
import SwiftUI
@testable import SnapshotTesting
#if os(iOS) || os(tvOS)
import CoreImage.CIFilterBuiltins
import UIKit
@ole
ole / Stateful.swift
Last active July 10, 2025 06:37
A wrapper view that provides a mutable Binding to its content closure. Useful in Xcode Previews for interactive previews of views that take a Binding. https://twitter.com/olebegemann/status/1565707085849010176
import SwiftUI
/// A wrapper view that provides a mutable Binding to its content closure.
///
/// Useful in Xcode Previews for interactive previews of views that take a Binding.
struct Stateful<Value, Content: View>: View {
var content: (Binding<Value>) -> Content
@State private var state: Value
init(initialState: Value, @ViewBuilder content: @escaping (Binding<Value>) -> Content) {
@myurieff
myurieff / InputField.swift
Last active May 29, 2023 10:18
SwiftUI TCA Validated Input Field
public enum InputField<Value: Equatable> {
/// The state of current input validation
public enum InputValidation: Equatable {
/// A value that has undergone validation and is found to be valid.
case valid(Value)
/// A value that has undergone validation and is found to be invalid.
/// Optionally, a feedback message can be displayed to the user
/// to let them know what the issue with their input is.
/// For example: "Please enter a value between 10 and 100."
case invalid(Value, feedback: String?)
@iampatbrown
iampatbrown / Reducer+BindingHelpers.swift
Created July 7, 2022 02:12
Helpers for creating reducers for BindableState
import ComposableArchitecture
import SwiftUI
extension Reducer {
/// Returns a reducer that applies ``BindingAction`` mutations to `LocalState` on `State`.
///
/// - Parameters:
/// - toLocalState: A key path that can get/set `LocalState` inside `State`.
/// - toLocalAction: A case path that can extract/embed `BindingAction` of `LocalState` from `Action`.
/// - Returns: A reducer that applies ``BindingAction`` mutations to `LocalState` on `State`.