Skip to content

Instantly share code, notes, and snippets.

View mrichman's full-sized avatar

Mark Richman mrichman

View GitHub Profile
%h1 Login
- form_for @user_session, :url => user_session_path do |f|
= f.error_messages
= f.label :login
%br
= f.text_field :login
%br
%br
= f.label :password
%br
# template.rb
gem 'activemerchant', :lib => 'active_merchant'
gem 'sqlite3-ruby', :lib => 'sqlite3'
gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com'
plugin 'exception_notifier', :git => 'git://github.com/rails/exception_notification.git'
plugin 'rspec', :git => 'git://github.com/dchelimsky/rspec.git'
plugin 'rspec-rails', :git => 'git://github.com/dchelimsky/rspec-rails.git'
plugin 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git'
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@interface Controller : NSObject /* Specify a superclass (eg: NSObject or NSView) */ {
IBOutlet UILabel *subtitle;
SystemSoundID soundID1;
SystemSoundID soundID2;
SystemSoundID soundID3;
SystemSoundID soundID4;
#import "Controller.h"
#import <AVFoundation/AVFoundation.h>
@implementation Controller
-(void) awakeFromNib {
NSBundle *mainBundle = [NSBundle mainBundle];
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[mainBundle pathForResource:@"Foo.mp3" ofType:@"mp3"]], &soundID1);
}
file 'app/views/layouts/master.html.haml', <<-TEMPLATE
!!! Strict
%html{:xmlns => 'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en'}
%head
%meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=UFT-8'}
= stylesheet_link_tag :all, :cache => true
= javascript_include_tag :all, :cache => true
= title
%body
#wrapper
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set nobackup
set nowritebackup
set history=50 " keep 50 lines of command line history
$sudo gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectionUsedPassword()... no
# RAILS_ROOT/lib/tasks/seed.rake
begin
require 'highline/import'
rescue LoadError
puts 'HighLine required, please run rake setup first'
end
namespace :db do
desc "Setup Database"
class User < ActiveRecord::Base
ROLES = %w(admin user guest).freeze
acts_as_authentic
acts_as_authorization_subject
validates_presence_of :login, :email
belongs_to :creator, :class_name => "User"
@mrichman
mrichman / gist:114353
Created May 19, 2009 20:08
Using seed-fu with users and roles
# db/fixtures/roles.rb
%w(admin normal guest).each do |r|
Role.seed(:name) do |s|
s.name = r
end
end
# db/fixtures/users.rb