Skip to content

Instantly share code, notes, and snippets.

View Lugghawk's full-sized avatar

Dave Lugg Lugghawk

  • Waterloo, Ontario
View GitHub Profile
//From here: http://stackoverflow.com/questions/9035627/elegant-method-to-generate-array-of-random-dates-within-two-dates
function randomDate(start, end) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
}
//Create a new date between Jan 1st, 2012 and Now.
randomDate(new Date(2012, 0, 1), new Date())
defmodule PMTest do
def apply_defaults(json_obj) do
Map.merge(json_obj, defaults, fn _,v1,v2 ->
case v1 do
nil -> v2
_ -> v1
end
end)
end
### Keybase proof
I hereby claim:
* I am lugghawk on github.
* I am davelugg (https://keybase.io/davelugg) on keybase.
* I have a public key whose fingerprint is 76CC D251 AF34 DF92 491D 4DBD 2F49 1A9F 3938 0912
To claim this, I am signing this object: