March 24th, 2007

Syntax Highlighting in Keynote

You would think that adding syntax highlighted code to your Keynote presentations would be as simple as copying & pasting from Textmate. Unfortunately that is not the case as Textmate doesn’t include formatting when copying items to the clipboard. There is however a solution by using some of the included bundles.

Here is my 4 step guide to including syntax highlighted code from Textmate into Keynote.

Step 1: Generate HTML

Open the document containing the code you would like to include. From the menubar select Bundles -> Textmate -> Generate HTML from Document (with line numbers). This will create an HTML document containing both the source code, as well as the stylesheet to match your current Textmate theme.

Step 2: Preview HTML

With the HTML window in focus select Window -> Show Web Preview. This will render the HTML in an embedded Safari window.

Step 3: Copy

You can now copy the rendered HTML, which will include all of the style information.

Step 4: Paste

Paste the copied HTML view into Keynote giving you syntax highlighted code which you can include in your slides.



August 15th, 2006

August Phoenix Ruby Users Group

We had another successful Phoenix Ruby Users Group this evening. I believe that we once again had a record turn out, many thanks to all who gave up their evening to come support the community. To be honest I was quite surprised with the number of people who attended, mainly do the the fact that I posted to the mailing list last week stating that I wanted to take a break from focusing on Rails to demo some of the other cool libraries that tend to get overlooked.

The original intent of this month’s meeting was for me to do an in-depth tutorial on Rake followed by a demo from James on automating Trac tasks via Rake tasks. Unfortunetly due to a prior commitment by James, and a sudden lack of interest on my part to talk about Rake for 45 min, plans needed to change. Thankfully this morning Jason convinced me that it would be cool to show off some of the capabilities of RubyCocoa. Thus having never even opened Xcode or InterfaceBuilder I spent my lunch hour doing a little research and was actually quite impressed at what I was able to figure out and hack together (how’s that for being agile!). In the end I decided to stumble through a demo of Ruby-Growl for showing cool little notifications, and RubyCocoa for building a sweet little UI to manage the execution of Rake tasks.

I’ve listed some very brief code-samples below, along with some links to the references that I found most helpful. If you are at all interested in either of these libraries please contact as I’d love to continue hacking on both.

Ruby-Growl

Code:

require ‘rubygems’
require ‘ruby-growl’
require ‘open-uri’

growl = Growl.new(“localhost”, “ruby-growl”, [“ruby-growl”])

begin
  URI.parse(“http://joshknowles.com”).open 
rescue 
  growl.notify(“ruby-growl”, “Error”, “joshknowles.com unavailable”) 
end

References:

RubyCocoa

References:

Once again thanks to all that attended and showed your support for the local development community. I apologize for my lack of preparation, and appreciate your patience I stumbled my way through my latest pet-project, hopefully you were able to see a thing or two that interests you. For those of you I met the first time, I hope to see you again. For you old timers it’s always a pleasure. I hope to see everyone next Tuesday evening for the AZ on Rails meeting where I will be giving a demo of Capistrano.



August 14th, 2006

Development Environment

Recently Robby convinced me that I should be using DarwinPorts as opposed to the src based configuration that had worked so well for me in the past. So with the help of a few good tutorials I deleted my /usr/local/ directory and made the plunge. After about a week now, having fully played with the new environment, I’ve got to say that if you haven’t tried out DarwinPorts you really should take the time to switch. I know it seems a bit odd that all your files are in this weird /opt directory (at least it was for me), but trust me the dependency management and install/update process is definitely worth the switch.

What follows is a brief recap of my installation process. Nothing here is original, it is all derived from the articles mentioned above, I just wanted to consolidate the information for my own archiving benefit.

Note: The following assumes you are running Mac OSX 10.4 (Tiger)

Install Xcode

Install the Application Image available from the Xcode section of the Apple Developer Connection website (ADC login required).

Install DarwinPorts

Install the Application Image available from the Downloads section of the DarwinPorts website.

Update PATH

echo ‘export PATH=”/opt/local/bin:/opt/local/sbin:$PATH”’ >> ~/.bash_profile

Update DarwinPorts

sudo port selfupdate

Install Ruby & Required RubyGems

sudo port install ruby
sudo port install rb-rubygems
sudo gem install -y rake
sudo gem install -y capistrano

Install RubyCocoa

sudo port install rb-cocoa

Install SQLite

sudo port install swig
sudo port install sqlite3
sudo port install rb-sqlite3

Install MySQL

sudo port install mysql5 +server
sudo port install rb-mysql5
sudo mysql_install_db5 –user=mysql
sudo launchctl load -w /Library/LaunchDaemons/org.darwinports.mysql5.plist

Secure MySQL

cat /etc/my.conf
[mysqld]
skip-thread-priority
skip-networking

Install Subversion

sudo port install subversion +tools

That’s it for now. I’ll update soon with lighttpd, Mongrel, etc. (currently I’m going old-school and running all local dev off of Webrick).

[Update 08/15/2006: Added install of RubyCocoa]