Skip to content

Instantly share code, notes, and snippets.

View lmarburger's full-sized avatar
🥖
Temporally nondeterministic

Larry Marburger lmarburger

🥖
Temporally nondeterministic
View GitHub Profile
#!/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
@lmarburger
lmarburger / output
Last active December 22, 2015 21:59 — forked from TimMoore/curl-bundler-api
Timing rubygems spec.4.8 download from Fastly and S3. Run the test script and paste your results in a comment below: `curl -s https://gist.github.com/lmarburger/6537333/raw/time.sh | bash`
$ 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
@lmarburger
lmarburger / .gitignore
Last active December 22, 2015 11:58 — forked from indirect/.gitignore
specs.4.8
prerelease_specs.4.8
versions.list
names.list
specs
deps
gems
*.sha512
@lmarburger
lmarburger / hack.rb
Created May 17, 2012 16:49 — forked from rkh/hack.rb
Possible for a module included somewhere to override a class's instance method?
class Base
def call
'call'
end
end
p Base.new.call #=> "call"
# Monkeypatching "works" but doesn't provide access to #super
# 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
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
}
foldingStartMarker = '/\*(\*|\s+\w)(?!\*)|\{\s*($|/\*(?!.*?\*/.*\S))';
foldingStopMarker = '(?<!\*)\*\*/|/\*\s+-+\s+\*/|^\s*\}';
Update these expressions so they also recongize:
foldingStartMarker:
/* section: something variable
---------------------------------------------- */
// Before vim-javascript
method(arg1, arg2,
arg3);
// After vim-javascript
method(arg1, arg2,
arg3);
// After (Not sure I like this)
@lmarburger
lmarburger / flatten.rb
Created December 16, 2009 02:50 — forked from avdi/flatten.rb
# 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]]
#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]