Skip to content

Instantly share code, notes, and snippets.


Biswarup Adhikari biswarupadhikari

View GitHub Profile
biswarupadhikari / validate.js
Created Nov 19, 2013
Validate Version using Javascript
View validate.js
function validateVersion(version){
var pat=/^[0-9]{1,3}.[0-9]{0,3}.[0-9]{0,3}$/;
return pat.test(version)
Validate Version
var version="10.2.5";
biswarupadhikari / Model.php
Created Oct 23, 2013
Joomla Custom Server Side Va
View Model.php
* Validate Data
function validate($form, $data,$group=null){
return $data;
biswarupadhikari / datetime_diff.php
Created Sep 30, 2013
Datetime difference in Hour
View datetime_diff.php
function getTimeDifference($start_time,$stop_time){ $start_time=strtotime($start_time); $stop_time=strtotime($stop_time); $seconds=$stop_time - $start_time; if($seconds > 3600 ){ $hours=floor($seconds / 3600); $seconds=$seconds % 3600; }else{ $hours='00'; } if($seconds > 60 ){ $minutes=floor($seconds / 60); $seconds=$seconds % 60; }else{ $minutes='00'; } return $hours.':'.$minutes.':'.$seconds; } echo getTimeDifference('2013-05-11 13:24:48','2013-05-12 13:59:49');
View new_gist_file
your socket is already in use. kill it and it should be resolved.fuser -k 8080/tcp for example the above code kills and frees the socket at 8080
Kill using process ID
biswarupadhikari / gist:6487523
Created Sep 8, 2013
Change PHPVersion Via htaccess
View gist:6487523
AddType application/x-httpd-php54 .php
AddType application/x-httpd-php53 .php
AddType application/x-httpd-php5 .php
biswarupadhikari / changePermission.php
Created Sep 7, 2013
Change File FolderPermission Recursively via PHP Script
View changePermission.php
exec ("find $curDir -type d -exec chmod 0755 {} +");
exec ("find $curDir -type f -exec chmod 0644 {} +");
View unzip.php
$zip = new ZipArchive;
$res = $zip->open('');
if ($res === TRUE) {
echo 'woot!';
} else {
echo 'doh!';
biswarupadhikari /
Created Aug 12, 2013
Sublime Text :: Inser Or Replace Content
import sublime, sublime_plugin
class ExampleCommand(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
self.view.replace(edit, region,"Test")
biswarupadhikari / gist:5592381
Created May 16, 2013
Joomla : Frontend pagination pass variable values
View gist:5592381
$app =JFactory::getApplication();
$router =$app->getRouter();
$router->setVar( 'filter_order',$listOrder);
$router->setVar( 'filter_order_Dir',$orderDirn);
$router->setVar( 'view','bookings');
biswarupadhikari / regularexpression.php
Created May 9, 2013
PHP: Regular Expression Example can be used in joomla plugin development
View regularexpression.php
$text="welcome to my blog {Twitter}google{/twitter}this ius how us follow me on {twitter}biswarupa
{/twitter} created i dont ondsfdsk dsf";
*/is i means case insesitive {twitter} or {TWiter} s whitespace or newline like {twitter}