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
var getAssetPath = function getAssetPath(packageName, assetPath) { | |
assetPath = assetPath || ''; | |
var meteor_root = Npm.require('fs').realpathSync(process.cwd() + '/../'); | |
var assets_folder = meteor_root + '/server/assets/packages/'+packageName.replace(':','_')+'/'+assetPath; | |
return assets_folder; | |
}; |
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 Cache { | |
private $cache = []; | |
public function functionCall($callable, $params = []){ | |
$hash = serialize([$callable, $params]); | |
if(!isset($this->cache[$hash])){ | |
$this->cache[$hash] = call_user_func_array($callable, $params); | |
echo "Function called!\t"; | |
}else{ |
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 | |
/** | |
* SQL Like operator in PHP. | |
* Returns TRUE if match else FALSE. | |
* @param string $pattern | |
* @param string $subject | |
* @return bool | |
*/ | |
function like_match($pattern, $subject) | |
{ |
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 | |
/** | |
* A class that simulates Enums behaviour | |
* <code> | |
* class Season extends Enum{ | |
* const Spring = 0; | |
* const Summer = 1; | |
* const Autumn = 2; | |
* const Winter = 3; | |
* } |
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 | |
/** | |
* Helper function that generates tests for the | |
* schema and data of a specific object. | |
* | |
* NOTE: | |
* IF THE DATA IN THE OBJECT IS WRONG, THE GENERATED | |
* TESTS WILL BE WRONG. | |
* It is still your responsibility to make sure your |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
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
/** | |
* Runs an array of promises one after another instead of in parallel | |
* | |
* @param array | |
* @param callback | |
* | |
* @returns {*} | |
*/ | |
function sequential(array, callback) { | |
var result = []; |
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
#!/usr/local/bin/php | |
<?php | |
$expectedTokens = [ | |
'die' => 'T_EXIT', | |
'exit' => 'T_EXIT', | |
'var_dump' => 'T_STRING' | |
]; | |
function extractDieData($fh) |
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
DELETE cu1 FROM db.client_users cu1, db.client_users cu2 | |
WHERE cu1.id > cu2.id | |
AND cu1.client_user_id = cu2.client_user_id | |
AND cu1.client_id = cu2.client_id | |
AND cu1.owner_type = cu2.owner_type | |
AND cu1.id <> cu2.id; |
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
console.log( | |
"%c %c %c \n" + | |
"%c %c %c %c \n" + | |
"%c %c \n" + | |
"%c %c %c %c \n" + | |
"%c %c %c \n" + | |
"%c \n" + | |
"%c \n" + | |
"%c \n" + | |
"%c \n", |