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
@mrb
mrb / pizza_dough.markdown
Last active Aug 29, 2015
Best pizza dough
View pizza_dough.markdown
  • 1 2lb bag good AP flour
  • 1 active dry yeast packet
  • 25 grams salt
  • 600 grams water (just over 2 cups)

Mix the salt, yeast, water and about 3/4 of the flour with the paddle attachment (on your stand mixer, or you can try it by hand which I've never done) for about a minute until it is all mixed, it should be pretty loose.

Let it sit, covered, for about 20 minutes.

Knead it on low for 5-7 minutes, until it starts to even out in texture, then start adding the rest of the flour until the dough starts to pull away from the bowl. It should still be pretty wet though. Knead for another 5-7 minutes on med-low, let it rest again for 20 minutes, then remove it to a floured bench, work it with your hands, shape it, and cut it into 4-5 even sized balls.

View breadboard.clj
(create-circuit :test)
(create-channel :tweets)
(create-device :tweeter-1 as :tweeter
(filters ["ukraine" "russia" "putin" "news" "crimea"]))
(create-device :tweet-channel as :channeler
(channel :tweets))
(create-wire->
View core.ml
open Format
open Syntax
open Support.Error
open Support.Pervasive
(* ------------------------ EVALUATION ------------------------ *)
exception NoRuleApplies
let rec isnumericval ctx t = match t with
View ruby.rb
irb(main):006:0* 1/0
ZeroDivisionError: divided by 0
from (irb):6:in `/'
from (irb):6
from /Users/mrb/.rbenv/versions/1.9.3-p545/bin/irb:12:in `<main>'
irb(main):007:0> 1/0.0
=> Infinity
@mrb
mrb / types.rb
Created Apr 10, 2014
Ruby's types
View types.rb
irb(main):002:0> 10*"*"
TypeError: String can't be coerced into Fixnum
from (irb):2:in `*'
from (irb):2
from /Users/mrb/.rbenv/versions/1.9.3-p545/bin/irb:12:in `<main>'
irb(main):003:0> "*"*10
=> "**********"
You can’t perform that action at this time.