Skip to content

Instantly share code, notes, and snippets.


Mars Hall mars

View GitHub Profile
paulp / global.sbt
Last active Oct 16, 2018
continuous compilation of the sbt build
View global.sbt
// These lines go in ~/.sbt/0.13/global.sbt
watchSources ++= (
(baseDirectory.value * "*.sbt").get
++ (baseDirectory.value / "project" * "*.scala").get
++ (baseDirectory.value / "project" * "*.sbt").get
addCommandAlias("rtu", "; reload ; test:update")
addCommandAlias("rtc", "; reload ; test:compile")
addCommandAlias("ru", "; reload ; update")
View Articles.js
import React from 'react'
import Router from 'react-router/BrowserRouter'
import Match from 'react-router/Match'
import Link from 'react-router/Link'
import Redirect from 'react-router/Redirect'
function elementInViewport(el) {
var top = el.offsetTop
var left = el.offsetLeft
var width = el.offsetWidth
function how-big-is {
local library="$1"
npm install "$library" uglifyjs webpack
echo "require('$library')" > index.js
./node_modules/.bin/webpack . build.js
./node_modules/.bin/uglifyjs build.js -cmo build-min.js 2> /dev/null
gzip -c build-min.js > build-min.js.gz
ls -lh build*
andymatuschak /
Last active Apr 12, 2021
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

kgrz /
Created Jun 20, 2016
Possible workaround for installing nokogiri 1.6.8 on OSX with brewed libxml2 2.9.4


The following commands fail on OSX:

gem install nokogiri
gem install nokogiri -- --use-system-libraries
gem install nokogiri -- --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-xml2-dir=/usr/local/opt/libxml2


maxvt /
Last active Apr 3, 2021
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

nruth /
Created Jan 19, 2016
rails migration pg_dump: invalid option -- 'i'

If you start to see something like this, e.g. on Heroku since they installed the postgres 9.5 client libraries on their dynos

/usr/lib/postgresql/9.5/bin/pg_dump: invalid option -- 'i'
Try "pg_dump --help" for more information.
rake aborted!
Error dumping database
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.4/lib/active_record/tasks/postgresql_database_tasks.rb:55:in `structure_dump'
arturmkrtchyan /
Last active Jan 7, 2021
Apache Spark Hidden REST API
curl http://spark-cluster-ip:6066/v1/submissions/status/driver-20151008145126-0000
View gist:fd7e987c832cc4efaa56

Hi Zach :D

Modals are funny beasts, usually they are a design cop-out, but that's okay, designers have to make trade-offs too, give 'em a break.

First things first, I'm not sure there is such thing as a "simple" modal that is production ready. Certainly there have been times in my career I tossed out other people's "overly complex solutions" because I simply didn't understand the scope of the problem, and I have always loved it when people who have a branch of experience that I don't take the time

cowboyd / mutable-collection.js
Created Mar 26, 2015
Present a mutable interface to an immutable array and track changes in realtime
View mutable-collection.js
import Ember from 'ember';
* Presents a mutable interface to an immutable array.
* As you make changes to the array, it tracks which objects are new,
* which objects have been removed, and which objects were in the
* original array. To use an instance of this class, set the
* `original` property to an array. This array will not be touched as
* you make changes via the mutable interface. E.g.