Based on the following guides:
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
| FROM ruby:2.6.3-alpine | |
| RUN apk add --update --no-cache bash build-base nodejs sqlite-dev tzdata postgresql-dev yarn | |
| RUN gem install bundler:2 | |
| WORKDIR /usr/src/app | |
| COPY package.json yarn.lock ./ | |
| RUN yarn install --check-files |
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
| #!/usr/bin/env ruby | |
| require 'open3' | |
| require 'fileutils' | |
| require 'tempfile' | |
| CITIES_POPULATION = 500 | |
| LANGS = %w(ru en uk zh tr) | |
| IN_LANGS_QUERY_STR = LANGS.map{|w| "'#{w}'"}.join(',') | |
| def run_command(command) |
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
| #!/usr/bin/env bash | |
| if [ $EUID -ne 0 ]; then | |
| echo "You must be root: \"sudo ngxdis\"" | |
| exit 1 | |
| fi | |
| # -z str: Returns True if the length of str is equal to zero. | |
| if [ -z "$1" ]; then | |
| echo "Please choose a site." |
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
| # lib/tasks/db.rake | |
| namespace :db do | |
| desc "Dumps the database to db/APP_NAME.dump" | |
| task :dump => :environment do | |
| cmd = nil | |
| epoch = Time.now.to_i | |
| with_config do |app, host, db, user| | |
| cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}-#{epoch}.dump" | |
| 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
| # app/policies/active_admin/ | |
| module ActiveAdmin | |
| class CommentPolicy < ApplicationPolicy | |
| class Scope < Struct.new(:user, :scope) | |
| def resolve | |
| scope | |
| end | |
| end | |
| end | |
| end |
UTF8 содержит три байта на символ, что не в полной мере отражает такие языки как японский. В ios используются смайлы emoji тоже пришедшие из японии и старая версия utf8 использующая 3 байта на символ их не поддерживает. Новая версия utf8 (utf8mb4) использует 4 байта на символ и в полной мере поддерживает все языки и спецсимволы. MySQL c версии 5.5.3 поддерживает utf8mb4
Для поддержки emoji нужно конвертировать нужную таблицу или всё базу в utf8mb4. Сделать это можно с помощью команд: Для базы:
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
| # dependency - Function.prototype.bind or underscore/lodash | |
| app = angular.module 'someApp' | |
| class @BaseCtrl | |
| @register: (app, name) -> | |
| name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1] | |
| app.controller name, @ | |
| @inject: (args...) -> |
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
| Make sure libxml2-devel, libxslt-devel and libiconv-devel are installed: | |
| $ gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib --with-xslt-dir=/usr/include/libxslt --with-iconv-include=/usr/include --with-iconv-lib=/usr/lib |
NewerOlder