I am Drew Yeaton

and I design standing up.

0 notes

WordPress Title Trickery

Here is a bit of the code we’re using on a new site redesign. We needed a custom, more descriptive title on certain pages.

It grabs a title from a custom field if you set one, or just gets the page title if you don’t. Also, since WP doesn’t display the page’s title if you’re on the homepage, we’ll grab custom text from the site’s description (which we don’t use for anything else).

<title>
<?php 
	$sep = ’ | ‘;
	$site = get_bloginfo(‘name’);
	
	if(!$title = get_post_meta($post->ID, ‘title’, TRUE)) {
// we need this because page title
// isn’t shown when on homepage if(is_front_page() || is_home()) $title = get_bloginfo(‘description’); else $title = wp_title(”, FALSE, ‘right’); } echo($title.$sep.$site); ?> </title>

0 notes

Ok people, this is what happens when you don’t have HIG (human interface guidelines) for your platform. These Android Developer Challenge entries represent a core sample of the best applications Android has to offer.

Based on the icons alone, it is clear what kind of junkiness you can expect in app they represent. This kind of stuff is endemic in the open source community.

Do any of these scream “quality” to you?

0 notes

Python: List Comprehension, Closures & Lambda

The best part of learning is being able to share your knowledge is a way that’s autodidactic & condescending. So, here’s a little (possibly obvious) nugget I came up with for using list comprehension, closures & lambda.

My problem: How do I take a list of n-dimensional coordinates, and make a list of just one of the coordinates?

You could do it like this with list comprehension:

lst = [ [0, 1],[1, 3],[2, -1],[3, 4],[4, 7] ]
print [y for x, y in lst] # prints [1, 3, -1, 4, 7]

But that’s lame and we have that ugly thing for every coord we need. How about using a closure to make it more general, like this:

# here we're making a function that makes a function
# using 'i' as a way to "customize it". this is a closure.
def get_coord_factory(i):
def get_coord(lst):
return [coords[i] for coords in lst]
return get_coord

# make a customized function that only returns 
# the x coordinate. we would make one of these for
# y and z too and reuse them. 
get_x_coord = get_coord_factory(0) 
print get_x_coord(lst) # prints [0, 1, 2, 3, 4]

But wait, in our closure we have a one line function with no statements and one expression. Sounds like a lambda function to me. Let’s rewrite that factory to use a lambda:

def get_coord_factory(i):
return lambda lst: [coords[i] for coords in lst]

Ok, so there you have it, we’ve combined these three nifty features into something that’s useful and entertaining. Here’s the full listing:

lst = [ [0, 1],[1, 3],[2, -1],[3, 4],[4, 7] ]

def get_coord_factory(i):
return lambda lst: [coords[i] for coords in lst]

get_x_coord = get_coord_factory(0)
print get_x_coord(lst) # prints [0, 1, 2, 3, 4]

0 notes

More on Push

I just came across this little iPhone app that displays Growl notifications on your phone that originate from your computer’s Growl-compliant app. It’s called Prowl, and it’s exactly what I had in mind when I wrote my little piece on iPhone Push notification two weeks ago.

Had Apple chosen to allow 3rd party background apps in favor of its notification service, this kind of thing would’ve been a near impossibility—not for the technical piece that lives on the iPhone, but the huge amount of potential bandwidth and complex infrastructure from the building a service from scratch. Furthermore, it would be Apple with the device that has a battery capacity problem. That’s not really the point though.

Filed under iphone

0 notes

Poor Man’s Guide: Deployment with Git (and GitHub)

Git is one of those things that when you learn it, you start looking for reasons to use it. I would describe it as frictionless version control. Although the king of nerdy, abrasive verbosity, Linus Torvalds explains it as really just a filesystem—it’s the way that you use it, through its minimal, command-line interface that makes Git so efficient.

The technical stuff I’m not great at, so use the these guides for installation. Also, check out this radical guide for getting started.

So, I use Git for all my personal projects and a few things at Flipswap. But, occasionally I have a need to deploy my work to a live server. I have a GitHub account so my hosted repository needs are taken care of, but I have yet to see a simple script that outlines how you’d actually do a deployment with Git. In hindsight, that’s probably because it’s so easy. Take a gander.

I have a shell script in a directory outside of my httpdocs directory called “private”. The script pulls in any updates from the repo hosted on GitHub into my “site” directory (which is below the “private” directory). Then copies everything sans hidden files (including the actual git files) to my “httpdocs” directory. The script looks like this:

echo “Updating…”
cd site
git pull
echo “Copying…”
rm -rf ../../httpdocs/*
cp -rf * ../../httpdocs/
# do any permission changes here…
# chmod 777 ../../httpdocs/system/cache
echo “Done.”

Filed under programming poor man's guide git

0 notes

Poor Man’s Guide: Twitter Integration

I was just researching quick ways to integrate a one of my latest Flipswap projects with Twitter when I ran across this obvious, yet non-obvious thing. You can construct a URL that pre-populates the update field with any text you like. It works like this (click it for full affect/effect):

http://twitter.com/home?status=Yeatblog+rocks+my+face+off.

The craziest thing about this “discovery” is that a search on Google for “post to twitter” yields exactly what you need to know in the results.

Filed under poor man's guide web twitter programming

0 notes

Autocross Wrap-up

Autocrossed today with Maggie in tow. We had a lot of fun and met some cool people. I’m left with some disappointment though—seems like this time I didn’t get a chance to learn something. Ninety-six cars ran today which only gave time for four 50s runs through the course. That’s one or two laps to “learn” the course and a few to try to get competitive time. The standaround-to-driving time ratio is about 75-1. That is, wait around and “work” for 5 hours and drive for about 4 minutes.

Anyway, had a great time and talked up Flipswap. It was a success (especially since I didn’t have the slowest time of the day this time.) Leaving you with some shots courtesy of Adam and his scooter wielding wife. Great people.

Much thanks to Flipswap for paying for my entry, numbers, and livery. No more car talk for a while. Who knows what will happen this week.

0 notes

Last Sunday I mentioned this unbelievable cross-country trip by Team Polizei completed in 32 hours, 7 minutes. This clip is what I imagine the entire trip was like—white knuckle driving punctuated by chatter about police officers.

According to Wolfram|Alpha, they were traveling an average of 0.1 times the speed of sound (or 76.65 miles per hour).

0 notes

Tale of the Tape

Regarding my upcoming autocross event at GVSU in a newly sponsored BMW, I thought it would be interesting to compare technical stats from my first autocross at WMAA.

Event
Then: WMAA Autocross, May 17th, 2009
Now: GVSU Autocross, July 5th, 2009

Vehicle
Then: 1985 BMW 318i (E30)
Now: 2002 BMW 330ci (E46)

Classification
Then: HS (H Stock)
Now: DSP (D Street Prepared)

Vehicle Horspower & Torque
Then: 101/103
Now: 225/215

Vehicle Weight
Then: 2395 lbs.
Now: 3318 lbs.

Vehicle Acceleration 0-100 km/h
Then: 11.4 s
Now: 6.3 s

Driver
Then: Drew Yeaton
Now: Drew Yeaton

Experience
Then: None
Now: Some

Filed under BMW autocross racing