Skip to content

Instantly share code, notes, and snippets.

ffmpeg -f avfoundation -framerate 30 -i "0" -target pal-vcd ./test-1.mpg -t 5
@nikbabchenko
nikbabchenko / run-command.json
Created October 4, 2023 13:25
NX new commands
"log": {
"command": "node script.js",
"options": {
"cwd": "libs/api/routing-registry"
}
}
@nikbabchenko
nikbabchenko / links.sh
Created June 20, 2023 13:38
npm link
@nikbabchenko
nikbabchenko / polling-fix.ts
Created September 6, 2022 10:16
Fix polling
public poll$<T>(
request$: () => Observable<T>,
delayTime: number = this.getPollingInterval()
): Observable<T> {
return interval(delayTime).pipe(
switchMap(() => request$())
);
}

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@nikbabchenko
nikbabchenko / generation.md
Last active May 4, 2022 10:44
Library Generation
  1. Generate library
npx nx generate @nrwl/angular:library --name=location-autocomplete --directory=angular/components/core --buildable --importPath=@truckstop-components/core-location-autocomplete --prefix=tsx --publishable --standaloneConfig
  1. Generate component
npx nx generate @schematics/angular:component --name=location-autocomplete --project=angular-components-core-location-autocomplete --style=scss --changeDetection=OnPush --export --prefix=tsx
@nikbabchenko
nikbabchenko / duck-typing.ts
Created October 11, 2021 11:37
Typescript duck typing
class Dog {
sound = "barking";
}
class Lion {
sound = "roaring";
}
const b: Lion = new Dog();
@nikbabchenko
nikbabchenko / get-news.js
Last active May 14, 2024 03:04
Promises task
const news = [
"https://jsonplaceholder.typicode.com/posts/1",
"https://jsonplaceholder.typicode.com/posts/2",
"https://jsonplaceholder.typicode.com/posts/3",
"https://jsonplaceholder.typicode.com/posts/4",
"https://jsonplaceholder.typicode.com/posts/5",
"https://jsonplaceholder.typicode.com/posts/6",
"https://jsonplaceholder.typicode.com/posts/7",
"https://jsonplaceholder.typicode.com/posts/8",
"https://jsonplaceholder.typicode.com/posts/9",
@nikbabchenko
nikbabchenko / async.js
Created September 7, 2021 08:16
async execution task
console.log('start')
setTimeout(() => {
console.log('setTimeout')
})
Promise.resolve().then(() => {
console.log('resolve')
})
console.log('end')
@nikbabchenko
nikbabchenko / counter.js
Created September 7, 2021 07:41
Counter
const counter = createCounter(); // { increment: Function, decrement: Function, value: Number }
counter.increment();
counter.value