Permission Cheat Sheet
chown -R www-data:www-data ./
// set the proper owner
find . -type f -exec chmod 644 {} \+
// Recursively set FILE permissions.
Permission Cheat Sheet
chown -R www-data:www-data ./
// set the proper owner
find . -type f -exec chmod 644 {} \+
// Recursively set FILE permissions.
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
<?php | |
function pre_print_r($var){ | |
echo "<pre>"; | |
print_r($var); | |
echo "</pre>"; | |
} | |
function Bigrams($word){ |
We have moved: https://github.com/magnetikonline/linuxmicrosoftievirtualmachines
Due to the popularity of this Gist, and the work in keeping it updated via a Gist, all future updates will take place at the above location. Thanks!
<?php | |
const ✓ = true; | |
const ✕ = false; | |
function ≠($left, $right) { | |
return $left != $right; | |
} | |
function ≅($left, $right) { |
#!/bin/bash | |
# Amazing static site generator | |
# Works for PHP and HTML sites | |
# Assumes web root to be in /web | |
# Dumps the site into a directory named "static" | |
PORT=9999 | |
php -S localhost:$PORT -t web >/dev/null & | |
PID=$! |
<?php | |
class QueryBuilder implements IteratorAggregate | |
{ | |
private $conn; | |
private $parts = array(); | |
public function __construct(Connection $conn) | |
{ |
A very basic regex-based Markdown parser. Supports the
following elements (and can be extended via Slimdown::add_rule()
):
<?php | |
$validator = new Validator(); | |
// Each validation rule is a property of the validator object. | |
$validator->username = function($value, $key, $self) | |
{ | |
if(preg_match('~\W~', $value)) | |
{ | |
return 'Your username must only contain letters and numbers'; |