Skip to content

Instantly share code, notes, and snippets.

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:
@hedgehog
hedgehog / gist:386057
Created May 1, 2010 04:43
EC2 AMI with chef-server installed
# install_chef_server.sh
#
# From list post by John Merrells <john@merrells.com>
# Modified by Mike Bailey <mike@bailey.net.au>
logfile="/root/log.txt"
echo "-----" >> $logfile
# New sources.list
cat > /etc/apt/sources.list << EOF
@hedgehog
hedgehog / mt_ragel_poc.rl
Last active May 9, 2017 12:05
Proof of concept simplying Machinetalk FSM & bindings
#
# Machinetalk FSM event runner: Ruby Proof-of-concept
#
#
# MIT License
#
# Copyright (c) 2017 Hedgehog
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@hedgehog
hedgehog / consume_json.rb
Created September 29, 2012 13:52 — forked from andreacampi/consume_json.rb
cookbooks/consume_json/libraries/consume_json.rb
class Chef
module Mixin
module ConsumeJson
def consume_json(url)
Chef::Log.debug "consume_json: requesting url: #{url}"
info = nil
fetch(url) do |data|
info = JSON.parse(data)
Chef::Log.debug "consume_json: parsed: #{info.inspect}"
@hedgehog
hedgehog / lib-redcarpet.rb
Created June 12, 2012 02:29
middleman issue #442 for version 2.0.15
require "tilt"
require "redcarpet"
puts 'loading custom...'
module ::Middleman
module Renderers
class RedcarpetTemplate < ::Tilt::RedcarpetTemplate::Redcarpet2
# Overwrite built-in Tilt version.
@hedgehog
hedgehog / Gemfile
Created June 4, 2012 12:47 — forked from mbleigh/Gemfile
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
source "https://rubygems.org"
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'handlebars_assets'
gem 'coffee-script'
@hedgehog
hedgehog / hooks_controller.rb
Created April 2, 2012 01:52 — forked from ryansch/hooks_controller.rb
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]
@hedgehog
hedgehog / robust_ohai_ec2.rb
Created February 21, 2012 04:53
Robust ec2 meta-data collection
# Ohai Eec2 meta-data collections and `looks_like_ec2?`
# were broken in at least: 0.6.4 and 0.6.10
#
# Invitation for wrath of the G-ds:
# This gist always seems to have worked to extract (some?/all?) meta-data
#
# Aslo allows us to avoid #all_plugins, which has needed wait functionality.
# See:
# http://www.danpisarski.com/2010/08/22/loading-only-the-data-you-want-in-ohai/
#
@hedgehog
hedgehog / rbenv-install-system-wide.sh
Created January 31, 2012 21:07
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@hedgehog
hedgehog / _multi-line-button.scss
Created January 21, 2012 11:46 — forked from jlong/_multi-line-button.scss
Sass files converted to SCSS from the article: [Multi-line Buttons with Compass, Sass, and CSS3](http://wiseheartdesign.com/articles/2010/10/19/multi-line-buttons-with-compass-sass-and-css3/)
@mixin multi-line-button($base-color) {
@include background-clip("padding-box");
border-width: 1px;
@include border-radius(6px);
border-style: solid;
color: white;
display: block;
margin: 0.2em auto;
padding: 12px 15px;
text-align: center;