Skip to content

Instantly share code, notes, and snippets.

Owain Lewis owainlewis

Block or report user

Report or block owainlewis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
owainlewis / 0_reuse_code.js
Created Jan 1, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
owainlewis / bktree.hs
Created Oct 11, 2012 — forked from ehamberg/bktree.hs
Implementation of a BK-Tree in Haskell
View bktree.hs
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
owainlewis / rbtree.lisp
Created Oct 9, 2012 — forked from Mozk0/rbtree.lisp
Red Black Tree for Common Lisp.
View rbtree.lisp
;; The following implementation of rb-tree is based on
(defun change-to-black (tree)
(pattern-match tree
((:pattern (_ . rest) :variable rest :ignore _) `(:B . ,rest))
(:otherwise nil)))
(defun rb-insert (tree obj cmp)
(change-to-black (rb-insert% tree obj cmp)))
owainlewis / multimethod.rb
Created Aug 11, 2012 — forked from alandipert/multimethod.rb
Multimethods in Ruby
View multimethod.rb
class Multimethod
attr_accessor :dispatch, :methods, :heirarchy, :default_method
class NoMatchingMethodError < StandardError
def initialize(&dispatch)
@dispatch = dispatch
@methods = []
@heirarchy = {}
owainlewis / deployer.rake
Created May 8, 2012 — forked from morgoth/deployer.rake
Rake task to copy local files to remote server via FTP
View deployer.rake
# Rake task to copy local files to remote server via FTP
# required credentials.yml file, that contains keys:
# server, username, password
require "net/ftp"
require "yaml"
class FTPClient
attr_reader :remote_path
You can’t perform that action at this time.