Skip to content

Instantly share code, notes, and snippets.

View rasmar's full-sized avatar

Marcin Raszkiewicz rasmar

View GitHub Profile
Task 1: Create a project jumphost instance
Navigation menu > Compute engine > VM Instance
Task 2: Create a Kubernetes service cluster
gcloud config set compute/zone us-east1-b
gcloud container clusters create nucleus-webserver1
@rasmar
rasmar / .config.yml
Last active August 5, 2019 03:05
Frontend E2E Circle 2.0 config
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:8.2.1
version: 2
jobs:
checkout_code:
<<: *defaults
steps:
@rasmar
rasmar / config.yml
Created May 19, 2018 15:12
Backend E2E CircleCI 2.0 config
version: 2
defaults: &defaults
working_directory: ~/project
docker:
- image: circleci/ruby:2.5.1-stretch-browsers
environment:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
@rasmar
rasmar / rubocop.yml
Created March 13, 2018 11:04
rubocop.yml
AllCops:
Include:
- "**/*.rake"
- "**/Gemfile"
- "**/Rakefile"
Exclude:
- "vendor/**/*"
- "db/**/*"
- "**/Guardfile"
- "config/environments/**/*"
@rasmar
rasmar / docker.sh
Created February 24, 2018 18:17
E2E - docker commands
$ docker ps # show running containers
$ docker ps -a # show all containers
$ docker ps -n=-1 # show n last created containers
$ docker start <container_name> # start container
$ docker stop <container_name> # stop container
$ docker cp <container_name>:<src> <dest> # copy file/directory from container to destinated dir in machine
$ docker cp <src> <container_name>:<dest> # copy file/directory from machine to container (don't get deceived, read 'understanding volumes' article)
$ docker images # list all images
$ docker rm -f <container_name> # remove container
$ docker rmi <image_name> # remove image
@rasmar
rasmar / e2e.sh
Last active March 9, 2018 12:14
E2E - backend start script
#!/bin/bash
echo "Setting up and running e2e tests!"
# Create database and seed (since we might want to include some data needed for our app to work properly like oauth clients
rails db:setup
# Start puma server in e2e environment on meta-address host on port 5001 in detached mode
RAILS_ENV=e2e puma -b tcp://0.0.0.0:5001 -d
@rasmar
rasmar / css_style.scss
Last active January 16, 2018 21:41
SASS style guide
// WORST CODE EVER
@mixin test-mixin($width) {
width: $width;
}
#important_thing {
size: 100px !important;
}
.myClass{
height:30px;
@rasmar
rasmar / git_commands.md
Last active January 16, 2018 20:42
GIT

git merge

One way of combining data from two branches is to use merging tool. Merge can be done by fast-forward or by recursive-strategy. Fast-forward is used when commits on a branch we want to merge to the current one are directly ahead of current HEAD. Git just moves pointer to the last commit. In other cases git looks for a common ancestor in two branches and starts from there trying to add changes to current branch. Sometimes this may result in conflicts which need to be resolved. Merging tool can be used by git mergetool.

git rebase

This is the second way of integrating data of branches. Rebase works little different than merge. After merge git history shows that there was parallel work done, with rebase it looks like its continous. Rebase works by going to the common ancestor of the two branches (the one you’re on and the one you’re rebasing onto), getting the diff introduced by each commit of the branch you’re on, saving those d

@rasmar
rasmar / optimising_databases.md
Last active January 15, 2018 21:47
Optimising databases

SQL Databases

Underlying structure of these databases are rows and columns. They are called relational databases. This term doesn't address Rails relations - associations, but relations between data. Data is linked by keys. Main databases used across the world: postgresql, mysql, sqllite All SQL databases require creating migrations in rails.

PostgreSQL vs MySQL vs SQLite

PostreSQL is one of the best maintained databases. It is flexible and powerfull, but not so easy to use, because it requires running server and have its own syntax.

@rasmar
rasmar / create_user_via_facebook_spec.rb
Last active February 23, 2018 15:52
Juniorship - specs
# frozen_string_literal: true
require "rails_helper"
describe OAuthServices::Create::CreateUserViaFacebook do
describe "#call" do
let(:id) { rand(100000..999999).to_s }
let(:email) { "john.doe@example.com" }
let(:languages) { [{ id: "106059522759137", name: "English" }] }
let(:photo_url) { "#{provider_api_url}#{id}/#{provider_api_silhouette_suffix}" }