Skip to content

Instantly share code, notes, and snippets.

Dustin Barker dstnbrkr

Block or report user

Report or block dstnbrkr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:06ea186de6327b89bb79
target :'MyApplicationTestsHost', :exclusive => true do
end
@dstnbrkr
dstnbrkr / gist:ac579f689f1275eed71c
Created Mar 18, 2015
find files matching multiple name patterns
View gist:ac579f689f1275eed71c
find $DIR -type f \( -name '*.h' -o -name '*.mm' \)
@dstnbrkr
dstnbrkr / gist:5f9a3c91d43eca89afce
Created Mar 18, 2015
Loop through filenames with spaces
View gist:5f9a3c91d43eca89afce
# example: renaming files named {0, 0, 0, 0} to 0-0-0-0
find $DIR -type f | while read f
do
NEW=`echo $f | sed 's/[{}]*//g' | sed 's/, /-/g'`
git mv "$f" $NEW
done
@dstnbrkr
dstnbrkr / Makefile
Last active Sep 25, 2017
The Makefile we use for continuous integration and distribution at Artsy.net
View Makefile
PROJECT = Artsy
BUNDLE_ID = net.artsy.artsy.beta
CONFIGURATION = Beta
WORKSPACE = $(PROJECT).xcworkspace
SCHEME = $(PROJECT)
APP_PLIST = $(PROJECT)/App/$(PROJECT)-Info.plist
IPA = $(PROJECT).ipa
DSYM = $(PROJECT).app.dSYM.zip
@dstnbrkr
dstnbrkr / gist:2770652
Created May 22, 2012
predicate templates
View gist:2770652
// the query:
// foo amount:15
// first becomes an array of predicate templates
[ "${column} like '%foo%'", "${column} >= 14 and ${column} <= 16" ]
// next, we inspect the model to find which columns to search on
// and repeat each query for each property
View git-merge-combine
#!/bin/sh
# Combines two versions of a file by removing all conflict markers
# Usage: git-merge-combine MyProject.xcodeproj/project.pbxproj
FILE=$1
TMPFILE=$1.tmp
sed -e 's/<<<<<<< HEAD//; s/=======//g; s/>>>>>>> .*$//' $FILE > $TMPFILE
if [ $? -ne 0 ]; then
@dstnbrkr
dstnbrkr / xcode-usages
Created Dec 6, 2011
Find references to a resource
View xcode-usages
grep -Rl "$1" * | grep -v build | grep -v BankSimple.xcodeproj | grep -v Icon*.png | grep -v Assets
filename=$1
extension=${filename##*.}
filename=${filename%.*}
grep -Rl $filename * | grep -v build | grep -v BankSimple.xcodeproj | grep -v Icon*.png | grep -v Assets
@dstnbrkr
dstnbrkr / xcode-remove-unused
Created Dec 6, 2011
Remove unused resources from xcode project.
View xcode-remove-unused
#!/bin/sh
for f in `find Resources/Images -type f ! -name '*@2x.png' ! -name 'Default*.png'`; do
FILENAME=`basename $f`;
NUSAGES=`usages $FILENAME | wc -l | awk '{print $1}'`;
if [ $NUSAGES = 0 ]; then
echo $f;
fi;
done;
@dstnbrkr
dstnbrkr / UIColorFromRGB
Created Mar 28, 2011
Convert hex value to UIColor
View UIColorFromRGB
UIColor* UIColorFromRGB(NSInteger rgb) {
return [UIColor colorWithRed:((float) ((rgb & 0xFF0000) >> 16)) / 0xFF
green:((float) ((rgb & 0xFF00) >> 8)) / 0xFF
blue:((float) (rgb & 0xFF)) / 0xFF
alpha:1.0];
}
@dstnbrkr
dstnbrkr / fermat.rkt
Created Mar 4, 2011
fermat test for primality
View fermat.rkt
(define (is-fermat-prime? n iterations)
(or (<= iterations 0)
(if (= (modulo (expt (+ (random (- n 1)) 1) (- n 1)) n) 1)
(is-fermat-prime? n (- iterations 1))
#f)))
You can’t perform that action at this time.