Skip to content

Instantly share code, notes, and snippets.

View ygrenzinger's full-sized avatar

Yannick Grenzinger ygrenzinger

View GitHub Profile
@ygrenzinger
ygrenzinger / CleanArchitecture.md
Last active March 31, 2024 13:57
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

@ygrenzinger
ygrenzinger / test.ts
Created December 15, 2023 15:49
Refactoring of the code at the end of the interview
// ================================================
// ==== ⬇️🚫 DO NOT TOUCH CODE BELOW HERE 🚫⬇️ ====
// ************ DATABASE STUFF ***************
interface EventModel {
id: number
kind: string
starts_at: string
ends_at: string
}
@ygrenzinger
ygrenzinger / Main.kt
Created March 5, 2021 20:11
Number Base Converter
package converter
import java.math.BigDecimal
import kotlin.math.pow
tailrec fun convertFromDecimal(rest: Long, base: Int, result: List<String>): List<String> {
return if (rest < base) {
result + rest.toString(base)
} else {
val remainder = rest % base
@ygrenzinger
ygrenzinger / MonadExs.hs
Last active December 14, 2022 07:39
Functor -> Applicative -> Monad typeclasses
-- Two datatypes
data Optional a = Some a | Empty deriving (Eq, Show)
data Or a b = A a | B b deriving (Eq, Show)
-- functor instances
instance Functor Optional where
fmap f (Some a) = Some (f a)
fmap _ Empty = Empty
instance Functor (Or a) where
"use strict";
const _ = require('lodash');
const assert = require('assert');
const Mocha = require('mocha')
const mocha = new Mocha();
mocha.suite.emit('pre-require', this, 'solution', mocha);
const sinon = require("sinon");
const OperationType = {
@ygrenzinger
ygrenzinger / weird.html
Created May 20, 2020 08:08
I don't understand this effet when I add a X in div
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Main</title>
<style>
body {
padding: 0;
margin: 0;
}
@ygrenzinger
ygrenzinger / scoopit_scrap.py
Created March 9, 2021 14:24
Scraping scoop.it
# coding=utf-8
# This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
import scrapy
from requests import get
from scrapy import Selector
import json
@ygrenzinger
ygrenzinger / Parser.scala
Last active February 5, 2021 09:13
Kata Becom Tech 2021-02-03
import scala.util.matching.Regex
trait Element
case class Number(value: Int) extends Element
object PlusOperator extends Element
case class ParseResult(elements: List[Element], rest: String)
@ygrenzinger
ygrenzinger / tic-tac-toe.py
Created August 9, 2020 18:42
Tic Tac Toe
# more info here https://github.com/Cledersonbc/tic-tac-toe-minimax
import random
from enum import Enum
from math import inf as infinity
class PlayerType(Enum):
USER = 1
EASY = 2
@ygrenzinger
ygrenzinger / SimpleSearchEngine.kt
Created May 13, 2020 14:26
Jetbrains academy SimpleSearchEngine
package search
import java.io.File
import java.util.*
typealias InvertedSearchData = MutableMap<String, Set<Int>>
enum class MatchingStrategy() {
ALL {
override fun execQuery(invertedSearch: InvertedSearchData, words: List<String>): Set<Int> {