Skip to content

Instantly share code, notes, and snippets.

@wadewest
wadewest / HAML_MarkdownWithTOC.rb
Created March 9, 2016 18:05
Custom HAML filter using Redcarpet to generate HTML with table of contents from Markdown. Copy file to config/initializers/ to install in Rails.
module Haml::Filters
module MarkdownWithTOC
include Haml::Filters::Base
def render(text)
<<~HAML_MD
<nav class="toc">
#{Redcarpet::Markdown.new( Redcarpet::Render::HTML_TOC.new ).render(text)}
@wadewest
wadewest / loadSources.vim
Created September 14, 2011 17:35
Searches up the directory structure for files named vimrc and loads them.
" loadSources Recursively
if has('ruby')
ruby << EOF
# loadOtherSource - climbs the directory structure looking for
# files named "vimrc" and calls source on each
# one starting with the one furthest from the
# current file.
def loadOtherSources