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
| #!/bin/sh | |
| # Pomodoro timer | |
| osascript -e 'display notification "💰💸" with title "GO" sound name "Hero"' | |
| sleep 1500 | |
| osascript -e 'display notification "🎉🎈🎋🎊" with title "STOP" sound name "Ping"' | |
| sleep 300 |
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
| $ curl -s https://gist.github.com/lmarburger/6537333/raw/time.sh | bash | |
| == Fastly == | |
| DNS: 0.156 CONNECT: 0.189 REQSENT: 0.488 STARTTX: 2.860 TOTAL: 5.583 | |
| X-Served-By: cache-v43-ASH, cache-ny58-NYC | |
| X-Cache: MISS, MISS | |
| DNS: 0.001 CONNECT: 0.040 REQSENT: 0.129 STARTTX: 0.174 TOTAL: 1.321 | |
| X-Served-By: cache-v43-ASH, cache-ny57-NYC | |
| X-Cache: MISS, HIT |
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
| specs.4.8 | |
| prerelease_specs.4.8 | |
| versions.list | |
| names.list | |
| specs | |
| deps | |
| gems | |
| *.sha512 |
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
| class Base | |
| def call | |
| 'call' | |
| end | |
| end | |
| p Base.new.call #=> "call" | |
| # Monkeypatching "works" but doesn't provide access to #super |
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
| # encoding: utf-8 | |
| input = [ 1, 2, 3, 4, 5, 8, 9, 11, 12, 13, 15 ] | |
| # Need to box the value to make it mutable | |
| State = Struct.new(:last_value) | |
| # divide the input into runs of consecutive numbers | |
| slices = input.slice_before(State.new(input.first)) do |value, state| | |
| consecutive = value == state.last_value.succ |
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
| exec_last_feature_or_test(){ | |
| history|sort -r|sed -s 's/^ [0-9]* //'|while read i;do if [[ "$i" =~ ^ruby || "$i" =~ ^cucumber ]];then echo $i|sh;exit;fi;done | |
| } |
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
| foldingStartMarker = '/\*(\*|\s+\w)(?!\*)|\{\s*($|/\*(?!.*?\*/.*\S))'; | |
| foldingStopMarker = '(?<!\*)\*\*/|/\*\s+-+\s+\*/|^\s*\}'; | |
| Update these expressions so they also recongize: | |
| foldingStartMarker: | |
| /* section: something variable | |
| ---------------------------------------------- */ |
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
| // Before vim-javascript | |
| method(arg1, arg2, | |
| arg3); | |
| // After vim-javascript | |
| method(arg1, arg2, | |
| arg3); | |
| // After (Not sure I like this) |
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
| # Single-level flatten | |
| arr = [ [1], [2,3], [4, [5]] ] | |
| # Too flat! | |
| arr.flatten # => [1, 2, 3, 4, 5] | |
| # Just right! | |
| arr.inject([]){|a,e| a.concat(e)} # => [1, 2, 3, 4, [5]] |
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
| #friends = Array.new | |
| #current_user.connections.each do |c| | |
| #friends.push([c.friend.full_name, c.user_id]) | |
| friends = current_user.connections.map do |c| | |
| [ c.friend.full_name, c.user_id ] | |
| end | |
| friends = friends.sort do |a, b| | |
| a[0] <=> b[0] |
NewerOlder