jQuery plugin for creating filters / tabs for a list of items

There are a lot of solutions for creating tabs over some content, but I couldn’t find anything that would automatically generate tabs for a list of items and allow some of the items to appear on different tabs.

I just published on Github an early version of a jQuery plugin to do just that. It’s called DynamicFilters (naming is hard). The basic idea is to “tag” the items (divs, for example) using classes, and call the plugin passing along the classes you want to turn into filters / tabs.

This can be very useful if you have to publish multiple lists per page and/or the same lists on multiple pages, since you’ll not need to duplicate the HTML for the tabs.

Stop resetting VirtualBox with cmd+R keyboard shortcut

After a while running Mac OS X and Windows XP in separate machines, I decided to get rid of the huge PC case under my desk and install Windows in a virtual machine within Mac OS X. VirtualBox was my choice, since it’s free and works awesomely.

One problem I was having, though, is that the current version of VirtualBox (in this exact moment I’m using 4.1.10) uses Command + R as a keyboard shortcut to reset the guest operating system. As you may know if you too use a Mac, this is also the combination of keys used to refresh a page in most browsers in Mac OS X. Since I keep switching between Windows and Mac throughout the day, my brain was having a difficult time remembering this difference, and I kept rebooting Windows by mistake.

Since I couldn’t find a solution, I decided to post a feature request in the VirtualBox Community website, asking for a feature that allows the users to change keyboard shortcuts. Before posting, though, I decided to investigate a little more, and ended up find a fix! Turns out it’s quite easy.

So, here it is what you have to do to stop this annoyance:

1) Under VirtualBox / Preferences, change the Host Key to something other than the left Cmd key (I used the right Option key);

2) In Windows, install SharpKeys and use it to map the Cmd key to the Ctrl key (or whatever other key you want);

3) ???

4) Profit!

 

No route matches “/rails/info/properties”

After installing Phusion Passenger (also known as mod_rails)  and creating a Rails application to test the environment, I was able to view the default “Welcome aboard” page that is displayed on new apps, but got an error after clicking the “About your application’s environment“. This was the message displayed:

No route matches “/rails/info/properties”

This was happening because by default Passenger sets the RAILS_ENV to production. The solution was to set it to development. This can be done in a couple of ways, but I decided to add “RailsEnv development” to the Apache configuration file, inside de definition of the app’s virtual host.

Open MKV files in VirtualDub

By default, VirtualDub does not support MKV / Matroska files. If you need to open a video in this format, you’ll have to use one of the workarounds available. The one that worked best for me is this:

1) Create a textfile (using Notepad or another plain text editor) with the following text:

DirectShowSource("video-filename.mkv")

Obviously replacing “video-filename” with the name of the MKV video you want to open. Give any name to the text file, but save it with the .avs extension, instead of the default .txt.

2) Open the .avs file you just created in VirtualDub. Make sure to have the video file in the same directory as the .avs.

Source

Custom token replacement in Drupal 7

If you need to replace custom tokens in the body or any other node field in Drupal 7, you can use the modules Token Filter and Custom Tokens to do the job.

Install and enable both modules, then enable the Replace Tokens filter in the desired input format. This is under Configuration / Input Formats.

To add the custom tokens, go to Structure / Custom tokens. If you create a token named Foobar, the custom token will be something like [custom:foobar].