code snippets from someone studying the art of computer science, a public notebook.

syntax highlighting

Date: 2011-04-27 21:54 tags: ruby

Checking out the very easy to implement syntax highlighting plugin named coderay, a ruby library. I love the ease of installing new plugins to the rails environment.

hash = { :water => 'wet', :fire => 'hot' }
puts hash[:fire] # Prints:  hot
 
hash.each_pair do |key, value| # Or:  hash.each do |key, value|
  puts "#{key} is #{value}"
end
 
# Prints:  water is wet
#          fire is hot
 
hash.delete :water # Deletes :water => 'wet'
hash.delete_if {|key,value| value=='hot'} # Deletes :fire => 'hot'

def testFunction(input1, input2)
   return input1 + input2
end

comments:

----

Add a comment:

Name:

Comment:

copyright 2012. font by ΒΆ