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xNTVlNjhlZWU5ODE3MTJmMmM1OTAxYjlhODIzZDk2Y2Jl
@jdubie
jdubie / use-cases.clj
Last active July 14, 2016 01:38
Eventbus API
;; assume 1 channel, and user id is always the shared key (kafka)
;; use cases
;; - logging (existing ladder.logging)
;; - publishing results of mutations with request infomation
(require '[ladder.logging :as log])
;; logging
(log/info :foo/bar {:baz :quz})
@jdubie
jdubie / foo.clj
Created December 1, 2015 17:56
datomic question about the `d/db` function
(ns datomic.example
(:require [datomic.api :as d]))
;; question about the function `d/db`
;;
;; in `example` pull `d/pull` always see the transaction that commits [:db/add id :foo :bar]?
(defn example
[conn id]
(do @(d/transact conn [{:db/id id :foo :bar}])
@jdubie
jdubie / macros.clj
Last active March 5, 2017 12:30
ClojureScript macros.
;; nice for reagent
(defmacro defc
"syntactic sugar for declaring stateful components. Keeps signature of inner
and outer params consistent.
Before:
(defn stateful-component
[params]
(let [local state]
@jdubie
jdubie / core.cljs
Last active August 29, 2015 14:27
My first macro! Syntactic sugar for stateful reagent components.
(ns example.core
(:require-macros [example.macro :refer [defc]])
(:require [reagent.core :as reagent :refer [atom]]))
;; without macro
(defn component
"example stateful component"
[a b c d]
(let [state (atom nil)]
@jdubie
jdubie / kabbes.json
Last active December 21, 2015 03:59
{
"globals": {
"test": [
"before",
"beforeEach",
"after",
"afterEach",
"it",
"describe"
]
@jdubie
jdubie / gist:6167263
Created August 6, 2013 18:35
A possible nodejs error handling convention
/* In api.js */
/**
* @param callback {function(err)}
*
* err.type in { 'malformed', 'forbidden', 'service_unavailable' }
*/
exports.connect = function (callback) {
var err = new Error('Service Unavailable, try again');
@jdubie
jdubie / gist:1145112
Created August 14, 2011 17:43
Karel Fills Potholes
//write your karel javascript
//code here.
function run() {
while(frontIsClear()) {
fillHole();
}
}
@jdubie
jdubie / Monday
Created August 11, 2011 06:11
Internet Scavenger hunt
-Sign up newbs to GMAIL
Send email
Search email (below)
Forward email
Chat