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 Objcontains = function(oldO, newO) { | |
var changed = {}; | |
_.each(newO, function(v, i) { | |
if (oldO[i] != undefined) { | |
if (Array.isArray(v)) { | |
changed[i] = _.difference(v, oldO[i]); | |
} else if (typeof v == 'object') { | |
changed[i] = Objcontains(oldO[i], v); | |
} else { | |
if (oldO != undefined && (oldO[i] == undefined || oldO[i] != v)) { |
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
public static function getStatus(){ | |
$status = null; | |
$handle = fsockopen(gearman_server, gearman_port,$errorNumber,$errorString,30); | |
if($handle!=null){ | |
fwrite($handle,"status\n"); | |
while (!feof($handle)) { | |
$line = fgets($handle, 4096); | |
if( $line==".\n"){ | |
break; |
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 getShortenForm($url){ | |
$ignore = array('I','0','O','1'); | |
$alphabet = array_merge(range('A','Z'),array_map(function($i){return (string)$i;},range(0,9))); | |
$parsing_url = md5($url.'-'.rand().'-'.rand().'-'.microtime(true)); | |
$parsing_url = substr($parsing_url, strlen($parsing_url)/2-1,strlen($parsing_url)).substr($parsing_url, 0,strlen($parsing_url)/2); | |
$shorten = strtoupper(substr(base_convert($parsing_url,16, 36),0,self::MAX_CHARS)); | |
$cleaned = array_diff($alphabet, $ignore); | |
$cleaned = array_values($cleaned); | |
$replaceble = array(); | |
array_walk($ignore,function($val,$key) use (&$replaceble,$cleaned){ |
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
/bootstrap/compiled.php | |
/vendor | |
composer.phar | |
composer.lock | |
.env.*.php | |
.env.php | |
.DS_Store | |
Thumbs.db | |
/app/storage/cache | |
/app/storage/logs |
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
server { | |
server_name domain.xyz; | |
location / { | |
proxy_pass http://localhost:3333; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; |
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
[program:project] | |
command=node server/index.js | |
autostart=true | |
directory=/home/www/project | |
autorestart=true | |
stderr_logfile=/var/log/project.err.log | |
stdout_logfile=/var/log/project.out.log |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "VisualEditor0", | |
"Effect": "Allow", | |
"Action": [ | |
"s3:PutObject", | |
"s3:GetObject" | |
], |
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
{ | |
"categories":[ | |
{ | |
"from":"0001", | |
"to":1499, | |
"category":"Agricultural Services" | |
}, | |
{ | |
"from":1500, | |
"to":2999, |
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
# creates a new invalidation and waits until it's complete | |
DISTRIBUTION_ID=xxx | |
INVALIDATION_ID=$(aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/" | jq -r '.Invalidation.Id') | |
until [[ $(aws cloudfront get-invalidation --id $INVALIDATION_ID --distribution-id $DISTRIBUTION_ID | jq -r '.Invalidation.Status') = "Completed" ]] | |
do | |
echo "Waiting for the invalidation to complete" | |
sleep 3 | |
done |