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
# Let Ruby ping pingomatic.com | |
require 'xmlrpc/client' | |
XMLRPC::Client.new('rpc.pingomatic.com', '/').call('weblogUpdates.extendedPing', SITE_NAME, SITE_URL, FEED_URL) |
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 -w | |
# This TextMate command takes an HTML IMG element and re-calculates its size. | |
# The currently selected image will then get the original dimensions. | |
# This is useful when you have changed an image and need to reset its dimensions | |
# in your HTML. | |
# | |
# This should work on the selected text or current line and replace the current | |
# selection. Scope: text.html. Assign a nice keyboard shortcut of your choosing. | |
# |
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
original = 'ThisIsAStringInCamelCaseWithNumbersLike12And14' | |
# Convert a CamelCase string to snake_case | |
snake_case = original.gsub(/([\w^_](?=[A-Z]))|([a-z](?=\d+))/, '\1\2_').downcase | |
# Convert a snake_case string to CamelCase | |
camel_case = snake_case.gsub(/^\w|_\w/) { |match| match[-1,1].upcase } | |
puts snake_case # => "this_is_a_string_in_camel_case_with_numbers_like_12_and_14" | |
puts camel_case # => "ThisIsAStringInCamelCaseWithNumbersLike12And14" |
NewerOlder