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
View ruby-block-sugar.asciidoc

You won’t find rants on how functional programming improves you, your sanity and your life overall here. There are some examples in the very beginning to save you some time on reading the whole post, just come along if you don’t like how they look like.

By the way, this is not even a blog, so formally this is not even a blog post. This is not a library or a new paradigm. It’s just a few pieces of code that might come handy for your daily job.

Example:

[1, 3.14, -4].map &_.safe{ magnitude odd? } # => [true, nil, false]
@pirj
pirj / repl.rb
Created Feb 23, 2019
Ruby REPL when `pry` is not there
View repl.rb
while(true) do
begin
print '> '
input = STDIN.readline.chop
output = eval(input)
puts "=> #{output}"
rescue StandardError => e
puts "Error: #{e.message}"
end
end
@pirj
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
pirj / CV.md
Last active Aug 22, 2019
Curriculum vitae
View CV.md

Personal summary

Name: Filipp Pirozhkov

Age: 40

Located in: Somewhere traveling

Top engineer with proven ability to develop efficient solutions to complex problems. Extensive experience and skills with all levels of software and architecture.

@pirj
pirj / a_spec.rb
Last active Aug 8, 2019
RSpec/ExampleGroupArgument cop draft
View a_spec.rb
RSpec.describe do
# good
describe MyClass do
end
describe 'sdfsd' do
end
describe "sfa #{dfsdf}" do
end
# questionable
@pirj
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 = RuboCop::NodePattern.new(pattern)
ast = RuboCop::ProcessedSource.new(source, ruby_version).ast
node_pattern.match(ast)
end
match('(send nil? :sum $...)', 'sum(1,2,3,n)')
# => [s(:int, 1), s(:int, 2), s(:int, 3), s(:send, nil, :n)]
@pirj
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
{
(send nil? { :expect :allow } (send nil? %))
(send nil? :is_expected)
}
#{Runners::ALL.node_pattern_union}
#all_matcher?
)
PATTERN
@pirj
pirj / Outro slide #1
Created Aug 27, 2018
Productivity tips
View Outro slide #1
RECAP
- 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
pirj / Gemfile
Created Aug 16, 2012
Sinatra + Omniauth
View Gemfile
source 'https://rubygems.org'
gem 'thin'
gem 'eventmachine', '1.0.0.rc.4'
gem 'sinatra'
gem 'sinatra-contrib', :require => 'sinatra/contrib'
gem 'sinatra-flash', :require => 'sinatra/flash'
gem 'rack-protection'
@pirj
pirj / Gemfile
Created Aug 17, 2012
Sinatra streaming + Redis PubSub
View Gemfile
source 'https://rubygems.org'
gem 'sinatra'
gem 'sinatra-contrib', require: 'sinatra/streaming'
group :development do
gem 'thin'
gem 'pry-rails'
end
You can’t perform that action at this time.