Skip to content

Instantly share code, notes, and snippets.

@levinalex
levinalex / gist:228213
Created November 6, 2009 19:37
wikipedia2git.rb
require 'httparty'
require 'grit'
require 'pathname'
module Wikipedia
class Revision
def initialize(article, revision)
@article = article
@revision = revision
@technoweenie
technoweenie / github_oauth_busy_developer_guide.md
Created May 30, 2010 18:34
GitHub OAuth Busy Developer's Guide

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
~/chef-repo(master) $ knife bootstrap 192.168.0.132
Bootstrapping Chef on 192.168.0.132
Failed to authenticate root - trying password auth
Enter your password:
192.168.0.132 [Wed, 23 Jun 2010 04:08:48 -0400] INFO: Client key /etc/chef/client.pem is not present - registering
192.168.0.132 [Wed, 23 Jun 2010 04:08:49 -0400] WARN: HTTP Request Returned 401 Unauthorized: Failed the authorization check
192.168.0.132 /usr/lib/ruby/1.8/net/http.rb:2101:in `error!': 401 "Unauthorized" (Net::HTTPServerException)
192.168.0.132 from /usr/lib/ruby/gems/1.8/gems/chef-0.9.0/bin/../lib/chef/rest.rb:216:in `api_request'
192.168.0.132 from /usr/lib/ruby/gems/1.8/gems/chef-0.9.0/bin/../lib/chef/rest.rb:267:in `retriable_rest_request'
192.168.0.132 from /usr/lib/ruby/gems/1.8/gems/chef-0.9.0/bin/../lib/chef/rest.rb:197:in `api_request'
.bar
.fill{:style => "width: #{(percent_full*100).round}%"}
#!/usr/bin/env ruby"
require 'rake/clean'
require 'rake/testtask'
task :default => :test
Rake::TestTask.new(:test) do |t|
t.warning = true
t.verbose = false
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
@ryansch
ryansch / hooks_controller.rb
Created September 28, 2010 15:03
Rails Controller for Chargify Webhooks
require 'md5'
class Chargify::HooksController < ApplicationController
protect_from_forgery :except => :dispatch
before_filter :verify, :only => :dispatch
EVENTS = %w[ test signup_success signup_failure renewal_success renewal_failure payment_success payment_failure billing_date_change subscription_state_change subscription_product_change ].freeze
def dispatch
event = params[:event]
@tpope
tpope / .gitattributes
Created October 24, 2010 20:38
Fewer conflicts in your Rails apps
Gemfile.lock merge=bundlelock
db/schema.rb merge=railsschema
@technicalpickles
technicalpickles / gist:654745
Created October 30, 2010 01:00
capistrano trix to upload `git diff --staged` and `git apply` that, instead of using `:scm: none` with `:deploy_via: copy`
after 'deploy:update_code' do
system("mkdir -p tmp && git diff --staged > #{rails_root}/tmp/staged.diff")
put File.read("#{rails_root}/tmp/staged.diff"), '/tmp/staged.diff'
run "cd #{latest_release} && if test -s /tmp/staged.diff; then git apply /tmp/staged.diff; fi"
end