Skip to content

Instantly share code, notes, and snippets.

View IceDragon200's full-sized avatar

Corey Powell IceDragon200

View GitHub Profile

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
def parse_ip_string(line)
line.scan(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/).each do |addr|
split_array = addr.split(".")
return split_array.map{ |str| str.rjust(3, '0') }.join '.'
end
nil
end
unless ARGV.size == 1
puts "Invalid number of arguments?"
# Search term parser from https://gist.github.com/1477730
# Modified to allow periods (and other non-letter chars) in unquoted field values
# and field names.
#
# Helper class to help parse out more advanced saerch terms
# from a form query
#
# Note: all hash keys are downcased, so ID:10 == {'id' => 10}
# you can also access all keys with methods e.g.: terms.id = terms['id'] = 10
# this doesn't work with query as thats reserved for the left-over pieces