Skip to content

Instantly share code, notes, and snippets.

Permission Cheat Sheet

   chown -R www-data:www-data ./
   // set the proper owner
   find . -type f -exec chmod 644 {} \+
   // Recursively set FILE permissions.
@willurd
willurd / web-servers.md
Last active May 4, 2025 11:11
Big list of http static server one-liners

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.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
<?php
function pre_print_r($var){
echo "<pre>";
print_r($var);
echo "</pre>";
}
function Bigrams($word){
@magnetikonline
magnetikonline / README.md
Last active February 7, 2025 07:27
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@ircmaxell
ircmaxell / equality.php
Last active April 19, 2019 13:52
Unicode Set Functions
<?php
const ✓ = true;
const ✕ = false;
function ≠($left, $right) {
return $left != $right;
}
function ≅($left, $right) {
@igorw
igorw / build.sh
Created December 11, 2012 19:40
Static Site Generator
#!/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=$!
@xeoncross
xeoncross / README.md
Created August 15, 2012 16:13 — forked from jbroadway/Slimdown.md
Slimdown - A simple regex-based Markdown parser.

Slimdown

A very basic regex-based Markdown parser. Supports the following elements (and can be extended via Slimdown::add_rule()):

  • Headers
  • Links
  • Bold
  • Emphasis
  • Deletions
<?php
class QueryBuilder implements IteratorAggregate
{
private $conn;
private $parts = array();
public function __construct(Connection $conn)
{
@jbroadway
jbroadway / Slimdown.md
Last active February 20, 2025 13:00
Slimdown - A simple regex-based Markdown parser.
@xeoncross
xeoncross / index.php
Created May 22, 2012 21:08
Validator Class
<?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';