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
/** | |
* @constructor | |
*/ | |
function Injector() { | |
/** | |
* @type {!Object.<string, function(Injector=): !Object>} | |
*/ | |
this.factories = {}; | |
/** | |
* @type {!Object.<string, !Object>} |
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 api-call-with-cb [api-call cb] | |
(go (let [resp (<! (api-call))] | |
(if (= 200 (:status resp)) | |
[(:body resp) nil] | |
[nil resp])))) | |
(defn api-fetch | |
([api-call cb] (api-call-with-cb api-call cb)) | |
([api-call] (api-call-without-cb api-call))) |
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
;; some speed tests of functions to access nested properties in JS objects. | |
(def test-data (->> (into {} (for [k1 (range 10)] | |
[k1 (into {} (for [k2 (range 10)] | |
[k2 (into {} (for [k3 (range 10)] | |
[k3 k3]))]))])) | |
(clj->js))) | |
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
#!/usr/bin/python | |
# Based on https://gist.github.com/provegard/1536682, which was | |
# Based on getifaddrs.py from pydlnadms [http://code.google.com/p/pydlnadms/]. | |
# Only tested on Linux! | |
from socket import AF_INET, AF_INET6, inet_ntop | |
from ctypes import ( | |
Structure, Union, POINTER, | |
pointer, get_errno, cast, |