Skip to content

Instantly share code, notes, and snippets.

class QueueNode<T> {
public promise: () => Promise<T>;
public next: QueueNode<T> | null;
public finished: boolean;
constructor(promise: () => Promise<T>) {
this.promise = promise;
}
}
class AsyncQueue {
@0xC0A1
0xC0A1 / bis.md
Created October 1, 2023 04:57 — forked from brandonsturgeon/bis.md
World of Warcraft 3.3.5a Warmane Complete PvE BiS (Best In Slot) List
@0xC0A1
0xC0A1 / wallet.ts
Created April 7, 2022 03:24
Get Solana Anchor Wallet From File System
import * as anchor from "@project-serum/anchor";
import fs from "fs/promises";
export const getWallet = async (keyPairFile: string) => {
const payer = anchor.web3.Keypair.fromSecretKey(
Buffer.from(
JSON.parse(
await fs.readFile(keyPairFile, {
encoding: "utf-8",
})
@0xC0A1
0xC0A1 / FIX
Created March 27, 2022 06:38
WSL2 Fix for dropped connections
Created a /etc/wsl.conf containing
[network]
generateResolvConf = false
I exited wsl and then issued a wsl --shutdown
entered wsl force deleted the /etc/resov.conf to stop it being a symbolic link
sudo rm -fd /etc/resov.conf
@0xC0A1
0xC0A1 / TodosContext.js
Created August 13, 2021 03:02
Todos Context
import React, { createContext, useReducer, useEffect, useState } from 'react';
import { useContext } from 'react';
import { useAsyncStorage } from '@react-native-async-storage/async-storage';
const initialState = {
loading: true,
todos: [],
};
const TodosStateContext = createContext(initialState);
@0xC0A1
0xC0A1 / Component.tsx
Created August 25, 2020 01:42
How to use the elements
import { XPButton } from '@xproduct/ui';
// Use it here
@0xC0A1
0xC0A1 / run-docs-2.sh
Created August 25, 2020 01:40
Run docs alternative command
$ yarn workspace @xproduct/ui run dev:all
@0xC0A1
0xC0A1 / package.jsonc
Created August 25, 2020 01:39
Package json alternative
{
// xproduct/ui package.json
"scripts": {
// ...
"dev:all": "concurrently \"yarn dev\" \"yarn dev:docs\""
}
}
@0xC0A1
0xC0A1 / run-docs.sh
Created August 25, 2020 01:36
Run docs command
$ yarn workspace @xproduct/ui run dev # Run the typescript compiler
$ yarn workspace @xproduct/ui run dev:docs # Run the storybook
@0xC0A1
0xC0A1 / package.jsonc
Created August 25, 2020 01:34
Resolutions file added
{
...
"resolutions": {
"react": "~16.11.0",
"react-dom": "~16.11.0"
}
}