This file contains hidden or 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
open ReactDOM | |
module MyComponent = struct | |
(* Component Properties *) | |
type props = {count: int} | |
(* Hey, state can be any type! *) | |
type state = string | |
(* Initializer *) |
This file contains hidden or 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 starlab.services.nashorn | |
(:require [clojure.tools.logging :as log] | |
[clojure.java.io :as io]) | |
(:import [javax.script | |
Invocable | |
ScriptEngineManager]) | |
(:use [plumbing.core :exclude [update]])) | |
(defn nashorn-env [] | |
(doto (.getEngineByName (ScriptEngineManager.) "nashorn") |
This file contains hidden or 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
FROM debian:wheezy | |
ENV DEBIAN_FRONTEND noninteractive | |
# Oracle Java 8 | |
RUN apt-get update \ | |
&& apt-get install -y wget openssl ca-certificates \ | |
&& cd /tmp \ | |
&& wget -qO jdk8.tar.gz \ |
This file contains hidden or 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 datascript-utils | |
(:require [datascript :as d])) | |
(defn data->datoms [prefix json] | |
(let [make-prefix | |
(fn [p] | |
(let [[full short] | |
(re-matches #"(.+?)s?$" p)] | |
short))] |
This file contains hidden or 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
(def db (atom nil)) | |
(defn error [e] | |
(.error js/console "An IndexedDB error has occured!" e)) | |
(defn new [cb] | |
(let [version 1 | |
request (.open js/indexedDB "lokate" version)] | |
(set! (.-onupgradeneeded request) (fn [e] | |
(reset! db (.. e -target -result)) |
This file contains hidden or 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
CREATE OR REPLACE FUNCTION table_update_notify() RETURNS trigger AS $$ | |
DECLARE | |
id bigint; | |
BEGIN | |
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN | |
id = NEW.id; | |
ELSE | |
id = OLD.id; | |
END IF; | |
PERFORM pg_notify('table_update', json_build_object('table', TG_TABLE_NAME, 'id', id, 'type', TG_OP)::text); |
This file contains hidden or 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
{:environment :production | |
:global {:logging-config "./logback.xml"} | |
:onyx {:job-scheduler :onyx.job-scheduler/balanced | |
:task-scheduler :onyx.task-scheduler/balanced | |
:peer-config {:onyx.messaging/impl :netty | |
:onyx.messaging/peer-port-range [40200 40220] | |
:onyx.messaging/peer-ports [40199] | |
:onyx.messaging/bind-addr "localhost" | |
:onyx.messaging/backpressure-strategy :high-restart-latency} | |
:peer-count 20 |
This file contains hidden or 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 your.macros-for-cljs.ns | |
(:require [sablono.compiler :as sablono-c])) | |
;; Make sablono also walk into other forms: | |
;; if, for, let, do: Already exist | |
(.addMethod @(var sablono-c/compile-form) "when" | |
(fn | |
[[_ bindings & body]] | |
`(when ~bindings ~@(for [x body] (sablono-c/compile-html x))))) |
This file contains hidden or 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
#!/bin/bash | |
# Referenced and tweaked from http://stackoverflow.com/questions/6174220/parse-url-in-shell-script#6174447 | |
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')" | |
# remove the protocol | |
url="$(echo ${1/$proto/})" | |
# extract the user (if any) | |
userpass="$(echo $url | grep @ | cut -d@ -f1)" | |
pass="$(echo $userpass | grep : | cut -d: -f2)" | |
if [ -n "$pass" ]; then |
This file contains hidden or 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
(defmulti control (fn [action] action)) | |
(defmethod control :init [_ [init-state] _] | |
init-state) | |
(defonce reconciler | |
(scrum/reconciler {:state (atom {}) ;; <= client-side state | |
:controllers {:user control}})) ;; <= action handlers |