Skip to content

Instantly share code, notes, and snippets.

@mainarthur
mainarthur / cacheClientWithExpire.ts
Last active February 9, 2024 21:04
JS/TS Implementation of RAM caching with efficient expires
export type CacheStorage = {
set: (key: string, value: string) => Promise<boolean>;
get: (key: string) => Promise<string | null>;
};
type CacheValue = { value: string; expireTime: number }
export const getRamCacheClient = () => {
const cache: Record<string, CacheValue> = {};
return {
базовые команды
git clone адрес репозитория - клонировать репозиторий на локальный компютер
git commit -m 'initial commit' комит изменений в локальный репозиторий
git push -u origin master - только первый раз отправка изменений в удаленный репозиторий
git push - все последующие разы отправка изменений в удаленный репозиторий
окат изменений
git pull - скачивается актуальная версия удаленного репозитория и все изменения применяются к локальному репозиторию
checkout - перейти в другую ветку
discard - не отправлять в репозиторий те изменения которые нам не нравятся
const { default: axios } = require('axios')
const { snakeCase, camelCase, stringifyQuery } = require('../util/requests')
const NodeElement = require('./NodeElement')
/**
* @typedef Post
* @property {String} path
* @property {String} url
* @property {String} title
* @property {String} description
const HTMLMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
}
/**
* @param {String} c
* @returns {String}
*/
#define LEFT_LED_PIN 11
#define RIGHT_LED_PIN 10
#define BEACON_TRIG 9
#define LEFT_ECHO 2
#define RIGHT_ECHO 3
#define true 1
#define false 0