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
# None of the various "private" functions or data structures used by our robot function are exposed. | |
# The function just magically returns a robot for the given host. | |
robot = do -> | |
_makeRobot = require "robotstxt" | |
_userAgent = "Mozilla/5.0 (compatible; Googlebot/2.1)" | |
robots = {} | |
(host) -> robots[host] ?= _makeRobot "http://#{host}/robots.txt", _userAgent |
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
testify "A bus with cascading events fires them all", (test) -> | |
bus = new Bus | |
flag = false | |
bus.on "foo", -> | |
bus.event "bar" | |
process.nextTick -> | |
test.assert.ok flag | |
test.done() | |
bus.on "foo", -> | |
bus.on "bar", -> flag = true |
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
def provision_server | |
if options[:spot] | |
request = compute.spot_requests.create( | |
:price => price, :instance_count => 1, | |
:tags => {"Name" => generate_server_name}, | |
:region => region, :flavor_id => flavor, :image_id => image, | |
:security_group_ids => security_group, :key_name => keypair) | |
server = nil | |
Fog.wait_for { server = compute.servers.get(request.reload.instance_id) } | |
server |
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
foo | |
bar: "monday" | |
baz: 7 | |
-> | |
"omg, this works" | |
# meanwhile ... | |
foo |
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
# λf.(λg.f (g g)) (λg.f (g g)) | |
Y = (f) -> ((g) -> f((x) -> g(g)(x)))((g) -> f((x) -> g(g)(x))) | |
# ß-reduction of Y: λf.(λg.g g) (λg.f (g g)) | |
X = (f) -> ((g) -> g((x) -> g(x)))((g) -> f((x) -> g(g)(x))) | |
# applied to factorial ... this returns 720 | |
X((f) -> (x) -> if x is 1 then 1 else x * f(x - 1))(6) |
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
_emit = EventEmitter.prototype.emit | |
EventEmitter.prototype.emit = -> | |
console.log arguments[0] | |
_emit(arguments) |
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
module FooMethods | |
def bar | |
"bar" | |
end | |
end | |
class Foo | |
extend FooMethods |
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
queue_list: | |
extends: {$ref: "#resource"} | |
mediaType: media_type("queue_list") | |
additionalProperties: { $ref: "#queue"} | |
queue: | |
type: "object" | |
properties: | |
name: { type: "string" } | |
pending: { type: "integer" } |
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
<3: start workers | |
- Starting (46105): workers.events | |
- Starting (46106): workers.config | |
- Starting (46108): workers.integrity | |
- Starting (46109): workers.analytics | |
- Starting (46110): workers.health | |
- workers.analytics is running. | |
- workers.health is running. | |
- workers.config is running. |