Skip to content

Instantly share code, notes, and snippets.

View ttdonovan's full-sized avatar

Tanner Donovan ttdonovan

  • San Francisco, CA
View GitHub Profile
@larrylv
larrylv / converter_simple.rb
Last active October 7, 2015 07:00
Convert Hash to XML
require "minitest/autorun"
require "builder"
class Converter
XML_DECLARATION = %q(<?xml version="1.0" encoding="UTF-8"?>)
def self.to_xml(h)
raise unless h.kind_of? Hash
h.inject("") { |s, (k, v)| s += node_with(k, v) }
@mislav
mislav / geoip_service.rb
Created September 3, 2012 11:48
Simple GeoIP service class using freegeoip.net and Faraday
require 'faraday_middleware'
require 'hashie/mash'
# Public: GeoIP service using freegeoip.net
#
# See https://github.com/fiorix/freegeoip#readme
#
# Examples
#
# res = GeoipService.new.call '173.194.64.19'
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@kiesia
kiesia / attributes-default.rb
Created July 5, 2012 06:12 — forked from philwo/attributes-default.rb
Chef cookbook for nginx + passenger (compiled from source)
default['nginx']['version'] = "1.2.0"
default['nginx']['passenger']['version'] = "3.0.12"
<html>
<head>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="jquery.twitter.min.js"></script>
<style type="text/css">
body {background: #333; font-size: 64px; color: #999}
.twitter-posts {padding: 10px; list-style-type:none; border-bottom: 1px solid #000;}
.twitter-posts a {text-decoration:none; color: #FFF;}
</style>
<script type="text/javascript">
@tomdale
tomdale / gist:1856842
Created February 18, 2012 01:54
Ember documentation TODO

Documentation

TODO

  • API docs
  • How to bootstrap a project
  • Application structure (M/V/C layers and what they're for)
  • Getting started with Ember and Rails
  • Built-in controls
  • How events are handled and bubbled
@geemus
geemus / addendum.markdown
Created September 1, 2011 20:26
API - Assumptions Probably Incorrect
@aiwilliams
aiwilliams / config.rb
Created May 2, 2011 21:31
Sprockets producing Handlebars templates from Haml
http_path = "/"
css_dir = "public/stylesheets"
sass_dir = "sass"
images_dir = "public/images"
http_images_dir = "images"
javascripts_dir = "public/javascripts"
fonts_dir = "public/fonts"
http_fonts_dir = "fonts"
module Test
module Unit
TestCase = RSpec::Core::ExampleGroup
end
end
class Test::Unit::TestCase
def self.inherited(host)
host.set_it_up host.name.gsub(/(Spec|Test)/,'')
def host.method_added(name)
@topfunky
topfunky / Cakefile
Created April 14, 2011 22:18
Watch both Sass and Coffee files and compile on change (for Node.js)
###
Modified from https://github.com/jashkenas/coffee-script/blob/master/Cakefile
Part of an upcoming PeepCode screencast. This snippet is MIT Licensed.
###
{spawn, exec} = require 'child_process'
task 'assets:watch', 'Watch source files and build JS & CSS', (options) ->
runCommand = (name, args) ->