Type | Maximum length | Size (bytes)
-----------+----------------+------------------
TINYTEXT | 255 | (2^8−1)
TEXT | 65,535 | (2^16−1) = 64 KiB
MEDIUMTEXT | 16,777,215 | (2^24−1) = 16 MiB
LONGTEXT | 4,294,967,295 | (2^32−1) = 4 GiB
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://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
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
// instead of using `expect(object).to.exist`, assert things | |
// through `.to.be.a(type)` which make failures more informative | |
expect(result).to.be.an('object') | |
.that.includes({ | |
foo: 'bar', | |
baz: 'quux' | |
}); | |
// to assert property value types i.e. date: | |
expect(result) |
You need to have the following in your initialization file (index.js
or redux/index.js
):
...
import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
import {entitiesReducer, queriesReducer} from 'redux-query';
import reduxQueryMiddleware from './middleware/reduxQuery';
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 chai = require('chai'); | |
// globalize sinon | |
global.sinon = require('sinon'); | |
// initialize chai plugins | |
chai.use(require('sinon-chai')); | |
chai.use(require('chai-as-promised')); | |
chai.use(require('chai-datetime')); |
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
/** | |
* Executes a given `fn` at the beginning of the next second. | |
* @param {function} fn – a function to execute | |
* @return {number} setTimeout's resulting timeout id, to give ability to cancel execution | |
*/ | |
function nextSecond(fn) { | |
const time = (new Date()).getTime(); | |
return setTimeout(fn, (Math.ceil(time / 1000) * 1000) - time); | |
} |
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://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
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
/** | |
* Sum two big numbers given as strings. | |
* | |
* @param {string} a | |
* @param {string} b | |
* @return {string} | |
*/ | |
function sumStrings(a, b) { | |
var zrx = /^0+/; // remove leading zeros | |
a = a.replace(zrx, '').split('').reverse(); |
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 array = []; // array to iterate | |
const promise = array.reduce((p, entry) => { | |
p.then(() => { | |
return new Promise((resolve, reject) => {...}); | |
}); | |
}, Promise.resolve()); | |
promise | |
.then(() => console.log('done!')) |
OlderNewer