Skip to content

Instantly share code, notes, and snippets.

Avatar

LucasCioffi

  • Scarsdale, NY, USA
View GitHub Profile
@LucasCioffi
LucasCioffi / example_controller.rb
Last active Apr 18, 2019
Here's a controller action you could insert into a Rails project. Accept a block of text and transform it into the language of Fake Grimlock. http://fakegrimlock.com/ Creative Commons Attribution License 3.0.
View example_controller.rb
def fake_grimlockify
if params[:text].present?
@text_output = ""
params[:text].split(" ").each do |word|
if word.size > 4
@text_output += word.singularize.upcase + " " #.force_encoding('UTF-16').gsub("\xE2\x80\x99","").force_encoding('UTF-8')
else
@text_output += word.upcase + " " #.force_encoding('UTF-16').gsub("\xE2\x80\x99","").force_encoding('UTF-8')
end
You can’t perform that action at this time.