Skip to content

Instantly share code, notes, and snippets.

View sudojunior's full-sized avatar
:shipit:
It'll be fine, let it run. 💥

Junior sudojunior

:shipit:
It'll be fine, let it run. 💥
View GitHub Profile
const recursive = (input: string[][]): string[][] => {
if (input.length === 0) return [];
if (input.length === 1) return input[0].map((i) => [i]);
const arr = input[0];
const perm = recursive(input.slice(1));
const result = arr.map((a) => perm.map((p) => [a, ...p])).flat(1);
return result;
};
@sindresorhus
sindresorhus / esm-package.md
Last active July 22, 2024 00:46
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@jakobbouchard
jakobbouchard / discord-verification-rundown.md
Last active February 18, 2024 13:40
Rundown of all the info about Discord's bot verification

Quick rundown of the Discord bot verification situation.

Remember, there's not rush to get verified before October 7th, since verification takes about 5 days anyways. If you are in less than a 100 servers, no need to worry, your bot will still work as it does currently. Keep in mind some stuff is NOT official, so unless there's a source, take it with a grain of salt.

Verification

  • If you are in a team, the owner gets verified, which verifies the whole team. Source
  • If you can't provide ID verification, you could transfer ownership of your team to another member so they can do the verification process. Source
  • The Stripe verification piece is on the user itself, but the other parts of the form are per-bot.
  • You do NOT need a Stripe account to verify, only your ID. [Source](https://discordapp.com/channels/613425648685547541/6972
let myObj = {
//add an asyncIterator method to my object
[Symbol.asyncIterator]() {
//which will return an object that contains a method called next()
return {
i: 0 /* my counter property */,
next() {
if (this.i < 3) {
//return value from the next method must be an object
//the object should contain a value and a done property
@quantum9Innovation
quantum9Innovation / color_blender.js
Last active April 11, 2020 00:54
An additive color blending algorithm in 10 lines of code that blends colors while retaining the brightness of each color to create realistic blends.
/*
Pass in 2 colors {r1,g1,b1} and {r2,g2,b2}
Select bi the blend intensity of the first color (0-->1)
Output is in form {r,g,b}
*/
var blend2A = function (r1,g1,b1,r2,g2,b2,bi) {
var endR = bi*r1+r2*(1-bi)
var endG = bi*g1+g2*(1-bi)
var endB = bi*b1+b2*(1-bi)
@nerrixde
nerrixde / vpn.md
Last active April 30, 2024 19:23 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@dikiaap
dikiaap / git-io-custom-url.md
Last active June 19, 2024 01:26
git.io custom URL

Update: As of 11 January 2022, git.io no longer accepts new URLs.

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
@Sven65
Sven65 / A Guide.md
Last active November 12, 2021 21:59
How to be a good programmer

How to be a good programmer

Step 1: Use a good programming language, like PHP, everyone loves PHP!

Step 2: Write a library that's useful! If you think it is, then it is, regardless of what others say, they only have more experience, what could they know?

Step 3: Use a good coding style, name your variables to something that is completely the opposite of what the variable actually is, this way you'll prevent evil hackers from stealing your code!!!

Step 4: Don't bother indenting, it's a waste of precious bytes on your harddrive and a wate of your precious time!

@Dinnerbone
Dinnerbone / minecraft_commands.txt
Last active September 12, 2023 19:53
Minecraft Java Edition 1.13 changes
advancement grant <targets> everything
advancement grant <targets> from <advancement>
advancement grant <targets> only <advancement>
advancement grant <targets> only <advancement> <criterion>
advancement grant <targets> through <advancement>
advancement grant <targets> until <advancement>
advancement revoke <targets> everything
advancement revoke <targets> from <advancement>
advancement revoke <targets> only <advancement>
advancement revoke <targets> only <advancement> <criterion>
@jagrosh
jagrosh / Growing A Discord Server.md
Last active February 17, 2024 04:29
Tips for creating and growing a new Discord server

This guide is kept up-to-date as Discord and available resources change!
A basic server template is available here

Creating and Growing a Discord Server

logo

Introduction

Hello! I'm jagrosh#4824! I'm writing this guide to try to help new server owners set up and grow their servers, which is a commonly-requested topic. It's very easy to go about this the wrong way, so it's best to be prepared and make smart decisions so that your community can flourish!

Background