Skip to content

Instantly share code, notes, and snippets.

<table id="posts">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Date Created</th>
<th>Published</th>
</tr>
</thead>
<tbody>
@samandmoore
samandmoore / render.js
Created May 31, 2012 01:19 — forked from mxriverlynn/render.js
Help me clean this up
// This is the render method in the `ItemView` in my Backbone.Marionette plugin.
// It's a giant method - far too much happening in this one method, and poor
// use of memory with all of the methods that get re-defined on every use.
//
// It desperately needs to be cleaned up. But I can't do something quite as
// simple as just move the inner functions on to the ItemView itself. There
// are too many methods on the ItemView already.
//
// Suggestions? What are some good patterns to clean this up?
//
require 'html2textile'
first_block = <<END
<div class="column span-3">
<h3 class="storytitle entry-title" id="post-312">
<a href="http://jystewart.net/process/2007/11/converting-html-to-textile-with-ruby/" rel="bookmark">Converting HTML to Textile with Ruby</a>
</h3>
<p>
<span>23 November 2007</span>