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
## | |
# Mixin for classes that should have locales and ability for their import/export. | |
# | |
module LocalizableDocument | |
extend ActiveSupport::Concern | |
included do | |
field :default_locale, type: String | |
field :locales, type: Hash, default: {} # { "fr" => { fields_of_document_to_be_translated } } | |
end |
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 CalculatorController < ApplicationController | |
before_action :set_first_number | |
before_action :set_second_number, except: :square_root | |
def addition | |
result = @first_number + @second_number | |
render json: result | |
end | |
def subtraction |
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
require 'nokogiri' | |
require 'open-uri' | |
require 'csv' | |
file = File.new('sto_kyiv.csv', 'a') | |
CSV.open(file, 'w') do |csv| | |
csv << %w(name tel address) |
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
//FALSE = will place into computer sea | |
//TRUE = will place into user sea | |
public void PlaceAllShips(bool usersea) | |
{ | |
int i; | |
ArrayList ships = new ArrayList(); // для зберігання кораблів всіх кораблів, які треба поставити на дошку | |
// додаємо всі кораблі в список | |
for (i = 0; i < ShipConstants.TOTAL_BATTLESHIPS; i++) ships.Add(new BattleShip(0, 0, ShipDirection.Horizontal)); | |
for (i = 0; i < ShipConstants.TOTAL_CRUISERS; i++) ships.Add(new Cruiser(0, 0, ShipDirection.Horizontal)); |