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
(defprotocol PWindow | |
(parent [this]) | |
(position [this]) | |
(size [this])) | |
(extend-protocol PWindow | |
js/HTMLDivElement | |
(parent [this] (.-parentNode 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
;; Example repository-format for automatic server-side synching (p2p-web) | |
;; commutative merging must be possible, it is (almost) a converging and commutative distributed data type(?) | |
#_{:uuid "blib" ;; used to ensure universal identity on repo creation (cannot conflict) | |
:schema {:type "http://github.com/ghubber/geschichte" ;; might not change, if it does warn and drop merge | |
:version (max v1 v2)} ;; internal only, allows update to server side synching software | |
:public (or p1 p2) ;; might only turn to true, always false initially, allows public access to repo meta-data, no strong safety, all values are still distributed!; if false only read access from user itself allowed; must be true for pull-requests | |
:causal-order {12344 #{3774 23} ;; use uuids as commit ids, unionize, no conflicts, removal impossible | |
3774 #{12} | |
23 #{12} |
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 rc4.core) | |
(defn init-sbox [enc-key] | |
(let [k (mapv int enc-key) | |
L (count enc-key)] | |
(loop [s (into [] (range 0 256)) i 0 j 0] | |
(if (= i 256) s | |
(let [j (mod (+ j (s i) (k (mod i L))) 256)] | |
(recur (assoc s i (s j) j (s i)) (inc i) j)))))) |
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
(import [pysistence [make_list make_dict]]) | |
(defn atom [init-val]) | |
(defn swap! [atom fn]) | |
(defn massoc [as k v] | |
(kwapply (as.using) {k v})) |
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 slide.window | |
(:use [dommy.core :only [set-style!]] | |
[dommy.template :only [PElement]])) | |
(defprotocol PWindow | |
(parent [this]) | |
(position [this]) | |
(size [this]) | |
#_(set-parent! [this par]) | |
#_(set-position! [this pos]) |
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 d3-line-plot-test) | |
(def margins {:top 20 | |
:right 20 | |
:bottom 30 | |
:left 50}) | |
(def totalwidth 960) | |
(def totalheight 500) |
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
(import [toolz.itertoolz.core [concat cons count drop mapcat partition partial take-nth]]) | |
(import [toolz.functoolz.core [compose complement]]) | |
; (import [pyrsistent [pvec pmap pset]]) ; persistent data structures for python | |
(import [matplotlib [pyplot :as plt]]) | |
(import [pylab :as p]) | |
(import [numpy :as np]) | |
;(import [scipy [optimize :as opt]]) | |
(import [pyNN.nest [setup | |
create | |
connect |
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
(def chan-log (atom [])) | |
(defn debug-chan [pre] | |
(let [c (chan) | |
lc (chan)] | |
(async/tap (async/mult c) lc) | |
(go-loop [m (<! lc)] | |
(swap! chan-log conj [pre m]) | |
(recur (<! lc))) | |
c)) |
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 cljc.play) | |
(defn fib [x] | |
(if (or (= x 1) (= x 0)) 1 | |
(+ (fib (- x 1)) (fib (- x 2))))) | |
(fib 30) | |
(defn msec [] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer