(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| <script> | |
| var=(!-[1,]), | |
| if (var) | |
| { | |
| alert(This is not IE explorer.) | |
| }else{ | |
| alert(This is IE explorer.) | |
| } | |
| </script> |
| #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; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #!/bin/bash | |
| # | |
| # 通过对比 ping 响应时间,找到本机最快的上传ip | |
| # Travis@fir.im | |
| # | |
| function refresh_host() | |
| { | |
| IP="$1" | |
| UPLOAD_HOST="upload.qiniu.com" |
| // 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 | |
| } |
| // 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 |
| 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 |
| [ | |
| { | |
| "coordinates":null, | |
| "truncated":false, | |
| "created_at":"Tue Aug 28 21:16:23 +0000 2012", | |
| "favorited":false, | |
| "id_str":"240558470661799936", | |
| "in_reply_to_user_id_str":null, | |
| "entities":{ | |
| "urls":[ |
| This was nice and fast... but it takes up WAY TOO MUCH space. And it's annoying to write. | |
| (I like the way I can just step into the function that calls the delegate for debugging) | |
| What's a better way to not make me call respondsToSelector in the middle of my code? Some proxy? | |
| struct { | |
| unsigned int delegateWillDisplayDocument:1; | |
| unsigned int delegateDidDisplayDocument:1; | |
| unsigned int delegateDidShowPageView:1; | |
| unsigned int delegateDidRenderPageView:1; |
| - (void)resetCoreData { | |
| DDLogInfo(@"[RESET-COREDATA] Started."); | |
| [MagicalRecord cleanUp]; | |
| NSURL *storeURL = [NSPersistentStore MR_urlForStoreName:kMobilStoreName]; | |
| NSURL *walURL = [[storeURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sqlite-wal"]; | |
| NSURL *shmURL = [[storeURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"sqlite-shm"]; | |