Skip to content

Instantly share code, notes, and snippets.

View jesse1981's full-sized avatar
💭
Nerding

Jesse Bryant jesse1981

💭
Nerding
View GitHub Profile
@TheNetJedi
TheNetJedi / ExportLambdaFunctions.sh
Last active November 8, 2023 15:44
Bash script to download all your Lambda functions.
#!/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
@cillosis
cillosis / gist:6370801
Created August 28, 2013 20:27
Git Hook - PHP Syntax Checker (pre-commit)
echo ""
echo "******************************"
echo "** Running PHP Syntax Check **"
echo "******************************"
if [ -z "$PHP_BIN" ]
then
PHP_BIN=php
fi
@dai-shi
dai-shi / facebook-node-sdk-sample.js
Created April 22, 2013 13:33
A sample code to get an application access token using Thuzi / facebook-node-sdk.
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;
<?php
$_PUT = array();
parse_str(file_get_contents('php://input'), $_PUT);
@jesse1981
jesse1981 / sortCustom.php
Last active February 17, 2017 03:25
Function to sort an array, in this example, used in conjunction with getCustomTypeData.
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]);
@lokimeyburg
lokimeyburg / closest_descendent.js
Last active December 16, 2015 08:49
$(element).closest_descendent('something') Similar to jquery .closest() but traversing decedents.
$.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