Skip to content

Instantly share code, notes, and snippets.

View biswarupadhikari's full-sized avatar

Biswarup Adhikari biswarupadhikari

View GitHub Profile
@biswarupadhikari
biswarupadhikari / gist:4019473
Created November 5, 2012 18:35
How to Install PHPUNIT for PHP Unit Testing
$ sudo apt-get install phpunit
$ sudo pear upgrade pear
$ sudo pear channel-discover pear.phpunit.de
$ sudo pear channel-discover components.ez.no
$ sudo pear channel-discover pear.symfony-project.com
$ sudo pear install --alldeps phpunit/PHPUnit
$ sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
$ sudo apt-get install libssh2-1-dev libssh2-php
@biswarupadhikari
biswarupadhikari / gist:4038614
Created November 8, 2012 12:50
How to Detect Right Click Linux Java JTable
jt.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
int r = jt.rowAtPoint(e.getPoint());
if (r >= 0 && r < jt.getRowCount()) {
jt.setRowSelectionInterval(r, r);
} else {
jt.clearSelection();
}
int rowindex = jt.getSelectedRow();
@biswarupadhikari
biswarupadhikari / gist:4055958
Created November 11, 2012 19:22
Joomla : Get Module Parameter from Joomla 1.6,1.7,2.5
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mod_jogajog');
$params = new JRegistry;
$params->loadString($module->params, 'JSON');
echo '<pre>';
print_r($params);
echo '</pre>';
@biswarupadhikari
biswarupadhikari / gist:4213130
Created December 5, 2012 06:47
LAMP /var/www/ Permission Setup Ubuntu Localhost
let say your username is adidac
$ sudo add user adidac www-data
$ sudo chown -R www-data:www-data /var/www/
$ sudo chmod -R g+rw /var/www/
@biswarupadhikari
biswarupadhikari / trim.js
Created December 13, 2012 13:57
JavaScript Trim Functionality
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
@biswarupadhikari
biswarupadhikari / test.sql
Created December 18, 2012 13:10
Clone Mysql Table Struture
create table mydb.test2 like mydb.test;
@biswarupadhikari
biswarupadhikari / copy.sql
Created December 18, 2012 13:13
All All Mysql Data From One Table to Another
INSERT INTO mydb.test2 SELECT * FROM mydb.test
The above query will copy all data from test table to test2 table.
@biswarupadhikari
biswarupadhikari / test.sh
Created December 21, 2012 11:39
How to Install PHP Curl In Ubuntu
sudo apt-get install php5-curl
@biswarupadhikari
biswarupadhikari / joomlaPermission.sh
Created December 21, 2012 12:03
Ubuntu Joomla File Folder Recursive Permission Set
find /var/www/joomla -type f -exec chmod 0644 {} \;
find /var/www/joomla -type d -exec chmod 0755 {} \;
@biswarupadhikari
biswarupadhikari / subdir.php
Created January 4, 2013 15:34
is_subdir php function. How to check is sub directory is php
<?php
function is_subdir($parent,$sub){
$parent=rtrim($parent,'/');
$sub=rtrim($sub,'/');
$parent=explode('/',$parent);
$sub=explode('/',$sub);
for($i=0;$i<count($parent);$i++){
if($parent[$i]!=$sub[$i]){
return false;
}