Posts tagged TextMate

Sep 05, 2007

TextMate find in project slow in Rails

TextMate Rails Ruby on Rails TextMate Rails Ruby on Rails | comments

Update: Don’t bother with the crap I spewed below. Just head over to Rail Spikes. There are a couple options if you read the post and comments.

I do a ton of project finds when programming in Rails using TextMate. “Find in project” (cmd-shift-F) is my master. If you do the same thing, you probably have noticed that over time this feature becomes slower and slower. What is the most likely cause?

Log files bring you down

Log roll
 
Photo by goldberg

The lowest hanging fruit on the slow-TextMate tree are log files. TextMate loads just about everything into memory as it’s searching. If you’re not careful, log files can become large and quite literally in charge. You have a couple options to make things nice.

The most obvious solution to a Rails programmer would be to execute rake log:clear. Snip snip and your log files are no longer a resource hog.

A more permanent solution is to right-click on the the log file in your TextMate project and select “Remove from project.” At the prompt, simply tell TextMate to “Delete References.” Even with this nuclear solution in place, it’s still probably a good idea to rake log:clear on occasion.


Jun 25, 2007

More TextMate dates for your WordPress blog

TextMate WordPress blogging bundle TextMate WordPress blogging bundle | comments

Previously I posted what amounts to a link post about how TextMate can be hacked to help you write blog entries for WordPress. I really did not take that post far enough. Once you have the TextMate environment set up, ala the TextMate wiki, then you need to get your timezone just right.

The TextMate blogging bundle has a built-in snippet for specifying the date (simply type “date” then the tab key). Unless you are in the GMT time zone, you’ll need to offset that date. For instance, currently in the central time zone I need to offset the date by -0500 hours.

Rather than type in that offset every time you include the date in your blog post, why not just update the snippet to do the work for you?

Blogging Date Snippet

With the TextMate blogging bundle, if you do not specify a date as you construct your post, it will default to the current date and time when you submit the post to your blog. The beauty is that the blogging bundle draws that date format from the snippet you updated above. So even posts with non-specific dates get set correctly for your timezone.


Jun 07, 2007

Adding lightbox to FlickrMate

TextMate FlickrMate lightbox Flickr TextMate FlickrMate lightbox Flickr | comments

There’s a cute little [TextMate][TextMate] bundle called [FlickrMate][FlickrMate]. It might just get me to post a few [more][p1] [pictures][p2] to this here blog. But it’s just short of perfect for my purposes. I want to integrate the handy [lightbox][lightbox] plugin to the FlickrMate output. That’s easy - assuming you’ve already incorporated lightbox into your blog. A WordPress blog, [for instance][wp-lightbox]. Oh, I’m also assuming you’ve already installed FlickrMate.

To add some lightbox-fu to the FlickrMate bundle, open the bundle editor (Bundles | Bundle Editor | Show Bundle Editor). You will probably wish to modify the HTML output for three FlickrMate commands: Flickr Text Search, Flickr Tag Search, and Browse Your Flickr Photos. To see the command code for these commands, simply pop open the FlickrMate bundle:

Flickrmate 1

Editing a command is as easy as selecting a command and modifying the command code presented. I’m sure I should tell you to back things up and all that. For each of the commands I mention above, you’ll want to scroll to the bottom of the command code and look for the following bit:

if linkurl
  print %Q{<a href="#{linkurl}" title="#{description}">
  	   <img src="#{url}" width="#{width}" height="#{height}" alt="#{title}" /></a>}
else
  print %Q{<img src="#{url}" width="#{width}" height="#{height}" alt="#{title}" />}
end

This is really simple. I shouldn’t even be typing this. To bring lightbox into the fold, just add the required rel="lightbox" to the anchor tag in the if linkurl portion of the code.

if linkurl
  print %Q{<a href="#{linkurl}" title="#{description}" rel="lightbox">
  	   <img src="#{url}" width="#{width}" height="#{height}" alt="#{title}" /></a>}
else
  print %Q{<img src="#{url}" width="#{width}" height="#{height}" alt="#{title}" />}
end

Apr 30, 2007

Specifying date when blogging from TextMate to WordPress

TextMate WordPress blogging bundle TextMate WordPress blogging bundle | comments

Friday was a day of Mac-fu. I spent the entire day getting more familiar with some tools and attempting to automate various repetitive tasks. I didn’t get very far, unfortunately, but the groundwork has been laid. OS X rocks.

TextMate is an amazing editor with amazing bundles snapped on to it. One of these bundles is for blogging. Why do I hop to my browser to blog when I have a glorious text editor right on my desktop that will accept Markdown formatting, grab categories directly from my blog, and upload pictures with a drag and a drop on the page?

The biggest problem I have with TextMate blogging is date stamping. I could throw an alternative date on my post pre-submission and it just was not recognized by WordPress. Something was lost in translation. Wiki-support to the rescue! TextMate fixes the problem fairly simply for me.

Note: I did receive an error when executing the provided patch against WordPress’s xmlrpc.php file:

patching file xmlrpc.php
Hunk #1 succeeded at 692 with fuzz 1 (offset 23 lines).
Hunk #2 FAILED at 763.
1 out of 2 hunks FAILED -- saving rejects to file xmlrpc.php.rej