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 | |
| // Our custom error handler | |
| function nettuts_error_handler($number, $message, $file, $line, $vars){ | |
| $email = " | |
| <p>An error ($number) occurred on line | |
| <strong>$line</strong> and in the <strong>file: $file.</strong> | |
| <p> $message </p>"; | |
| $email .= "<pre>" . print_r($vars, 1) . "</pre>"; |
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 getTweets($hash_tag) { | |
| $url = 'http://search.twitter.com/search.atom?q='.urlencode($hash_tag) ; | |
| echo "<p>Connecting to <strong>$url</strong> ...</p>"; | |
| $ch = curl_init($url); | |
| curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE); | |
| $xml = curl_exec ($ch); | |
| curl_close ($ch); | |
| //If you want to see the response from Twitter, uncomment this next part out: |
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 getDistanceBetweenPointsNew($latitude1, $longitude1, $latitude2, $longitude2) { | |
| $theta = $longitude1 - $longitude2; | |
| $miles = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) + (cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta))); | |
| $miles = acos($miles); | |
| $miles = rad2deg($miles); | |
| $miles = $miles * 60 * 1.1515; | |
| $feet = $miles * 5280; | |
| $yards = $feet / 3; |
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 cleanInput($input) { | |
| $search = array( | |
| '@<script[^>]*?>.*?</script>@si', // Strip out javascript | |
| '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags | |
| '@<style[^>]*?>.*?</style>@siU', // Strip style tags properly | |
| '@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments | |
| ); | |
| $output = preg_replace($search, '', $input); |
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
| CREATE DATABASE dbname DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; | |
| GRANT ALL PRIVILEGES ON dbname>.* TO 'new_user'@'localhost' | |
| IDENTIFIED BY 'pswd' WITH GRANT OPTION; |
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 | |
| class Demo extends ParentClass | |
| { | |
| function demoParent(...$arguments) | |
| { | |
| // some overrided logic | |
| return (new \ReflectionClass(get_class($this))) | |
| ->getParentClass() | |
| ->getMethod(__METHOD__) |
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
| rm -rf `find . -type d -name .svn` |
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
| find ./ -type f -exec chmod 644 {} \; | |
| find ./ -type d -exec chmod 755 {} \; |
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
| yum remove selinux-policy evolution -y; | |
| wget http://archive.fedoraproject.org/pub/archive/fedora/linux/releases/12/Everything/x86_64/os/Packages/mysql-gui-common-5.0r14-1.fc12.x86_64.rpm http://archive.fedoraproject.org/pub/archive/fedora/linux/releases/12/Everything/x86_64/os/Packages/mysql-gui-tools-5.0r14-1.fc12.x86_64.rpm http://archive.fedoraproject.org/pub/archive/fedora/linux/releases/12/Everything/x86_64/os/Packages/mysql-query-browser-5.0r14-1.fc12.x86_64.rpm http://archive.fedoraproject.org/pub/archive/fedora/linux/releases/12/Everything/x86_64/os/Packages/mysql-administrator-5.0r14-1.fc12.x86_64.rpm; | |
| rpm -ihv ./*.rpm | |
| yum install libXv-1.0.5-1.fc13.i686 libXScrnSaver-1.2.0-1.fc12.i686 qt-4.6.3-8.fc13.i686 qt-x11-4.6.3-8.fc13.i686 -y; | |
| yum install skype -y; | |
| yum install cowsay -y; | |
| yum install mc -y; |
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
| SELECT * FROM auto4.model WHERE `name` like '%\n'; | |
| UPDATE auto3.model m SET name=REPLACE(name, '\n', '') |