Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

lehung lecaoquochung

🏠
Working from home
Block or report user

Report or block lecaoquochung

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View better-nodejs-require-paths.md

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:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@lecaoquochung
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
USERNAME="myusername"
PASSWORD="mypassword"
# Project you want to export issues from
View README.md

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\ Text.app/Contents/SharedSupport/bin/subl"
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 http://example.com http://referrer.example.com');
phantom.exit();
}
// Set the important pieces
You can’t perform that action at this time.