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 'ruby-debug' | |
require 'rainbow' | |
require 'colorize' | |
def result(message) | |
msg = message.to_a.map(&:strip) | |
stats = msg.last.split(",") | |
errors = stats[-1].split(" ").first.to_i | |
failures = stats[-2].split(" ").first.to_i | |
color = (failures >= 1||errors>=1) ? :"yellow" : :"green" |
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
#!/bin/bash | |
# installed as root in /root/backups/mysql | |
# needs to be installed via cron | |
# will run at 3:10 am every morning | |
# | |
# crontab -e | |
# 10 3 * * * /root/mysql_backups.sh > /backups/status.log | |
# change DB_USER and DB_PASSWD as per configuration |
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
#!/bin/sh -e | |
#/ Usage: pow [on|off] | |
#/ Toggle between running Pow (http://pow.cx) and Apache on Mac OS X. | |
# Show Usage | |
function usage { | |
grep '^#/' "$0" | cut -c4- | |
exit 2 | |
} | |
[ -z "$1" -o "$1" = "--help" ] && usage |
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
# Gemfile | |
# Relevant Capistrano gems | |
gem 'capistrano' | |
gem 'capistrano-ext' | |
gem 'capistrano_colors' |
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 'sinatra' | |
get "/" do | |
@person = Person.new | |
"Hello #{@person.name}. You are #{@person.born_at} years old!" | |
end |
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 'yaml' | |
# Nested YAML structure from something-nested.yml | |
# | |
# nested: | |
# key: value | |
# key_two: value_two | |
# Procedural Approach to building a single Hash from nested YAML data structure. | |
@yaml = YAML.load_file("something-nested.yml") |
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
#test/test_helper.rb | |
require 'test/unit/ui/console/testrunner' | |
class Test::Unit::UI::Console::TestRunner | |
def guess_color_availability | |
true | |
end | |
end | |
#Gemfile |
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
<script> | |
// coffeescript | |
$ -> | |
$("#project_fields .project").live "blur", (event)-> | |
// alert($(this).text()) | |
$field = $(this) | |
$project_id = $(this).data("project-id") | |
$data = $(this).text() |
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
"Scs Epc Score".gsub (/scs|epc/i) { |i| i.upcase } | |
# => SCS EPC Score |
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
# recursively delete original files after a git merge failure | |
find . -name *.orig -delete |
OlderNewer