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 target = window; | |
for (var i in target) { | |
if ("function" != typeof target[i]) continue; | |
target[i] = (function(name, fn) { | |
return function() { | |
console.log("" + name + " called"); | |
return fn.apply(target, arguments); | |
} | |
})(i, target[i]); | |
} |
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 parseVersion(s) { | |
var m = exp.exec(s); | |
return (m) ? | |
{ | |
major: m[1], | |
minor: m[2], | |
patch: m[3], | |
pre: m[5] || '', | |
meta: m[7] || '' | |
} : |
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
// --------------------------------------------------------------------------- | |
// BlockSizeInBytes | |
// Returns the number of bytes required to hold <aCount> objects of type <T> | |
// in blocks of <aBlockSize> bytes. | |
template <typename T> inline size_t BlockSizeInBytes(size_t aCount, size_t aBlockSize = 4) | |
{ | |
return (((aCount * sizeof(T)) + aBlockSize - 1) / aBlockSize) * aBlockSize; | |
} |
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 DelegateCollection() { | |
for (var i = 0, m = arguments.length; i < m; i++) { | |
this.addCall(arguments[i]); | |
} | |
} | |
//------------------------------------------------------------------------------ | |
DelegateCollection.prototype = new Array; |
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) { |
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
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
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
(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
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'] | |
}, | |
{ |
OlderNewer