Skip to content

Instantly share code, notes, and snippets.

View dominikb's full-sized avatar

Dominik Bauernfeind dominikb

View GitHub Profile
@dominikb
dominikb / allowlist.txt
Created February 13, 2025 22:40
Example for list of allowed licenses for usage with dominikb/composer-license-checker
BSD-3-Clause
MIT
@dominikb
dominikb / untilfailure
Created November 15, 2024 08:35
Utility script to repeatedly run a command while it succeeds
#!/bin/bash
# See https://stackoverflow.com/questions/12967232/repeatedly-run-a-shell-command-until-it-fails
# Description:
# Run a command until it returns a failure error code.
# Examples:
# untilfailure bundle exec rspec spec/my_flaky_spec.rb
# untilfailure bundle exec rspec spec/my_flaky_spec.rb --seed 1234
@dominikb
dominikb / example.rb
Last active August 13, 2024 15:54
CanCanCan illegal table alias
# frozen_string_literal: true
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'activerecord', '~> 7.1.0'
gem 'sqlite3', '~> 1.4'
gem 'cancancan', '~> 3.6.0', require: false
# Potential fix mentioned in https://github.com/CanCanCommunity/cancancan/issues/696 but does not work either
@dominikb
dominikb / freeport.rb
Last active May 10, 2023 15:12
Ruby script to kill processes occupying ports
#!/usr/bin/env ruby
ports = ARGV
def show_help
puts "Usage: freeport <ports...>"
puts "-h, --help\tShow this help page."
end
def show_help?
@dominikb
dominikb / .php_cs.dist
Created March 6, 2019 18:21
PHP CS Fixer configuration
<?php
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'@PhpCsFixer' => true,
@dominikb
dominikb / FiltersScope.php
Created January 6, 2019 20:05
Adds support for resolving type hinted models by id
<?php
namespace Spatie\QueryBuilder\Filters;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
use ReflectionMethod;
use ReflectionParameter;
class FiltersScope implements Filter