This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body | |
{ | |
margin: auto; | |
width: 78%; | |
color: #666; | |
font-family: GillSans, Calibri, Trebchet, sans-serif; | |
} | |
/* Deal with the links */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jConsole = { | |
init: function() { | |
holder = document.createElement("div") | |
holder.setAttribute("style", "height: 250px; background: #000000; color: #ffffff; opacity: 0.4; position: static;") | |
document.body.appendChild(holder) | |
} | |
} | |
jConsole.init() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyAwesomeClass | |
attr_accessor :awesome_instance_variable | |
def initialize(var) | |
@awesome_instance_variable = var | |
end | |
def reverse! | |
@awesome_instance_variable = @awesome_instance_variable.reverse | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def every(delay) | |
loop do | |
sleep(delay) | |
yield | |
end | |
end | |
def beep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%w[ | |
rubygems | |
sinatra | |
dm-core | |
dm-timestamps | |
].each { |lib| require lib } | |
get '/' do | |
"You aren't supposed to be viewing this." | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sinatra | |
haml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Rufus = { | |
Mnemo: { | |
/** CONSTANTS **/ | |
V: [ 'a', 'e', 'i', 'o', 'u' ], | |
C: [ 'b', 'd', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'r', 's', 't', 'z' ], | |
SYL: [], // This is populated later on. [1] | |
SPECIAL: [ |
OlderNewer