Skip to content

Instantly share code, notes, and snippets.

body
{
margin: auto;
width: 78%;
color: #666;
font-family: GillSans, Calibri, Trebchet, sans-serif;
}
/* Deal with the links */
a:link,a:visited,a:hover{color:#476c8e}a:link,a:visited,.nav:visited,.nav:link,.nav,.codeheader,.quoteheader,.catbg3 a:visited,.catbg3 a:link,tr.catbg3 td,.catbg3,.catbg2 a:visited,.catbg2 a:link,.catbg a:visited,.catbg a:link,.maintab_active_back,.maintab_back,.maintab_back a:visited,.maintab_back a:link,.maintab_active_back a:visited,.maintab_active_back a:link,.maintab_active_back a:hover,.maintab_back a:hover,.mirrortab_back,.mirrortab_active_back,.mirrortab_active_back a:visited,.mirrortab_active_back a:link,.mirrortab_back a:visited,.mirrortab_back a:link,.mirrortab_active_back a:hover,.mirrortab_back a:hover,div.navigation ul li a{text-decoration:none}a:hover,a.nav:hover,.titlebg2 a:visited,.titlebg2 a:link,.titlebg2 a:hover{text-decoration:underline}.nav:visited,.nav:link,.nav,button,textarea,input,textarea,select,.quote,.code,.codeheader,.quoteheader,.windowbg,.windowbg2,.windowbg3,.mirrortab_active_back a:hover,.mirrortab_back a:hover{color:#000}a.nav:hover{color:#c33}table{empty-cells:show}tr,th,td
# tiny shoes app that tells the length of some text
Shoes.app :title => 'strlen', :width => 300, :height => 125 do
background "#CFC".."AFA"
stack :margin => 10 do
para "Enter some text here"
@text = edit_line
every 0.1 do
@len.replace "The length of the text entered is " + @text.text.length.to_s + "."
end
@vikhyat
vikhyat / dice2.rb
Created December 2, 2008 06:57
Roll 2 dice several times (v2)
# Rolling a dice is equivalent to generating a random number from 1 to 6.
def dice_roll
sum = 0
2.times {
sum += 1 + rand(6)
}
sum
end