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 | |
//$letters = array_merge(range(chr(65), chr(90)), range(chr(97), chr(122))); | |
$letters = array_merge(range('a', 'z'), range('A', 'Z')); |
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
//var i, interval_id; | |
//var interval_id; | |
var timeout_id; | |
//i = 0; | |
//interval_id = setInterval(function() { | |
timeout_id = setTimeout(function() { | |
// ++i; |
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
var global = (function () { | |
return this; | |
}()); |
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 | |
echo pathinfo($filename, PATHINFO_EXTENSION); | |
// Where `$filename` can be path to file, only file etc.. | |
// P.S. Of course, it can be `exe` file, just renamed to `virus.exe.jpg`, and it will say that it's `jpg`. |
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 | |
Route::set('cms', function($uri) { | |
$is_empty = empty($uri); | |
$does_exists = class_exists('Controller_' . $uri); | |
if ($is_empty || $does_exists) { | |
$default_route = Route::get('default'); |
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 log(value) { | |
try { | |
console.log(value) | |
} catch(exception) {} | |
} |
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 | |
class Arr extends Kohana_Arr { | |
/** | |
* Checks that keys exists in the array. | |
* Keys, not key (singular), as built-in function does. | |
* | |
* @param array The array of keys | |
* @param array The array to check |
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 remove_diacritics(string) { | |
var diacritics = [ | |
{'base' : 'AA', 'letters' : /[\uA732]/g}, | |
{'base' : 'AE', 'letters' : /[\u00C6\u01FC\u01E2]/g}, | |
{'base' : 'AO', 'letters' : /[\uA734]/g}, | |
{'base' : 'AU', 'letters' : /[\uA736]/g}, | |
{'base' : 'AV', 'letters' : /[\uA738\uA73A]/g}, | |
{'base' : 'AY', 'letters' : /[\uA73C]/g}, | |
{'base' : 'B', 'letters' : /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g}, |
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 | |
while(true) { | |
read('a lot'); | |
write($code); | |
test($everything); | |
read('more'); | |
rewrite($code); | |
read('moaaaar!'); | |
rewrite($better_code); |
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
def fibonacci(n): | |
result = [] | |
x, y = 0, 1 | |
while x < n: | |
result.append(x) | |
x, y = y, y + x |
OlderNewer