Skip to content

Instantly share code, notes, and snippets.

View givingwu's full-sized avatar

Mountain Ghost. W givingwu

View GitHub Profile
@givingwu
givingwu / gulpfile.js
Created January 23, 2019 05:58 — forked from torgeir/gulpfile.js
Example 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 September 19, 2018 10:53 — 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.
(() => {
['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 September 10, 2018 08:50 — forked from gaearon/connect.js
connect.js explained
// 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 (