Category: Code

Remove Empty Lines and Comments

Remove comments and blank lines from example.pl sed ‘/ *#/d; /^$/d’ example.pl

Merging a Branch with the Master Branch in git

The commands needed to merge two branches in git. git checkout master git merge BrachName git commit -m “Merged” -a

Stop crond When mysqld is Down

A perl script to stop crond if mysqld is down #!/usr/bin/perl # See if MySQL server is alive or not…

Find if a Variable is Defined in Ruby

This will let you find whether a variable is defined in ruby. if(defined? var_name) then print var_name + ” is…

Install dependencies for HTML Validator

Installing the dependencies for HTML Validator extension for Firefox on linux. sudo yum install compat-libstdc++-296 compat-libstdc++-33 tidy

Get URL Headers from Linux Command Line

Show the headers of an URL from the command line. This will need perl, lwp installed on the system. lwp-request…

Installing a Ruby Gem

Use this command to install a ruby gem in Linux – you must be connected to the net sudo gem…

Compress PHP Output from .htaccess

Compress all PHP output by adding this line to .htaccess file php_value output_handler ob_gzhandler

A Simple Logging Function for JavaScript

Prints all the arguments of the function. This function uses console.log if firebug is available – else, uses alert. function…

Chainable interface in JavaScript

Creating Chainable interfaces in javascript… (function() { function _init() { return this; } _init.prototype = { “myFunction”: function() { return…