This file contains hidden or 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
# 0.4.0 TODO | |
# | |
# - merge Windows fix | |
# - merge Stephan's ap/object | |
# - merge Mongo(?) | |
# - specs for arbitrary Obj | |
# - rescue LoadError if in specs if Rails is not installed | |
# - require unless defined?(::AwesomePrint) (when required from .irbrc) | |
# - Obj overrides :send | |
# - Obj overrides :method |
This file contains hidden or 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 | |
# Usage: | |
# $ ./script/railssh | |
APP_PATH = File.expand_path('../../config/application', __FILE__) | |
require File.expand_path('../../config/boot', __FILE__) | |
require APP_PATH | |
Rails.application.require_environment! | |
module Kernel |
This file contains hidden or 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
// Generic version of the waiting-for-pause trick: | |
// execute callback only after a pause in user input; the function returned | |
// can be used to handle an event type that tightly repeats (such as typing | |
// or scrolling events); it will execute the callback only if the given timout | |
// period has passed since the last time the same event fired | |
function createOnPause(callback, timeout, _this) { | |
return function(e) { | |
var _that = this; | |
if (arguments.callee.timer) | |
clearTimeout(arguments.callee.timer); |
This file contains hidden or 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
20:22 1.9.2@r3 [~/Source/Rails/fat_free_crm.r3] (rails3)$ rails c | |
Loading development environment (Rails 3.0.3) | |
ruby-1.9.2-p0 > ActiveRecord::Base.time_zone_aware_attributes | |
true | |
ruby-1.9.2-p0 > Time.zone = "Pacific Time (US & Canada)" | |
"Pacific Time (US & Canada)" | |
ruby-1.9.2-p0 > x1 = Account.create(:name => "x1", :updated_at => 1.day.ago) | |
#<Account:0x0000010476b218> { | |
:id => 131, | |
:user_id => nil, |
This file contains hidden or 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 ActiveModel | |
# == Active Model XML Serializer | |
module Serializers | |
module Xml | |
extend ActiveSupport::Concern | |
include ActiveModel::Serialization | |
class Serializer #:nodoc: | |
class Attribute #:nodoc: | |
attr_reader :name, :value, :type |
This file contains hidden or 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
### 1) Added $stderr tracing in gems/activesupport-3.0.3/lib/active_support/xml_mini.rb | |
### | |
FORMATTING = { | |
"symbol" => Proc.new { |symbol| symbol.to_s }, | |
"date" => Proc.new { |date| date.to_s(:db) }, | |
"datetime" => Proc.new { |time| $stderr.puts "3.0.3: time.xmlschema for <#{time.class.inspect}>"; time.xmlschema }, | |
"binary" => Proc.new { |binary| ActiveSupport::Base64.encode64(binary) }, | |
"yaml" => Proc.new { |yaml| yaml.to_yaml } | |
} unless defined?(FORMATTING) |
This file contains hidden or 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
require "rubygems" | |
require "ap" | |
unless IRB.version.include?('DietRB') | |
IRB::Irb.class_eval do | |
def output_value | |
ap @context.last_value | |
end | |
end | |
else # MacRuby |
This file contains hidden or 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
function detect_rvm { | |
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') | |
[ "$gemset" != "" ] && gemset="@$gemset" | |
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') | |
[ "$version" != "" ] && version="$version" | |
local full="$version$gemset" | |
[ "$full" != "" ] && echo "$full" | |
} | |
function git_deleted { |
This file contains hidden or 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
function git_deleted { | |
[[ $(git status 2> /dev/null | grep deleted:) != "" ]] && echo "-" | |
} | |
function git_added { | |
[[ $(git status 2> /dev/null | grep "Untracked files:") != "" ]] && echo '+' | |
} | |
function git_modified { | |
[[ $(git status 2> /dev/null | grep modified:) != "" ]] && echo "*" |
This file contains hidden or 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
# Everything you need to do to get started with Rails 2.3.8 | |
# | |
# As of June 14th, 2010 @ 2:30 p.m. MST | |
# | |
# This gist now features instructions to get Rails 3 up and running with: | |
# - Ruby 1.8.7-p174 | |
# - Bundler 0.9.26 | |
# - Cucumber 0.8.0 | |
# - Rspec 1.3.0 + Rspec-Rails 1.3.2 | |
# - RVM |