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 Geonames | |
ARCHIVES = ['allCountries.zip', 'alternateNames.zip'].freeze | |
TARGET_DIR = Rails.root.join('tmp').freeze | |
FILES = Hash[ARCHIVES.collect { |a| [a, File.join(TARGET_DIR, a)] }].freeze | |
end |
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
def show | |
url = request.original_url | |
if url.last == '?' | |
redirect_to url.chop and return | |
end | |
params[:name] = 'russia' if params[:name].blank? | |
@node = Node.find_by(name: params[:name]) |
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
class RegistrationService < ServiceFactory | |
def self.call(params) | |
@@errors = [] | |
@params = params | |
@user = User.new( @params ) | |
if @user.save | |
@user | |
else | |
@@errors << @user.errors |
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
validates :msisdn1, :msisdn2, :msisdn3, format: { with: /(\+7|8)\d{10}/ }, if: :russian? | |
validates :msisdn1, :msisdn2, :msisdn3, length: { minimum: 8, maximum: 16 }, unless: :russian? | |
def russian? | |
starts_with?("+7", "8") | |
end |
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
$where = " startdate ... " #или что там у тебя | |
$where .= " AND ((salestype = 0 and salescode=$userCode) OR (salestype=1 and salescode=$userGr) OR (salestype=2))" | |
$sql = $self->dbi->query("select * from dtbl_catalog_items_prices where $where order by salestype") |
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
dm@Servant /v/w/s/c/cron> ./import_ftp.pl | |
Smartmatch is experimental at /var/www/scandeco.dev/cgi-bin/extlib/Mojo/Collecti on.pm line 31. | |
Smartmatch is experimental at /var/www/scandeco.dev/cgi-bin/extlib/Mojo/Collecti on.pm line 36. | |
[Thu Feb 16 14:13:59 2017] import_ftp.pl: given is experimental at /var/www/scan deco.dev/cgi-bin/lib/GG/Admin/Catalog.pm line 56. | |
[Thu Feb 16 14:13:59 2017] import_ftp.pl: when is experimental at /var/www/scand eco.dev/cgi-bin/lib/GG/Admin/Catalog.pm line 58. | |
[Thu Feb 16 14:13:59 2017] import_ftp.pl: when is experimental at /var/www/scand eco.dev/cgi-bin/lib/GG/Admin/Catalog.pm line 59. | |
[Thu Feb 16 14:13:5 |