This script of sorts overrides require
and load
to record the time it takes
to require files within a section of your code, and then generates a report
afterward. It's intelligent enough to figure out where files were required
from and construct a hierarchy of the required files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.extend(Object, { | |
clone: function(object) { | |
return object.clone ? object.clone() : Object.extend({ }, object); | |
}, | |
toQueryString: function(object) { | |
return object.toQueryString ? object.toQueryString() : $H(object).toQueryString() | |
} | |
}); | |
var PseudoHash = Class.create(Hash, (function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Various ideas for improving not_a_mock so that we don't have to track methods manually | |
# Note that none of these work, so don't try them | |
class Object | |
def track_all_methods | |
ancestors = self.class.ancestors - [Object, Kernel, ...] # insert all of Ruby Core classes here | |
instance_methods = ancestors.map {|x| x.instance_methods(false) } | |
class_methods = ancestors.map {|x| x.singleton_methods(false) } | |
methods = (instance_methods + class_methods).flatten.map {|x| x.to_sym } | |
track_methods(*methods) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# In Ruby 1.8.6, there's a bug in YAML that is revealed when you | |
# serialize and then deserialize a large YAML::Omap. If you look | |
# at the generated YAML, it looks like every so often, instead | |
# of an object showing up in the YAML file, the object is skipped | |
# and another a reference to another object shows up. This does | |
# not seem to happen with an Array of values, or an Array of Arrays, | |
# or an Array of Hashes, or a Hash. This behavior was fixed in 1.8.7. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Patch Rails so that a plain text mailer view won't be rendered with the layout | |
# Only tested in Rails 2.2 - I'm not sure how this works with 2.3 | |
module ActionMailer | |
class Base | |
def candidate_for_layout?(options) | |
return false if ActionView::Template === options[:file] && options[:file].content_type == "text/plain" | |
[email protected](:_exempt_from_layout?, default_template_name) | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
#================================================================================ | |
# powergrep -- improved rgrep with colors and the ability to omit directories | |
#================================================================================ | |
# Created: 6 Sep 2007 | |
# Last modified: 2 Jun 2009 | |
# (c) 2007-2009 Elliot Winkler | |
#================================================================================ | |
# CHANGELOG: | |
# * 2 Jun 2009 - added --mate option to open matched files in TextMate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
jQuery delayed observer | |
(c) 2007 - Maxime Haineault ([email protected]) | |
Special thanks to Stephen Goguen & Tane Piper. | |
Slight modifications by Elliot Winkler | |
*/ | |
(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
# A reimplementation of James Coglan's svn2git Ruby script as a Perl | |
# module and accompanying executable, forked from | |
# http://github.com/schwern/svn2git by Elliot Winkler. | |
# | |
# Changes are as follows: | |
# | |
# * Update fix_tags and fix_trunk so they're closer to Ruby script | |
# * Change default behavior so that the directory for the git repo will |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
class Base | |
VALIDATION_SYMBOLS = %w( | |
acceptance confirmation exclusion format inclusion length numericality presence size uniqueness | |
).inject({}) {|hash, name| hash["validates_#{name}_of"] = name; hash } | |
VALIDATION_METHODS = VALIDATION_SYMBOLS.invert | |
class << self | |
def validations | |
@validations ||= {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Don't reload views or routes | |
# This (along with setting cache_classes to false) brought running a | |
# single spec file down from 7.4s to 2.8s | |
# See discussion: http://github.com/timcharper/spork/issues#issue/13 | |
# | |
# To install, put this in spec/support and then require it in your spec_helper like: | |
# | |
# require 'spork' | |
# require File.expand_path(File.dirname(__FILE__) + "/support/spork") | |
# |
OlderNewer