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
| == profile by cpu | |
| require 'stackprof' | |
| profile = StackProf.run(mode: :wall, raw: true) do | |
| process(period: period, search_query: ['toDate(created_at) BETWEEN ? AND ?', period&.begin, period&.end]) | |
| end | |
| File.write('stackprof.json', JSON.generate(profile)) | |
| # Go to https://www.speedscope.app/ |
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
| db:migrate runs (single) migrations that have not run yet. | |
| db:create creates the database | |
| db:drop deletes the database | |
| db:schema:load creates tables and columns within the existing database following schema.rb. This will delete existing data. | |
| db:setup does db:create, db:schema:load, db:seed |
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
| Ubuntu | |
| sudo apt-get install language-pack-ru --установка русской локали | |
| sudo apt-get install firefox-locale-ru -- русский для firefox | |
| sudo apt install numix-gtk-theme numix-icon-theme --установка темы Numix | |
| sudo apt install unity-tweak-tool --для управления темой и расширенными настройками | |
| -- Установка расширения VirtualBox GuestAddtion | |
| sudo apt-get install virtualbox-guest-additions-iso | |
| --environment variables -- |
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
| Rspec example: | |
| describe Class, type: :service do | |
| let(a) { build(:a) } | |
| let!(b) { build_stubbed(:b) } | |
| let!(c) { create(:c) } | |
| before do | |
| VCR.turn_off! | |
| WebMock.enable! |
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
| anc_desc= {} | |
| ObjectSpace.each_object(Class).select{ |x| x < Object }.each{ |c| anc_desc[c.name] = c.superclass.name if c.name && c.superclass.name } | |
| File.open'result.dot', 'w' do |file| | |
| file.puts %Q(digraph "Ruby#{RUBY_VERSION}" {\n) | |
| file.puts %Q(node [shape=box];\n edge [arrowtail="empty", dir=back];\n) | |
| anc_desc.each.sort_by { |desc, anc| anc + desc }.each{ |desc, anc| file.puts %Q("#{anc}" -> "#{desc}";\n)} | |
| #anc_desc.each{|desc, anc|file.puts%Q("#{anc}" -> "#{desc}";\n)} | |
| file.puts'}'; | |
| end | |
| system 'dot -Tsvg result.dot -o ruby.svg' |
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 | |
| namespace :routes do | |
| desc 'Поиск неприкрытых авторизацией роутов' | |
| task list_all_routes: :environment do | |
| controllers_actions = [] | |
| controllers_actions << { controller: 'Контроллер', | |
| action: 'Метод', | |
| verb: 'Глагол', | |
| path: 'Путь', |