Skip to content

Instantly share code, notes, and snippets.

View FreePhoenix888's full-sized avatar
Empty your mind, be formless, shapeless - like water

FreePhoenix888

Empty your mind, be formless, shapeless - like water
View GitHub Profile
function serialize(numbers) {
return numbers.map(num => String.fromCharCode(num)).join('');
}
function deserialize(str) {
return str.split('').map(char => char.charCodeAt(0));
}
let numbers = [1, 5, 10, 255, 300];
let serialized = serialize(numbers);
@FreePhoenix888
FreePhoenix888 / yargs-boilerplate.ts
Last active February 26, 2024 07:51
Yargs Boilerplate
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
const cliOptions = yargs(hideBin(process.argv))
.usage(`$0 [Options]`, `Description of the program`)
.options({
verbose: {
alias: "v",
description: "Enable verbose logging",
type: "boolean",
@FreePhoenix888
FreePhoenix888 / findGetCommunityPointsButtonAndClickWithInterval.js
Last active February 26, 2024 07:42
Find "Get Community Points" button and click with interval
findGetCommunityPointsButtonAndClickWithInterval();
/**
* Finds the get community points button
*/
function findGetCommunityPointsButton() {
const communityPointsContainerElement = document.body.querySelector(
".community-points-summary"
);
console.log({ communityPointsContainerElement });
@FreePhoenix888
FreePhoenix888 / find_repeating_chat_messages_and_alarm.js
Last active February 25, 2024 16:09
Find Repeating Chat Messages And Alarm
doAllWork();
/**
* Find repeating messages in the twitch chat every {@link checkIntervalInMs} milliseconds and play a sound at url {@link soundUrl} if there are more than {@link howManyMessagesMustBeUnique} unique messages in the last {@link howManyMessagesToCheck} and logs the messages if {@link shouldLog} is true and adds a stop button to the page
* @example
* ```
* workForMe()
* ```
*/
function doAllWork(
@FreePhoenix888
FreePhoenix888 / Описание Дипа.md
Last active November 15, 2023 06:27
Описание дипа

Краткое описание

Deep это:

  • Связи
  • Пакеты, содержащие связи (сам пакет это тоже связь)
  • Обработчики вставки/обновления/удаления в любой поддерживаемой среде
  • Материализованный путь связей, деревья

Связи

@FreePhoenix888
FreePhoenix888 / gist:442a7b0735dcbc8a1cb689642d5070f1
Last active August 24, 2023 07:21
create...Decorator prototype talking

Код-прототип для декоратора пакета capacitor-geolocation

import {DeepClientInstance} from '@deep-foundation/deeplinks/imports/client.js'
import { Package } from './package';

/**
 * 
 * @example
 * #### Create a decorator from another decorator
\`\`\`
// Get your token by creating one token manually and find it in Browser Developer Tools -> Network -> GenerateApiKey -> Request
const REQUEST_VERIFICATION_TOKEN = REQUEST_VERIFICATION_TOKEN;
const packages = [
...document
.querySelector('.available-packages-container')
.querySelectorAll('input'),
].map((input) => input.parentNode.textContent.trim());
for (package of packages) {
fetch('https://www.nuget.org/account/GenerateApiKey', {
headers: {
@FreePhoenix888
FreePhoenix888 / regenerate_and_copy_nuget_tokens.js
Created November 27, 2022 17:06
Regenerate and copy nuget tokens
const regenerateTokens = async ({ manageContainer }) => {
const regenerateTokenElements = [
...manageContainer.querySelectorAll('a'),
].filter((linkElement) => linkElement.textContent.trim() == 'Regenerate');
for (regenerateTokenElement of regenerateTokenElements) {
regenerateTokenElement.click();
}
prompt('Wait until all your keys regenerate to copy them properly');
};
@FreePhoenix888
FreePhoenix888 / regenerate_all_nuget_tokens.js
Last active November 27, 2022 16:12
Regenerate all nuget tokens
const manageContainer = document.querySelector("#manage-container");
const regenerateTokenElements = [...manageContainer.querySelectorAll("a")].filter(linkElement => linkElement.textContent.trim() == 'Regenerate')
for (regenerateTokenElement of regenerateTokenElements) {
regenerateTokenElement.click()
}
@FreePhoenix888
FreePhoenix888 / create-nuget-token-for-every-available-package.js
Created November 27, 2022 12:15
Create nuget token for every available package. Do not forget to select Package Owner to see available packages
// Get your token by creating one token manually and find it in Browser Developer Tools -> Network -> GenerateApiKey -> Request
const REQUEST_VERIFICATION_TOKEN = REQUEST_VERIFICATION_TOKEN;
const packages = [
...document
.querySelector('.available-packages-container')
.querySelectorAll('input'),
].map((input) => input.parentNode.textContent.trim());
for (package of packages) {
fetch('https://www.nuget.org/account/GenerateApiKey', {
headers: {