Skip to content

Instantly share code, notes, and snippets.

@dukeofgaming
dukeofgaming / gist:010ddb1dc0877f997c31
Created June 9, 2014 04:11
Recursively change permissions
#Taken from http://movabletripe.com/archive/recursively-chmod-directories-only/
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
@dukeofgaming
dukeofgaming / gist:d13c49de65750708531c
Created June 9, 2014 04:12
IE7 display inline-block parse hack
/*Taken from: http://flipc.blogspot.com/2009/02/damn-ie7-and-inline-block.html*/
div.content_block{
display: inline-block; /*The way other browsers work correctly*/
/*IE7*/
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*/
}
#Taken from:
# http://stevelosh.com/blog/2009/05/what-i-hate-about-mercurial/#hg-rm-is-a-confusing-mess
#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
dukeofgaming / gist:6d44cb7482a92ed23df2
Created June 9, 2014 04:12
Netbeans Macro Commands
Taken from http://six.vh.paanjoyhost.cn/?p=288:
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]
<?php
/*
/com_mycomponent
|-/views
| |-/response
| |-/tmpl
| | |-default.php
| | |-index.html
| |-view.raw.php
*/
@dukeofgaming
dukeofgaming / gist:4cdee61ea2ec2734c4b5
Created June 9, 2014 04:17
Register autoload of classes in a folder with customizable file naming rule
<?php
/**
* @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(
scandir($absolute_path),
@dukeofgaming
dukeofgaming / gist:b6b5163450da244ca699
Last active August 29, 2015 14:02
Reverse proxy in Apache
#/etc/httpd/conf/extra/httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName {hostname}
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>