Skip to content

Instantly share code, notes, and snippets.


Artur Trzop ArturT

View GitHub Profile
View bitbucket-pipelines(cypress-docker-image).yml
# bitbucket-pipelines.yml
# this is example using cypress/base docker image
image: cypress/base:10
max-time: 30
# job definition for running E2E tests in parallel with
e2e: &e2e
name: Run E2E tests with @knapsack-pro/cypress
ArturT /
Last active Mar 5, 2021
Buildkite parallel builds

Knapsack Pro

A commercially supported version of Knapsack that provides a hosted service for test timing data and additional job distribution modes for Ruby, JavaScript, etc. See the documentation and step-by-step tutorial for Ruby setup instructions and example pipelines. For other programming languages please check integrations.

ArturT / api_controller.rb
Last active Jan 23, 2021
How to rescue ActionDispatch::Http::MimeNegotiation::InvalidType in API controller for Rails 6.1+ and render nice JSON error. Learn more how you could run RSpec/Minitest tests faster in Rails app
View api_controller.rb
# This is example how to rescue from exception ActionDispatch::Http::MimeNegotiation::InvalidType
# and show nice JSON error in your API
module API
class BaseController < ActionController::API
def process_action(*args)
rescue ActionDispatch::Http::MimeNegotiation::InvalidType => exception
# set valid Content-Type to be able to call render method below
request.headers['Content-Type'] = 'application/json'
render status: 400, json: { errors: [exception.message] }
ArturT /
Created May 14, 2020 — forked from isaacsanders/
Joel Spolsky on Equity for Startups

This is a post by Joel Spolsky. The original post is linked at the bottom.

This is such a common question here and elsewhere that I will attempt to write the world's most canonical answer to this question. Hopefully in the future when someone on answers.onstartups asks how to split up the ownership of their new company, you can simply point to this answer.

The most important principle: Fairness, and the perception of fairness, is much more valuable than owning a large stake. Almost everything that can go wrong in a startup will go wrong, and one of the biggest things that can go wrong is huge, angry, shouting matches between the founders as to who worked harder, who owns more, whose idea was it anyway, etc. That is why I would always rather split a new company 50-50 with a friend than insist on owning 60% because "it was my idea," or because "I was more experienced" or anything else. Why? Because if I split the company 60-40, the company is going to fail when we argue ourselves to death. And if you ju

ArturT / Unix Philosophy - rules
Created Mar 22, 2020 — forked from olgaczarnecka/Unix Philosophy - rules
Some notes regarding Unix Philosophy (actually in my opinion they apply to general good programming practices) based on "The Art of Unix Programming by Eric Steven Raymond" (
View Unix Philosophy - rules
Basics of Unix philosophy:
- Use simple algorithms as well as simple data structures
- Data structures, not algorithms are central to programming - organise it well
- Fancy algorithms are buggier than simple ones
Modularity - build out simple parts connected by well defined interfaces. Be able to update/upgrade the part without breaking the whole.
ArturT / postgres-upgrade-database-failed.log
Last active Mar 5, 2020
Postgres 11 to 12 upgrade database failed. Solution to fix it.
View postgres-upgrade-database-failed.log
brew postgresql-upgrade-database
==> Upgrading postgresql data from 11 to 12...
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
Referenced from: /usr/local/Cellar/postgresql@11/11.7/bin/postgres
Reason: image not found
no data was returned by command ""/usr/local/Cellar/postgresql@11/11.7/bin/postgres" -V"
The program "postgres" is needed by pg_ctl but was not found in the
same directory as "/usr/local/Cellar/postgresql@11/11.7/bin/pg_ctl".
Check your installation.
==> Moving postgresql data from /usr/local/var/postgres to /usr/local/var/postgres.old..
ArturT /
Created Feb 4, 2020
Run flaky test til it fails
while [ "$?" == 0 ]; do rspec spec/flaky_spec.rb:123; done
ArturT / cypress-codefresh.yml
Created Oct 19, 2019 example for E2E test runner - parallel testing. Example from blog post
View cypress-codefresh.yml
# .codefresh/codefresh.yml
version: "1.0"
- "clone"
- "build"
- "tests"
ArturT / Test.Dockerfile
Created Oct 11, 2019 matrix configuration for running parallel tests with Knapsack Pro for Ruby on Rails project (PostgreSQL + Docker setup). Follow installation guide for knapsack_pro ruby gem here or learn more about it at
View Test.Dockerfile
# Test.Dockerfile
FROM ruby:2.6.5-alpine3.10
# Prepare Docker image for Nokogiri
RUN apk add --update \
build-base \
libxml2-dev \
libxslt-dev \
jq \
nodejs \
View main.yaml
# .github/workflows/main.yaml
name: Main
on: [push]
name: CI
runs-on: ubuntu-latest