Skip to content

Instantly share code, notes, and snippets.

var UrlsClass = function(urls) {
if (this.window === this) {
return new Error("You should use the word new!");
}
this.urls = urls;
};
// ["A", "B", "A", "C"]
// getUrls(10) -> ["C", "A", "B"]
var arrayToFlatten = [
'item',
{
someKey: 'someValue',
arrayKey: [ 'h', 'e', 'l', 'l', 'o' ]
},
undefined,
null,
1234,
[ 5, 6, 7, 8 ],
# this is my array
posts = [{"name"=> "Post1", "start_on"=>"2015-08-11 10:50:00"}, {"name"=>"Post2", "start_on"=>"2015-08-11 10:50:00"}, {"name"=> "Post3", "start_on"=>"2015-08-14 11:00:00"}, {"name"=> "Post4", "start_on"=>"2015-08-14 11:00:00"}]
# this method should group posts by start_on property
def group(posts)
posts.group_by { |p|
puts "TEST"
puts p.inspect
Time.parse(p['start_on'])
}
@nenadjaja
nenadjaja / gist:6542230
Created September 12, 2013 18:55
Git config for user ndjaja
alias.l=log --pretty=oneline -n 20 --graph --abbrev-commit
alias.s=status -s
alias.d=!git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat
alias.di=!d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d
alias.p=!git pull; git submodule foreach git pull origin master
alias.c=clone --recursive
alias.ca=!git add -A && git commit -av
alias.go=checkout -B
alias.tags=tag -l
alias.branches=branch -a