Skip to content

Instantly share code, notes, and snippets.

View mrdulin's full-sized avatar
🤔
Coding until the earth blows up

official_dulin mrdulin

🤔
Coding until the earth blows up
View GitHub Profile
@mrdulin
mrdulin / esm-package.md
Created June 16, 2023 08:44 — forked from sindresorhus/esm-package.md
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.
@mrdulin
mrdulin / enzyme_render_diffs.md
Created February 24, 2021 03:36 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@mrdulin
mrdulin / hero.ts
Created January 14, 2021 11:31 — forked from brennanMKE/hero.ts
Example of Mongoose with TypeScript and MongoDb
import * as mongoose from 'mongoose';
export let Schema = mongoose.Schema;
export let ObjectId = mongoose.Schema.Types.ObjectId;
export let Mixed = mongoose.Schema.Types.Mixed;
export interface IHeroModel extends mongoose.Document {
name: string;
power: string;
@mrdulin
mrdulin / mockmetrics.go
Created May 25, 2020 12:45 — forked from feketegy/mockmetrics.go
Mockmetrics Spy initial draft
// Package mockmetrics will gather metrics on a mocked function, such as number of calls, record arguments that the
// mocked function is called with.
//
// Example:
//
// type NumberGetter interface {
// GetNumber() int
// AddNumber(num int)
// }
//
@mrdulin
mrdulin / StubSpec.js
Created November 20, 2019 08:23 — forked from Jeffy2012/StubSpec.js
Sinon.js Stub Demo
var expect = chai.expect;
function test() {
return arguments[0];
}
var testJSON = __html__['test/fixtures/test.json'];
var CID = 1;
function fn() {
CID++;
}
var obj = {
@mrdulin
mrdulin / vpn.md
Created October 24, 2019 16:25 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

A Russian translation of this article can be found here, contributed by Timur Demin. There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.

Why not?