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 | |
/** | |
* Generates data with ready-to-edit CSV for magento translation | |
* | |
* A handy tool that generates CSV data for magento theme translation | |
* You can set the $mode to: | |
* a) either write that data to translate.csv at path you specify, | |
* b) or just to dump that data in browser for you to copy and use (default). | |
* In the write mode it appends new data to translate.csv thus you dont |
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 | |
/* fork: making more promising and fail-safe */ | |
class RegionVO { | |
const NSW = 35; | |
const ACT = 37; | |
const VIC = 38; | |
const QLD = 9; | |
const SA = 36; |
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 | |
// PHP fizzbuzz implementation by Jitendra Adhikari | |
// see: http://content.codersdojo.org/code-kata-catalogue/fizz-buzz/ | |
// | |
// if you have shorter/smarter ways out, please fork or comment... | |
echo implode('<br/>', array_map(function($d){ | |
return ($d%15==0)?'fizzbuzz':($d%5==0?'buzz':($d%3==0?'fizz':$d)); | |
}, range(1,100))); |
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 | |
/** | |
* For a given string S, a substring b is said to be its border if S starts and end with b. | |
* Suppose we need length of longest border b that also occurs in S, even after b is trimmed at ends of S. | |
* | |
* This function is aimed at that need. ;) | |
* | |
*/ | |
function maxBorderLen($S){ |
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 | |
/** | |
* Obfuscator - The naive and trivial PHP Code obfuscator | deobfuscator | |
* | |
* generate() Generates a obfuscated string of given code | |
* also gives the chunk value required by work() | |
* work() Reverses the obfuscated string using chunk value given by generate() | |
* to original code and then execute the code and returns response | |
* |
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 | |
/** | |
* A str_ireplace_array for PHP | |
* | |
* Case insensitive version of str_replace_array | |
* See https://wiki.php.net/rfc/cyclic-replace | |
* | |
* @author Jitendra Adhikari | adhocore <jiten.adhikary@gmail.com> | |
* |
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 | |
/** | |
* A helper function expand_array for PHP | |
* | |
* This is actually developed during the real need to develop JSON api | |
* I wanted to have JSON api response spitted properly expanded (with semantic nodes) | |
* But didnot want to do it by playing with arrays (looping, merging n' what not) time and again. | |
* So, After fetching single dimensional array data from database, with keys having | |
* some specific delimeter, this helper would do for me what i want to. |
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 | |
/** | |
* Alternative prime number generator | |
* | |
* Generates first <n> prime numbers using | |
* the prime numbers themselves | |
* | |
* @author Jitendra Adhikari <jiten.adhikary@gmail.com> | |
* |
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
#!/usr/bin/env php | |
<?php | |
/* | |
* A simple php cli tool to traverse movie directories | |
* and download the missing subtitles from subscene.com | |
* (Especially suited for movies from yify torrents) | |
* | |
* Usage: php sub.php /path/to/movies/ | |
* |
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 | |
/* | |
* AJAX file upload with progress bar, as minimal as it can be. | |
* If it doesnot work try latest version of web browser. | |
*/ | |
// big file upload | |
ini_set('memory_limit', '1G'); |
OlderNewer