The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23/12/2008
- Revised date: 15/12/2013
- Original post
# A CoffeeScript version of http://norvig.com/spell-correct.html | |
[fs, _] = [require("fs"), require("underscore")] | |
words = (text) -> text.toLowerCase().match /[a-z]+/g | |
train = (features) -> | |
model = {} | |
_.each features, (f) -> if model[f] then model[f] += 1 else model[f] = 1 | |
model |
a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!
if __FILE__ == $0 | |
puts "Run with: watchr #{__FILE__}. \n\nRequired gems: watchr rev" | |
exit 1 | |
end | |
# -------------------------------------------------- | |
# Convenience Methods | |
# -------------------------------------------------- | |
def run(cmd) | |
puts(cmd) |
ENV["WATCHR"] = "1" | |
system 'clear' | |
def growl(message) | |
growlnotify = `which growlnotify`.chomp | |
title = "Watchr Test Results" | |
puts message | |
image = message.match(/\s0\s(errors|failures)/) ? "~/.watchr_images/passed.png" : "~/.watchr_images/failed.png" | |
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'" | |
system %(#{growlnotify} #{options} &) |