Skip to content

Instantly share code, notes, and snippets.

View kafkahw's full-sized avatar

Wei Hou kafkahw

View GitHub Profile
@kafkahw
kafkahw / git_rebase
Created September 26, 2014 15:18
Git Rebase
git rebase -i HEAD~X
where X is # of commits
@kafkahw
kafkahw / Notes
Last active August 29, 2015 14:07
Notes
Javascript:
* delegate = event handler
CSS:
* Pseduo class: to define a special state of an element.
* Pseduo element: to style specified parts of an element.
* "height" is the vertical measurement of the container.
Note: The height property does not include padding, borders, or margins; it sets the height of the area inside the padding, border, and margin of the element!
@kafkahw
kafkahw / mac_setup
Last active August 23, 2016 00:31
Mac Setup
1. Terminal: use iTerm(https://www.iterm2.com/) instead
2. Use on-my-zsh instead of bash: https://github.com/robbyrussell/oh-my-zsh
3. User config for .zshrc:
# User configuration
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin"
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
@kafkahw
kafkahw / Preferences.sublime-settings
Created August 23, 2016 00:29
Subl user preference settings
{
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
"font_size": 13.0,
"ignored_packages":
[
"Vintage"
],
"translate_tabs_to_spaces": true,
@kafkahw
kafkahw / To learn list
Created January 3, 2017 20:17
TO LEARN in 2017
PWA and Firebase
React Fiber
Functional Programming/ Reactive Programming: start from here: https://gist.github.com/staltz/868e7e9bc2a7b8c1f754
@kafkahw
kafkahw / reactUILib
Created January 6, 2017 19:57
react UI lib
Material UI: http://www.material-ui.com/#/get-started/required-knowledge
Grommet: https://grommet.github.io/hpinc/
@kafkahw
kafkahw / mock_api_webpack
Created January 19, 2017 20:58
Mock API with webpack
https://webpack.github.io/docs/webpack-dev-server.html#api
If mocking API is needed when running webpack dev server, you can set it up in your webpack config as follows:
devServer: {
setup: function(app) {
// Here you can access the Express app object and add your own custom middleware to it.
// For example, to define custom handlers for some paths:
// app.get('/some/path', function(req, res) {
// res.json({ custom: 'response' });
// });
},
@kafkahw
kafkahw / How to download streaming video
Created January 31, 2017 02:29 — forked from danfinlay/How to download streaming video.md
How to download a streaming video with Google Chrome
#How to download streaming video
Streaming just means a download that they don't want you to keep. But Chrome's developer tools make it easy to access what's really going on under the hood.
##Open Developer Tools
From the page where you want to download some things, go into your chrome menu to open the developer tools. You can either:
1. (On a mac): Command-option-J
2. (On a PC): Control-alt-J
@kafkahw
kafkahw / Git config hacks
Last active June 2, 2017 21:36
Git config gotchas
Change git:// to https://
git config --global url.https://github.com/.insteadOf git://github.com/
Set an alias for public profile:
git config --global alias.publicprofile '!git config user.name "Wei Hou" && git config user.email "[email protected]" && git config github.user "kafkahw"'
@kafkahw
kafkahw / utils.js
Created June 5, 2017 23:30
Remote react component loading
import React from 'react';
export function loadRemoteComponent(url) {
return fetch(url)
.then(response => response.text())
.then(text => {
// Define exports and require method for eval(text)
const exports = {};
function require(name) {
if (name === 'react') {