Posts tagged “php”

Bashpress 2008/09/03

Guilty. I wrote another blogging engine. This one's command-line based and only for those willing to get HTML on their shirt. Writing a post looks like this:

  1. bin/new "This is the post's title"
  2. Write the post in the file it gives you
  3. bin/preview path/to/the/post
  4. Check it out in your favorite browser
  5. bin/publish path/to/the/post

I rolled my own because I rather like the command line and rather dislike being h4x0red. It has a script to import a Wordpress blog, so you can come and play, too. The source is on GitHub.

Go ahead and make fun of me for spending my free time on this. I hope it'll make me write more (I hated Wordpress' WYSIWYG editor, even in HTML mode).

http://github.com/rcrowley/bashpress

Comments (4)

wp-screenshots plugin 2008/01/22

Ever wanted Wordpress to display small screenshots of pages you're linking to like the del.icio.us homepage? Neither have I but a friend wanted it and I wanted to build a Wordpress plugin, so here it is.

wp-screenshots takes the URL of a del.icio.us RSS feed as input and gives back a <ul> containing thumbnails from the unofficial Snap API.

Installation is as easy as running svn co http://svn.rcrowley.org/svn/wp-screenshots/ ./ in your wp-content/plugins/ directory. You can then use the PHP function screenshots() anywhere in your templates. As a bonus, if you setup wp-screenshots.php to run as a cronjob, it'll understand what's up and just hit the proper image URLs to make sure Snap's cache is primed for your page views.

http://svn.rcrowley.org/svn/wp-screenshots/

Comments (6)

Headed to St. Louis 2007/10/05

Tomorrow I head to St. Louis to do a bit of Yahoo! recruiting at my alma mater. If you're a web geek and go to Wash U, make sure you come see us.

Preparing for the trip, I've been trying to decide what to read on the flight. I could pick up some fiction, but let's be honest, I'll never do that voluntarily. So I decided to read 37Signals' Getting Real. Being a clever miser, I made a little script to download all 91 essays so I don't have to buy the PDF to read it offline. Enjoy:

Update

I like the 37Signals guys, so until we clarify things, I've taken down the PHP code. However, I believe this is fair use. The copyright notice non-37Signals-Matt pasted below is simply not applicable since I have not redistributed their content by providing the script.

A bit of automation has little to do with the fact that the content is freely available online. If it makes anyone sleep any better, I'll recycle my original dump and go back to the website and click print 91 times. Do forgive me for saving myself some time.

Comments (6)

CVS oops fix 2007/07/12

Committing a new project to CVS is quite a chore. I have been slowing getting it together for the past couple of days, screwing up early and often. If you ever find yourself with a directory tree full of CVS directories and you would rather not, try this:

<?php

function scrub($path) { $dir = opendir($path); while (false !== $d = readdir($dir)) { if ('.' == $d{0}) continue; if ('CVS' == $d) `rm -rf $path/$d`; else if (is_dir("$path/$d")) scrub("$path/$d"); } } scrub('.');

?>

I've discovered other nasty quirks, too. Like you can't actually remove a directory, but you can suppress empty ones on cvs update using the -P option. Adding binary files and trusting CVS to play nicely is a terrible idea. Instead you need to think for it and do cvs add -k b file to let it know you're adding a binary file.

Or, if you have decision-making power, you could just switch to Subversion.

Comments (0)