π
This file contains hidden or 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
| # Gratheon Individual Contributor License Agreement | |
| Thank you for your interest in contributing to Gratheon ("We" or "Us"). | |
| This Contributor License Agreement ("Agreement") documents the rights granted | |
| by contributors to Us. To make this document effective, please sign it and | |
| send it to Us by email at [email protected], or submit it through our | |
| CLA Assistant bot on GitHub. | |
| This is a legally binding document, so please read it carefully before agreeing |
This file contains hidden or 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
| final class Loader{ | |
| // spl_autoload_register([$this, 'loadClass'], true, $prepend); | |
| public function findFile($class){ | |
| //... | |
| /* autoload core without namespace classes */ | |
| if (is_file($location = ROOTPATH . 'application/core/' . $class . EXT)) { | |
| return $location; | |
| } | |
| /* autoload library classes */ | |
| if (is_file($location = ROOTPATH . 'application/libraries/' . $class . EXT)) { |
This file contains hidden or 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
| /* repeat X times to get (table cardinality)^X number of rows in it */ | |
| INSERT IGNORE INTO table_to_flood (a,b) SELECT FLOOR(RAND()*100000), UUID() FROM table_to_flood; |
This file contains hidden or 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
| app.filter['sprintf'] = function () { | |
| return function (str, number) { | |
| function parse(str) { | |
| var args = [].slice.call(arguments, 1), | |
| i = 0; | |
| str = str.replace(/{(\d+)}/g, function (a, number) { | |
| return typeof args[number] != 'undefined' | |
| ? args[number] |
This file contains hidden or 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
| #!/bin/bash | |
| lftp -u login,pass ftp://[email protected] <<EOF | |
| mget -d -O /local/path/to/save/to /remote/path/to/dir/*.BIN | |
| EOF |
This file contains hidden or 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
| cd /var/www/html | |
| git clean -f | |
| git fetch --all | |
| #git pull origin master | |
| git reset --hard origin/master |
This file contains hidden or 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 | |
| /** | |
| * Manages variable as bitfield | |
| */ | |
| class BitField { | |
| private $value; | |
| /** | |
| * @param int $value initial value |
This file contains hidden or 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 php_highlight($source, $classes = true) { | |
| $r1 = $r2 = '##'; | |
| // adds required PHP tags (at least with vers. 5.0.5 this is required) | |
| if (strpos($source, ' ?>') === false) // xml is not THAT important ;-) | |
| { | |
| $source = "<?php " . $source . " ?>"; | |
| $r1 = '#<\?.*?(php)?.*? #s'; | |
| $r2 = '#\?>#s'; | |
| } |
This file contains hidden or 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 htmlDiff($old, $new, $exceptions = array()) { | |
| $ret = ''; | |
| $diff = diff(explode(' ', $old), explode(' ', $new), $exceptions); | |
| foreach ($diff as $k) { | |
| if (is_array($k)) { | |
| $ret .= (!empty($k['d']) ? "<del style='background:#FFFF00;'>" . implode(' ', $k['d']) . "</del> " : '') . (!empty($k['i']) ? "<ins style='background:#00FF00;'>" . implode(' ', $k['i']) . "</ins> " : ''); | |
| } | |
| else { | |
| $ret .= $k . ' '; |
This file contains hidden or 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 num2MultipleRus($int){ | |
| $str=strval($int); | |
| $fin=$str[strlen($str)-1]; | |
| if ($fin==1) return 1; | |
| elseif ($fin>1 && $fin<5) return 2; | |
| elseif ($fin>4) return 3; | |
| } |
NewerOlder