Skip to content

Instantly share code, notes, and snippets.

View chungchi300's full-sized avatar

Jeff Chung chungchi300

View GitHub Profile

MVP 3. Define objectives

  1. Explore
  2. Record for future retry
  3. Try

Project: S.O.L.I.D F.I.R.S.T

@chungchi300
chungchi300 / cloudSettings
Last active December 3, 2018 10:16
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-12-03T10:16:31.161Z","extensionVersion":"v3.1.2"}
@chungchi300
chungchi300 / better-nodejs-require-paths.md
Created February 18, 2018 13:38 — 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

Desipite everyone said it is easy,I think it is good have some hints for it
Clean Javascript solution
```
```
[You can see more lesson & hints & test & answer on my github repo](https://github.com/chungchi300/head-first-cracking-the-coding-interview-on-hackerrank/tree/master/__tests__/cracking-the-code-interview)
//very important,these javascript component is more debuggable then native
import fetch from 'isomorphic-fetch';
import FormData from 'form-data';
let formData = new FormData();
formData.append('file',fs.createReadStream('test/api/testMedia.jpg'));
//implement your own header function
let headers = prepareHeaders();
// the whatwg-fetch polyfill installs the fetch() function
// on the global object (window or self)
//
// Return that as the export for use in Webpack, Browserify etc.
require('whatwg-fetch');
var globalObject = typeof self === "undefined" ? global : self;
module.exports = globalObject.fetch.bind(globalObject);
We couldn’t find that file to show.