Skip to content

Instantly share code, notes, and snippets.

View gist:9086538
The following code
(defn do-stuff [msg]
(hmatch msg
[:dog age name] (println "got a dog with age " age " and name " name)
[:cat cute? legs] (println "got a cat that is " cute? " cute and has " legs "legs")
[other] (println "got an unrecognized animal of type " other ))
View gist:9410532
PROJECT = websocket
DEPS = cowboy erldn
dep_cowboy = pkg://cowboy master
dep_erldn = master
View gist:9426556
{application, hello_erlang, [
{description, "Hello world with Cowboy!"},
{vsn, "0.1.0"},
{modules, []},
{registered, [hello_erlang_sup]},
{applications, [
View gist:9426939
Erlang/OTP 17 [RELEASE CANDIDATE 2] [erts-6.0] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V6.0 (abort with ^G)
(websocket_example@> application:stop(websocket).
=INFO REPORT==== 8-Mar-2014::02:51:11 ===
application: websocket
exited: stopped
type: permanent
View gist:9444104
public_router() ->
View gist:9443944
=INFO REPORT==== 9-Mar-2014::03:03:41 ===
application: websocket
exited: {bad_return,
View gist:9443959
## websocket_app.erl
View gist:10002189
websocket_handle({text, Msg}, Req, State) ->
try _X = lists:flatten(io_lib:format("~p", [erldn:parse_str(Msg)])) of
_ -> {reply, {text, <<"That's what she said! ", Msg/binary >>}, Req, State}
_ -> {reply, {text, <<"ERROR Parsing", Msg/binary >>}, Req, State}
websocket_handle(_Data, Req, State) ->
{ok, Req, State}.
View gist:50ac3fbba4251436abc1
(ns doc.doc-diff
#+clj (:require [clojure.core.typed :as t])
#+cljs (:require-macros [cljs.core.typed :as t]))
(t/defalias Cmd (U Set-Attrs Set-Order Update-Child Swap-Child))
(t/defalias Cmds (t/Seq Cmd))
View gist:b8db01ac91ee5d2805e5
(Rec [x]
(U '{:op (Value :if)
:test x
:then x
:else x}
'{:op (Value :var)
:var clojure.lang.Var}
'{:op (Value :nil)}
'{:op (Value :false)}))))