This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract Files ( https://wiki.archlinux.org/index.php/Bashrc_helpers ) | |
extract() { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xvjf $1 ;; | |
*.tar.gz) tar xvzf $1 ;; | |
*.tar.xz) tar xvJf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_tag( $tag, $xml ) { | |
$tag = preg_quote($tag); | |
preg_match_all('{<'.$tag.'[^>]*>(.*?)</'.$tag.'>.'}', | |
$xml, | |
$matches, | |
PREG_PATTERN_ORDER); | |
return $matches[1]; | |
} | |
// source http://www.catswhocode.com/blog/15-php-regular-expressions-for-web-developers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -pi -e 's/find/replace/g' *.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#myTable > tbody:last').append('<tr>...</tr><tr>...</tr>'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SOURCE: http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/ | |
+--------+------------+-------+ | |
| type | variety | price | | |
+--------+------------+-------+ | |
| apple | gala | 2.79 | | |
| apple | fuji | 0.24 | | |
| apple | limbertwig | 2.87 | | |
| orange | valencia | 3.59 | | |
| orange | navel | 9.36 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.imageReplace { | |
border:0; | |
font: 0/0 a; | |
text-shadow:none; | |
background-color:transparent; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# IF newdomain AND not subdir THEN redirect to subdir | |
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com | |
RewriteCond %{REQUEST_URI} !^/domain | |
Rewriterule ^(.*)$ /domain/$1 [L] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deny from all | |
Order deny,allow | |
AuthType Basic | |
AuthName “Restricted” | |
AuthUserFile /path_to_password/.htpasswd | |
Require valid-user | |
Allow from 192.168.1.10 | |
Satisfy Any |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Non-www to www | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L] | |
www to non-www | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^/(.*)$ http://%1/$1 [R=301,L] |
OlderNewer