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
val regex = """mongodb://(\w+):([\w|-]+)@([\w|\.]+):(\d+)/(\w+)""".r | |
url match { | |
case Some(regex(u, p, host, port, dbName)) => | |
ConnectionParams(host, port.toInt, dbName, u, p) | |
case None => { | |
ConnectionParams("127.0.0.1", 27017, "mylocaldb") | |
} |
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/env python | |
import json | |
import fileinput | |
def compact(raw): | |
parsed = json.loads(raw) | |
compacted = json.dumps(parsed, separators=(',',':')) | |
return compacted |
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
new_list = [number for row in numbers | |
for number in row] |
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 load-resource | |
[name] | |
(let [rsc-name (str "somefolder/" name) | |
thr (Thread/currentThread) | |
ldr (.getContextClassLoader thr)] | |
(.getResourceAsStream ldr rsc-name))) |
NewerOlder