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
def hello name | |
"Hello #{name}" | |
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
def document_to_string(filename) | |
text = '' | |
File.open(filename) do |f| | |
while line = f.gets | |
text << line | |
end | |
end | |
text | |
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
= Setup | |
=== In your browser | |
login to http://github.com | |
go to http://github.com/resolve/refinerycms | |
if you have a fork already, delete it (if you're not going to loose work. This makes it much easier for us to integrate your changes back in) | |
click on fork | |
=== In terminal | |
git clone [email protected]:USERNAME/refinerycms.git refinerycms |
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
def dsh(un, va) | |
(va.size - 1).downto(1) {|j| va[j] = va[0 .. j].inject(1) { |pr, it| pr * it } } | |
ar = un.zip va | |
hs = {} | |
ar.each {|i| hs[i[0]] = i[1] } | |
hs | |
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
class Month_Sampler | |
Months = { 'Jan' => "January", 'Feb' => "February", 'Mar' => "March", 'Apr' => "April", | |
'May' => "May", 'Jun' => "June", 'Jul' => "July", 'Aug' => "August", | |
'Sep' => "September", 'Oct' => "October", 'Nov' => "November", 'Dec' => "December" | |
} | |
# assign abbreviated and full month names depending on what is provided. | |
# Because this is a sample short script, I simply fail if wrong input. | |
def initialize month | |
fail("Incorrect Month representation (as a string)") unless |
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
>> my_method(3, "Sang Shin", {:a => " loves ", :b => " Young Shin"}) {|s| puts s } | |
3 | |
Sang Shin | |
{:a=>" loves ", :b=>" Young Shin"} | |
=> [3, "Sang Shin", {:a=>" loves ", :b=>" Young Shin"}] | |
>> my_method(3, "Sang Shin", {:a => " loves ", :b => " Young Shin"}) {|s| s } | |
=> [3, "Sang Shin", {:a=>" loves ", :b=>" Young Shin"}] |
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
module Prompt | |
def prompt(prompt = ":> ", chomp = true) | |
puts self << prompt | |
chomp ? gets.chomp! : gets | |
end | |
end | |
class String | |
include Prompt | |
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
vgoff@vgoff-DT01:~$ rvm system | |
vgoff@vgoff-DT01:~$ rvm info | |
rvm 0.1.12 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/] | |
system: | |
uname: "Linux vgoff-DT01 2.6.31-17-generic #54-Ubuntu SMP Thu Dec 10 16:20:31 UTC 2009 i686 GNU/Linux" | |
shell: "bash" | |
version: "4.0.33(1)-release" |
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
Command given: rvm 1.8.6,1.8.7,1.9.1 --trace gem install sinatra --no-rdoc --no-ri | |
1.8.6,1.8.7,1.9.1 --trace gem install sinatra --no-rdoc --no-ri | |
rvm 0.1.12 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/] | |
+ [[ -z ruby ]] | |
+ [[ ! -z '' ]] | |
+ [[ ! -z '' ]] | |
+ [[ 5 -gt 0 ]] | |
+ rvm_token=gem |
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
=begin | |
You create your code here, and then click on paste... and then others can get | |
the link that is created, and can potentially fork it and make changes to | |
their own versions. | |
=end | |
def hello_world | |
"Hello, world!" | |
end |