Skip to content

Instantly share code, notes, and snippets.

View gtkatakura's full-sized avatar

gtkatakura

View GitHub Profile
const fsp = require("fs").promises;
const path = require("path");
const { execSync } = require("child_process");
const chalk = require("chalk");
const Confirm = require("prompt-confirm");
const jsonfile = require("jsonfile");
const semver = require("semver");
const packagesDir = path.resolve(__dirname, "../packages");
@kentcdodds
kentcdodds / README.md
Last active August 9, 2022 09:52
Function syntaxes supported by TypeScript

TypeScript Function Syntaxes

I'm trying to create examples of all the different ways to write functions and function type definitions in TypeScript.

One requirement is these examples must work with strict mode (noImplicitAny, etc) enabled.

If I'm missing anything, please add comments below with examples. I'll eventually put this into a blog post.

@sciyoshi
sciyoshi / esbuild-relay.js
Created February 19, 2021 16:34
Esbuild plugin for compiling relay queries
import { promises } from "fs";
import crypto from "crypto";
import path from "path";
import { print, parse } from "graphql";
const plugin = {
name: "relay",
setup: build => {
build.onLoad({ filter: /\.tsx$/, namespace: "" }, async args => {
let contents = await promises.readFile(args.path, "utf8");
@rponte
rponte / using-uuid-as-pk.md
Last active May 6, 2024 21:23
Não use UUID como PK nas tabelas do seu banco de dados

Pretende usar UUID como PK em vez de Int/BigInt no seu banco de dados? Pense novamente...

TL;TD

Não use UUID como PK nas tabelas do seu banco de dados.

Um pouco mais de detalhes

@n1ru4l
n1ru4l / find-version-range-conflicts.ts
Last active March 11, 2021 23:00
Find conflicting package.json ranges in mono repository
/**
* This is a simple script for detecting conflicting
* version ranges across packages inside a mono repository.
*/
import fs from "fs";
import glob from "glob"; // yarn add -W -E -E -D glob@7.1.6
import { promisify } from "util";
const globP = promisify(glob);
@sibelius
sibelius / deferredPromise.ts
Created October 19, 2020 17:24
Using deferred promise to test websockets
const createDeferred = () => {
let d = {};
const promise = new Promise((resolve, reject) => {
d = { resolve, reject };
});
return { ...d, promise } as {
resolve: () => void;
reject: (err: unknown) => void;
promise: Promise<void>;
};
@graninas
graninas / What_killed_Haskell_could_kill_Rust.md
Last active March 18, 2024 14:57
What killed Haskell, could kill Rust, too

At the beginning of 2030, I found this essay in my archives. From what I know today, I think it was very insightful at the moment of writing. And I feel it should be published because it can teach us, Rust developers, how to prevent that sad story from happening again.


What killed Haskell, could kill Rust, too

What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount.

Is Haskell dead?

import XMonad
import XMonad.Hooks.DynamicLog
import qualified Data.Map as M
myStatusBar = "xmobar"
myStatusBarPP = xmobarPP
{ ppCurrent = xmobarColor "#429942" "" . wrap "<" ">" }
@gabriel-barrett
gabriel-barrett / qtt.md
Last active November 19, 2022 21:50
On quantity type theory

Basic QTT

Quantitative type theory (QTT) is an extension of dependent type theory which allows us to track the number of computational (non-erased) uses of variables in well-typed lambda terms. With such usage information, QTT allows us to combine dependent types with substructural types, such as linear, affine or relevant types.

While in a Martin-Löf style type theory typing judgments are of form x1 : A1, ..., xn : An ⊢ b : B, in QTT the bindings in the context

@sibelius
sibelius / webpack.server.js
Created July 14, 2020 14:59
Webpack config for server
const path = require('path');
const webpack = require('webpack');
const WebpackNodeExternals = require('webpack-node-externals');
const ReloadServerPlugin = require('reload-server-webpack-plugin');
const cwd = process.cwd();
module.exports = {