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
package com.github.nha; | |
import java.util.Map; | |
import java.util.concurrent.ConcurrentHashMap; | |
public class Configuration<K, V> { | |
private Map<K, V> map; | |
public Configuration() { |
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
### Keybase proof | |
I hereby claim: | |
* I am nha on github. | |
* I am nha (https://keybase.io/nha) on keybase. | |
* I have a public key whose fingerprint is 7C65 1064 0EAC 25F8 1586 9E0E 59C5 150B 84CD 9FA4 | |
To claim this, I am signing this object: |
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
;; Datomic example code | |
;; demonstrates various update scenarios, using a news database | |
;; that contains stories, users, and upvotes | |
;; grab an in memory database | |
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://foo") | |
(d/create-database uri) | |
(def conn (d/connect uri)) |
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
;;Using the Cassowary constraint solver from ClojureScript | |
;;This demo shows using multimethods for readable constraint syntax using +, -, and =. | |
;;Output is a row of circles with random radii spaced so that the space between their boundaries is uniform. | |
(ns c2.main | |
;;refer-clojure :exclude is currently broken in ClojureScript master | |
;;Ticket open: http://dev.clojure.org/jira/browse/CLJS-114 | |
;;Fix applied here: https://github.com/lynaghk/clojurescript/tree/114-refer-clojure-exclude | |
(:refer-clojure :exclude [+ - =]) | |
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 user) | |
(def app | |
"Intenal Helper" | |
(fnil conj [])) | |
(defprotocol PathSeq | |
(path-seq* [form path] "Helper for path-seq")) | |
(extend-protocol PathSeq |
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 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 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
;; (require '[clojure.string :as str] '[clojure.java.shell :as shell] '[taoensso.timbre :as timbre]) | |
(defn with-free-port! | |
"Attempts to kill any current port-binding process, then repeatedly executes | |
nullary `bind-port!-fn` (which must return logical true on successful | |
binding). Returns the function's result when successful, else throws an | |
exception. *nix only. | |
This idea courtesy of Feng Shen, Ref. http://goo.gl/kEolu." | |
[port bind-port!-fn & {:keys [max-attempts sleep-ms] |
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
;; MUST be possible | |
;; http://funcool.github.io/cats/latest/#alet | |
;; https://gist.github.com/aclemmensen/11272381 | |
;; http://www.lispcast.com/core-async-browser-motivation | |
;; https://gist.github.com/aclemmensen/11272381 | |
(defn sample-async-fn [t s] | |
(println "sample-async-fn" t s js/Date.) | |
(go (<! (timeout t)) |
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
(function(context) { | |
'use strict'; | |
var Timer = Java.type('java.util.Timer'); | |
var Phaser = Java.type('java.util.concurrent.Phaser'); | |
var TimeUnit = Java.type('java.util.concurrent.TimeUnit'); | |
var AsyncHttpClient = Java.type('com.ning.http.client.AsyncHttpClient'); | |
var timer = new Timer('jsEventLoop', false); | |
var phaser = new Phaser(); |
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 carder-devcards.map | |
(:require [taoensso.timbre :as timbre] | |
[cljsjs.react-leaflet] ;; js/ReactLeaflet | |
) | |
(:require-macros [devcards.core :as dc :refer [defcard defcard-doc defcard-om-next noframe-doc deftest dom-node]])) | |
(defn build | |
([component props] | |
(build component props (array))) |
OlderNewer