Skip to content

Instantly share code, notes, and snippets.

@ninjitaru
ninjitaru / clean_pod_install
Created November 8, 2013 02:58
pod install step that also clean its cache
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod
@ninjitaru
ninjitaru / gist:7715907
Created November 30, 2013 06:06
git bash completion
after install it using
brew install git bash-completion
remember to add
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
@ninjitaru
ninjitaru / gist:8629482
Last active January 4, 2016 13:39
git add deleted files
git rm $(git ls-files --deleted)
git ls-files --deleted --exclude-standard -z | while read -r -d '' file; do
git rm "$file"
done
@ninjitaru
ninjitaru / gist:761d76ac3219a969d054
Last active August 29, 2015 14:01
build facebook aar
cd facebook-sdk/facebook
open build.gradle modify buildToolsVersion
run gradle from compatable version
gradle build
facebook.aar is in build/libs/
// only need 112 bit for 14 ascii character
LDPC_Parity_Irregular H;
H.generate(224,
"0 0.27684 0.28342 0 0 0 0 0 0.43974",
"0 0 0 0 0 0.01568 0.85244 0.13188",
"rand", // random unstructured matrix
"500 8"); // optimize girth
LDPC_Generator_Systematic G(&H);
LDPC_Code C(&H, &G);
C.set_exit_conditions(2500);
@ninjitaru
ninjitaru / gist:88879b4e3cca35ba2e08
Created November 9, 2014 09:04
gen localized string on xcode
genstrings -o zh-Hant.lproj *.m
@ninjitaru
ninjitaru / gist:b82557a6ccad653bc2a0
Last active August 29, 2015 14:11
iOS 8+ open app setting
if(&UIApplicationOpenSettingsURLString) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
const { redis, getSubscriber, subscribeWithSubscriber, publish } = require('applib/redis');
const _ = require('lodash');
// 1 ~ 80ms
// 10 ~ 80ms
// 100 ~ 80ms
// 1000 ~ 90ms
// 10000 ~ 200ms
// spread across 10 client
{
reservations/-Kl2_DOjdmBh4Rlj58C1/-Kl2_DOjdmBh4Rlj58C2/-LuuTCKCHkZS-_MRRLLH/autoTableIds: [
0: "-Kl7-4NnyHWpkLXNXzVj"
]
reservations/-Kl2_DOjdmBh4Rlj58C1/-Kl2_DOjdmBh4Rlj58C2/-Luuw9YunML-YZ7Jy6Al/autoTableIds: [
0: "-Kl3S7kPpTA9V_570Q7e"
1: "-Kl3S8vGcRe0f4WnEe-Z"
2: "-Kl3SAkzCGky85zAR41B"
3: "-Kl7-7CYtKKHM4-HIUT9"
]
{
reservations/-Kl2_DOjdmBh4Rlj58C1/-Kl2_DOjdmBh4Rlj58C2/-LuuTCKCHkZS-_MRRLLH/autoTableIds: [
0: "-Kl7-4NnyHWpkLXNXzVj"
]
reservations/-Kl2_DOjdmBh4Rlj58C1/-Kl2_DOjdmBh4Rlj58C2/-Luuw9YunML-YZ7Jy6Al/autoTableIds: [
0: "-Kl3S7kPpTA9V_570Q7e"
1: "-Kl3S8vGcRe0f4WnEe-Z"
2: "-Kl3SAkzCGky85zAR41B"
3: "-Kl7-7CYtKKHM4-HIUT9"
]