View validate.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | |
if(validateVersion(version)){ |
View Model.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Validate Data | |
*/ | |
function validate($form, $data,$group=null){ | |
$status=true; | |
if(!$this->EmailValidate($data['email'])){ | |
$status=false; | |
} | |
if($status){ | |
return $data; |
View datetime_diff.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View gist:6487523
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddType application/x-httpd-php54 .php | |
AddType application/x-httpd-php53 .php | |
AddType application/x-httpd-php5 .php |
View changePermission.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$curDir=dirname(__FILE__); | |
exec ("find $curDir -type d -exec chmod 0755 {} +"); | |
exec ("find $curDir -type f -exec chmod 0644 {} +"); |
View unzip.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$zip = new ZipArchive; | |
$res = $zip->open('my-20130906-191334.zip'); | |
if ($res === TRUE) { | |
$zip->extractTo(dirname(__FILE__)); | |
$zip->close(); | |
echo 'woot!'; | |
} else { | |
echo 'doh!'; | |
} |
View contentreplace.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
View gist:5592381
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$listOrder=$this->escape($this->state->get('list.ordering')); | |
$orderDirn=$this->escape($this->state->get('list.direction')); | |
$app =JFactory::getApplication(); | |
$router =$app->getRouter(); | |
$router->setVar( 'filter_order',$listOrder); | |
$router->setVar( 'filter_order_Dir',$orderDirn); | |
$router->setVar( 'view','bookings'); | |
?> |
View regularexpression.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$text="welcome to my blog {Twitter}google{/twitter}this ius how us follow me on {twitter}biswarupa | |
{/twitter} created i dont ondsfdsk dsf"; | |
preg_match_all('/{twitter}(.*?)\{\/twitter}/is',$text,$matches); | |
print_r($matches); | |
/* | |
*/is i means case insesitive {twitter} or {TWiter} s whitespace or newline like {twitter} | |
{/twitter} | |
*/ |
NewerOlder