Skip to content

Instantly share code, notes, and snippets.

View garrytan's full-sized avatar

Garry Tan garrytan

View GitHub Profile
#!/usr/bin/ruby
def awesome_script
puts "Hello World!"
end
#!/usr/bin/ruby
def awesome_script
puts "Hello World!"
end
#!/usr/bin/ruby
def hello_world
puts "Hi world!"
end
hello_world
def ruby_method
puts "Hello world! Posterous now supports gists!"
end
sudo gem install garrytan-ebayapi --source http://gems.github.com
<% if request.user_agent.match(/MSIE 6.0/) && !request.user_agent.match(/MSIE (7|8)/) && cookies[:ie6sucks_hide] != '1' %>
<!--[if lt IE 7]>
<div style='border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative;' id="ie6sucks">
<div style='position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;'><a href='#' onclick='javascript:this.parentNode.parentNode.style.display="none"; return false;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg' style='border: none;' alt='Close this notice' id="ie6sucks_hide"/></a></div>
<div style='width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;'>
<div style='width: 75px; float: left;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg' alt='Warning!'/></div>
<div style='width: 275px; float: left; font-family: Arial, sans-serif;'>
<div style='font-size: 14px; font-weight: bold; margin-top: 1
# this is needed so that we can still access the original ActiveSupport version of JSON encoding
# JSON gem is faster but does not support automatic unicode conversion for < and >, which can cause
# problems for </script> in JSON output (browser interprets as exiting the script area, and results in XSS exploit)
#
# e.g. EscapableJsonString.new('<no_xss>').to_json
# => "\u003Cno_xss\u003E"
#
class EscapableJsonString < String
def to_json(options = nil) #:nodoc:
json = '"' + gsub(ActiveSupport::JSON::Encoding.escape_regex) { |s|
fasfds
This is a gist