The python regex structure is mostly this
re.<method>
is the go to interface with common signature as (pattern, string, flags=0)
and most of the time there is an equivalent
Pattern.<method>
with the first argument being the string
instead of pattern
But the <method>
has [, pos[, endpos]]
and no flags=0
which might be useful
So I will omit all the equivalent methods' signatures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# basics | |
# oh frik the commit message was wrong | |
git commit -a --amend -m "new message" | |
# or | |
git commit -a --amend --no-edit | |
# set remote | |
git remote set-url origin url | |
# other stuff |
cd %USERPROFILE%/.vscode/extensions
yo code
# if that errors do
npm install -g yo generator-code
# This is an important step
# I found this the hard way but without a "__metadata" in the package.json, you cannot set themes nor activate extensions
# So, here is a dummy payload that you can add to your package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Intents } = require("discord.js"); | |
Intents.ALL = Object.values(Intents.FLAGS).reduce((acc, p) => acc | p, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable consistent-return */ | |
class TokenType { | |
constructor(type, regex) { | |
this.type = type; | |
this.regex = regex; | |
} | |
match(s) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require(`crypto`); | |
// var a = crypto.randomBytes(20).toString(`hex`); | |
// var b = crypto.randomBytes(20).toString(`hex`); | |
// var c = crypto.randomBytes(20).toString(`hex`); | |
var a = `acc3be0ffe08a5a37546ff6f31c8eab2ce11bd7e`; | |
var b = `0ded06494ff6017e86257f15f12db11e09ec2664`; | |
var c = `630fea9f3c2d173718a53d5488f3b53b22e35f88`; | |
const abc = Array.from({length: a.length + 1}, () => |
Programming stands for the abstraction and translation of real life instructions into instructions that a computer can understand.
Many people don't quite grasp the difference between the process of computers, so I will list core differences below.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div style="width: 40px; aspect-ratio: 1 / 1;"> | |
<svg class="star-svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/2000/xlink" width="21px" height="24px"> | |
<path style="fill: black; transform: translate(2.1px, 2.4px)" d="M 0 0.054 Z M 15.422 18.129 L 10.158 15.361 L 4.893 18.129 L 3 16 l 1.006 -5.863 l -4.259 -4.152 l 5.887 -0.855 l 2.632 -5.334 l 2.633 5.334 l 5.885 0.855 L 18.677 8.114 L 14.419 12.266 L 15.422 18.129 Z"></path> | |
<path style="fill: cyan;" d="M 0 0.054 z M 15.422 18.129 l -5.264 -2.768 l -5.265 2.768 l 1.006 -5.863 L 1.64 8.114 l 5.887 -0.855 l 2.632 -5.334 l 2.633 5.334 l 5.885 0.855 l -4.258 4.152 L 15.422 18.129 z"></path> | |
</svg> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prime checking regex, which this code is based off of | |
// https://regex101.com/r/RIJkGF/1 | |
type StringDivisible<n extends string, div extends string> = n extends `` ? true : n extends `${div}${infer r}` ? StringDivisible<r, div> : false; | |
type Substrings<n extends string, d extends string = ""> = n extends `${d}${infer r}` ? readonly [` ${d}`, ...Substrings<r, ` ${d}`>] : readonly []; | |
type StringFactors<n extends string> = Substrings<n> extends readonly [unknown, ...infer R extends readonly string[], unknown] ? R : never; | |
type StringIsPrime<n extends string, Factors extends readonly string[] = StringFactors<n>> = Factors extends readonly [infer s extends string, ...infer R extends readonly string[]] ? StringDivisible<n, s> extends true ? false : StringIsPrime<n, R> : true; | |
type RepeatStringByStringDigit<str extends string, d extends string> = |
When splitting a large string, it is best to use a worker thread, microservice, or a lambda. However, if you are looking into event-loop based solutions, you have to leverage JavaScript's api for scheduling tasks.
Code:
const createAwaitTick = () => ({ then(fn) { setImmediate(fn) } });
async function *_charGenerator(str, batchSize) {
let i = batchSize
for (const c of str) {
OlderNewer