css · geeky · php code

Lazy image placeholders that respect the actual image aspect ratio

While lazy loading of the images has been used by many performance conscious websites, the placeholder images are not usually the focus. Having placeholder images that respect the actual proportion of the lazily loaded images will reduce the “jumpiness” once images are loaded. Obviously in order to do this, you will need to know the… Continue reading Lazy image placeholders that respect the actual image aspect ratio

geeky · php code

Dynamically generate svg and converting it to gif in drupal

For the recent baby names project, we have a need to generate a baby name graphic on the fly to be used for pinterest. The corresponding graphics designed are very vector friendly. My first thought was why not generate these in svg to be shared? There are three background patterns and three different color groups… Continue reading Dynamically generate svg and converting it to gif in drupal

geeky · javascript · php code

Twitter API 1.1 php get tweets script

I’ve been using a nice caching php script for getting my latest tweets. Recently twitter completely stopped support for API 1 and everyone must use API 1.1. API 1.1 requires authentication and therefore making it more complicated to use the original script. I’ve modified the script with the help of the codebird library to do… Continue reading Twitter API 1.1 php get tweets script

geeky · php code

Simple PHP URL rewrite

One thing I did for dmb is making dodosmb.com/profile/username work with my profile.php script. Normally without the help of .htaccess, you can use the value of the path info from the global variable For example, create a php file named profile.php and in there put: Then upload the file and load it with yourServerPath/profile.php/dodo. The… Continue reading Simple PHP URL rewrite

funny · geeky · php code

A new way of array checking in PHP

i just saw the funniest thing in PHP yet! below is taken from here. This code is lifted from a socket handling class that I’ve been asked to work on today. Prepare to cringe: It’s worth noting that the foreach() statement will move from line 392 with so much as a return key (as it… Continue reading A new way of array checking in PHP