This file contains hidden or 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. дана максимальная ставка | |
2. сделано определённое количество ставок | |
3. прошло определённое ремя | |
*/ | |
package main |
This file contains hidden or 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
# Green | |
function echo_ok { | |
echo -e "\033[32m[OK]\033[0m $@" | |
} | |
# Red (using strerr as output) | |
function echo_err { | |
echo -e "\033[31m[ERROR]\033[0m $@" 1>&2 | |
} |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Pony Test</title> | |
</head> | |
<body> | |
<h1>Задание:</h1> | |
<ul> | |
<li>Необходимо сделать фильтр товаров для магазина игрушечных пони</li> |
This file contains hidden or 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
#!/bin/bash | |
echo "Generating an SSL private key to sign your certificate..." | |
openssl genrsa -des3 -out myssl.key 1024 | |
echo "Generating a Certificate Signing Request..." | |
openssl req -new -key myssl.key -out myssl.csr | |
echo "Removing passphrase from key (for nginx)..." | |
cp myssl.key myssl.key.org | |
openssl rsa -in myssl.key.org -out myssl.key |
This file contains hidden or 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
upstream faye { | |
server 127.0.0.1:9292; | |
} | |
upstream webrick{ | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 80 default; |
This file contains hidden or 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
module RetryableTyphoeus | |
require 'typhoeus' | |
include Typhoeus | |
DEFAULT_RETRIES = 1 | |
class Request < Typhoeus::Request | |
def original_on_complete=(proc) | |
@original_on_complete = proc |
This file contains hidden or 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 File.join(File.dirname(__FILE__), 'deploy/nginx') | |
require File.join(File.dirname(__FILE__), 'deploy/log') | |
default_run_options[:pty] = true | |
set :ssh_options, { :forward_agent => true } | |
set :application, "appname" | |
set :repository, "git@giturl" | |
set :scm, :git |
This file contains hidden or 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
# An experiment for a capistrano 'stage' that can actually be used to | |
# deploy multiple feature branches at once. | |
# Intended to be installed config/deploy/feature_demo , when using cap | |
# multi-stage support: add 'feature_demo' to 'stages' in `config/deploy.rb` too. | |
# Run from a git feature branch `cap feature_demo deploy` to deploy to | |
# single machine we have all our feature demos on. | |
# Name of feature branch will be taken from current git checkout. |
This file contains hidden or 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
namespace :data do | |
namespace :import do | |
task :cities do | |
country_codes = Hash[Country.all.map {|c| [c.iata_code, c.id]}] | |
import_csv_to 'cities' do |row| | |
country_code, city_name, city_name_en, city_lat, city_long = [*row] | |
country_id = country_codes[country_code] || nil | |
if city_name |
NewerOlder