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 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 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"
View example.rb
class Collection
class Instance
def initialize(id)
@id = id
end
def say
"I am #{@id}"
end
end
@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 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_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_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 largest_series_product.py
def largest_product(num_string, series):
if series == 0:
return 1
end = series
products = []
for n in range(len(num_string)):
selection = num_string[n:end]
View wordpress.rb
require_relative 'request'
require 'json'
module Requests
class Wordpress
WEBSITE_URL = 'https://public-api.wordpress.com/rest/v1.1/sites/xxx/stats?http_envelope=1'.freeze
def initialize
super(WEBSITE_URL)
chrome!
You can’t perform that action at this time.