Skip to content

Instantly share code, notes, and snippets.

View bobthecow's full-sized avatar

Justin Hileman bobthecow

View GitHub Profile
<?xml version="1.0"?>
<root>
<item>
<name>Truly Ergonomic Keyboard</name>
<!--
DIP switch settings:
1 2 3 4 5
last_response.body.should match_json({
user: {
id: :user_id,
username: 'chancancode',
full_name: 'Godfrey Chan',
email: 'godfrey@example.com',
type: 'Administrator',
points: Fixnum,
homepage: /\Ahttps?\:\/\/.*\z/i,
created_at: WILDCARD_MATCHER,
@bobthecow
bobthecow / match_json.rb
Created July 10, 2012 22:15
match_json
require 'json_expressions'
RSpec::Matchers.define :match_json do |expected|
unless JsonExpressions::Matcher === expected
expected = JsonExpressions::Matcher.new(expected)
end
match do |actual|
actual = JSON.parse(actual) if String === actual
expected =~ actual
@bobthecow
bobthecow / fishfish.rb
Created June 13, 2012 15:59
brew install fishfish
require 'formula'
class Fishfish < Formula
homepage 'http://ridiculousfish.com/shell'
url 'https://github.com/fish-shell/fish-shell.git'
depends_on 'autoconf' => :build
depends_on 'readline'
skip_clean 'share/doc'
#!bash
#
# nanoc-completion
# ================
#
# Bash completion support for nanoc
#
#
# Installation
# ------------
@bobthecow
bobthecow / radio_mustach_example.html
Created March 5, 2012 15:23 — forked from ebaxt/radio_mustach_example.html
Checking radio with Mustache
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/mustache.js"></script>
</head>
<body>
<div id="formWrapper">
@bobthecow
bobthecow / html_compressor.rb
Created February 29, 2012 22:36 — forked from dutygeeks/html_compressor.rb
HTML COMPRESSOR
require 'html_compressor'
class HtmlCompressor < Nanoc3::Filter
identifier :html_compressor
# Runs the content through htmlcompressor.
#
# This method optionally takes options to pass directly to htmlcompressor
#
# @param [String] content The content to filter
# Rules:
compile '*' do
if not item.binary?
if item[:kind] == 'image'
layout 'image'
else if item[:kind] == 'link'
layout 'link'
else
layout 'item'
class Item
def pretty_date
"<time class=\"timeago created-at\" datetime=\"#{Time.parse(self[:created_at]).iso8601}\">#{Date.parse(self[:created_at]).strftime('%e %B %Y')}</time>"
end
end
<?php echo str_repeat(file_get_contents(__FILE__, false, null, __COMPILER_HALT_OFFSET__), 2);
__halt_compiler();
<?php echo str_repeat(file_get_contents(__FILE__, false, null, __COMPILER_HALT_OFFSET__), 2);
__halt_compiler();