Skip to content

Instantly share code, notes, and snippets.

Alan Dipert alandipert

Block or report user

Report or block alandipert

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
alandipert / days.boot
Last active Aug 27, 2015
Boot script to print the days in some interval to standard out
View days.boot
#!/usr/bin/env boot
(set-env! :dependencies '[[clj-time "0.11.0"]])
(require '[clj-time.core :as t]
'[clj-time.format :as f]
'[boot.cli :refer [defclifn]])
(defn day-range
"Sequence of days from start-day (inclusive) to end-day (exclusive)"
View bacwn.cljs.hl
(page "index.html"
(:require-macros [fogus.datalog.bacwn.macros :refer (facts <- ?- make-database)])
(:require [fogus.datalog.bacwn :as bacwn]
[fogus.datalog.bacwn.impl.rules :refer [rules-set]]
[fogus.datalog.bacwn.impl.database :refer [add-tuples]]
[fogus.datalog.bacwn.impl.syntax :refer [explode]]
[tailrecursion.hoplon :refer [do!]]))
;;; Schema & initial data
View callcc.clj
(import 'clojure.lang.ExceptionInfo)
(defn call-cc [f]
(let [v (promise)
e (ex-info "cc" {:v v})]
(try (f #(do (deliver v %) (throw e)))
(catch ExceptionInfo ex
(if (identical? ex e)
@(:v (ex-data ex))
(throw ex))))))
View event.cljs
(extend-type js/jQuery.Event
(-deref [this] (-> this .-target js/jQuery .val)))
;; (input :type "text"
;; :click #(.log js/console @%)
;; :value "hello")
View gist:10877092
(page "index.html"
(:require-macros [paranav :refer [dbg]])
(:require [tailrecursion.hoplon.reload :refer [reload-all]]
[ :as z]))
(def $ js/jQuery)
(when (-> js/window .-location .-hostname (= "localhost")) (reload-all))
(defn ->attr-map "(HLisp attrs workaround)" [m]
View seeing.clj
(defmacro seeing [& body]
(println "environment"
~(->> (keys &env)
(mapcat #(vector `'~% %))
(apply hash-map)))
(let [res# (do ~@body)]
(println "return value" res#)
View gist:11369611
(page "index.html"
(:require [tailrecursion.hoplon.reload :refer [reload-all]]
[goog.string :as gstr]))
(when (-> js/window .-location .-hostname (= "localhost")) (reload-all))
;;; cells
(defc persons

And now, by the immortal gods! I think nothing more happy than that generation of men we commonly call fools, idiots, lack-wits, and dolts; splendid titles too, as I conceive them. I'll tell you a thing, which at first perhaps may seem foolish and absurd, yet nothing more true. And first they are not afraid of death—no small evil, by Jupiter! They are not tormented with the conscience of evil acts, not terrified with the fables of ghosts, nor frightened with spirits and goblins. They are not distracted with the fear of evils to come nor the hopes of future good. In short, they are not disturbed with those thousand of cares to which this life is subject. They are neither modest, nor fearful, nor ambitious, nor envious, nor love they any man. And lastly, if they should come nearer even to the very ignorance of brutes, they could not sin, for so hold the divines. And now tell me, you wise fool, with how many troublesome cares your mind is continually perplexed; heap together all the discommodities of your life,

View gist:87ae0ca84328e3308c0f
In gherkin line 37:
^-- SC1000: $ is not used specially and should therefore be escaped.
In gherkin line 38:
^-- SC1000: $ is not used specially and should therefore be escaped.
View gist:5a5a7640fc2c05d00c42
(defn make-page
[text form-zippers]
[(flow/cell :source cursor 0)
(flow/cell :source zippers form-zippers)
(flow/cell current-zipper (get ?zippers ?cursor))
(flow/cell printed-zippers (mapv (comp print-clojure z/root) ?zippers))
(flow/cell strings (mapv str ?printed-zippers))
(flow/cell offsets (vec (cons 0 (reductions + (map (comp inc count) ?strings)))))
(flow/cell current-printed (?printed-zippers ?cursor))
You can’t perform that action at this time.