Skip to content

Instantly share code, notes, and snippets.

@mikejholly
mikejholly / longshoreman.md
Last active August 29, 2015 14:02
Longshoreman

Longshoreman

Longshoreman automates application deployment using Docker. Create a Docker repository (or use a service), configure the cluster using AWS or Digital Ocean (or whatever you like) and deploy applications using a Heroku-like CLI tool. We're currently using it in production at Wayfinder.

Why?

We created Longshoreman because we fell in love with Docker but were frustrated with the lack of production-ready deployment options that were available at the time. We looked closely at Deis, Flynn, Dokku and others, but they either did not meet our requirements or were explicitly marked as non ready for production. We were extremely impressed by Deis in particular and it's use of bleeding edge technologies like CoreOS, etcd and systemd. The biggest complaint we have about Deis is it's inability to relaunch applications using the Docker registry (at least when we last researched it).

How?

Newark - Travel Time Estimates
Distance from Caffe Gelato to Peace A Pizza
274m (1m)
Distance from Caffe Gelato to Mario's Pizza
4093m (7m)
Distance from Caffe Gelato to Del Pez
160m (1m)
@mikejholly
mikejholly / Common Grammer
Created December 31, 2011 18:48
TextMate whitespace include
{ scopeName = 'source';
patterns = (
{ name = 'source.invalid.trailing-whitespace';
match = '(\s*$)?';
captures = { 1 = { name = 'invalid.trailing-whitespace'; }; };
},
);
}
@mikejholly
mikejholly / gist:3724921
Created September 14, 2012 21:19
PHP Recursion Fun
<?php
$a = array(
'foo' => array(
'bar' => array(
'baz' => 'foo',
'bar' => array(
'loo' => 'poo'
),
),
<?php
function screenshot_url($url) {
$token = md5($url . $secret);
$img = "http://api.screenshotshark.com/$key/$token/png/?url=" . urlencode($url);
}
?>
<img src='<?php echo screenshot_url("http://news.google.com") ?>' />
@mikejholly
mikejholly / gist:5347776
Created April 9, 2013 17:45
Check out this highly readable bit of JS from Drupal wysiwyg.
Drupal.wysiwyg.editor.attach[params.editor](context, params, (Drupal.settings.wysiwyg.configs[params.editor] ? jQuery.extend(true, {}, Drupal.settings.wysiwyg.configs[params.editor][params.format]) : {}));
<?php
// Check for token
if (empty($_REQUEST['jwt'])) {
return drupal_not_found();
}
// Load token
$payload = $_REQUEST['jwt'];
# Get API token for authorization header
token = session.get "apiToken"
id = record.get "_id"
###
xhr = new XMLHttpRequest()
xhr.onreadystatechange = ->
console.log arguments
xhr.open "DELETE", "http://#{ENV.domains.crud}/api/v1/pathways/#{id}"
xhr.setRequestHeader "Authorization", "Token token=#{token}"
#!/bin/bash
PARENT=$1
VERSION=$2
BRANCH=feature/core-bump-$VERSION
if [[ -z $PARENT || -z $VERSION ]]; then
echo "Usage: $0 <dir-with-repos> <core-version>"
exit 1
fi
@mikejholly
mikejholly / gist:759ee1747b5ddb5ba052
Created March 11, 2015 03:01
Knuth Algorithm U Set Partitions
class Partitioner
def initialize(ns, m)
@ns = ns
@m = m
end
def partitions()
n = @ns.length
a = [0] * (n + 1)