Skip to content

Instantly share code, notes, and snippets.

@patrickwmcgee
Created August 28, 2012 13:53
Show Gist options
  • Save patrickwmcgee/3498191 to your computer and use it in GitHub Desktop.
Save patrickwmcgee/3498191 to your computer and use it in GitHub Desktop.
Amazing wordwrap function from https://github.com/cmdrkeene/memegen
def word_wrap(txt, col = 80)
txt.gsub(/(.{1,#{col + 4}})(\s+|\Z)/, "\\1\n")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment