- Необходимо реализовать Web App используя RoR.
- Модели: Category (id, name), Product (id, name, price, category_id). Product belong to Category. Category has many products.
- В seeds.rb создать 10 категорий с рандомными именами и 1000 продуктов с рандомными именами, ценой и рандомной категорией используя https://github.com/thoughtbot/factory_bot_rails для создания сущностей и https://github.com/stympy/faker для заполнения полей рандомными значениями.
- Реализовать страницу показа списка продуктов в таблице со следуюшими колонками: ID, Product Name, Category Name, Price.
- Добавить пагинацию при показе списка продуктов по 50 продуктов на страницу.
- Релизовать сортировку продуктов при клике по названю поля (при первом клике - asc, при втором клике на ту же колонку - desc).
- Реализовать фильтр продуктов по цене (от - до), имени категории (селектбокс с выпадающим списком названий категорий), именем продукта (текстовое поле которое может содержать часть имени продукта).
- Написать тесты на данный функ
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
# 9 x 9 | |
# | |
# x x x x x x x x x | |
# x x x x x x x x x | |
# x 1 x x x x x x 2 | |
# x x x x x x x x x | |
# x x x x x x x x x | |
# x x x x x x x x x | |
# x x x x x x x x x | |
# x x x x x x x x x |
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
image: "ruby:2.4.1" | |
services: | |
- postgres:latest | |
variables: | |
POSTGRES_USER: runner | |
POSTGRES_PASSWORD: password | |
before_script: |
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
FROM ruby:2.2.3 | |
RUN apt-get update -qq | |
RUN apt-get install -y -qq build-essential | |
RUN apt-get install -y -qq nodejs | |
RUN apt-get install -y -qq libpq-dev | |
ENV APP_HOME /app | |
ENV BUNDLE_PATH /bundle | |
ENV BUNDLE_JOBS 5 |
SSH into Root
$ ssh [email protected]
Change Root Password
###Тестовое задание
#####1. Добавить к классу Array метод, который будет возвращать индекс элемента, при условии что массив может быть вложенным
a = [
'hash',
'array',
[
'map',
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
require 'sequel' | |
DB ||= Sequel.connect ENV['DATABASE_URL'] | |
class Resource < Sequel::Model | |
include Sequel.inflections | |
def after_save | |
db.notify channel | |
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
—– BEGIN LICENSE —– | |
K-20 | |
Single User License | |
EA7E-940129 | |
3A099EC1C0B5C7C5 33EBF0CF BE82FE3B |
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
#!/bin/sh | |
c_koef=1000; | |
while read line; do | |
if [ "$line" = "${line%#*}" -a "$line" ]; then | |
echo "CPU temperature is:" | |
awk 'BEGIN{print '"$line"'/'"$c_koef"'}' | |
fi | |
done < /sys/class/thermal/thermal_zone0/temp |
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
load 'deploy' | |
# Uncomment if you are using Rails' asset pipeline | |
load 'deploy/assets' | |
load 'config/deploy' # remove this line to skip loading any of the default tasks |