Skip to content

Instantly share code, notes, and snippets.

View valeksiev's full-sized avatar

Vladimir Aleksiev valeksiev

View GitHub Profile
name = []
def set_name(self, user_name):
self.name.append(user_name)
return len(self.name) - 1
def get_name(self, user_id):
if user_id >= len(self.name):
return 'There is no such user'
else:
@valeksiev
valeksiev / index.html
Last active April 13, 2021 15:26
forEach vs filter + concat vs filter + splat (http://jsbench.github.io/#c46bc2594b8941843f3794c26cef99b9) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>forEach vs filter + concat vs filter + splat</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@valeksiev
valeksiev / smaple_spec.rb
Last active November 17, 2015 14:11
A bit more extended sample spec for Ruby@FMI fifth task
describe ObjectStore do
RSpec::Matchers.define :be_success do |with_message: '', and_result: false|
match do |actual|
without_result = actual.message == with_message &&
actual.success? == true &&
actual.error? == false
return without_result unless and_result
@valeksiev
valeksiev / sample_spec.rb
Last active October 23, 2015 13:32
A bit more extended sample spec for Ruby@FMI third task
require 'prime'
describe 'Third task' do
describe RationalSequence do
it 'can calculate the first rational number' do
expect(RationalSequence.new(1).to_a).to eq ['1/1'.to_r]
end
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')