patchwork

an assorted collection of randomness and non-essential remarks
Have at least one original repos where PHP is the dominant language The walrus is no stranger to variety. Use at least 4 different languages throughout all your repos Fork and commit to someone's open source project in need Have a project valued enough to be forked by someone else Have at least three original repos where Ruby is the dominant language Have at least one original repo where Ruby is the dominant language Have at least one original repo where some form of shell script is the dominant language
Endorse tarakanbg on Coderwall Powered by Obtvse

notams: a ruby gem for retrieving... well, NOTAMs

New release: notams, gem for retrieving the currently active NOTAMs for an airport or a region. Supports multiple airports/regions in one request. Pulls data from FAA website. Depends on nokogiri for the heavy lifting.

Here’s a quote from the documentation:

The .notams method can be applied to any string (or variable containing a string), representing a valid ICAO code of an airport or FIR, or a comma-separated list of airports/regions. It will return an array,
containing all the currently active NOTAMs for your selection. You can loop through the array to display or parse individual notams.

Loading gist...

As usual, the packaged gem is available on rubygems and the source code and documentation are on github.

Nice Nokogiri tutorial

I stumbled upon a nicely written entry-level tutorial about nokogiri, giving a clean, plain language explanation of the basic gem functionality and methods. The article is part of The Bastards Book of Ruby.

Img

Dan Nguyen

Parsing HTML with Nokogiri

We... saw how to use the web inspector to intercept raw data files. This allows
us to read from them directly rather than deal with the data in HTML format...
But there will be many instances when you'll need to parse raw HTML. The
Ruby gem Nokogiri makes reading raw HTML as easy as crack-parsed XML
and JSON.

Read the entire post here

Great site for 3D panoramas

#D panoramas

Discovered on the web: Airpano.com a great site for 3D aerial panoramas and virtual tours. Plenty of gorgeous places and landmarks from all over the world, nice theme music, intuitive mouse controls.
One can spend an entire day in virtual travelling and day-dreaming.

Android: fixing the Google Play Store 'insufficient space' error

There's an annoying issue that many Android users with custom ROMs such as CyanogenMod have experienced: when trying do download a larger app from the Google Play Store, i.e. 25-30 MB app, then occasionally an error message appears to indicate that the download can't be completed due to "insufficient space on the device".
This can happen even if there are 90-100 MB free on internal memory, which is much more then required for installation.

This issue crept in with one of the newer versions of Android Market, around the end of 2011, so devices that haven't been upgraded since will be unaffected. The issue is due to the Market (Play Store) cash being stored on internal memory and affecting the free space requirements calculations for downloading a new bigger app locally and then installing it. This can be solved by moving the Play Store cache to the SD card. Luckily there's an app that makes this easy!

App

Enter Marketfix. Just install the app and run it, but note: it requires root permissions to complete the cache relocation operation.

GCMapper updated with new features

It looks like gcmapper got some traction after its initial release, so after listening to some feedback I released a new version with the following changes:

  • [Enhancement] Maps now show the user input code (ICAO or IATA) instead of ICAO only
  • [Feature] New hash option :city to toggle city labels on or off (see Readme)
  • [Feature] New hash option :airport_name to toggle airport name labels on or off (see Readme)

Some examples of the new options:

Loading gist...

GCMapper: A Ruby gem for generating Great Circle maps

Yet another gem release announcement: this time it's GCMapper, a library for easy generation of Great Circle Map images between 2 or more airports. The gem provides an API for constructing the image URLs, the maps themselves are pulled from gcmap.com.

Here's a quote from the documentation:

The .gcmap method can be applied to a string (or variable containing a string), representing a valid route between 2 or more airports (ICAO or IATA codes), connected with dashes, like this: EGLL-LOWI or LFST-LSZH-LBSF.

The resulting image size and look can be customized by passing an optional hash of arguments to the .gcmap method. Customizable attributes include width, height and terrain (toggle satellite terrain overlay). These options can be combined in any way or omitted entirely.

Here are some examples:

Loading gist...

Finally, here's an example of how to use the gem in a Rails application:

In your controller:

@route = "egll-lowi"

In your view:

<%= image_tag @route.gcmap(:width => "600") %>

