Web Dev Notes

Blog about web development by Robert Dawson

Generate an image in Terminal

If you ever find yourself needing to generate a placeholder image and can't be bothered going to a site like http://placehold.it, typing in a URL, and saving the resulting image, you can simply open Terminal and type this command:

curl -O http://placehold.it/350x150

Although, this might be more appropriate:

curl -O https://placekitten.com/g/200/300

How to fix a Day One tag name

  1. Open Day One.
  2. Go to Preferences > Sync.
  3. Click the folder icon in the "Data File" section. My folder is called "Journal_dayone."
  4. A Finder window will open. Keep it open and close Day One.
  5. Drag the "entries" folder to Sublime or another text editor with folder support.
  6. Find and replace. Make sure it's case-sensitive if necessary.
  7. Open Day One to check.

You're welcome!

Set Messages Status to Available on Startup

Maybe it's my overbearing electromagnetic influence, but I routinely encounter a problem with the Mac app, Messages, in that, if it doesn't detect an Internet connection, it changes its status to "Offline" and, because I shutdown and opt to restart with the same applications open, the status of Messages remains "Offline" when it opens, even when I try to change it to "Available." Um.

So, to solve this simple but annoying bug for Apple, download the following AppleScript script bundle and add it to your login items so it runs on startup.

Set Messages Status to Available on Startup


  1. Download to /Documents/scripts/Applescript/.
  2. Uncompress (from .zip to .scptd).
  3. Go to System Preferences > Users & Groups > Login Items (tab).
  4. Select the + sign.
  5. Find your script.

If you don't feel like downloading the script bundle above, just open the AppleScript Editor application, start a new script, and paste in the following code:

if application "Messages" is not running then
launch application "Messages"
end if

tell application "Messages"
set status to available
end tell

Automator script to copy all open URLs in Safari to clipboard


You need to send someone (or do anything with) a list of URLs you have open (in Safari or Chrome on Mac).


Use this Automator workflow script:

on run {input, parameters}
	set _urls to {}
	tell application "Safari"
		repeat with _tab in tabs of window 1
			set end of _urls to URL of _tab
		end repeat
	end tell
	set {_tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
	set the clipboard to _urls as string
	set AppleScript's text item delimiters to _tid
	return input
end run

Then, just paste wherever you like!

How to use phpDocumentor on WordPress (on Mac)

Here are the steps it took for me to get phpDocumentor to create documentation for a WordPress installation.


  1. Open phpDocumentor.ini*
  2. Uncomment the line (line 25 for me) starting with "memory_limit"
  3. Set memory_limit to "2048M"**
  4. Open Terminal and go to the directory above the one your wordpress installation
  5. Use phpdoc (takes a few minutes)


phpdoc -o HTML:frames:earthli -d wordpress -t wordpress/docs

* I'm using MAMP and my directory is /Applications/MAMP/htdocs/phpdoc/.
** Probably overkill; consider available RAM. For me, 1024M wasn't enough. I kept getting this error:

phpdoc FAILED: Bad environment variable $PHP (set to "/usr/bin/php")

How to play Keynote full-screen

It's simple to display Keynote presentations full-screen. But, since I'm new to the program, it took me a minute to find the option. Here's how to do it.


  1. Go to the Keynote menu.
  2. Go to Preferences.
  3. Go to the Slideshow tab.
  4. Check "Scale slides up to fit display."


screenshot of Slideshow scale option in Keynote

Note: This applies to Keynote '09.

Automator workflow to download specific files from URL

I've finally returned to the saving grace of Macs after over a decade and I love it! One useful app is Automator, which, as the name implies, automates tasks. This is potentially very helpful, although, after looking at all the options one night, I have to confess that I walked away wondering how I would practically use it.

Well, today, at a conference, I finally found a great use: downloading specific files, in my case .pdf and .zip files, from a URL.


  1. Open Automator.
  2. Make a new workflow.
  3. Add these actions, in this order:
    1. Get Specific URLs
    2. Get Link URLs from Webpages
    3. FIlter URLs
  4. In the "Get Specific URLs" action, set your URL.
  5. In the "FIlter URLs" action, add your filter(s). (e.g., Name contains .pdf)
  6. Run, to test results.
  7. Add the "Download URLs" action and choose a download folder.

Wait for it to finish, which could take a while depending on total file size.

Get wget on a Mac

The Mac doesn't come with wget, but you can easily make an alias called "wget".


  1. Open Terminal.
  2. Type "cd ~/" to make sure you're in your user directory.
  3. Type "echo 'alias wget="curl -O"' >> ~/.bash_profile" to create a persistent alias.
  4. Restart Terminal.
  5. Go to a directory where you want to download a file.
  6. Type "wget http://www.myurl.com/myfile.pdf" and begin downloading!