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
this is my deploy.rb | |
require 'mina/bundler' | |
require 'mina/rails' | |
require 'mina/git' | |
require 'mina/rbenv' | |
require 'mina_sidekiq/tasks' | |
require 'mina/unicorn' | |
# require 'mina/rbenv' # for rbenv support. (http://rbenv.org) | |
# require 'mina/rvm' # for rvm support. (http://rvm.io) |
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
nano /home/deployer/YOUR_APP/shared/config/database.yml | |
nano /home/deployer/YOUR_APP/shared/config/secrets.yml | |
i have one quis also this two file need edit only on my server or i can edit in on my local computer also before mina deploy |
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
Create a list of the intervals of the day. | |
Field 1: Beginning of the day (From, the time in 24-hour format) | |
Field 2: End of the working day (Till, the 24-hour format) | |
Field 3: Divider partition hour intervals (integer, usually divider 60) | |
Button: Create a list of slots | |
class CreateWorkingDays < ActiveRecord::Migration | |
def change | |
create_table :working_days do |t| | |
t.datetime :start_of_day |
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
rails new test_app | |
cd test_app | |
echo "gem 'devise', '~> 3.0.0'" >> Gemfile | |
bundle install | |
rails g devise:views | |
gem install html2slim | |
for file in app/views/devise/**/*.erb; do erb2slim $file ${file%erb}slim; done |
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
# Тестовое задание | |
Для выполнения этого задания сделайте форк этого репозитория, и по готовности сделайте пулл реквест. Руби 2.2 и только std-lib | |
## Вычисление выражения в обратной польской записи | |
Написать программу, которая вычисляет выражения в обратной польской нотации. | |
Например, если на вход ей дать выражение 5 1 2 + 4 * + 3 - (что эквивалентно 5 + ((1 + 2) * 4) - 3 в нормальной записи), то она даст ответ 14. Валидными операциями являются +, -, \*, /, ^. |
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
# 3. Please refactor User#from_omniauth method. Currently it's hard to read. Please make it more clear. | |
def self.from_omniauth(auth, organization) | |
user = User.where(provider: auth.provider, uid: auth.uid).first | |
if user | |
return user | |
else | |
registered_user = User.where(email: auth.info.email).first | |
if registered_user |
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
=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') |
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 OrderItemsValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) | |
raise 'Order must be one item from each menu!' unless each_menu?(value) | |
raise 'Items must be from today\'s menu!' unless contains_in_today_menu?(value) | |
raise 'Order can contain only one item for each menu!' unless only_one_per_menu?(value) | |
rescue Exception => e | |
record.errors[attribute] << (options[:message] || e.message) | |
end | |
private |
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
# Deploy | |
require 'mina/bundler' | |
require 'mina/rails' | |
require 'mina/git' | |
require 'mina/rbenv' | |
set :rails_env, 'production' | |
set :deploy_to, 'deploy_location_without_current' | |
set :app_path, 'app_location' | |
set :user, 'alif' |
OlderNewer