View gist:9086538
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 )) | |
becomes: |
View gist:9410532
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROJECT = websocket | |
DEPS = cowboy erldn | |
dep_cowboy = pkg://cowboy master | |
dep_erldn = https://github.com/txrev319/erldn.git master |
View gist:9426556
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{application, hello_erlang, [ | |
{description, "Hello world with Cowboy!"}, | |
{vsn, "0.1.0"}, | |
{modules, []}, | |
{registered, [hello_erlang_sup]}, | |
{applications, [ | |
kernel, | |
stdlib, | |
cowboy | |
]}, |
View gist:9426939
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@127.0.0.1)1> application:stop(websocket). | |
=INFO REPORT==== 8-Mar-2014::02:51:11 === | |
application: websocket | |
exited: stopped | |
type: permanent | |
ok |
View gist:9444104
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(websocket_app). | |
-behaviour(application). | |
-export([start/2]). | |
-export([stop/1]). | |
-export([public_router/0]). | |
public_router() -> |
View gist:9443944
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=INFO REPORT==== 9-Mar-2014::03:03:41 === | |
application: websocket | |
exited: {bad_return, | |
{{websocket_app,start,[normal,[]]}, | |
{'EXIT', | |
{{badmatch,{error,{already_started,<0.53.0>}}}, | |
[{websocket_app,start,2, | |
[{file,"src/websocket_app.erl"},{line,26}]}, | |
{application_master,start_it_old,4, | |
[{file,"application_master.erl"},{line,272}]}]}}}} |
View gist:9443959
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## websocket_app.erl | |
-module(websocket_app). | |
-behaviour(application). | |
-export([start/2]). | |
-export([stop/1]). | |
View gist:10002189
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | |
catch | |
_ -> {reply, {text, <<"ERROR Parsing", Msg/binary >>}, Req, State} | |
end; | |
websocket_handle(_Data, Req, State) -> | |
{ok, Req, State}. | |
View gist:50ac3fbba4251436abc1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)})))) |
OlderNewer