WordPress recent posts as JSON

Posted by & filed under Programming.

For an update to one of my web projects I went looking for a way to get the recent posts as JSON instead of using the RSS feed. I personally find JSON much easier to deal with than RSS, so that’s the route I wanted to take.

days_ago function for PHP

Posted by & filed under Programming.

Can’t take credit for all of this, but I also don’t remember where the code that I started with came from. days_ago is a function that will take two dates and return a more human friendly version of dates. So if you pass today’s date and yesterday’s date it will return “1 day ago.”

PHP function to get first n words from a string

Posted by & filed under Programming.

A handy little function for your bag of tricks. This PHP function will return a max number of words out of a string, or the whole string if it’s already shorter. This probably could be made shorter, but I was in a hurry when I needed this and went for quick rather than clever.

Netbeans with multiple monitors

Posted by & filed under Computers & Internet.

How did I not try this before today? My normal method of needing two files open was to have the one I’m working on in Netbeans and the other in Notepad++ on separate monitors.  Turns out you can drag the tab of an open file outside of Netbeans and it becomes its own window. We’re… Read more »

Grouping MySQL query by date

Posted by & filed under Computers & Internet.

Working on a statistics plugin I needed a way to group records by the day.  Turns out it’s remarkably easy. If you just want to group by year and month take off the DAY() part.  This would also be a good query to use WEEK() on to pull records grouped by the week they were… Read more »

How to get a screen shot from an iPhone

Posted by & filed under Computers & Internet.

It’s come up a few times where I’ve needed to get a screen shot from my iPhone.  Turns out there are two ways to do it, one of which is built into the phone. Easiest way is to hold down the home button and press the power button.  You’ll hear the shutter sound and the… Read more »