Skip to content

Instantly share code, notes, and snippets.

View JoeStanton's full-sized avatar

Joe Stanton JoeStanton

  • DeepMind
  • London
View GitHub Profile
after_success:
- chmod 600 deployment/key.pem
- ssh-add deployment/key.pem
- gem install capistrano
- cap deploy
@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'
@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 / 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 / pipe.js
Created January 28, 2016 11:36
Nice ES7 pipeline syntax
import {map, unique, sort} from "prelude-ls"
types
::map(v => v[type])
::unique
::sort
::map(toOption);
@JoeStanton
JoeStanton / pipe.js
Last active January 28, 2016 13:05
Piping - In the absence of the `|>` operator, a Clojure-like threading function
import {map, unique} from "prelude-ls";
function pipe(input, ...funcs) {
return funcs.reduce((step, f) => f(step), input);
}
function curry(fn, ...args) {
if (args.length >= fn.length) {
return fn(...args);
}