Find the End of the Week with PHP

Just had a need to to represent the end of the current week in PHP. A quick Google search turned up a bunch of clumsy ways. The most common was to run the current date and day of the week through some math to get the date of Next Friday.

Fortunately thinking of those last two words reminded me of an easier way, and one that I use in BASH occasionally. PHP's strtotime function takes a similar language that GNU Date does. So to find out the date of next friday, just use this line of code:

$week_ending = date('Y-m-d', strtotime( 'Next Friday'));

You can also use "This Friday" which will return today's date on a Friday instead of a week from today.

Amazon Link Marklet

Just a quick post for anyone using Amazon's affiliate program.  Since it's a pain to use Amazon's own link maker, and the amazon associates toolbar creates links that are too log to easily paste in email of IM, I've created a bookmarklet to solve the problem.

This little marklet will take the current amazon URL, chop off the unneccesary arguments, and add your affiliate tag to the end.


We could probably omit the ?tag= but I have seen instances where Amazon didn't count the short urls and prefer this method of adding the affiliate tag.

To use this marklet, drag the following URL to your bookmark toolbar, then edit the properties and change geekdad84-20 to your affiliate id.  Or don't edit it so I get the commission, it's up to you.

Amazon URL

Google Trends, Java, PHP, Ruby, Python


Henry brings up a good question in the comments on the comparison of the languages.  While I don't believe the trends in search terms are a good measure of job possibilities or job growth, they do indicate what people are interested in, or at least what they are having trouble with.



The lines, top to bottom are Java, PHP, Ruby, Python.  Java's popularity is waning and the other 3 seem to be flat lined.  I picked the United States for the last 12 months.  I was hoping this would help reduce the counts of searches for Java Indonesia, but it probably amplified the counts for coffee shops.

Before you get too crazy comparing the graphs here with the trends, keep in mind that the indeed graphs show percent of change in postings, not total number of jobs.  The intent is to show which markets are growing the fastest, not which are the biggest.

Read the graph as you will, Java is probably more popular than the other languages but I don't think it is better, nor do I think it is growing.  Java might be all but gone in a decade and we will be looking down on the current agile languages in favor of something better, faster, cheaper and wondering how on earth we put up with the ancient bloated tools like AJAX, Rails, Django, etc.

Stop the Auto-Play Madness


I don't care if you are a band, and want to promote your new song.  If I am shopping for music, then odds are very good that I like music, and that I am already listening to something.  Your shit doesn't sound good mixed up with whatever I'm listening to.

Don't set up a player widget to start automatically.  Bonus asshat points if you hide the stop button.  That just makes me leave your site much sooner.

Do put a player widget on the page and make it easy to see.  I promise I'll click play when I'm ready.

Google App Engine – Google Code


appengine_lowres.jpgGoogle App Engine - Google Code

Run your web applications on Google's infrastructure.
Google App Engine enables you to build web applications on the same scalable systems that power Google applications.

Try it free with 500 MB persistent storage and enough juice to server up 5 million pages a month. Sounds like a good alternative to EC2 and S3 for those on a budget.

[update]  I applied before I went to sleep last night and had an invite waiting for me this morning.  Now I just need to come up with a cool idea.

Fun with TLDs, .sh


The .sh top level domain (TLD) looks to have a lot of good available names.  Too bad they  cost 60£ (+VAT).  That's about 120 USD.  If the exchange rate improves, which .sh domains would you develop?

GM Reddit

Genetically Modified Reddit is a greasemonkey_logo.jpgGreasemonkey script that I wrote to automate the task of voting up and down the things I like.

Get it here: gmreddit.user.js

You will need to install greasemonkey first. Once installed, you can manage user scripts and edit the arrays at the top of the file to include your keywords.

The script checks for down votes first and skips the up vote if it finds any. Adding more keywords might affect performance, but it runs fine on all my machines.