A woman has two children, (at least) one of whom is a boy. What's the probability that she has two boys?
B B-B 1/4
/
/
B
/ \
/ \
/ G B-G 1/4
/
decorate = (klass, methodName, fn) -> | |
method = klass::[methodName] | |
klass::[methodName] = (args...) -> | |
method.apply this, args | |
fn.apply this, args | |
# Example | |
decorate Array, 'push', (args...) -> |
#!/usr/bin/env python | |
import json | |
import re | |
import subprocess | |
import sys | |
if len(sys.argv) > 1: | |
lsregister = sys.argv[1] | |
else: |
A woman has two children, (at least) one of whom is a boy. What's the probability that she has two boys?
B B-B 1/4
/
/
B
/ \
/ \
/ G B-G 1/4
/
cheerio = require 'cheerio' | |
request = require 'request' | |
tutor = require 'tutor' | |
request 'http://www.wizards.com/magic/tcg/events.aspx?x=mtg/event/playerschamp/2012/cubepool', | |
(err, res, body) -> | |
throw err if err? | |
$ = cheerio.load body | |
names = $('a.nodec').map -> @text() |
# Takes a box (an array) and a function, f, which takes a continuation. | |
# A sentinel is placed in the box, then f is invoked. When f calls its | |
# continuation, c, the box is inspected. Only if the sentinel is still | |
# in the box will c in turn call its continuation. | |
# | |
# If several asynchronous requests are made in quick succession, the | |
# responses may not be received in the order in which they were sent. | |
# This function makes it possible to define a function to be invoked | |
# *unless the request has been superseded by the time it completes*. | |
skip_continuation_if_superseded = (box, f) -> |
express = require 'express' | |
app = express() | |
app.param (name, arg) -> switch Object::toString.call arg | |
when '[object RegExp]' | |
(req, res, next, val) -> | |
if arg.test val then next() else next 'route' |
FILES = ( | |
'foo.txt', | |
'bar.txt', | |
'baz.txt', | |
) | |
def getmetadata(path): | |
return {'blah': True, 'quux': 42} |
ROUND 1 | |
Darryn 2 v 0 James | |
Dan 2 v 0 Matt | |
Doug 0 v 2 David | |
ROUND 2 | |
Darryn 2 v 0 David | |
James 2 v 1 Dan |