Skip to content

Instantly share code, notes, and snippets.

Avatar
👍
what's up

Patrik Toma patotoma

👍
what's up
View GitHub Profile
@andreasonny83
andreasonny83 / README.md
Created Jul 20, 2019
Run node app in background
View README.md

Run node app in background

Running a script in the background in linux can be done using nohup, using nohup we can run node application in the background

$ nohup node server.js > /dev/null 2>&1 &
  • nohup means: Do not terminate this process even when the stty is cut off
  • > /dev/null means: stdout goes to /dev/null (which is a dummy device that does not record any output)
@mindplay-dk
mindplay-dk / image-url.ts
Last active Feb 12, 2021
Rotate image preview to compensate for EXIF orientation (Javascript / Typescript)
View image-url.ts
// Based on: https://stackoverflow.com/a/46814952/283851
/**
* Create a Base64 Image URL, with rotation applied to compensate for EXIF orientation, if needed.
*
* Optionally resize to a smaller maximum width - to improve performance for larger image thumbnails.
*/
export async function getImageUrl(file: File, maxWidth: number|undefined) {
return readOrientation(file).then(orientation => applyRotation(file, orientation || 1, maxWidth || 999999));
}
@pbojinov
pbojinov / README.md
Last active Nov 26, 2021
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/
View README.md

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe