I hereby claim:
- I am avdgaag on github.
- I am avdgaag (https://keybase.io/avdgaag) on keybase.
- I have a public key whose fingerprint is 4F42 6A06 0AD7 FB17 65C7 F164 7109 F6F2 67B5 C31C
To claim this, I am signing this object:
function! MyOmniFunc(findstart, base) | |
if a:findstart | |
let existing = matchstr(getline('.')[0:col('.')-1],'#\d*$') | |
return col('.')-1-strlen(existing) | |
endif | |
ruby << EOF | |
require 'open-uri' | |
require 'json' | |
def issues(repo, token) |
class ProductForm | |
attr_reader :page, :form | |
def initialize(page) | |
@page = page | |
@form = page.find('form.new_product') | |
end | |
def title=(new_title) | |
form.fill_in 'product_title', with: new_title |
#!/usr/bin/env ruby | |
require 'open3' | |
require 'tmpdir' | |
module Literate | |
class Line | |
INDENT = ''.freeze | |
def self.indent(str) |
I hereby claim:
To claim this, I am signing this object:
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" |
#!/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. | |
# |
# Let Ruby ping pingomatic.com | |
require 'xmlrpc/client' | |
XMLRPC::Client.new('rpc.pingomatic.com', '/').call('weblogUpdates.extendedPing', SITE_NAME, SITE_URL, FEED_URL) |
<img\s+((alt|border|class|id|src|usemap|hspace|vspace)="[^"]+"\s*)+> |
pattern = /<img\s+((alt|border|class|id|src|usemap|hspace|vspace)="[^"]+"\s*)+>/ | |
# Invoke sips to try and find the image's original dimensions | |
# This returns both the widht and height. | |
def get_original_size_for(image) | |
output = %x{sips -g pixelWidth -g pixelHeight "#{image}"} | |
if output.scan(/pixelWidth:[^\d]*(\d+).*pixelHeight:[^\d](\d+)/im) | |
return $1, $2 | |
else | |
exit_show_tool_tip "Could not get image size from #{output.inspect}" |
terms = { | |
'ë' => 'ë' | |
} | |
{ | |
'wp_posts' => %w{post_content post_title post_excerpt}, | |
'wp_comments' => %w{comment_author comment_author_url comment_content}, | |
'wp_terms' => %w{name}, | |
'wp_term_taxonomy' => %w{description} | |
}.each_pair do |table, columns| | |
columns.each do |column| |