Skip to content

Instantly share code, notes, and snippets.

View soofaloofa-zz's full-sized avatar

Kevin Sookocheff soofaloofa-zz

View GitHub Profile
@soofaloofa-zz
soofaloofa-zz / On choosing a hypermedia type
Last active October 14, 2023 07:23
On choosing a hypermedia type for your API - HAL, JSON-LD, Collection+JSON, SIREN, Oh My!
A comparison of Collection+JSON, HAL, JSON-LD and SIREN media types.
Discussion at
http://sookocheff.com/posts/2014-03-11-on-choosing-a-hypermedia-format/
@soofaloofa-zz
soofaloofa-zz / numbers.clj
Created June 23, 2011 18:04
4. Numbers Games
(defn add1 [n]
(+ n 1))
(defn sub1 [n]
(- n 1))
(defn plus [n m]
(cond
(zero? m) n
:else (add1 (plus n (sub1 m)))))
@soofaloofa-zz
soofaloofa-zz / cons.clj
Created June 17, 2011 17:40
3. Cons the Magnificent
(defn rember [atom l]
(loop [lat (seq l) res []]
(if lat
(let [f (first lat)]
(if (= f atom)
(next lat)
(recur (next lat) (conj res f))))
res)))
(defn firsts [lol]
@soofaloofa-zz
soofaloofa-zz / doit.clj
Created June 14, 2011 15:09
2. Do It, Do It Again, and Again, and Again ...
(defn atom? [x]
(not (seq? x)))
(defn lat? [x]
(loop [l x]
(cond
(empty? l) true
(atom? (first l)) (recur (last l))
:else false)))
@soofaloofa-zz
soofaloofa-zz / toys.clj
Created June 13, 2011 18:29
1. Toys (Clojure)
(defn atom? [x]
(not (seq? x)))
@soofaloofa-zz
soofaloofa-zz / fade.js
Created May 18, 2011 13:51
Dissecting jQuery's Fade Animation
function $(id) {
var $ = document.getElementById(id);
var opacityTo = function (elm, v) {
elm.style.opacity = v/100; // CSS3
elm.style.MozOpacity = v/100; // FF
elm.style.KhtmlOpacity = v/100; // Safari
elm.style.filter=" alpha(opacity ="+v+")"; // IE
};