Skip to content

Instantly share code, notes, and snippets.

dukeofgaming / gist:b6b5163450da244ca699
Last active Aug 29, 2015
Reverse proxy in Apache
View gist:b6b5163450da244ca699
NameVirtualHost *:80
<VirtualHost *:80>
ServerName {hostname}
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
dukeofgaming / gist:4cdee61ea2ec2734c4b5
Created Jun 9, 2014
Register autoload of classes in a folder with customizable file naming rule
View gist:4cdee61ea2ec2734c4b5
* @author dukeofgaming
* @param string $path The path where the files with the classes are located (1 class per file always)
* @param function $rule Callback that receives the file name as parameter and returns the class name
function autoloadPath($path,$rule=null){
$absolute_path = dirname(__FILE__).DS.$path;
$files = array_filter(
View gist:9beed5e14d60a0cc2f3d
| |-/response
| |-/tmpl
| | |-default.php
| | |-index.html
| |-view.raw.php
View gist:6d44cb7482a92ed23df2
Taken from
Annotations Cycling [annotations-cycling]
Beep [beep]
Collapse All [collapse-all-folds]
Collapse All Java Code [collapse-all-code-block-folds]
Collapse All Javadoc [collapse-all-javadoc-folds]
Collapse Fold [collapse-fold]
Comment [comment]
Copy [copy-to-clipboard]
View gist:0c1155ca45f8e19b6bb6
#Taken from:
#Here’s part of the help for the hg rm command:
# This only removes files from the current branch,
# not from the entire project history. -A can be
# used to remove only files that have already been
# deleted, -f can be used to force deletion, and
# -Af can be used to remove files from the next
dukeofgaming / gist:d13c49de65750708531c
Created Jun 9, 2014
IE7 display inline-block parse hack
View gist:d13c49de65750708531c
/*Taken from:*/
display: inline-block; /*The way other browsers work correctly*/
zoom: 1; /*Meaningless for other than IE*/
*display: inline; /*Asterisk parse hack, ignored by smarter browsers*/
_height: Xpx; /*IE6 only parse hack, where X is the desired height*/
dukeofgaming / gist:010ddb1dc0877f997c31
Created Jun 9, 2014
Recursively change permissions
View gist:010ddb1dc0877f997c31
#Taken from
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
View gist:8361b752a782826fdb8c
class Object{
private static $singletons = array();
public static function &singleton(){
$class = get_called_class();
if(!array_key_exists($class, self::$singletons)){
self::$singletons[$class] = new $class();
return self::$singletons[$class];
dukeofgaming / gist:76e9752ffe8009a1d0e0
Created Jun 9, 2014
Create bootable USB in WIndows
View gist:76e9752ffe8009a1d0e0
#Create bootable drive, via:
list disk (find the disk number for the removable media)
select disk #
create partition primary
select partition 1
format fs=fat32 quick
dukeofgaming / gist:04e3217bbe195acc9d6d
Created Jun 9, 2014
A shell script to encrypt a file so that only a SSL site's private key can decrypt
View gist:04e3217bbe195acc9d6d
#Taken from
set -e
echo "Encrypting $2 for $1."
# make a directory to store results for this site
mkdir -p results/$1
# get that site's SSL certificate, validating it with the cacert.pem we have