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
Object::go = -> fold (|>), this, & | |
[1 to 10].go do | |
filter odd | |
map (^2) | |
fold1 (+) | |
#=> 165 | |
#compare: | |
[1 to 10] |
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
;; QuickSort in Clojure | |
;; quicksort :: Ord a => [a] -> [a] | |
(defn quicksort [seq] | |
(if (emtpy? seq) [] | |
(let [x (first seq) | |
xs (rest seq)] | |
(concat (quicksort (filter (fn [v] (<= v x)) xs)) | |
[x] | |
(quicksort (filter (fn [v] (> v x)) xs)))))) |
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
say = -> process.stdout.write it + \\n | |
targets = | |
coco: \co | |
'coffee-script': \cf | |
'./lib/livescript': \ls | |
N = 99 | |
o = |
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
json <-! $.getJSON \url | |
results <-! $.get json.url | |
alert results |
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
var phantom = require('phantom'); | |
phantom.create(function(ph) { | |
return ph.createPage(function(page) { | |
return page.open("http://www.google.com", function(status) { | |
console.log("opened google? ", status); | |
return page.evaluate((function() { | |
return document.title; | |
}), function(result) { | |
console.log('Page title is ' + result); | |
return ph.exit(); |