Skip to content

Instantly share code, notes, and snippets.

View sanjarcode's full-sized avatar

Sanjar Afaq sanjarcode

View GitHub Profile
@drodsou
drodsou / writeFileSyncRecursive.js
Last active June 5, 2024 15:57
Like writeFileSync but creating all folder paths if not exist
// -- updated in 2020/04/19 covering the issues in the comments to this point
// -- remember you also have things like `ensureDirSync` from https://github.com/jprichardson/node-fs-extra/blob/master/docs/ensureDir-sync.md
const fs = require('fs')
function writeFileSyncRecursive(filename, content, charset) {
// -- normalize path separator to '/' instead of path.sep,
// -- as / works in node for Windows as well, and mixed \\ and / can appear in the path
let filepath = filename.replace(/\\/g,'/');
// -- preparation to allow absolute paths as well
@iangreenleaf
iangreenleaf / gist:b206d09c587e8fc6399e
Last active November 14, 2024 09:13
Rails naming conventions

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.