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
| alias ls='ls -lah' | |
| alias ld='ls -d .*' | |
| alias ez='exec zsh' | |
| alias tf="sftp mike@tick" | |
| alias .2='cd ../../' | |
| alias .3='cd ../../../' | |
| alias .4='cd ../../../../' | |
| alias .5='cd ../../../../../' | |
| alias h='history' | |
| alias j='jobs -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
| FILE SPACING: | |
| # double space a file | |
| sed G | |
| # double space a file which already has blank lines in it. Output file | |
| # should contain no more than one blank line between lines of text. | |
| sed '/^$/d;G' | |
| # triple space a file |
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
| $!/bin/bash | |
| find . -type d -print0 | while read -d '' -r dir; do | |
| files=("$dir"/*) | |
| printf "%5d files in directory %s\n" "${#files[@]}" "$dir" | |
| done |
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
| #single page redirects | |
| Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html | |
| Redirect 301 /oldpage2.html http://www.yoursite.com/folder/ | |
| #entire site redirect | |
| Redirect 301 / http://newsite.com/ | |
| #automatically append or prepend files | |
| php_value auto_prepend_file "/real/path/to/file/functions.php" | |
| php_value auto_append_file "/real/path/to/file/footer.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
| <?php | |
| //useful in combination with scandir() function and a foreach loop | |
| if (file_exists('test.xml') { | |
| $xml = simplexml_load_file('test.xml'); | |
| $node1 = $xml->node1; | |
| $node2 = $xml->node1->node2; | |
| $n2attr = $node2['someAttr']; | |
| } |
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
| <?php | |
| $email = $_POST('email'): | |
| $number = $_POST('number'); | |
| $d = $_POST('day'); | |
| $m = $_POST('month'); | |
| $y = $_POST('year'); | |
| $answer = $_POST('answer'); | |
| //returns true if the email is valid |
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
| <?php | |
| /** | |
| * util.php | |
| * | |
| * util.php is a library of helper functions for common tasks such as | |
| * formatting bytes as a string or displaying a date in terms of how long ago | |
| * it was in human readable terms (E.g. 4 minutes ago). The library is entirely | |
| * contained within a single file and hosts no dependencies. The library is | |
| * designed to avoid any possible conflicts. | |
| * |
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
| <?php | |
| //check http://en.wikipedia.org/wiki/List_of_SMS_gateways for gateways and compile into this function as needed | |
| mail("[email protected]", "", "Your packaged has arrived!", "From: David Walsh <[email protected]>\r\n"); | |
| ?> |
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
| <?php | |
| function clean($value) { | |
| // If magic quotes not turned on add slashes. | |
| if(!get_magic_quotes_gpc()) | |
| // Adds the slashes. | |
| { $value = addslashes($value); } | |
| // Strip any tags from the value. |