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 color(index, text) | |
normal = "\e[#{index}m#{text}\e[0m" | |
bold = "\e[#{index}m\e[1m#{text}\e[0m" | |
"#{normal} #{bold} " | |
end | |
if ARGV.empty? | |
puts "Usage: ruby #{__FILE__} NAME" | |
exit | |
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
require 'parser/current' | |
class ExtractRenderUpdate < Parser::Rewriter | |
attr_reader :current_action | |
attr_reader :extracted_sources | |
def on_block(node) | |
replace_with_render_file(node) | |
super | |
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
=begin | |
USAGE: ruby-rewrite -l controller_actions_keyword_args.rb -m <FILE> | |
This rewriter moves your Rails controller tests from `get action, params, session, flash` to | |
`get action, params: params, session: session, flash: flash`. | |
Which is needed if you see the following message in your Rails 5.0 tests : | |
DEPRECATION WARNING: Using positional arguments in functional tests has been deprecated, | |
in favor of keyword arguments, and will be removed in Rails 5.1. |
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
require_relative 'rewrite_rjs' | |
require_relative 'jquery_hack_generator' | |
filenames = ARGV | |
filenames.each do |filename| | |
source = File.read filename | |
erbified_source = rewrite(source) | |
puts erbified_source if ENV['DEBUG'] | |
generator = JqueryHackScriptGenerator.new(nil) {page| eval(erbified_source)} |
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
class Tree | |
attr_reader :children, :item | |
def initialize(item) | |
@item = item | |
@children = [] | |
end | |
def add(child_item) | |
children << Tree.new(child_item) |
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
export beetil_api_key=YOUR_BEETIL_API_KEY_HERE | |
# extracts the branch name | |
function plain_git_branch { | |
git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///' | |
} | |
# extracts the part of the branch name that could be a beetil number | |
function beetil_number_from_git_branch { | |
plain_git_branch 2> /dev/null | cut -c2-9 |
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
https://github.com/bagedevimo/chicken-soup-people | |
https://github.com/aidancopps/rocket | |
https://github.com/dillonsue2288/MakeRobot | |
https://github.com/purederp/robo | |
https://github.com/fesherman/First-man-on-the-moon | |
https://github.com/LoveBug/Wellington-Sights |
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
# Require this file, or put this in where Rails will auto load it. | |
class UrlValidator < ActiveModel::EachValidator | |
def initialize(options) | |
super | |
@domain = options[:domain] | |
@permissible_schemes = options[:schemes] || %w(http https) | |
@error_message = options[:message] || 'is not a valid url' | |
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
require 'mail' | |
module Savon | |
module SOAP | |
class Response | |
def multipart? | |
http.headers["Content-Type"] =~ /^multipart/ | |
end | |
def boundary |
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
sudo gem install unicorn | |
sudo echo "You have been unicorn\'ed" |
NewerOlder