- 🎨 when improving the format/structure of the code
- 🚀 when improving performance
- ✏️ when writing docs
- 💡 new idea
- 🚧 work in progress
- ➕ when adding feature
- ➖ when removing feature
- 🔈 when adding logging
- 🔇 when reducing logging
- 🐛 when fixing a bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// globals.js | |
// https://gist.github.com/pocotan001/6305714 | |
// Finding improper JavaScript globals | |
(function() { | |
var prop, cleanWindow, | |
globals = new function globals() {}, | |
body = document.body, | |
iframe = document.createElement('iframe'), | |
ignore = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# .ico- | |
*/ | |
[class^="ico-"]::before, | |
[class*=" ico-"]::before { | |
display: inline-block; | |
content: ""; | |
vertical-align: middle; | |
} | |
[class^="ico-"]:not(:empty)::before, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const error = new Error('unicorn') | |
const serialized = JSON.stringify(error, ['name', 'message', 'stack']) | |
console.log(error) // { name: 'Error', message: 'unicorn', stack: 'Error: unicorn\n at Object.<anonymous> …' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const n = 10 | |
Array.apply(null, Array(n)).forEach( … ) | |
// or | |
[...Array(n).keys()].forEach( … ) | |
// or | |
Array(n).fill().forEach( … ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ABC = ["a", "b", "c"]; | |
ABC.reduce((acc, key) => { | |
acc[key] = `${key}!`; | |
return acc; | |
}, Object.create(null)); | |
ABC.reduce( | |
(acc, key) => Object.assign(acc, { [key]: `${key}!` }), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "UTF-8"; | |
/* ================================================== [ Reset ] */ | |
* { | |
margin: 0; | |
padding: 0; | |
} | |
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { | |
display: block; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathToRegexp from 'path-to-regexp' | |
import queryString from 'query-string' | |
export default class Route { | |
/** | |
* @param {string} path | |
* @param {Function} handler | |
*/ | |
constructor (path, handler) { | |
this.path = path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { EventEmitter } from 'events' | |
import Dispatcher from '../Dispatcher' | |
const CHANGE_EVENT = 'change' | |
/** | |
* Extend certain stores from a this `Store` class | |
*/ | |
export default class Store extends EventEmitter { | |
emitChange () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
removeReactIds() { | |
const children = this.el.querySelectorAll('[data-reactid]'); | |
this.el.removeAttribute('data-reactid'); | |
Array.prototype.forEach.call(children, (child) => { | |
child.removeAttribute('data-reactid'); | |
}); | |
} |
NewerOlder