Skip to content

Instantly share code, notes, and snippets.


Nathan Borror nathanborror

View GitHub Profile

Key repeat

defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)

Requires restart.

Hide desktop

nathanborror /
Last active May 31, 2022 15:50
How to setup a new Go project using Google Cloud Run and Cloud SQL.

Go Google Cloud

How to setup a new Go project using Google Cloud Run and Cloud SQL.

Setup a new project

Update gcloud and authenticate

$ gcloud components update
$ gcloud auth login
View flip.swift
struct FlippedUpsideDown: ViewModifier {
func body(content: Content) -> some View {
.scaleEffect(x: -1, y: 1, anchor: .center)
extension View {
func flipUpsideDown() -> some View {
nathanborror / ContentView.swift
Last active October 30, 2022 13:26
SwiftUI wrapper around Slack's PanModal (
View ContentView.swift
import SwiftUI
import PanModal
struct ExampleView: View {
@State var detail: AnyView? = nil
@State var items: [String] = ["Detail 1", "Detail 2", "Detail 3"]
var body: some View {
NavigationView {

iOS Launch Screen

Steps taken to unofficially localize:

  1. Create a new InfoPlist.strings file
  2. Add the following line to that file:
UILaunchStoryboardName = "LaunchScreen";
View AdaptToKeyboard.swift
import SwiftUI
import Combine
struct AdaptToKeyboard: ViewModifier {
@State var currentHeight: CGFloat = 0
func body(content: Content) -> some View {
nathanborror / playground.swift
Last active January 3, 2023 22:16
Custom UIKit view with child SwiftUI views
View playground.swift
import UIKit
import SwiftUI
import PlaygroundSupport
// CustomParentView is a custom UIKit view. Its Coordinator can be used
// to manage delegates if needed (e.g. UIContextMenuInteractionDelegate).
struct CustomParentView<Content: View>: UIViewRepresentable {
let content: UIView
nathanborror / sm-2.swift
Last active February 11, 2018 00:13
SM-2 Algorithm
View sm-2.swift
// Based on the SuperMemo 2 Algorithm:
import UIKit
struct Item {
let id: UUID
let prompt: String
let explaination: String
var score: Score
nathanborror / delay.swift
Created January 30, 2018 18:42
Simulate Slow Connection
View delay.swift
let task = URLSession.shared.dataTask(with: req) { (data, response, error) in
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(4)) {
nathanborror / instructions.txt
Last active May 17, 2023 00:55
Example Kubernetes setup with Postgres and two Services for serving an API and a static site using Ingress. Also have a CronJob example for kicks.
View instructions.txt
*** Cluster Setup for Google Container Engine ***
0/ Install and configure local gcloud and kubectl:
> gcloud components install kubectl
1/ Configure Google Cloud account:
> gcloud config set account YOUR_EMAIL_ADDRESS
> gcloud config set project YOUR_PROJECT_ID
> gcloud config set compute/zone us-west1-a
> gcloud config set container/cluster example