Skip to content

Instantly share code, notes, and snippets.

View kwakueshun's full-sized avatar
🏠
Working from home

Samuel Eshun kwakueshun

🏠
Working from home
View GitHub Profile
@gdavis
gdavis / xcode-vim.markdown
Last active May 26, 2024 12:16
Notes for working with Xcode VIM mode

Xcode VIM

Learning VIM in Xcode comes with its own set of challenges and limitations, but there is enough there for you to give your mousing hand a break and master the keyboard.

A limited set of commands are available in Xcode, and this document attempts help ease the learning curve of using VIM in Xcode by providing a handy reference as well as what I find works for me in practice.

NOTE: Commands are case-sensitive. A command of N means pressing shift + n on the keyboard.

This document is a work in progress! Leave a comment if you would like to see a change.

@IanKeen
IanKeen / FocusState.swift
Last active June 30, 2023 17:00
SwiftUI: FocusedState shim for < iOS15
import Combine
import SwiftUI
extension View {
public func focused<T>(file: StaticString = #file, _ state: FocusState<T>, equals value: T) -> some View {
modifier(FocusedModifier(state: state, id: value, file: file))
}
}
@propertyWrapper
@DakotaLMartinez
DakotaLMartinez / instructions.md
Last active May 20, 2024 23:48
Adding an SSH key to GitHub (Mac OS X or Linux)

You need to do this if you try this command:

ssh -T git@github.com

and you get something that says

git@github.com: Permission denied (public key).
@telugu-boy
telugu-boy / chapters_to_playlist.py
Last active March 9, 2024 10:39
takes youtube video with chapters and downloads and splits into playlist based on the chapter timestamps
# https://www.github.com/telugu-boy/
import youtube_dl
import getopt
import sys
import os
# https://www.youtube.com/watch?v=obLq6k3clHo
ydl_opts = {
@nathanhleung
nathanhleung / FIX-MACOS-HANG.md
Last active February 24, 2024 08:25
Fix macOS Hanging Issue

Fix macOS Hanging Issue

Problem

Hey Apple users:

If you're now experiencing hangs launching apps on the Mac, I figured out the problem using Little Snitch.

It's trustd connecting to http://ocsp.apple.com >

//
// ContentView.swift
// Widgets
//
// Created by Kyle Halevi on 7/3/20.
//
import SwiftUI
struct Widget: View {
# Script to download all the WWDC 2020 session videos in the highest 4K video and audio
# You may have to update ffmpeg before using this script. I needed version 4.3 or higher to successfully download the videos.
#
# If you want the lower bitrate audio, do a find/replace of "audio_english_192" with "audio_english_64"
# If you want lower bitrate or lower resolution video, do a find/replace of "hvc_2160p_16800" with any of the following:
# "hvc_2160p_11600"
# "hvc_1440p_8100"
# "hvc_1080p_5800"
# "hvc_1080p_4500"
# "hvc_720p_3400"
@IanKeen
IanKeen / CustomKeyCodable.swift
Last active February 1, 2022 18:27
PropertyWrapper: CustomKeyCodable allows defining the keys for decoding _per property_
protocol CustomKeyCodable: Codable {
init()
}
extension CustomKeyCodable {
init(from decoder: Decoder) throws {
self.init()
let container = try decoder.container(keyedBy: AnyCodingKey.self)
let mirror = Mirror(reflecting: self)
@IanKeen
IanKeen / LosslessCodable.swift
Last active May 22, 2024 20:06
PropertyWrapper: LosslessCodable attempts to brute force convert the incoming value to the required type - the underlying type is maintained and used when encoding the value back
public typealias LosslessStringCodable = LosslessStringConvertible & Codable
@propertyWrapper
public struct LosslessCodable<Value: LosslessStringCodable>: Codable {
private let type: LosslessStringCodable.Type
public var wrappedValue: Value
public init(wrappedValue: Value) {
self.wrappedValue = wrappedValue
@mattt
mattt / UIViewControllerPreview.swift
Last active January 8, 2024 23:09
Generic structures to host previews of UIView and UIViewController subclasses.
import UIKit
#if canImport(SwiftUI) && DEBUG
import SwiftUI
struct UIViewControllerPreview<ViewController: UIViewController>: UIViewControllerRepresentable {
let viewController: ViewController
init(_ builder: @escaping () -> ViewController) {
viewController = builder()
}