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
parseQueryParams = function (query) { | |
var re = /([^&=]+)=?([^&]*)/g; | |
var decodeRE = /\+/g; | |
var decode = function (str) { | |
return decodeURIComponent(str.replace(decodeRE, " ")); | |
}; | |
var params = {}, e; | |
while (e = re.exec(query)) { | |
var k = decode(e[1]), v = decode(e[2]); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="UTF-8"> | |
<title>Drawing Tools</title> | |
<script type="text/javascript" | |
src="http://maps.google.com/maps/api/js?sensor=false&libraries=drawing"></script> | |
<style type="text/css"> | |
#map, html, body { |
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
// Javascript | |
<script>alert('Test');<script> | |
// PHP | |
<?php echo 'Test echo 1'; ?> | |
<?= 'Test echo 2' ?> | |
<?php include('non_existent_file'); ?> | |
<?php require('non_existent_file'); ?> | |
// HTML |
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 | |
/** | |
* Get the year the file was uploaded relative to its location in wp-content/uploads/ | |
* | |
* @param string Can be a URL or an absolute path to the file | |
* | |
* @return string Returns the year as a string, but can easily be cast to an int | |
*/ | |
function get_uploaded_year($uri) |
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
########################################################### | |
# Determine the operating system from the command line | |
# | |
# NB: Only handles Ubuntu, CentOS, and MacOS so far | |
########################################################### | |
function which_os() { | |
# Setup an OSNAME variable to capture the OS's name | |
OSNAME='Unknown'; | |
# If there is an /etc/os-release file, use that |
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 a view under the controller's view namespace if one is set | |
* | |
* @param string $template | |
* @param array $data | |
* @param array $mergeData | |
* | |
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
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 | |
/** | |
* Filter an ACF field to add Markdown support with Jetpack | |
* | |
* @link https://www.advancedcustomfields.com/resources/acfload_value/ | |
*/ | |
add_filter('acf/load_value/type=textarea', function ($content) { | |
return wpautop( | |
WPCom_Markdown::get_instance()->transform($content) |
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 | |
// [...]wp-config.php contents[...] | |
define('DEBUGGING_ON', false); | |
define('WP_DEBUG', DEBUGGING_ON); | |
define('WP_DEBUG_LOG', DEBUGGING_ON); | |
define('WP_DEBUG_DISPLAY', DEBUGGING_ON); | |
@ini_set('display_errors', DEBUGGING_ON); |
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 | |
function debug_step($message = '') | |
{ | |
if (isset($_GET['debug'])) { | |
/** | |
* Count how many times the debug step has been called | |
* @var integer | |
*/ | |
static $i = 1; |
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 | |
/** | |
* Get the directory's modified time based on when the last file within it was updated | |
* | |
* @param string Which directory to look within | |
* @param string A regular expression to match files | |
* | |
* @return int The timestamp | |
*/ |
NewerOlder