Skip to content

Instantly share code, notes, and snippets.

View vjt's full-sized avatar
💭
looking at the stars

Marcello Barnaba vjt

💭
looking at the stars
View GitHub Profile
if RUBY_PLATFORM == 'java'
class Gem::Version # oddity
class << self
alias orig_correct? correct?
def correct?(version)
orig_correct? version.sub(/-?java$/, '')
end
end
end
end
@vjt
vjt / bench.rb
Created February 11, 2010 13:09
# bench() - (C) 2010 [email protected] - MIT License
#
# Useful bench() routine for your .irbrc
#
# Usage:
#
# bench { some code }
# 1000 iterations: 1.205242 (0.000121 per iteration)
# bench(4939) { some code }
# 4939 iterations: 1.420919 (0.000288 per iteration)
# http://gist.github.com/301471
#
# Not Found - (C) 2010 [email protected] - MIT License
#
# Quick hack to have a string that always says "not found",
# even when multiple methods are chained to it.
#
#
# E.g.:
#
module YourApp
# This module fixes the double-port bug in generated URIs by an application
# running on a non-standard port (80 / 443).
# - [email protected]
#
# Ref: https://rails.lighthouseapp.com/projects/8994/tickets/1106-rewrite_url-adds-port-twice
#
module RewriterPatch
def self.included(rewriter)
// ==UserScript==
// @name Facebook Purity - Removes annoying quiz and application messages from your facebook homepage
// @namespace http://steeev.freehostia.com
// @description Removes messages posted by applications to your facebook homepage
// @include http://www.facebook.com/*
// @include http://www.new.facebook.com/*
// @version 1.54b - 24th June 2009
// ==/UserScript==
// UPDATES
.*.sw?
verify-cn
# Authlogic MD5 - Crypt crypto provider
# (C) 2009 [email protected] - MIT License
# Requires ruby facets (http://facets.rubyforge.org)
#
require 'facets/crypt'
module Authlogic
module CryptoProviders
class MD5Crypt
class << self
// ==UserScript==
// @name Remove All Facebook Ads
// @author http://joshdick.net/programs
// @version 1.4
// @namespace http://userscripts.org/scripts/show/13787
// @description Removes any and all ads from Facebook.
// @include *facebook.com*
// ==/UserScript==
# ActiveRecord helper to manage an integer `status` column using Ruby :symbols.
# (C) 2009 Marcello Barnaba <[email protected]> - Released under the terms of the MIT License
# http://sindro.me/
#
# == Usage ==
#
# [REQUIRED] Put this file in lib/
# [OPTIONAL] Fork this gist
# [OPTIONAL] Pluginize it
# [OPTIONAL] Write some tests
#!/bin/bash
# Database Dump utility for MySQL. Put in cron like this:
#
# DUMPDIR='/home/example/DatabaseDumps' USER='dbuser' PASS='dbpass' DB='dbname' /path/to/dumpdb.sh
#
# (C) 2009 [email protected]
#
[ -z "$MAXAGE" ] && MAXAGE=744