Skip to content

Instantly share code, notes, and snippets.

View owainlewis's full-sized avatar

Owain Lewis owainlewis

View GitHub Profile
@ehamberg
ehamberg / bktree.hs
Created December 8, 2011 13:40
Implementation of a BK-Tree in Haskell
import qualified Data.Map as M
import Control.Applicative
import Data.Maybe (mapMaybe)
-- A BK-Tree is has a root word and more trees connected to it with branches of
-- lengths equal to the Levenshtein distance between their root words (i.e. an
-- n-ary tree).
data BKTree s = BKTree s (M.Map Int (BKTree s)) | Empty deriving (Show)
-- Inserting a word is done by inserting it along a branch of lenght
(ns type-level-tagger
{:doc "Implements State-of-the-art Unsupervised Part-of-speech Tagger
from \"Simple Type-Level Unsuperivsed POS Tagging\"
by Yoong-Keok Lee, Aria Haghighi and Regina Barzilay
(http://www.cs.berkeley.edu/~aria42/pubs/typetagging.pdf)
blog post: http://wp.me/pcW6S-x"
:author "Aria Haghighi (aria42@gmail.com)"}
(:use [clojure.java.io :only [reader]]
[clojure.contrib.duck-streams :only [with-out-writer]]
[clojure.contrib.seq-utils :only [indexed]]
# Example encoding of an email message in JSON
{
headers: [ # in an array since order matters
{ name: 'Subject', value: 'An email' },
{ name: 'Date', value: 'Thu, 4 Mar 2010 15:35:32 -0800' },
{ name: 'From', value: 'george@foo.com' },
{ name: 'To', value: 'paul@goo.com' }
{ name: 'Sender', value: 'paul@goo.com' }
{ name: 'Reply-to', value: 'paul@goo.com' }
@njvitto
njvitto / deploy.rake
Created April 11, 2010 16:56 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]