This file contains 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
0eNrs3d2uHUeWGOhXafBaasTvWrELMxeG4RkMYLiBHnt8YTQESmJVES2JMkW1XdOoB/B7zLyYn2TOOZTEoyqGdnxZY1S5u9FAtQ55YjEyV0Rm5Jex1/7HF59/9f2rb9++/ubdi1/944vXX7z55rsXv/pP//jiu9e/+eblV49/9s3Lr1+9+NWLb77/4qtXL99++vbVyy/evXn74vefvHj9zZev/uuLX9Xf/90nL1598+71u9ev3jd++uF3n33z/defv3r78Auf/Bjk29ffvvr03ZtPf/P2zffffPnikxffvvnuodmbbx7/oYdQrd3+en7y4ncvfvVpG+uv58M/8uXrt6++eP8r6/ef/FHs9rPYfxyx3vJDxIf//P1HYvTj/v0sWnw82oBo6+d9+9nR1vaR4PP8VJb8heDjI7EDYnPH8zx4XdjxBbFv2vHbnQH2syG7GWC1wAzQo68wvXrRw68fJtjbN5+/+fbN23cfixs/RX2I+fbVf/7+1XfvPvv166/evXr73eMvfff+H3l/efjxuvHJi59+42d/+sO/99Wb37z+7t3rLz59/Icf/9X//P3Lrx769ngxevP264er0ycvvnjz9bcv3758vCD96sX/+vQH3z9eymb5/d89/N/HDuh8trdR+XQNiF400zD7Z9XgMP1n4/MC8z86R4crQDQ9Mbfz4NkxeCv3Li857l5eGlwBnofb3MDahyn/5asvXn/56u2nD9Ps89ffPE2zj0z+/mPA8cfZepyR37x7++arzz5/9duX//D6caL+449xP3v4uy9f/3Bh+McXz396uCD8+vXbh4vIh4XIu999+9inf3j99t33T5P/h06+/41P//3jkuRx/fLu5dMVYJY/uDz89//2/7x4PNw/jPtDmO/fvvzm9fdff/rr71999ekXr7766n28P7q+PP7Bq89+6MzLh5P8uPx58/27b79/94dLpzs9/s3bV6++ef+vfPu7z56uXJ/9+u2brz97/c1DsBe/+vXLr7579XgV+1iSPlzGvn7 |
This file contains 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
# frozen_string_literal: true | |
MAX_COLUMNS_FOR_TABLE = 15 unless defined?(MAX_COLUMNS_FOR_TABLE) | |
DEFAULT_EDITOR = 'code' unless defined?(DEFAULT_EDITOR) | |
class PrettyString < String | |
# https://no-color.org/ | |
NO_COLOR = ENV.key?('NO_COLOR') || `tput colors`.chomp.to_i < 8 unless defined?(NO_COLOR) | |
unless defined?(ANSI_COLORS) | |
ANSI_COLORS = { | |
red: 31, |
This file contains 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 | |
# frozen_string_literal: true | |
require 'uri' | |
require 'json' | |
require 'net/http' | |
require 'optparse' | |
require 'forwardable' | |
COMMAND_NAME = File.basename(__FILE__) |
This file contains 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
echo "Creating $(git rev-parse --git-dir)/hooks/pre-commit.d" | |
mkdir $(git rev-parse --git-dir)/hooks/pre-commit.d | |
echo "Downloading rubocop hook into $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop" | |
wget -O $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop https://gist.githubusercontent.com/brand-it/93d04c839238283e3e756811b9c9cee0/raw/616bf812b58bcefc52d564ed8abacbf30966193c/pre-commit.d_rubocop | |
echo "Changing rubocop into a executable $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop" | |
chmod 755 $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop | |
echo "adding hooks_directory variable to $(git rev-parse --git-dir)/hooks/pre-commit if it does not already exist" | |
grep -qxF 'hooks_directory=$(git rev-parse --git-dir)/hooks/pre-commit.d' $(git rev-parse --git-dir)/hooks/pre-commit || echo 'hooks_directory=$(git rev-parse --git-dir)/hooks/pre-commit.d' >> $(git rev-parse --git-dir)/hooks/pre-commit | |
echo "adding $hooks_directory/rubocop variable to $(git rev-parse --git-dir)/hooks/pre-commit if it do |
This file contains 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 | |
# frozen_string_literal: true | |
require 'net/http' | |
require 'open-uri' | |
require 'tempfile' | |
require File.expand_path('ruby_bash', __dir__).to_s | |
options = {} |
This file contains 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
def format_as_table(header, data) | |
total_columns = data.first.size | |
data.insert(0, header) if header | |
column_widths = total_columns.times.map { |col| data.map { |row| row[col].size }.max } | |
if header | |
data.insert(1, Array.new(total_columns, '-').zip(column_widths).map { |a, b| a * b }) | |
end | |
data.map do |row| | |
row.zip(column_widths).map do |cell, width| | |
cell.to_s.ljust(width) |
This file contains 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
# PrettyString.new('something').blue | |
# PrettyString.new('something').red | |
# PrettyString.new('something').green | |
# PrettyString.new('something').yellow | |
# PrettyString.new('something').magenta | |
# PrettyString.new('something').white | |
class PrettyString < String | |
# https://no-color.org/ | |
NO_COLOR = ENV.key?('NO_COLOR') || `tput colors`.chomp.to_i < 8 | |
ANSI_COLORS = { |
This file contains 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
# A nice way to add color to strings | |
class PrettyString < String | |
# https://no-color.org/ | |
NO_COLOR = ENV.key?('NO_COLOR') || `tput colors`.chomp.to_i < 8 | |
ANSI_COLORS = { | |
white: 0, | |
red: 31, | |
green: 32, | |
yellow: 33, | |
blue: 34, |
This file contains 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 | |
# frozen_string_literal: true | |
require 'json' | |
def files | |
@files ||= begin | |
`git diff --staged --name-only --cached`.split("\n").reject do |file| | |
!File.exists?(file) | |
end | |
end |
This file contains 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 'fileutils' | |
require 'tempfile' | |
# cn = '*.tb.local.vhost' | |
# server_name = 'dev.tb.local.vhost' | |
# admin_server_name = 'admin.tb.local.vhost' | |
NewerOlder