Skip to content

Instantly share code, notes, and snippets.

Design Principles

  • YAGNI: Don't build it until you need it.
  • DRY: Extract patterns after second duplication, not before.
  • Fail Fast: Explicit errors beat silent failures.
  • Simple First: Write the obvious solution, optimize only if needed.
  • Delete Aggressively: Less code = fewer bugs.
  • Semantic Naming: Always name variables, parameters, and API endpoints with verbose, self-documenting names that optimize for comprehension by both humans and LLMs, not brevity (e.g., waitUntilObjectIsSaved = true vs wait = true).
  • Naming the app in identifiers: spell it out as Batterby/batterby in code — variables, constants, config values, storage keys. The short btb/BTB_ form is only for identifiers that are also read outside this codebase and benefit from being terse: DOM ids and classes in the browser extension, Blender object prefixes, and generated filenames.
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@craigbeck
craigbeck / 0_reuse_code.js
Created July 15, 2014 06:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console