Skip to content

Instantly share code, notes, and snippets.

View mccaffers's full-sized avatar
👋
Hey!

Ryan McCaffery mccaffers

👋
Hey!
View GitHub Profile
@mccaffers
mccaffers / screenshot-every-minute-macos.sh
Last active May 12, 2024 09:56
Bash script to take a screenshot on macOS every minute, converts to webp
# Take a screenshot on macOS every minute
# converts the screenshot to webp to reduce file size
while :;
do
name=$(date +%m\-%d\-%y\_%H.%M.%S);
screencapture -m -D 1 -t png ~/Desktop/screenshots/$name.png;
convert ~/Desktop/screenshots/$name.png ~/Desktop/screenshots/$name.webp;
rm -rf ~/Desktop/screenshots/$name.png;
sleep 60;
done
@mccaffers
mccaffers / ios-unit-test.sh
Last active April 16, 2024 16:29
Unit test iOS from the command line
# Wipe the simulators
xcrun simctl erase all
# Run the unit tests
xcodebuild -scheme TestProject \
-destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \
-resultBundlePath TestResult/ \
-enableCodeCoverage YES \
clean build test \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
@mccaffers
mccaffers / forwarder.mjs
Last active October 7, 2023 07:38
AWS Lambda Request Forwarder
'use strict'
import http from "https";
import zlib from "zlib";
/* global atob */
function queryString (kvPairs) {
const result = []
for (let key in kvPairs) {
@mccaffers
mccaffers / dismiss-multiple-sheets-snippet.swift
Last active May 17, 2024 11:58
SwiftUI - Dismiss multiple sheets (modals) at once
// Swiftui Tricks
// Dimiss multiple sheets
if let firstScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
if let firstWindow = firstScene.windows.first {
let viewController = firstWindow.rootViewController
viewController?.dismiss(animated: true)
}
}