Skip to content

Instantly share code, notes, and snippets.

Avatar

Johannes Barre iGEL

  • BillFront
  • Berlin, Germany
View GitHub Profile
View Dockerfile
FROM debian
RUN apt-get update && apt-get install -y --no-install-recommends chromium
CMD chromium --headless --verbose --no-sandbox --screenshot https://www.chromestatus.com
@iGEL
iGEL / check_out.clj
Last active Mar 5, 2020
Clojure version of the tests for Kata 09
View check_out.clj
;; This is an adapted version of the tests from http://codekata.com/kata/kata09-back-to-the-checkout/ for Clojure
;; Original version by Dave Thomas
;; Run it like this:
;; lein exec check_out.clj
;; # or with Docker:
;; docker run -v `pwd`:`pwd` -w `pwd` clojure:alpine lein exec check_out.clj
(ns check-out.core
(:require [clojure.test :refer [is are deftest testing run-tests]]
@iGEL
iGEL / script.rb
Last active Feb 6, 2018
Bringt uns die Zeitumstellung mehr Sonnenlicht?
View script.rb
require 'sun_times'
# 1. Install ruby
# 2. gem install ruby-sun-times
# 3. ruby sun.rb
def f(t)
t.strftime("%H:%M")
end
@iGEL
iGEL / enforce_workspace.tf
Last active Jan 30, 2018
Enforce terraform workspaces can be only applied from a certain branch
View enforce_workspace.tf
# Source: https://gist.github.com/iGEL/3cecd4bf5518a627cb2aaf9802c37f14
# Fails if the user is currently not on the configured branch in git.
# Output doesn't matter, only that it succeeds (exit status 0).
# Current terraform version: v0.11.2
data "external" "enforce_workspace" {
program = ["./git-branch"]
query = {
View call_without_parens.diff
diff --git a/spec/rubocop/cop/style/lambda_call_spec.rb b/spec/rubocop/cop/style/lambda_call_spec.rb
index abbd89c..93d37b9 100644
--- a/spec/rubocop/cop/style/lambda_call_spec.rb
+++ b/spec/rubocop/cop/style/lambda_call_spec.rb
@@ -61,5 +61,15 @@ describe RuboCop::Cop::Style::LambdaCall, :config do
new_source = autocorrect_source(['a.call(x)'])
expect(new_source).to eq('a.(x)')
end
+
+ it 'auto-corrects x.call to x.()' do
@iGEL
iGEL / mail_patch.rb
Created Mar 3, 2017
Safe monkey patched mail 2.6.4 deprecation warnings for Ruby 2.4
View mail_patch.rb
# frozen_string_literal: true
unless Mail::VERSION.version == "2.6.4"
raise "Please delete #{__FILE__}, it's not required anymore"
end
# This file monkey patches away the new deprecation warnings from Ruby 2.4.
# Lifted here:
# * https://github.com/mikel/mail/pull/1053
# * https://github.com/mikel/mail/pull/1058
View keybase.md

Keybase proof

I hereby claim:

  • I am igel on github.
  • I am igelei (https://keybase.io/igelei) on keybase.
  • I have a public key ASDx5e08AAwZryDHFw8SUstrqXo7r9JFyYuYES17Xmqw2Ao

To claim this, I am signing this object:

@iGEL
iGEL / webmock_curl.rb
Last active Sep 9, 2015
Patch WebMock to print the curl command on disabled net connect. Just copy & paste it to execute.
View webmock_curl.rb
module WebMock
class NetConnectNotAllowedError < Exception
alias_method :stubbing_instructions_without_curl, :stubbing_instructions
private
def stubbing_instructions(request_signature)
[
stubbing_instructions_without_curl(request_signature),
CurlInstructions.new(request_signature).instructions
@iGEL
iGEL / check_out_spec.rb
Last active Jan 10, 2019
RSpec version of the tests for Kata 09
View check_out_spec.rb
# This is a reimplementation of the tests of this kata:
# http://codekata.com/kata/kata09-back-to-the-checkout/
# Original implementation by Dave Thomas
RSpec.describe CheckOut do
let(:rules) { } # Define your rules here!
it 'incremential scanning on the same bill' do
checkout = CheckOut.new(rules)