This file contains hidden or 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
| /** | |
| * Pad a string to a certain length with another string | |
| * @param {String} input The input string | |
| * @param {Number} padLength The length of result string | |
| * @param {String} padStr The padding string | |
| * @returns {String} | |
| */ | |
| function strPad(input, padLength, padStr) { | |
| if (input.length < padLength) { | |
| return strPad(padStr + input, padLength, padStr); |
This file contains hidden or 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 React from 'react'; | |
| import PropTypes from 'prop-types'; | |
| const ImageFallback = ({ src, fallbackSrc, ...other }) => { | |
| let element; | |
| const setFallbackSrc = () => { | |
| element.src = fallbackSrc; | |
| }; |
This file contains hidden or 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
| // Simple JavaScript Templating | |
| // John Resig - http://ejohn.org/ - MIT Licensed | |
| (function () { | |
| var cache = {}; | |
| this.tmpl = function tmpl(str, data) { | |
| // Figure out if we're getting a template, or if we need to | |
| // load the template - and be sure to cache the result. | |
| var fn = !/\W/.test(str) ? | |
| cache[str] = cache[str] || |
This file contains hidden or 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
| ;(function () { | |
| function timeago(text) { | |
| var now = new Date(), | |
| yesterday, | |
| date = new Date(text), | |
| diff = (now.getTime() - date.getTime()) / 1000; | |
| yesterday = new Date(); | |
| yesterday.setDate(now.getDate() - 1); | |
This file contains hidden or 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
| define(function(require) { | |
| var Deferred = function () { | |
| this.onDoneList = []; | |
| this.onFailList = []; | |
| this.execute = function (list, args) { | |
| var len = list.length, | |
| i = 0; | |
| args = Array.prototype.slice.call(args); |