Skip to content

Instantly share code, notes, and snippets.

View sinner's full-sized avatar
:electron:
Crafting

José Gabriel González Pérez sinner

:electron:
Crafting
View GitHub Profile
@sinner
sinner / better-nodejs-require-paths.md
Created December 20, 2015 23:08 — forked from branneman/better-nodejs-require-paths.md
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:

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

Those suck for maintenance and they're ugly.

Possible solutions

@sinner
sinner / app.js
Created December 20, 2015 18:57 — forked from branneman/app.js
Node.js application entry-point files
#!/usr/bin/env node
'use strict';
var spawn = require('child_process').spawn;
var args = [
'--harmony',
'app/bootstrap.js'
];
@sinner
sinner / 0_reuse_code.js
Created February 7, 2014 13:54
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
<?php
abstract class BaseModelManager {
protected $em;
protected $class;
protected $repository;
protected $container;
/**
* Constructor.