Skip to content

Instantly share code, notes, and snippets.

Avatar
🍕
Helping companies market and sell more software

Michael Bernstein mrb

🍕
Helping companies market and sell more software
View GitHub Profile
View index.haml
-@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 Jul 22, 2008
Sass + 3 column A List Apart Layout
View lsd.sass
/* 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
View index.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
@mrb
mrb / index.haml
Created Jul 22, 2008
column/pagination in haml
View index.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
View gist:1245
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
View gist:3126
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
View gist:4101
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,
View gist:7194
brewery:
name:string
city:string
state:string
country:stirng
beer_breweries:
brewery_id:integer
beer_id:integer
View gist:16141
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]
View gist:20407
create_table :jots_notes, :force => true do |t|
t.references :jot, :polymorphic => true
t.references :note
t.timestamps
end
You can’t perform that action at this time.