Skip to content

Instantly share code, notes, and snippets.

View cbilson's full-sized avatar

Chris Bilson cbilson

View GitHub Profile
@pedroteixeira
pedroteixeira / SpamLord.java
Created March 11, 2012 23:15
coursera nlp pa1
// Modified SpamLord.java to call clojure code
public List<Contact> processFile(String fileName, BufferedReader input) {
List<Contact> contacts = new ArrayList<Contact>();
// for each line
Matcher m;
String email;
try {
List results = new spamlord().process(input);
@ctford
ctford / at_all.clj
Created March 11, 2012 20:44
A short piano piece in Overtone
(ns overtunes.songs.at-all
(:use
[overtone.live :only [at now]]
[overtone.inst.sampled-piano :only [sampled-piano]]))
(defn bpm [beats-per-minute]
(let [start (now)
ms-per-minute (* 60 1000)
ms-per-beat (/ ms-per-minute beats-per-minute)]
#(+ start (* ms-per-beat %))))
@semperos
semperos / clj->js.clj
Created January 22, 2012 19:43
ClojureScript to JavaScript (from mmcgrana)
(defn clj->js
"Recursively transforms ClojureScript maps into Javascript objects,
other ClojureScript colls into JavaScript arrays, and ClojureScript
keywords into JavaScript strings."
[x]
(cond
(string? x) x
(keyword? x) (name x)
(map? x) (.strobj (reduce (fn [m [k v]]
(assoc m (clj->js k) (clj->js v))) {} x))
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@hiredman
hiredman / core.clj
Created October 25, 2011 22:56
srepl.clj
(ns srepl.core
(:use [clojure.main :only [repl]]
[clojure.pprint :only [pprint with-pprint-dispatch code-dispatch]])
(:import (jline.console ConsoleReader)
(jline.console.completer Completer))
(:gen-class))
(defmulti super-dispatch class)
(defmethod super-dispatch :default [thing]
;; this file is a walkthrough of Moustache features, a web framework for Clojure
;; http://github.com/cgrand/moustache/tree/master
;; Moustache allows to declare routes, apply middlewares and dispatch on http methods.
;; Moustache is compatible with all frameworks built on Ring, including Compojure
(ns demo
(:use net.cgrand.moustache)
(:use [ring.adapter.jetty :only [run-jetty]])) ;; hmmm Ring without servlets