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
FormsEngine.WcmController = function() { | |
this.type = "ECM"; | |
}; | |
FormsEngine.WcmController.prototype.downloadTypeTaxonomyInst = function(siteId) { | |
return "hello " +siteId; | |
}; | |
var controller = new FormsEngine.WcmController(); |
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
// 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); |
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 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--) |
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.prototype._makeLikeNative = function() | |
{ | |
if(Object.defineProperty) | |
{ | |
var blackLabelProp = | |
{ | |
enumerable: false, | |
configurable: false, | |
writable: false, | |
value: true |
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 sys = require('sys'), | |
http = require('http'), | |
fs = require('fs'), | |
Script = process.binding('evals').Script; | |
var extToMimeMap = | |
{ | |
'.txt': 'text/plain', |
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($G) | |
{ | |
var _wrap = function(Class) | |
{ | |
var _toString = Class.prototype.toString; | |
Class.prototype.toString = function() | |
{ | |
console.error('stack trace\n' + (this.stack || '/* no stack trace */')); |
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 _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(); |
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 i, n = 300000, a; | |
console.time("1"); | |
i = n; while(i--) | |
{ | |
a = []; | |
} | |
console.timeEnd("1"); | |
console.time("2"); |
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
// you can run it at http://bga.github.com/speedtest/ | |
var _fn = (function() | |
{ | |
var re = /\d/; | |
return function(s) | |
{ | |
re.test(s); | |
}; |
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 _fn = (function() | |
{ | |
var re = /\d/; | |
return function(s) | |
{ | |
return Math.random() + re.test(s); | |
}; | |
})(); |