Skip to content

Instantly share code, notes, and snippets.

View LauJensen's full-sized avatar

Lau B. Jensen LauJensen

View GitHub Profile
;; Examples from: http://www.databasteknik.se/webbkursen/relalg-lecture/index.html
(def employees (table connection-info :employees))
(def departments (table connection-info :departments))
;;== Projection ==
;; SELECT salary FROM employees
@(project employees #{:salary})
(-> (join [:employees :e] [:employees :b] {:e.mgr :b.nr})
(select (= :b.name "John"))
(project :b.name))
@LauJensen
LauJensen / ab
Created November 3, 2010 11:17 — forked from anonymous/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
;;; See the inspirational SO question: http://stackoverflow.com/questions/3346382
(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."
[ns]
(doseq [s (keys (ns-interns ns))
;new num branch results
(defn fib [n]
(if (>= 1 n)
1
(+ (fib (dec n)) (fib (- n 2)))))
(time (fib 38))
"Elapsed time: 3716.828 msecs"
(ns joy.proxytest)
;;== evilbase
(gen-class
:name joy.proxytest.evilbase
:prefix "evilbase-"
:post-init ctor
:methods [[tragedy [] void]]
:impl-ns joy.proxytest)
;sample use idea:
(defn mapx
"Returns a lazy sequence consisting of the result of applying f to the
set of first items of each coll, followed by applying f to the set
of second items in each coll, until any one of the colls is
exhausted. Any remaining items in other colls are ignored. Function
f should accept number-of-colls arguments."
[f coll]
(gen-iter iter [f seq-cell]
(ns com.wangdera.slideshow
(:import (java.io File)
(javax.imageio ImageIO)
(javax.swing JFrame JPanel Timer)
(java.awt Dimension Frame Color)))
(def imagelist (atom []))
(def running (atom true))
(defmacro props [obj & properties]
@LauJensen
LauJensen / cells.clj
Created February 23, 2010 20:08 — forked from richhickey/cells.clj
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
(set! *warn-on-reflection* true)
#!/usr/bin/perl4
# Horrible, horrible, horrible edit of someone's
# even more horrible "reddit clone in 4 lines of perl".
use CGI ':standard';
$dir = File::Basename::dirname( $0 );
chdir $dir;