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 makeNonce(length) { | |
let nonce = ""; | |
let possible = "0123456789"; | |
for (let i = 0; i < length; i++) { | |
nonce += possible.charAt(Math.floor(Math.random() * possible.length)); | |
} | |
return nonce; | |
} |
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 | |
// Return all meta for a single post in a flat array. | |
function get_all_post_meta($post_id) { | |
// Get all the meta values. | |
$meta = get_post_meta($post_id, ''); | |
// We only need the first item - return a flat array. | |
return array_map(function($item) { | |
return $item[0]; | |
}, $meta); |
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 | |
if (!function_exists('dd')) { | |
function dd($data) | |
{ | |
ini_set("highlight.comment", "#969896; font-style: italic"); | |
ini_set("highlight.default", "#FFFFFF"); | |
ini_set("highlight.html", "#D16568"); | |
ini_set("highlight.keyword", "#7FA3BC; font-weight: bold"); | |
ini_set("highlight.string", "#F2C47E"); |
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 trimArrayKeys($originalArray) { | |
$strip_keys = ['banned_key']; | |
return array_diff_key($originalArray, array_flip($strip_keys)); | |
} |
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
## | |
# You should look at the following URL's in order to grasp a solid understanding | |
# of Nginx configuration files in order to fully unleash the power of Nginx. | |
# http://wiki.nginx.org/Pitfalls | |
# http://wiki.nginx.org/QuickStart | |
# http://wiki.nginx.org/Configuration | |
# | |
# Generally, you will want to move this file somewhere, and start with a clean | |
# file but keep this around for reference. Or just disable in sites-enabled. | |
# |
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
server { | |
listen 80; | |
listen [::]:80 ipv6only=on; | |
# Log files for Debugging | |
access_log /var/log/nginx/laravel-access.log; | |
error_log /var/log/nginx/laravel-error.log; | |
# Webroot Directory for Laravel project | |
root /var/www/laravel/public; |
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'; | |
console.log('Getting JSON...'); | |
exports.handler = async (event) => { | |
let templateId = 1; | |
let responseCode = 200; | |
console.log('request:' + JSON.stringify(event)); | |
if (event.queryStringParameters && event.queryStringParameters.templateId) { |