Skip to content

Instantly share code, notes, and snippets.

View mtavkhelidze's full-sized avatar
🇬🇪
OOP is an exceptionally bad idea which could only have originated in California.

Misha Tavkhelidze mtavkhelidze

🇬🇪
OOP is an exceptionally bad idea which could only have originated in California.
View GitHub Profile
@mtavkhelidze
mtavkhelidze / match_case.py
Last active June 1, 2023 05:05
Scala-like case class pattern matching in Python >= 3.10
import math
from dataclasses import dataclass
from math import sqrt
"""
Scala-like case class pattern mathing in python >= 3.10
"""
@dataclass(frozen=True)
FROM alpine:3.10
ARG SPARK_VERSION=3.0.0-preview
ARG HADOOP_VERSION_SHORT=3.2
ARG HADOOP_VERSION=3.2.0
ARG AWS_SDK_VERSION=1.11.375
RUN apk add --no-cache bash openjdk8-jre python3
# Download and extract Spark
@mtavkhelidze
mtavkhelidze / .scalafmt.conf
Last active March 17, 2024 07:42
Dot scalafmt.conf
align.preset = none
# From https://scalameta.org/scalafmt/docs/configuration.html
#
# Keep in mind that 80 characters fit perfectly on a split laptop
# screen with regular resolution.
#
# GitHub mobile view only shows 80 characters and sometimes you might
# review code on your phone.
#
# Consider refactoring your code before choosing a value above 100.
@mtavkhelidze
mtavkhelidze / build.sbt
Last active March 17, 2024 07:44
Dot build.sbt
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "3.4.0"
lazy val fpsCode = (project in file("."))
.settings(
name := "fps-code",
idePackagePrefix := Some("ge.zgharbi.study.fps"),
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % "0.7.29" % Test,
@mtavkhelidze
mtavkhelidze / CMakeLists.txt
Last active September 5, 2024 13:22
Template CMakeLists with GoogleTest
cmake_minimum_required(VERSION 3.30)
project(project_cpp VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror" CACHE PATH "" FORCE)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test/lib)
@mtavkhelidze
mtavkhelidze / Protected.tsx
Last active November 17, 2024 05:43
A component for protection of routes, for example when using `wouter`
import React, { type PropsWithChildren } from "react";
type Props = {
with: () => boolean;
} & PropsWithChildren
const Protected: React.FC<Props> = props =>
props.with() ? <>{props.children}</> : <UserLogin />;