Skip to content

Instantly share code, notes, and snippets.

@mfittko
mfittko / Dockerfile
Last active April 13, 2023 06:28 — forked from uyorum/Dockerfile
Dockerfile for AWS CodeBuild with Ruby 3.2.2
# Start with the AWS CodeBuild standard image
FROM public.ecr.aws/codebuild/amazonlinux2-x86_64-standard:4.0 as builder
RUN yum install -y git make gcc bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel && \
git clone https://github.com/rbenv/ruby-build.git && \
PREFIX=/usr/local ./ruby-build/install.sh
ARG RUBY_VERSION
ENV RUBY_VERSION=${RUBY_VERSION:-3.2.2}
ENV RUBY_DIR=/usr/local/ruby-${RUBY_VERSION}
@mfittko
mfittko / retry.rb
Last active February 24, 2022 09:39
Ruby: Retry API calls
def validate_billing_agreement(billing_agreement_id)
with_retry do
handle_response(client.validate_billing_agreement(billing_agreement_id))&.data
end
end
def with_retry(initial_delay: 0.1, max_seconds: 10)
seconds ||= initial_delay
yield
rescue RuntimeError => e
@mfittko
mfittko / knapsack-with-working-coverage.rb
Last active August 3, 2020 09:07
In order to have full working coverage (includign lib folder) we needed to make sure to start simplecov coverage reporting befor the knapsack rspec task was invoked...
#!/usr/bin/env ruby
require_relative '../../spec/support/simple_cov_helper.rb'
SimpleCovHelper.report_coverage('integration')
load "#{Gem::Specification.find_by_name('knapsack_pro').gem_dir}/lib/tasks/queue/rspec.rake"
Rake::Task['knapsack_pro:queue:rspec'].invoke('--format doc --format RSpec::Instafail --tag ~skip --format RspecJunitFormatter --out tmp/test_results/spec/integration.xml')
@mfittko
mfittko / Vagrantfile
Created May 10, 2017 13:02 — forked from foscomputerservices/Vagrantfile
Vagrantfile for Running RubyMine under Vagrant/VirtualBox/Ubuntu on Mac or Windows
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.