This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mac Network Commands Cheat Sheet | |
After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty. | |
Get an ip address for en0: | |
ipconfig getifaddr en0 | |
Same thing, but setting and echoing a variable: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://code.google.com/p/android/issues/detail?id=156708 | |
# http://stackoverflow.com/questions/16736856/what-should-be-in-my-gitignore-for-an-android-studio-project | |
*.iml | |
.gradle | |
/local.properties | |
/.idea/workspace.xml | |
/.idea/libraries | |
.DS_Store | |
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn partition-every | |
"adapted from clojure core version of partition-by | |
partition a collection every time a predicate returns true | |
=> (partition-every keyword? [:a 1 2 3 :b :c 4 5 6 7 :d :e]) | |
((:a 1 2 3) (:b) (:c 4 5 6 7) (:d) (:e))" | |
[pred coll] | |
(lazy-seq | |
(when-let [s (seq coll)] | |
(let [fst (first s) | |
run (cons fst (take-while (complement pred) (next s)))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cycle detection function | |
* Outputs count and grouped cycles with a from key path and to key path. | |
* The executing browser should have console.group and .groupEnd functions. | |
* | |
* Based on: | |
* http://stackoverflow.com/questions/14962018/detecting-and-fixing-circular-references-in-javascript/14962496#14962496 | |
* | |
* @param {Object} obj Any js object | |
* @return {void} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;=> (let-map [i (range 5)] (inc i)) | |
;(1 2 3 4 5) | |
;=> (def books '({:name "The Great Gatsby" :href "urlA"} | |
; {:name "The Unbearable Lightness of Being" :href "urlB"})) | |
;=> (let-map [b books] [:li [:a {:href (:href b)} (:name b)]]) | |
;([:li [:a {:href "urlA"} "The Great Gatsby"]] [:li [:a {:href "urlB"} "The Unbearable Lightness of Being"]]) | |
(defmacro let-map | |
[decl form] | |
"Usage: (let-map [i (range 5)] (inc i))" |