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
@mrb
mrb / breadboard.clj
Last active August 29, 2015 13:57 — forked from jrecursive/gist:9668987
(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->
open Format
open Syntax
open Support.Error
open Support.Pervasive
(* ------------------------ EVALUATION ------------------------ *)
exception NoRuleApplies
let rec isnumericval ctx t = match t with
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 April 10, 2014 16:05
Ruby's types
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
=> "**********"
@mrb
mrb / spelling.ml
Created April 12, 2014 22:45
OCaml Spelling
let prog =
CompoundStm(AssignStm("a", OpzExp(NumExp 5, Plus, NumExp 3)),
CompoundStm(AssignStm("b",
EseqExp(PrintStm[IdExp("a"), OpExp(IdExp("a"), Minus, NumExp 1)],
OpExp(NumExp 10, Times, IdExp("a")))),
PrintStm[IdExp("b")]));;
Error: The variant type exp has no constructor OpzExp
Did you mean OpExp?