Skip to content

Instantly share code, notes, and snippets.

View mrb's full-sized avatar
🍕
Helping companies market and sell more software

Michael Bernstein mrb

🍕
Helping companies market and sell more software
View GitHub Profile
-@authors.each_with_index do |author, index|
#container{:style=>"float:left;"}
.bigsansed="#{link_to author.name, author}"
%br/
-@authors.each_with_index do |author, index|
#container{:style=>"float:right;"}
.bigsansed="#{link_to author.name, author}"
%br/
#pagination
=will_paginate @posts
@mrb
mrb / lsd.sass
Created July 22, 2008 14:08
Sass + 3 column A List Apart Layout
/* Change lc_width and rc_width to control column width, and voila */
!lc_width= 140px
!rc_width= 180px
!lc_p= 10px
!lc_pad= !lc_p*2
!rc_p= 10px
!rc_pad= !rc_p*2
!lc_full= !lc_width + !lc_pad
!rc_full= !rc_width + !rc_pad
.floatleft{:style=>"width:200px;"}
-@contacts[0...(@contacts.per_page/2)].each_with_index do |contact, index|
=render :partial => "contact", :locals => {:contact => contact}
.floatright{:style=>"width:200px;"}
-@contacts[(@contacts.per_page/2)...@contacts.per_page].each_with_index do |contact, index|
=render :partial => "contact", :locals => {:contact => contact}
#pagination{:style=>"clear:both;"}
=will_paginate
@mrb
mrb / index.haml
Created July 22, 2008 15:00
column/pagination in haml
.floatleft{:style=>"width:200px;"}
-@contacts[0...(@contacts.per_page/2)].each_with_index do |contact, index|
=render :partial => "contact", :locals => {:contact => contact}
.floatright{:style=>"width:200px;"}
-@contacts[(@contacts.per_page/2)...@contacts.per_page].each_with_index do |contact, index|
=render :partial => "contact", :locals => {:contact => contact}
#pagination{:style=>"clear:both;"}
=will_paginate
module ApplicationHelper
def e_tag(model)
eval("link_to image_tag(\'pencil.png\'), edit_#{model.class.name.underscore}_path(model)")
end
def d_tag(model)
eval("link_to image_tag(\'delete.png\'), model, :confirm => \'Are you sure?\', :method => :delete")
end
def show_report_books(book)
update_page do |page|
page.insert_html :bottom, book.genre.name.capitalize.to_sym, {:partial => 'static_book', :locals=>{:book=>book}}
end
end
First, install graphviz - http://www.graphviz.org/Download..php --
it is available for multiple platforms and is easy to install.
Secondly, run a:
1 gem install railroad
And Railroad and its dependencies are installed. Railroad is capable of visualizing model relationships,
controllers, and more. Check the railroad site at http://railroad.rubyforge.org/ for great examples
such as Typo visualized and other sick visualizations. Once you have these installed,
brewery:
name:string
city:string
state:string
country:stirng
beer_breweries:
brewery_id:integer
beer_id:integer
last_tr = TherapistReport.send(:with_exclusive_scope) {TherapistReport.all}.collect{|x| x if (x.report_id == self.report.previous && x.therapist_id == self.therapist_id && x.report.territory_id == self.report.territory_id)}.compact[0]
create_table :jots_notes, :force => true do |t|
t.references :jot, :polymorphic => true
t.references :note
t.timestamps
end