Skip to content

Instantly share code, notes, and snippets.

View tonycoco's full-sized avatar

Tony Coconate tonycoco

View GitHub Profile
# Get this working in an initializer...
%w(zipcode, city, designated_market_area, core_based_statistical_area).each do |t|
Zips::<t's classified name here>.set_schema("")
Zips::<t's classified name here>.set_table_name("zips_#{t.pluralize}")
end
@tonycoco
tonycoco / jmeterxmltocsv.rb
Created November 3, 2010 19:58
A quick script to convert JMeter log XML files to CSV files for Excel imports (Since, Excel can't import XML data... wow.)
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
XML_FILE = ARGV[0]
CSV_FILE = ARGV[1]
if XML_FILE.nil? || CSV_FILE.nil?
puts 'usage: ruby jmeterxmltocsv.rb source_file target_file'
@tonycoco
tonycoco / My IRBRC
Created April 1, 2011 15:21
Just a few good things to do for your Rails 3 applications in IRBRC
%w[rubygems wirble pp ap].each do |gem_name|
begin
require gem_name
rescue LoadError => err
warn "Please do: gem install #{gem_name.sub(/\/.*/,'')}"
end
end
Wirble.init
Wirble.colorize
@tonycoco
tonycoco / gist:1528711
Created December 28, 2011 17:08
TextMate Patterns
File:
!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
Folder:
!.*/(\.[^/]*|doc|log|solr|public/uploads|public/system|tmp|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$
@tonycoco
tonycoco / pow_debugger
Created April 10, 2012 03:54
POW! Debugger
# Debugging with POW!
#
# Setup POW!'s ~/.powconfig with the following:
# export POW_WORKERS=1
# export POW_TIMEOUT=3600
#
# Run `bundle exec rdebug -c` in the Terminal to start the debugger
if (Rails.env.development? || Rails.env.test?) && !(defined?($rails_rake_task) && $rails_rake_task)
puts "=> Debugger enabled"
@tonycoco
tonycoco / rubyhashsyntax.rb
Created May 11, 2012 17:17
Confusing Ruby Hash Syntax
# New
range :percentile, from: percentile[0], to: 1
# Old
range :percentile, :from => percentile[0], :to => 1
@tonycoco
tonycoco / image_filters.rb
Created June 11, 2012 15:04
Useful image filters (Instagram/Hipster/Cool) for CarrierWave using MiniMagick (ImageMagick)
module CarrierWave
module MiniMagick
def toaster_filter
manipulate! do |img|
img.modulate '150,80,100'
img.gamma 1.1
img.contrast
img.contrast
img.contrast
img.contrast
@tonycoco
tonycoco / config.ru
Created July 11, 2012 16:40
Rack It Up... Using POW! with PHP (Or, rather using PHP with Rack)
# config.ru for Pow + Wordpress, based on http://stuff-things.net/2011/05/16/legacy-development-with-pow/
# added hackery to work around wordpress issues - Patrick Anderson ([email protected])
# clearly this could be cleaner, but it does work
require 'rack'
require 'rack-legacy'
require 'rack-rewrite'
# patch Php from rack-legacy to substitute the original request so
# WP's redirect_canonical doesn't do an infinite redirect of /
@tonycoco
tonycoco / tm2-bundles
Created September 14, 2012 17:01
TextMate 2 Bundles
These are some needed bundles for TM2...
cd ~/Library/Application Support/Avian/Bundles
git clone https://github.com/cucumber/cucumber-tmbundle Cucumber.tmbundle
git clone https://github.com/kuroir/SCSS.tmbundle
git clone https://github.com/mads379/Whitespace.tmbundle
open Cucumber.tmbundle/color_themes/Sunburst.tmTheme
@tonycoco
tonycoco / 0-readme.md
Created December 3, 2012 17:05 — forked from burke/0-readme.md
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.