Dealing with timezones

When your creating an application maybe you end up dealing with timezones… there’s a huge black hole waiting for you there! Just one advice: use an existing, consolidated, tested timezones library!

Check out this funny video from Computerphile with Tom Scott: The Problem with Time & Timezones!

Sass logo

SASS or how to DRY your CSS

I’ve read an interesting article introducing SASS.

In short: SASS (Syntactically Awesome StyleSheets) is an extension of CSS that allow you to code and organize your stylesheet using variables, nested rules, mixins and inline imports!

As outlined in the linked post it may appear as an hindrance but it isn’t: actually if your start using it you’re applying the “don’t repeat yourself” (DRY) principle… no more redundant repetition but a more clean and neat set of stylesheets!

…and it’s an open source project!!!

Steps to get started? A few:

  1. install a Sass application or the command line utility to process .scss files
  2. take a look at sass reference
  3. write a .scss file
  4. put it through one of those compiler and you get your css files!

Why swap all the time… let’s check the swappiness!

Since 2003 my system has a linux based SO… and I’m very happy… I took a quick peek at Windows 8 and I’m glad I don’t need it.

But it’s not always a bed of roses.

I got 8Gb of ram in my workstation but sometimes (lot of browser tabs, netbeans, virtualbox, etc) I run out of free ram. The kernel then start to use the swap file. And up to this time it’s all by the book.

It happens, often, to reach quota 6/7Gb but not over that… in these cases the kernel decide to swapout something and I find myself with about 2Gb of free ram and 1.5Gb of swap file… the problem is that at this point my user experience become tiring.

So I found that the problem regards a certain kernel parameter: vm.swappiness. In Ubuntu it’s default is 60 and the valid range is 0 to 100 (0 means “try to not swap unless is necessary”, 100 “swap whenere you feel like it”). To find out your actual value try this in a command shell:

cat /proc/sys/vm/swappiness

Now… if you want to try a new value you can launch this command:

sudo sysctl vm.swappiness=30

Once you found  the right value for you it’s possible to put this setting in the configuration file “/etc/sysctl.conf”:

# swap tendency
vm.swappiness = 10

To check your configuration you can use this command and watch “si” and “so” columns (“swapin” & “swapout”):

vmstat 1


Javascript (jQuery) gallery made easy

When I need to put a fancy gallery in a site my pick i It’s a well documented MIT-licensed jQuery-based gallery that you can download here. You can eventually purchase even more fancy themes!

css transformation easing

With CSS3 you can apply transformation to DOM objects.. you can do a lot of thing but basically you can translate, rotate, scale and skew. One interesting thing I discovered today is how to add a custom “easing” to that transformation: cubic-bezier!

What you have to put in your css is:

-webkit-transition: -webkit-transform .5s cubic-bezier(.82,.2,.89,.3);
   -moz-transition: -moz-transform    .5s cubic-bezier(.82,.2,.89,.3);
    -ms-transition: -ms-transform     .5s cubic-bezier(.82,.2,.89,.3);
     -o-transition: -o-transform      .5s cubic-bezier(.82,.2,.89,.3);

Instead of “cubic-bezier(a,b,c,d)” you can also use a few preset (linear, ease, ease-in, ease-out, ease-in-out).

To figure out which values put in that function you can use this useful site: There you can also compare curves!!!