Skip to content

Instantly share code, notes, and snippets.

@kkosuge
Forked from rummelonp/glitch.rb
Created December 11, 2012 04:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkosuge/4255854 to your computer and use it in GitHub Desktop.
Save kkosuge/4255854 to your computer and use it in GitHub Desktop.
テキストをグリッチ(参考: http://nekogata.hatenablog.com/entry/2011/11/13/040535
# -*- coding: utf-8 -*-
class String
GLITCH_CHARS = ("\u0300".."\u036f").to_a
def glitch
self.each_char.reduce("") do |r, c|
r + c + rand(2).times.map { GLITCH_CHARS.sample }.join('')
end
end
end
puts "ニャーン".glitch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment