Created
November 13, 2011 17:12
-
-
Save gailimov/1362347 to your computer and use it in GitHub Desktop.
Pretty awesome parser of advices from http://fucking-great-advice.ru
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
# coding: utf-8 | |
# Pretty awesome parser of advices from http://fucking-great-advice.ru | |
# PHP version from Dmitry Zudochkin: https://gist.github.com/1303241 | |
# Author: Kanat Gailimov <gailimov@gmail.com> (http://gailimov.info) with love :) | |
require 'json' | |
require 'open-uri' | |
require 'cgi' | |
hash = JSON.parse(open('http://fucking-great-advice.ru/api/random').read) | |
hash['text'] = CGI.unescapeHTML(hash['text'].gsub(' ', ' ').gsub(/&#[0-9]|;/, '')) | |
puts hash['text'] |
теперь занеси его в ~/.bashrc, чтобы при входе на сервак отображался рандомный совет )
ага, занесу)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Джаст фор фан поиграться с рубями :)