Skip to content

Instantly share code, notes, and snippets.

View rrichards's full-sized avatar
💭
Rocking the CLI

Ryan Richards rrichards

💭
Rocking the CLI
  • R3 Technologies, Inc.
  • Edmond, OK
  • 22:17 (UTC -12:00)
  • X @rrichards
View GitHub Profile
This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell))
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.1
# Use the ruby + gem set
∴ rvm 1.9.1%rails3
This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell))
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.1
# Use the ruby + gem set
∴ rvm 1.9.1%rails3
Rails CMS alternatives
======================
Note: project activity was checked on 11/26/09 for most of these projects, and the "last update" field has not been kept up to date since then.
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09
class HashSpy
def initialize(hash={})
@hash = hash
end
def method_missing(method_name, *args, &block)
puts "***** hash access"
puts " before: #{@hash.inspect}"
r = @hash.send(method_name, *args, &block)

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js
#rails console in my project configured with .rvmrc
# sanity check
ruby-1.8.7-p249 > %x{"source ~/.zshrc"}
sh: source ~/.zshrc: No such file or directory
=> ""
ruby-1.8.7-p249 > %x{"source ~/.zshrc ; rvm 1.8.7-p249%rails3 ; rvm gemdir"}
sh: source ~/.zshrc ; rvm 1.8.7-p249%rails3 ; rvm gemdir: No such file or directory
=> ""
# include at least one source and the rails gem
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
gem 'sqlite3-ruby', :require => 'sqlite3'
# Devise 1.0.2 is not a valid gem plugin for Rails, so use git until 1.0.3
# gem 'devise', :git => 'git://github.com/plataformatec/devise.git', :ref => 'v1.0'
group :development do
# bundler requires these gems in development
~] % rvm --trace gemset name (rh1n0@morpheus:)
--trace gemset name
rvm 0.1.33 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]
+__rvm_parse_args:382> [[ -z '' ]]
+__rvm_parse_args:382> [[ ! -z ruby-1.8.7-p249 ]]
+__rvm_parse_args:382> rvm_action=use
class Guide < ActiveRecord::Base
has_many :textboxes
accepts_nested_attributes_for :textboxes, :allow_destroy => true
has_attached_file :guide_image,
:styles => {:hero => "765x307!",
:smaller_hero => "674x200!",
:admin_size => "150x60!"
},
#Your resizing will warp (squash or stretch) images if they don't match
# your dimensions.
#To resize while maintaining aspect ratio, use "64x64>" - This will
#result in either the width or the height = 64 and the other side will
#be relatively smaller.
#To resize with crop, use "64x64#" - This will result in both width and
#height = 64 and the longer of the two will be cropped evenly on either
#side.
#You should usually use one of these unless you are very sure of the
#aspect ratio of the images being uploaded.