By jthomas on July 14, 2009 at 10:10 am.
Filed under: Languages, PHP, Quick Tips and Tricks
Many PHP frameworks make use of routing through one master file, typically index.php. It is easy enough, however, to write that portion of the URL out, thus achieving a more svelte and sexy address bar in the process.
To do so just create an .htaccess file in your app’s root directory (likely next to the index.php in question) if one doesn’t already exist (OS X folks may have to use Terminal to work with .htaccess as it will be invisible). Then drop these rules into place:
<ifmodule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</ifmodule>
<ifmodule !mod_rewrite.c>
ErrorDocument 404 /index.php
</ifmodule>
Some frameworks require that you configure the base URL of the system, so don’t forget to do that too or your app will start acting wacky after this is in place.
By jthomas on July 1, 2009 at 11:27 am.
Filed under: Quick Tips and Tricks
Something we’ve noticed and annoyed by for years now is iChat (and likely other instant message clients) tends to throw up when you try to send code through them when connected through the AIM network. Specifically, HTML or text with < and >. There doesn’t seem to be a lot of rhyme or reason as to when it happens, either.
One little trick we use when in the office is to open the Bonjour List (⌘ + 2) and send the message via Bonjour instead of AIM. Voilá, code through IM.
By jthomas on May 15, 2009 at 2:51 pm.
Filed under: Quick Tips and Tricks
I always have a moment of hesitation before I put my (or anyone’s) email address somewhere on the public web. While I’m not completely convinced of their prevalence, I understand that there are crawlers looking for email addresses. These bots are said to cultivate these email addresses which are later used for spam and who knows what else.
Wondering if there was something easy I could do to combat this I stumbled across a perfect little solution. Dan Benjamin of Hivelogic fame had already created the exact thing I sought out. It’s called Enkoder, and is available in both OS X app and browser form. Usage is simple, just plug in the email address and link copy and you are given the <script> tag to paste into your HTML.
By rgriffith on May 14, 2009 at 4:03 pm.
Filed under: Browsers, IE, Quick Tips and Tricks
Today, Jordan and I were trying to view a piece of rendered source in IE that was put into a div via Ajax. I Googled “IE View Ajax source” and figured I might find an add-in to IE or something that would accomplish this. The first link I found said all that you needed to view this was paste the following code into the address bar in IE:
javascript:'' + window.document.body.outerHTML+ ''
Or you can use this bookmarklet (Drag to links bar or add to Favorites): View Generated Source.
I know, I didn’t believe it would work either but it does work. The HTML that it outputs though is very, very scary.
The page where I found this is here: http://ericappel.net/blog/2006/10/03/ViewHTMLSourceGeneratedByAJAX.aspx
In addition, apparently Microsoft makes a developer toolbar for IE (7 not 8) that you can download as well. Microsoft Developer Toolbar.