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
$.fn.closest_descendent = function(filter) { | |
var $found = $(), | |
$currentSet = this; // Current place | |
while ($currentSet.length) { | |
$found = $currentSet.filter(filter); | |
if ($found.length) break; // At least one match: break loop | |
// Get all children of the current set | |
$currentSet = $currentSet.children(); | |
} | |
return $found.first(); // Return first match of the collection |
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 sortCustom($data,$field,$datatype="text",$direction="desc") { | |
$cycle = false; | |
for ($i=0;$i<(count($data)-1);$i++) { | |
switch($datatype) { | |
case "date": | |
$arrDate1 = explode("-", $data[$i][$field]); | |
$mkDate1 = mktime(1,1,1,$arrDate1[1],$arrDate1[2],$arrDate1[0]); | |
$arrDate2 = explode("-", $data[$i+1][$field]); | |
$mkDate2 = mktime(1,1,1,$arrDate2[1],$arrDate2[2],$arrDate2[0]); |
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 | |
$_PUT = array(); | |
parse_str(file_get_contents('php://input'), $_PUT); |
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 FB = require('fb'); | |
FB.api('oauth/access_token', { | |
client_id: process.env.FACEBOOK_APP_ID, | |
client_secret: process.env.FACEBOOK_SECRET, | |
grant_type: 'client_credentials' | |
}, function(res) { | |
if (!res || res.error) { | |
console.log('error occurred when getting access token:', res && res.error); | |
return; |
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
echo "" | |
echo "******************************" | |
echo "** Running PHP Syntax Check **" | |
echo "******************************" | |
if [ -z "$PHP_BIN" ] | |
then | |
PHP_BIN=php | |
fi |
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
#!/usr/bin/env bash | |
#You need to have aws-cli installed and configured | |
#Credits to Reddit user u/aa93 for the suggestions | |
mkdir code | |
aws lambda list-functions | \ | |
grep FunctionName | \ | |
cut -d '"' -f4 | \ | |
while read -r name; do | |
aws lambda get-function --function-name $name | tail -n 3 | egrep -o 'https?://[^ ]+' | sed 's/"//' | xargs wget -O ./code/$name.zip |