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
//============================================================================== | |
(function(){ | |
var _currentIndex = 0; | |
var _history = [{ | |
url: location.hash.substr(1) || '/', | |
index: _currentIndex | |
}]; | |
var _currentState = _history[_currentIndex]; | |
var _ignorePopstate = false; |
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
//============================================================================== | |
//============================================================================== | |
window.MessageLoop = (function(){ | |
//============================================================================ | |
var _Set; | |
if ('undefined' !== typeof Set) { | |
_Set = Set; | |
} | |
else { |
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
//------------------------------------------------------------------------------ | |
// DependencyManager | |
// The DependencyManager handles asynchronous module initialization with | |
// dependencies. | |
// | |
// Example: | |
// ======= | |
// Modules A and B load asynchronously. | |
// Module C requires A and B and loads synchronously. | |
// Module D requires C and loads asynchronously. |
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
//------------------------------------------------------------------------------ | |
// Create a function `collection.fnName`. | |
// The function applies `_.lodashFn` on `collection` and calls `fnName` on | |
// each item. | |
// @param collection Any collection lodash can process | |
// @param fnName Name of function generated. | |
// @param lodashFn Name of the lodash collection function to apply. | |
// Defaults to 'each'. | |
function createCollectionProxyFn(collection, fnName, lodashFn) { | |
lodashFn = lodashFn || 'each'; |
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
var g = [ | |
{ | |
v: '1.0.0', | |
f: ['README.md', 'new/images/image1.jpg','new/images/image2.jpg','new/images/image3.jpg'] | |
}, | |
{ | |
v: '0.2.0', | |
f: ['README.md', 'foo/bar/bar.txt'] | |
}, | |
{ |
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
(function(){ | |
var el = document.createElement('link'); | |
el.rel="stylesheet"; | |
el.type="text/css"; | |
el.href="http://www.seiberspace.de/media/show-scripts.css"; | |
document.head.appendChild(el); | |
})(); | |
// for pasting into bookmarks: | |
// javascript:(function(){var%20el%20=%20document.createElement('link');el.rel="stylesheet";el.type="text/css";el.href="http://www.seiberspace.de/media/show-scripts.css";document.head.appendChild(el);})(); |
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
function formatS(s) { | |
var args = Array.prototype.slice.call(arguments); | |
var _replFn = function(all, before, index) { | |
return before + args[parseInt(index)]; | |
} | |
return s.replace(formatS._m, _replFn).replace('%%', '%'); | |
} | |
formatS._m = /([^%])%([0-9]+)/g; |
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
bool ConstrainImageSize( | |
int &aWidth, // in/out - actual image width | |
int &aHeight, // in/out - actual image height | |
const int aMaxWidth, // in - max width | |
const int aMaxHeight // in - max height | |
) const | |
{ | |
float ratioNeed = std::max( (float)aWidth / (float)aMaxWidth, (float)aHeight / (float)aMaxHeight ); | |
if( ratioNeed > 1.0 ) { | |
// actually needs downscaling at all |
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
//============================================================================== | |
var RPC = (function(){ | |
var RPC = {}; | |
var _nextConnectionId = 1; | |
var _nextMessageId = 1; | |
var _nextObjectId = 1; | |
/*** | |
* Class _SharedObject | |
*/ |
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
//============================================================================== | |
// class InitManager | |
function InitManager(arStates) { | |
var _state = 0; | |
//---------------------------------------------------------------------------- | |
// privates | |
// return `aState` limited to a valid arStates index | |
var _sanitizeState = function(aState) { |