TIMBERLINE LODGE WEBSITE

January 18th, 2009


URL: http://www.timberlinelodge.com
Agency: Nemo
Role: Lead Developer
Technology: PHP / Wordpress


Featured in the Wordpress Showcase

Struck SLC

January 15th, 2009


Hallo, Dit is Struck from Jeramy Morrill on Vimeo.


This video makes me feel all warm and nostalgic on the inside, like a cup of hot cocoa. Congrats to the team @ STRUCK! I miss you guys… especially GareBear!

WORDPRESS – EASILY LOOP THROUGH PAGE CHILDREN

January 11th, 2009

The following code will let you create a custom “Wordpress Loop” that contains the post objects of the children of the current page.


Just drop this code in your theme file:


<?php
    $project_list = get_posts('numberposts=5&order=ASC&orderby=menu_order&post_type=page&post_parent='.$post->ID);
 
    foreach($project_list as $post):
    setup_postdata($post);
?>
    <div class="post" id="post-<?php the_ID(); ?>">
    </div>
 
<?php 
    endforeach; 
?>

NemoHQ

January 10th, 2009

URL: http://www.nemohq.com
AGENCY: Nemo
ROLE: Technical Architect, Wordpress Integration
TECHNOLOGIES: Flash, Ruby on Rails

Using jQuery to Build a Better Flash Fly-Down Nav

January 9th, 2009

It seems simple, but one of the most troublesome tasks is to get a Flash fly-down (or drop-down) menu to reliably collapse when it sits over non-Flash content. Some browsers (IE) have trouble recognizing the change of control from the Flash Player application instance to the browser. For that reason Flash won’t always read when the mouse has moved outside the bounds of the Flash Player… worse still – it just receives no notification at all, which means that if you’re relying on Flash to read when the mouse has moved outside the bounds of the navigation – you’re out of luck.


Over the years I’ve come up with many tricks to help deal with this – some more effective than others. Today I found the best solution to date. It’s not 100% effective, but it’s much better than any of the other options that I used.


I decided to try using the jQuery hover method to detect when the mouse leaves the Flash’s containing DIV element in the DOM.


The AJAX code looked something like this:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$('document').ready(function()
{
    $('#flashNavReplace').hover(
        function()
        {
	    //rollover functionality here
        },
        function()
        {
            getFlashMovie("flashNavReplace").jsCloseNavigation();
        });
});
 
function getFlashMovie(movieName) 
{
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
}

and then the Flash side uses some code like this:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import flash.external.ExternalInterface;
 
/**************************************************************************
* 
* CONSTRUCTOR
* 
**************************************************************************/
public function TopNavigation()
{
    //setup the JS callback
    ExternalInterface.addCallback("jsCloseNavigation", jsClose);
}
 
function jsClose():void
{
    Logger.log("CALLED FROM JS");
    //close the nav
}


This works for me pretty much all of the time… I can break it if I really try, but it works great for normal usage.

SPEAK VISUAL IS GETTING A LOT OF ATTENTION

January 7th, 2009

Congratulations to the entire NVIDIA team here @ odopod on the success of the Speak Visual site on being featured in F:E:D, StyleBoost, and being chosen as the FWA Site of the Day.




Activate URLs and Twitter Profile Links with PHP

January 4th, 2009


In a current project I’m reading in a user’s Twitter feed and displaying it on the hompage of their Wordpress blog. I know that there are a thousand plug-ins that exist to do this exact thing, but I wanted to write my own.


Using the official Twitter API the contents of the individual were returned as plain text, meaning that all HTML links were totally dead. I wanted a way to automatically add the HTML to enable URL’s as well as twitter “@” profile links. I found some regular expressions and with some tweaking came up with these 2 functions.


To activate the URLs in block of text pass it to the following function:

function activateURLS($tweet)
{
    return preg_replace("@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@", 
        "<a href="$1" target="_blank">$1</a>", 
        $tweet);
}


To activate Twitter @ profile links using the following PHP block:

function activateTwitterProfiles($tweet)
{
    return preg_replace("/@([^ ,.!#$%^&]+)/", 
        "<a href="http://twitter.com/$1" target="_blank">@$1</a>", 
        $tweet);
}


They’re super easy to use, just call them like this:

activateTwitterProfiles(activateLinks($tweet->text))