Skip to content

Instantly share code, notes, and snippets.

@voidless
voidless / git-abort
Created December 27, 2019 13:51
Git continue/abort scripts (put in a folder added to PATH)
#!/bin/bash
repo_path=$(git rev-parse --git-dir)
if [ $? -ne 0 ]; then
exit $?
fi
if [ -d "${repo_path}/rebase-merge" ]; then
git rebase --abort
@voidless
voidless / gist:6cc3a529f560bd7c89acee4b51ff72f7
Created December 26, 2018 10:10
Dynamic type font style sizes
==========================================================================================================
#### category: UICTContentSizeCategoryAccessibilityXXXL
fontsize: UIFontTextStyleTitle1 58.000000
fontsize: UIFontTextStyleTitle2 56.000000
fontsize: UIFontTextStyleTitle3 55.000000
fontsize: UIFontTextStyleBody 53.000000
fontsize: UIFontTextStyleHeadline 53.000000
fontsize: UIFontTextStyleCallout 51.000000
fontsize: UIFontTextStyleSubheadline 49.000000
fontsize: UIFontTextStyleFootnote 44.000000
@voidless
voidless / symbolicate-ios.sh
Created July 3, 2017 12:08
Symbolicate iOS crash
# xcode symbolicate
function symbolicate() {
XCODE_PATH=/Applications/Xcode.app
DEVELOPER_DIR=$XCODE_PATH/Contents/Developer $XCODE_PATH/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/Current/Resources/symbolicatecrash $1 2>/dev/null
}
@voidless
voidless / git-merged-diff.sh
Created November 12, 2015 12:09
git-merged-diff X Y - Show branches, merged in branch X and not merged in branch Y
# Example: git-merged-diff development master
function git-merged-diff() {
ONE_BRANCHES=$(git branch -a --merged $1 | grep -v $1 | sed 's:remotes/origin/::g' | ack -io '(?<=^ [ *])[a-z/_-]+' | sort | uniq)
TWO_BRANCHES=$(git branch -a --merged $2 | grep -v $2 | grep -v $1 | sed 's:remotes/origin/::g' | ack -io '(?<=^ [ *])[a-z/_-]+' | sort | uniq)
echo "==== Branches currently in $2 but not in $1:"
comm -13 <(echo $ONE_BRANCHES) <(echo $TWO_BRANCHES)
}
@voidless
voidless / NSDateFormatter+Helpers.m
Last active November 12, 2015 12:10
NSDateFormatter for server api
+ (NSDateFormatter *)serverDateTimeFormatter
{
static NSDateFormatter *formatter;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
formatter = [NSDateFormatter new];
formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
formatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
formatter.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
@voidless
voidless / commit-msg
Last active September 17, 2015 14:15
Git commit hook to add branch name
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".