Skip to content

Instantly share code, notes, and snippets.

@alloy-d
alloy-d / how-do-i-host.yml
Created August 26, 2015 20:35
Experimenting with getting a specific host's IP in Ansible
---
- name: "debug hosts"
hosts: "tag_ov_env_future"
tasks:
- name: "what is play_hosts?"
debug: var=play_hosts
# - name: "what are the variables for these hosts?"
# debug: "var=hostvars[item]['ec2_dns_name']"
# with_items: play_hosts
@alloy-d
alloy-d / ruby.rubocop.yml
Last active August 29, 2015 14:24
Overture house style guide.
# # Overture's House Style Guide for Ruby
#
# This is a configuration file for [Rubocop][rubocop].
#
# It is based on [the default configuration file for Rubocop
# 0.32.1][rubocop-source-default-config].
#
# This style guide assumes that you are not writing code for any version
# of Ruby before version 1.9.
#
@alloy-d
alloy-d / gittest.yml
Created April 1, 2015 16:49
Ansible playbook for a simple test of what data comes from the git module.
- hosts: localhost
connection: local
gather_facts: false
tasks:
- name: clone test repo
git:
repo: git://github.com/intridea/hashie
update: yes
version: master
dest: repo
@alloy-d
alloy-d / build-image.sh
Created February 10, 2015 20:30
Build multiple docker images using the same Ansible directory as build context.
#!/bin/sh
if [ "$1" = "" ]; then
echo "Please specify the name of an image in the images directory."
fi
DIR="images/${1}"
if [ ! -d "$DIR" ]; then
echo "${DIR} doesn't exist!"
@alloy-d
alloy-d / subscriber.js
Created February 6, 2015 16:24
Minimal mixin for managing Bacon subscriptions alongside the React component lifecycle.
define(function () {
"use strict";
var Subscriber = {
componentDidMount: function () {
this._unsubscribers = [];
},
componentWillUnmount: function () {
var i, len = this._unsubscribers.length;
for (i = 0; i < len; i += 1) {
(add-to-list 'exec-path "/usr/local/bin")
(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))
(add-to-list 'exec-path "/Users/adam/.rbenv/shims/bundle")
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
(add-to-list 'package-pinned-packages '(cider . "melpa-stable") t)
package main
import (
"fmt"
"math"
)
func main() {
str := fmt.Sprintf("%v", math.MaxUint64)
fmt.Printf("MaxUint64 is %v.\n", math.MaxUint64)
@alloy-d
alloy-d / validations.js
Last active August 29, 2015 14:13
a less-awful validation framework.
// ## Goals
//
// We want a validation framework with the following attributes:
//
// - Data validations can be specified alongside the data model.
// - Validations match the specificity of the data they validate
// (i.e., if there's a problem with `model.items[1]`, the validation
// fails for `model.items[1]`, *not* `model.items`).
// - Validations can be serialized with the data they validate.
// - Validations can be applied piecemeal: validating `model.thingy`
@alloy-d
alloy-d / autocompleter.rb
Created January 5, 2015 22:15
Finish sentences using Google autocomplete!
require 'capybara'
require 'forwardable'
class GoogleCompleter
extend Forwardable
attr_accessor :session
def_delegator :session, :evaluate_script, :js
def initialize
@alloy-d
alloy-d / selenium-test.rb
Created October 14, 2014 18:17
Nonsense with Capybara and threads
require 'thread'
require 'capybara'
Capybara.register_driver :selenium_chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
class SeleniumTest
class SeleniumThread
def initialize(queue, done)