This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'uri' | |
ARGV.each do |url| | |
puts URI.encode url | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'uri' | |
ARGV.each do |url| | |
puts URI.decode url | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This really should belong in String, not Date... | |
class String | |
# Calculate the Time represented by this string, and the (optional) time pattern | |
# that describes this string (see Time#strftime). | |
# Returns a nil time if the String does not match the pattern, or the pattern is invalid. | |
def strptime(format=nil) | |
date = format ? Date.strptime(self, format) : Date.strptime(self) | |
date.to_time | |
rescue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this in your ~/.irbrc | |
begin | |
require 'pry' | |
Pry.start | |
exit | |
rescue LoadError | |
puts "Pry not found, using 'irb' instead. Try\n gem install pry" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code | |
// Treat double-click like a single-click | |
$("button").multi_click(function () { | |
alert("It's all good.") | |
}) | |
// Different actions for single- or double-click | |
$("button").multi_click(function () { | |
alert("Try double-clicking me!") |