Skip to content

Instantly share code, notes, and snippets.

View Myllaume's full-sized avatar

Guillaume Brioudes Myllaume

View GitHub Profile
@infologie
infologie / documentation.css
Last active March 11, 2021 14:47
Modèle Pandoc pour page HTML avec sommaire cliquable. Pensé pour de la documentation logicielle (manuel d'utilisation).
/* VARIABLES */
:root {
--sans: "Helvetica Neue", Helvetica, sans-serif;
--serif: Georgia, serif;
--mono: Menlo, Monaco, Consolas, "Courier New", monospace;
--code-background-color: #f5f5f5;
--code-border-color: #ccc;
font-size: 100%;
}
@branneman
branneman / better-nodejs-require-paths.md
Last active April 11, 2025 10:39
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

@solenoid
solenoid / gist:1372386
Created November 17, 2011 04:49
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};