Skip to content

Instantly share code, notes, and snippets.

@DaSchTour
DaSchTour / eslint-js
Created September 23, 2022 11:46
Important Eslint rules
"new-parens": "error",
"no-implicit-coercion": "error",
"prefer-template": "error",
"linebreak-style": ["error", "unix"],
"object-shorthand": ["error", "always"],
@DaSchTour
DaSchTour / .prettierrc.yaml
Created September 23, 2022 11:13
Angular Tailwind Prettier Configuration
bracketSpacing: true
bracketSameLine: true
semi: true
singleQuote: true
trailingComma: all
arrowParens: always
endOfLine: lf
htmlWhitespaceSensitivity: strict
printWidth: 120
tabWidth: 2
import { Injectable } from '@angular/core';
import { isNil } from 'lodash-es';
import { ReplaySubject } from 'rxjs';
import { filter, finalize, map } from 'rxjs/operators';
@Injectable({
providedIn: 'root',
})
export class ResizeObserverService {
private readonly entries: ReplaySubject<Array<ResizeObserverEntry>> = new ReplaySubject(1);
@DaSchTour
DaSchTour / typescript-strategy-and-factory-patterns.ts
Last active October 19, 2022 17:12 — forked from shershen08/typescript-strategy-and-factory-patterns.ts
Strategy and factory patterns in TypeScript
// see article with examples in JAVA here: https://dzone.com/articles/design-patterns-the-strategy-and-factory-patterns
// example for educational purposes shownig close and mature syntax of modern TypeScript
enum AccountTypes {CURRENT, SAVINGS, HIGH_ROLLER_MONEY_MARKET, STANDARD_MONEY_MARKET}
////////////////////////////////////////
/// the interface that is used by the strategy
////////////////////////////////////////
interface InterestCalculationStrategy {
@DaSchTour
DaSchTour / gist:4973415
Created February 17, 2013 20:56
redirect wrong URL to the correct target without www to www and with "wrong" end to .de
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [OR]
RewriteCond %{HTTP_HOST} ^www\.(.*)\.(com|net|org|info|eu)$
RewriteRule ^(.*)$ http://www.%1.de/$1 [L,R=301]