Skip to content

Instantly share code, notes, and snippets.

View byaruhaf's full-sized avatar
🏄
Surfing Xcode

Franklin Byaruhanga byaruhaf

🏄
Surfing Xcode
View GitHub Profile
@byaruhaf
byaruhaf / debouncingTextField.swift
Created September 17, 2022 16:53 — forked from carlynorama/debouncingTextField.swift
Debouncing Text Field
//
// DebouncingTextField.swift
// LocationSearchResults
//
// Created by Labtanza on 8/13/22.
// https://stackoverflow.com/questions/66164898/swiftui-combine-debounce-textfield
// https://stackoverflow.com/questions/62635914/initialize-stateobject-with-a-parameter-in-swiftui
import SwiftUI
@byaruhaf
byaruhaf / backtracking_template.py
Created June 5, 2022 18:57 — forked from RuolinZheng08/backtracking_template.py
[Algo] Backtracking Template & N-Queens Solution
def is_valid_state(state):
# check if it is a valid solution
return True
def get_candidates(state):
return []
def search(state, solutions):
if is_valid_state(state):
solutions.append(state.copy())
@byaruhaf
byaruhaf / pre-commit
Created April 22, 2022 11:09 — forked from samwize/pre-commit
Git Pre-Commit hook with SwiftLInt
#!/bin/bash
SWIFT_LINT=./Pods/SwiftLint/swiftlint
if [[ -e "${SWIFT_LINT}" ]]; then
count=0
for file_path in $(git ls-files -m --exclude-from=.gitignore | grep ".swift$"); do
export SCRIPT_INPUT_FILE_$count=$file_path
count=$((count + 1))
done
@byaruhaf
byaruhaf / Brewfile
Created November 9, 2021 02:43 — forked from cliss/Brewfile
Casey Liss's Brewfile, as of 31 October 2021
cask_args appdir: "/Applications"
tap "homebrew/cask-fonts"
brew "mas"
#### LAPTOPS ####
#cask "tripmode"
#### LAPTOPS ####
mas "Boop", id: 1518425043
@byaruhaf
byaruhaf / CustomPhotoPickerView.swift
Created January 7, 2021 14:38 — forked from felix-larsen/CustomPhotoPickerView.swift
PHPhotoPicker metadata example
import SwiftUI
import PhotosUI
struct CustomPhotoPickerView: UIViewControllerRepresentable {
@Binding var selectedImage: UIImage?
@Binding var date: Date?
@Binding var location: CLLocationCoordinate2D?
@Environment(\.presentationMode) var presentationMode
@byaruhaf
byaruhaf / IntegerTextField.swift
Created December 21, 2020 12:55 — forked from grosch/IntegerTextField.swift
SwiftUI TextField which only accepts integers and binds to an Int? instead of a String
import SwiftUI
private class IntegerTextFieldValue: ObservableObject {
@Published var value = "" {
didSet {
let numbersOnly = value.filter { $0.isNumber }
if value != numbersOnly {
value = numbersOnly
}
}
@byaruhaf
byaruhaf / shh.rb
Created December 20, 2020 07:55 — forked from robinsloan/shh.rb
Disable RTs from all the people you follow on Twitter.
require "rubygems"
require "twitter"
# get these from apps.twitter.com
CONSUMER_KEY = "foo"
CONSUMER_SECRET = "bar"
OAUTH_TOKEN = "blee"
OAUTH_TOKEN_SECRET = "baz"
TWITTER_USER = "your_username" # needs to be the one associated with keys above
@byaruhaf
byaruhaf / RevealBuildPhase.sh
Created December 13, 2020 02:27 — forked from Ashton-W/RevealBuildPhase.sh
Build Phase Script for copying and signing libReveal in Debug Configuration
#!/usr/bin/env bash
# Build Phase Script for copying and signing libReveal based on Configuration
# https://gist.github.com/Ashton-W/6db611ac93be2f8bad7f
set -o errexit
set -o nounset
LIBREVEAL_PATH="/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib"
INJECT_REVEAL="${INJECT_REVEAL:-NO}"