Skip to content

Instantly share code, notes, and snippets.

Lau B. Jensen LauJensen

Block or report user

Report or block LauJensen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View designer.html
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<polymer-element name="my-element">
:host {
position: absolute;
width: 100%;
height: 100%;
View designer.html
<link rel="import" href="../paper-input/paper-input.html">
<polymer-element name="my-element">
:host {
position: absolute;
width: 100%;
height: 100%;
LauJensen / gist:789530
Created Jan 21, 2011
First cut at interface for CASE
View gist:789530
clojureql.core> (project (table :t1)
[:id (case :wages
(<= :wage 5) "low"
(>= :wage 10) "high"
:else "average")])
WHEN (wage <= 5) THEN low
WHEN (wage >= 10) THEN high
ELSE average
END AS wages
View gist:666980
clojureql.core> (let [photo-counts (table {} :photos [:user_id [:count:* :as :cnt]])]
(-> (table {} :users [:*])
(join photo-counts (= {:users.user_id :photos.user_id}))
"SELECT users.*,photos_aggregation.cnt FROM users
(SELECT photos.user_id,count(photos.*) AS cnt FROM photos GROUP BY user_id)
AS photos_aggregation ON (users.user_id = photos_aggregation.user_id)"
View clojure-relational-algebra.clj
;; Examples from:
(def employees (table connection-info :employees))
(def departments (table connection-info :departments))
;;== Projection ==
;; SELECT salary FROM employees
@(project employees #{:salary})
View clojure-relational-algebra.clj
(-> (join [:employees :e] [:employees :b] {:e.mgr})
(select (= "John"))
View ab
Server Software: aleph
Server Hostname: localhost
Server Port: 9292
Document Path: /
Document Length: 6 bytes
Concurrency Level: 50
Time taken for tests: 9.565 seconds
Complete requests: 10000
View trace-ns.clj
;;; See the inspirational SO question:
(require 'clojure.contrib.trace)
(defn trace-ns
"Replaces each function from the given namespace with a version wrapped
in a tracing call. Can be undone with untrace-ns. ns should be a namespace
object or a symbol."
(doseq [s (keys (ns-interns ns))
View client.clj
(defn with-timeout [thunk]
(let [task (FutureTask. thunk)
thr (Thread. task)]
(.start thr)
(.get task 10 TimeUnit/SECONDS)
(catch TimeoutException e
(.cancel task true)
(.stop thr (Exception. e))
View gist:442044
;new num branch results
(defn fib [n]
(if (>= 1 n)
(+ (fib (dec n)) (fib (- n 2)))))
(time (fib 38))
"Elapsed time: 3716.828 msecs"
You can’t perform that action at this time.