// Инициализировать переменную значением undefined
var city;
// Определить функцию result
var result = function () {
// присвоить переменной значение
city = "Moscow";
}
// Вызвать функцию alert с параметром city
alert(city);
get /products/*permalink
process puma
with pidfile /path/to/pid/file
start program = "/bin/su -u deployer -c 'cd /srv/www/myapp/current && ( RACK_ENV=production ~/.rvm/bin/rvm default do bundle exec puma -C /srv/www/myapp/shared/puma.rb )'
stop program = "..."
group puma
"
Цель: продать разработку современного сайта.
require 'sidekiq'
require 'awesome_model'
AwesomeModel # => ???
...
AwesomeWorker.perform_async ::AwesomeModel.new.object_id.to_i
flash.now.error = 'Error message'
$("#error").text('Error message').show();
как их использовать для группировки кода в Rails, не создавая gem
# app/models/department.rb
class Department < ActiveRecord::Base
has_many :contracts
has_many :invoices, through: :contracts
end
# app/controllers/departments_controller.rb
def index
@departments = Department.includes(contracts: [:invoices]).all
end
# app/views/departments/index.html.haml
%table
%tr
%td Name
%td Contracts
= render @departments
# app/views/departments/_department.html.haml
%tr
%td= department.name
%td
= render department.contracts
# app/views/contracts/_contract.html.haml
= contract.name
- if contract.invoices.present?
= render contract.invoices
- else
No invoices on this contract.
%hr/
# app/views/invoices/_invoice.html.haml
= invoice.total_sum
module Magick
@@name = "SouthEastGravity"
end
class MagickNameGetter
include Magick
def self.name
@@name
end
end
MagickNameGetter.name
function say() {
return function (name) {
return greet + ' ' + name;
};
}
var greet = 'Hello';
var en = say();
console.log(say('John'));
console.log(say('Martin'));