Posts from July 2008

Hands On With Kodak’s Zi6 Pocket HD Camcorder

Forget Flip Videos, I want one of these! 720p HD, takes SD cards, and 16:9 recording? Awesome.

Posted on July 25, 2008 Leave a Comment
Tagged with: , ,

Calm Waters, Sebago Lake, Maine (Vertical)

Calm Waters, Sebago Lake, Maine (Vertical)

Posted on July 21, 2008 Leave a Comment
Tagged with: , , , , , , , , ,

Calm Waters, Sebago Lake, Maine (Horizontal)

Calm Waters, Sebago Lake, Maine (Horizontal)

Posted on July 21, 2008 Leave a Comment
Tagged with: , , , , , , , , ,

Sebago, Sunset, and Sky

Sebago, Sunset, and Sky

I think I may have gone a bit over the edge processing this one, what do you think?

Posted on July 21, 2008 Leave a Comment
Tagged with: , , , , , , , , ,

Boat and Sky Horizontal 2, Sebago Lake, Maine

Boat and Sky Horizontal 2, Sebago Lake, Maine

Not sure which of these 3 I liked best, so I uploaded all 3. Let me know what you think!

Posted on July 21, 2008 Leave a Comment
Tagged with: , , , , , , , , ,

Boat and Sky Vertical, Sebago Lake, Maine

Boat and Sky Vertical, Sebago Lake, Maine

Not sure which of these 3 I liked best, so I uploaded all 3. Let me know what you think!

Posted on July 21, 2008 Leave a Comment
Tagged with: , , , , , , , , ,

Boat and Sky Horizontal 1, Sebago Lake,  Maine

Boat and Sky Horizontal 1, Sebago Lake, Maine

Not sure which of these 3 I liked best, so I uploaded all 3. Let me know what you think!

Posted on July 21, 2008 Leave a Comment
Tagged with: , , , , , , , , ,

GelaSkins

Gorgeous artist-designed skins for iPods, iPhones, and laptops. I’m considering buying this one for my iPod.

Posted on July 21, 2008 Leave a Comment
Tagged with:

Pass Blocks to Your Markdown Helper

For the new site, I’m going to be using Markdown to handle the formatting of all of my content. I created a simple helper to make things easy:

def markdown(str)
  RDiscount.new(str).to_html
end

(Note: I’m using the RDiscount library instead of BlueCloth, for reasons discussed here)

However, what if I wanted to add a “Read more” link at the end of the entry excerpt? I’d have to do something like this:

<%= markdown entry.excerpt + link_to("Read more", entry_path(entry)) %>

This way didn’t really appeal to me. What I really wanted to do was just pass a Ruby block, like this:

<% markdown do %>
  <%= entry.excerpt %> <%= link_to "Read more", entry_path(entry) %>
<% end %>

In order to do this, I just had to modify my markdown helper a bit:

def markdown(str='', &block)
  str    = capture(&block) if block_given?
  result = RDiscount.new(str).to_html

  block_given? ? concat(result, block.binding) : result
end

And, just like that, I can now pass blocks to my Markdown helper.

Posted on July 15, 2008 Leave a Comment
Tagged with: , ,

Rails Envy Caching Tutorial

Awesome guide to Rails caching that definitely saved me several times building this site.

Posted on July 14, 2008 Leave a Comment
Tagged with: , , ,

Redevelopment Update

I put together a quick video showing where I’m at with the new design and backend for KyleSlattery.com. Take a look, and let me know what you think!

Posted on July 12, 2008 3 Comments
Tagged with: , , ,

PHP Facebook Paginator

While building the Viddler Facebook application, I needed to create a pagination tool that worked just like Facebook’s. After looking at their HTML and their logic of what pages to display, I came up with one, which I’m releasing for anyone to use. The function takes 5 arguments, in the following order:

  • $base_path: The base path for pagination. For instance, if /videos/4/ was page 4, $base_path would be “/videos”
  • $cur_page: The current page number
  • $total_items: The total number of items on the page
  • $per_page: The number of items that are displayed on each page
  • $footer_bar: If set to “true” this does not include the “Displaying items 1-5 of 10” text, and styles it as a footer paginator, instead of a header paginator.
  • $name: What you’re paginating. This shows up as “Displaying $items 5-10 of 40”

Here’s an example:

<?php echo paginator('/videos', 2, 44, 5, false, 'items'); ?>

And here’s what it would look like:

Paginator example

You can download the source here. Hopefully this helps someone!

Posted on July 8, 2008 7 Comments
Tagged with: , , , ,