Skip to content

Instantly share code, notes, and snippets.

View Lipen's full-sized avatar
🐈
Working from home

Konstantin Chukharev Lipen

🐈
Working from home
View GitHub Profile
@klmr
klmr / generator.md
Last active August 28, 2022 02:26
Python-like generators in R

A little experiment using restarts.

(And while we’re at it, let’s torture R’s syntax a little.)

![screenshot][]

In the following we will be using R’s “restarts” feature to implement the state machine that drives generators in languages such as Python. Generators allow lazily generating values on demand: a consumer invokes a generator, and consumes values as they are produced. A new value is only produced once the previous one has been consumed.

@dcode
dcode / GitHub Flavored Asciidoc (GFA).adoc
Last active June 23, 2024 21:12
Demo of some useful tips for using Asciidoc on GitHub

GitHub Flavored Asciidoc (GFA)

@Takhion
Takhion / ExhaustiveWhen.kt
Last active July 28, 2021 19:19
Exhaustive `when` mapping in Kotlin
@file:Suppress("PackageDirectoryMismatch") // root package looks great when importing, ie. `import exhaustive`
/**
* Allows requiring an exhaustive mapping in a `when` block when used with the [rangeTo] operator.
* @sample [exhaustive_when_example]
*/
@Suppress("ClassName") // lowercase because it should look like a keyword
object exhaustive {
@genadyp
genadyp / bdd.md
Last active May 8, 2022 12:41
BDD - Binary Decision Diagrams
@jacekkopecky
jacekkopecky / index.js
Created May 20, 2021 16:47
Custom javascript for github.com projects: In GitHub project boards, double click on a card, or select a card and press 'e' to edit it.
// double click on a card, or select a card and press e, to edit it
document.addEventListener('keyup', (e) => {
if (e.key === 'e' && document.activeElement?.classList.contains('project-card')) {
const buttons = document.activeElement.querySelectorAll('details button[role=menuitem]');
for (const btn of buttons) {
if (btn.textContent === 'Edit note') btn.click();
}
}
});