Skip to content

Instantly share code, notes, and snippets.

View vsvld's full-sized avatar
🦚

lo w vsvld

🦚
  • maincast
  • kyiv
View GitHub Profile
##
# 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
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
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)
//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));