Skip to content

Instantly share code, notes, and snippets.

“Any fool can know. The point is to understand.”

lehung lecaoquochung

“Any fool can know. The point is to understand.”
View GitHub Profile

Better local require() paths for Node.js


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

lecaoquochung / github_issues_to_csv.rb
Created Nov 28, 2018 — forked from henare/github_issues_to_csv.rb
Exports Github issues to CSV so it can be imported into Jira
View github_issues_to_csv.rb
require 'json'
require 'open-uri'
require 'csv'
require 'date'
# Github credentials to access your private project
# Project you want to export issues from

Local SSL websites on Mac OSX

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on Mac OSX Yosemite.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward edit to Sublime Text:

alias edit="/Applications/Sublime\"
View change-referrer.demo.phantom.js
var page = require('webpage').create();
page.onConsoleMessage = function (msg) {
console.log('From Page Console: '+msg);
page.onInitialized = function() {
page.evaluate(function () {
"use strict";
//The Referrer we want to set
View fake-referrer.phantom.js
var system = require('system');
// Exit in case of wrong parameter count.
if (system.args.length !== 3) {
console.log('Usage: scriptname targetUrl referrer');
console.log('example: $> phantomjs fake-referrer.phantom.js');
// Set the important pieces