Skip to content

Instantly share code, notes, and snippets.

View henrik's full-sized avatar

Henrik Nyh henrik

View GitHub Profile
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
@henrik
henrik / gfm.rb
Created April 16, 2009 23:23 — forked from mojombo/gfm.rb
GitHub Flavored Markdown
# GitHub Flavored Markdown Layer
def fix_markdown_quirks(text)
# prevent foo_bar_baz from ending up with an italic word in the middle
text.gsub!(/(\w+_\w+_\w[\w_]*)/) do |x|
x.gsub('_', '\_') if x.split('').sort.to_s[0..1] == '__'
end
# in very clear cases, let newlines become <br /> tags
text.gsub!(/(\A|\n\n)(^\w[^\n]*\n)(^\w[^\n]*\n)+/m) do |x|
x.gsub(/^(.+)\n/, "\\1 \n")