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
In response to all the responses to: | |
http://twitter.com/rtomayko/status/1155906157 | |
You should never do this in a source file included with your library, | |
app, or tests: | |
require 'rubygems' | |
The system I use to manage my $LOAD_PATH is not your library/app/tests |
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
class BaseTask | |
def self.perform(*args) | |
ActiveRecord::Base.verify_active_connections! | |
end | |
end | |
class SomeTask < BaseTask | |
def self.perform(*args) | |
super | |
# do some stuff |
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
# ACK: | |
# modified from | |
# http://gist.github.com/264496 by github.com/eric | |
# http://gist.github.com/465293 by github.com/alexyoung | |
# USAGE: | |
# 1) > ruby -rrequire_tracking -e "require 'active_support'" | |
# 2) put in config/preinitializer.rb | |
# WHAT: Provides a simple overview of memory allocation occuring |
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
// If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/) | |
// Then, use underscore's mixin method to extend it with all your other utility methods | |
// like so: | |
_.mixin({ | |
escapeHtml: function () { | |
return this.replace(/&/g,'&') | |
.replace(/>/g,'>') | |
.replace(/</g,'<') | |
.replace(/"/g,'"') | |
.replace(/'/g,'''); |
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
40+ newbie rails mistakes | |
themes: | |
Build for failure | |
expect services to be slow | |
expect services to be unavailable | |
Build so components can be easily replaced | |
Build so code can be easily reused | |
mistakes: |
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
export PROJECT_NAME=$1 | |
export WORKING_DIR=~/working/active/$PROJECT_NAME | |
cd $WORKING_DIR; | |
tmux start-server | |
tmux new-session -d -s $PROJECT_NAME -n work | |
tmux new-window -t$PROJECT_NAME:1 -n server | |
tmux new-window -t$PROJECT_NAME:2 -n test |
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
<!-- layout file --> | |
<% if current_user %> | |
Welcome <%= current_user.username %>. Not you? <%= link_to "Log out", logout_path %> | |
<% else %> | |
<%= link_to "Sign up", signup_path %> or <%= link_to "log in", login_path %>. | |
<% 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
# rspec continuous runner script using watchr, growl and spork | |
# run this script via 'watchr' | |
# gist at: https://gist.github.com/797853/ | |
# based on: https://gist.github.com/276317/ | |
# you may want to install image file for growl. | |
if RUBY_VERSION >= "1.9" # multibyte encoding only supported in Ruby 1.9 | |
Encoding.default_external = "UTF-8" | |
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
source 'http://rubygems.org' | |
gem 'rails', '3.0.4' | |
group :test do | |
gem 'database_cleaner' | |
gem 'rspec-rails' | |
gem 'rspec-rails-matchers' | |
gem 'sham' | |
gem 'spork', '=0.9.0.rc7' |
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
diff --git a/array.c b/array.c | |
index b1616c5..16326fc 100644 | |
--- a/array.c | |
+++ b/array.c | |
@@ -302,7 +302,7 @@ ary_alloc(VALUE klass) | |
return (VALUE)ary; | |
} | |
-static VALUE | |
+VALUE |
OlderNewer