This file contains hidden or 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
### Ruby | |
## Breakpoint | |
# DEBUG SNIPPET >>> REMOVE <<< | |
require (RUBY_VERSION.match(/1\.8\..*/) ? 'ruby-debug' : 'debugger');Debugger.start; debugger | |
### System |
This file contains hidden or 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
## User configuration | |
{ | |
"bold_folder_labels": true, | |
"caret_style": "phase", | |
"color_scheme": "Packages/User/Monokai Soda.tmTheme", | |
"font_face": "DejaVu Sans Mono", | |
"font_size": 10.0, | |
"highlight_line": true, | |
"ignored_packages": |
This file contains hidden or 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
require 'ostruct' | |
def self.convert_data(elements) | |
results = [] | |
if elements.is_a?(Array) | |
elements.each do |el| | |
results << deep_convert(el) | |
end | |
else |
This file contains hidden or 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
git config --global core.autocrlf false |
This file contains hidden or 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 bash | |
for component in "dtk-client" "dtk-common" "dtk-common-repo" "server" "dtk-repo-manager" "dtk-admin-application" "common" | |
do | |
if [ -d "$HOME/$component" ]; then | |
echo "Updating $HOME/$component ..." | |
git --git-dir="$HOME/$component/.git" --work-tree="$HOME/$component" clean -f | |
git --git-dir="$HOME/$component/.git" --work-tree="$HOME/$component" checkout . | |
git --git-dir="$HOME/$component/.git" --work-tree="$HOME/$component" pull | |
fi | |
done |
This file contains hidden or 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 bash | |
if [ -z $1 ]; | |
then | |
client_branch="master" | |
else | |
client_branch=$1 | |
fi | |
if [ -z $2 ]; | |
then |
This file contains hidden or 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
UBUNTU SET RM ALL | |
alias rm-all='git rm $(git ls-files --deleted)' | |
WINDOWS SET RM ALL | |
doskey rm-all=bash -c "git rm $(git ls-files --deleted)" |
This file contains hidden or 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 | |
require 'pp' | |
# no stdout buffering | |
STDOUT.sync = true | |
# checks for windows/unix for chaining commands | |
OS_COMMAND_CHAIN = RUBY_PLATFORM =~ /mswin|mingw|cygwin/ ? "&" : ";" |
This file contains hidden or 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
# | |
# Takes possible invalid UTF-8 output and ignores invalid bytes | |
# | |
# http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/ | |
def self.normalize_to_utf8_output(response) | |
if response[:data] | |
ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') | |
output = response[:data][:output]||'' | |
valid_output = ic.iconv(output + ' ')[0..-2] |
This file contains hidden or 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
houses = ['Lannister','Stark','Grayjoy','Baratheon','Tyrell','Martel'] | |
players = ['Nera','Asaf','Keno','Aki','Haris','Zaharije'] | |
while !houses.empty? do | |
puts "#{players.delete_at(rand(players.length))} :: #{houses.delete_at(rand(houses.length))}" | |
end |
OlderNewer