Skip to content

Instantly share code, notes, and snippets.

@lubekpl
lubekpl / resume.json
Last active September 22, 2022 06:36
resume.json
{
"references":[
],
"interests":[
{
"keywords":[
"Ruby",
"Web development",
"Backend development"
################################################################
# Global configuration
################################################################
# Enable debug mode
#
# Optional
# Default: false
#
# debug = true
@lubekpl
lubekpl / config.json
Created March 6, 2019 10:42
Example of Hound's config.json
{
"max-concurrent-indexers" : 2,
"dbpath" : "data",
"health-check-uri" : "/healthz",
"repos" : {
"repo1" : {
"url" : "file:///code/repo1"
},
"repo2" : {
"url" : "file:///code/repo2"
@lubekpl
lubekpl / .pryrc
Created February 5, 2018 19:32 — forked from phansch/.pryrc
Colored Pry prompt including Rails environment and app name
def formatted_env
case Rails.env
when 'production'
bold_upcased_env = Pry::Helpers::Text.bold(Rails.env.upcase)
Pry::Helpers::Text.red(bold_upcased_env)
when 'staging'
Pry::Helpers::Text.yellow(Rails.env)
when 'development'
Pry::Helpers::Text.green(Rails.env)
else
class ServiceGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
def copy_service_file
template "service.rb", "app/services/#{file_name}.rb"
end
def copy_service_spec_file
template "service_spec.rb", "spec/services/#{file_name}_spec.rb"
end
@lubekpl
lubekpl / migrate.rake
Created December 10, 2015 10:22 — forked from jswanner/migrate.rake
Rolls back migrations in current branch not present in specified branch.
desc 'rolls back migrations in current branch not present in other'
task :rollback_branch_migrations, [:other_branch] do |t, args|
load "#{Dir.pwd}/Rakefile"
branch_migrations = BranchMigrations.new(args.other_branch)
puts ['Rollback the following migrations', branch_migrations, 'y,n? ']
next if %w[no n NO N].include?(STDIN.gets.chomp)
Rake::Task['environment'].invoke
# Rack middleware that drops non properly encoded cookies that would hurt the ActionDispatch::Cookies middleware.
#
# This is actually a hotfix for issues
# * https://github.com/rack/rack/issues/225
# * https://github.com/rails/rails/issues/2622
module CleanCookies
# Tests whether a string may be decoded as a form component
def decodable?(string)
URI.decode_www_form_component(string)
true
@lubekpl
lubekpl / mail.rb
Created July 28, 2014 12:10 — forked from vivien/mail.rb
#!/usr/bin/env ruby
require "mail"
require "optparse"
imap_opts = {
:address => "imap.gmail.com",
:port => 993,
:enable_ssl => true
}