Skip to content

Instantly share code, notes, and snippets.

@ghoseb
ghoseb / ns-cheatsheet.clj
Last active May 20, 2024 13:01 — forked from alandipert/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.
@alexnodejs
alexnodejs / async-calls
Created May 14, 2015 00:00
Wait for multiple async calls and do something after that (Swift)
let url = NSURL(string: "https://www.google.net")
let request = NSURLRequest(URL: url!)
let group = dispatch_group_create()
for index in 1...100 {
dispatch_group_enter(group)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {(response, data, error) in
println("\(index) complete")
dispatch_group_leave(group)
}