View
External content

How much should I refactor?

The Rails community has been abuzz with object-oriented programming, SOLID principles, laws, design patterns, and other principles, practices, and patterns. We’ve (re)discovered new tools and techniques to separate and reuse logic, making code easier to test, understand, and maintain. Now that we’ve learned about all these new tools, when do we use them?

External content

Using ENUMs with Rails - See John Code

This sounds promising:

The best part from the Rails side, is that you don’t have to change anything at all in your code to swap a varchar out for an ENUM.

Calendar quarter calculations in Ruby and MySQL

ActiveSupport >= 3 has

Date.parse('2011-02-10').beginning_of_quarter #=> 2011-01-01
Date.parse('2011-02-10').end_of_quarter #=> 2011-03-31

You can manually calculate the quarter index like

(Date.parse('2011-02-10').month / 3.0).ceil #=> 3

MySQL has

SELECT QUARTER('2011-02-10'); #=> 1

Mysql/Mysql2 agnostic database.yml

If you upgrade to the mysql2 gem, you will run into the problem that the server's database.yml (which is usually not under version control) needs to change exactly on deploy.

You can however make your database.yml work for mysql and mysql2 at the same time. Simpy do this

production:
   adapter: <%= defined?(Mysql2) ? 'mysql2' : 'mysql' %>
   #...
External content

archan937/ruby-mass

Introspect the Ruby Heap by indexing, counting, locating references to and detaching (in order to release) objects.

External content

Responsive Inspiration

A collection of inspirational websites using media queries and responsive web design. Curated by Eivind Uggedal (@uggedal).

LibreOffice Impress: Distorted text letters in presentation mode

Upgade to LibreOffice 3.5.3+ or disable hardware accelleration in Tools → Options → LibreOffice → View → Graphic output.

Show hint in HTML 5 text fields

To have your text input field pre-filled in with some text that disappears as soon as the user selects it, use the attribute placeholder:

<input type="text" placeholder="User name here">

This will only work in recent browsers (IE >= 10, FF >= 4, Chrome >= 4, Safari >= 5, Opera >= 11.6).

External content

Preloaders.net - AJAX loading GIF and APNG spinners, bars and 3D animations generator

Generated animations are free to use without backlink obligations…

… WITH THE EXCEPTION of any other animated images generator applications

Haha :)

Security fixes for Rails 2.3

Last week saw a security issue with rails 2.3 that required a fix. While an official patch was provided, the 2.3 branch is no longer maintained. So we forked it.

(I'm sure there are already 100 other forks doing absolutely the same, but they are not very easily discoverable.)

To use our fork, change the gem "rails"... line in your Gemfile to this:

gem 'rails', :git => 'https://github.com/makandra/rails.git', :branch => '2-3-fixes'

The intent is to make as few changes to the f…

The asset pipeline does not like files that look like fingerprints

If you have a file that looks like a precompilation fingerprint, the Rails asset pipeline will not see it. So don't have filenames like this:

8e21264d-f678-4005-b90c-8d8288a0d179.ttf
External content

Solve Flash performance issues in Ubuntu

The linked article describes how to use a Firefox addon "Flash-Aid" to install a better build of Flash and apply some optimizations.

With this I can now properly watch fullscreen HD videos under Ubuntu.

CSS3 Media Queries have reached recommendation status

Media Queries have reached W3C Recommendation on June 19th 2012.

If you were interested in other (future) web standards you can have a look at recent W3C publications.

Updated: Puppet 2.6.x on Ubuntu lucid 10.04

New way to install an actual puppet version on ubuntu

Trouble changing filename casing in git

On case-insensitive file systems like Mac's HFS+ (per default – you may change this, but it won't work for all programs), git won't recognize when you change the casing of files in your repository.

Workaround

git mv -f oldfile.name Oldfile.name
External content

Skype 4.0 for Linux

Promises unified window for all chat conversations, better call quality.

Upgrade seems to work fine. If you installed your old skype from a Ubuntu repository, you need to remove it first using:
sudo apt-get remove skype
Then simply install the .deb from the official page. You won't lose any settings.

Updated: Helpers to render (money) amounts

  • The amount helper now retrieves the decimal separator from your I18n dictionary (number.format.separator) instead of hardcoding it to a comma.
  • money_amount helper tunnels options to amount
  • New money_amount option :zero_as_dash

Geordi: Use load-dump script to source a database dump into your database

This script loads a dump into your development database.

You can provide the full path to you database dump like this:

load-dump path/to/my.dump

When you call load-dump without any arguments it will show a menu with all dumps in your ~/dumps/ folder.

load-dump

This script is part of our geordi gem on github.

View
3112 cards