Skip to content

Instantly share code, notes, and snippets.

View brandoncordell's full-sized avatar

Brandon Cordell brandoncordell

View GitHub Profile
# jobs_controller
class JobsController < ApplicationController
def new
@job = Job.new
end
def create
@job = Job.new(params[:job])
@job.current_step = session[:listing_step]
=> Booting WEBrick
=> Rails 3.0.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-07-24 21:52:53] INFO WEBrick 1.3.1
[2011-07-24 21:52:53] INFO ruby 1.9.2 (2011-02-18) [x86_64-darwin10.7.0]
[2011-07-24 21:52:53] INFO WEBrick::HTTPServer#start: pid=33000 port=3000
Started GET "/" for 127.0.0.1 at 2011-07-24 21:53:00 -0400
%h2 Post Your Job
%ol
%li Listing Details
%li Company Details
%li Preview Your Listing
%li Finish
- form_for :job, :url => { :action => :create } do |f|
/ = f.error_messages
/ = render "jobs/shared/#{@job.current_step}", :f => f
@brandoncordell
brandoncordell / gist:1119296
Created August 2, 2011 00:15
Lost of the schema...
Not sure what's the best schema I should use in this situation.
I want:
-------
- Users should be able to register an account, with a subdomain
- Subdomain owners can invite other users to access the account
- Users should be able to own multiple subdomains, and belong to multiple subdomains
- Users will access their account through their subdomain (e.g. cooluser.myapp.com)
namespace "site" do
match 'branding' => 'account#branding', :as => 'account_branding'
post 'branding' => 'account#save_branding', :as => 'account_branding'
end
alert 'test'
jQuery('.new-page').click (e) ->
e.preventDefault()
alert e
@brandoncordell
brandoncordell / .gitignore
Created August 11, 2011 08:27
My standard .gitignore for Rails projects
.bundle
db/*.sqlite3
log/*.log
tmp/
.sass-cache/
# rails ignores
*.rbc
*.sassc
.sass-cache
@brandoncordell
brandoncordell / gist:1159943
Created August 21, 2011 01:21
Loading a plist into an array
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Info"
ofType:@"plist"];
NSFileManager *fm = [NSFileManager defaultManager];
if ([fm fileExistsAtPath:plistPath])
NSLog(@"File Exists");
else
NSLog(@"File not found");
NSArray *tmpArray = [[NSArray alloc] initWithContentsOfFile:plistPath];
createToolbar : function(editor){
var me = this,
items = [],
tipsEnabled = Ext.tip.QuickTipManager && Ext.tip.QuickTipManager.isEnabled(),
baseCSSPrefix = Ext.baseCSSPrefix,
fontSelectItem, toolbar, undef;
function btn(id, toggle, handler){
return {
itemId : id,
@brandoncordell
brandoncordell / gist:1360922
Created November 12, 2011 18:36
rspec generator
config.generators do |g|
g.test_framework :rspec, :fixture => true, :views => false
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
end