Skip to content

Instantly share code, notes, and snippets.

View george's full-sized avatar

George george

View GitHub Profile
<%- content_for :main_content do -%>
<div id="main_content">
<%= render :partial => 'form' %>
</div> <!-- main_content -->
<%- end -%>
class HomePageController < ApplicationController
# this ensures 'current_user' is populated with the logged in user
before_filter :login_required
def index
# populate an ivar (instance variable) so we can use it in the view
@user = current_user
@lists = @user.lists
@other_things_the_user_owns = @user.other_things_the_user_owns
end
# note: this code could be tightened up a lot,
# but the concept should be fairly clear
class HomePageController < ApplicationController
# this ensures 'current_user' is populated with the logged in user
before_filter :login_required
def index
@user = current_user
@lists = @user.lists
@other_things_the_user_owns = @user.other_things_the_user_owns
class CreateContents < ActiveRecord::Migration
def self.up
create_table :contents do |t|
t.text :data
# t.integer :layout_order
t.integer :position
# :position is idiomatic rails
t.integer :element_id
t.integer :webpage_id
t.integer :parent_id
@george
george / x
Created October 27, 2008 00:33
test ubiquity command sharing
[deploy@partners ~]$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 1676 476 ? Ss Mar07 1:02 init [3]
root 2 0.0 0.0 0 0 ? S Mar07 1:40 [migration/0]
root 3 0.0 0.0 0 0 ? SN Mar07 0:00 [ksoftirqd/0]
root 4 0.0 0.0 0 0 ? S Mar07 0:00 [watchdog/0]
root 5 0.0 0.0 0 0 ? S< Mar07 0:00 [events/0]
root 6 0.0 0.0 0 0 ? S< Mar07 4:05 [khelper]
root 7 0.0 0.0 0 0 ? S< Mar07 0:00 [kthread]
root 9 0.0 0.0 0 0 ? S< Mar07 0:00 [xenwatch]
# installing RVM per http://rvm.beginrescueend.com/install/ from the github repository
# on a fresh Snow Leopard install (updated): OSX 10.6.2
new-host:~ george$ mkdir -p ~/.rvm/src/
new-host:~ george$ cd ~/.rvm/src
new-host:src george$ rm -rf ./rvm/
new-host:src george$ git clone git://github.com/wayneeseguin/rvm.git
Initialized empty Git repository in /Users/george/.rvm/src/rvm/.git/
remote: Counting objects: 8977, done.
remote: Compressing objects: 100% (2504/2504), done.
work ∴ cd gitjour
error: Gemset 'gitjour' does not exist, rvm gemset create 'gitjour' first. # <= correct, it doesn't exist
Using /Users/george/.rvm/gems/ree-1.8.7-2010.02 with gemset gitjour # <= surprising given it doesn't exist, but understandable
gitjour ∴ rvm gemdir
/Users/george/.rvm/gems/ree-1.8.7-2010.02@gitjour # <= again, surprising given it doesn't exist, but understandable
gitjour ∴ ls /Users/george/.rvm/gems/ree-1.8.7-2010.02@gitjour
ls: /Users/george/.rvm/gems/ree-1.8.7-2010.02@gitjour: No such file or directory # <= expected
gitjour ∴ rvm gemset create 'gitjour'
Gemset 'gitjour' does not exist, rvm gemset create 'gitjour' first. # <= I shouldn't see this since I'm in the process of creating it
'gitjour' gemset created (/Users/george/.rvm/gems/ree-1.8.7-2010.02@gitjour). # <= I <3 RVM
# == Schema Information
#
# Table name: flying_spaghetti_monsters
#
# id :integer(4) not null, primary key
# awesomeness :string
# meatballs :boolean
# last_seen :datetime
# model-specific requires
@george
george / Gemfile
Created March 9, 2011 15:57
for thinking_sphinx google group "uninitialized constant ThinkingSphinx::Mutex" post
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'mysql2'
# gem 'ck_fu', :git => 'git@github.com:george/ck_fu.git'
gem 'configatron', '~> 2.6.4'
gem 'db_populate', '~> 0.2.6'
gem 'fastercsv' # TODO: delete (only needed for initial DB migration)
gem 'hoptoad_notifier', '~> 2.4.6'