This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Show method location | |
method(:meth).source_location | |
# Nice gem 'method_source' makes life easier. Use it inside console: | |
require 'method_source' | |
# Show method source | |
method(:meth).source.display | |
# Show class or method definition | |
show-source Job | |
show-source Job.work |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remote | |
git br -r | grep -v 'master\|dev\|new_front' | awk -Forigin/ '{print $2 $3}' | xargs -I {} git push origin :{} | |
# Local | |
git branch | grep -v 'master\|dev\|new_front' | xargs -I {} git branch -D {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CarrierWave.configure do |config| | |
if Rails.env.test? || Rails.env.cucumber? | |
config.storage = :file | |
config.enable_processing = false | |
else | |
config.asset_host = Rails.application.secrets.asset_host | |
config.fog_provider = 'fog/openstack' | |
config.fog_credentials = { | |
provider: 'OpenStack', | |
openstack_auth_url: 'https://api.selcdn.ru/v3', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name '*.png' -exec pngquant -ext .png -force 256 {} \; | |
find -type f -name "*.png" -exec optipng \-o2 \-strip all '{}' \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Where | |
class <<self | |
attr_accessor :editor | |
def is_proc(proc) | |
source_location(proc) | |
end | |
def is_method(klass, method_name) | |
source_location(klass.method(method_name)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'rubygems' | |
require 'aws-sdk' | |
module S3 | |
# Upload directory recursively to S3 | |
class DirectoryUpload | |
attr_reader :folder_path, :bucket, :include_folder | |
attr_accessor :files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :changelog do | |
# simple rake task to output a changelog between two commits, tags ... | |
# output is formatted simply, commits are grouped under each author name | |
# | |
desc "generate changelog with nice clean output" | |
task :generate, :since_c, :until_c do |t, args| | |
since_c = args[:since_c] || `git tag | head -1`.chomp | |
until_c = args[:until_c] || `git rev-parse --short HEAD` | |
cmd=`git log --pretty='format:%ci::%an <%ae>::%s::%H' --after=#{since_c} --before=#{until_c}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inherit_from: .rubocop_todo.yml | |
AllCops: | |
# Default formatter will be used if no `-f/--format` option is given. | |
DefaultFormatter: fuubar | |
# Cop names are displayed in offense messages by default. Change behavior | |
# by overriding DisplayCopNames, or by giving the `--no-display-cop-names` | |
# option. | |
DisplayCopNames: true | |
# Style guide URLs are not displayed in offense messages by default. Change |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo apt install net-tools | |
sudo netstat -ntlp | grep LISTEN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add `gem 'awesome_print` to Gemfile | |
rails c | |
# cl = Scryfaller::Client.new | |
# hash = cl.cards.search(q: "Aberrant Researcher // Perfected Form").body[:data].first | |
ap hash, ruby19_syntax: true, index: false, indent: 2 | |
# Copy and paste output into https://www.cleancss.com/ruby-beautify/ |