Skip to content

Instantly share code, notes, and snippets.

@mtnygard
mtnygard / gist:2254147
Created March 30, 2012 19:10
Books I recommended today
@mtnygard
mtnygard / gist:2638441
Created May 8, 2012 18:49
Books I recommended today - May 8, 2012
@mtnygard
mtnygard / gist:3306775
Created August 9, 2012 18:20
Retriable functions, written in CPS
(ns planck-server-nio.common
(:require (clojure.algo [monads :as m])))
(defn fail [x] (fn [c] nil))
(defn attempt [[a t f]]
(fn [c]
(if-let [result (f)]
result
(c [(inc a) t f]))))
@mtnygard
mtnygard / 00_readme
Created December 20, 2012 16:30
DEVS state machine
core.clj - DEVS state machine implementation. This ns provides construction functions as well as the generic evolver. A state machine is simply data about the allowed states, allowed inputs, and actions to trigger on transitions.
core-test.clj - Tests for DEVS
echo.clj - A sample usage. Illustrates construction and application of the state machine.
@mtnygard
mtnygard / query.clj
Created February 8, 2013 22:19
Use Datomic queries as a source for RxJava pipes.
(ns rxjava-datomic.query
(:require [datomic.api :as d])
(:use [clojure.repl :only [pst]])
(:import [rx Observable]
datomic.Peer))
(defn query [qry & inputs]
(Observable/toObservable
(Peer/q qry (object-array inputs))))
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px;
color: #333;
}
@mtnygard
mtnygard / First build, fails in units tests on operators
Created August 31, 2013 16:47
RxJava Non-deterministic build at commit [6a7ee812c7](https://github.com/Netflix/RxJava/commit/6a7ee812c75234ed01350b2fa168223f2d79c62e). All these transcripts are from a single shell, executed one after the other.
RxJava master mn › ./gradlew clean build
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
:language-adaptors:clean
:rxjava-contrib:clean
:rxjava-core:clean
:language-adaptors:rxjava-clojure:clean UP-TO-DATE
:language-adaptors:rxjava-groovy:clean UP-TO-DATE
:language-adaptors:rxjava-scala:clean UP-TO-DATE
:rxjava-contrib:rxjava-android:clean UP-TO-DATE
:rxjava-contrib:rxjava-swing:clean UP-TO-DATE

Reciprocal Needs in the Employment Relation

We can look at two sides of the management coin: What do the individuals get out of it? And what benefit does the whole system derive from it?

I will disregard any benefits that accrue to managers just by holding the position of managing. Those are just circular logic. Circular logic abounds in discussions of management and hierarchy. For example, consider status reports. It will be said that status reports are necessary so managers know what their employees are working on. It’s

@mtnygard
mtnygard / sm.clj
Created January 7, 2014 17:48
A really, really minimal state machine with validity checking.
(ns sm)
(defn satisfied?
[machine input [txn-state txn-input guard & _]]
(and (= (:state machine) txn-state) (= input txn-input) (if guard (guard machine input) true)))
(defn evolve
[m i]
(let [[_ _ _ next & actions] (first (filter #(satisfied? m i %) (:transitions m)))
_ (println actions)
Verifying that +mtnygard is my blockchain ID. https://onename.com/mtnygard