Skip to content

Instantly share code, notes, and snippets.

Avatar

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
options:
max-time: 30
# job definition for running E2E tests in parallel with KnapsackPro.com
e2e: &e2e
name: Run E2E tests with @knapsack-pro/cypress
caches:
@ArturT
ArturT / parallel-builds.md
Last active Mar 5, 2021
Buildkite parallel builds
View parallel-builds.md

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
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 https://docs.knapsackpro.com/2020/how-to-speed-up-ruby-and-javascript-tests-with-ci-parallelisation
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)
super
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
ArturT / Equity.md
Created May 14, 2020 — forked from isaacsanders/Equity.md
Joel Spolsky on Equity for Startups
View Equity.md

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
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" (http://www.catb.org/esr/writings/taoup/html/graphics/taoup.pdf)
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
Rules:
Modularity - build out simple parts connected by well defined interfaces. Be able to update/upgrade the part without breaking the whole.
@ArturT
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
ArturT / run_flaky_test_til_fail.sh
Created Feb 4, 2020
Run flaky test til it fails
View run_flaky_test_til_fail.sh
while [ "$?" == 0 ]; do rspec spec/flaky_spec.rb:123; done
@ArturT
ArturT / cypress-codefresh.yml
Created Oct 19, 2019
Codefresh.io example for Cypress.io E2E test runner - parallel testing. Example from blog post https://docs.knapsackpro.com/2019/how-to-run-cypress-parallel-tests-on-codefresh-ci-server
View cypress-codefresh.yml
# .codefresh/codefresh.yml
version: "1.0"
stages:
- "clone"
- "build"
- "tests"
steps:
main_clone:
@ArturT
ArturT / Test.Dockerfile
Created Oct 11, 2019
Codefresh.io 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 https://docs.knapsackpro.com/knapsack_pro-ruby/guide/ or learn more about it at https://knapsackpro.com
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]
jobs:
vm-job:
name: CI
runs-on: ubuntu-latest