Skip to content

Instantly share code, notes, and snippets.

View jasoncodes's full-sized avatar

Jason Weathered jasoncodes

View GitHub Profile
@jasoncodes
jasoncodes / config.ru
Created May 18, 2010 11:29 — forked from toolmantim/config.ru
Serving simple static sites using Rack
# Rackup file for serving up a static site from a "public" directory
#
# Useful for chucking a static site on Heroku
class IndexRewriter
def initialize(app) @app = app end
def call(env)
env["PATH_INFO"].gsub! /\/$/, '/index.html'
@app.call(env)
end
class Hash
def selekt
inject({}) {|hsh,(k,v)|
hsh[k] = v if yield(k,v)
hsh
}
end
end
raise "Check if this is still needed on #{Rails.version}" unless Rails.version == '2.3.5'
# <https://rails.lighthouseapp.com/projects/8994/tickets/3208-belongs_to-with-primary_key-does-not-work-with-finds-include>
# this should hopefully be fixed in 2.3.6. Untested on 3.0.
# can't easily patch the output of association_join via a alias_method_chain
# so the whole method is replaced here with the one line fix applied
module ActiveRecord::Associations::ClassMethods
class JoinDependency
class JoinAssociation
For <http://bjeanes.com/2009/10/01/code-formatting-in-rss-feeds>:
Firstly, please don't limit your feed to just excerpts. Clicking through to read content is annoying at best (more clicks) and impossible at worst (i.e. offline).
Inline styling of the feed content is a much better idea but still not the best. Markup should be semantic (your current code block are not IMO) and feed readers may not even respect user styles.
I think the markup needs to be fixed so it makes sense semantically. I'm thinking it should be a normal <pre/> with <span/>s for style hooks. To add line numbers, wrap each line in <code/> so we can style each line (unless I'm missing a way to write a selector to match all lines a la ::first-line).
I have quickly thrown together a proof of concept, tested in Safari 4 only. It's roughly styled like your blog with the <pre/> code generated by the TextMate.tmbundle but with manually added <code/> tags. The styling is a good candidate for SASS with all the calculations.