Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Hileman bobthecow

View GitHub Profile
View gist:3855290
<?xml version="1.0"?>
<root>
<item>
<name>Truly Ergonomic Keyboard</name>
<!--
DIP switch settings:
1 2 3 4 5
View new.rb
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,
View match_json.rb
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 Jun 13, 2012
brew install fishfish
View fishfish.rb
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'
View nanoc-completion.bash
#!bash
#
# nanoc-completion
# ================
#
# Bash completion support for nanoc
#
#
# Installation
# ------------
View radio_mustach_example.html
<!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">
View html_compressor.rb
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
View Rules
# Rules:
compile '*' do
if not item.binary?
if item[:kind] == 'image'
layout 'image'
else if item[:kind] == 'link'
layout 'link'
else
layout 'item'
View gist:1366147
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
View quine.php
<?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();
You can’t perform that action at this time.