Skip to content

Instantly share code, notes, and snippets.

View mattpolito's full-sized avatar

Matt Polito mattpolito

View GitHub Profile
@mattpolito
mattpolito / poop.rb
Created April 7, 2011 21:13
Poopin'
class Poop
class << self
def outta_my_butt
"( 0 )"
end
end
# or for all you hipsters
# def self.outta_my_butt
# "( 0 )"
# end
@mattpolito
mattpolito / gist:908483
Created April 7, 2011 19:18 — forked from sparkertime/gist:868498
Senor CrankyPants
/* MrCrankyPants - block users and images from Propane!
* to use, place it in ~/Library/Application Support/Propane/unsupported/caveatPatchor.js (yes, it must be that file name)
*
* Created by ripping code off of https://gist.github.com/825404 and https://gist.github.com/310162
*/
Campfire.MrCrankyPants = Class.create({
options: {
blockedUsers: ['Abe L.', 'George W.'],
usersDisallowedToPostImages: ['Theodore R.'],
@mattpolito
mattpolito / .irbrc
Created April 6, 2011 14:22
big pimpin' irbrc
# Color definitions
ANSI = {}
ANSI[:RESET] = "\e[0m"
ANSI[:BOLD] = "\e[1m"
ANSI[:UNDERLINE] = "\e[4m"
ANSI[:LGRAY] = "\e[0;37m"
ANSI[:GRAY] = "\e[1;30m"
ANSI[:RED] = "\e[31m"
ANSI[:GREEN] = "\e[32m"
ANSI[:YELLOW] = "\e[33m"
When /^I fill in payment info that results in success$/ do
When %{I fill in payment info with:
| Card Number | 1 |
| Expiration | 1/2012 |
| Card Verification | 999 |
| Zipcode | 60120 |}
end
When /^I fill in payment info with:$/ do |table|
within "fieldset.payment.info" do
@mattpolito
mattpolito / update.rb
Created March 2, 2011 14:04
updates your vim bundles when using git
#!/usr/bin/ruby
require 'fileutils'
DROPBOX_DIR = File.expand_path("~/Dropbox/config_files")
VIM_BUNDLES_DIR = DROPBOX_DIR + "/.vim/bundle"
files = Dir["#{VIM_BUNDLES_DIR}/*"]
files.each do |file|
unless !File.directory?("#{file}/.git")
FileUtils.cd(file)
@mattpolito
mattpolito / install.rb
Created March 2, 2011 14:02
creates symlinks for your config files into your home directory when in Dropbox
#!/usr/bin/ruby
require 'fileutils'
HOME_DIR = File.expand_path("~")
DROPBOX_DIR = File.expand_path("~/Dropbox/config_files")
files = Dir["#{DROPBOX_DIR}/.*"]
files.shift(2)
files.delete(".*.*.sw*") # remove any vim swap files that may have entered from editing
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
rvm_lib_path = File.join(rvm_path, 'lib')
$LOAD_PATH.unshift rvm_lib_path
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
# RVM is unavailable at this point.
raise "RVM ruby lib is currently unavailable."
@mattpolito
mattpolito / gist:740582
Created December 14, 2010 15:35
Invalid query that changed after upgrade to Rails 3.0.3 from 3.0.1 These seems to be a rouge set of single quotes around the second INNER JOIN
-- Rails 3.0.3 - No workie *Sad Face*
SELECT "presentations".* FROM "presentations" INNER JOIN "taggings" ON "presentations"."id" = "taggings"."taggable_id" AND "taggings"."taggable_type" = 'Presentation' INNER JOIN "tags" ON 'taggings.tag_id = tags.id AND taggings.context = ''tags''' ORDER BY created_at DESC
-- Rails 3.0.1 - Works fine *Hooray*
SELECT "presentations".* FROM "presentations" INNER JOIN "taggings" ON "presentations"."id" = "taggings"."taggable_id" AND "taggings"."taggable_type" = 'Presentation' INNER JOIN "tags" ON taggings.tag_id = tags.id AND taggings.context = 'tags' ORDER BY created_at DESC
<html>
<head>
<title>reactionCONTROL - Course Correction in Progress</title>
</head>
<body id=”maintenance”>
<div id=”content”>
<p>Sir, a coordinate correction is currently underway.</p>
<p>We’re sorry but you’ll have to get back to your seat. Rest assured
we’ll be back on course shortly.</p>
</div>
class Comment
include MongoMapper::EmbeddedDocument
include Gravatarable
key :name, String
key :email, String
key :url, String
key :body, String
key :created_at, Time