Skip to content

Instantly share code, notes, and snippets.

View egormkn's full-sized avatar

Egor Makarenko egormkn

View GitHub Profile
@phoemur
phoemur / avltree.hpp
Last active November 30, 2023 02:46
AVL Tree implemented in modern C++ (C++14), using smart_pointers for memory management, move semantics and variadic number of elements for insert and remove
// based on https://users.cs.fiu.edu/~weiss/dsaa_c++4/code/AvlTree.h
#ifndef AVL_TREE_HEADER_MAIN
#define AVL_TREE_HEADER_MAIN
#include <algorithm>
#include <initializer_list>
#include <iostream>
#include <iterator>
#include <memory>
@VictorTaelin
VictorTaelin / promise_monad.md
Last active May 10, 2024 04:22
async/await is just the do-notation of the Promise monad

async/await is just the do-notation of the Promise monad

CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.

In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.

First, let's illustrate the 3 styles by implementing

@martinbuberl
martinbuberl / git-import-repository.md
Last active June 20, 2024 10:42
Import existing Git repository into another

Import existing Git repository into another

Folder structure before (2 separate repositories):

XXX
 |- .git
 |- (project files)
YYY
 |- .git
@fliedonion
fliedonion / !GIST file list order - summary.md
Last active June 25, 2024 04:32
Understand GIST file list order.
Summary How to control (or Understand) your GIST page's files list order.
Notice not official documentation.
@lcaballero
lcaballero / tmLaguage Syntax Keys
Created February 26, 2013 04:33
Scraped .tmLanguage files. Looking for the syntax keys, which in this pulls only the name tags with dotted, fully qualified, tuples (so not very sophisticated).
comment.block.antlr
comment.block.applescript
comment.block.bibtex
comment.block.c
comment.block.css
comment.block.d
comment.block.documentation
comment.block.documentation.javadoc
comment.block.documentation.js
comment.block.documentation.json
@jewelsea
jewelsea / ServiceTest.java
Created May 23, 2012 10:29
JavaFX Service example
import javafx.animation.*;
import javafx.application.Application;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.*;
import javafx.concurrent.*;
import javafx.event.*;
import javafx.geometry.*;
import javafx.scene.Scene;
@joergschiller
joergschiller / a2dp_sink_ubuntu_linux.md
Created January 24, 2012 23:05
A2DP Sink on Ubuntu Linux with bluez (streaming bluetooth stereo audio from smartphone to pc)

Howto Enable and Use A2DP Sink on Ubuntu Linux with Bluez

  1. Add Enable=Source to /etc/bluetooth/audio.conf right after [General].

  2. Find address in form XX:XX:XX:XX:XX:XX of phone with hcitool scan.

  3. Pair and trust smartphone with sudo bluez-simple-agent hci0 XX:XX:XX:XX:XX:XX and sudo bluez-test-device trusted XX:XX:XX:XX:XX:XX yes.

  4. Create loopback in pulseaudio connection bluetooth a2dp source with alsa sink: