External content

What's in a View? A look at the alternatives

Great look at the tradeoffs between progressive enhancement with jQuery or similiar, vs. client-side views.

Chart.js - a promising JavaScript charting library with MIT-license

Chart.js seems to be a good alternative to Google's Chart API and other commercial chart drawing libraries.

  • good looking charts
  • canvas based (means less memory consumptive, but no interactivity out of the box)
  • highly configurable
  • good API and documentation
  • just 4.5 kilobytes
  • MIT license
  • Browser support: all browsers supporting the canvas element (for IE8 and below, use the polyfill as describes in the [chart.js documentation…

Tips And Tricks For Print Style Sheets

Smashing Magazine lists some handy tricks for print style sheets, all with CSS:

  • Expand External Links For Print
  • Print QR Codes For Easy URL References
  • Use CSS filters to improve the result of printed graphics (i.e. images with transparent parts)

About progamming with Multi-Touch, Touch- and Mouse-Events in the webbrowser

Since there are more and more touch-capable devices out there, as a web-developer it becomes more and more important to know how to deal with touch events next to mouse events and how you you can combine both worlds (mouse and touch interaction).

Here's a quick introduction to (multi-)touch browser events and an advanced article that deals with touch and mouse events and how they can be combined.

How to copy your „Google Chrome“ or „Chromium“ profile without creating an online account

Google Chrome saves your profile data in ~/.config/google-chrome.
To transfer the profile to for example a system you have setup freshly do following steps:

  • make a copy of ~/.config/google-chrome
  • install google-chrome
  • restore your backuped profile to ~/.config/google-chrome
  • launch google-chrome

(Replace google-chrome by chromium-browser if you use chromium-browser)

Ensure reloading of favicons

Sometimes it seems a favicon does not work because your browser displays an old version or (in case of local development) a favicon of another project you worked on recently.

Though, you can force your browser to really reload the favicon using some kind of additional version parameter string like this:

= favicon_link_tag("/favicon.ico?v=2")

Ruby: Find where a method is defined

Dead simple: Get the method object and ask for its owner:

=> #<Method: String#upcase> 
=> String

Ruby 1.9 adds a method Method#source_location that returns file and line number where that method is defined.

class Example; def method() end end
=> nil
=> ["(irb)", 11] 

=> nil # String#upcase is a native method that's defined in C

Rumor has it in Ruby 1.8 there…

Comparing Rails' flash hashes will not respect their internal lists of used entries

Rails flashes (FlashHash) track a list of used keys, which is not respected when comparing flash hashes.

This does not concern you under most circumstances.


When ActionController picks up a flash object, it will call the #sweep method once; that method checks the list of used flash entries and deletes those. All other entries are flagged as used. This means they will be deleted on the next request, but are still be available for rendering during the current request.

Fun facts: When redirecting, this does not happen. Also,…

Interactive generator for gradients, borders, noise textures and box shadows

CSSmatic lets you play around with four rather complex CSS stylings and gives you CSS or SASS code to use your result right away.

  • Gradients
  • Borders
  • Noise textures – offers a texture download
  • Box shadows

Ruby 1.9 or Ruby 2.0 do not allow using shortcut blocks for private methods

Consider this class:

class Foo

  def test
    puts "Hello"

While you can say create a block to call that method (using ampersand and colon) on Ruby 1.8, …

1.8.7 >
=> #<Foo:0x1e253c8> 

… you cannot do that on Ruby 1.9 or 2.0:

1.9.3 >
NoMethodError: private method `test' called for #<Foo:0x00000001e8c258>
2.0.0 >
NoMethodError: private method `test' called for #<Foo:0x000000027bc738...

How to: Ruby heredoc without interpolation

When you use heredoc, string interpolation is enabled by default:

x = "Universe"
  Hello #{x}
# => "Hello Universe"

This may be impractical sometimes. To avoid interpolation in heredoc strings, simply enclose your heredoc marker with single quotes:

x = "Universe"
  Hello #{x}
# => "Hello #{x}"

That will make the string behave like a single-quoted string, so sequences like \n wil…

Loading dumps via SSH, unpacking and sourcing them, all with a progress bar

Here is a hacky way to load dumps directly from the source server, without fully copying them over and extracting them first.

It may break horribly for you. This is the dark side of the force.

  1. Install pipe viewer, if you don't have it already: sudo apt-get install pv
  2. Know the location of the dump file on the remote server. We'll use /mnt/dumps/my_project.dump.bz2 in the example below.
  3. Find out the size of the (bzipped) file in by…

Initiate SSL secured TCP connections to remote services

Establishing a TCP connection to a SSL secured remote service is not possible using telnet or nc.

Though, you can use openssl for that:

openssl s_client -connect

Fix „rvm no such file to load -- openssl“ or "rvm no such file to load -- zlib"

For example if you use rvm and get this message:

ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand

You've installed your ruby without having all required libraries.

I don't know why there isn't a Warning message if you install a ruby with rvm and didn't have libraries like openssl and zlib.

To fix this you can execute this:

#to show the requirements for your system
rvm requireme...

Browser Hacks: CSS Rules to Target Specific Browsers And Versions

The linked site lists a wealth of CSS hacks that let you apply styles to just that one browser. You should be using this mostly for fixing browser issues and not give up on creating solid styles.

Different behavior for BigDecimal#floor in Ruby 1.8 and Ruby 1.9

Ruby 1.8 (supplied by Rails' ActiveSupport)

=> BigDecimal

Ruby 1.9 (supplied by Ruby 1.9 itself)

=> Fixnum

In fact, Float#floor has changed from Ruby1.8 to Ruby 1.9 which is used by BigDecimal#floor internally.

Attached initializer backports Ruby 1.9 behavior to Ruby 1.8.

Capistrano: Bundler stalls and asks for "Username"

Given you use Capistrano together with bundler to automatically install your gems when deploying.

I recently had the problem that Capistrano stalled like this:

[err ::] Username:

It turned out that I this originated from GitHub. We had a gem in our Gemfile that explicitly pointed to a GitHub URL like that:

gem 'foogem', :git => ''

The URL was returning a 404 which caused the problems. You have to get another gem or point to a fork on GitHub.

3390 cards