Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom de Bruijn tombruijn

View GitHub Profile
View Gemfile
source "https://rubygems.org"
gemspec
@tombruijn
tombruijn / README.md
Last active Sep 6, 2020
Retry until fail script
View README.md

Until fail

Retry a command until it fails.

Debugging brittle specs is annoying and time consuming work. Let's automate finding those brittle specs by retrying them until they fail.

Accompanying blog post.

Usage

View rust_color_format.rs
fn color(text: String) -> String {
format!("\x1B[0;31m{}\x1B[0m", text)
}
@tombruijn
tombruijn / Dockerfile
Created Jul 10, 2020
CentOS 7.8.2003 + Ruby 2.3.0 Dockerfile
View Dockerfile
FROM centos:centos7.8.2003
RUN yum install -y git gcc gcc-c++ make openssl-devel bzip2 wget && \
cd ~/ && mkdir tmp && cd tmp && \
wget -O ruby-install-0.7.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.7.0.tar.gz && \
tar -xzvf ruby-install-0.7.0.tar.gz && \
cd ruby-install-0.7.0/ && \
make install
RUN ruby-install ruby 2.3.0
View elixir_linking_error_3
/app/_build/prod/lib/elixir_package/priv/libelixir_package_extension.a(floatdisf.o): In function `__floatdisf':
floatdisf.c:(.text.__floatdisf+0x0): multiple definition of `__floatdisf'
/app/_build/prod/lib/elixir_package/priv/libelixir_package_extension.a(compiler_builtins-874d313336916306.compiler_builtins0-efdbf1bd2f3b1e3c9741f8dcfa1f7012.rs.rcgu.o):/checkout/src/rustc/compiler_builtins_shim/../../libcompiler_builtins/src/float/conv.rs:89: first defined here
collect2: error: ld returned 1 exit status
View elixir_linking_error_2
/app/_build/prod/lib/elixir_package/priv/libelixir_package_extension.a(divdf3.o): In function `__divdf3':
divdf3.c:(.text.__divdf3+0x0): multiple definition of `__divdf3'
/app/_build/prod/lib/elixir_package/priv/libelixir_package_extension.a(compiler_builtins-a6b6fad6cc543169.compiler_builtins0.rcgu.o):/checkout/src/rustc/compiler_builtins_shim/../../libcompiler_builtins/src/macros.rs:253: first defined here
/app/_build/prod/lib/elixir_package/priv/libelixir_package_extension.a(divsf3.o): In function `__divsf3':
divsf3.c:(.text.__divsf3+0x0): multiple definition of `__divsf3'
/app/_build/prod/lib/elixir_package/priv/libelixir_package_extension.a(compiler_builtins-a6b6fad6cc543169.compiler_builtins0.rcgu.o):/checkout/src/rustc/compiler_builtins_shim/../../libcompiler_builtins/src/macros.rs:253: first defined here
/app/_build/prod/lib/elixir_package/priv/libelixir_package_extension.a(muldf3.o): In function `__muldf3':
muldf3.c:(.text.__muldf3+0x0): multiple definition of `__muldf3'
/app/_build/prod/lib/elixir_p
View keybase.md

Keybase proof

I hereby claim:

  • I am tombruijn on github.
  • I am tombruijn (https://keybase.io/tombruijn) on keybase.
  • I have a public key ASAWMmghMGGNT9nCA0asFbiezsQiCiiCqDytMjE8qiTGwAo

To claim this, I am signing this object:

View appsignal_custom_add_exception.rb
# Custom method to track exceptions regardless if an AppSignal transaction is
# currently active.
#
# When an AppSignal transaction is already active for this thread, it will add
# the exception to the currently active transaction. Note that only one
# exception can be added a transaction.
#
# When no AppSignal transactions are active for this thread it will create one
# temporarily, add the exception to the temporary transaction and send it to
# AppSignal.
@tombruijn
tombruijn / config_application.rb
Last active May 5, 2017
AppSignal Rails 5.1 workaround
View config_application.rb
# config/application.rb
# Workaround for making the AppSignal gem work on Rails 5.1.
# Put this after your Rails app module is defined.
# E.g. `module TestApp; class Application < Rails::Application`.
# Safest location being at the end of the `config/application.rb` file.
# Create a new middleware class with a different name so that when the original
# middleware is deleted the newly added one isn't deleted as well, since Rails
@tombruijn
tombruijn / capybara_ip_stub.rb
Created Nov 23, 2016
Fake an ip address on a capybara request
View capybara_ip_stub.rb
around do |example|
# Set custom IP address
original_app = Capybara.app
Capybara.app = lambda do |env|
Rails.application.call(env.merge("REMOTE_ADDR" => "8.8.8.8"))
end
example.run
Capybara.app = original_app
end