Compress PHP Output from .htaccess
Compress all PHP output by adding this line to .htaccess file
php_value output_handler ob_gzhandler
Compress all PHP output by adding this line to .htaccess file
php_value output_handler ob_gzhandler
Prints all the arguments of the function. This function uses console.log if firebug is available - else, uses alert.
function p() {
for(var i=0; i<<arguments.length; i++) {
if(window.console) console.log(arguments[i]);
else alert(arguments[i]);
}
}
Creating Chainable interfaces in javascript…
(function() {
function _init() {
return this;
}
_init.prototype = {
"myFunction": function() {
return this;
}
// Put all the functions here - make sure all 'return this;'
}
chainer = function() {
return new _init();
}
})();
Roll out your own JavaScript Interfaces
[tags][/tags]
This is how you create a permanent alias is fish…
alias x='exit'
save_function x
Create the MySQL format date(YYYY-MM-DD) using the date command
date +%Y-%m-%d
Moving, Coping and Deletion
svn mv file.php to_folder/ #Move
svn cp file.php to_folder/ #Copy
svn rm file.php #Deletion
The build.xml file to concatenate files using ant. This can be executed using the command ‘ant “ConcatAll”‘
<?xml version="1.0" encoding="UTF-8"?>
<project name = "MyProj" basedir = "." >
<target name = "ConcatAll" >
<concat destfile = "final.txt" fixlastline = "yes" >
<filelist dir = "."
files = "first_file.txt
second_file.txt
third_file.txt"/>
</concat>
</target>
</project>
Another method to get the sensex. This method is more realiable in working - but the data might be a bit old. Data supplied by Yahoo Finances.
curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=%5EBSESN&f=sl1d1t1c1ohgv&e=.csv'| awk -F ',' '{print $2}'
This one command will fetch and display the latest sensex figure in Linux. This command basically downloads a page, locates a specific line, and then extract just the necessary portion from it. I am sure you could find other uses for this method.
curl -s "http://money.rediff.com/money/jsp/markets_home.jsp" |grep ''|head -n1|perl -pe 's/^.+\">([\d\,\.]+)<\/TD>.+$/\1/i;'