Skip to content

Instantly share code, notes, and snippets.

AlxGolubev / classes.rb
Created Oct 11, 2021
For students lecture
View classes.rb
class Task
attr_accessor :title, :completted
def initialize(title)
@title = title
@completted = false
class TodoList

Часть 1

Необходимо написать на чистом Руби класс, который реализует следующее: Вводим в консоли параметры перевозимого груза - вес(кг), длина(см), ширина(см), высота(см) Вводим в консоли название пункта отправления и название пункта назначения Через или любой другой сервис со схожим функционалом мы расчитываем расстояние, которое груз должен преодолеть

Результатом работы класса должен быть хеш следующего вида -> {weight: 1, length: 1, width: 1, height: 1, distance: 1, price: 1}

  • Расчет цены:
View test.js
import React from 'react'
import ACTIONS from 'store/actions'
const Navbar = (props) => (
const { user, role } = props
const logout = () => {
diaptch(ACTIONS.LOGOUT, { user: user })
return (
<div class="navbar">
<Link to="/profile" onClick={logout()}>Profile</Link>
View router.rb
module Resource
def connection(routes)
if routes.nil?
puts "No route matches for #{self}"
loop do
print 'Choose verb to interact with resources (GET/POST/PUT/DELETE) / q to exit: '
verb = gets.chomp
View helpers.js
import {
} from 'routes/AdvanceSearch/helpers/Utils'
export const ADVANCE_SEARCH_FILTER_FORM_INITIAL = generateInitialObjForAdvSearchFilters(
View recursive-sorting.js
const R = require('ramda')
const kind = 'desc'
let collection = {
nodes: [
name: 'Items',
children: [
AlxGolubev / update-json-in-postgres.sql
Created Jun 26, 2017
How to create a new key in existing record with JSONB field in Postgres
View update-json-in-postgres.sql
UPDATE users SET preferences = jsonb_set(to_jsonb(preferences), '{some_preference}'::text[], 'true'::jsonb, true);
AlxGolubev / jobs_mover.rb
Last active Jun 5, 2017
Class for case when queue for worker was changed but there are a lot of scheduled jobs in queue previously used
View jobs_mover.rb
class JobsMover
def initialize(original_queue, klass)
@original_queue =
@klass = klass
def move
jobs = { |job| job.item['class'] == @klass }
View exmpl.json
"name":"Software Licensing Agreement",
AlxGolubev / rubymine.vmoptions
Last active Feb 23, 2017
Rubymine Config for Memory Optimization
View rubymine.vmoptions