_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q52600 | train | function() {
// convert to a poly point string
for (var i = 0, il = this.value.length, array = []; i < il; i++)
array.push(this.value[i].join(','))
return array.join(' ')
} | javascript | {
"resource": ""
} | |
q52601 | train | function(o, ease, delay){
if(typeof o == 'object'){
ease = o.ease
delay = o.delay
o = o.duration
}
var situation = new SVG.Situation({
duration: o || 1000,
delay: delay || 0,
ease: SVG.easing[ease || '-'] || ease
})
this.queue(situation)
... | javascript | {
"resource": ""
} | |
q52602 | train | function(o, ease, delay) {
return (this.fx || (this.fx = new SVG.FX(this))).animate(o, ease, delay)
} | javascript | {
"resource": ""
} | |
q52603 | train | function(a, v, relative) {
// apply attributes individually
if (typeof a == 'object') {
for (var key in a)
this.attr(key, a[key])
} else {
// the MorphObj takes care about the right function used
this.add(a, new SVG.MorphObj(null, v), 'attrs')
}
return this
} | javascript | {
"resource": ""
} | |
q52604 | train | function(box) {
var b = new c()
// merge boxes
b.x = Math.min(this.x, box.x)
b.y = Math.min(this.y, box.y)
b.width = Math.max(this.x + this.width, box.x + box.width) - b.x
b.height = Math.max(this.y + this.height, box.y + box.height) - b.y
return fullBox(b)
} | javascript | {
"resource": ""
} | |
q52605 | train | function() {
// find delta transform points
var px = deltaTransformPoint(this, 0, 1)
, py = deltaTransformPoint(this, 1, 0)
, skewX = 180 / Math.PI * Math.atan2(px.y, px.x) - 90
return {
// translation
x: this.e
, y: this.f
, transformed... | javascript | {
"resource": ""
} | |
q52606 | train | function(a, v, n) {
// act as full getter
if (a == null) {
// get an object of attributes
a = {}
v = this.node.attributes
for (n = v.length - 1; n >= 0; n--)
a[v[n].nodeName] = SVG.regex.isNumber.test(v[n].nodeValue) ? parseFloat(v[n].nodeValue) : v[n].nodeValue
return a
... | javascript | {
"resource": ""
} | |
q52607 | train | function() {
var matrix = (this.attr('transform') || '')
// split transformations
.split(/\)\s*/).slice(0,-1).map(function(str){
// generate key => value pairs
var kv = str.trim().split('(')
return [kv[0], kv[1].split(SVG.regex.matrixElements).map(function(str){ return parseFloa... | javascript | {
"resource": ""
} | |
q52608 | train | function(parent) {
if(this == parent) return this
var ctm = this.screenCTM()
var temp = parent.rect(1,1)
var pCtm = temp.screenCTM().inverse()
temp.remove()
this.addTo(parent).untransform().transform(pCtm.multiply(ctm))
return this
} | javascript | {
"resource": ""
} | |
q52609 | train | function(s, v) {
if (arguments.length == 0) {
// get full style
return this.node.style.cssText || ''
} else if (arguments.length < 2) {
// apply every style individually if an object is passed
if (typeof s == 'object') {
for (v in s) this.style(v, s[v])
} else if (SVG.reg... | javascript | {
"resource": ""
} | |
q52610 | train | function() {
return SVG.utils.map(SVG.utils.filterSVGElements(this.node.childNodes), function(node) {
return SVG.adopt(node)
})
} | javascript | {
"resource": ""
} | |
q52611 | train | function() {
// unmask all targets
for (var i = this.targets.length - 1; i >= 0; i--)
if (this.targets[i])
this.targets[i].unmask()
this.targets = []
// remove mask from parent
this.parent().removeElement(this)
return this
} | javascript | {
"resource": ""
} | |
q52612 | train | function(element) {
// use given mask or create a new one
this.masker = element instanceof SVG.Mask ? element : this.parent().mask().add(element)
// store reverence on self in mask
this.masker.targets.push(this)
// apply mask
return this.attr('mask', 'url("#' + this.masker.attr('id') + '")')
... | javascript | {
"resource": ""
} | |
q52613 | train | function() {
// unclip all targets
for (var i = this.targets.length - 1; i >= 0; i--)
if (this.targets[i])
this.targets[i].unclip()
this.targets = []
// remove clipPath from parent
this.parent().removeElement(this)
return this
} | javascript | {
"resource": ""
} | |
q52614 | train | function(element) {
// use given clip or create a new one
this.clipper = element instanceof SVG.ClipPath ? element : this.parent().clip().add(element)
// store reverence on self in mask
this.clipper.targets.push(this)
// apply mask
return this.attr('clip-path', 'url("#' + this.clipper.attr('id... | javascript | {
"resource": ""
} | |
q52615 | train | function(offset, color, opacity) {
return this.put(new SVG.Stop).update(offset, color, opacity)
} | javascript | {
"resource": ""
} | |
q52616 | train | function(o) {
if (typeof o == 'number' || o instanceof SVG.Number) {
o = {
offset: arguments[0]
, color: arguments[1]
, opacity: arguments[2]
}
}
// set attributes
if (o.opacity != null) this.attr('stop-opacity', o.opacity)
if (o.color != nul... | javascript | {
"resource": ""
} | |
q52617 | train | function(text) {
// remove contents
while (this.node.hasChildNodes())
this.node.removeChild(this.node.lastChild)
// create text node
this.node.appendChild(document.createTextNode(text))
return this
} | javascript | {
"resource": ""
} | |
q52618 | train | function(size) {
return this.put(new SVG.Circle).rx(new SVG.Number(size).divide(2)).move(0, 0)
} | javascript | {
"resource": ""
} | |
q52619 | train | function(x1, y1, x2, y2) {
return this.put(new SVG.Line).plot(x1, y1, x2, y2)
} | javascript | {
"resource": ""
} | |
q52620 | train | function(source, width, height) {
return this.put(new SVG.Image).load(source).size(width || 0, height || width || 0)
} | javascript | {
"resource": ""
} | |
q52621 | train | function(text) {
if(text == null) return this.node.textContent + (this.dom.newLined ? '\n' : '')
typeof text === 'function' ? text.call(this, this) : this.plain(text)
return this
} | javascript | {
"resource": ""
} | |
q52622 | train | function(d) {
// create textPath element
var path = new SVG.TextPath
, track = this.doc().defs().path(d)
// move lines to textpath
while (this.node.hasChildNodes())
path.node.appendChild(this.node.firstChild)
// add textPath element as child node
this.node.appendCh... | javascript | {
"resource": ""
} | |
q52623 | train | function(url) {
var link = new SVG.A
if (typeof url == 'function')
url.call(link, link)
else
link.to(url)
return this.parent().put(link).put(this)
} | javascript | {
"resource": ""
} | |
q52624 | train | function(marker, width, height, block) {
var attr = ['marker']
// Build attribute name
if (marker != 'all') attr.push(marker)
attr = attr.join('-')
// Set marker attribute
marker = arguments[1] instanceof SVG.Marker ?
arguments[1] :
this.doc().marker(width, height, block)
retu... | javascript | {
"resource": ""
} | |
q52625 | train | function(d, cx, cy) {
return this.transform({ rotation: d, cx: cx, cy: cy })
} | javascript | {
"resource": ""
} | |
q52626 | train | function(x, y) {
var type = (this._target || this).type;
return type == 'radial' || type == 'circle' ?
this.attr('r', new SVG.Number(x)) :
this.rx(x).ry(y == null ? x : y)
} | javascript | {
"resource": ""
} | |
q52627 | train | function() {
var i, il, elements = [].slice.call(arguments)
for (i = 0, il = elements.length; i < il; i++)
this.members.push(elements[i])
return this
} | javascript | {
"resource": ""
} | |
q52628 | train | function(a, v, r) {
if (typeof a == 'object') {
for (v in a)
this.data(v, a[v])
} else if (arguments.length < 2) {
try {
return JSON.parse(this.attr('data-' + a))
} catch(e) {
return this.attr('data-' + a)
}
} else {
this.attr(
'data-' + a
... | javascript | {
"resource": ""
} | |
q52629 | train | function(k, v) {
// remember every item in an object individually
if (typeof arguments[0] == 'object')
for (var v in k)
this.remember(v, k[v])
// retrieve memory
else if (arguments.length == 1)
return this.memory()[k]
// store memory
else
this.memory()[k] = v
ret... | javascript | {
"resource": ""
} | |
q52630 | camelCase | train | function camelCase(s) {
return s.toLowerCase().replace(/-(.)/g, function(m, g) {
return g.toUpperCase()
})
} | javascript | {
"resource": ""
} |
q52631 | fullHex | train | function fullHex(hex) {
return hex.length == 4 ?
[ '#',
hex.substring(1, 2), hex.substring(1, 2)
, hex.substring(2, 3), hex.substring(2, 3)
, hex.substring(3, 4), hex.substring(3, 4)
].join('') : hex
} | javascript | {
"resource": ""
} |
q52632 | proportionalSize | train | function proportionalSize(box, width, height) {
if (height == null)
height = box.height / box.width * width
else if (width == null)
width = box.width / box.height * height
return {
width: width
, height: height
}
} | javascript | {
"resource": ""
} |
q52633 | deltaTransformPoint | train | function deltaTransformPoint(matrix, x, y) {
return {
x: x * matrix.a + y * matrix.c + 0
, y: x * matrix.b + y * matrix.d + 0
}
} | javascript | {
"resource": ""
} |
q52634 | parseMatrix | train | function parseMatrix(matrix) {
if (!(matrix instanceof SVG.Matrix))
matrix = new SVG.Matrix(matrix)
return matrix
} | javascript | {
"resource": ""
} |
q52635 | ensureCentre | train | function ensureCentre(o, target) {
o.cx = o.cx == null ? target.bbox().cx : o.cx
o.cy = o.cy == null ? target.bbox().cy : o.cy
} | javascript | {
"resource": ""
} |
q52636 | stringToMatrix | train | function stringToMatrix(source) {
// remove matrix wrapper and split to individual numbers
source = source
.replace(SVG.regex.whitespace, '')
.replace(SVG.regex.matrix, '')
.split(SVG.regex.matrixElements)
// convert string values to floats and convert to a matrix-formatted object
return arrayToMat... | javascript | {
"resource": ""
} |
q52637 | at | train | function at(o, pos) {
// number recalculation (don't bother converting to SVG.Number for performance reasons)
return typeof o.from == 'number' ?
o.from + (o.to - o.from) * pos :
// instance recalculation
o instanceof SVG.Color || o instanceof SVG.Number || o instanceof SVG.Matrix ? o.at(pos) :
// for al... | javascript | {
"resource": ""
} |
q52638 | assignNewId | train | function assignNewId(node) {
// do the same for SVG child nodes as well
for (var i = node.childNodes.length - 1; i >= 0; i--)
if (node.childNodes[i] instanceof SVGElement)
assignNewId(node.childNodes[i])
return SVG.adopt(node).id(SVG.eid(node.nodeName))
} | javascript | {
"resource": ""
} |
q52639 | fullBox | train | function fullBox(b) {
if (b.x == null) {
b.x = 0
b.y = 0
b.width = 0
b.height = 0
}
b.w = b.width
b.h = b.height
b.x2 = b.x + b.width
b.y2 = b.y + b.height
b.cx = b.x + b.width / 2
b.cy = b.y + b.height / 2
return b
} | javascript | {
"resource": ""
} |
q52640 | idFromReference | train | function idFromReference(url) {
var m = url.toString().match(SVG.regex.reference)
if (m) return m[1]
} | javascript | {
"resource": ""
} |
q52641 | serializeProperty | train | function serializeProperty(metadata, prop) {
if (!metadata || metadata.excludeToJson === true) {
return;
}
if (metadata.customConverter) {
return metadata.customConverter.toJson(prop);
}
if (!metadata.clazz) {
return prop;
}
if (utils_1.isArrayOrArrayClass(prop)) {
... | javascript | {
"resource": ""
} |
q52642 | goTo | train | function goTo(hash,changehash){
win.unbind('hashchange', hashchange);
hash = hash.replace(/!\//,'');
win.stop().scrollTo(hash,duration,{
easing:easing,
axis:'y'
});
if(changehash !== false){
var l = location;
location.href = (l.protocol+'//'+l.host+l.pathname+'#!/'+hash.substr(1));
}
win.bi... | javascript | {
"resource": ""
} |
q52643 | activateNav | train | function activateNav(pos){
var offset = 100,
current, next, parent, isSub, hasSub;
win.unbind('hashchange', hashchange);
for(var i=sectionscount;i>0;i--){
if(sections[i-1].pos <= pos+offset){
navanchors.removeClass('current');
current = navanchors.eq(i-1);
current.addClass('current');
pa... | javascript | {
"resource": ""
} |
q52644 | train | function (param, value) {
var jvmObject;
if (arguments[0] instanceof org.apache.spark.ml.param.ParamPair) {
jvmObject = arguments[0];
} else {
jvmObject = new org.apache.spark.ml.param.ParamPair(param, value);
}
this.logger = Logger.getLogger("ParamPair_js... | javascript | {
"resource": ""
} | |
q52645 | train | function(rows,nRows,nCols) {
this.logger = Logger.getLogger("RowMatrix_js");
var jvmObject;
if (arguments[0] instanceof org.apache.spark.mllib.linalg.distributed.RowMatrix) {
jvmObject = arguments[0];
} else if (arguments.length === 3) {
jvmObject = new org.apache... | javascript | {
"resource": ""
} | |
q52646 | train | function () {
this.logger = Logger.getLogger("Gradient_js");
var jvmObject;
if (arguments[0] instanceof org.apache.spark.mllib.optimization.Gradient) {
jvmObject = arguments[0];
} else {
jvmObject = new org.apache.spark.mllib.optimization.Gradient();
}
... | javascript | {
"resource": ""
} | |
q52647 | train | function (clusterCenters) {
var jvmObject;
if (clusterCenters instanceof org.apache.spark.mllib.clustering.KMeansModel) {
jvmObject = clusterCenters;
} else {
jvmObject = new org.apache.spark.mllib.clustering.KMeansModel(clusterCenters);
}
this.logger = L... | javascript | {
"resource": ""
} | |
q52648 | train | function () {
var jvmObject;
if (arguments.length == 1) {
jvmObject = arguments[0];
} else {
var value = arguments[0];
this._accumulableParam = arguments[1];
if (arguments[1] instanceof FloatAccumulatorParam) {
value = parseFloat(va... | javascript | {
"resource": ""
} | |
q52649 | train | function (jvmObject) {
this.logger = Logger.getLogger("mllib_recommendation_ALS_js");
if (!jvmObject) {
jvmObject = new org.apache.spark.mllib.recommendation.ALS();
}
JavaWrapper.call(this, jvmObject);
} | javascript | {
"resource": ""
} | |
q52650 | train | function (predictionAndObservations) {
this.logger = Logger.getLogger("RegressionMetrics_js");
var jvmObject;
if (predictionAndObservations instanceof org.apache.spark.mllib.evaluation.RegressionMetrics) {
jvmObject = predictionAndObservations;
} else {
jvmObject ... | javascript | {
"resource": ""
} | |
q52651 | train | function (topNode, algo) {
var jvmObject;
if (topNode instanceof org.apache.spark.mllib.tree.model.DecisionTreeModel) {
jvmObject = topNode;
}/* if (topeNode instanceof Node {
jvmObject = new org.apache.spark.mllib.tree.model.DecisionTreeModel(topNode,algo);
} */ e... | javascript | {
"resource": ""
} | |
q52652 | train | function (jvmObject) {
this.logger = Logger.getLogger("mllib_feature_Word2Vec_js");
if (!jvmObject) {
jvmObject = new org.apache.spark.mllib.feature.Word2Vec();
}
JavaWrapper.call(this, jvmObject);
} | javascript | {
"resource": ""
} | |
q52653 | train | function (boundaries, predictions, isotonic) {
this.logger = Logger.getLogger("IsotonicRegressionModel_js");
var jvmObject;
if (boundaries instanceof org.apache.spark.mllib.regression.IsotonicRegressionModel) {
jvmObject = boundaries;
} else {
jvmObject = new org.... | javascript | {
"resource": ""
} | |
q52654 | train | function () {
this.logger = Logger.getLogger("MatrixFactorizationModel_js");
var jvmObject = arguments[0];
if (arguments.length > 1) {
var userFeatures = Utils.unwrapObject(arguments[1]);
var productFeatures = Utils.unwrapObject(arguments[2]);
jvmObject = new ... | javascript | {
"resource": ""
} | |
q52655 | handleArguments | train | function handleArguments(args) {
return new Promise(function(resolve, reject) {
var requires = [];
var promises = [];
// check for Promises in args
if (args && args instanceof Array) {
args.some(function (arg, i) {
if ((arg.value === null || typeof(arg.value) == 'undefined') && arg.opti... | javascript | {
"resource": ""
} |
q52656 | train | function(jvmObject) {
this.logger = Logger.getLogger("BisectingKMeans_js");
if (!jvmObject) {
jvmObject = new org.apache.spark.mllib.clustering.BisectingKMeans();
}
JavaWrapper.call(this, jvmObject);
} | javascript | {
"resource": ""
} | |
q52657 | train | function (jvmObject) {
this.logger = Logger.getLogger("ml_param_ParamMap_js");
if (!jvmObject) {
jvmObject = new org.apache.spark.ml.param.ParamMap();
}
JavaWrapper.call(this, jvmObject);
} | javascript | {
"resource": ""
} | |
q52658 | run | train | function run(sc) {
var LogisticRegressionModel = require('eclairjs/mllib/classification').LogisticRegressionModel;
var LabeledPoint = require("eclairjs/mllib/regression/LabeledPoint");
var Vectors = require("eclairjs/mllib/linalg/Vectors");
var BinaryClassificationMetrics = require("eclairjs/mllib/evalu... | javascript | {
"resource": ""
} |
q52659 | train | function(scoreAndLabels,numBins) {
var jvmObject;
if (scoreAndLabels instanceof org.apache.spark.mllib.evaluation.BinaryClassificationMetrics) {
jvmObject = scoreAndLabels;
} else {
jvmObject = new org.apache.spark.mllib.evaluation.BinaryClassificationMetrics(Utils.unwrap... | javascript | {
"resource": ""
} | |
q52660 | train | function (algo, trees, treeWeights) {
this.logger = Logger.getLogger("GradientBoostedTreesModel_js");
var jvmObject;
if (arguments[0] instanceof org.apache.spark.mllib.tree.model.GradientBoostedTreesModel) {
jvmObject = arguments[0];
} else {
jvmObject = new org.a... | javascript | {
"resource": ""
} | |
q52661 | train | function (sqlContext, logical) {
var jvmObject;
if (arguments[0] instanceof org.apache.spark.sql.execution.QueryExecution) {
var jvmObject = arguments[0];
} else {
jvmObject = new org.apache.spark.sql.execution.QueryExecution(Utils.unwrapObject(sqlContext), Utils.unwrapOb... | javascript | {
"resource": ""
} | |
q52662 | run | train | function run(sc) {
var lines = sc.textFile(directory);
var points = lines.map(function (line, LabeledPoint, Vectors) {
var parts = line.split(",");
var y = parseFloat(parts[0]);
var tok = parts[1].split(" ");
var x = [];
for (var i = 0; i < tok.length; ++i) {
... | javascript | {
"resource": ""
} |
q52663 | train | function (strategy) {
this.logger = Logger.getLogger("DecisionTree_js");
var jvmObject;
if (strategy instanceof Strategy) {
jvmObject = new org.apache.spark.mllib.tree.DecisionTree(Utils.unwrapObject(strategy));
} else if (strategy instanceof rg.apache.spark.mllib.tree.Decisi... | javascript | {
"resource": ""
} | |
q52664 | EclairJS | train | function EclairJS(sessionName) {
if (sessionName && EJSCache[sessionName]) {
console.log("got hit")
return EJSCache[sessionName].ejs;
} else {
var server = new Server();
var kernelP = server.getKernelPromise();
var instance = {
Accumulable: require('./Accumulable.js')(kernelP),
Accu... | javascript | {
"resource": ""
} |
q52665 | componentWillReceiveProps | train | function componentWillReceiveProps(nextProps) {
var children = this.props.children;
var index = children.findIndex(function (c) {
return c.props.value === nextProps.value && !c.props.disabled;
});
if (index !== -1 && index !== this.state.checkedIndex) {
this.setState({ checkedInd... | javascript | {
"resource": ""
} |
q52666 | executeCommand | train | function executeCommand(sid, command, ain, options, path)
{
path = path || '/webservices/homeautoswitch.lua?0=0';
if (sid)
path += '&sid=' + sid;
if (command)
path += '&switchcmd=' + command;
if (ain)
path += '&ain=' + ain;
return httpRequest(path, {}, options);
} | javascript | {
"resource": ""
} |
q52667 | sequence | train | function sequence(promises) {
var result = Promise.resolve();
promises.forEach(function(promise,i) {
result = result.then(promise);
});
return result;
} | javascript | {
"resource": ""
} |
q52668 | switches | train | function switches() {
return fritz.getSwitchList().then(function(switches) {
console.log("Switches: " + switches + "\n");
return sequence(switches.map(function(sw) {
return function() {
return sequence([
function() {
return fritz.getSwitchName(sw).then(function(name) {
... | javascript | {
"resource": ""
} |
q52669 | train | function() {
return fritz.getDevice(thermostat).then(function(device) {
console.log("[" + thermostat + "] " + device.name);
});
} | javascript | {
"resource": ""
} | |
q52670 | debug | train | function debug() {
return fritz.getDeviceList().then(function(devices) {
console.log("Raw devices\n");
console.log(devices);
});
} | javascript | {
"resource": ""
} |
q52671 | train | function(params, callback) {
var t = this;
if (typeof(params) !== 'string' || params.length < 1) {
callback("Autocomplete paramter must be a nonzero string");
}
// Forward to the completion mechanism if it can be completed
if (params.substr(-1).match(/([0-9])|([a-z])|([A-Z])|([_])... | javascript | {
"resource": ""
} | |
q52672 | train | function(params, callback) {
var t = this;
if (params === '.break' && t.shellCmd) {
t.shellCmd.kill();
}
if (NEW_REPL) {
t.stream.emit('data', params + "\n");
} else {
t.stream.emit('data', params);
}
return callback(null);
} | javascript | {
"resource": ""
} | |
q52673 | train | function(command) {
var t = this;
t.shellCmd = ChildProcess.exec(command, function(err, stdout, stderr) {
if (err) {
var outstr = 'exit';
if (err.code) {
outstr += ' (' + err.code + ')';
}
if (err.signal) {
outstr += ' ' + err.signal;
... | javascript | {
"resource": ""
} | |
q52674 | train | function(probe){
var t = this;
t.probe = probe;
events.EventEmitter.call(t);
if (t.setEncoding) {
t.setEncoding('utf8');
}
} | javascript | {
"resource": ""
} | |
q52675 | train | function(attrs, callback) {
var t = this;
// Value is the only thing to set
if (typeof attrs.value === 'undefined') {
return callback({code:'NO_VALUE'});
}
// Set the model elements. These cause change events to fire
if (t.isModel) {
t.value.set(attrs.value);
... | javascript | {
"resource": ""
} | |
q52676 | train | function() {
var t = this;
if (t.isModel) {
t.value.off('change', t.poll, t);
} else {
PollingProbe.prototype.release.apply(t, arguments);
}
} | javascript | {
"resource": ""
} | |
q52677 | train | function(expression, depth){
var t = this;
// Determine a default depth
depth = typeof depth === 'undefined' ? DEFAULT_DEPTH : depth;
// Get the raw value
var value = t._evaluate(expression);
// Return the depth limited results
return Monitor.deepCopy(value, depth);
} | javascript | {
"resource": ""
} | |
q52678 | train | function() {
var t = this,
newValue = t.eval_control(t.key, t.depth);
// Set the new value if it has changed from the current value
if (!_.isEqual(newValue, t.get('value'))) {
t.set({value: newValue});
}
} | javascript | {
"resource": ""
} | |
q52679 | train | function() {
var t = this, hostName = t.get('hostName'), hostPort = t.get('hostPort'),
url = t.get('url');
// Build the URL if not specified
if (!url) {
url = t.attributes.url = 'http://' + hostName + ':' + hostPort;
t.set('url', url);
}
// Connect with this url
... | javascript | {
"resource": ""
} | |
q52680 | train | function(callback) {
var t = this;
callback = callback || function(){};
var onPong = function() {
t.off('pong', onPong);
callback();
};
t.on('pong', onPong);
t.emit('connection:ping');
} | javascript | {
"resource": ""
} | |
q52681 | train | function(reason) {
var t = this, socket = t.get('socket');
t.connecting = false;
t.connected = false;
// Only disconnect once.
// This method can be called many times during a disconnect (manually,
// by socketIO disconnect, and/or by the underlying socket disconnect).
if (t.s... | javascript | {
"resource": ""
} | |
q52682 | train | function(hostName) {
var t = this, testHost = hostName.toLowerCase(),
myHostName = t.get('hostName'), remoteHostName = t.get('remoteHostName');
myHostName = myHostName && myHostName.toLowerCase();
remoteHostName = remoteHostName && remoteHostName.toLowerCase();
return (testHost === myH... | javascript | {
"resource": ""
} | |
q52683 | train | function() {
var t = this, socket = t.get('socket');
log.info(t.logId + 'emit', Monitor.deepCopy(arguments, 5));
socket.emit.apply(socket, arguments);
} | javascript | {
"resource": ""
} | |
q52684 | train | function(eventName, handler) {
var t = this, socket = t.get('socket');
t.socketEvents = t.socketEvents || {};
if (t.socketEvents[eventName]) {
throw new Error('Event already connected: ' + eventName);
}
socket.on(eventName, handler);
t.socketEvents[eventName] = handler;
... | javascript | {
"resource": ""
} | |
q52685 | train | function(eventName) {
var t = this, socket = t.get('socket');
if (t.socketEvents && t.socketEvents[eventName]) {
socket.removeListener(eventName, t.socketEvents[eventName]);
delete t.socketEvents[eventName];
}
return t;
} | javascript | {
"resource": ""
} | |
q52686 | train | function() {
var t = this, socket = t.get('socket');
for (var event in t.socketEvents) {
socket.removeListener(event, t.socketEvents[event]);
}
t.socketEvents = null;
return t;
} | javascript | {
"resource": ""
} | |
q52687 | train | function() {
var t = this, socket = t.get('socket');
if (t.socketEvents) {throw new Error('Already connected');}
t.socketEvents = {}; // key = event name, data = handler
// Failure events
t.addEvent('connect_failed', function(){
t.trigger('error', 'connect failed');
t.dis... | javascript | {
"resource": ""
} | |
q52688 | train | function(monitorJSON, callback) {
callback = callback || function(){};
var t = this,
errorText = '',
router = Monitor.getRouter(),
gateway = t.get('gateway'),
startTime = Date.now(),
firewall = t.get('firewall'),
logCtxt = _.extend({}, monitorJSON)... | javascript | {
"resource": ""
} | |
q52689 | train | function(params, callback) {
callback = callback || function(){};
var t = this,
errorText = '',
router = Monitor.getRouter(),
probeId = params.probeId,
monitorProxy = t.incomingMonitorsById[probeId],
firewall = t.get('firewall'),
logCtxt = null,
... | javascript | {
"resource": ""
} | |
q52690 | train | function(params, callback) {
callback = callback || function(){};
var t = this,
errorText = '',
logId = t.logId + 'probeControl',
startTime = Date.now(),
router = Monitor.getRouter(),
firewall = t.get('firewall');
// Don't allow inbound requests if th... | javascript | {
"resource": ""
} | |
q52691 | train | function(name, callback, context) {
if (!(eventsApi(this, 'on', name, [callback, context]) && callback)) return this;
this._events || (this._events = {});
var list = this._events[name] || (this._events[name] = []);
list.push({callback: callback, context: context, ctx: context || this});
re... | javascript | {
"resource": ""
} | |
q52692 | train | function(loud) {
this.changed = {};
var already = {};
var triggers = [];
var current = this._currentAttributes;
var changes = this._changes;
// Loop through the current queue of potential model changes.
for (var i = changes.length - 2; i >= 0; i -= 2) {
var key = chang... | javascript | {
"resource": ""
} | |
q52693 | train | function(models, options) {
var model, i, l, existing;
var add = [], remove = [], modelMap = {};
var idAttr = this.model.prototype.idAttribute;
options = _.extend({add: true, merge: true, remove: true}, options);
if (options.parse) models = this.parse(models);
// Allow a single mode... | javascript | {
"resource": ""
} | |
q52694 | train | function(methodName, method) {
return function() {
// Connect the success/error methods for callback style requests.
// These style callbacks don't need the model or options arguments
// because they're in the scope of the anonymous callback function.
var args = _.toArray(arguments), callba... | javascript | {
"resource": ""
} | |
q52695 | train | function(callback) {
var t = this, startTime = Date.now();
Monitor.getRouter().connectMonitor(t, function(error) {
// Monitor changes to writable attributes
if (!error && t.get('writableAttributes').length > 0) {
t.on('change', t.onChange, t);
}
// Give the caller... | javascript | {
"resource": ""
} | |
q52696 | train | function() {
var t = this;
return (t.probe && t.probe.connection ? t.probe.connection : null);
} | javascript | {
"resource": ""
} | |
q52697 | train | function(callback) {
var t = this,
reason = 'manual_disconnect',
startTime = Date.now(),
probeId = t.get('probeId');
// Stop forwarding changes to the probe
t.off('change', t.onChange, t);
// Disconnect from the router
Monitor.getRouter().disconnectMonitor(t... | javascript | {
"resource": ""
} | |
q52698 | train | function() {
var t = this,
writableAttributes = t.get('writableAttributes'),
writableChanges = {};
// Add any writable changes
var probeAttrs = t.toProbeJSON();
delete probeAttrs.id;
for (var attrName in probeAttrs) {
var isWritable = writableAttributes === '*'... | javascript | {
"resource": ""
} | |
q52699 | train | function(name, params, callback) {
var t = this,
probe = t.probe,
logId = 'control.' + t.get('probeClass') + '.' + name,
startTime = Date.now();
// Switch callback if sent in 2nd arg
if (typeof params === 'function') {
callback = params;
params = null;
... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.