Archive for 'Ruby'

How to initialize an Array of Hashes in Ruby

How to initialize an array of hashes. Each value of keys within the hash will initially consist of an empty array: your_hash = {|h,k| h[k] = [] }

.rvm/scripts/functions/support: line 490: 10144 Trace/BPT trap: 5 issue

When I was trying to install ruby-2.1.3 via RVM (rvm install 2.1.3), I got the following error: I resolved this issue by reinstalling ruby 2.1.3 with –disable-binary option:

String datatype usages

‘ ‘ ” ” %q( ) – matches with single-quote but you can choose %Q| | – like double-quote but you can choose end chars doc =

Ruby vs Python

Python vs. Ruby: A Battle to The Death

Hidden Gems of Ruby 1.9

At GoGaRuco (Golden Gate RubyConf) in San Francisco, CA today… Talk by Aaron Patterson minitest require ‘minitest/autorun’ refute_equal (same as assert_not in TestUnit) inherit from MiniTest::Unit::TestCase Test Performance Run test with -verbose, you can see how long each test takes. minitest/spec (similar to rspec) ——— ObjectSpace ObjectSpace.each_object do |obj| p obj end count_object_size (to see […]

Lightning Talks at GoGaRuco

At GoGaRuco (Golden Gate RubyConf) today in San Francisco, CA The following is just some brief notes and may or may not make any sense. Talks went pretty quickly. Concurrency with Rubinius Ron Evans – TicketMaster (universal api) – allows migration of one system to another. (supports JIRA amongst other things) —– Fixture Builder by […]

Data-Driven Government and the Ruby Developer

At GoGaRuCo (Golden Gate RubyConf) today in San Francisco, CA… Talk by Eric Mill who works at Sunlight Labs and who is working with government to make their data public. Here are some examples of where you can get data. Data Californa Data Chicago Every Block New York Data Mine United States Data […]

Ruby APIs for NoSQL

At GoGaRuco (Golden Gate RubyConf) today in San Francisco, CA… Talk by: Sarah Mei, Pivotal Labs How you store data in Ruby without using a relational database. ActiveModel compliant libraries mongoDB: mongoid – gem: mongoid How do you unify a model with a data scattered across multiple stores? This is not solved yet. How do […]

Succeeding at Open Source Development

At GoGaRuco (Golden Gate RubyConf) today… Here’s what I got out of the Open Source Development talk: If you want to build up your open source project and manage it properly, you have to be open to newer contributors who are enthusiastic, even if they build a feature you think is useless. Communication is important. […]

RVM and Frozen Rails Conflict

I have an existing rails application and want to switch to using RVM in order to tie particular versions of Ruby, Rails and RubyGems to this application. My existing Rails application has a frozen Rails version 2.2.2 tied into it and so exists in my vendor/rails directory. Before I installed RVM, the following question came […]