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
<!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<%= stylesheet_link_tag "print_order", :media => "print, screen" %> | |
</head> | |
<body> | |
<p align="right"> | |
Унифицированная форма № ТОРГ- 12 Утверждена постановлением Госкомстата России от 25.12.98 № 132 |
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
# ruby 2.0 | |
str = "\u0000\u0001\u000177773705257\u0000\u0000\u0001559#81635181\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\b\u0000\b\u0004!\u0004\"\u0004\u001E\u0004\u001F" | |
puts "str:\n" | |
puts str | |
puts "\n here relults for str:" | |
yes = str.force_encoding("utf-16be").encode("utf-8") | |
puts yes | |
puts yes.include?('СТОП') | |
puts str.force_encoding("utf-16le").encode("utf-8") |
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
# config/environments/production.rb | |
# ... | |
config.middleware.use HerokuRedirect |
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
# lib/heroku_redirect.rb | |
class HerokuRedirect | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
request = Rack::Request.new(env) | |
unless request.host.starts_with?("www.") || request.host.starts_with?("start.") || request.host.starts_with?("crm.") || request.host.starts_with?("api.") || request.host.starts_with?("erp.") || request.host.include?("mydomain.com") || request.host.include?("staging.") | |
# puts 'redirecting to www' |
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 'tire' | |
require 'nobrainer' | |
NoBrainer.connect 'rethinkdb://server/company' | |
class Employee | |
include NoBrainer::Document | |
field :name | |
field :title |
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
module Accessible | |
extend ActiveSupport::Concern | |
included do | |
has_many :accessibilities, as: :accessible, dependent: :destroy | |
has_many :roles, -> { uniq }, through: :accessibilities | |
scope :visible_to, ->(role_names) { | |
role_names = [role_names] if [String, Symbol].include?(role_names.class) | |
if role_names.include?(Role::ROOT_ROLE) | |
all |
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
# connecting select2 to the appropriate hooks: | |
# | |
# hard case: best_in_place's select | |
$ -> | |
# first, find the mount point | |
$('body').on 'best_in_place:activate', '.best_in_place', -> | |
# second, attach empty update() to `this` to screen the downstream calls | |
# which otherwise will cause an error |
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
heroku pg:backups capture; | |
curl -o latest.dump `heroku pg:backups public-url`; | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U pguser -d blog_development latest.dump; |
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
PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump |
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
# Задача: Программа получает ссылку на страницу, выбирает оттуда все ссылки которые найдет и выводит их на экран. | |
# Ограничения: программа должна получать ссылку от меня в интерактивном режиме (используя метод gets) | |
# Программа: | |
class Proga # создание класса "Программа" | |
puts "Please, input a web-site" # запрос у пользователя ссылки на сайт | |
link = gets.chomp # создание переменной link, в которую будет складываться ответ пользователя | |
puts "You enter #{link}" # вывести на экран значение переменной link |
OlderNewer