Skip to content

Instantly share code, notes, and snippets.

View Voronar's full-sized avatar
💭
Let functions be functions!

Kirill Alexander Khalitov Voronar

💭
Let functions be functions!
View GitHub Profile
@likev
likev / V8-leak-test.js
Last active February 13, 2020 01:02
A V8 bug that cause Node.js(and also V8-related browsers and APPs) memory leak
let create_leak_class = () => {
function Leak() {
//call an unused prototype method
this.unused();
}
Leak.prototype.unused = () => {
@tkrotoff
tkrotoff / FrontendFrameworksPopularity.md
Last active July 11, 2025 10:13
Front-end frameworks popularity (React, Vue, Angular and Svelte)
@repodevs
repodevs / macOS.sh
Created December 12, 2018 14:56
gpg: signing failed: Inappropriate ioctl for device macOS
❱ git config user.signingKey 38AF394C
❱ git config commit.gpgSign true
echo "test" | gpg --clearsign
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
test
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device
@gcatlin
gcatlin / sdl-opengl-example.c
Last active November 1, 2024 00:07
Minimal C SDL2 OpenGL example
//
// cc main.c glad.c -lSDL2
//
#include "glad.h" // https://glad.dav1d.de/
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <stdbool.h>
int main()
{
@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.
@Robbepop
Robbepop / .rustfmt.toml
Created March 16, 2017 18:19
.rustfmt.toml with all configs, descriptions, parameters and defaults for version 0.7.1 of rustfmt.
# ----------------------------------------------------------------------------------
# r u s t f m t - C O N F I G
# ==================================================================================
#
# Version: 0.7.1
# Author : Robbepop <[email protected]>
#
# A predefined .rustfmt.toml file with all configuration options and their
# associated description, possible values and default values for use in other
# projects.
@mihow
mihow / load_dotenv.sh
Last active July 10, 2025 11:45
Load environment variables from dotenv / .env file in Bash
# The initial version
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
# My favorite from the comments. Thanks @richarddewit & others!
set -a && source .env && set +a
@cspotcode
cspotcode / README.md
Last active February 28, 2017 08:18
ts-loader .jsx bug reproduction

To reproduce:

$ npm install
$ npm run tsc
# tsc emits all code to tsc-out as expected
$ npm run webpack
# Errors indicate that it can't find either .jsx files but it can find the .js files

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