This file contains hidden or 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
sum = 0 | |
array = [1,2,3] | |
array.each {|a| sum+=a} | |
#array.each do |a| | |
# sum+=a | |
#end | |
puts sum #--> 6 |
This file contains hidden or 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
angular.module('filmer').directive 'document', -> | |
template = () -> | |
'<canvas id="editorWindow" style="background-color: rgba(255, 194, 93, 0.4)" width ="500px" height = "500px"></canvas>' | |
getMousePos = (canvas, evt) -> | |
rect = canvas.getBoundingClientRect() | |
return { | |
x: evt.clientX - rect.left | |
y: evt.clientY - rect.top |
This file contains hidden or 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
describe 'Expectation Matchers' do | |
describe 'equivalence matchers' do | |
it 'will match loose equality with #eq' do | |
a = "2 cats" | |
b = "2 cats" | |
expect(a).to eq(b) | |
expect(a).to be == b # synonym for #eq |
This file contains hidden or 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 find(n) | |
unless n < 2 || n % 2 == 0 && n != 2 | |
arr = [] | |
n.times do |a| | |
arr.push(a) if a < (Math.sqrt(n) + 1).floor && a > 1 | |
end |
This file contains hidden or 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
until $c == num | |
find(c) | |
c += 1 | |
end | |
# Тоже что и: | |
while $c < nume | |
find(c) | |
c += 1 |
This file contains hidden or 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
Rails.application.routes.draw do | |
mount_devise_token_auth_for 'User', at: 'auth', controllers: { | |
sessions: 'overrides/sessions' | |
} | |
root 'application#angular' | |
resource :messages | |
# Redirect anything to root | |
get '*path' => redirect('/') |
This file contains hidden or 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
STDOUT.sync = true # DO NOT REMOVE | |
# Don't let the machines win. You are humanity's last hope... | |
@width = gets.to_i # the number of cells on the X axis | |
@height = gets.to_i # the number of cells on the Y axis | |
cells = Array.new | |
@height.times do | |
line = gets.chomp # width characters, each either 0 or . |
This file contains hidden or 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
STDOUT.sync = true # DO NOT REMOVE | |
# Don't let the machines win. You are humanity's last hope... | |
@width = gets.to_i # the number of cells on the X axis | |
@height = gets.to_i # the number of cells on the Y axis | |
@cells = Array.new | |
@height.times do | |
line = gets.chomp # width characters, each either 0 or . |
This file contains hidden or 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
# Auto-generated code below aims at helping you parse | |
# the standard input according to the problem statement. | |
@n = gets.to_i # the number of temperatures to analyse | |
@temps = gets.chomp # the n temperatures expressed as integers ranging from -273 to 5526 | |
if @n == 0 | |
puts 0 | |
return | |
end |
This file contains hidden or 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
STDOUT.sync = true # DO NOT REMOVE | |
# Auto-generated code below aims at helping you parse | |
# the standard input according to the problem statement. | |
@road = gets.to_i # the length of the road before the gap. | |
@gap = gets.to_i # the length of the gap. | |
@platform = gets.to_i # the length of the landing platform. | |
required_speed = @gap + 1 |
OlderNewer