Skip to content

Instantly share code, notes, and snippets.

@benoittgt
benoittgt / spec_helper.rb
Created March 9, 2018 15:04
find where data are leaking with rspec and active record
RSpec.configure do |config|
config.before(:suite) do
FactoryBot.find_definitions if FactoryBot.factories.count == 0
DatabaseCleaner[:active_record].clean_with(:transaction)
end
config.around(:each) do |example|
unless User.count.zero?
# we will output to current terminal but also into a file in tmp
open('tmp/leaky.txt', 'a') { |f|
@joakimk
joakimk / pipeline.md
Last active March 18, 2018 08:37
How we made our commit to production time twice as fast using heroku pipelines

Background

We started out with two apps.

  • foo-staging
  • foo-production

Our CI would run tests, then deploy to staging, run smoke tests and then run to production and run smoke tests.

This took about 22-25 min.

@timvisee
timvisee / falsehoods-programming-time-list.md
Last active July 21, 2025 13:21
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@stokarenko
stokarenko / capybara_chrome.rb
Created August 29, 2017 11:12
Headless Chrome within RSpec & Capybara
# spec/support/capybara_chrome.rb
require 'selenium/webdriver'
require 'capybara/rspec'
require 'capybara-screenshot/rspec'
RSpec.configure do
Capybara.server = :puma
Capybara.server_port = 5000
@lattner
lattner / TaskConcurrencyManifesto.md
Last active July 18, 2025 12:29
Swift Concurrency Manifesto
@Yoshyn
Yoshyn / .Manage Kubernete
Last active November 19, 2018 14:13
.Manage Kubernete
# Contains :
# * attachment-rc.yml : How to attach a console to a process inside a pod
# * script.sh : Set of script for managing pods easily
# * minikube_on-mac.sh : Install minikube on macos
# Strace & Docker
# https://medium.com/@rothgar/how-to-debug-a-running-docker-container-from-a-separate-container-983f11740dc6
@abelards
abelards / arel_use.rb
Last active October 11, 2021 16:13
Ruby, Rails, ActiveRecord and Arel
# Welcome to my "arel gist"!
## It started hacky, then as an example, but we want it cleaner.
# ActiveRecord
## This is an ORM: you call Ruby methods and get Ruby objects, it makes SQL and object instantiations for you.
## It's Rails' default, but there are alternatives: https://github.com/Sdogruyol/awesome-ruby#orm
Student.all
Topic.first
Workshop.sum(:hours)
@inadarei
inadarei / minikube-sierra.md
Last active October 20, 2020 01:57
Minikube Setup: Docker for Mac / Sierra

Prerequisite: latest Docker for Mac on MacOS Sierra

$ brew update
$ brew install --HEAD xhyve
$ brew install docker-machine-driver-xhyve
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
@przbadu
przbadu / Ctags.md
Last active February 25, 2025 22:42
Ctags for ruby on rails and node applications

Install ctags

http://ctags.sourceforge.net follow this url for installation and documentation.

Ctags with Ruby/Rails

We can ctags lots of programming languages. Here is how to do it for ruby/rails. I really like how RubyMine jumps to the source code (either withing project score or to the gem source). This is really useful for reading source code for those classes, methods, modules etc. But Now that I use vim as My IDE/Editor I really like that functionality to happen in my vim editor. And I found ctags as the solution.

@marcotc
marcotc / sidekiq_retry_time.csv
Created February 14, 2017 18:16
Sidekiq retry exponential backoff formula times
Retry count Retry Time Total Cumulative Time Total Cumulative Days
0 0:00:00 0:00:00 0.0
1 0:00:16 0:00:16 0.0
2 0:00:31 0:00:47 0.0
3 0:01:36 0:02:23 0.0
4 0:04:31 0:06:54 0.0
5 0:10:40 0:17:34 0.0
6 0:21:51 0:39:25 0.0
7 0:40:16 1:19:41 0.1
8 1:08:31 2:28:12 0.1