Skip to content

Instantly share code, notes, and snippets.

View kevinmbeaulieu's full-sized avatar

Kevin Beaulieu kevinmbeaulieu

View GitHub Profile
@kevinmbeaulieu
kevinmbeaulieu / .lldbinit
Last active July 6, 2022 19:40
LLDB utilities
# Shortcuts to force execution in an Objective-C context instead of Swift (assuming current context is Swift)
command alias eobjc e -l objc
command alias pobjc e -l objc --
command alias poobjc e -l objc -O --
# Call while paused on closing } of a function to print return value
# TODO: Fix this, as $rax doesn't seem to be recognized anymore
# command alias retval p $rax
# Usage: let <variable-name> <memory-address> <type-name>
@kevinmbeaulieu
kevinmbeaulieu / Injector.swift
Last active March 3, 2023 22:27
Thumbtack Swift Dependency Injector
import Foundation
/// Thread-safe Swift dependency injector
///
/// **Using Injector**
/// 1. Call `Injector.setup()` early in the application lifecycle.
/// 2. In dependency classes, conform to one of `Injectable`, `Singleton`, `WeakSingleton`, `EagerSingleton`.
/// 3. In application code, construct dependencies using property injection like:
/// ```
/// private let logger: TTLogger = inject()
@kevinmbeaulieu
kevinmbeaulieu / ddd
Last active July 6, 2022 16:54
Delete derived data
#!/bin/sh
# To install, run:
# sudo install ddd /usr/local/bin
set -euo pipefail
print_usage() {
cat <<EOF
usage: ddd [<options>] [<project>]
@kevinmbeaulieu
kevinmbeaulieu / Git Extensions.md
Last active September 1, 2022 18:32
Git Extensions

Git shortcuts/custom commands

Installation:

  1. Download and unzip gist
  2. In the unzipped folder, run sh install.sh
  3. Add the following line to your .zshrc/.bashrc file: export PATH="$HOME/.git-commands:$PATH"
@kevinmbeaulieu
kevinmbeaulieu / notify
Last active May 11, 2023 14:34
Command to display a notification on macOS
# Copy this function and paste into your `.zshrc`/`.bashrc`
function notify () {
if [ $# -ge 1 ]
then
osascript -e "display notification \"$1\" with title \"Terminal\""
else
osascript -e "display notification \"Command finished.\" with title \"Terminal\""
fi
}