Tag Archives: ruby

Switching to Rubinus on OS X & Heroku

Rubinus is a ruby VM written in C with true parallelism support, and a cool design that attempts to write as much of the interpreter as possible in ruby itself. It’s been developed for a few years now, with financial supported by Engine Yard and is stating to mature. Heroku have included it as pre-installed   …Continue Reading

Announcing: gs-apns, a new fork of the apns gem.

For the last year Geospike has been using jtv-apns, itself a fork of apns. Our needs have grown, and today I announce our own fork of the APNS gem, name ‘gs-apns’. Gem on rubygems. Code & docs on github. The gs-apng gem continues the good work of James Pozdena and Paul Gebheim with some key   …Continue Reading

Rescuing HTTPClient Exceptions

I have a need in a rails app to rescue just exceptions raised due to fairly common situations in downloading data from URLs. Catching all exceptions is bad, as exceptions in my code are treated the same as connection errors, and not passed to my standard exception handling (HTTP 500, plus email to me). From   …Continue Reading

Beautiful Ruby

When coding, I often have the need for a statement along the lines of: print (string_a != nil) ? string_a : string_b i.e. print string_a unless it’s nil, then print string_b. In ruby, I figured there must be a neater way, so I tried: print string_a or string_b and it worked. Wow. So neat. So   …Continue Reading

Tales of PDF Generation in Rails

Last week’s “inflight project” (that is, some fun code I hack out while in the air) was to do some custom PDF generation in Rails. That is, a special view to render a PDF. There appear to be two main approaches to this currently in rails: PDFKit (which uses the wkhtmltopdf binary, itself based on   …Continue Reading

Day of Ruby Bugs

Learned a lot today. Created and deployed a migration Created my desired JSON format Updated rails on dev machine and server. Configured geospike.com’s rails server to talk to the PHP update server using JSON over REST hit a lot of bugs too reload! doesn’t reload the console in 3.0.0 and 3.0.4 as_json is not processed   …Continue Reading

Ruby Ternary Operations

Ruby’s other Ternary Operator Best Practices