Skip to content

Instantly share code, notes, and snippets.

View GuoQichen's full-sized avatar

IanGuo GuoQichen

  • DXY
  • HangZhou
View GitHub Profile
/**
* reactive context
*
* @Why 解决provide无法reactive的问题
*
* eg:
*
* data: () => ({
* items: ['item 1', 'item 2],
* message: 'A reactive message'
@GuoQichen
GuoQichen / util.js
Created July 14, 2018 04:34
jsUtils
const getImageFileSize = (file) => new Promise((resolve, reject) => {
const image = new Image()
image.src = window.URL.createObjectURL(file)
image.onerror = reject
image.onload = () => {
const width = image.naturalWidth
const height = image.naturalHeight
window.URL.revokeObjectURL(image.src)
resolve({ width, height })
}
@GuoQichen
GuoQichen / slim-redux.js
Created June 6, 2017 08:35 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
sudo brew uninstall node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R $(whoami) /usr/local
brew link --overwrite node
# post-install 安装后
brew postinstall node
@GuoQichen
GuoQichen / gitproxy.txt
Last active October 20, 2016 02:26
Git 设置代理和取消代理
git config --global http.proxy http://127.0.0.1:8123
git config --global https.proxy https://127.0.0.1:8123
git config --global --unset http.proxy
git config --global --unset https.proxy