Skip to content

Instantly share code, notes, and snippets.

@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 / mre.dot
Created July 27, 2015 05:01
Minimal reproducible example: Parent node labels mssing
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 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;
@hedgehog
hedgehog / gist:1605596
Created January 13, 2012 11:14
HAML snippet: loopable?
.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