Skip to content

Instantly share code, notes, and snippets.

View MatejBransky's full-sized avatar
💭
I may be slow to respond.

Matej Bransky MatejBransky

💭
I may be slow to respond.
View GitHub Profile
@MatejBransky
MatejBransky / ArtistList.js
Created November 22, 2023 12:51 — forked from n1ru4l/ArtistList.js
mobx + apollo-client + react
import React from 'react'
import { observer } from 'mobx-react'
function ArtistList({ uiState: { artistData } }) {
const { data } = artistData;
if ( !data || !data.artists || !data.artists.length ) {
return <div>No artists bruh.</div>
}
const { artists } = data
return (
@MatejBransky
MatejBransky / clean-architecture.md
Last active April 3, 2022 21:23
Clean Architecture (Domain Driven Design)

Clean Architecture

Domain Layer

At the center is the domain layer. It is the entities and data that describe the subject area of the application, as well as the code to transform that data. The domain is the core that distinguishes one application from another.

You can think of the domain as something that won't change if we move from React to Angular, or if we change some use case. In the case of the store, these are products, orders, users, cart, and functions to update their data.

The data structure of domain entities and the essence of their transformations are independent from the outer world. External events trigger domain transformations, but do not determine how they will occur. >

@MatejBransky
MatejBransky / commands.sh
Created September 20, 2021 11:57
Git - keep a feature branch up to date with the master/main branch
git checkout main
git pull
git checkout <feature-branch>
git rebase -Xours master
@MatejBransky
MatejBransky / prepare-commit-msg.sh
Last active April 22, 2020 07:19
Inspects branch name and checks if it contains a Jira ticket number. If yes, commit message will be automatically prepended with it.
#!/bin/bash
# Check if the COMMIT_EDITMSG file exists (the case was found at GIT GUI)
if [ ! -f "$1" ]; then
exit
fi
#
# Inspects branch name and checks if it contains a Jira ticket number (i.e. ABC-123).
# If yes, commit message will be automatically prepended with [ABC-123].
@MatejBransky
MatejBransky / machine.js
Created January 31, 2020 11:28
Generated by XState Viz: https://xstate.js.org/viz
/**
* The copy of the stateMachine.js for Visualizer (modified imports)
*/
// Available variables:
// Machine (machine factory function)
// XState (all XState exports)
const settings = {
steps: 20,
@MatejBransky
MatejBransky / SQL-exercise-01.md
Last active June 6, 2019 13:03
SQL-exercise-01

Zadani

Mas tabulku s tymy

INSERT  INTO  `tymy` (`id`, `name`) VALUES
(1, 'Brno'),
(2, 'Praha'),
(3, 'Ostrava'),
(4, 'Plzen');
@MatejBransky
MatejBransky / README.md
Created April 22, 2018 07:40 — forked from dominikwilkowski/README.md
Flatten javascript objects into a single-depth object with ES6

Flatten a deep javascript object into single-depth object with ES6

Call it via:

const flat = flatten( realDeepObject );

Test case: