Skip to content

Instantly share code, notes, and snippets.

View DKurilo's full-sized avatar
🔬
∀ f. Functor f ⇒ (a → f b) → s → f t

Dima DKurilo

🔬
∀ f. Functor f ⇒ (a → f b) → s → f t
View GitHub Profile
@DKurilo
DKurilo / README.md
Last active January 21, 2022 20:50
Static Analisys of TypeScript code with SonarQube

Static Analysis of TypeScript code with SonarQube

  1. Install sonarqube-scanner
npm install --save-dev sonarqube-scanner sonarqube-verify jest-sonar
  1. Create configuration for project: sonar-project.properties
sonar.projectKey=secure-typescript-boilerplate
@DKurilo
DKurilo / queue.js
Last active September 26, 2023 13:28
Simple TypeScript and JavaScript queues
const mkQueue = (sameTimeCount, delay, maxRepeats) => {
const queued = [];
const inWork = [];
const removeFromInWork = (frr) => {
const i = inWork.indexOf(frr);
inWork.splice(i, 1);
if (inWork.length < sameTimeCount && queued.length > 0) {
const [newFrr] = queued.splice(0, 1);
// eslint-disable-next-line no-use-before-define
addToInWork(newFrr);
@DKurilo
DKurilo / index.js
Created January 14, 2022 17:00
Monad prsing inspired parsing in JS / copy from codesandbox just not to lose it
const skip = (parser) => (text) => {
const parsed = parser(text);
if (parsed.length === 0) {
return parsed;
}
return [{ parsed: [], text: parsed[0].text }];
};
const chain = (f) => (parser1) => (parser2) => (text) => {
const parsed = parser1(text);
if (parsed.length === 0) {