Shopify Liquid for loop« an older post
a newer one »View enums in postgres

Ruby Notes


Yeah, those small details I need to keep looking up as I switch among ruby, javascript, php, and python on any given day.

See also:,_Substitution_and_Insertion

CSV notes at

# remove only leading and trailing whitespace (like PHP's trim) 
# use a regular expression ( this evaluates to 
str = "white chocolate"
str.gsub("white", "dark")
# which are groupings, btw (this evaluates to "1a")
"a1".gsub(/(\w)(\d)/, '\2\1')
# puts and print
print "use a return at the end\n"
puts "automatically adds the newline"

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.