Skip to content

Instantly share code, notes, and snippets.

View onetom's full-sized avatar

Tamas Herman onetom

View GitHub Profile
@onetom
onetom / map-each
Created April 20, 2011 17:43
Error has been reported already and fixed in R2/Forward, but it hasn't made it into R2 yet
map-each: func [
"Evaluates a block for each value(s) in a series and returns them as a block."
[throw catch]
'word [word! block!] "Word or block of words to set each time (local)"
data [block!] "The series to traverse"
body [block!] "Block to evaluate each time"
/into "Collect into a given series, rather than a new block"
output [any-block! any-string!] "The series to output to" ; Not image!
/local init len x
][
@onetom
onetom / gist:5815308
Created June 19, 2013 15:38
darcs-push-to-hub.darcs.net-fails
---==| ~/p/darcs-push-to-hub.darcs.net-fails |==---
$ ~/.cabal/bin/darcs push [email protected]:test-before-sending-to-simon
HINT: if you want to change the default remote repository to
[email protected]:test-before-sending-to-simon,
quit now and issue the same command with the --set-default flag.
Sun Jun 16 03:38:54 HKT 2013 Tamas Herman <[email protected]>
* Base sinatra app
Shall I push this patch? (1/20) [ynW...], or ? for more options: a
Apply failed!
@onetom
onetom / gist:b6128ef804036d8542cc
Created January 23, 2015 00:19
Side effecting on cell value transition
(defc user nil)
(defc route "")
(defn role-of [user route]
(when user
(if (= "#/secret-route" route) :power-user :pawn)))
(defn get-submissions-for [user route]
(when-let [role (role-of user route)]
(get-submissions role (:email user))))
@onetom
onetom / gist:43e4009dd8fa124ce399
Created June 5, 2015 01:59
Function within `cell-let` fails with Hoplon6
(defelem cell-let-problem [{:keys [data]}]
(cell-let [{:keys [title]} data
fun #(str title " - " title)
double-title (fun)]
(div :text double-title)))
(cell-let-problem :data (cell {:title "cell-let test"}))
# Uncaught TypeError: fun.call is not a function
@onetom
onetom / build.boot
Created November 18, 2015 00:43
Loading datomic.api from boot-test is slow
(set-env!
:source-paths #{"."}
:dependencies '[
[com.datomic/datomic-pro "0.9.5153"]
[adzerk/boot-test "1.0.4"]])
(require
'[adzerk.boot-test :refer :all])
@onetom
onetom / gist:6ee78d00dfdfef7602cf
Created February 13, 2016 19:36
Adzerk Boot Docker container install from scratch
$ time docker run -it adzerk/boot-clj repl
Unable to find image 'adzerk/boot-clj:latest' locally
latest: Pulling from adzerk/boot-clj
5e7f975cbeeb: Pull complete
a3ed95caeb02: Pull complete
a3e4bb9953ce: Pull complete
32e8c9a8996e: Pull complete
Digest: sha256:713f49c833be372227089aed8dbd424e191f18ada924cfad984258c7c463ce6c
Status: Downloaded newer image for adzerk/boot-clj:latest
@onetom
onetom / auth_core.clj
Created May 4, 2016 08:46
Minimal Castra client
(ns auth-core
(:require-macros
[hoplon.core :refer [with-init! defelem]]
[javelin.core :refer [defc defc= cell= dosync]]
[compile-time-config :refer [env]])
(:require
[hoplon.core :refer :all]
[hoplon.storage-atom :refer [local-storage]]
[javelin.core :refer [cell]]
[castra.core :refer [mkremote assoc-when xhr-resp-headers]]
@onetom
onetom / dates.cljc
Created September 12, 2016 15:26 — forked from Deraen/dates.cljc
Cljc dates
(ns metosin.dates
"Use this namespace to format dates and datetimes for user.
Don't use for serializing or deserializing.
Clojure side uses always Helsinki timezone.
On Cljs side, uses the timezone of browser."
#?(:cljs (:require goog.date.UtcDateTime
goog.date.Date
goog.i18n.DateTimeFormat))
#?(:clj (:import [org.joda.time DateTimeZone])))
@onetom
onetom / paging.clj
Created September 12, 2016 15:27 — forked from micha/paging.clj
(ns ui.paging
(:require [hoplon.core :refer (def-values)]))
(defmacro defp
[name & args]
`(def ~name (paginate ~@args)))
@onetom
onetom / rpc.cljs.hl
Created September 12, 2016 15:28 — forked from micha/rpc.cljs.hl
(ns app.rpc
(:require-macros
[adzerk.env :as env])
(:require
[ui.util :as util]
[ui.paging :as p :refer-macros [defp]]
[castra.core :as castra :refer [mkremote]]))
(env/def
GEIR_BRANCH nil