Skip to content

Instantly share code, notes, and snippets.

View AaronFlower's full-sized avatar
💭
I may be slow to respond.

AaronFlower

💭
I may be slow to respond.
View GitHub Profile
@AaronFlower
AaronFlower / GitHub-Forking.md
Created December 25, 2017 09:42 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@AaronFlower
AaronFlower / left-right-arr.js
Created December 22, 2017 17:48
left-mid-right array
/* [left], mid [right] */
function leftMidRight () {
this.currentDim = this.dimsMap.get(val)
this.leftArr = []
this.rightArr = []
for (let i = val - 1; i >= val - this.halfSize; --i) {
if (i >= 0) {
this.leftArr.unshift(i)
} else {
@AaronFlower
AaronFlower / location-search.js
Created December 19, 2017 08:38
window location search params
var queryItems = {}
window.location.search.replace(/[?&]([^=]+)=([^=&]+)/g, function (_, key, value) {
queryItems[key] = value
})
console.log(queryItems)
@AaronFlower
AaronFlower / createResource.js
Last active December 15, 2017 15:37
axios create restful resource api
/**
* create Restful API Resource with axios
*/
function createResource (http, path, actions) {
let resource = {
get: id => http.get(`${path}/${id}`),
save: data => http.post(path, data),
query: params => http.get(path, {params}),
update: data => http.put(path, data),
delete: id => http.delete(path, {id})
@AaronFlower
AaronFlower / webpack-config-optimize.js
Created December 11, 2017 15:05
webpack-config-optimize
const path = require('path')
const webpack = require('webpack')
const htmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: {
app: './src/main.js',
moduleA: './src/moduleA.js',
moduleB: './src/moduleB.js',
moduleC: './src/moduleC.js'
@AaronFlower
AaronFlower / simple-webpack-config.js
Created December 11, 2017 15:01
simple-webpack-config
const path = require('path')
const webpack = require('webpack')
const htmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
 entry: {
  app: './src/main.js',
  moduleA: './src/moduleA.js',
  moduleB: './src/moduleB.js',
  moduleC: './src/moduleC.js'
 },
@AaronFlower
AaronFlower / babel-spread.js
Created December 9, 2017 06:52
babel support spread
/*
That syntax is an experimental proposed syntax for the future, it is not part of es2015 or react so you'll need to enable it.
npm install --save-dev babel-plugin-transform-object-rest-spread
and add
"plugins": ["transform-object-rest-spread"]
alongside your existing presets.
@AaronFlower
AaronFlower / .babelrc.js
Created December 9, 2017 06:45
babel rc
{
"presets": [
["env", { "modules": false }],
"stage-2"
],
"plugins": ["transform-runtime", "transform-vue-jsx"],
"comments": false,
"env": {
"test": {
"presets": ["env", "stage-2"],
@AaronFlower
AaronFlower / .postcssrc.js
Last active December 8, 2017 14:41
postcss-import 无法识别别名解决方法
// https://github.com/michael-ciniawsky/postcss-load-config
//
const webpackConfig = require('./build/webpack.base.conf.js')
// 使用 postcss-import-webpack-resolver 就可以识别别名了。
const createResolver = require('postcss-import-webpack-resolver')
module.exports = {
"plugins": {
// to edit target browsers: use "browserslist" field in package.json
// https://www.npmjs.com/package/postcss-import-webpack-resolver
@AaronFlower
AaronFlower / webpack-expose-loader.js
Last active December 6, 2017 14:08
expose-loader 暴露全局变量到宿主环境上
{
module: {
rules: [{
test: path.resolve(__dirname, '../pdmp/scripts/lib/jquery-1.12.4.js'),
use: [{
loader: 'expose-loader',
options: '$'
},
{
loader: 'expose-loader',