Skip to content

Instantly share code, notes, and snippets.

View alexanderfefelov's full-sized avatar
💭
Bluetooth Ninja

Alexander Fefelov alexanderfefelov

💭
Bluetooth Ninja
View GitHub Profile
@wlib
wlib / LICENSE
Last active April 30, 2024 17:07
Run a shell script with bash, line-by-line, prompted on each command. Useful for running unknown scripts or debugging. Not a secure substitute for understanding a script beforehand.
MIT License
Copyright (c) 2021 Daniel Ethridge
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@cwillmor
cwillmor / ells.pde
Created January 25, 2021 02:50
ells.pde (L-tiling clock in processing)
// ell clock https://twitter.com/cwillmore/status/1353435612636803073
// developed with processing 3.5.4 (processing.org)
// TODO:
// - motion blur
// - ripple update of ells - one only starts rotating when it has room to (<< ... <> ... >>)
static final int DEPTH = 3;
static final int N = 1 << (DEPTH + 1);
static final int FRAME_RATE = 30;
static final float DT = 1 / (float)FRAME_RATE;
@melvic-ybanez
melvic-ybanez / what-i-didnt-know-about-fp-2020.md
Last active August 1, 2024 08:25
What I Didn't Know about Functional Programming until 2020

What I Didn't Know about Functional Programming until 2020

  1. Programming using a series of transformations and aggregations, something I've been doing for years, is known as programming in the map/reduce style.
  2. The more abstract the type is, the greater its cardinality, and the smaller the set of operations it supports. So make use of universal quantifiers, particularly by implementing fully parametric functions. They guide you on how to implement their term-level definitions by narrowing down the number of possible implementations. In other words, the type system of Scala (or Haskell, for that matter) is not only great for capturing compile-time errors, but is also capable of leading you to the correct solution.
  3. You can encode union types by combining different Scala features such as type constructors, subtyping and implicits, and by taking advantage of the Curry-Howard Isomorphism and De Morgan's Laws for neg
@graninas
graninas / haskeller_competency_matrix.md
Last active November 18, 2024 08:12
Haskeller competency matrix
@kspar
kspar / ExceptionExtensions.kt
Created January 16, 2019 20:39
Exception stack trace as string in Kotlin
import java.io.PrintWriter
import java.io.StringWriter
// Extension property on Exception
val Exception.stackTraceString: String
get() {
val stringWriter = StringWriter()
this.printStackTrace(PrintWriter(stringWriter))
return stringWriter.toString()
}
@gvolpe
gvolpe / di-in-fp.md
Last active September 16, 2024 07:18
Dependency Injection in Functional Programming

Dependency Injection in Functional Programming

There exist several DI frameworks / libraries in the Scala ecosystem. But the more functional code you write the more you'll realize there's no need to use any of them.

A few of the most claimed benefits are the following:

  • Dependency Injection.
  • Life cycle management.
  • Dependency graph rewriting.
@rsp
rsp / GitHub-Project-Guidelines.md
Last active June 11, 2024 12:41
Git Strict Flow and GitHub Project Guidelines - setup rules and git flow for commercial and open-source projects by @rsp

Git Strict Flow and GitHub Project Guidelines

Or how to turn this:

into this:

package fasterparser
import scala.collection.mutable
object Parse {
def main(args: Array[String]): Unit = {
def hello[_:Ctx] = P( "hello" )
def world[_:Ctx] = P( "world" )
def helloWorld[_:Ctx] = P( hello.! ~ (" " | ",").rep ~ world.! )

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@ericclemmons
ericclemmons / example.md
Last active September 20, 2024 12:46
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here