Skip to content

Instantly share code, notes, and snippets.

FormsEngine.WcmController = function() {
this.type = "ECM";
};
FormsEngine.WcmController.prototype.downloadTypeTaxonomyInst = function(siteId) {
return "hello " +siteId;
};
var controller = new FormsEngine.WcmController();
// very basic example and don`t remember api. Sorry
var firstWord = 'hello', lastWord = 'world!';
var firstNode = document.evaluate('//text()[contets(.,"' + firstWord + '")]', root ....).snapshotItem(0);
var lastNode = document.evaluate('//text()[contets(.,"' + lastWord + '")]', root ....).snapshotItem(0);
var range = document.createRange();
range.setStart(firstNode, firstNode.data.indexOf(firstWord));
range.setEnd(lastNode, lastNode.data.lastIndexOf(lastWord) + lastWord.length);
var i, n = 10000, m = 10;
var a = new Array(m);
var d = +new Date();
i = m; while(i--)
a[i] = '1';
console.log('fill array', new Date - d);
var d = +new Date();
i = n; while(i--)
Function.prototype._makeLikeNative = function()
{
if(Object.defineProperty)
{
var blackLabelProp =
{
enumerable: false,
configurable: false,
writable: false,
value: true
(function()
{
var sys = require('sys'),
http = require('http'),
fs = require('fs'),
Script = process.binding('evals').Script;
var extToMimeMap =
{
'.txt': 'text/plain',
(function($G)
{
var _wrap = function(Class)
{
var _toString = Class.prototype.toString;
Class.prototype.toString = function()
{
console.error('stack trace\n' + (this.stack || '/* no stack trace */'));
var _restoreSymbol = (function($G)
{
var iframe = document.createElement('iframe');
(document.body || document.documentElement).appendChild(iframe);
iframe.style.display = 'none';
var win = iframe.contentWindow, doc = win.document;
doc.open();
var i, n = 300000, a;
console.time("1");
i = n; while(i--)
{
a = [];
}
console.timeEnd("1");
console.time("2");
// you can run it at http://bga.github.com/speedtest/
var _fn = (function()
{
var re = /\d/;
return function(s)
{
re.test(s);
};
var _fn = (function()
{
var re = /\d/;
return function(s)
{
return Math.random() + re.test(s);
};
})();