The setup installs the following software:
- Nginx
- MySQL
- PHP
- Node
- Composer
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Which Browser?</title> | |
</head> | |
<body> | |
<p>You are using <span id="browser"></span> <span id="version"></span> on <span id="os"></span></p> | |
<script type="text/javascript" src="browserdetect.js"></script> | |
<script type="text/javascript"> |
<?php | |
// Based on <https://github.com/mecha-cms/extend.minify> | |
define('MINIFY_STRING', '"(?:[^"\\\]|\\\.)*"|\'(?:[^\'\\\]|\\\.)*\''); | |
define('MINIFY_COMMENT_CSS', '/\*[\s\S]*?\*/'); | |
define('MINIFY_COMMENT_HTML', '<!\-{2}[\s\S]*?\-{2}>'); | |
define('MINIFY_COMMENT_JS', '//[^\n]*'); | |
define('MINIFY_PATTERN_JS', '\b/[^\n]+?/[gimuy]*\b'); | |
define('MINIFY_HTML', '<[!/]?[a-zA-Z\d:.-]+[\s\S]*?>'); |
Lsyncd is a tool used to keep a source directory in sync with other local or remote directories. It is a solution suited keeping directories in sync by batch processing changes over to the synced directories.
So the generic use case is to keep a source directory in sync with one or more local and remote directories.
<?php | |
// This code is based in Mathew Horne blog post: https://matthewhorne.me/defer-async-wordpress-scripts/ | |
//function to add async attribute | |
function add_async_attribute( $tag, $handle ) { | |
$scripts_to_async = array( 'my-js-handle-async', 'another-handle-async' ); | |
//check if this script is in the array | |
if ( in_array( $handle, $scripts_to_async ) ) { | |
//return with async | |
return str_replace( ' src', ' async="async" src', $tag ); |