Skip to content

Instantly share code, notes, and snippets.

View Andrew8xx8's full-sized avatar

Andrew Kulakov Andrew8xx8

View GitHub Profile
@Andrew8xx8
Andrew8xx8 / Gemfile
Created June 14, 2013 10:32
Example of API with ransack search and kaminari paginate.
gem 'kaminari'
gem 'ransack'
@Andrew8xx8
Andrew8xx8 / regexp.php
Created April 9, 2011 10:19
Полезные регулярные выражения
<?php
/*
* Юзернейм
*
* Буквы, цифры, дефисы и подчёркивания, от 3 до 16 символов.
* Начинаться должно всегда с буквы латинского алффавита
*/
preg_match('%^[a-z][a-z0-9_-]{3,16}$%', $userName);
/*
@Andrew8xx8
Andrew8xx8 / .rubocop.yml
Last active May 8, 2020 00:09
.rubocop.yml
AllCops:
Exclude:
- db/**/*
- config/**/*
- node_modules/**/*
- bin/*
- vendor/**/*
Bundler/OrderedGems:
Enabled: false
@Andrew8xx8
Andrew8xx8 / readme.md
Last active December 24, 2019 19:15
rename на OSX

Установка OSX

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

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install rename
@Andrew8xx8
Andrew8xx8 / terminal-open.sh
Created December 1, 2012 17:17
Opens terminal with specified tabs
#!/bin/bash
USAGE="Usage: -p Project path"
while getopts p: options; do
case $options in
p ) PROJECT="$OPTARG";;
esac
done
@Andrew8xx8
Andrew8xx8 / validate.rb
Created February 5, 2019 08:26
Ruby DSL
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 March 5, 2018 09:45 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 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
[[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 December 13, 2017 16:31
Git merge fuckup
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 October 13, 2017 12:25
E.Letov — Everything goes according to plan for https://jackschaedler.github.io/jazzari/