Skip to content

Instantly share code, notes, and snippets.

View wongzigii's full-sized avatar
🎯
Focusing

W0n9 wongzigii

🎯
Focusing
  • Loopring
View GitHub Profile
@wongzigii
wongzigii / Find out the most commonly use linux command
Last active October 7, 2016 14:18
Find out the most commonly use linux command
history | awk '{CMD[$2]++;count++;}END { for (a in CMD) print CMD[a] "" CMD[a]/count*100"% "a;}' | grep -v "./" | column -c3 -s "" -t | sort -nr | nl | head -n 30
@wongzigii
wongzigii / Profiling your Swift compilation times
Last active October 7, 2016 14:17
Profiling your Swift compilation times
// Steal from http://irace.me/swift-profiling
xcodebuild -workspace App.xcworkspace -scheme App clean build OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" | grep .[0-9]ms | grep -v ^0.[0-9]ms | sort -nr > culprits.txt
// Origin from http://mjtsai.com/blog/2016/05/24/swift-tuples-arent-equatable/
extension SequenceType {
/// Returns `true` iff an element in `self` satisfies `predicate`.
@warn_unused_result
public func contains(@noescape predicate: (Self.Generator.Element) throws -> Bool) rethrows -> Bool
}
@wongzigii
wongzigii / turbo-qiniu.sh
Created March 10, 2016 13:35 — forked from trawor/turbo-qiniu.sh
本脚本解决部分地区七牛上传速度慢的问题
#!/bin/bash
#
# 通过对比 ping 响应时间,找到本机最快的上传ip
# Travis@fir.im
#
function refresh_host()
{
IP="$1"
UPLOAD_HOST="upload.qiniu.com"
@wongzigii
wongzigii / introrx.md
Created November 1, 2015 15:50 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@wongzigii
wongzigii / Benchmark of Lock Performance Test
Last active October 7, 2016 14:18
Benchmark of Lock Performance Test
#import <objc/runtime.h>
#import <objc/message.h>
#import <libkern/OSAtomic.h>
#import <pthread.h>
#define ITERATIONS (1024*1024*32)
- (void)testLock
{
double then, now;
unsigned int i, count;
@wongzigii
wongzigii / IEJudge
Last active August 29, 2015 14:05
IE judge
<script>
var=(!-[1,]),
if (var)
{
alert(This is not IE explorer.)
}else{
alert(This is IE explorer.)
}
</script>