Skip to content

Instantly share code, notes, and snippets.

View EduVencovsky's full-sized avatar
🎯
Focusing

Eduardo Vencovsky EduVencovsky

🎯
Focusing
View GitHub Profile
/**
* `Char` represents a single-byte character.
*/
// prettier-ignore
export type Char =
| "\x00" | "\x01" | "\x02" | "\x03" | "\x04" | "\x05" | "\x06" | "\x07"
| "\x08" | "\x09" | "\x0A" | "\x0B" | "\x0C" | "\x0D" | "\x0E" | "\x0F"
| "\x10" | "\x11" | "\x12" | "\x13" | "\x14" | "\x15" | "\x16" | "\x17"
| "\x18" | "\x19" | "\x1A" | "\x1B" | "\x1C" | "\x1D" | "\x1E" | "\x1F"
| "\x20" | "\x21" | "\x22" | "\x23" | "\x24" | "\x25" | "\x26" | "\x27"
type CountTo<N extends number, S extends 0[] = []> = S["length"] extends N
? S
: CountTo<N, [...S, 0]>;
type Inc<N extends number> = [...CountTo<N>, 0]["length"];
type Dec<N extends number> = CountTo<N> extends [infer _H, ...infer T]
? T["length"]
: 0;
type Before<
Memory extends number[],
@tumainimosha
tumainimosha / page-info.ts
Last active August 29, 2023 11:02
NestJS Graphql Cursor Based pagination
import { ObjectType, Field } from "@nestjs/graphql";
@ObjectType()
export class PageInfo {
@Field({ nullable: true })
startCursor: string;
@Field({ nullable: true })
endCursor: string;
@vovimayhem
vovimayhem / dev.Dockerfile
Created August 18, 2017 00:02
PhantomJS on Alpine (Docker)
# 1: Use node 6 as base:
FROM node:6-alpine
# 2: Download+Install PhantomJS, as the npm package 'phantomjs-prebuilt' won't work on alpine!
# See https://github.com/dustinblackman/phantomized
RUN set -ex \
&& apk add --no-cache --virtual .build-deps ca-certificates openssl \
&& wget -qO- "https://github.com/dustinblackman/phantomized/releases/download/2.1.1/dockerized-phantomjs.tar.gz" | tar xz -C / \
&& npm install -g phantomjs \
&& apk del .build-deps
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 5, 2024 06:09
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@mmazzarolo
mmazzarolo / hideOnScroll.js
Last active October 31, 2023 07:32
react-native-action-button hide on scroll
// 1. Define a state variable for showing/hiding the action-button
state = {
isActionButtonVisible: true
}
// 2. Define a variable that will keep track of the current scroll position
_listViewOffset = 0
// 3. Add an onScroll listener to your listview/scrollview
<ListView
@deeplook
deeplook / pi_digits.py
Created February 13, 2013 20:16
Generate digits of Pi using a spigot algorithm.
"""
Run the algorithm below using CPython, Cython, PyPy and Numba and compare
their performance. (This is implementing a spigot algorithm by A. Sale,
D. Saada, S. Rabinowitz, mentioned on
http://mail.python.org/pipermail/edu-sig/2012-December/010721.html).
"""
def pi_digits(n):
"Generate n digits of Pi."
k, a, b, a1, b1 = 2, 4, 1, 12, 4