This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; *very* quick and dirty support for javascript destructuring on | |
;;;; native javascript arrays and objects | |
(add-inline-form | |
get [[_ a b c]] | |
(str "((" a "[" b "]" ")||" c ")")) | |
(add-inline-form | |
nth [[_ a b]] | |
(str a "[" b "]")) | |
(add-inline-form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jury; | |
jury || (jury = {}); | |
if(!jury.destro)jury.destro = {}; | |
(function() { | |
jury.destro.foo = function(b, a) { | |
if(arguments.length !== 2)throw"required arity is 2";var h, c; | |
c = b["that-thingy"] || "bar"; | |
var d; | |
d = b["this-thingy"] || "foo"; | |
var e; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns #^{:doc "A handful of utilities for handling sessions"} | |
somnium.financier.app.control.session | |
(:refer-clojure :exclude (assoc! dissoc! get))) | |
;;;; declaring session var here for global-ish access to session | |
(def *session* {}) | |
(def *flash* {}) | |
(defn with-dynamic-session |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; point-free SHA1 hash | |
(import java.security.MessageDigest) | |
(defmacro >> | |
"(>> 1 2 3 4 5) => (2 3 4 5 1)" | |
[x & xs] | |
`(~@xs ~x)) | |
(defn sha1 [#^String s] | |
(-> (doto (MessageDigest/getInstance "SHA1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro defn-src | |
[& body] | |
`(alter-meta! | |
(defn ~@body) | |
assoc :defn-src (quote ~(cons 'defn body)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [cursor (fetch-eager :where {... whatever ...}) | |
res (transient [])] | |
(while (.hasNext cursor) | |
(conj! res (-> cursor .next .toClojure))) | |
(persistent! res)) | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deftype ConsType [_first _more] [ISeq] :as this | |
ISeq | |
(first ([] _first)) | |
(next ([] (when (first _more) _more)) | |
(seq ([] this)) | |
(cons ([x] (ConsType. x this))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-to-list 'swank-clojure-classpath (expand-file-name "classes/" path)) | |
(add-to-list 'swank-clojure-classpath (expand-file-name "src/" path)) | |
(add-to-list 'swank-clojure-classpath (expand-file-name "test/" path)) | |
;; in swank-clojure.el | |
;; add resources to swank-clojure-project classpath | |
(add-to-list 'swank-clojure-classpath (expand-file-name "resources/" path)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro and-let | |
[bindings & body] | |
(if (seq bindings) | |
(let [[a b & cs] bindings] | |
`(when-let [~a ~b] (and-let ~cs ~@body))) | |
`(do ~@body)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lang.EmptyCons = { | |
first: function() {return null;}, | |
rest: function() {return lang.EmptyCons;}, | |
seq: function() {return null;}, | |
toString: function() {return "()";} | |
} | |
lang.Cons = function(_first, _rest) { | |
if (!_rest) { _rest = lang.EmptyCons; } | |
this._first = _first; |
OlderNewer