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.
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).
Updated: Puppet 2.6.x on Ubuntu lucid 10.04
New way to install an actual puppet version on ubuntu
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 #=> 1
Yes, you do actually divide by 3.0
, not 4.0
.
MySQL has
SELECT QUARTER('2011-02-10'); #=> 1
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 :)
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
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' %>
#...
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...
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.
archan937/ruby-mass
Introspect the Ruby Heap by indexing, counting, locating references to and detaching (in order to release) objects.
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
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 toamount
- New
money_amount
option:zero_as_dash
Responsive Inspiration
A collection of inspirational websites using media queries and responsive web design. Curated by Eivind Uggedal (@uggedal).
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.
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.
Why you should never use hash functions for message authentication
Read the linked article together with this reply to get an appreciation for why it's a bad idea to roll your own crypto protocol.
Top 7 Myths about HTTPS | HttpWatch Blog
Myth #5 (Each HTTPS Site Needs its Own Public IP Address) is actually still true, but the rest of the article is worth reading.
xip.io: wildcard DNS for everyone
xip.io is a magic domain name that provides wildcard DNS for any IP address. Say your LAN IP address is 10.0.0.1. Using xip.io,
10.0.0.1.xip.io resolves to 10.0.0.1
www.10.0.0.1.xip.io resolves to 10.0.0.1
mysite.10.0.0.1.xip.io resolves to 10.0.0.1
foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1
...and so on. You can use these domains to access virtual hosts on your development web server from devices on your local network, like iPads, iPhones, and other computers.
Loading half a billion rows into MySQL
Some advice for bulk loading many records into InnoDB and finishing before the sun burns out. Use with care.
Update: Shell script to deploy changes to production and not shoot yourself in the foot
deploy-to-production
now calls Capistrano with bundle exec
since we started to bundle Capistrano in all projects.
Use ActiveSupport autoloading outside of Rails
The following code activates autoloading using ActiveSupport 3.x:
require 'active_support'
require 'active_support/dependencies'
relative_load_paths = %w[app/controllers app/models]
ActiveSupport::Dependencies.autoload_paths += relative_load_paths
How to search for large messages in Thunderbird
You can search for large messages by folder or by your entire email account.
Useful to reduce your mailbox size with a few deletions.
Browser Standards progress: CSS filter property
Some progress was made by browsers on implementing CSS filters like blur, greyscale or some other effects. You might already know the legacy CSS filter attribute that old IE versions used to perform DirectX transformations. Luckily these legacy filters are removed in IE10. The good news is, newest WebKit-based browsers like Chrome (18.0+) Safari and Mozilla Firefox expe...
jQuery Tag Cloud
TagCanvas is a Javascript class which will draw and animate a HTML5 canvas based tag cloud.