This file contains 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
#!/usr/bin/env ruby | |
# Packaged as a gem, too. | |
# gem install fizx-remind | |
system *ARGV | |
status = $? | |
system "growlnotify", "-m", "#{ARGV.first} is finished", "remind" | |
exit status.to_i |
This file contains 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
Who builds a house without drawing blueprints? | |
Leslie Lamport, Yammer, Jan 23 2013 | |
Architects plan--programmers don't. Maybe this is why programs crash and houses don't. | |
A blueprint for software is a spec. Not a formal Coq-provable one, but real-world one. | |
Why don't programmers write specs? | |
You can't code-gen from spec (retort--can't building-gen from blueprints) |
This file contains 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 | |
# clear old pipe and lock | |
rmdir worklock 2>/dev/null | |
rm work | |
if [[ ! -p work ]]; then | |
mkfifo work | |
else | |
dd if=work of=/dev/null |
This file contains 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
package main | |
/** | |
* This is a little too permissive (and hacked together), but it illustrates | |
* the point of encoding a bufio.Scanner that is stateful, so that it can | |
* parse the redis protocol. | |
*/ | |
import ( | |
"bufio" |
This file contains 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
package main | |
func main() { | |
buf := make([]int, 0) | |
buf = append(buf, 0, 1, 2, 3) | |
sub := buf[0:2] //hang on to a reference of the beginning of the vector | |
for { | |
for i := 0; i < 1000; i++ { | |
buf = append(buf, i) | |
} |
This file contains 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
package main | |
func main() { | |
buf := make([]int, 0) | |
for { | |
for i := 0; i < 1000; i++ { | |
buf = append(buf, i) | |
} | |
buf = buf[999:1000] | |
} |
This file contains 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
require 'socket' | |
server = TCPServer.new ENV["PORT"] | |
loop do | |
client = server.accept | |
client.puts "Hello !" | |
client.puts "Time is #{Time.now}" | |
client.close | |
end |
This file contains 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
#!/usr/bin/env ruby | |
require "open-uri" | |
require "rubygems" | |
require "json" | |
unless ENV["ASANA_API_KEY"] | |
puts "please set ASANA_API_KEY in the env" | |
exit 1 | |
end |
This file contains 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
module Kernel | |
def eventually(timeout = 1.0, start = Time.now, exception = nil, &block) | |
throw exception || Timeout::Error if Time.now > (start + timeout) | |
begin | |
return true if block.call | |
rescue RSpec::Expectations::ExpectationNotMetError => exception | |
EM.next_tick { | |
eventually(timeout, start, exception, &block) | |
} | |
end |
NewerOlder