Skip to content

Instantly share code, notes, and snippets.

@dkul108
dkul108 / clean_code.md
Created July 1, 2024 12:27 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@dkul108
dkul108 / cdk-podman-buildah-on-codebuild.ts
Created August 14, 2023 16:56 — forked from neilkuan/cdk-podman-buildah-on-codebuild.ts
cdk-podman-buildah-on-codebuild.ts
import * as path from 'path';
import * as codebuild from '@aws-cdk/aws-codebuild';
import * as codecommit from '@aws-cdk/aws-codecommit';
import * as ecr from '@aws-cdk/aws-ecr';
import * as iam from '@aws-cdk/aws-iam';
import { App, Construct, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core';
export class MyStack extends Stack {
@dkul108
dkul108 / main.go
Created October 11, 2022 12:48 — forked from kartiksura/main.go
Querying AWS Athena using Golang SDK
package main
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/athena"
)
@dkul108
dkul108 / build.sbt
Created November 16, 2020 14:15 — forked from jpablo/build.sbt
Using discipline to test Category laws
val dottyVersion = "0.20.0-RC1"
lazy val root = project
.in(file("."))
.settings(
name := "discipline-example",
version := "0.1.0",
libraryDependencies ++= Seq(
"com.novocode" % "junit-interface" % "0.11" % "test",
("org.typelevel" % "cats-core_2.13" % "2.0.0").withDottyCompat(scalaVersion.value),
@dkul108
dkul108 / Libraries.md
Created September 28, 2020 11:37 — forked from ChristopherDavenport/Libraries.md
A Current Listing of Libraries
@dkul108
dkul108 / Logic.idr
Created August 1, 2020 16:13 — forked from mbbx6spp/Logic.idr
Propositions *AS* Types: The Cheatsheet (with Fancy Nancy)
module Logic
-- Connective is a fancy word for operator.
namespace Connectives
-- Truth: Also known as the "unit" type, (there is only one truth in value,
-- literally).
-- Scala: type Truth = Unit
-- Haskell: type Truth = ()
Truth : Type
@dkul108
dkul108 / Arity.kt
Created April 3, 2020 21:14 — forked from asm0dey/Arity.kt
Variable arity data classes for Kotlin
fun <A> c(a: A) = Arity1(a)
fun <A, B> c(a: A, b: B) = Arity2(a, b)
fun <A, B, C> c(a: A, b: B, c: C) = Arity3(a, b, c)
fun <A, B, C, D> c(a: A, b: B, c: C, d: D) = Arity4(a, b, c, d)
fun <A, B, C, D, E> c(a: A, b: B, c: C, d: D, e: E) = Arity5(a, b, c, d, e)
fun <A, B, C, D, E, F> c(a: A, b: B, c: C, d: D, e: E, f: F) = Arity6(a, b, c, d, e, f)
fun <A, B, C, D, E, F, G> c(a: A, b: B, c: C, d: D, e: E, f: F, g: G) = Arity7(a, b, c, d, e, f, g)
fun <A, B, C, D, E, F, G, H> c(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) = Arity8(a, b, c, d, e, f, g, h)
fun <A, B, C, D, E, F, G, H, I> c(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I) = Arity9(a, b, c, d, e, f, g, h, i)
fun <A, B, C, D, E, F, G, H, I, J> c(a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J) = Arity10(a, b, c, d, e, f, g, h, i, j)
@dkul108
dkul108 / Applicative.scala
Created March 28, 2020 23:05 — forked from DanielaSfregola/Applicative.scala
tutorial-cat-solutions
package com.danielasfregola.tutorial.cat.applicative
import com.danielasfregola.tutorial.cat.functor.Functor
trait Applicative[Box[_]] extends Functor[Box] {
def pure[A](a: A): Box[A]
def ap[A, B](boxF: Box[A => B])(boxA: Box[A]): Box[B]
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.Function;
// Profunctor Optics
// http://programming-journal.org/2017/1/7/
public interface Optics {
static void main(final String[] args) {
System.out.println(Pair.<String, Optional<Pair<Integer, Boolean>>>