Clojure Components Demo
$ git clone https://gist.github.com/oubiwann/32a11597ea641fdb1dc6 \
components-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", |
| ;; In the LFE REPL: | |
| > (defun |hello world| (x) | |
| (io:format "Hello, ~s~n" `(,x))) | |
| |hello world| | |
| > (|hello world| "Robert") | |
| Hello, Robert | |
| ok | |
| > |
| OS := $(shell uname -s) | |
| ifeq ($(OS),Linux) | |
| LIBTOOL = libtool | |
| endif | |
| ifeq ($(OS),Darwin) | |
| LIBTOOL = glibtool | |
| endif | |
| FILENAME = scale_image |
| ;;;; 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 |
| $ git clone git@github.com:oubiwann/erlport-demo.git | |
| $ cd erlport-demo |
| from example.bottle.bttl import Bottle | |
| app = Bottle() | |
| @app.get('/') | |
| def index(): | |
| return "Hello, World!" | |
| @app.get('/orders') | |
| def get_orders(): |