Skip to content

Instantly share code, notes, and snippets.

Aidan Rudkovskyi rudkovskyi

Block or report user

Report or block rudkovskyi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gspeech.rb
# encoding: UTF-8
#
# Example of usage:
# 1.9.3p125 :003 > t = GoogleSpeech.load "#{Dir.home}/text.txt"
# => #<GoogleSpeech:0x007f89e38ba690 @text="Hello World it's just a text file. Hey yey!!!", @lang="en">
# 1.9.3p125 :004 > t.save("out.mp3")
# => "out.mp3"
#
# 1.9.3p125 :005 > f = GoogleSpeech.new "Thats shit but I love it"
@rudkovskyi
rudkovskyi / gist:4369670
Created Dec 24, 2012
Google Translation.
View gist:4369670
# encoding: UTF-8
#
#1.9.3-p327 :013 > t = GTranslate.new "This stuff is pretty unexpected!", "pl"
#=> #<GTranslate:0x0000000195b0b8 @lang="pl", @text="This stuff is pretty unexpected!", @response=["[[[\"Ten materiał jest dość nieoczekiwanego!\",\"This stuff is pretty unexpected!\",\"\",\"\"]],,\"en\",,[[\"Ten materiał jest\",[5],1,0,802,0,3,0],[\"dość\",[6],1,0,792,3,4,0],[\"nieoczekiwanego!\",[7],1,0,726,4,6,0]],[[\"This stuff is\",5,[[\"Ten materiał jest\",802,1,0],[\"Tych rzeczy jest\",0,1,0],[\"Te rzeczy są\",0,1,0]],[[0,13]],\"This stuff is pretty unexpected!\"],[\"pretty\",6,[[\"dość\",792,1,0],[\"całkiem\",9,1,0],[\"pretty\",0,1,0],[\"śliczny\",0,1,0],[\"ładna\",0,1,0]],[[14,20]],\"\"],[\"unexpected !\",7,[[\"nieoczekiwanego!\",726,1,0]],[[21,32]],\"\"]],,,[[\"en\"]],28]"]>
#1.9.3-p327 :014 > t.parse[0]
# => ["Ten materiał jest dość nieoczekiwanego!"]
#
class GTranslate
require 'net/http'
View linked_list.rb
class Node
attr_accessor :next_item, :value
def initialize(next_item, value)
@next_item = next_item
@value = value
end
def reversed
@a = []
View custom_max.rb
class Array
def custom_max
idx = self[0] > self[1] ? 1 : 0
self.delete_at(idx)
self.length <= 1 ? self[0] : self.custom_max
end
end
a = [4,3,6,1,44,4,8,31,41,2,1,98,2,3,1,8,32,1,4,5,6]
View example.rb
class Collection
class Instance
def initialize(id)
@id = id
end
def say
"I am #{@id}"
end
end
View download_ny_photos_2.rb
# Adding RMagick to combine images
require 'open-uri'
require 'uri'
require 'rmagick'
class PhotoDownloader
RESOURCE = 'http://access.nypl.org/image.php/'
def initialize(id, zoom, dimension)
View download_ny_photos_final.rb
# https://theoryofe.co/2016/10/17/reverse-engineering-by-using-chrome/
require 'open-uri'
require 'uri'
require 'rmagick'
class PhotoDownloader
RESOURCE = 'http://access.nypl.org/image.php/'.freeze
def initialize(id, zoom)
View downloads_ny_photos_step_1.rb
# First quick draft
require 'open-uri'
require 'uri'
class PhotoDownloader
RESOURCE = 'http://access.nypl.org/image.php/'
def initialize(id, dimension)
@id = id
View download_ny_photos_step_2.rb
# Adding RMagick to combine images
require 'open-uri'
require 'uri'
require 'rmagick'
class PhotoDownloader
RESOURCE = 'http://access.nypl.org/image.php/'
def initialize(id, zoom, dimension)
View bingy.rb
require 'open-uri'
class Bingy
LANDING_PAGE = 'http://www.bing.com/translator'.freeze
SPEAK_URL = LANDING_PAGE + '/api/language/Speak?locale=en-US&media=audio/mp3'
def initialize(text, gender = 'male')
@user_agent = 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36'
@params = { text: text, gender: gender }
end
You can’t perform that action at this time.