-
Create one-click install Dokku droplet don't associate any ssh keys on this step
-
Enter ssh-keygen -t rsa on your local machine and follow instructions
-
Enable ssh access to remote server without password from your machine: cat ~/.ssh/id_rsa.pub | ssh [email protected] "sudo sshcommand acl-add dokku dokku"
-
Login to remote server ssh root@YOUR_SERVER_IP
-
Create new Dokku app:
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
def multiply m_1, m_2 | |
m_2 = m_2.reduce(:zip).map(&:flatten) | |
m_1.collect do |i| | |
m_2.collect do |j| | |
i.zip(j).map{|k| k.reduce(:*)}.reduce(:+) | |
end | |
end | |
end | |
m_1 = Array.new(2){Array.new(2){rand}} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int i,j; | |
int a[5][6],b[6],c[6]; | |
printf("array A input: \n"); | |
for (i=0; i<5; i++) { |
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
def split_name(name) # Метод для разделения полного ФИО на отдельные объекты | |
data = name.split(' ') # Превращаем полное имя в массив | |
result = { # Помещаем разделенные данные в хэш | |
lastname: data[0], | |
firstname: data[1], | |
secondname: data.drop(2).map(&:inspect).join(' ').gsub('"', '') # Оставляем в secondname ячейки массива после второй, убираем лишние символы | |
} | |
return result.map{|i,j|"#{i}: #{j}\n"}.join(' ') # Возврат хэша в читабельном виде, убираем лишние символы и т.д. | |
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
require 'csv' | |
CSV.open('./public/russia_hotels.csv', 'r').each do |row| | |
Hotel.create(:ean_hotel_id => row[0],:name => row[1],:name_ru => row[2],:address=>row[3],:address_ru=>row[4],:city=>row[5],:city_ru=>row[6],:latitude=>row[8],:longitude=>row[9],:airport=>row[10],:nearby=>row[11],:nearby_ru=>row[12],:high_rate=>row[13],:low_rate=>row[14]) | |
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
[ | |
{ | |
"region": "Москва и Московская обл.", | |
"city": "Москва" | |
}, | |
{ | |
"region": "Москва и Московская обл.", | |
"city": "Абрамцево" | |
}, |
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
<div class="optionals"> | |
<% @sections.each_with_index do |section, index| %> | |
<div class="field"> | |
<label><b><%= section.name %></b></label> | |
<%= hidden_field_tag "hotel[option_ids][]", nil %> | |
<% section.options.each do |option| %> | |
<label><%= check_box_tag "hotel[option_ids][]" %> | |
<%= option.name %></label> | |
<% end %> | |
</div> |
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
<? | |
/** | |
** Сохранение данных о СПО в базе: | |
** 1. http-запрос | |
** 2. xml-парсинг | |
** 3. вставка в mysql:masterweb_ext.mwToursInfo | |
**/ | |
define('INC_DIR', dirname(__FILE__).'/../includes/'); | |
require_once INC_DIR.'auto_prepend.php'; | |
require_once INC_DIR.'showcase/params.php'; |
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
<table> | |
<% | |
dates_from = @soap_daily_price.map{|item| item[:date_from]}.uniq.sort | |
dates_to = @soap_daily_price.map{|item| item[:date_to]}.uniq | |
rooms_types = @soap_daily_price.map{|item| [item[:room_type_name],item[:room_category_name]]}.uniq | |
%> | |
<tr> | |
<td>empty</td> |
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
<% if @soap_daily_price != nil %> | |
<div class="daily"> | |
<h2>Суточные цены</h2> | |
<table class="table"> | |
<tr> | |
<th>Даты размещения</th> | |
<th>Номер</th> | |
<th>Тип размещения</th> | |
<th>Питание</th> | |
<th>Цена, руб</th> |