Skip to content

Instantly share code, notes, and snippets.

View RobertMenke's full-sized avatar
🎯
Focusing

Robert Menke RobertMenke

🎯
Focusing
View GitHub Profile
@RobertMenke
RobertMenke / websocket-close-event-codes.js
Created September 9, 2018 14:44
Defines constants for all websocket close event codes that are used in practice
// Defines constants for all websocket close event codes that are used in practice
// Link: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
/**
* Normal closure; the connection successfully completed whatever purpose for which it was created.
*/
const NORMAL_CLOSURE = 1000
/**
* The endpoint is going away, either because of a server failure
@RobertMenke
RobertMenke / query-param.codable.swift
Last active February 28, 2023 10:24
Swift Codable to URL Query String
import Foundation
import DictionaryCoding
/// Note: This relies on the DictionaryCoding package https://github.com/elegantchaos/DictionaryCoding
struct QueryParamEncoder {
func encode<T: Encodable>(_ item: T) throws -> String {
let encoder = DictionaryEncoder()
let encoded: [String: Any] = try encoder.encode(item)
let queryParams = encodeDictionary(encoded)
@RobertMenke
RobertMenke / ProgressStepper.swift
Created January 16, 2021 21:43
SwiftUI Progress Stepper Demo
import SwiftUI
/// Diameter of the circle that represents an individual step in the stepper
private let ITEM_DIAMETER: CGFloat = 24
/// Intended to be implemented by an enum that models each step in a progress stepper
protocol ProgressStepperDescriptor {
/// Get all steps for a given instance. This allows an enum to provide some subset of its cases to the stepper rather than
/// assuming that MyEnum.allCases is always representative of what the user sees.
func getSteps() -> [ProgressStepperDescriptor]
@RobertMenke
RobertMenke / skhdrc
Created December 21, 2023 20:17
skhd config
# -- Changing Window Focus --
# change window focus within space
alt + ctrl - k : yabai -m window --focus north
alt + ctrl - l : yabai -m window --focus east
alt + ctrl - j : yabai -m window --focus south
alt + ctrl - h : yabai -m window --focus west
#change focus between external displays (left and right)
alt + ctrl + shift - n: yabai -m display --focus east