Skip to content

Instantly share code, notes, and snippets.

View hoeck's full-sized avatar

Erik Söhnel hoeck

  • Dresden, Germany
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Meine erste Videoapplikation</title>
<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="https://raw.github.com/Wolfy87/EventEmitter/master/EventEmitter.min.js"></script>
<script src="https://raw.github.com/palavatv/palava-client/master/palava.min.js"></script>
<script type="text/coffeescript">
import locale
x = [ u'sac', u'sáb']
sorted(x)
>>> [u'sac', u's\xe1b']
locale.setdefault(locale.LC_COLLATE, 'de_DE.UTF-8')
sorted(x, cmp=locale.strcoll)
>>> [u's\xe1b', u'sac']
(project (table :t1)
[:id :title]
(case :alias??
(<= :wage 200)
"low"
(and (> :wage 200) (< :wage 400))
"average"
(>= :wage 400)
"high"
:else "negative"))
(project (table :t1)
[:id :title]
(case :alias
(when (<= :wage 200)
"low")
(when (and (> :wage 200) (< :wage 400))
"average")
(when (>= :wage 400)
"high")
:else
\usepackage{listings}
\lstdefinelanguage{Clojure}
{morekeywords={defn, defmacro, let, if, when, loop, recur},
sensitive=false,
morecomment=[l]{;;},
morecomment=[s]{/*}{*/},
morestring=[b]",
}
(def x {:a 1 :b 2 :c 3})
(def y {:a 2 :b 3 :c 4})
(def z (zipmap [:a :b :c] (range 10 15)))
(def g #{:a :b})
(defn always-merge-with [f keyseq & maps]
(reduce (fn [ret k] (assoc ret k (apply f (map #(get % k) maps)))) {} keyseq))
(always-merge-with vector g x y z)
=> {:b [2 nil 11], :a [1 2 10]}
(def x {:a 1 :b 2 :c 3})
(def y {:a 2 :b 3 :c 4})
(def z (zipmap [:a :b :c] (range 10 15)))
(def g #{:a :b})
(defn always-merge-with [f keyseq & maps]
(reduce (fn [ret k] (assoc ret k (apply f (map #(get % k) maps)))) {} keyseq))
(always-merge-with vector g x y z)
=> {:b [2 nil 11], :a [1 2 10]}
(clojure.xml/emit {:tag :FOO
:attrs {:attr 'xxx},
:content [{:tag :BAR
:attrs {:name "bar", :num 123}}
{:tag :BAR
:attrs {:name "baz", :num 100}}]})
<?xml version='1.0' encoding='UTF-8'?>
<FOO attr='xxx'>
<BAR name='bar' num='123'/>
<BAR name='baz' num='100'/>
(binding [*print-meta* true]
[(str (with-meta 'symbol {:a 1}))
(pr-str (with-meta 'symbol {:a 1}))])
=> ["symbol" "^{:a 1} symbol"]
;; snippets to be used on the repl or within the example applet
(ns demo)
(defmacro show [& body]
`(pivot/disp-> (pivot/show (do ~@body))))
;; ---title---
;; Treeview Tutorial
;; ---description---