Skip to content

Instantly share code, notes, and snippets.


Augusts Bautra Epigene

View GitHub Profile
Epigene / Nim
Created Jul 17, 2018
Some know-how and cheats for Nim programming languages
View Nim

Compiling with the -d:release flag will turn the bounds checks off. This will result in higher performance but less safety.

View settings.js
"workbench.colorTheme": "Solarized Dark",
"editor.minimap.enabled": false,
"explorer.fontFamily": "DejaVu Sans Mono",
"explorer.autoReveal": false,
"editor.fontFamily": "DejaVu Sans Mono, 'Courier New', monospace, 'Droid Sans Fallback'",
"editor.tabSize": 2,
"editor.fontSize": 12.5,
"window.zoomLevel": 1,
"editor.rulers": [80, 120],
Epigene / test_service.rb
Created Feb 23, 2018
An example of a service class code created by a rails service generator
View test_service.rb
module V1
module Api
class TestService
# This service TODO
def initialize
def call
Epigene / bundler.config
Last active Dec 24, 2019
Make bundler always use some pg_config
View bundler.config
# single install
gem install pg -v 1.1.4 -- --with-pg-config=/Applications/
# permanent config, troublesome
bundle config --with-pg-config=/Applications/
View cloudSettings
Epigene / bench_data.csv
Created Oct 14, 2017
Raw data for setup strategy comparison
View bench_data.csv
file line_number group time
./spec/setup_benchmark.rb 9 SetupBenchmark::NewVSAllOthersWhenTestingBookVampireTitle::WhenSettingUpWithNew 0.198
./spec/setup_benchmark.rb 17 SetupBenchmark::NewVSAllOthersWhenTestingBookVampireTitle::WhenSettingUpWithInstanceDouble 0.173
./spec/setup_benchmark.rb 25 SetupBenchmark::NewVSAllOthersWhenTestingBookVampireTitle::WhenSettingUpWithFactoryGirlBuildStubbed 0.396
./spec/setup_benchmark.rb 33 SetupBenchmark::NewVSAllOthersWhenTestingBookVampireTitle::WhenSettingUpWithFactoryGirlBuild 0.916
./spec/setup_benchmark.rb 41 SetupBenchmark::NewVSAllOthersWhenTestingBookVampireTitle::WhenSettingUpWithFactoryGirlCreate 1.155
./spec/setup_benchmark.rb 55 SetupBenchmark::InstanceDoubleVSFactoryGirlBuildStubbedFactoryGirlBuildAndFactoryGirlCreate::WhenSettingUpWithInstanceDouble 0.443
Epigene / book.rb
Created Oct 14, 2017
complete mock
View book.rb
after_save :do_something
def do_something
Epigene / bout4.rb
Created Oct 14, 2017
Build VS create
View bout4.rb
describe " VS FactoryGirl.create" do
subject {! }
bout4_number_of = 200
context "when setting up with" do
let(:book) { build(:book) }
bout4_number_of.times do
it "triggers ApplicationRecord.class in callback" do
Epigene / book.rb
Created Oct 14, 2017
Matching author and publisher names?
View book.rb
def with_characteristics?(characteristics_hash) == characteristics_hash[:author_name] && == characteristics_hash[:publisher_name]
Epigene / bout3.rb
Created Oct 14, 2017
FC.build_stubbed vs other FC strategies
View bout3.rb
describe "FactoryGirl.build_stubbed VS [, FactoryGirl.create]" do
subject { book.with_characteristics?(options) }
let(:options) { {author_name:, publisher_name:} }
bout3_number_of = 200
context "when setting up with FactoryGirl.build_stubbed" do
let(:book) { build_stubbed(:book) }