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
# build output dirs | |
BUILD_DIR = build | |
JS_BUILD_DIR = $(BUILD_DIR)/js | |
CSS_BUILD_DIR = $(BUILD_DIR)/css | |
IMG_BUILD_DIR = $(BUILD_DIR)/img | |
VENDOR_BUILD_DIR = $(BUILD_DIR)/vendor | |
TESTS_BUILD_DIR = test/build | |
# sources | |
TEMPLATES = $(shell find app -name '*.hbs') |
<?php | |
// See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html | |
// Start a session (which should use cookies over HTTP only). | |
session_start(); | |
// Create a new CSRF token. | |
if (! isset($_SESSION['csrf_token'])) { | |
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32)); | |
} |
# apigen.neon | |
# | |
# Neon configuration file for the documentation generator "ApiGen". | |
# | |
# This program is free software: you can redistribute it and/or modify it under | |
# the terms of the GNU Lesser General Public License as published by the Free | |
# Software Foundation, either version 3 of the License, or (at your option) any | |
# later version. | |
# | |
# This program is distributed in the hope that it will be useful, but WITHOUT |
#!/bin/bash | |
# | |
# This script backups an OS X system to an external volume, effectively | |
# cloning it. It is based on [0], [1] and [2] for OS X and [3] and [4] for | |
# Linux. One could also use commercial tools like SuperDuper! or Carbon Copy | |
# Cloner. The latter website has an interesting list[5] on what files to | |
# exclude when cloning. | |
# | |
# Exclusions (from CCC[5]), see rsync_excludes_osx.txt | |
# |
<?php | |
# PDO Wrapper, supporting MySQL and Sqlite | |
# Usage: | |
# $db = new db(); | |
# | |
# // table, data | |
# $db->create('users', array( | |
# 'fname' => 'john', | |
# 'lname' => 'doe' | |
# )); |
<?php | |
/** | |
* This class can add WSSecurity authentication support to SOAP clients | |
* implemented with the PHP 5 SOAP extension. | |
* | |
* It extends the PHP 5 SOAP client support to add the necessary XML tags to | |
* the SOAP client requests in order to authenticate on behalf of a given | |
* user with a given password. | |
* |
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
To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.
// This is the basic principle of a minimalistic jQuery based widget system. | |
// Every widget has one root element, with a unique classname prefix. Here I used "w-". | |
// | |
// First, select all those widgets on the page with $('.w-...'). | |
// Second, iterate over all of them and work with them in a local scope. | |
$(function() { | |
$('.w-my-widget').each(function() { | |
// Grab the elements you need. | |
var $root = $(this); | |
var $child = $root.find('.child'); // Always use .find() from $root or a child of $root, to avoid global selectors and potential bugs with one widget affecting another. |
#!/usr/bin/php | |
<?php | |
ini_set('display_errors', 1); | |
error_reporting(E_ALL); | |
$host = '127.0.0.1'; | |
$user = 'root'; | |
$pass = ''; | |
$db = 'test'; |