Skip to content

Instantly share code, notes, and snippets.

@hedgehog
hedgehog / mt_ragel_poc.rl
Last active May 9, 2017
Proof of concept simplying Machinetalk FSM & bindings
View mt_ragel_poc.rl
#
# 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 / mre.dot
Created Jul 27, 2015
Minimal reproducible example: Parent node labels mssing
View mre.dot
strict digraph structs {
graph [bb="0,0,582,464"];
node [label="\N"];
subgraph cluster_h1a_h1c {
graph [bb="8,8,252,456",
label="Host (h1d):h1a",
lheight=0.21,
lp="130,444.5",
lwidth=1.14
];
@hedgehog
hedgehog / consume_json.rb
Created Sep 29, 2012 — forked from andreacampi/consume_json.rb
cookbooks/consume_json/libraries/consume_json.rb
View 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 Jun 12, 2012
middleman issue #442 for version 2.0.15
View lib-redcarpet.rb
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 Jun 4, 2012 — forked from mbleigh/Gemfile
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
View Gemfile
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 Apr 2, 2012 — forked from ryansch/hooks_controller.rb
Rails Controller for Chargify Webhooks
View hooks_controller.rb
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 Feb 21, 2012
Robust ec2 meta-data collection
View robust_ohai_ec2.rb
# 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 Jan 31, 2012
rbenv install and system wide install on Ubuntu 10.04 LTS.
View rbenv-install-system-wide.sh
# 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 Jan 21, 2012 — 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/)
View _multi-line-button.scss
@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 / gist:1605596
Created Jan 13, 2012
HAML snippet: loopable?
View gist:1605596
.info-block-1
.info-title
%h1= link_to "A", "#"
%h2 a
.infoText
%p aaa
.info-block-2
.info-title
%h1= link_to "B", "#"
%h2 b