Skip to content

Instantly share code, notes, and snippets.

@glongman
glongman / gist:72884af5edebdfe5bec1
Last active September 21, 2015 13:37
Broadcast ssh login to Production into Slack
  1. create a slack webhook integration - copy the webhook url
  2. add following to top of ~/.ssh/config
Host *
  PermitLocalCommand yes
  1. add LocalCommand to host entry
Host production.example.com
 User ubuntu
@bbhoss
bbhoss / interfaxer.rb
Created July 27, 2012 23:09
Quick library that uses HTTParty to talk to the Interfax faxing service.
# MIT License
class Interfaxer
include HTTParty
base_uri "https://rest.interfax.net"
headers 'Content-Type' => 'application/pdf'
def initialize(username, password)
self.class.basic_auth(username, password)
end
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@nevans
nevans / resque_enqueue.rb
Created November 21, 2011 16:32
resque: queue.enqueue(job_selector, arg1, arg2)
# in response to https://twitter.com/#!/avdi/status/138513455622791168
# Yes, resque's enqueue API is wacky, but in practice it's not a problem,
# because it's trivial to route around.
# This is untested, and skips any resque enqueue hooks you might have setup.
# but those aren't major hurdles to fix.
class ResqueQueueWrapper
def initialize(queue, resque=Resque)
@queue = queue
@jonah-williams
jonah-williams / default.rb
Created March 16, 2010 23:36 — forked from ezmobius/default.rb
chef recipe to add delayed_job workers to monit to run them on Engine Yard cloud instances
#
# Cookbook Name:: delayed_job
# Recipe:: default
#
node[:applications].each do |app_name, data|
user = node[:users].first
case node[:instance_role]
when "solo", "app", "app_master"