Skip to content

Instantly share code, notes, and snippets.

View JoeStanton's full-sized avatar

Joe Stanton JoeStanton

  • DeepMind
  • London
View GitHub Profile
@JoeStanton
JoeStanton / .travis.yml
Created January 23, 2013 14:15
Example Travis Configuration
---
language: node_js
node_js:
- 0.8
notifications:
email:
- 'joe.stanton@red-badger.com'
after_success:
- chmod 600 deployment/key.pem
- ssh-add deployment/key.pem
- gem install capistrano
- cap deploy
@JoeStanton
JoeStanton / deploy.rb
Created January 25, 2013 10:13
Example Capistrano Deployment file for Node.js Projects
set :application, "SampleApp"
set :repository, "."
set :scm, :none
set :use_sudo, false
set :keep_releases, 5
#Use the copy method which will compress and scp the files
set :deploy_via, :copy
set :main_js, "app.js"
@JoeStanton
JoeStanton / Vagrantfile
Created February 6, 2013 12:16
A typical Vagrantfile. Web: Nginx+ Node.js DB: MongoDB + Redis
Vagrant::Config.run do |config|
config.vm.define :web do |web|
web.vm.box = "precise64"
web.vm.box_url = "http://files.vagrantup.com/precise64.box"
web.vm.network :hostonly, "192.168.100.10"
web.vm.host_name = "web.local"
web.vm.provision :chef_solo do |chef|
chef.add_recipe "ohai"
@JoeStanton
JoeStanton / package_for_ec2.rb
Created February 6, 2013 14:23
Packaging a Vagrant VM up for EC2 Provisioning
def package_for_ec2 config, chef
require 'json'
open "chef/#{config.vm.host_name.split('.')[0]}.json", 'w' do |f|
chef.json[:run_list] = chef.run_list
f.write chef.json.to_json
end
end
@JoeStanton
JoeStanton / ec2-provision.sh
Last active January 18, 2019 07:47
Install Chef-Solo and provision the specified role on a bare EC2 instance.
#!/usr/bin/env bash
echo Starting to provision server with role: $1
echo -e "\nInstalling and bootstrapping chef-solo..."
apt-get -y update
apt-get --no-install-recommends -y install build-essential ruby ruby-dev rubygems libopenssl-ruby
gem install chef ruby-shadow --no-ri --no-rdoc
echo 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/lib/gems/1.8/bin"' > /etc/environment
@JoeStanton
JoeStanton / Sharepoint.coffee
Created June 13, 2013 13:44
Sharepoint.coffee
request = require 'request'
_ = require 'underscore'
url = require 'url'
log = require '../log'
async = require 'async'
config = require '../config'
Parser = new require('xml2js').Parser
@JoeStanton
JoeStanton / gist:7303910
Created November 4, 2013 15:11
Example manual instrumentation in Ruby
StatsD.increment 'user.signups'
StatsD.measure 'user synchronization' do
Users.sync()
end
@JoeStanton
JoeStanton / gist:7303958
Created November 4, 2013 15:14
Sample task that can be hooked into Capistrano for deploy-time annotations.
require 'librato/metrics'
REPO_NAME = 'JoeStanton/my-project'
Librato::Metrics.authenticate 'joe.stanton@red-badger.com', 'API_KEY'
sha, msg = `git log -n 1 --pretty="%h:%s"`.strip.split(":", 2)
Librato::Metrics.annotate :deployments, "Deployed #{sha}", {
description: msg,
links: [ {rel: "github", href: "http://github.com/#{REPO_NAME}/commit/#{sha}"} ]
}
@JoeStanton
JoeStanton / Gemfile
Last active September 15, 2016 08:48
React onChange event not firing under Poltergeist
source "https://rubygems.org"
gem 'rspec'
gem 'capybara'
gem 'poltergeist'
gem 'selenium-webdriver'