Skip to content

Instantly share code, notes, and snippets.

ngOnInit() {
this.filteredRoutes$ = from(this.routes).pipe(
concatMap((route) => {
// handle if nothing is in canActivate
if (!route.canActivate || !route.canActivate.length) {
// create an object that has the route and result for filtering
return of({ route, result: true });
}
return from(route.canActivate).pipe(
@steven2358
steven2358 / ffmpeg.md
Last active August 3, 2025 21:04
FFmpeg cheat sheet
public muteFirst = <T,R>(first$: Observable<T>, second$: Observable<R>) => Observable.combineLatest(
first$,
second$,
(a,b) => b
).distinctUntilChanged();
@faisalmuhammad
faisalmuhammad / local-storage.ts
Last active October 15, 2020 13:12
Generic Local Storage Class
/**
* Customized HTML5 local storage class with additional functionality.
*/
export class LocalStorage {
/**
* Checks if the browser supports local storage.
* @returns true if the local storage is supported; false otherwise.
*/
public static isSupported(): boolean {
try {
@manio
manio / waga.sh
Created March 8, 2017 07:48
a simple bash script for weight logging automation to myfitnesspal and influxdb
#!/bin/bash
# a simple bash script for weight logging automation
# more info: https://skyboo.net/2017/03/automate-my-weekly-weight-logging/
if [[ $# -eq 0 ]]; then
echo "[*] ERROR: missing weight argument"
exit
fi
echo "[*] **** MyFitnessPal ****"
@squallstar
squallstar / viewer.html
Created January 26, 2017 21:20
Pinch gestures for pdf.js
<script type="text/javascript">
var gesturesSetUp = false;
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1;
document.addEventListener('textlayerrendered', function (e) {
if (gesturesSetUp || e.detail.pageNumber !== PDFViewerApplication.page) {
return;
}
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active July 12, 2025 14:53
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@deebloo
deebloo / rxjs-worker-map.example.js
Last active August 19, 2016 17:24
A RxJs operator that runs in a new thread. https://github.com/deebloo/rxjs-worker
// https://github.com/deebloo/rxjs-worker
var observable = Observable.of([0, 1, 2, 3, 4]);
observable
.map(function (data) {
return data.concat([5, 6, 7, 8, 9]);
})
.workerMap(function (data) {
return data.concat([10,11,12,13,14]);;
})
@keesey
keesey / levenshtein.ts
Last active May 5, 2025 12:25
Levenshtein distance implemented in TypeScript
export function levenshtein(a: string, b: string): number
{
const an = a ? a.length : 0;
const bn = b ? b.length : 0;
if (an === 0)
{
return bn;
}
if (bn === 0)
{