This file contains hidden or 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
| 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"] |
This file contains hidden or 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
| var arrayToFlatten = [ | |
| 'item', | |
| { | |
| someKey: 'someValue', | |
| arrayKey: [ 'h', 'e', 'l', 'l', 'o' ] | |
| }, | |
| undefined, | |
| null, | |
| 1234, | |
| [ 5, 6, 7, 8 ], |
This file contains hidden or 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
| # 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']) | |
| } |
This file contains hidden or 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
| 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 |
NewerOlder