Skip to content

Instantly share code, notes, and snippets.


Phil Pirozhkov pirj

Block or report user

Report or block pirj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
pirj / a_spec.rb
Last active Aug 8, 2019
RSpec/ExampleGroupArgument cop draft
View a_spec.rb
RSpec.describe do
# good
describe MyClass do
describe 'sdfsd' do
describe "sfa #{dfsdf}" do
# questionable
pirj / f_hjkl_movements.json
Last active Sep 16, 2019
Karabiner complex modiications: Vi'ish mode
View f_hjkl_movements.json
"title": "F + HJKL",
"rules": [
"description": "Vi'ish Mode [F as Trigger Key]",
"manipulators": [
"type": "basic",
"parameters": {
"basic.to_delayed_action_delay_milliseconds": 150,
pirj / subject_stub.rb
Last active May 20, 2019
Modified version of the `lib/rubocop/cop/rspec/subject_stub.rb` cop to detect `expect(subject).to all receive(...)` syntax only
View subject_stub.rb
def_node_matcher :message_expectation?, <<-PATTERN
(send nil? { :expect :allow } (send nil? %))
(send nil? :is_expected)
pirj / match.rb
Last active May 22, 2019
NodePattern debug boilerplate
View match.rb
def match(pattern, source)
ruby_version = RUBY_VERSION.to_f
node_pattern =
ast =, ruby_version).ast
match('(send nil? :sum $...)', 'sum(1,2,3,n)')
# => [s(:int, 1), s(:int, 2), s(:int, 3), s(:send, nil, :n)]
pirj / repl.rb
Created Feb 23, 2019
Ruby REPL when `pry` is not there
View repl.rb
while(true) do
print '> '
input = STDIN.readline.chop
output = eval(input)
puts "=> #{output}"
rescue StandardError => e
puts "Error: #{e.message}"
pirj / Outro slide #1
Created Aug 27, 2018
Productivity tips
View Outro slide #1
- don't blindly follow the hints
- figure out what slows you down and takes away your focus
- move forward one confident step at a time
- be confident with the changes you make
- identify the inconveniences that slow you down or distract you, and eliminate them
- rest assured that what slows you down has a solution, you just need to find it
pirj /
Created Feb 1, 2017 — forked from piscisaureus/
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

pirj /
Created Jan 16, 2017
Pull Heroku DB from staging/prod to local dev
psql -c "select pg_terminate_backend(pid) from pg_stat_activity where datname='LOCAL_DB_NAME'" postgres $(whoami) \
&& psql -c 'drop database LOCAL_DB_NAME' postgres $(whoami) \
&& heroku pg:pull DATABASE_URL LOCAL_DB_NAME --app APP_NAME
# Replace LOCAL_DB_NAME to say myblog_development and APP_NAME to myblog_staging
pirj /
Created May 30, 2016
Generate self-signed certificate
[ -z "$1" ] && echo provide file name as argument e.g. server && exit 1
openssl genrsa -des3 -passout pass:x -out $1.pass.key 2048
openssl rsa -passin pass:x -in $1.pass.key -out $1.key
rm $1.pass.key
openssl req -new -key $1.key -out $1.csr
openssl x509 -req -days 365 -in $1.csr -signkey $1.key -out $1.crt
cat $1.key $1.crt > $1.pem
rm $1.key $1.crt $1.csr
pirj /
Created May 4, 2016
git integration branch (for rebase)
git remote set-head origin develop
You can’t perform that action at this time.