Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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;
@hedgehog
hedgehog / features|focus_test.feature
Created January 3, 2012 01:22 — forked from mattheworiordan/features|focus_test.feature
Capybara-Webkit focus on an element test that fails
Feature: Capybara Webkit focus test
In order to show that Capybara Webkit does not allow an element to maintain focus
I created this feature
Which anyone can try
@javascript
Scenario: Run demo page
When I am on the capybara demo page
Then I should see a successful result
@hedgehog
hedgehog / chat.rb
Created January 2, 2012 20:26 — forked from rkh/chat.rb
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
@hedgehog
hedgehog / reference.mkdn
Created January 2, 2012 07:55 — forked from mirisuzanne/reference.mkdn
Susy Documentation / Reference

Susy Reference

Terms

  • Susy Grid: A grid that you build with Susy. You can have multiple on one page if you need.
  • Grid Element: Any HTML element that is aligned to a Susy Grid.
  • Container: The root element in a Susy Grid. Anything inside it is a potential Grid Element.
  • Context: Either root (default) or the number of columns spanned by the parent Grid Element.
@hedgehog
hedgehog / gist:1506046
Created December 21, 2011 13:28 — forked from mitchellh/gist:1277049
Configure Vagrant VM to use Host DNS for VPN
Vagrant::Config.run do |config|
# ...
config.vm.customize do |vm|
# Use the host resolver for DNS so that VPN continues
# to work within the VM
vm.network_adapters.each do |na|
if na.enabled? && na.nat_driver
na.nat_driver.dns_use_host_resolver = true
end
@hedgehog
hedgehog / sortable.rb
Created December 7, 2011 21:35 — forked from jarib/sortable.rb
jquery ui sortable w/ webdriver
require 'selenium-webdriver'
pr = Selenium::WebDriver::Firefox::Profile.new
pr.native_events = true
d = Selenium::WebDriver.for :firefox, :profile => pr
d.get "http://jqueryui.com/demos/sortable/"
list = d.find_element(:id, 'sortable').find_elements(:tag_name, 'li')
d.action.drag_and_drop_by(list[0], 0, 200).perform