Skip to content

Instantly share code, notes, and snippets.

View futurist's full-sized avatar

James Yang futurist

  • China
View GitHub Profile
@futurist
futurist / es5_inheritance
Created January 29, 2016 04:16 — forked from MartinSvarrer/es5_inheritance
ES5 way of doing inheritance
function SuperClass () {};
SuperClass.prototype = {
constructor: SuperClass,
a: 'Hello',
b: 'super',
c: function () {
return this.a + ', ' + this.b + '!';
}
};
@futurist
futurist / open-finder.el
Created April 18, 2016 23:01 — forked from hidsh/open-finder.el
Mac: open folder by Finder from Emacs
(defun open-finder-1 (dir file)
(let ((script
(if file
(concat
"tell application \"Finder\"\n"
" set frontmost to true\n"
" make new Finder window to (POSIX file \"" dir "\")\n"
" select file \"" file "\"\n"
"end tell\n")
(concat
@futurist
futurist / webpack-replace-html.js
Created May 28, 2016 07:41
Webpack: Generate [hash].js in production html file
// Webpack: Generate [hash].js in production html file
// From: https://github.com/webpack/webpack/issues/86
if (process.env.NODE_ENV === 'production') {
// Hashing of this kind happens only in prod.
config.output.filename = "bundle-[hash].js"; // In dev's config, it's "bundle.js"
config.plugins.push(
// To rewrite stuff like `bundle.js` to `bundle-[hash].js` in files that refer to it, I tried and
// didn't like the following plugin: https://github.com/ampedandwired/html-webpack-plugin
@futurist
futurist / babel-fix-exports-default
Created June 2, 2016 01:56
fix es3 compatibility for exports default
ref: http://www.aliued.com/?p=3240
// babel-template.js file, line 124 to add below:
if (replacement) {
replacement[TEMPLATE_SKIP] = true;
path.replaceInline(replacement);
// fix es3 compatibility:
@futurist
futurist / cvimrc
Created June 15, 2016 01:10
cVimrc
let blacklists = ["http://1111hui.com/*","http://126.com/*","http://163.com/*"]
@futurist
futurist / win10-setup.txt
Last active June 24, 2016 06:19
win10 setup from a clean install
1. Chrome+FF
2. Chrome Extension:
New Tab Redirect
Youdao dict
3. Emacs, with .emacs.d settings ( emacs MUST RUN AS ADMINISTRATOR)
HKLM\SOFTWARE\GNU\Emacs\HOME
string key set to d:\emacs
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
@futurist
futurist / Preferences.sublime-settings
Created June 15, 2016 13:46
sublime text User setttings
{
"font_size": 12,
"hot_exit": false,
"line_padding_bottom": 6,
"line_padding_top": 6,
"save_on_focus_lost": false,
"show_encoding": true,
"translate_tabs_to_spaces": true,
"update_check": false,
"word_wrap": true
@futurist
futurist / introrx.md
Created June 18, 2016 09:03 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@futurist
futurist / eslint-es3.js
Created June 20, 2016 05:32
eslint for ES3
'use strict';
var merge = require( 'lodash.merge' );
var extras = {
parserOptions : {
ecmaVersion : 3,
},
@futurist
futurist / gitconfig
Last active June 26, 2016 22:25
global git config
[user]
name = James Yang
email = [email protected]
[credential]
helper = store
[filter "lfs"]
clean = git lfs clean %f
smudge = git lfs smudge %f
required = true