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
| getFiles($directory, $recursive = false, $pattern = NULL, $absolute = false) { | |
| $return = array(); | |
| $iterator = ($recursive === false) ? new \FilesystemIterator($directory, \FilesystemIterator::SKIP_DOTS) : new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory), \RecursiveIteratorIterator::SELF_FIRST); | |
| $iterator = ($pattern !== NULL) ? new \RegexIterator($iterator, '/' . $pattern . '/i') : $iterator; | |
| $directory = preg_quote($directory . '/', '/'); | |
| foreach($iterator as $path) { | |
| if($path->isFile() === true) { | |
| $return[] = ($absolute !== false) ? $path->getPathname() : preg_replace('/^' . $directory . '/', '', $path->getPathname()); | |
| } |
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
| AddType application/json .shrunk | |
| AddType application/javascript .shrunk.jsonp | |
| <IfModule mod_rewrite.c> | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteRule ^(.+.q(?:[0-9]+).shrunk)$ shrinkimage.php?file=$1 [QSA,L] | |
| RewriteRule ^(.+.q(?:[0-9]+).shrunk.jsonp)$ shrinkimage.php?file=$1&jsonp=1 [QSA,L] | |
| </IfModule> | |
| <Ifmodule mod_deflate.c> |
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 | |
| if [ ! $(whoami) = 'root' ]; then | |
| echo "This script should be run as root." > /dev/stderr | |
| exit 1 | |
| fi | |
| if [ ! -f "/opt/local/bin/port" ] ; then | |
| echo "This script requires macports to be installed" | |
| exit 1 |
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 | |
| if [ ! $(whoami) = 'root' ]; then | |
| echo "This script should be run as root." > /dev/stderr | |
| exit 1 | |
| fi | |
| spinner() | |
| { | |
| local pid=$! |
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() { | |
| 'use strict'; | |
| function definition(demand, provide, path, isObject) { | |
| var settings; | |
| function onPostConfigure(options) { | |
| settings = isObject(options) ? options : {}; | |
| } | |
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 | |
| class Modify { | |
| private static $instance = NULL; | |
| protected static $mbstring = NULL; | |
| protected static $iconv = NULL; | |
| protected static $characterset = NULL; | |
| /* | |
| protected static $diacritics = array( | |
| 'À'=>'A','Á'=>'A','Â'=>'A','Ã'=>'A','Å'=>'A','Ä'=>'A','Æ'=>'AE', |
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
| 'use strict'; | |
| class CustomError extends Error { | |
| constructor(...args) { | |
| super(...args); | |
| Object.defineProperty(this, 'name', { value: this.constructor.name }); | |
| // This is for Node only... | |
| Error.captureStackTrace(this, this.constructor); | |
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
| class MyFirstClass { | |
| constructor() { | |
| return new Promise(async (resolve, reject) => { | |
| try { | |
| resolve(this); | |
| } catch(error) { | |
| reject(error); | |
| } | |
| }); | |
| } |
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
| class Child extends Component { | |
| static defaultProps = { | |
| onRef: undefined | |
| } | |
| componentDidMount() { | |
| this.props.onRef(this); | |
| } | |
| componentWillUnmount() { |
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
| self.addEventListener('install', function(event) { | |
| return self.skipWaiting(); | |
| }); | |
| self.addEventListener('activate', function(event) { | |
| return event.waitUntil(self.clients.claim()); | |
| }); |