Archive for the ‘Development’ Category

jQuery Mobile – Defining multiple local pages

How to define multiple pages within one single HTML file

<div data-role="page" id="main-page">
    <div data-role="header">
        //Content
    </div>
    <div data-role="content">
        //Content
    </div>
    <div data-role="footer">
        //Content
    </div>
</div>
<div data-role="page" id="subpage-1">
    <div data-role="header">
        //Content
    </div>
    <div data-role="content">
        //Content
    </div>
    <div data-role="footer">
        //Content
    </div>
</div>

Share

iPhone/iPod JavaScript Redirect

JavaScript redirect For iPhones/iPods Specifically

<script language="javascript">
    if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
    {
        location.replace("http://url-to-send-them/iphone.html");
    }
</script>

Share

Forgotten TO-DO’s

I’m not sure about all the rest of the Developers out there but my biggest problem is coming back to finish TO-DO’s.

I have always marked temporary code hacks, or code that needed improvement with a // ::TO-DO:: {description of issue}.

I finally got sick of going through old code and seeing multiple ::TO-DO:: blocks.

I wrote this tiny shell script and run it nightly from cron.

#!/bin/sh
echo "Starting ::TO-DO:: Search for (project)"
echo ""
grep -r -n "::TO-DO::"  (/PATH/TO/PROJECT/FILES/) (/PATH/TO/PROJECT/FILES1) (/PATH/TO/PROJECT/FILES2) -B1 -A3

Just ensure there is an email address for the cron output or you will have to pipe greps output to mail, mailx, mutt, or something similar.

The -r flag tells grep to search recursively for each path.
The -n flag adds line numbers on the offending line.
The -B1 and -B3 adds the prior line and three following lines to the output.


Share

All The Cheat Sheets That A Web Developer Needs

Posted by Bogdan over at topdesignmag.com

No matter how good programmer you are, you can`t memorize everything. It often happens to spend more time searching for a particular library, tag or declaration, than implementing it on our code. To ease your work I have gathered here some of the most important cheat sheets that you will ever need. Do you have any suggestions?

It’s good shit – go check out the full post: http://www.topdesignmag.com/all-the-cheat-sheets-that-a-web-developer-needs/


Share
Twitter Delicious Facebook Digg Stumbleupon Favorites More