Skip to content

Instantly share code, notes, and snippets.

@ravicious
Created December 4, 2008 19:04
Show Gist options
  • Save ravicious/32024 to your computer and use it in GitHub Desktop.
Save ravicious/32024 to your computer and use it in GitHub Desktop.
=begin
By Ravicious aka Torian (ID 386)
http://ravsite.net/
Umieść swój ASCII art w pliku "ascii.txt" w tym samym folderze, co skrypt. Następnie odpal skrypt i otwórz ponownie plik, a później możesz to wkleić do swojego profilu ;)
Thanks for:
- Robert Evans
http://www.megasolutions.net/ruby/search-a-file-and-replace-text-50116.aspx
- Hipekhop
http://orodlin.webhost.pl/forum/index.php?topic=1169.msg16585#msg16585
=end
def ChangeOnFile(file, regex_to_find, text_to_put_in_place)
text = File.read file
File.open(file, 'w+'){|f| f << text.gsub(regex_to_find, text_to_put_in_place)}
end
ChangeOnFile('ascii.txt', / /, "[color=#000000]- [/color]")
ChangeOnFile('ascii.txt', /\[\/color\]\[color=#000000\]/, "")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment