Skip to content

Instantly share code, notes, and snippets.

View tag9724's full-sized avatar
🦆

Gaëtan Burg tag9724

🦆
  • France
View GitHub Profile
export default {
100: 'CONTINUE',
101: 'SWITCHING_PROTOCOLS',
102: 'PROCESSING',
103: 'CHECKPOINT',
200: 'OK',
201: 'CREATED',
202: 'ACCEPTED',
203: 'NON_AUTHORITATIVE_INFORMATION',
204: 'NO_CONTENT',
@n1ru4l
n1ru4l / index.js
Created August 7, 2017 10:47
Fetch blob and convert to base64
export const fetchAsBlob = url => fetch(url)
.then(response => response.blob());
export const convertBlobToBase64 = blob => new Promise((resolve, reject) => {
const reader = new FileReader;
reader.onerror = reject;
reader.onload = () => {
resolve(reader.result);
};
reader.readAsDataURL(blob);
@branneman
branneman / better-nodejs-require-paths.md
Last active July 30, 2024 01:03
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions