Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
sindresorhus / esm-package.md
Last active July 23, 2024 10:30
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.
@tumainimosha
tumainimosha / page-info.ts
Last active July 10, 2024 01:20
NestJS Graphql Cursor Based pagination
import { ObjectType, Field } from "@nestjs/graphql";
@ObjectType()
export class PageInfo {
@Field({ nullable: true })
startCursor: string;
@Field({ nullable: true })
endCursor: string;
@schnello
schnello / 3dprintflow.txt
Created April 16, 2019 11:53
nodered flow for octoprint
[{"id":"4bedb5dd.1b0e8c","type":"change","z":"9d5bc26c.e42c8","name":"Set Progress 0","rules":[{"t":"set","p":"payload.progress.completion","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":300,"wires":[["e7dc5b91.a12e18"]]},{"id":"cea131b0.44184","type":"ui_template","z":"9d5bc26c.e42c8","group":"e2bbaa5d.0c6bf8","name":"Video Frame","order":1,"width":"10","height":"10","format":"<img width=\"16\" height=\"16\" src=\"{{flow.payload.webcam.on}}\" />","storeOutMessages":false,"fwdInMessages":true,"templateScope":"local","x":290,"y":580,"wires":[[]]},{"id":"8f572379.1bf63","type":"http request","z":"9d5bc26c.e42c8","name":"","method":"use","ret":"txt","url":"","tls":"","x":550,"y":60,"wires":[["27be8cd7.507f94"]]},{"id":"7bfde874.9bb6d8","type":"ui_gauge","z":"9d5bc26c.e42c8","name":"","group":"146f3617.73b19a","order":4,"width":"0","height":"0","gtype":"gage","title":"Heatbed","label":"","format":"{{msg.payload.temperature.bed.actual}}°C","min":0,"max":"110",
@balupton
balupton / README.md
Last active February 23, 2022 04:19
Convert XPS to PDF

Convert XPS to PDF on macOS

# IF you are on alpine, install the dependencies
apk add curl git bash

# IF you are on ubuntu, install the dependencies
apt update
apt install curl git bash
@damc-dev
damc-dev / runBashScript.bat
Last active January 31, 2024 15:44
Execute Bash Script (Using Git Bash) from Windows Task Scheduler
cmd /c ""C:\Program Files (x86)\Git\bin\bash.exe" --login -i -- H:\Daily_Reports\yesterdayTogglReport.sh"