Skip to content

Instantly share code, notes, and snippets.

View cbrnrd's full-sized avatar
🤠

Carter Brainerd cbrnrd

🤠
View GitHub Profile
@thehenster
thehenster / gist:2215231
Created March 27, 2012 11:44
How to remove/disable the automatic XSS protection helper html escaping for Rails 3
# dirty way to completely remove the automatic escaping of html in rails helpers
# useful to get your Rails 2 -> 3 upgrade running to the point where the raw/.html_safe additions can be delegated
module CustomHtmlSafe
def html_safe?
true
end
end
class ActionView::OutputBuffer
@rtomayko
rtomayko / optparse-template.rb
Last active June 3, 2023 03:16
Ruby optparse template
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"
@rkumar
rkumar / gist:445735
Created June 20, 2010 10:47
ruby's OptionParser to get subcommands
#!/usr/bin/env ruby -w
## Using ruby's standard OptionParser to get subcommand's in command line arguments
## Note you cannot do: opt.rb help command
## other options are commander, main, GLI, trollop...
# run it as
# ruby opt.rb --help
# ruby opt.rb foo --help
# ruby opt.rb foo -q
# etc