View pocotumblr.css
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; |
View Route.js
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 |
View serialize-error.js
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> …' } |
View reduce.js
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}!` }), |
View Store.js
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 () { |
View times.js
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( … ) |
View smoothScroll.js
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
/** | |
* http://easings.net/#easeOutCubic | |
*/ | |
function easeOutCubic(t) { | |
const _t = t - 1; | |
return _t * _t * _t + 1; | |
} | |
/** |
View isHalfWidth.js
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
// Basic Latin (0000–007F) http://unicode.org/charts/PDF/U0000.pdf | |
// Halfwidth Katakana (FF61–FF9F) http://unicode.org/charts/PDF/UFF00.pdf | |
function isHalfWidth(string) { | |
return /[\u0000-\u007f\uff61-\uff9f]/.test(string); | |
} |
View isAllowEmbed.js
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 url from 'url'; | |
const WHITE_LIST = ['hoge.com', 'piyo.com', 'huga.com']; | |
/** | |
* 対象のサイトで iframe の埋め込みを許可するかどうか | |
* | |
* @returns {boolean} | |
*/ | |
const isAllowEmbed = () => { |
View removeReactIds.js
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