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
function trickyToString(data, withComma) { | |
var outStr = ""; | |
for( key in data ) { | |
outStr = outStr + key; | |
if(withComma) { | |
outStr = outStr + "," + data[key]; | |
} else { | |
outStr = outStr + ";" + data[key]; | |
} | |
outStr = outStr + "\n"; |
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
; copy from https://github.com/daveray/seesaw/blob/develop/src/seesaw/options.clj | |
(defrecord Option [name setter getter examples]) | |
(defmacro bean-option | |
[name-arg target-type & [set-conv get-conv examples]] | |
(let [[option-name bean-property-name] (split-bean-option-name name-arg) | |
target (gensym "target")] | |
`(Option. ~option-name | |
(fn [~(with-meta target {:tag target-type}) value#] |
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
(-> (frame :title "Why Swing, why?" | |
:on-close :exit | |
:content (label :text "Hiya" | |
:border 5 | |
:background "#888" | |
:foreground :blue)) | |
pack! | |
show!) |
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
(bean (java.util.Date.)) | |
{:seconds 40, :date 23, :class java.util.Date, | |
:minutes 47, :hours 21, :year 113, | |
:timezoneOffset -480, :month 1, :day 6, | |
:time 1361627260711} |
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 com.example.bst) | |
; using {:val :left :right} as tree data structure | |
(defn node [val & [left right other]] | |
{:val val :left left :right right :bag other}) | |
(defn insert [parent i-node] | |
(let [i-val (:val i-node) | |
p-val (:val parent) | |
side (cond (> i-val p-val) :left |
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
(defn mod3? [num] (= (mod num 3) 0)) | |
(defn mod5? [num] (= (mod num 5) 0)) | |
(defn fizzbuzz [num] (cond (and (mod3? num) (mod5? num)) "FizzBuzz" | |
(mod5? num) "Buzz" | |
(mod3? num) "Fizz" | |
:else num)) | |
(map fizzbuzz (range 1 101)) |
NewerOlder