Skip to content

Instantly share code, notes, and snippets.

Avatar

Augusts Bautra Epigene

View GitHub Profile
View bullet_stact.txt
Bullet::Notification::UnoptimizedQueryError at /api/v2/tiered_pricing_models/11834910-c11f-49bb-b095-23c98acbe51f
=================================================================================================================
> user: augusts
PUT /api/v2/tiered_pricing_models/11834910-c11f-49bb-b095-23c98acbe51f
AVOID eager loading detected
TieredPricingModel => [:account_tiered_pricing_model_template]
Remove from your finder: :includes => [:account_tiered_pricing_model_template]
Call stack
/Users/augusts/Projects/herer-api/spec/requests/tiered_pricing_models_spec.rb:63:in `block (3 levels) in <top (required)>'
@Epigene
Epigene / Code of Code.md
Created May 21, 2021
Comprehensive draft of Ruby code style to codify into Rubocop
View Code of Code.md

Dev team standarts

Follow community and company code guidelines, facilitate collaboration

Adhere to Ruby Style Guide

Special mentions agreed to on 2018-07-20

1. Use no spaces around curly braces around Hash parentheses

# good
View spec.rb
describe "#current_agreement_vehicle assoc", :slow, travel_to: "2021-01-01" do
let!(:vehicle1) do
Timecop.freeze(1.day.ago) { create(:vehicle) }
end
let!(:vehicle2) do
Timecop.freeze(2.days.ago) { create(:vehicle) }
end
let(:av1_2) do
@Epigene
Epigene / 50.json
Created Jan 10, 2020
Flamegraph for method spec on Rails 5.0
View 50.json
{"version":1.2,"mode":"wall","interval":1000,"samples":817,"gc_samples":220,"missed_samples":189,"metadata":{},"frames":{"2256502940":{"name":"Mysql2::Client#query","file":"/Users/augusts/.rvm/gems/ruby-2.5.3/gems/mysql2-0.5.3/lib/mysql2/client.rb","line":129,"total_samples":17,"samples":17,"edges":{"2256502940":17},"lines":{"131":[16,16],"130":[17,0],"132":[1,1]}},"2279488660":{"name":"ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter#execute","file":"/Users/augusts/.rvm/gems/ruby-2.5.3/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb","line":217,"total_samples":27,"samples":0,"edges":{"2256502940":17,"2228340160":27},"lines":{"218":[44,0]}},"2228340160":{"name":"ActiveRecord::ConnectionAdapters::AbstractAdapter#log","file":"/Users/augusts/.rvm/gems/ruby-2.5.3/gems/activerecord-5.0.7.2/lib/active_record/connection_adapters/abstract_adapter.rb","line":582,"total_samples":27,"samples":0,"edges":{"2279488660":17,"2230307860":27},"lines":{"590":[17,0],"583":[27,0]}},
@Epigene
Epigene / 42.json
Created Jan 10, 2020
Flamegraph for method spec on Rails 4.2
View 42.json
{"version":1.2,"mode":"wall","interval":1000,"samples":251,"gc_samples":151,"missed_samples":24,"frames":{"2248648540":{"name":"Mysql2::Client#query","file":"/Users/augusts/.rvm/gems/ruby-2.5.3/gems/mysql2-0.4.10/lib/mysql2/client.rb","line":118,"total_samples":5,"samples":5,"edges":{"2248648540":5},"lines":{"120":[5,5],"119":[5,0]}},"2319186460":{"name":"ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter#execute","file":"/Users/augusts/.rvm/gems/ruby-2.5.3/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb","line":316,"total_samples":8,"samples":0,"edges":{"2248648540":5,"2245218080":8},"lines":{"317":[13,0]}},"2245218080":{"name":"ActiveRecord::ConnectionAdapters::AbstractAdapter#log","file":"/Users/augusts/.rvm/gems/ruby-2.5.3/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb","line":477,"total_samples":8,"samples":0,"edges":{"2319186460":5,"2242197020":8},"lines":{"484":[5,0],"478":[8,0]}},"2242197020":{"name":"ActiveSupport::N
@Epigene
Epigene / settings.json
Created Dec 10, 2019
Gene's VSC general settings, 2019-12-10
View settings.json
{
"terminal.integrated.env.osx": {
"PATH": "~/.rvm/gems/ruby-2.5.3/bin:~/.rvm/rubies/ruby-2.5.3/bin:~/.rvm/bin:/bin:/usr/local/opt/qt@5.5/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
},
"ctags": {
"executePath": "~/.rvm/gems/ruby-2.5.3/gems/ripper-tags-0.7.0/bin/ripper-tags",
"options": "--tag-file=.tags --recursive --force --exclude=/assets/ --exclude=.bundle --exclude=.git/ --exclude=coverage/ --exclude=log/ --exclude=tmp/ --exclude=bin/",
"fileName": ".tags"
},
"colorInfo.languages": [
@Epigene
Epigene / ruby.json
Last active Dec 10, 2019
Gene's snippets for VSC, 2019-12-10
View ruby.json
{
"service_spec template": {
"prefix": "service_spec",
"body": [
"RSpec.describe $0TODO, :service do",
" let(:options) do",
" {}",
" end",
"",
" describe \"#call\", :implicit_subject do",
View Karabiner custom rules.md

Karabiner Elements v12.7.0 custom rule setup

  1. Open ~/.config/karabiner/assets/complex_modifications
  2. Make a new *.json rule file
  3. Put the rule json in there.
  4. Reload Karabiner and add the rule.

Control + D to Show Desktop

View gist:e459b4642552f3bb85b58f6bce775369
SELECT `applications`.* FROM `applications` LEFT OUTER JOIN `agreements` `agreements_f0` ON `applications`.`id` = `agreements_f0`.`application_id` WHERE ((`applications`.`hidden` = ? OR `applications`.`hidden` IS ?)) AND ((LOWER(`applications`.`client_name`) LIKE LOWER(?)) OR (LOWER(`applications`.`client_email`) LIKE LOWER(?)) OR (LOWER(`applications`.`client_identification_no`) LIKE LOWER(?)) OR (LOWER(`applications`.`client_phone`) LIKE LOWER(?)) OR (LOWER(`applications`.`client_phone2`) LIKE LOWER(?)) OR (LOWER(`applications`.`client_phone3`) LIKE LOWER(?)) OR (LOWER(`applications`.`client_phone4`) LIKE LOWER(?)) OR (LOWER(`applications`.`vehicle_no`) LIKE LOWER(?)) OR (LOWER(`applications`.`vehicle_vin`) LIKE LOWER(?)) OR (LOWER(`applications`.`vehicle_no2`) LIKE LOWER(?)) OR (LOWER(`applications`.`vehicle_technical_certificate_no`) LIKE LOWER(?)) OR (LOWER(`applications`.`vehicle_technical_certificate_no2`) LIKE LOWER(?)) OR (LOWER(`applications`.`number`) LIKE LOWER(?)) OR (LOWER(`applications`.`reque
@Epigene
Epigene / ruby.json
Last active Aug 31, 2018
Ruby (predominantly RSpec) snippets for VSC.
View ruby.json
{
"scope spec template": {
"prefix": "scope_spec",
"body": [
"describe \".SCOPE_NAME\" do",
" subject(:collection) { described_class.SCOPE_NAME }",
"",
" context \"when instantiating actual records\", :slow do",
" let!(:match) { create(:FACTORY, :TRAIT) }",
" let!(:counter) { create(:FACTORY) }",