Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Kulakov Andrew8xx8

View GitHub Profile
View .rubocop.yml
AllCops:
Exclude:
- db/**/*
- config/**/*
- node_modules/**/*
- bin/*
- vendor/**/*
Bundler/OrderedGems:
Enabled: false
@Andrew8xx8
Andrew8xx8 / readme.md
Last active Dec 24, 2019
rename на OSX
View readme.md

Установка OSX

Открыть терминал и выполнить последовательно две команды

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install rename
View validate.rb
class A
def self.validates(attribute, options)
p 'define validator', attribute, options
@@validatos ||= {}
@@validatos[attribute] = options
p '/define validator'
end
def valid?
@@validatos.keys.map do |attribute|
@Andrew8xx8
Andrew8xx8 / ssl_puma.sh
Created Mar 5, 2018 — forked from tadast/ssl_puma.sh
localhost SSL with puma
View ssl_puma.sh
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
View gist:80da122a5d6c9c1c4b488c0cb00f7c59
[[1, 36, 0], [0, 36, 22], [1, 40, 96], [0, 40, 117], [1, 36, 192], [0, 36, 213], [1, 44, 288], [0, 44, 304], [1, 36, 384], [0, 36, 409], [1, 40, 480], [0, 40, 499], [1, 36, 576], [0, 36, 597], [1, 44, 672], [0, 44, 692], [1, 36, 768], [0, 36, 789], [1, 40, 864], [0, 40, 883], [1, 36, 960], [0, 36, 982], [1, 44, 1056], [0, 44, 1073], [1, 36, 1152], [0, 36, 1173], [1, 40, 1248], [0, 40, 1268], [1, 36, 1344], [0, 36, 1363], [1, 44, 1440], [0, 44, 1459], [1, 36, 1536], [0, 36, 1556], [1, 40, 1632], [0, 40, 1652], [1, 36, 1728], [0, 36, 1761], [1, 44, 1824], [0, 44, 1844], [1, 36, 1920], [0, 36, 1941], [1, 40, 2016], [0, 40, 2037], [1, 36, 2112], [0, 36, 2135], [1, 44, 2208], [0, 44, 2224], [1, 37, 2304], [0, 37, 2324], [1, 41, 2400], [0, 41, 2417], [1, 37, 2496], [0, 37, 2518], [1, 45, 2592], [0, 45, 2611], [1, 37, 2688], [0, 37, 2716], [1, 41, 2784], [0, 41, 2801], [1, 37, 2880], [0, 37, 2904], [1, 45, 2976], [0, 45, 2994], [1, 38, 3072], [0, 38, 3095], [1, 42, 3168], [0, 42, 3189], [1, 38, 3264], [0, 38, 3280],
@Andrew8xx8
Andrew8xx8 / gmf.sh
Last active Dec 13, 2017
Git merge fuckup
View gmf.sh
git init
touch correct.txt broken.txt
git add .
git commit -m "Init commit"
git checkout -b feature
echo 'I need to be here!' >> correct.txt
echo 'I need to be here!' >> broken.txt
git add .
git commit -m "Texts added"
git checkout master
@Andrew8xx8
Andrew8xx8 / 0EGATTP.md
Last active Oct 13, 2017
E.Letov — Everything goes according to plan for https://jackschaedler.github.io/jazzari/
View 0EGATTP.md
@Andrew8xx8
Andrew8xx8 / README.md
Last active Oct 11, 2017
Разработка рельсового проета в докере
View README.md

ПОДГОТОВКА

Билд контейнера:

docker-compose build

Создание базы:

docker-compose docker-compose run db:create db:migrate db:seed
View gist:0eca7d277551135eec64b34117c4a244
can [:memberships, :members], Organization do |organization|
@user.has_role?(:resource_administrator, organization)
all_childrens = @user.admined_organizations.map do |user_admined_organization|
user_admined_organization.actable.get_descendent_memberships.where(member_type: Organization.types)
end
all_childrens.flatten.map do |membership|
membership.member == organization.actable
end.reduce(&:|)
@Andrew8xx8
Andrew8xx8 / quckstart.md
Last active Oct 4, 2016
Как начать писать на Rails
View quckstart.md

Нужна тачка с ubuntu. 16.04 или 14.04. Ставим зависимости

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev libgdbm-dev libncurses5-dev automake libtool bison libffi-dev

Далее ставим руби с помощью http://rvm.io/ Это такая приблуда для того чтобы руби ставить.