Skip to content

Instantly share code, notes, and snippets.

View ahlinc's full-sized avatar

Andrew Hlynskyi ahlinc

  • Ukraine, Kyiv
View GitHub Profile
use core::future::Future;
use core::pin::Pin;
use core::task::Poll;
use futures_core::Stream;
/// Item to return from stream.
pub struct StreamItem {
pub append_length: usize,
}
/// State shared between each sequential item computation.
@hackape
hackape / checker_mod.ts
Last active January 26, 2023 15:18
Answer to Stack Overflow Question: "How can I see how TypeScript computes types?"
// https://github.com/microsoft/TypeScript/blob/ba5e86f1406f39e89d56d4b32fd6ff8de09a0bf3/src/compiler/checker.ts
// 1. add this line to ln:3
export const _conditionalTypes: any = {}
// 2. then replace ln:12303 to ln:12360
function trackConditionalType() {
// one time stuff
@rust-play
rust-play / playground.rs
Created December 7, 2018 22:55
Code shared from the Rust Playground
type BarberId= usize;
type ShopId = usize;
struct Shop {
barber: Option<BarberId>,
}
struct Barber {
shop: Option<ShopId>,
}
@Aerijo
Aerijo / tree_sitter_guide.md
Last active May 16, 2024 11:06
Guide to writing your first Tree-sitter grammar

Guide to your first Tree-sitter grammar

NOTE: The Tree-sitter API and documentation has changed and improved since this guide was created. I can't guarantee this is up to date.

About

Tree-sitter is the new way Atom is providing language recognition features, such as syntax highlighting, code folding, autocomplete, and more. In contrast to TextMate grammars, which work by regex matching, Tree-sitter will generate an entire syntax tree. But more on that can be found in it's own docs.

Here, we look at making one from scratch.

@althonos
althonos / setup.cfg
Last active March 4, 2024 18:08
A `setup.cfg` template for my Python projects
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author_email = martin.larralde@embl.de
url = https://github.com/althonos/{name}
description = {description}
long_description = file: README.md
@wanglf
wanglf / vscode-extension-offline.md
Last active May 3, 2024 06:06
Download VS Code extensions as VSIX

How to use?

  • Copy content of vsix-bookmarklet, create a bookmark in your browser.
  • Navigate to the web page of the VS Code extension you want to install.
  • Click the bookmark you just created, then click the download button.
    download
  • After download finished, rename the file extension to *.vsix.
  • In VS Code, select Install from VSIX... in the extension context menu.
    vsc
@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active May 19, 2024 03:51
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@ekreutz
ekreutz / ansible_variable_precedence.md
Last active April 25, 2024 17:43
Ansible variable precedence (order, hierarchy)
@parkovski
parkovski / 1-traits.cpp
Last active September 1, 2021 11:57
"Trait" vtables
#include <stdio.h>
class PartialEq {
public:
virtual bool eq(PartialEq *const) const = 0;
};
class PartialOrd {
public:
virtual int partial_cmp(PartialOrd *const) const = 0;