I hereby claim:
- I am mccraigmccraig on github.
- I am mccraigmccraig (https://keybase.io/mccraigmccraig) on keybase.
- I have a public key whose fingerprint is 1200 ACF5 97F1 53C3 7246 5B5A 172A 5DB8 BFD8 9F3F
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
;;;;;;;;;;;;;;;;;;;;; macro | |
(ns clustermap.lastcall-method | |
(:require [clojure.tools.macro :refer [name-with-attributes]])) | |
(defn ^:private lastcall-method* | |
"defines an API method with last-call-wins semantics : returns a | |
channel of a single-value, the response | |
only responses corresponding to the the last |
(require '[cats.core :refer :all]) | |
(require '[cats.monad.continuation :as cont]) | |
(defn with-something | |
[config] | |
(cont/continuation | |
(fn [cc] | |
(prn (str "setting up something: " (pr-str config))) | |
(let [r (cc :something)] | |
(prn "tearing down something") |
(require '[clojure.algo.monads :refer :all]) | |
(defn with-something | |
[config] | |
(fn [cc] | |
(prn (str "setting up something: " (pr-str config))) | |
(let [r (cc :something)] | |
(prn "tearing down something") | |
r))) |
(ns clustermap.application | |
(:require [parenjin.application :as app] | |
[parenjin.job :as job] | |
[clustermap.config :as conf] | |
[clustermap.connectors :as conn] | |
[clomponents.control :as clomp])) | |
(def app-spec {:enjins { | |
:ping {:model :clustermap.datasets.ping.dataset/dataset} |
(ns delaymap | |
(:require [schema.core :as s]) | |
(:import [clojure.lang MapEntry])) | |
(defn ^:private deref-seq [underlying] | |
(when-first [[k v] underlying] | |
(lazy-seq (cons (MapEntry. k @v) (deref-seq (rest underlying)))))) | |
(defprotocol IValidatable | |
(schema [this]) |
(def state-field (first (filter #(= "state" (.getName %)) (seq (.getDeclaredFields (java.lang.Class/forName "clojure.lang.Agent")))))) | |
(.setAccessible state-field true) | |
(def foo (agent 1)) | |
(.set state-field foo 5) | |
user=> @foo | |
5 |
class Array | |
class Val | |
attr_reader :i | |
def initialize(i) | |
@i = i | |
end | |
def eql?(other) | |
other.is_a?(Val) && @i==other.i |
# evil Ruby dynamic variables | |
class DynamicValue | |
attr_read :default_value | |
def initialize(val) | |
@default_value = val | |
end | |
def method_missing(name, *args) |
#!/usr/bin/env ruby | |
# Trivial little twitter script | |
# Pass it a list of names as command line arguments | |
# and it will return a list of all people who follow everyone in the | |
# list. | |
# A person is implicitly assumed to follow themselves, so if foo follows | |
# bar and bar follows foo then common_followers foo bar would include | |
# both foo and bar in the output, but if bar did not follow foo it | |
# would include neither. |