Packing rectangles into a rectangle

published on January 18, 2015 in Tips and Tricksno comments
Packing rectangles into a rectangle Once, I have been given the following task: make a JavaScript plugin that allows to fit a variable number of rectangles of different sizes into another rectangle. Or better, you have a variable number of surfaces to cover with iron, iron is provided in panels of size depending on the factory: calculate the minimum number of panels that you need to fulfill the request. In this calculation, you need to include a margin between the rectangles as well – that corresponds to the line of cut. It was a quite interesting challenge. Finding the perfect algorithm in a short time was quite... read more »
Tags:

array_insert for PHP

published on March 24, 2014 in Tips and Tricksno comments
Similar to array_splice, this array_insert function allows to insert an object in an array – thing that unfortunately is not possible with array_splice that deals only with array parameters. This function offers an option for replacing the item correspondent to the offset. function array_insert($array, $offset, $object[, $replace=false]) $array is the array to be modified $offset is the position where we want to insert our object. It needs to be positive and within the limits given by the dimension of the array. If it is less than 0, the object will be inserted as the first element;... read more »
Tags:

How to create a reverse slideDown-slideUp jQuery animation

published on July 6, 2013 in Tips and Tricksno comments
For those who love the slideDown and slideUp animation effect and would like to know how to create the reverse of this effect, here is a nice trick to simulate it. SlideDown will be the effect that makes the object disappear, while SlideUp will be the effect that makes the object re-appear. I called this effect blink, because it reminds me the blinking of an eye (demo links at the bottom). If you try to use simply jQuery animate function, the result is to obtain an object that effectively slide down until is completely gone out of the view; but it displays in a different way from the usual... read more »

How to change the WordPress upload directory

published on September 13, 2012 in Tips and Tricksno comments
How to change the Wordpress upload directory Have you ever wondered if it is possible to change the place where your media files are stored? Well, there is a way and it is very simple. Just go into the admin panel yoursitename.com/wp-admin. Then go Settings->Media.  As you have opened the page, scroll down to Uploading Files. Everything happens there! ... read more »
Tags:

Quick delicious pasta for busy designers

published on August 19, 2012 in Tips and Tricksno comments
Quick delicious pasta for busy designers There are some moments when deadlines are so tight that do not grant us a break for a snack, surely unimaginable for a meal. So let’s see how to prepare a delicious and quick dish with spaghetti and an incredibly easy sauce. Ingredients: Spaghetti (in the picture you can see spelt pasta, but you can use common wheat pasta) Olive Oil (possibly Extra vergine) Parmesan Lemon Salt Preparation: Put some water in a pot and add some salt (quantity depending on the quantity of water). When the water boil, add the spaghetti and let them cook as long as indicated on the wrapper (usually around 10... read more »
Tags:

Treatment for kitchen burns

published on August 10, 2012 in Tips and Tricksno comments
Treatment for kitchen burns Has anybody ever wondered how to prevent our skin from becoming red or blistered after getting burn? Let’s suppose you are preparing a delicious sauce, you are so happy and cannot wait to taste it on your pasta. But, ouch!, accidentally some drops of your sauce, or of hot oil or hot water have splashed on your hand. Or let’s suppose that you have touched the hot pot… it is not only a painful thing, but after few instances the affected part will become red and then a blister will nicely blow there. Of course you do not want to spoil your happiness because of that unfortunate... read more »
Tags: