Skip to content

Instantly share code, notes, and snippets.

Guacamole
2 avocados
½ tsp kosher salt
several grinds of black pepper
2-3t fresh lime or lemon juice
1 roma tomato, chopped
¼ finely chopped onion (i prefer red)
4T chopped fresh cilantro leaves
1 jalapeno, seeded/deveined (1 chipotle or serrano are 2nd/3rd choices)
@gnarl
gnarl / jar_compare.rb
Last active December 18, 2015 13:19
Find JAR file differences between git commits. Usage: ruby jar_compare.rb current_commit prev_commit git_directory
require 'fileutils'
require 'awesome_print'
def find_jars(revision, path)
FileUtils.cd path
puts %x{git checkout #{revision}}
result = []
@gnarl
gnarl / server_build.rb
Created May 31, 2013 18:27
server build script
#!/usr/bin/ruby
require 'fileutils'
HOME_DIR = '/Users/cfouts/'
SNAP_DIR = HOME_DIR + 'Sandbox/snapcreator/'
FRAME_DIR = SNAP_DIR + 'SC-Framework/'
SERV_DIR = FRAME_DIR + 'server/'
GUI_DIR = FRAME_DIR + 'GUI/'
@gnarl
gnarl / house_hunt.rb
Created March 2, 2013 01:49
Scraping Trulia to find a house
require 'mechanize'
require 'awesome_print'
BASE = "http://www.trulia.com"
PREFIX = "/for_sale/"
PRICE = "215000-262000_price/"
NL = "7_nl/"
require 'rest-client'
require 'json'
require 'pp'
DEBUG = true
TAB = " "
HOST = 'https://api.github.com/'
PORT = '443'
@gnarl
gnarl / ReverseString.java
Created April 22, 2012 01:16
Recursive String Reverse
public class ReverseString {
public static void main(String[] argv) {
String origString = argv[0];
System.out.println(origString);
System.out.println(reverse(origString));
}
public static String reverse(String str){
char[] strAry = str.toCharArray();
@gnarl
gnarl / NodeCircle.java
Created April 22, 2012 00:48
Circular Linked List
/**
* NodeCircle is a demo class that implments a size N linked list of nodes. The
* last node is then set to point to the first node creating a circular linked
* list. The method removeEveryFifthNode then removes every fifth node starting
* from the first node while maintaining the cicular linked list.
*/
public class NodeCircle
{
@gnarl
gnarl / rippy_back.rb
Created April 3, 2012 17:25
PG Setup and Backup
require 'logger'
require 'active_record'
require 'awesome_print'
# edit postgresql.conf, using /tmp/pg for testing
# http://www.postgresql.org/docs/9.1/interactive/continuous-archiving.html
# wal_level = archive
# archive_mode = on
# archive_command = 'test ! -f /tmp/pg/%f && cp %p /tmp/pg/%f'
@gnarl
gnarl / palindrome_test.rb
Created February 29, 2012 18:07
ruby unit test example
require 'test/unit'
require 'palindrome'
require 'awesome_print'
class PalindromeTest < Test::Unit::TestCase
SAS_P = "sas"
def setup
end
@gnarl
gnarl / itunes_service
Created November 11, 2011 03:52
My Sun Eyed Girl
# itunes_service.rb
require 'sinatra'
require 'json'
require './applay'
get '/music/play' do
ItunesAppScript.new.play
end