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"],
[myObject aMesage:5.0f];
// a comment
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({
;; holy crap! continuations should very much be possible!
(defn make-list3 [n k]
(if (zero? n)
(trampoline k '())
(fn [] (make-list3 (dec n) (fn [l] #(k (conj n l)))))))
;; works!
(time (trampoline make-list3 1000000 (fn [l] l)))
;; Paul Grahams Continuation Code in Clojure
(def *cont* identity)
(defmacro =fn [parms & body]
`(fn [~'*cont* ~@parms] ~@body))
(defmacro =defn [fn-name parms & body]
(let [f (symbol (str "=" fn-name))]
`(do
(defmacro ~fn-name ~parms
Function.implement({
partial: function(bind, args) {
var self = this;
args = $splat(args);
return function() {
return self.apply(bind, args.concat($A(arguments)));
};
}
});
Array.implement({
first: function() {
return this[0];
},
rest: function() {
return this.slice(1, this.length);
},
drop: function(n) {
Document.implement({
getWindow: function(){
return (new Window(this.defaultView || this.parentWindow));
}
});
Window.implement({
$$: function(selector){
if (arguments.length == 1 && typeof selector == 'string') return (new Document(this.document)).getElements(selector);
var elements = [];