Skip to content

Instantly share code, notes, and snippets.

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:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@fivetanley
fivetanley / application.adapter.js
Last active September 3, 2015 00:42 — forked from indirect/application.adapter.js
data-perf-demo
import DS from 'ember-data';
export default window.DS.ActiveModelAdapter.extend();
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
array: [1,2,3]
});
[Version]
Signature="$Windows NT$"
Provider="Microsoft Visual Studio 2008 Professional Edition - ENU"
[CompleteComponentList]
gencomp15
gencomp95
gencomp6
gencomp7
gencomp8
import DS from "ember-data";
export default DS.JSONAPIAdapter.extend();
@fivetanley
fivetanley / javascript_ANSI_escape_codes.md
Created January 23, 2017 21:45 — forked from leommoore/javascript_ANSI_escape_codes.md
JavaScript - ANSI Escape Codes

#JavaScript - ANSI Escape Codes

ANSI Escape Codes are special characters which can be used to control formatting, colors or other output preferences in a text terminal. Escape Codes are non-printing code and will not appear in the output directly.

  • \033 begins the escape sequence
  • [ indicates the color
  • 33 is the foreground color for yellow
  • m indicates the end of the setting

Note: \033[39m is used set the color back to the terminal defult

import Ember from 'ember';
const { computed } = Ember;
const statKeys = ['a', 'b', 'c'];
// Some basic Ember class
const Thing = Ember.Object.extend({
stats: null
});
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}