Skip to content

Instantly share code, notes, and snippets.

View ToddG's full-sized avatar

ToddG ToddG

View GitHub Profile
@ToddG
ToddG / dynamic_file.erl
Created May 2, 2011 05:49
file performance testing
-module(dynamic_file).
%% notes:
%% http://www.matisse.net/bitcalc/?input_amount=17179869184&input_units=bits&notation=legacy
%% http://20bits.com/articles/network-programming-in-erlang/
%% ------------------------------------------------------------------
%% API Function Exports
%% ------------------------------------------------------------------
@ToddG
ToddG / speedtest1.clj
Created December 29, 2010 05:02
Testing Mark's NonBlockingHashMap
(ns justforfun.speedtest1
(:use justforfun.NonBlockingHashMap))
(set! *warn-on-reflection* true)
;; I've simply extended Mark Engelberg's test code for his NonBlockingHashMap and
;; included my test results -- TDG
(defmacro xtime
"Evaluates expr and returns the time."
@ToddG
ToddG / diningphilosopher.clj
Created December 28, 2010 23:50
Dining Philosopher Problem
(ns algorithms.problems.diningphilosophers)
; ----------------------------------------------
; Dining Philosopher Problem
;
; This implementation satisfies the following story
; line:
;
; Our waiters set several tables of various
; sizes for dinner. One by one, the various hungry
@ToddG
ToddG / basic_binary_search_tree
Created December 4, 2010 06:31
Basic Binary Search Tree
(ns algorithms.core
(:use clojure.test))
;; -----------------------------------------------------------------------------
;; A simple BST implemented in Clojure using both defrecord and defprotocol.
;; Note the use of the unwind function to update the graph after each insertion.
;;
;; References:
;;
;; BST/Clojure
(ns web01.core
(:import
java.util.Map
java.util.HashMap
[java.io File InputStream]
[clojure.lang IDeref IFn ISeq])
(:use
compojure.core,
ring.adapter.jetty
clojure.contrib.json.read