Brief Notes
Noteworthy links, summaries and concise prose on stuff.

Ruby development

All about developing with the Ruby Programming Language.


Install the latest version of Ruby on WebFaction.

Count the number of lines in a file:

puts IO.foreach("./a_very_big_file.csv").count

# => 859369 -> took about 1 second to run on my MacBook Air

In Sublime Text 3, for the Ruby syntax, to ignore the colon (:) character, and bang (!) and predicate (?) methods as word separators:

  1. With a Ruby (.rb) file open, navigate to menu item: Sublime Text > Preferences > Settings - More > Syntax Specific - User

  2. Add this line:

    "word_separators": "./\\()\"'-,.;<>~@#$%^&*|+=[]{}`~"


gem install ... --no-doc disables documentation generation when installing gems (source).

To check what methods a newly-created object would have:

# => [:!, :!=, :!~, :<=>, :==, :===, :=~, :__id__, :__send__, :class, :clone, :define_singleton_method, :display, :dup, :enum_for, :eql?, :equal?, :extend, :freeze, :frozen?, :hash, :inspect, :instance_eval, :instance_exec, :instance_of?, :instance_variable_defined?, :instance_variable_get, :instance_variable_set, :instance_variables, :is_a?, :itself, :kind_of?, :method, :methods, :nil?, :object_id, :private_methods, :protected_methods, :public_method, :public_methods, :public_send, :remove_instance_variable, :respond_to?, :send, :singleton_class, :singleton_method, :singleton_methods, :taint, :tainted?, :tap, :to_enum, :to_s, :trust, :untaint, :untrust, :untrusted?]

Scripts & programming examples

Using ruby -cw to check for script syntax errors with warnings turned on