#Post OpenSUSE / Gnome Install List
- add keys
- Setup proxy if necessary
- Add packman repo
- Remove OO, Music and Music from Favorites
| <?php | |
| /** | |
| * Adding Cache Headers and ETag to example: http://sperling.com/examples/pcss/ | |
| */ | |
| class PHPStyle | |
| { | |
| public static function setHeaders($filename="style.css",$type="text/css") |
| <?php | |
| $url="http://thehilolowdown.blogspot.com/feeds/posts/default?max-results=1"; | |
| $_c = curl_init(); | |
| curl_setopt($_c, CURLOPT_URL, $url); | |
| curl_setopt($_c, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($_c, CURLOPT_TIMEOUT, 3); | |
| //curl_setopt($_c, CURLOPT_USERPWD, "$_user:$_pass"); | |
| //curl_setopt($_c, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); | |
| $_data = curl_exec($_c); | |
| $response= curl_getinfo($_c); |
| <?php | |
| function SendNews($to,$subject,$emailText,$emailHtml) { | |
| global $fromName,$fromEmail,$MoPixList; | |
| //TEXT FORMAT | |
| //Plain Text Boundary of Email Message for Non-HTML browsers | |
| $message=" | |
| --==Multipart_Boundary_xc75j85x |
| <?php | |
| /** | |
| * Use whatever method you like to grab your HTML string. We'll use a site I mentioned in this post | |
| * as an example. | |
| */ | |
| $remote_site_data = file_get_contents('http://www.10stripe.com/articles/automatically-generate-table-of-contents-php.php'); | |
| $dom_document = new DomDocument(); | |
| @$dom_document->loadHTML($remote_site_data); | |
| $headers = $dom_document->getElementsByTagName('h2'); | |
| foreach ($headers as $header) { |
| <?php | |
| /** | |
| * http://philsturgeon.uk/blog/2013/09/named-parameters-in-php | |
| */ | |
| public function getFriends($args) | |
| { | |
| $args += [ | |
| 'user_id' => null, | |
| 'screen_name' => null, | |
| 'cursor' => -1, |
| <?php | |
| /** | |
| * Check for Valid Date Entry | |
| */ | |
| public function validDateString($datestring) | |
| { | |
| if(!preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$datestring) | |
| || date("Y-m-d", strtotime($datestring))!=$datestring) | |
| return false; | |
| else |
| /**Check Date Input on Server**/ | |
| $date_regex = '/^(19|20)\d\d[\-\/.](0[1-9]|1[012])[\-\/.](0[1-9]|[12][0-9]|3[01])$/'; | |
| // Check date input | |
| if(isset($_POST['start'])) { | |
| if (preg_match($date_regex,$_POST['start']) && preg_match($date_regex,$_POST['end'])) { | |
| $_start = $_POST['start']; | |
| $_end = $_POST['end']; | |
| } else { | |
| die("Invalid Date Format"); | |
| } |
| // | |
| // because I like to Captilize Id's | |
| // <span='Name'><label><input name='name'/></label></span | |
| // | |
| var TSD = {};// my object | |
| TSD.ucword = function(string) { | |
| return string.charAt(0).toUpperCase() + string.slice(1); | |
| } |
| "A wise coder once said: “When I commit my code, only God and I know what it does. After a while, only God knows." | |
| Quoted by Remi Woler http://www.sitepoint.com/preventing-code-rot-101-unit-testing/ |