Skip to content

Instantly share code, notes, and snippets.

Avatar

Mountain Ghost givingwu

View GitHub Profile
@givingwu
givingwu / QQ三国推举孝廉.js
Last active Aug 1, 2019
QQ三国 推举孝廉 所有问题,后面准备出个 SearchSG 搜索器。 欢迎贡献,😄 Have fun!
View QQ三国推举孝廉.js
// 爬虫: https://blog.csdn.net/qq_36612997/article/details/53036790
// blog 作者: https://me.csdn.net/qq_36612997
const questions = [
{
"id":"1",
"question":"三国演义是谁的著作",
"answer":"罗贯中"
},
{
@givingwu
givingwu / deepCopy.js
Created Jun 26, 2019
deepCopy & deepMerge Method in ECMAScript 6
View deepCopy.js
export function deepCopy(obj) {
if (typeof obj !== 'object' || obj === null) {
return obj
}
if (obj instanceof Date) {
return new Date(obj.getTime())
}
if (obj instanceof Array) {
@givingwu
givingwu / gulpfile.js
Created Jan 23, 2019 — forked from torgeir/gulpfile.js
Example gulpfile.js
View gulpfile.js
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
@givingwu
givingwu / colorBrowserConsole.js
Created Sep 19, 2018 — forked from IUnknown68/colorBrowserConsole.js
Adds color functions to the browser-console (e.g. console.green() or console.greenB() for bold-green. Simple and primitive.
View colorBrowserConsole.js
(() => {
['white', 'silver', 'gray', 'black', 'red', 'maroon', 'yellow', 'olive', 'lime',
'green', 'aqua', 'teal', 'blue', 'navy', 'fuchsia', 'purple'
].forEach(color => {
console[color] = (...args) => {
console.log(`%c${args.join(' ')}`, `color:${color}`)
}
console[`${color}B`] = (...args) => {
console.log(`%c${args.join(' ')}`, `color:${color};font-weight:bold`)
}
@givingwu
givingwu / connect.js
Created Sep 10, 2018 — forked from gaearon/connect.js
connect.js explained
View connect.js
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (