Skip to content

Instantly share code, notes, and snippets.

View kuahyeow's full-sized avatar

Thong Kuah kuahyeow

View GitHub Profile
@kuahyeow
kuahyeow / extract_render_update.rb
Created November 8, 2017 08:11
Extracts `render :update` blocks from controllers
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
@kuahyeow
kuahyeow / name_in_lights.rb
Created May 15, 2018 02:54
A little script to delight the kids - increase the font size in your terminal !
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