Category: Code

Scope and Binding in JavaScript

Function x executions in the scope of object y. var Car = function() { this.name = ‘car’; } var Truck…

Adding a Windows Entry to Grub

The code to add a Windows loading section in Grub title Windows rootnoverify (hd0,1) chainloader +1 [tags]grub,windows,linux,boot,loader[/tags]

Dynamic/Static/Strong/Weak Types

A dynamically typed language is a language where the type of a variable can be altered at any time. (It…

Replace \n with another String

The command to convert all \n in a file to another string – very useful for list code generation. perl…

Remove Extension in Shell Scripting

This command will list all the files a folder without their extensions. Comes handy when doing shell scripting perl -e…

HTTP Digest Authentication with PHP

The code for using HTTP Digest Authentication with PHP. <?php realm = ‘Restricted area’; if (empty(_SERVER[‘PHP_AUTH_DIGEST’])) { header(‘HTTP/1.1 401 Unauthorized’);…

Find Element’s Position using JavaScript

Find the position of an element using javascript function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) {…

Searching text in a directory using find and grep

Use find and grep to search for a specific text in a directory. In this example, we search for files…

SourceForge Project Packager – from SVN source

This script will package your SVN code to a tar.gz file. Just give the name of the project as the…

Heading Fonts Styles

Some fonts/styles that could be used in headings – ie. <h1> tags. font:17px “Trebuchet MS”,Verdana,Arial,Helvetica,sans-serif; font:20px Georgia,Times,serif; [tags]font,style,heading,css[/tags]