Tag Archives: code

MySQL Union is column name and data-type agnostic

I stumbled upon a rare care while working on one of my projects. The data in one of my variables in PHP was being jumbled up. It took an hour of debugging my PHP code till I realized the the … more

Tags: , ,
Posted in lab | 4 Comments
• • •

Greedy Regular Expressions

By default the pattern matching in regular expressions is greedy in nature. The regex engine will try to match the largest string possible for the given expression rather than the first smallest match, which may not be desired behavior every … more

Tags: , ,
Posted in lab | Leave a comment
• • •

Base62: Convert a number to base 62 for short URLs in PHP

Base62 is a PHP class to convert a number to and from any base between 2-62. There is no native function in PHP to convert upto base 62. The native function base_convert converts numbers upto base 36, ie. using 0-9 … more

Tags: , , , ,
Posted in lab | 3 Comments
• • •

XML2Array: Convert XML to Array in PHP

XML2Array is a class to convert XML to an array in PHP. It returns an array which can be converted back to XML using the Array2XML class. It can take a string XML as input or an object of type … more

Tags: , , , ,
Posted in lab | 10 Comments
• • •

Array2XML: convert PHP Array to XML (with attributes and CDATA)

Array2XML is a class to convert an array in PHP to XML. It allows you to parse a multidimensional array into XML including attributes unlike other scripts available on the internet. It returns the XML in form of DOMDocument object … more

Tags: , , , ,
Posted in lab | 58 Comments
• • •

Getting most out of Amazon S3

Amazon S3 is a very useful service. S3, according to the official Amazon Web Services website is Amazon S3 is storage for the Internet. It is designed to make web-scale computing easier for developers. Its a no frills service and … more

Tags: , , ,
Posted in lab | 17 Comments
• • •

Powerpoint / Slideshow Karaoke

Last year while I was at SlideShare.net, me and my friends were thinking of some cool ways to use our API. At the same time we were checking out emails from our users about how they are using sideshows in … more

Tags: , , , ,
Posted in lab | Leave a comment
• • •

Cookie Jar: Yummy JSON Cookies (using Prototype)

JavaScript code to store data as JSON strings in cookies. It uses prototype.js to store and retrieve JSON data from cookies. Now we can store and retrieve JavaScript Objects, Arrays, Boolean, String, Number values using cookies, just like storing Java … more

Tags: , , , , , ,
Posted in lab | 36 Comments
• • •

JavaScript/CSS Font Detector

JavaScript code to detect available availability of a particular font in a browser using JavaScript and CSS.

Tags: , , , , ,
Posted in lab | 24 Comments
• • •

Snake (Game)

Snake is a tiny game that I made in my computer lab while learning C. This is quite similar to the one found in ‘Nokia’ mobile phones and others. Download: Snake (122 kb, with source code)

Tags: , , ,
Posted in lab | 1 Comment
• • •