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
# https://github.com/atipugin/telegram-bot-ruby | |
# Uninstall all other telegram bot gems before installing telegram-bot-ruby | |
# All of them use same namespace | |
require 'telegram/bot' | |
token = '' #your token here | |
Telegram::Bot::Client.run(token) do |bot| | |
# we don't have API to setup Faraday connection, so we will override it | |
bot.api.send(:conn).proxy = 'https://90.176.152.12:41586' #get some free proxy here https://www.sslproxies.org/ | |
#test connection |
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
class VkController < ApplicationController | |
skip_before_action :verify_authenticity_token, raise: false | |
def index | |
a = params['name'] | |
return render json: {'key'=>a.reverse!} | |
end | |
def wow | |
a = params['name'] |
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
require 'aws-sdk-s3' | |
require 'net/http' | |
creds = Aws::Credentials.new('', '') | |
s3 = Aws::S3::Resource.new( | |
credentials: creds, | |
endpoint: 'https://storage.yandexcloud.net', | |
region: 'us-east-1' | |
) |
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
createAnimations: function() | |
{ | |
//тут я генерил анимации мальчику и девочке | |
this.createAnimation("side", [1, 7, 1, 13] ); | |
this.createAnimation("up", [2, 8, 2, 14] ); | |
this.createAnimation("down", [ 0, 6, 0, 12 ] ); | |
this.createAnimation("enemy_down", [ 21, 27, 21, 33 ]); | |
this.createAnimation("searcher_side", [4, 10, 4, 16] ); |
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
# Function prints results of block execution | |
# and prints message if no block was given | |
def function_that_can_accept_block(x, &block) | |
return "Wow, no block was given!" unless block_given? | |
block.call(x) | |
end | |
def some_other_function(x) | |
"I am a function and I print my input: #{x}" |
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
def integrating_Monte_Carlo_base(a, b, n = 100, &block) | |
sum = 0 | |
res = 0 | |
# чтобы в цикле не считать этот диапазон | |
range = a..b.to_f | |
for i in 0..n | |
# ваша версия rand не работала, на вход надо либо одно число, либо Range | |
x = rand(range) | |
# debug print | |
p x |
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
def breadth_first_search?(start, goal) | |
visited = Hash.new(false) | |
queue = Queue.new << start | |
visited[start] = true | |
until queue.empty? | |
node = queue.pop | |
return true if node == goal | |
@vertices[node].each { |child| bfs_add_node(queue, visited, child) } | |
end | |
false |
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
a = [[0,1,1], [1,2,2], [2,0,1]] | |
def select_row(a, i, n) | |
row = Array.new(n, 0) | |
a.select{ |x| x[0] == i }.each do |x| | |
row[x[1]] = x[2] | |
end | |
row | |
end |
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
class HomeController < ApplicationController | |
def index | |
end | |
end |
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
a-scene | |
a-box color="#4CC3D9" position=("-1 0.5 -3") rotation=("0 45 0") | |
a-sphere color="#EF2D5E" position=("0 1.25 -5") radius="1.25" | |
a-cylinder color="#FFC65D" height="1.5" position=("1 0.75 -3") radius="0.5" | |
a-plane color="#7BC8A4" height="4" position=("0 0 -4") rotation=("-90 0 0") width="4" | |
a-sky color="#ECECEC" |
OlderNewer