Skip to content

Instantly share code, notes, and snippets.

View DuckOfDoom's full-sized avatar

Vladimir Yanovsky DuckOfDoom

View GitHub Profile
@DuckOfDoom
DuckOfDoom / grepout
Last active December 2, 2016 16:16
Checking out git branches with grep
#!/usr/bin/env ruby
command = 'git branch -a'
unless ARGV[0].nil?
command += ' | grep ' + ARGV[0]
end
lines = IO.popen(command).readlines
if lines.count == 0
@DuckOfDoom
DuckOfDoom / TypeMembersLayout
Last active August 29, 2015 14:18
Type Members Layout
<?xml version="1.0" encoding="utf-8" ?>
<!--
I. Overall
I.1 Each pattern can have <Match>....</Match> element. For the given type declaration, the pattern with the match, evaluated to 'true' with the largest weight, will be used
I.2 Each pattern consists of the sequence of <Entry>...</Entry> elements. Type member declarations are distributed between entries
I.3 If pattern has RemoveAllRegions="true" attribute, then all regions will be cleared prior to reordering. Otherwise, only auto-generated regions will be cleared
I.4 The contents of each entry is sorted by given keys (First key is primary, next key is secondary, etc). Then the declarations are grouped and en-regioned by given property
@DuckOfDoom
DuckOfDoom / linecounter.rb
Last active August 29, 2015 14:15
Line counter
dirs = Dir.glob('**/Assets/Scripts') + Dir.glob('**/Assets/Tests')
files = []
dirs.each do |d|
files.concat(Dir.glob( File.join(d, '**', '*.cs')))
end
filesCount = files.length
linesCount = 0