Skip to content

Instantly share code, notes, and snippets.

View santoshyadavdev's full-sized avatar
🏠
making a difference

Santosh Yadav santoshyadavdev

🏠
making a difference
View GitHub Profile
@LayZeeDK
LayZeeDK / direct-standalone-dependencies.md
Last active June 10, 2022 08:01
Indirect dependencies between components declared by NgModules. Standalone Angular components are easier to understand for both developers and compilers. "imports" means import statements in these diagrams.
  graph TD;
      A[ParentComponent]--imports-->B[ChildComponent];
@martinwoodward
martinwoodward / setup.md
Last active December 3, 2023 17:01
Camera Setup
@sindresorhus
sindresorhus / esm-package.md
Last active June 4, 2025 00:56
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
<link rel="shortcut icon" width=32px>
<canvas style="display: none" id="loader" width="16" height="16"></canvas>
<script>
class Loader {
constructor(link, canvas) {
this.link = link;
this.canvas = canvas;
this.context = canvas.getContext('2d');
this.context.lineWidth = 2;
@kentcdodds
kentcdodds / README.md
Last active March 30, 2024 11:39
user-package-stats

user-package-stats

I was poking around trying to figure out all the packages I have access to publish and got curious. So I write this little script to determine the download stats for all the packages I have publish access to.

Feel free to try it yourself. Just change the username passed to getUserDownloadStats.

By default, the stats are sorted by their average daily downloads (descending). That should give you an idea of the most "popular" package of a given user relative to how long that package has been around.

You can use it with npx like so:

@LayZeeDK
LayZeeDK / my-log-driver\my-log-driver-config.token.ts
Last active March 13, 2021 17:46
Generate Lumberjack log driver with no custom options.
import { inject, InjectionToken } from '@angular/core';
import { LumberjackLogDriverConfig, lumberjackLogDriverConfigToken } from '@ngworker/lumberjack';
export const myLogDriverConfigToken = new InjectionToken<LumberjackLogDriverConfig>('__MY_LOG_DRIVER_CONFIG__', {
factory: () => inject(lumberjackLogDriverConfigToken),
});
import { Injectable, Inject } from '@angular/core';
import { configToken } from './config.token';
import { Config } from './config';
@Injectable({
providedIn: 'any', // 👈 Tree-shakable, only bundled if used
})
export class ConfigService {
constructor(@Inject(configToken) private config: Config) {
https://www.typescriptlang.org/play?ts=4.1.0-dev.20200921#code/PQKhCgAIUgDeo0oENJVvcyKMa3-B2OaWx6pikgCaSCJpHfQzYDGktjjThnrb9LPDfJpUiAA0jEjAEaQ0J4kdWmzFnLgsXj5MtVMHD8tDnubLjhfSbOnm+3Xgu3pZTETIbH8gwX3Xolj1m78fPx0QcGCKjo+nkYEauLaonHqiXHatBLEacw2-jEm9n75yl7BId5IhoXOGAlF1egJWqquZDnu0aVVKp3FMQE8QlGxnEnJdaNiJnJ4EyKU8LCUlAAqABYAlgDOkFuQAIaQAMoAigAykAAmewAuewBGe5sApjsAtgAOADZPr08AdtcnhdIO8AK4AJyenwAnjs-pBltD3k9DgBjcHrd7XSDXJEvPZ-P4Ae1u13WRL+mwAdCsNttfgTttdVjcdtiicjwTcnttNkTvjDIBScXjtgBaSDQomgy5PABm6z++MgACIrrcHs8VQAaSgACgAVqDNtiDrjkftCSSbuS-gBKS3A5n-SAAR1BT3BsPW2ONioA5pA+b9IK8iZCRRaCcTSbbqZQAJLYzag97vcPXbYHFN3Z7suVHM7auGoz6gi4Bo4AUVOVYAwstIHqAO4+1aQVEUitkinbABkkANRMVmztup8CYAcocqwAlZbFgCqAAUACIAQWWVcdkFXNarW6DpJ+-0zNJ8tN273BRINT1R2M+6wAbjz9tjVtdru9NgAuYDAP6bagncVKdq8wCdhcPzrAAHsAmZipsrqfJQPqQM2jwYRiX4uncsJ1iy4LfNsy7rKiADWTYdkRJEAAJQTBsFgUSrzFp+35-gB1ytrh4IsRBqIAPrvORVF2ueMCUAAmtKHYEnCJp7J8nw4psSEoXCkrSuCQrNvC163ve2K8e2sB-O8ryKbcKmQAxRLQa8cEIepyGfLAQrgvM0J7OC8IjjZqn2Y5zmIW5Hl6oiyJohiWKQAALFSACMOzbJC7rrJCFwSUsPiRZiv6QKs

Iterables, AsyncIterables, Observables, Oh My!

I know there is a lot of confusion around Observables, Iterables, AsyncIterables and AsyncObservables. Let's try to break this down and the reasons for each.

Pull versus Push Collections

When it comes to collections, you have two ways of thinking about collections, push versus pull. With pull, the consumer is in control of when you get the items, but with push, you get the values when the producer is ready.

Pull Based Collections

What Hiring Should Look Like

This is definitely not the first time I've written about this topic, but I haven't written formally about it in quite awhile. So I want to revisit why I think technical-position interviewing is so poorly designed, and lay out what I think would be a better process.

I'm just one guy, with a bunch of strong opinions and a bunch of flaws. So take these suggestions with a grain of salt. I'm sure there's a lot of talented, passionate folks with other thoughts, and some are probably a lot more interesting and useful than my own.

But at the same time, I hope you'll set aside the assumptions and status quo of how interviewing is always done. Just because you were hired a certain way, and even if you liked it, doesn't mean that it's a good interview process to repeat.

If you're happy with the way technical interviewing currently works at your company, fine. Just stop, don't read any further. I'm not going to spend any effort trying to convince you otherwise.