Skip to content

Instantly share code, notes, and snippets.

[test]: Update test/* files
[dist]: Changes to submodules, version bumps, updates to package.json
[minor]: Small changes
[doc]: Updates to documentation
[fix]: Bug fixes
[bin]: Update binary scripts associated with the project
[refactor]: Refactor of existing code
[nit]: Small code review changes mainly around style or syntax
[feat]: New features
@johnstew
johnstew / icons.sh
Created March 4, 2017 15:46
Replace Atom Icon (maybe other icons also)
# Steps taken from here: https://sethvargo.com/replace-icons-osx/
ls /Applications/Atom.app/Contents/Resources | grep .icns
cp ~/.custom-icons/atom.icns /Applications/Atom.app/Contents/Resources/atom.icns
touch /Applications/Atom.app
sudo killall Finder && sudo killall Finder
@johnstew
johnstew / package.json
Created February 2, 2017 00:49
tree-shaking webpack package.json
{
"name": "",
"version": "1.0.0",
"description": "",
"main": "",
"scripts": {
"start": "webpack --config webpack.config.js",
"build": "webpack -p --config webpack.config.js"
},
"keywords": [],
@johnstew
johnstew / index.bundle.js
Created February 2, 2017 00:35
tree-shaking webpack index.bundle.js
([function(e, t, n) {
"use strict";
function r() {
console.log("foo called")
}
// NO MORE BAR :)
t.a = r
}, function(e, t, n) {
"use strict";
@johnstew
johnstew / index.bundle.js
Created February 2, 2017 00:33
tree-shaking webpack index.bundle.js
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = foo;
/* unused harmony export bar */
function foo() {
console.log('foo called');
}
@johnstew
johnstew / utils.js
Created February 2, 2017 00:32
tree-shaking webpack utils.js
export function foo() {
console.log('foo called');
}
export function bar() {
console.log('bar called');
}
@johnstew
johnstew / index.js
Created February 2, 2017 00:32
tree-shaking webpack index.js
import { foo } from './utils';
foo();
@johnstew
johnstew / .babelrc
Created February 1, 2017 17:17
babelrc with preset-env and lodash
{
"presets": [
[
"env", {
"targets": {
"browsers": [
"last 2 versions",
"safari >= 7"
]
},
@johnstew
johnstew / webpack.config.js
Created January 31, 2017 03:09
tree-shaking webpack.config.js
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: path.resolve(__dirname, 'src/index.js'),
output: {
filename: 'index.bundle.js',
path: path.resolve(__dirname, 'build')
},
module: {
@johnstew
johnstew / index.js
Last active October 2, 2017 18:47
Webpack v2 Tree Shaking and UglifyJS Dead Code Elimination Analysis
import { render } from './script1';
render();