Skip to content

Instantly share code, notes, and snippets.

View pangloss's full-sized avatar
😃

Darrick Wiebe pangloss

😃
View GitHub Profile
@pangloss
pangloss / Using Pacer
Last active December 12, 2015 03:58
GraphTO presentation notes and code snippets
Using Pacer
Darrick Wiebe
dw@xnlogic.com
@pangloss
pangloss / gist:4983392
Created February 19, 2013 05:43
Stacktrace while backgrounded
$ fg
bundle exec irb -r lightmesh
Feb 19, 2013 12:38:10 AM org.hornetq.core.logging.impl.JULLogDelegate error
SEVERE: Failed to execute failure listener
java.lang.NoClassDefFoundError: datomic/reconnector2/Reconnector$fn__7032
at datomic.reconnector2.Reconnector.reconnect(reconnector2.clj:54)
at datomic.peer.Connection.reconnect(peer.clj:87)
at datomic.peer$create_connection_state$fn__7537$fn__7538.invoke(peer.clj:211)
at clojure.lang.Delay.deref(Delay.java:33)
at clojure.core$deref.invoke(core.clj:2080)
(ns rel-fsm.core
(:refer-clojure :exclude [==])
(:use [clojure.core.logic :exclude [is]] :reload))
(defn logic-fsm-w-mutual-recursion [str out]
(letfn [(S0 [str out]
(fresh [r]
(conde [(== () str) (== :accept out)]
[(resto str r)
(conde [(firsto str 0) (S0 r out)]
@pangloss
pangloss / euler-59.clj
Created May 12, 2013 18:34
Taking advantage of list comprehensions and lazy-seqs to solve http://projecteuler.net/problem=59 quite speedily.
(ns euler-59)
(defn decryptions [data]
(let [chrs (range (int \a) (inc (int \z)))]
(for [a chrs b chrs c chrs]
(let [k (cycle [a b c])]
(map (fn [a b] (bit-xor a b)) data k)))))
; Doesn't take much to validate english!
(defn possibly-valid? [str]

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@pangloss
pangloss / .gvimrc
Created June 10, 2013 00:22
My current vim configuration
" Make external commands work through a pipe instead of a pseudo-tty
"set noguipty
" set the X11 font to use
" set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1
set guifont=DejaVu\ Sans\ Mono:h11
" set guifont=Anonymous\ Pro:h14
set ch=1 " Make command line x lines high
(def data {:a [{:remove 999999}], :s nil, :action :update, :id 123123}
(postwalk #(cond
(keyword? %) (name %)
(map? %) (HashMap. %)
(instance? clojure.lang.MapEntry %) %
(sequential? %) (ArrayList. %)
:else %)
data)
@pangloss
pangloss / better-walk.clj
Created June 27, 2013 20:45
Updated clojure.walk/walk to better handle MapEntry.
(defn walk [inner outer form]
(cond
(list? form) (outer (apply list (map inner form)))
(instance? clojure.lang.IMapEntry form) (let [[k v] (map inner form)]
(outer (clojure.lang.MapEntry. k v)))
(seq? form) (outer (doall (map inner form)))
(coll? form) (outer (into (empty form) (map inner form)))
:else (outer form)))
<== is setStarts
[source] <== [explain 1] <== [transform] <== [explain 2] <== [filter] <== [explain 3]
\_____________________/ \__________________/
prevExplain prevExplain
@pangloss
pangloss / xn.test.cljs
Last active January 23, 2020 05:45
ClojureScript XHR with core.async.
(ns xn.test
(:require-macros [cljs.core.async.macros :refer [go alts!]]
(:require [xn.core :as xn]
[xn.util :as u]
[cljs.core.async :refer [<! take!]]
[xn.xhr :refer [request-body request-records chain-req]]))
(def sample-app
(reify
xn/Application