Skip to content

Instantly share code, notes, and snippets.

View thetrav's full-sized avatar

Travis Dixon thetrav

View GitHub Profile
@thetrav
thetrav / Dockerfile
Created January 15, 2016 04:41
Ansible in Docker
FROM ubuntu
RUN apt-get update
RUN apt-get install -y wget build-essential python python-dev
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py
def double(i):
return i*2
def increment(i):
if i=='broken':
return None
return i+1
def flatten(listOfOptions):
return reduce(list.__add__, listOfOptions)
@thetrav
thetrav / test.html
Created October 19, 2014 02:17
Bacon Dispatch?
<html>
<head>
<title>test eventTicks</title>
<script src="js/lib/zepto-1.1.4.js"></script>
<script src="js/lib/bacon-0.7.12.js"></script>
<script>
$(function() {
var ticks = new Bacon.Bus();
ticks.plug($(".ticker").asEventStream("click", function() {
return {tick: 1};
@thetrav
thetrav / gist:7382137
Last active December 27, 2015 20:09
sample pact matchers
{
"provider": {
"name": "Animal Service"
},
"consumer": {
"name": "Zoo App"
},
"interactions": [
{
"description": "a request for animals",
@thetrav
thetrav / LazyVariables.groovy
Created October 10, 2012 07:18
Groovy Lazy Instance Variables
class LazyVariables {
def lazy(variables) {
variables.each { name, init ->
def chars = name.toCharArray()
chars[0] = Character.toUpperCase(chars[0])
def getter = "get${new String(chars)}"
this.metaClass[getter] = {
def value = init()
this.metaClass[name] = value
this.metaClass[getter] = { value }