Skip to content

Instantly share code, notes, and snippets.

View xkeshav's full-sized avatar
🟪

Keshav Mohta xkeshav

🟪
View GitHub Profile
@xkeshav
xkeshav / calss.debug.php
Created May 23, 2011 07:35
how to debug in php files
/** This function is used to debug variables during page execution
* @param $what , the variable which need to debug,can be array or single variable
* @param $more , to know the method and line number where that variable is used
* @param $die , set TRUE if want to stop the page
* how to use : debug::watch($postarray,1,1);
* @author keshav mohta
* @date Aug 12, 2010
*/
class debug()
{
@xkeshav
xkeshav / gist:3367635
Created August 16, 2012 07:15 — forked from remy/gist:360113
setInterval run once, then keep running
setInterval((function () {
console.log(new Date()); // run some arbitrary code
return arguments.callee; // here be the magic
})(), 1000);
// ^---- and that runs the function, and the return val is assign to the interval
@xkeshav
xkeshav / popular.js
Created May 29, 2013 07:16
usage of jsonp first time
Ext.BLANK_IMAGE_URL = './extjs/resources/images/default/s.gif';
MyApp = {};
// get Context of the current location
// First we look for the tag <base> from HTML
// and if tag is not then look for the URL then
// @return parent location of the current file including `/`
MyApp.getContext = function() {
var base = document.getElementsByTagName('base')[0];
@xkeshav
xkeshav / phone.css
Created October 17, 2014 11:45
phone ki gudgudi
ul.scheme {
min-height: 30px;
width: 180px;
margin-left:-30px;
list-style-type: none;
counter-reset: chrome-counter;
}
li {
margin: 2px 0;
@xkeshav
xkeshav / phone.html
Created October 17, 2014 11:47
gudgudi phone ko
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="phone.css">
<title>Giggles</title>
</head>
<body>
<span>Giggle my numer</span>
<ul class="scheme">
<li class="cc1" ></li>
@xkeshav
xkeshav / wish.php
Last active August 29, 2015 14:07
Wish A message create colored Image
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Create Wish Card</title>
<link rel="stylesheet" type="text/css" href="wish.css">
</head>
<body>
<form action="blank.php" method="post" >
<div id="wishBox">
@xkeshav
xkeshav / iterator.php
Created December 16, 2014 13:40
php SPL iterator practice
<?php
$project_dir = '/opt/lampp/htdocs/parixan/data';
$RealPath = realpath($project_dir);
var_dump($RealPath);
$Directory = new RecursiveDirectoryIterator($RealPath, FilesystemIterator::SKIP_DOTS | FilesystemIterator::CURRENT_AS_FILEINFO);
foreach ($Directory as $dir) {
if( $Directory->hasChildren() ) {
$ch = $Directory->getChildren();
// var_dump($ch->key());
@xkeshav
xkeshav / iteratorreturn
Created December 17, 2014 14:48
want to shorten the code
<?php
$loc = '/opt/lampp/archive/data/';
$i = 0;
latestThumb($loc);
function pre($what, $stop = false ){
echo "<pre>";
print_r($what);
echo "</pre>";
if ($stop) die;
}
@xkeshav
xkeshav / final_Iterator.php
Created December 18, 2014 15:22
Iterator file which will retrive latest image of latest folder distributed in timetamp nomeniclature of without scanning complete directory
<?php
// error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
error_reporting(E_ALL ^ E_NOTICE);
class latest {
private $basepath;
private $flags;
public $parentDir;
private $thumbDirName = 'thumbnails';
public $i = 1;