Skip to content

Instantly share code, notes, and snippets.

View ygrenzinger's full-sized avatar

Yannick Grenzinger ygrenzinger

View GitHub Profile
@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
}
"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 / 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 / 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 / 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 / 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 / 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> {
@ygrenzinger
ygrenzinger / Matrix.kt
Created May 9, 2020 19:26
Jetbrains academy Matrix
package processor
import java.math.RoundingMode
import java.text.DecimalFormat
import java.text.NumberFormat
import java.util.*
import kotlin.math.pow
data class Matrix(val rowSize: Int, val columnSize: Int, val data: List<List<Double>>) {
@ygrenzinger
ygrenzinger / MineSweeper.kt
Created May 8, 2020 06:09
Minesweeper project from Jetbrain academy
package minesweeper
import java.util.*
import kotlin.random.Random
enum class Command {
MARK, EXPLORE
}
enum class State {