Skip to content

Instantly share code, notes, and snippets.

([xml] (-join (svn log -r $version:HEAD --xml))).log.logentry | ? { @('zszugyi', 'author2') -contains
$_.author } | foreach-object { svn diff --no-diff-deleted --summarize -r ("" + (-1 + $_.revision) + ":" + $_.revision) }
> .\changed_files.txt
Get-Content .\changed_files.txt | foreach { $_.split(" ")[7] } |sort |Get-Unique
@zszugyi
zszugyi / add_yard_docs.py
Created May 3, 2012 23:47
sublime text 2 plugin that adds yard docs to the selected Ruby or Python methods
import sublime, sublime_plugin
import re
class AddYardDocs(sublime_plugin.TextCommand):
def run(self, edit):
for selection in reversed(self.view.sel()):
current_line_region = self.view.line(selection)
current_line = self.view.substr(current_line_region)
if 'def ' not in current_line:
continue
@zszugyi
zszugyi / number_selections.py
Created May 3, 2012 18:02
sublime_text2 plugin to add numbers to the selected locations in the current view
import sublime, sublime_plugin
class NumberSelections(sublime_plugin.TextCommand):
def run(self, edit):
selections = self.view.sel()
for i in reversed(range(len(selections))):
selection = self.view.sel()[i]
self.view.insert(edit, selection.begin(), "%d" % (i + 1))
@zszugyi
zszugyi / gist:1430850
Created December 4, 2011 18:04
sublime_text2 command to wrap the current selection with '#{' and '}' when '#' is pressed
{ "keys": ["#"], "command": "insert_snippet", "args": {"contents": "#{${0:$SELECTION}}"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
]
}
@zszugyi
zszugyi / gist:1407691
Created November 30, 2011 02:18
class to convert the public key part of an RSA key to the .NET XML format
require 'openssl'
require 'base64'
class RSAKeyToXmlConverter
def initialize rsa_key_string
@key = OpenSSL::PKey::RSA.new(rsa_key_string)
end
def to_public_key