Forking:
git clone [email protected]:showell/coffee-script.git
cd coffee-script
git remote add upstream git://github.com/jashkenas/coffee-script.git
git fetch upstream
git merge upstream/master
git branch mybranch
git checkout mybranch
handle_data = (data) -> | |
for line in data.split('\n') | |
regex = /(\w+)/g | |
while true | |
matches = regex.exec(line) | |
if matches | |
for word in matches[1..matches.length-1] | |
console.log word | |
else | |
break |
# This is a simple Proxy Server in CS. Use it for debugging interactions | |
# between a browser and a server. Right now it just prints the HTTP headers, | |
# but you can easily modify it to do more interesting sniffing. | |
# | |
# Thanks to James Cohen for posting the original code: | |
# | |
# http://webmonkeyuk.wordpress.com/2011/05/06/node-js-20-line-proxy-server-ported-to-15-lines-of-coffeescript/ | |
# | |
# To turn this on, go to Chrome/Preferences/Under the Hood, | |
# scroll down to Change Proxy Settings button, check the box for |
Forking:
git clone [email protected]:showell/coffee-script.git
cd coffee-script
git remote add upstream git://github.com/jashkenas/coffee-script.git
git fetch upstream
git merge upstream/master
git branch mybranch
git checkout mybranch
a = 0 | |
++a | |
b = a | |
c = b | |
d = c | |
f = d | |
g = f | |
h = a - b | |
l = a | |
m = a |
MAX = 10 | |
second_powers = -> | |
[a,b] = [0, 1] | |
n = 1 | |
while n <= MAX | |
console.log b | |
a += 1 | |
b += 2*a + 1 | |
++n |
jQuery -> | |
up = (icon) -> | |
icon.removeClass('downarrow').addClass('uparrow') | |
down = (icon) -> | |
icon.removeClass('uparrow').addClass('downarrow') | |
toggle = (elem) -> | |
icon = $(elem).find("span.icon") |
ns = 'http://www.w3.org/2000/svg' | |
svg = document.createElementNS ns, 'svg' | |
svg.width = 200 | |
svg.height = 200 | |
svg.style.height = '200px' | |
svg.style.width = '200px' | |
svg.style.border = "1px black solid" | |
elem = document.getElementById("main") | |
elem.appendChild svg |
is_heap = (arr) -> | |
n = 0 | |
m = 0 | |
while true | |
for i in [0..1] | |
m += 1 | |
return true if m > arr.length | |
return false if arr[m] > arr[n] | |
n += 1 | |
def swap(a, i, j): | |
a[i], a[j] = a[j], a[i] | |
def is_heap(a): | |
n = 0 | |
m = 0 | |
while True: | |
for i in [0, 1]: | |
m += 1 | |
if m >= len(a): |
def permute(n): | |
def k(a): | |
# returns index of array preceding longest | |
# string of descending values | |
k = len(a) - 2 | |
while k >= 0: | |
if a[k] < a[k+1]: | |
return k | |
k -= 1 | |
return k |