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
(defn lookup-contract [m allowed] | |
(reify | |
clojure.lang.ILookup | |
(valAt [coll k] | |
(.valAt coll k nil)) | |
(valAt [coll k not-found] | |
(if (contains? allowed m) | |
(.valAt coll k not-found) | |
(throw (IllegalArgumentException. | |
(str k " violates lookup contract, allowed " allowed))))))) |
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
var Benchmark = require('benchmark'); | |
var t = require('transducers.js'); | |
var ct = require('transducers-js'); | |
var Immutable = require('immutable'); | |
var suite = Benchmark.Suite('transducers'); | |
function benchArray(n) { | |
var arr = new Immutable.Range(0, n).toVector(); | |
suite |
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 no-rerender.core | |
(:require [om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true])) | |
(enable-console-print!) | |
(def app-state (atom [{:group "A" :text "An item of group A" :color "steelblue"} | |
{:group "B" :text "An item of group B" :color "steelblue"}])) | |
(def switch-color {"steelblue" "green" |
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 ptv.scratch | |
(:require | |
[om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true])) | |
(enable-console-print!) | |
(def app-state (atom {})) | |
(defn component-one [data owner opts] |
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
#!/usr/bin/java -jar clojure-1.7.0-master-SNAPSHOT.jar | |
(let [pom-uber-jar | |
(str "http://thelibraryofcongress.s3.amazonaws.com/" | |
"pomegranate-0.0.13-SNAPSHOT-jar-with-dependencies.jar") | |
cl (java.net.URLClassLoader. (into-array [(java.net.URL. pom-uber-jar)])) | |
cx (.getContextClassLoader (Thread/currentThread))] | |
(push-thread-bindings {clojure.lang.Compiler/LOADER cl}) |
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
(defproject data_analyzer "0.1.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:url "http://example.com/FIXME" | |
:license {:name "Eclipse Public License" | |
:url "http://www.eclipse.org/legal/epl-v10.html"} | |
:main analyzer.core | |
:source-paths ["src/clj" "src/cljs"] | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[org.clojure/data.json "0.2.4"] | |
[org.clojure/clojurescript "0.0-2173"] |
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
(defproject cljs-gwt "0.1.0-SNAPSHOT" | |
:description "FIXME: write this!" | |
:url "http://example.com/FIXME" | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[org.clojure/clojurescript "0.0-2138"] | |
[compojure "1.0.4"] | |
[hiccup "1.0.0"]] | |
:plugins [[lein-cljsbuild "1.0.1"] |
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 test.core | |
(:require-macros [cljs.core.async.macros :refer [go]]) | |
(:require [cljs.core.async :refer [<! chan put!]] | |
[om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true])) | |
(enable-console-print!) | |
(def aidc (chan)) |
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
; using 2120 | |
(defprotocol P (m [x])) | |
(extend-protocol P | |
number | |
(m [x] (- x))) | |
(set! (.-foo js/Number.prototype) | |
#(this-as this (m this))) |
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
#lang racket | |
(require (prefix-in r: racket)) | |
(define-match-expander seq | |
(λ (stx) | |
(syntax-case stx () | |
[(_ p ...) | |
#'(app sequence->list (list p ...))]))) |