Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View patotoma's full-sized avatar
👍
what's up

Patrik Toma patotoma

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

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)
@pbojinov
pbojinov / README.md
Last active December 8, 2023 21:09
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

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

@mindplay-dk
mindplay-dk / image-url.ts
Last active September 28, 2023 15:25
Rotate image preview to compensate for EXIF orientation (Javascript / Typescript)
// 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));
}