Skip to content

Instantly share code, notes, and snippets.

View dougalcorn's full-sized avatar

Doug Alcorn dougalcorn

View GitHub Profile
@jimweirich
jimweirich / pullrequest.rb
Created May 5, 2013 00:51
Script I use to pull in pull requests from GitHub
#!/usr/bin/ruby -wKU
if ARGV.empty?
puts "Usage: pullrequest user:branch"
exit 1
end
url = `git config --get remote.origin.url`
unless %r{([^/]+)\.git$} =~ url
puts "Unable to determine repo from url (#{url})"
@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"
@stevebourne
stevebourne / Gemfile
Created April 15, 2012 19:28
Add facebook auth to a Clearance app, using omniauth-facebook
gem 'omniauth'
gem 'omniauth-facebook'
gem 'clearance'
@rubyist
rubyist / Rakefile
Created August 15, 2011 18:06
coffee compiling rakefile
require 'coffee_script'
require 'rake/clean'
def coffee_to_js(coffee)
File.join(BUILDDIR, File.dirname(coffee.split('/')[1..-1].join('/')), File.basename(coffee).ext('js'))
end
JSFILE = 'app.js'
JSPATH = "_attachments/js/app/#{JSFILE}"
COFFEE = FileList['coffeescript/**/*.coffee']
@rab
rab / with_log_level.rb
Created March 31, 2011 13:48
temporarily change the logging level for the duration of a block
require 'logger'
module WithLogLevel
def with_log_level(level=Logger::INFO)
if logger
begin
original_level = logger.level
logger.level = level
yield
ensure
@tbtlr
tbtlr / get_barcode_from_image.js
Created June 1, 2010 19:33
Barcode recognition with JavaScript - Demo: http://bit.ly/djvUoy
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
# credits
# http://github.com/hartcode/serverjuice/
# http://blog.fiveruns.com/2008/3/3/compiling-ruby-rubygems-and-rails-on-ubuntu
# http://www.rubyinside.com/how-to-install-a-ruby-18-stack-on-ubuntu-810-from-scratch-1566.html
# upgrade packages
apt-get update
apt-get upgrade
# install reasonably easy-to-use text editor (skip this if you can wield something greater)