Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby -wKU
require 'pp'
require 'open-uri'
# the page that holds the registry (updated often)
registry = 'http://www.iana.org/assignments/language-subtag-registry'
culture_codes = Hash.new('')
current = ""
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'haml'
configure do
set :folder_name, 'pictures_of_me'
set :root, File.dirname(__FILE__)
#!/usr/bin/env ruby -wKU
# http://en.wikipedia.org/wiki/Quadratic_alphabet_code
require 'pp'
class TapCode
attr_reader :letters, :array
def initialize
\documentclass[12pt]{amsart}
% this should add multiline comments
\usepackage{verbatim}
\usepackage{graphicx}
\begin{document}
\noindent
Dana Merrick \\
@dmerrick
dmerrick / dnmrrck.js
Created May 20, 2010 04:06
A cheap SCVNGR clone to try out node.js
// config variables
var port = 8090,
host = "localhost";
// define the clues and answers
var clues = ['What is the most beautiful programming language?',
'That\'s right! What is the greatest city in the USA?',
'Perfect! Who makes the best online scavenger hunts?'],
answers = ['Ruby',
class AddPasswordToOwner < ActiveRecord::Migration
def self.up
add_column :owners, :crypted_password, :string, :limit => 40
add_column :owners, :salt, :string, :limit => 40
end
def self.down
remove_column :owners, :crypted_password
remove_column :owners, :salt
end
@dmerrick
dmerrick / autotest.rb
Created July 21, 2010 18:32
Use this to make autotest work with Growl.
# save this file as ~/.autotest
# start autospec with ./script/autospec
# you may need to install the "autotest" and "autotest-rails-pure" gems
# if you have any issues getting this to work (like Growl notifications not appearing),
# take a look at the README found here: http://github.com/svoop/autotest-growl
begin
# a mixin to provide logging and nagios monitoring to cron jobs
module Utils
module BCMCronJob
# set up the log file
# we could also simply use RAILS_DEFAULT_LOGGER
def before_job
log_file_name = "bcm_cron.log"
@log_file ||= File.open(File.join(Rails.root, 'log', log_file_name), 'a')
------- Apache processes --------
### Processes: 0
### Total private dirty RSS: 0.00 MB
--------- Nginx processes ----------
PID PPID VMSize Private Name
------------------------------------
#!/bin/bash
# This script fills in some of the gaps on an Engine Yard cluster deploy.
# -Dana
# I could probably use ARGV for this, but whatever.
THIS_ENV=staging
# move into our home directory
cd