Regex ^ and $
Personal notes
$ and ^ match the end of the string as a whole, not necessarily the end of a line. To match the end of lines, use the enhanced line anchor match mode /m.
^$, matches the start of a line, immediately followed by the end of a line. ^$ does not match characters, it matches a position.
Use PHP & YQL to find out what city a zip is from
<?php
$_GET['zip'] = '16601';
//Validate the zip
$zip = str_replace(" ", "", $_GET['zip']); //remove white-space
if (!ctype_alnum($zip)) {
die("Enter alpha-numeric numbers only");
}
if (strlen($zip) > 7) {
die("Zip query is too long");
}
$zip = urlencode($zip);
$url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20google.geocoding%20where%20q%3D%22$zip%22&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
$xml = file_get_contents($url);
$location = new SimpleXMLElement($xml);
//var_dump($xml);
//var_dump($location);
$status = (string)$location->results->json->Status->code;
if ($status !== '200') {
die('Could not get location');
}
$country = (string)$location->results->json->Placemark->AddressDetails->Country->CountryName;
switch ($country) {
case "USA":
case "Canada":
echo (string)$location->results->json->Placemark->address;
break;
default:
echo 'false';
}
Site5 hosting is great
I started hosting with Site5 for my production sites and I love it. I’m using VPS4, which gives you 4 processors and 2gb of ram. I chose the dallas option.The total is about $124.00 a month. Support was a main selling point for me. I tested Site5′s support system pretty well, and usually within a few hours someone always fixed my problems. I tested site5 for about a month before I made the great leap from my previous VPS (PowerVPS).
Site5 also upgraded me from their lowest VPS wich is $53 for 756mb of ram, to the level 4 within 2 hours (which is good).
yui compressor example
yui-compressor –type css /home/batman/Dropbox/production/alpha/httpdocs/css/bd.css -o combo.css –charset utf-8
Print Meida CSS – Check List
Print Friendly Page
(dark / black backgrounds won’t print)
font-size:100%;
serif-font
avoid floating
colors to black
display none for pages you don’t to show
css code
<link rel=”stylesheet” href=”css/master.css” type=”text/css” media=”screen”>
<link rel=”stylesheet” href=”css/print.css” type=”text/css” media=”print”>
You can combine these two into one
@media screen {} //anything between these brackets is screen
@media print {} //nest the print rules
Finished Site Check List – CSS
Finished Site Check List
CSS Usage – FireFox Addon (Detects Unused Css Rules)
Validate CSS
Validate HTML
Increase Font Size
Test WithOut Images – (White Text On White Background)
Turn Off CSS
Cross Browser Testing
Test Agreed Devices
http://www.browsercam.com
https://browserlab.adobe.com
Measure Page Load
http://www.webpagetest.org – specifically tests IE
http://tools.pingdom.com/fpt/
FireFox
Y!SLOW
Reduce Image Sizes
Add width and height to inline images (Improves Speed.. but presentational?)
TypeKit.Com —– I’m using it now
http://typekit.com/fonts
Type kit allows you to use @font-face in your webpages without fear of font licensing. The fonts I used in my last project came across the wire at 50k, which is much smaller than using images. I signed up for the $50.00 a year package.