Skip to content

Instantly share code, notes, and snippets.

View biswarupadhikari's full-sized avatar

Biswarup Adhikari biswarupadhikari

View GitHub Profile
@biswarupadhikari
biswarupadhikari / getFileHashCode.sh
Created August 7, 2012 02:43
How to Generate Sha1 Or md5 Value for a File File Hash Code
filepath="/home/testuser/MyRadio.jpg"
myfilehash=$(sha1sum $filepath)
echo "File Sha1 Value is $myfilehash"
myfilehash=$(md5sum $myfilepath)
echo "File MD5 Value is $myfilehash"
@biswarupadhikari
biswarupadhikari / gist:3396638
Created August 19, 2012 17:42
Install Git-FTP
$ git clone http://github.com/resmo/git-ftp.git
$ cd git-ftp
$ git checkout master
$ sudo make install
@biswarupadhikari
biswarupadhikari / filename.js
Created September 6, 2012 06:02
Extract File Without Extension Via Javascript
var url = "http://example.com/index.htm";
var filename = url.match(/([^\/]+)(?=\.\w+$)/)[0];
@biswarupadhikari
biswarupadhikari / mod_youtube.xml
Created October 10, 2012 07:39
Joomla:How to add Module Parameter Joomla 2.5
<config>
<fields name="params">
<fieldset name="basic" label="Module Parameters" description="Module settings">
<field size="10" name="youtube_url" type="text" default="200" label="Youtube Video URL" description="" />
<field size="10" name="height" type="text" default="315" label="Height" description="" />
<field size="10" name="width" type="text" default="560" label="Width" description="" />
</fieldset>
</fields>
@biswarupadhikari
biswarupadhikari / gist:3880666
Created October 12, 2012 18:20
Joomla:Check Logged user in Frontend or In Backend
<?php
$app =& JFactory::getApplication();
if ($app->isAdmin()) {
echo "we are in the administrator";
} else {
echo "we are in the frontend site";
}
@biswarupadhikari
biswarupadhikari / .htaccess
Created November 1, 2012 12:48
How to Password Protect Directory Usiing .htaccess file
AuthName "Secure Area"
AuthType Basic
AuthUserFile /home/adidac/.htpasswd
require valid-user
@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: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, '');
}
}