Skip to content

Instantly share code, notes, and snippets.

View oubiwann's full-sized avatar
💭
🌌

Duncan McGreggor oubiwann

💭
🌌
View GitHub Profile
@oubiwann
oubiwann / README.md
Last active February 11, 2020 14:03
Clojure Components Demo

demo

Clojure Components Demo

Download

$ git clone https://gist.github.com/oubiwann/32a11597ea641fdb1dc6 \
    components-demo
@oubiwann
oubiwann / 01-repl-session-simple.clj
Last active October 23, 2015 21:05
Pulsar gen-event Demo
(ns event-demo.clj
(:require [clojure.tools.logging :as log]
[clojure.core.match :refer [match]]
[co.paralleluniverse.pulsar.core :as pulsar]
[co.paralleluniverse.pulsar.actors :as actors])
(:refer-clojure :exclude [promise await bean])
(:import [co.paralleluniverse.common.util Debug]
[co.paralleluniverse.actors LocalActor]))
;;
lcmap-rest.app=> (def conn (cc/connect ["127.0.0.1"] {:keyspace "lcmap" :version 3}))
...
#'lcmap-rest.app/conn
lcmap-rest.app=> (cql/select conn "epsg_5070")
ReadTimeoutException Cassandra timeout during read query at consistency ONE
(1 responses were required but only 0 replica responded)
com.datastax.driver.core.Responses$Error$1.decode (Responses.java:61)
;; Then an attempt with the lcmap prefix, tried out of desperation, knowing that the
===> Compiling lfesample
===> erl_opts [debug_info,{src_dirs,["src","test"]}]
===> src_files []
===> Files to compile first: []
===> Starting do/1 for {lfe, compile} ...
===> Compiling lfesample
===> Starting dotlfe_compile/6 ...
===> erl_opts [debug_info,{src_dirs,["src","test"]}]
===> src_files: ["/home/oubiwann/lab/lfe/rebar3-lfe-compile/lfesample/_build/default/deps/lfesample/src/lfesample.lfe",
"/home/oubiwann/lab/lfe/rebar3-lfe-compile/lfesample/_build/default/deps/lfesample/src/lfesample-util.lfe",
@oubiwann
oubiwann / hello-world.lfe
Last active August 29, 2015 14:25
Demonstrating spaces in function names
;; In the LFE REPL:
> (defun |hello world| (x)
(io:format "Hello, ~s~n" `(,x)))
|hello world|
> (|hello world| "Robert")
Hello, Robert
ok
>
@oubiwann
oubiwann / Makefile
Last active August 29, 2015 14:24
Modification of FFMeg's doc/examples/scaling_video.c that scales a YUV image
OS := $(shell uname -s)
ifeq ($(OS),Linux)
LIBTOOL = libtool
endif
ifeq ($(OS),Darwin)
LIBTOOL = glibtool
endif
FILENAME = scale_image
@oubiwann
oubiwann / area.clj
Last active August 29, 2015 14:24
Dispatch in LFE and Clojure
;;;; From the Clojure Cookbook
;;;; by Luke VanderHart and Ryan Neufeld
;; The easiest way to implement runtime polymorphism is via hand-rolled,
;; map-based dispatch using functions like cond or condp:
(defn area
"Calculate the area of a shape"
[shape]
(condp = (:type shape)
$ git clone https://github.com/oubiwann/linear-regression-tutorial.git
$ cd linear-regression-tutorial
$ make
@oubiwann
oubiwann / 01-checkout.txt
Last active August 29, 2015 14:10
LFE and Python 3
$ git clone git@github.com:oubiwann/erlport-demo.git
$ cd erlport-demo
@oubiwann
oubiwann / 01-bottle.py
Last active August 29, 2015 14:05
Comparison of Python (Bottle), Clojure (Compojure), and Erlang/LFE (lfest) REST Routes
from example.bottle.bttl import Bottle
app = Bottle()
@app.get('/')
def index():
return "Hello, World!"
@app.get('/orders')
def get_orders():