Notes:

  • the route string can be constructed from either ICAO or IATA airport codes; both types are recognized
  • the route string is not case sensitive, so for example lgav-lqsa will be recognized as well
  • layover routes that chain multiple airports (more than 2) are also supported
  • default image parameters are: width 720px, width: 360px, terrain not shown
  • when passing the width and height hash options the values can be put in quotes or not, either way works

As usual, the packaged gem is available on rubygems and the source code and documentation are on github.

Vatsim_metar: a ruby gem for displaying Vatsim metars

I just released a simple ruby library for pulling and displaying latest VATSIM metar for a particular station. Can be used with Rails, Sinatra or any other kind of ruby application (web or otherwise).

The usage is really simple, here's a quote from the README:

The .metar method can be applied to a string (or variable containing a string), representing a valid ICAO code. Like this:

Loading gist...

The input ICAO code is not case sensitive, so the following should work as well:

Loading gist...

Technicalities

This library augments the default Ruby String class with a method named .metar. It returns a string, containing the latest Vatsim METAR. The data is obtained via curl from Vatsim's web API, hence the curb dependency.

The packaged gem is available on rubygems and the source code and documentation are on github.

Rails Installer update for Ubuntu 12.04 (Precise Pangolin)

Alt text

I just updated my simple Rails Installer script for compatibility with Ubuntu 12.04. Some extra necessary deb packages were added and the ruby version is now bumped to 1.9.3. If you don't feel like fiddling with rvm and gemsets, which in my opinion is seldom necessary anymore with all the latest bundler improvements, you can just grab the script from github.

Gitlab 2.4 first impressions

Today the great folks at http://gitlabhq.com/ released their version 2.4 and it's great to see the project going strong and getting more mature and more powerful with each new release. They're also keeping the original promise of monthly releases and this is a very tight schedule, considering how much work goes into each new version. This one for example has more than 200 commits.

So here are my thought's, focusing mostly on the deficiencies, as those are getting fewer and fewer with each release :).

This release introduces yet another visual redesign, not as fundamental as the previous one, but rather an incremental and quite welcome polish and enhancement, harnessing the power of twitter bootstrap and the responsive layout design.

The milestones feature is necessary and welcome as well, however not perfect in its current implementation. For one thing we need to be able to see at a glance which milestone do the issues belong to in the issues list. Also we need multi-edit on issues to be able to mass-assign/reassign milestones, assignees, etc.

The activity timelines, both global and scoped through a particular project are very handy for keeping track of what all the other members are doing, however they're missing an RSS feed and that in a Rails app is easy to attach.

The merge/pull request functionality is great and in the code sections the only thing I'm really missing is a functionality replicating Github's "blame" view.

The admin interface has evolved for the better, but something I'm missing here is the ability to fine-tune user permissions, perhaps custom roles with the possibility to include/exclude any of the currently existing permissions on a per-role basis. For example what is the logic behind a "developer" being able to open issues, but only close their own ones? It's too restrictive if only a "master" can resolve issues - considering all the powers a master has, I don't want to be forced to assign this role to anyone whom I want to work on and close issues.

But these are all minor things that will undoubtedly be smoothed out in the future and even now it's a pleasure to use gitlab in production on a daily basis. Looking forward to version 3, which should come in May and bring even more excitement!

Slovom - a Ruby library for verbalizing currency

Last night I released a new ruby gem (slovom).

It converts decimal currency numbers into text in Bulgarian language, which can be useful in financial applications, accounting documents, and all other instances requiring currency verbalization. It handles the specifics of verbally presenting numbers and prices in Bulgarian, including grammatical irregularities, differences due to gender, singularity and plurality and the logic of using or omitting the "and" conjunction from the resulting string.

It's extracted from a pawnbroker/pawnshop rails application which I'm currently working on, called Lombard, to be released as a service in the coming months.

Example usage:

product1.price.to_s => "23.00"
product1.price.slovom => "двадесет и три лева"

product2.price.to_s => "1563.78"
product2.price.slovom => "хиляда петстотин шестдесет и три лева и седемдесет и осем стотинки"

product3.price.to_s => "0.75"
product3.price.slovom => "седемдесет и пет стотинки"

"76.03".to_d.slovom => "седемдесет и шест лева и три стотинки"

It's a bit surprising to see some 50 downloads of the gem in less than a day, hopefully other Bulgarian ruby developers will find it useful.

Here's the github link for convenience.