Skip to content

Instantly share code, notes, and snippets.

View swannodette's full-sized avatar

David Nolen swannodette

View GitHub Profile
read
----
{
"action": "read",
"table": "user/shift/trail/comment",
"constraints": {
"user_id": 67
},
"properties": "*" || ["username", "summary", "modified"],
"orderby": ["<" || ">", "modified"],
var TestTwoSpace = ShiftSpace.Space.extend({
attributes: {
name: 'TestTwo',
icon: 'TestTwo.png'
}
});
var TestTwoShift = ShiftSpace.Shift.extend({
setup: function(json) {
var TestTwoSpace = ShiftSpace.Space.extend({
attributes: {
name: 'TestTwo',
icon: 'TestTwo.png'
}
});
var TestTwoShift = ShiftSpace.Shift.extend({
setup: function(json) {
var TestTwoSpace = ShiftSpace.Space.extend({
attributes:
{
name: 'TestTwo',
icon: 'TestTwo.png'
}
});
var TestTwoShift = ShiftSpace.Shift.extend({
@swannodette
swannodette / snippet.txt
Created July 17, 2009 18:42 — forked from anonymous/snippet.txt
Bulk.json
[
{
"action": "read",
"table": "workset",
"properties": "*",
"constraints": {
"userid": "4511"
},
"orderby": [
">",
(import [java.security MessageDigest])
(def *sha1* "SHA-1")
(def *abc* (.getBytes "ABC"))
(def *abc-sha1* "3c1bdbb26f358bab27f267924aa2c9a3fcfdb8")
(defn start-message-digest [type]
(MessageDigest/getInstance type))
(defn update-message-digest [#^MessageDigest md bytes]
; Amaturish Clojure version of uniprot mapping function by @sjcockell
; Improved a bit by David Nolen
; http://blog.fuzzierlogic.com/archives/339
; http://gist.github.com/329730
(ns uniprot
(:use [clojure.contrib.duck-streams])
(:require [clojure.contrib.str-utils2 :as s])
(:import java.net.URLEncoder))
(defn- url-encode [param] (URLEncoder/encode param))
;; 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
@swannodette
swannodette / web.clj
Created April 1, 2010 13:19 — forked from devn/web.clj
(ns defn-test
(:use clj-html.core
[net.cgrand.moustache :only [app]]
[ring.adapter.jetty :only [run-jetty]]
[ring.util.response :only [response]]))
(defhtml application [text body]
[:html
[:head
[:title text]]
(definterface IntToIntFn
(#^int call [^int n]))
(def fibr
(let [one (int 1)
two (int 2)]
(reify
IntToIntFn
(call [this n]
(if (>= one n) one (+ (.call this (dec n)) (.call this (- n two))))))))