Skip to content

Instantly share code, notes, and snippets.

View jvillarejo's full-sized avatar

Juani Villarejo jvillarejo

View GitHub Profile
@jvillarejo
jvillarejo / retry_until_timeout_spec.rb
Created January 7, 2022 22:38
A timeout for failing specs when using turbo frames and hotwire
# This is how we use it
retry_until_timeout do
expect(page).to have_button('Add comment')
expect(page).to have_text('Cancell')
end
def retry_until_timeout(seconds = 10, message: 'Failed with timeout')
Timeout.timeout(seconds) do
loop do
yield
@jvillarejo
jvillarejo / Makefile
Created January 3, 2016 22:21 — forked from ahawkins/Makefile
Example Makefile
RUBY_IMAGE:=$(shell grep FROM Dockerfile | cut -f2 -d' ')
DYNAMODB_IMAGE:=dynamodb:latest # original value ommitted
APP_IMAGE:=inventory_service/app
TAG:=$(shell git rev-parse --short HEAD)
REGISTRY:=example.registry.com # original value omitted
.DEFAULT_GOAL:= build
@jvillarejo
jvillarejo / online.rb
Last active December 16, 2015 10:39 — forked from hannesg/online.rb
Updated so it doesn't leave defunct ifconfig processes
#!/usr/bin/env ruby
def online?
num = 0
flag_regexp = /R[A-Z]*\n$/m
process = IO.popen("ifconfig -s")
process.each do |line|
num = num + 1
# ignore first line
next if num == 1
# ignore lo