repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
jillix/svg.connectable.js | example/js/svg.js | 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 | 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(' ')
} | [
"function",
"(",
")",
"{",
"// convert to a poly point string",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"il",
"=",
"this",
".",
"value",
".",
"length",
",",
"array",
"=",
"[",
"]",
";",
"i",
"<",
"il",
";",
"i",
"++",
")",
"array",
".",
"push",
"(... | Convert array to string | [
"Convert",
"array",
"to",
"string"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L504-L510 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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)
... | [
"function",
"(",
"o",
",",
"ease",
",",
"delay",
")",
"{",
"if",
"(",
"typeof",
"o",
"==",
"'object'",
")",
"{",
"ease",
"=",
"o",
".",
"ease",
"delay",
"=",
"o",
".",
"delay",
"o",
"=",
"o",
".",
"duration",
"}",
"var",
"situation",
"=",
"new"... | sets or returns the target of this animation
@param o object || number In case of Object it holds all parameters. In case of number its the duration of the animation
@param ease function || string Function which should be used for easing or easing keyword
@param delay Number indicating the delay before the animation st... | [
"sets",
"or",
"returns",
"the",
"target",
"of",
"this",
"animation"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L1281-L1298 | train | |
jillix/svg.connectable.js | example/js/svg.js | function(o, ease, delay) {
return (this.fx || (this.fx = new SVG.FX(this))).animate(o, ease, delay)
} | javascript | function(o, ease, delay) {
return (this.fx || (this.fx = new SVG.FX(this))).animate(o, ease, delay)
} | [
"function",
"(",
"o",
",",
"ease",
",",
"delay",
")",
"{",
"return",
"(",
"this",
".",
"fx",
"||",
"(",
"this",
".",
"fx",
"=",
"new",
"SVG",
".",
"FX",
"(",
"this",
")",
")",
")",
".",
"animate",
"(",
"o",
",",
"ease",
",",
"delay",
")",
"... | Get fx module or create a new one, then animate with given duration and ease | [
"Get",
"fx",
"module",
"or",
"create",
"a",
"new",
"one",
"then",
"animate",
"with",
"given",
"duration",
"and",
"ease"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L1827-L1829 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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
} | [
"function",
"(",
"a",
",",
"v",
",",
"relative",
")",
"{",
"// apply attributes individually",
"if",
"(",
"typeof",
"a",
"==",
"'object'",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"a",
")",
"this",
".",
"attr",
"(",
"key",
",",
"a",
"[",
"key",
"]... | Add animatable attributes | [
"Add",
"animatable",
"attributes"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L1891-L1903 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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)
} | [
"function",
"(",
"box",
")",
"{",
"var",
"b",
"=",
"new",
"c",
"(",
")",
"// merge boxes",
"b",
".",
"x",
"=",
"Math",
".",
"min",
"(",
"this",
".",
"x",
",",
"box",
".",
"x",
")",
"b",
".",
"y",
"=",
"Math",
".",
"min",
"(",
"this",
".",
... | Merge rect box with another, return a new instance | [
"Merge",
"rect",
"box",
"with",
"another",
"return",
"a",
"new",
"instance"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L2171-L2181 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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... | [
"function",
"(",
")",
"{",
"// find delta transform points",
"var",
"px",
"=",
"deltaTransformPoint",
"(",
"this",
",",
"0",
",",
"1",
")",
",",
"py",
"=",
"deltaTransformPoint",
"(",
"this",
",",
"1",
",",
"0",
")",
",",
"skewX",
"=",
"180",
"/",
"Mat... | Extract individual transformations | [
"Extract",
"individual",
"transformations"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L2211-L2239 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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
... | [
"function",
"(",
"a",
",",
"v",
",",
"n",
")",
"{",
"// act as full getter",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"// get an object of attributes",
"a",
"=",
"{",
"}",
"v",
"=",
"this",
".",
"node",
".",
"attributes",
"for",
"(",
"n",
"=",
"v",
... | Set svg element attribute | [
"Set",
"svg",
"element",
"attribute"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L2452-L2531 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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... | [
"function",
"(",
")",
"{",
"var",
"matrix",
"=",
"(",
"this",
".",
"attr",
"(",
"'transform'",
")",
"||",
"''",
")",
"// split transformations",
".",
"split",
"(",
"/",
"\\)\\s*",
"/",
")",
".",
"slice",
"(",
"0",
",",
"-",
"1",
")",
".",
"map",
... | merge the whole transformation chain into one matrix and returns it | [
"merge",
"the",
"whole",
"transformation",
"chain",
"into",
"one",
"matrix",
"and",
"returns",
"it"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L2713-L2731 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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
} | [
"function",
"(",
"parent",
")",
"{",
"if",
"(",
"this",
"==",
"parent",
")",
"return",
"this",
"var",
"ctm",
"=",
"this",
".",
"screenCTM",
"(",
")",
"var",
"temp",
"=",
"parent",
".",
"rect",
"(",
"1",
",",
"1",
")",
"var",
"pCtm",
"=",
"temp",
... | add an element to another parent without changing the visual representation on the screen | [
"add",
"an",
"element",
"to",
"another",
"parent",
"without",
"changing",
"the",
"visual",
"representation",
"on",
"the",
"screen"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L2733-L2743 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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... | [
"function",
"(",
"s",
",",
"v",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"==",
"0",
")",
"{",
"// get full style",
"return",
"this",
".",
"node",
".",
"style",
".",
"cssText",
"||",
"''",
"}",
"else",
"if",
"(",
"arguments",
".",
"length",
... | Dynamic style generator | [
"Dynamic",
"style",
"generator"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L2888-L2917 | train | |
jillix/svg.connectable.js | example/js/svg.js | function() {
return SVG.utils.map(SVG.utils.filterSVGElements(this.node.childNodes), function(node) {
return SVG.adopt(node)
})
} | javascript | function() {
return SVG.utils.map(SVG.utils.filterSVGElements(this.node.childNodes), function(node) {
return SVG.adopt(node)
})
} | [
"function",
"(",
")",
"{",
"return",
"SVG",
".",
"utils",
".",
"map",
"(",
"SVG",
".",
"utils",
".",
"filterSVGElements",
"(",
"this",
".",
"node",
".",
"childNodes",
")",
",",
"function",
"(",
"node",
")",
"{",
"return",
"SVG",
".",
"adopt",
"(",
... | Returns all child elements | [
"Returns",
"all",
"child",
"elements"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L2931-L2935 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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
} | [
"function",
"(",
")",
"{",
"// unmask all targets",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"targets",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"if",
"(",
"this",
".",
"targets",
"[",
"i",
"]",
")",
"this",
".",
"tar... | Unmask all masked elements and remove itself | [
"Unmask",
"all",
"masked",
"elements",
"and",
"remove",
"itself"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L3488-L3499 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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') + '")')
... | [
"function",
"(",
"element",
")",
"{",
"// use given mask or create a new one",
"this",
".",
"masker",
"=",
"element",
"instanceof",
"SVG",
".",
"Mask",
"?",
"element",
":",
"this",
".",
"parent",
"(",
")",
".",
"mask",
"(",
")",
".",
"add",
"(",
"element",... | Distribute mask to svg element | [
"Distribute",
"mask",
"to",
"svg",
"element"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L3514-L3523 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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
} | [
"function",
"(",
")",
"{",
"// unclip all targets",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"targets",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"if",
"(",
"this",
".",
"targets",
"[",
"i",
"]",
")",
"this",
".",
"tar... | Unclip all clipped elements and remove itself | [
"Unclip",
"all",
"clipped",
"elements",
"and",
"remove",
"itself"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L3547-L3558 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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... | [
"function",
"(",
"element",
")",
"{",
"// use given clip or create a new one",
"this",
".",
"clipper",
"=",
"element",
"instanceof",
"SVG",
".",
"ClipPath",
"?",
"element",
":",
"this",
".",
"parent",
"(",
")",
".",
"clip",
"(",
")",
".",
"add",
"(",
"elem... | Distribute clipPath to svg element | [
"Distribute",
"clipPath",
"to",
"svg",
"element"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L3573-L3582 | train | |
jillix/svg.connectable.js | example/js/svg.js | function(offset, color, opacity) {
return this.put(new SVG.Stop).update(offset, color, opacity)
} | javascript | function(offset, color, opacity) {
return this.put(new SVG.Stop).update(offset, color, opacity)
} | [
"function",
"(",
"offset",
",",
"color",
",",
"opacity",
")",
"{",
"return",
"this",
".",
"put",
"(",
"new",
"SVG",
".",
"Stop",
")",
".",
"update",
"(",
"offset",
",",
"color",
",",
"opacity",
")",
"}"
] | Add a color stop | [
"Add",
"a",
"color",
"stop"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L3605-L3607 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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... | [
"function",
"(",
"o",
")",
"{",
"if",
"(",
"typeof",
"o",
"==",
"'number'",
"||",
"o",
"instanceof",
"SVG",
".",
"Number",
")",
"{",
"o",
"=",
"{",
"offset",
":",
"arguments",
"[",
"0",
"]",
",",
"color",
":",
"arguments",
"[",
"1",
"]",
",",
"... | add color stops | [
"add",
"color",
"stops"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L3678-L3693 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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
} | [
"function",
"(",
"text",
")",
"{",
"// remove contents",
"while",
"(",
"this",
".",
"node",
".",
"hasChildNodes",
"(",
")",
")",
"this",
".",
"node",
".",
"removeChild",
"(",
"this",
".",
"node",
".",
"lastChild",
")",
"// create text node",
"this",
".",
... | Insert some plain text | [
"Insert",
"some",
"plain",
"text"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L3868-L3877 | train | |
jillix/svg.connectable.js | example/js/svg.js | function(size) {
return this.put(new SVG.Circle).rx(new SVG.Number(size).divide(2)).move(0, 0)
} | javascript | function(size) {
return this.put(new SVG.Circle).rx(new SVG.Number(size).divide(2)).move(0, 0)
} | [
"function",
"(",
"size",
")",
"{",
"return",
"this",
".",
"put",
"(",
"new",
"SVG",
".",
"Circle",
")",
".",
"rx",
"(",
"new",
"SVG",
".",
"Number",
"(",
"size",
")",
".",
"divide",
"(",
"2",
")",
")",
".",
"move",
"(",
"0",
",",
"0",
")",
... | Create circle element, based on ellipse | [
"Create",
"circle",
"element",
"based",
"on",
"ellipse"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L3942-L3944 | train | |
jillix/svg.connectable.js | example/js/svg.js | function(x1, y1, x2, y2) {
return this.put(new SVG.Line).plot(x1, y1, x2, y2)
} | javascript | function(x1, y1, x2, y2) {
return this.put(new SVG.Line).plot(x1, y1, x2, y2)
} | [
"function",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
"{",
"return",
"this",
".",
"put",
"(",
"new",
"SVG",
".",
"Line",
")",
".",
"plot",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
"}"
] | Create a line element | [
"Create",
"a",
"line",
"element"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L4061-L4063 | train | |
jillix/svg.connectable.js | example/js/svg.js | function(source, width, height) {
return this.put(new SVG.Image).load(source).size(width || 0, height || width || 0)
} | javascript | function(source, width, height) {
return this.put(new SVG.Image).load(source).size(width || 0, height || width || 0)
} | [
"function",
"(",
"source",
",",
"width",
",",
"height",
")",
"{",
"return",
"this",
".",
"put",
"(",
"new",
"SVG",
".",
"Image",
")",
".",
"load",
"(",
"source",
")",
".",
"size",
"(",
"width",
"||",
"0",
",",
"height",
"||",
"width",
"||",
"0",
... | create image element, load image and set its size | [
"create",
"image",
"element",
"load",
"image",
"and",
"set",
"its",
"size"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L4254-L4256 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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
} | [
"function",
"(",
"text",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"return",
"this",
".",
"node",
".",
"textContent",
"+",
"(",
"this",
".",
"dom",
".",
"newLined",
"?",
"'\\n'",
":",
"''",
")",
"typeof",
"text",
"===",
"'function'",
"?",
"te... | Set text content | [
"Set",
"text",
"content"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L4452-L4458 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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... | [
"function",
"(",
"d",
")",
"{",
"// create textPath element",
"var",
"path",
"=",
"new",
"SVG",
".",
"TextPath",
",",
"track",
"=",
"this",
".",
"doc",
"(",
")",
".",
"defs",
"(",
")",
".",
"path",
"(",
"d",
")",
"// move lines to textpath",
"while",
"... | Create path for text to run on | [
"Create",
"path",
"for",
"text",
"to",
"run",
"on"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L4537-L4553 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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)
} | [
"function",
"(",
"url",
")",
"{",
"var",
"link",
"=",
"new",
"SVG",
".",
"A",
"if",
"(",
"typeof",
"url",
"==",
"'function'",
")",
"url",
".",
"call",
"(",
"link",
",",
"link",
")",
"else",
"link",
".",
"to",
"(",
"url",
")",
"return",
"this",
... | Create a hyperlink element | [
"Create",
"a",
"hyperlink",
"element"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L4630-L4639 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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... | [
"function",
"(",
"marker",
",",
"width",
",",
"height",
",",
"block",
")",
"{",
"var",
"attr",
"=",
"[",
"'marker'",
"]",
"// Build attribute name",
"if",
"(",
"marker",
"!=",
"'all'",
")",
"attr",
".",
"push",
"(",
"marker",
")",
"attr",
"=",
"attr",
... | Create and attach markers | [
"Create",
"and",
"attach",
"markers"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L4706-L4719 | train | |
jillix/svg.connectable.js | example/js/svg.js | function(d, cx, cy) {
return this.transform({ rotation: d, cx: cx, cy: cy })
} | javascript | function(d, cx, cy) {
return this.transform({ rotation: d, cx: cx, cy: cy })
} | [
"function",
"(",
"d",
",",
"cx",
",",
"cy",
")",
"{",
"return",
"this",
".",
"transform",
"(",
"{",
"rotation",
":",
"d",
",",
"cx",
":",
"cx",
",",
"cy",
":",
"cy",
"}",
")",
"}"
] | Map rotation to transform | [
"Map",
"rotation",
"to",
"transform"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L4754-L4756 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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)
} | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"var",
"type",
"=",
"(",
"this",
".",
"_target",
"||",
"this",
")",
".",
"type",
";",
"return",
"type",
"==",
"'radial'",
"||",
"type",
"==",
"'circle'",
"?",
"this",
".",
"attr",
"(",
"'r'",
",",
"new",
... | Add x and y radius | [
"Add",
"x",
"and",
"y",
"radius"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L4799-L4804 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | function() {
var i, il, elements = [].slice.call(arguments)
for (i = 0, il = elements.length; i < il; i++)
this.members.push(elements[i])
return this
} | [
"function",
"(",
")",
"{",
"var",
"i",
",",
"il",
",",
"elements",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
"for",
"(",
"i",
"=",
"0",
",",
"il",
"=",
"elements",
".",
"length",
";",
"i",
"<",
"il",
";",
"i",
"++",
"... | Add element to set | [
"Add",
"element",
"to",
"set"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L4845-L4852 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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
... | [
"function",
"(",
"a",
",",
"v",
",",
"r",
")",
"{",
"if",
"(",
"typeof",
"a",
"==",
"'object'",
")",
"{",
"for",
"(",
"v",
"in",
"a",
")",
"this",
".",
"data",
"(",
"v",
",",
"a",
"[",
"v",
"]",
")",
"}",
"else",
"if",
"(",
"arguments",
"... | Store data values on svg nodes | [
"Store",
"data",
"values",
"on",
"svg",
"nodes"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L4992-L5016 | train | |
jillix/svg.connectable.js | example/js/svg.js | 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 | 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... | [
"function",
"(",
"k",
",",
"v",
")",
"{",
"// remember every item in an object individually",
"if",
"(",
"typeof",
"arguments",
"[",
"0",
"]",
"==",
"'object'",
")",
"for",
"(",
"var",
"v",
"in",
"k",
")",
"this",
".",
"remember",
"(",
"v",
",",
"k",
"... | Remember arbitrary data | [
"Remember",
"arbitrary",
"data"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5020-L5035 | train | |
jillix/svg.connectable.js | example/js/svg.js | camelCase | function camelCase(s) {
return s.toLowerCase().replace(/-(.)/g, function(m, g) {
return g.toUpperCase()
})
} | javascript | function camelCase(s) {
return s.toLowerCase().replace(/-(.)/g, function(m, g) {
return g.toUpperCase()
})
} | [
"function",
"camelCase",
"(",
"s",
")",
"{",
"return",
"s",
".",
"toLowerCase",
"(",
")",
".",
"replace",
"(",
"/",
"-(.)",
"/",
"g",
",",
"function",
"(",
"m",
",",
"g",
")",
"{",
"return",
"g",
".",
"toUpperCase",
"(",
")",
"}",
")",
"}"
] | Convert dash-separated-string to camelCase | [
"Convert",
"dash",
"-",
"separated",
"-",
"string",
"to",
"camelCase"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5086-L5090 | train |
jillix/svg.connectable.js | example/js/svg.js | fullHex | 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 | 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
} | [
"function",
"fullHex",
"(",
"hex",
")",
"{",
"return",
"hex",
".",
"length",
"==",
"4",
"?",
"[",
"'#'",
",",
"hex",
".",
"substring",
"(",
"1",
",",
"2",
")",
",",
"hex",
".",
"substring",
"(",
"1",
",",
"2",
")",
",",
"hex",
".",
"substring",... | Ensure to six-based hex | [
"Ensure",
"to",
"six",
"-",
"based",
"hex"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5098-L5105 | train |
jillix/svg.connectable.js | example/js/svg.js | proportionalSize | 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 | 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
}
} | [
"function",
"proportionalSize",
"(",
"box",
",",
"width",
",",
"height",
")",
"{",
"if",
"(",
"height",
"==",
"null",
")",
"height",
"=",
"box",
".",
"height",
"/",
"box",
".",
"width",
"*",
"width",
"else",
"if",
"(",
"width",
"==",
"null",
")",
"... | Calculate proportional width and height values when necessary | [
"Calculate",
"proportional",
"width",
"and",
"height",
"values",
"when",
"necessary"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5114-L5124 | train |
jillix/svg.connectable.js | example/js/svg.js | deltaTransformPoint | function deltaTransformPoint(matrix, x, y) {
return {
x: x * matrix.a + y * matrix.c + 0
, y: x * matrix.b + y * matrix.d + 0
}
} | javascript | function deltaTransformPoint(matrix, x, y) {
return {
x: x * matrix.a + y * matrix.c + 0
, y: x * matrix.b + y * matrix.d + 0
}
} | [
"function",
"deltaTransformPoint",
"(",
"matrix",
",",
"x",
",",
"y",
")",
"{",
"return",
"{",
"x",
":",
"x",
"*",
"matrix",
".",
"a",
"+",
"y",
"*",
"matrix",
".",
"c",
"+",
"0",
",",
"y",
":",
"x",
"*",
"matrix",
".",
"b",
"+",
"y",
"*",
... | Delta transform point | [
"Delta",
"transform",
"point"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5127-L5132 | train |
jillix/svg.connectable.js | example/js/svg.js | parseMatrix | function parseMatrix(matrix) {
if (!(matrix instanceof SVG.Matrix))
matrix = new SVG.Matrix(matrix)
return matrix
} | javascript | function parseMatrix(matrix) {
if (!(matrix instanceof SVG.Matrix))
matrix = new SVG.Matrix(matrix)
return matrix
} | [
"function",
"parseMatrix",
"(",
"matrix",
")",
"{",
"if",
"(",
"!",
"(",
"matrix",
"instanceof",
"SVG",
".",
"Matrix",
")",
")",
"matrix",
"=",
"new",
"SVG",
".",
"Matrix",
"(",
"matrix",
")",
"return",
"matrix",
"}"
] | Parse matrix if required | [
"Parse",
"matrix",
"if",
"required"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5140-L5145 | train |
jillix/svg.connectable.js | example/js/svg.js | ensureCentre | 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 | function ensureCentre(o, target) {
o.cx = o.cx == null ? target.bbox().cx : o.cx
o.cy = o.cy == null ? target.bbox().cy : o.cy
} | [
"function",
"ensureCentre",
"(",
"o",
",",
"target",
")",
"{",
"o",
".",
"cx",
"=",
"o",
".",
"cx",
"==",
"null",
"?",
"target",
".",
"bbox",
"(",
")",
".",
"cx",
":",
"o",
".",
"cx",
"o",
".",
"cy",
"=",
"o",
".",
"cy",
"==",
"null",
"?",
... | Add centre point to transform object | [
"Add",
"centre",
"point",
"to",
"transform",
"object"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5148-L5151 | train |
jillix/svg.connectable.js | example/js/svg.js | stringToMatrix | 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 | 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... | [
"function",
"stringToMatrix",
"(",
"source",
")",
"{",
"// remove matrix wrapper and split to individual numbers",
"source",
"=",
"source",
".",
"replace",
"(",
"SVG",
".",
"regex",
".",
"whitespace",
",",
"''",
")",
".",
"replace",
"(",
"SVG",
".",
"regex",
"."... | Convert string to matrix | [
"Convert",
"string",
"to",
"matrix"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5154-L5167 | train |
jillix/svg.connectable.js | example/js/svg.js | at | 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 | 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... | [
"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",
".",
... | Calculate position according to from and to | [
"Calculate",
"position",
"according",
"to",
"from",
"and",
"to"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5170-L5180 | train |
jillix/svg.connectable.js | example/js/svg.js | assignNewId | 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 | 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))
} | [
"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... | Deep new id assignment | [
"Deep",
"new",
"id",
"assignment"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5220-L5227 | train |
jillix/svg.connectable.js | example/js/svg.js | fullBox | 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 | 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
} | [
"function",
"fullBox",
"(",
"b",
")",
"{",
"if",
"(",
"b",
".",
"x",
"==",
"null",
")",
"{",
"b",
".",
"x",
"=",
"0",
"b",
".",
"y",
"=",
"0",
"b",
".",
"width",
"=",
"0",
"b",
".",
"height",
"=",
"0",
"}",
"b",
".",
"w",
"=",
"b",
".... | Add more bounding box properties | [
"Add",
"more",
"bounding",
"box",
"properties"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5230-L5246 | train |
jillix/svg.connectable.js | example/js/svg.js | idFromReference | function idFromReference(url) {
var m = url.toString().match(SVG.regex.reference)
if (m) return m[1]
} | javascript | function idFromReference(url) {
var m = url.toString().match(SVG.regex.reference)
if (m) return m[1]
} | [
"function",
"idFromReference",
"(",
"url",
")",
"{",
"var",
"m",
"=",
"url",
".",
"toString",
"(",
")",
".",
"match",
"(",
"SVG",
".",
"regex",
".",
"reference",
")",
"if",
"(",
"m",
")",
"return",
"m",
"[",
"1",
"]",
"}"
] | Get id from reference string | [
"Get",
"id",
"from",
"reference",
"string"
] | 279b5a44112b99e777462650514ec1332ea5d202 | https://github.com/jillix/svg.connectable.js/blob/279b5a44112b99e777462650514ec1332ea5d202/example/js/svg.js#L5249-L5253 | train |
jf3096/json-typescript-mapper | index.js | serializeProperty | 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 | 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)) {
... | [
"function",
"serializeProperty",
"(",
"metadata",
",",
"prop",
")",
"{",
"if",
"(",
"!",
"metadata",
"||",
"metadata",
".",
"excludeToJson",
"===",
"true",
")",
"{",
"return",
";",
"}",
"if",
"(",
"metadata",
".",
"customConverter",
")",
"{",
"return",
"... | Prepare a single property to be serialized to JSON.
@param metadata
@param prop
@returns {any} | [
"Prepare",
"a",
"single",
"property",
"to",
"be",
"serialized",
"to",
"JSON",
"."
] | 20c715fa8d58df810fa06dd306ff97442134db51 | https://github.com/jf3096/json-typescript-mapper/blob/20c715fa8d58df810fa06dd306ff97442134db51/index.js#L177-L191 | train |
QBisConsult/psql-api | webroot/pages/assets/js/script.js | goTo | 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 | 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... | [
"function",
"goTo",
"(",
"hash",
",",
"changehash",
")",
"{",
"win",
".",
"unbind",
"(",
"'hashchange'",
",",
"hashchange",
")",
";",
"hash",
"=",
"hash",
".",
"replace",
"(",
"/",
"!\\/",
"/",
",",
"''",
")",
";",
"win",
".",
"stop",
"(",
")",
"... | scroll to a section and set the hash | [
"scroll",
"to",
"a",
"section",
"and",
"set",
"the",
"hash"
] | d9a4f32663e9533b13a4e28d2fffa7a3d35e4e12 | https://github.com/QBisConsult/psql-api/blob/d9a4f32663e9533b13a4e28d2fffa7a3d35e4e12/webroot/pages/assets/js/script.js#L111-L123 | train |
QBisConsult/psql-api | webroot/pages/assets/js/script.js | activateNav | 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 | 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... | [
"function",
"activateNav",
"(",
"pos",
")",
"{",
"var",
"offset",
"=",
"100",
",",
"current",
",",
"next",
",",
"parent",
",",
"isSub",
",",
"hasSub",
";",
"win",
".",
"unbind",
"(",
"'hashchange'",
",",
"hashchange",
")",
";",
"for",
"(",
"var",
"i"... | activate current nav element | [
"activate",
"current",
"nav",
"element"
] | d9a4f32663e9533b13a4e28d2fffa7a3d35e4e12 | https://github.com/QBisConsult/psql-api/blob/d9a4f32663e9533b13a4e28d2fffa7a3d35e4e12/webroot/pages/assets/js/script.js#L127-L154 | train |
EclairJS/eclairjs | server/src/main/resources/eclairjs/ml/param/ParamPair.js | 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 | 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... | [
"function",
"(",
"param",
",",
"value",
")",
"{",
"var",
"jvmObject",
";",
"if",
"(",
"arguments",
"[",
"0",
"]",
"instanceof",
"org",
".",
"apache",
".",
"spark",
".",
"ml",
".",
"param",
".",
"ParamPair",
")",
"{",
"jvmObject",
"=",
"arguments",
"[... | A param and its value.
@classdesc
@param {module:eclairjs/ml/param.Param} param
@param {object} value
@class
@memberof module:eclairjs/ml/param | [
"A",
"param",
"and",
"its",
"value",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/ml/param/ParamPair.js#L31-L41 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/linalg/distributed/RowMatrix.js | 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 | 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... | [
"function",
"(",
"rows",
",",
"nRows",
",",
"nCols",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"RowMatrix_js\"",
")",
";",
"var",
"jvmObject",
";",
"if",
"(",
"arguments",
"[",
"0",
"]",
"instanceof",
"org",
".",
"apache"... | Represents a row-oriented distributed Matrix with no meaningful row indices.
@memberof module:eclairjs/mllib/linalg/distributed
@classdesc
@param {module:eclairjs.RDD} rows stored as an RDD[Vector]
@param {number} [nRows] number of rows. A non-positive value means unknown, and then the number of rows will
be determined... | [
"Represents",
"a",
"row",
"-",
"oriented",
"distributed",
"Matrix",
"with",
"no",
"meaningful",
"row",
"indices",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/linalg/distributed/RowMatrix.js#L41-L55 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/optimization/Gradient.js | 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 | 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();
}
... | [
"function",
"(",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"Gradient_js\"",
")",
";",
"var",
"jvmObject",
";",
"if",
"(",
"arguments",
"[",
"0",
"]",
"instanceof",
"org",
".",
"apache",
".",
"spark",
".",
"mllib",
".",
... | Class used to compute the gradient for a loss function, given a single data point.
@class
@memberof module:eclairjs/mllib/optimization
@constructor | [
"Class",
"used",
"to",
"compute",
"the",
"gradient",
"for",
"a",
"loss",
"function",
"given",
"a",
"single",
"data",
"point",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/optimization/Gradient.js#L28-L39 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/clustering/KMeansModel.js | 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 | 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... | [
"function",
"(",
"clusterCenters",
")",
"{",
"var",
"jvmObject",
";",
"if",
"(",
"clusterCenters",
"instanceof",
"org",
".",
"apache",
".",
"spark",
".",
"mllib",
".",
"clustering",
".",
"KMeansModel",
")",
"{",
"jvmObject",
"=",
"clusterCenters",
";",
"}",
... | A clustering model for K-means. Each point belongs to the cluster with the closest center.
@classdesc
A Java-friendly constructor that takes an Iterable of Vectors.
@param {@module:eclairjs/mllib/linalg.Vector[]} clusterCenters
@returns {??}
@memberof module:eclairjs/mllib/clustering
@class | [
"A",
"clustering",
"model",
"for",
"K",
"-",
"means",
".",
"Each",
"point",
"belongs",
"to",
"the",
"cluster",
"with",
"the",
"closest",
"center",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/clustering/KMeansModel.js#L35-L46 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/Accumulable.js | 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 | 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... | [
"function",
"(",
")",
"{",
"var",
"jvmObject",
";",
"if",
"(",
"arguments",
".",
"length",
"==",
"1",
")",
"{",
"jvmObject",
"=",
"arguments",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"var",
"value",
"=",
"arguments",
"[",
"0",
"]",
";",
"this",
"."... | A data type that can be accumulated, ie has an commutative and associative "add" operation,
but where the result type, `R`, may be different from the element type being added, `T`.
You must define how to add data, and how to merge two of these together. For some data types,
such as a counter, these might be the same ... | [
"A",
"data",
"type",
"that",
"can",
"be",
"accumulated",
"ie",
"has",
"an",
"commutative",
"and",
"associative",
"add",
"operation",
"but",
"where",
"the",
"result",
"type",
"R",
"may",
"be",
"different",
"from",
"the",
"element",
"type",
"being",
"added",
... | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/Accumulable.js#L47-L65 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/recommendation/ALS.js | 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 | function (jvmObject) {
this.logger = Logger.getLogger("mllib_recommendation_ALS_js");
if (!jvmObject) {
jvmObject = new org.apache.spark.mllib.recommendation.ALS();
}
JavaWrapper.call(this, jvmObject);
} | [
"function",
"(",
"jvmObject",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"mllib_recommendation_ALS_js\"",
")",
";",
"if",
"(",
"!",
"jvmObject",
")",
"{",
"jvmObject",
"=",
"new",
"org",
".",
"apache",
".",
"spark",
".",
"ml... | Alternating Least Squares matrix factorization.
ALS attempts to estimate the ratings matrix `R` as the product of two lower-rank matrices,
`X` and `Y`, i.e. `X * Yt = R`. Typically these approximations are called 'factor' matrices.
The general approach is iterative. During each iteration, one of the factor matrices is... | [
"Alternating",
"Least",
"Squares",
"matrix",
"factorization",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/recommendation/ALS.js#L61-L69 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/evaluation/RegressionMetrics.js | function (predictionAndObservations) {
this.logger = Logger.getLogger("RegressionMetrics_js");
var jvmObject;
if (predictionAndObservations instanceof org.apache.spark.mllib.evaluation.RegressionMetrics) {
jvmObject = predictionAndObservations;
} else {
jvmObject ... | javascript | function (predictionAndObservations) {
this.logger = Logger.getLogger("RegressionMetrics_js");
var jvmObject;
if (predictionAndObservations instanceof org.apache.spark.mllib.evaluation.RegressionMetrics) {
jvmObject = predictionAndObservations;
} else {
jvmObject ... | [
"function",
"(",
"predictionAndObservations",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"RegressionMetrics_js\"",
")",
";",
"var",
"jvmObject",
";",
"if",
"(",
"predictionAndObservations",
"instanceof",
"org",
".",
"apache",
".",
"... | Evaluator for regression.
@param predictionAndObservations an RDD of (prediction, observation) pairs.
@memberof module:eclairjs/mllib/evaluation
@classdesc
@param {module:eclairjs.RDD} predictionAndObservations
@class | [
"Evaluator",
"for",
"regression",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/evaluation/RegressionMetrics.js#L31-L43 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/tree/model/DecisionTreeModel.js | 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 | 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... | [
"function",
"(",
"topNode",
",",
"algo",
")",
"{",
"var",
"jvmObject",
";",
"if",
"(",
"topNode",
"instanceof",
"org",
".",
"apache",
".",
"spark",
".",
"mllib",
".",
"tree",
".",
"model",
".",
"DecisionTreeModel",
")",
"{",
"jvmObject",
"=",
"topNode",
... | Decision tree model for classification or regression.
This model stores the decision tree structure and parameters.
@param topNode root node
@param algo algorithm type -- classification or regression
@classdesc
@param {Node} topNode
@param {Algo} algo
@class
@memberof module:eclairjs/mllib/tree/model | [
"Decision",
"tree",
"model",
"for",
"classification",
"or",
"regression",
".",
"This",
"model",
"stores",
"the",
"decision",
"tree",
"structure",
"and",
"parameters",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/tree/model/DecisionTreeModel.js#L36-L48 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/feature/Word2Vec.js | 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 | function (jvmObject) {
this.logger = Logger.getLogger("mllib_feature_Word2Vec_js");
if (!jvmObject) {
jvmObject = new org.apache.spark.mllib.feature.Word2Vec();
}
JavaWrapper.call(this, jvmObject);
} | [
"function",
"(",
"jvmObject",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"mllib_feature_Word2Vec_js\"",
")",
";",
"if",
"(",
"!",
"jvmObject",
")",
"{",
"jvmObject",
"=",
"new",
"org",
".",
"apache",
".",
"spark",
".",
"mlli... | Word2Vec creates vector representation of words in a text corpus.
The algorithm first constructs a vocabulary from the corpus
and then learns vector representation of words in the vocabulary.
The vector representation can be used as features in
natural language processing and machine learning algorithms.
We used skip-... | [
"Word2Vec",
"creates",
"vector",
"representation",
"of",
"words",
"in",
"a",
"text",
"corpus",
".",
"The",
"algorithm",
"first",
"constructs",
"a",
"vocabulary",
"from",
"the",
"corpus",
"and",
"then",
"learns",
"vector",
"representation",
"of",
"words",
"in",
... | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/feature/Word2Vec.js#L42-L50 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/regression/IsotonicRegressionModel.js | 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 | 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.... | [
"function",
"(",
"boundaries",
",",
"predictions",
",",
"isotonic",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"IsotonicRegressionModel_js\"",
")",
";",
"var",
"jvmObject",
";",
"if",
"(",
"boundaries",
"instanceof",
"org",
".",
... | Regression model for isotonic regression.
@param boundaries Array of boundaries for which predictions are known.
Boundaries must be sorted in increasing order.
@param predictions Array of predictions associated to the boundaries at the same index.
Results of isotonic regression and therefore monotone.
@param isotonic ... | [
"Regression",
"model",
"for",
"isotonic",
"regression",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/regression/IsotonicRegressionModel.js#L41-L52 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/recommendation/MatrixFactorizationModel.js | 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 | 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 ... | [
"function",
"(",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"MatrixFactorizationModel_js\"",
")",
";",
"var",
"jvmObject",
"=",
"arguments",
"[",
"0",
"]",
";",
"if",
"(",
"arguments",
".",
"length",
">",
"1",
")",
"{",
"v... | Model representing the result of matrix factorization.
Note: If you create the model directly using constructor, please be aware that fast prediction
requires cached user/product features and their associated partitioners.
@param rank Rank for the features in this model.
@param userFeatures RDD of tuples where each t... | [
"Model",
"representing",
"the",
"result",
"of",
"matrix",
"factorization",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/recommendation/MatrixFactorizationModel.js#L44-L55 | train | |
EclairJS/eclairjs | client/lib/utils.js | handleArguments | 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 | 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... | [
"function",
"handleArguments",
"(",
"args",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"requires",
"=",
"[",
"]",
";",
"var",
"promises",
"=",
"[",
"]",
";",
"// check for Promises in args",
"if",... | Returns a promise that resolves once all the arguments have been resolved. | [
"Returns",
"a",
"promise",
"that",
"resolves",
"once",
"all",
"the",
"arguments",
"have",
"been",
"resolved",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/client/lib/utils.js#L535-L635 | train |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/clustering/BisectingKMeans.js | function(jvmObject) {
this.logger = Logger.getLogger("BisectingKMeans_js");
if (!jvmObject) {
jvmObject = new org.apache.spark.mllib.clustering.BisectingKMeans();
}
JavaWrapper.call(this, jvmObject);
} | javascript | function(jvmObject) {
this.logger = Logger.getLogger("BisectingKMeans_js");
if (!jvmObject) {
jvmObject = new org.apache.spark.mllib.clustering.BisectingKMeans();
}
JavaWrapper.call(this, jvmObject);
} | [
"function",
"(",
"jvmObject",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"BisectingKMeans_js\"",
")",
";",
"if",
"(",
"!",
"jvmObject",
")",
"{",
"jvmObject",
"=",
"new",
"org",
".",
"apache",
".",
"spark",
".",
"mllib",
"... | A bisecting k-means algorithm based on the paper "A comparison of document clustering techniques"
by Steinbach, Karypis, and Kumar, with modification to fit Spark.
The algorithm starts from a single cluster that contains all points.
Iteratively it finds divisible clusters on the bottom level and bisects each of them us... | [
"A",
"bisecting",
"k",
"-",
"means",
"algorithm",
"based",
"on",
"the",
"paper",
"A",
"comparison",
"of",
"document",
"clustering",
"techniques",
"by",
"Steinbach",
"Karypis",
"and",
"Kumar",
"with",
"modification",
"to",
"fit",
"Spark",
".",
"The",
"algorithm... | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/clustering/BisectingKMeans.js#L52-L60 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/ml/param/ParamMap.js | 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 | function (jvmObject) {
this.logger = Logger.getLogger("ml_param_ParamMap_js");
if (!jvmObject) {
jvmObject = new org.apache.spark.ml.param.ParamMap();
}
JavaWrapper.call(this, jvmObject);
} | [
"function",
"(",
"jvmObject",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"ml_param_ParamMap_js\"",
")",
";",
"if",
"(",
"!",
"jvmObject",
")",
"{",
"jvmObject",
"=",
"new",
"org",
".",
"apache",
".",
"spark",
".",
"ml",
".... | A param to value map.
@classdesc
Creates an empty param map.
@class
@memberof module:eclairjs/ml/param | [
"A",
"param",
"to",
"value",
"map",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/ml/param/ParamMap.js#L31-L39 | train | |
EclairJS/eclairjs | server/examples/mllib/lbfgs_example.js | run | 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 | 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... | [
"function",
"run",
"(",
"sc",
")",
"{",
"var",
"LogisticRegressionModel",
"=",
"require",
"(",
"'eclairjs/mllib/classification'",
")",
".",
"LogisticRegressionModel",
";",
"var",
"LabeledPoint",
"=",
"require",
"(",
"\"eclairjs/mllib/regression/LabeledPoint\"",
")",
";"... | This needs to be in global scope, as it is used in LAMBDA function | [
"This",
"needs",
"to",
"be",
"in",
"global",
"scope",
"as",
"it",
"is",
"used",
"in",
"LAMBDA",
"function"
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/examples/mllib/lbfgs_example.js#L24-L106 | train |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/evaluation/BinaryClassificationMetrics.js | 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 | 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... | [
"function",
"(",
"scoreAndLabels",
",",
"numBins",
")",
"{",
"var",
"jvmObject",
";",
"if",
"(",
"scoreAndLabels",
"instanceof",
"org",
".",
"apache",
".",
"spark",
".",
"mllib",
".",
"evaluation",
".",
"BinaryClassificationMetrics",
")",
"{",
"jvmObject",
"="... | Evaluator for binary classification.
@param scoreAndLabels an RDD of (score, label) pairs.
@param numBins if greater than 0, then the curves (ROC curve, PR curve) computed internally
will be down-sampled to this many "bins". If 0, no down-sampling will occur.
This is useful because the curve contains a point for each ... | [
"Evaluator",
"for",
"binary",
"classification",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/evaluation/BinaryClassificationMetrics.js#L50-L61 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/tree/model/GradientBoostedTreesModel.js | 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 | 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... | [
"function",
"(",
"algo",
",",
"trees",
",",
"treeWeights",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"GradientBoostedTreesModel_js\"",
")",
";",
"var",
"jvmObject",
";",
"if",
"(",
"arguments",
"[",
"0",
"]",
"instanceof",
"o... | Represents a gradient boosted trees model.
@param algo algorithm for the ensemble model, either Classification or Regression
@param trees tree ensembles
@param treeWeights tree ensemble weights
@classdesc
@param {Algo} algo
@param {module:eclairjs/mllib/tree/model.DecisionTreeModel[]} trees
@param {number[]} treeWei... | [
"Represents",
"a",
"gradient",
"boosted",
"trees",
"model",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/tree/model/GradientBoostedTreesModel.js#L40-L53 | train | |
EclairJS/eclairjs | server/src/main/resources/eclairjs/sql/execution/QueryExecution.js | 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 | 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... | [
"function",
"(",
"sqlContext",
",",
"logical",
")",
"{",
"var",
"jvmObject",
";",
"if",
"(",
"arguments",
"[",
"0",
"]",
"instanceof",
"org",
".",
"apache",
".",
"spark",
".",
"sql",
".",
"execution",
".",
"QueryExecution",
")",
"{",
"var",
"jvmObject",
... | The primary workflow for executing relational queries using Spark. Designed to allow easy
access to the intermediate phases of query execution for developers.
While this is not a public class, we should avoid changing the function names for the sake of
changing them, because a lot of developers use the feature for de... | [
"The",
"primary",
"workflow",
"for",
"executing",
"relational",
"queries",
"using",
"Spark",
".",
"Designed",
"to",
"allow",
"easy",
"access",
"to",
"the",
"intermediate",
"phases",
"of",
"query",
"execution",
"for",
"developers",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/sql/execution/QueryExecution.js#L40-L50 | train | |
EclairJS/eclairjs | server/examples/mllib/lr_example.js | run | 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 | 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) {
... | [
"function",
"run",
"(",
"sc",
")",
"{",
"var",
"lines",
"=",
"sc",
".",
"textFile",
"(",
"directory",
")",
";",
"var",
"points",
"=",
"lines",
".",
"map",
"(",
"function",
"(",
"line",
",",
"LabeledPoint",
",",
"Vectors",
")",
"{",
"var",
"parts",
... | Logistic regression based classification using ML Lib. | [
"Logistic",
"regression",
"based",
"classification",
"using",
"ML",
"Lib",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/examples/mllib/lr_example.js#L34-L63 | train |
EclairJS/eclairjs | server/src/main/resources/eclairjs/mllib/tree/DecisionTree.js | 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 | 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... | [
"function",
"(",
"strategy",
")",
"{",
"this",
".",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"DecisionTree_js\"",
")",
";",
"var",
"jvmObject",
";",
"if",
"(",
"strategy",
"instanceof",
"Strategy",
")",
"{",
"jvmObject",
"=",
"new",
"org",
".",
... | A class which implements a decision tree learning algorithm for classification and regression.
It supports both continuous and categorical features.
@param strategy The configuration parameters for the tree algorithm which specify the type
of algorithm (classification, regression, etc.), feature type (continuous,
categ... | [
"A",
"class",
"which",
"implements",
"a",
"decision",
"tree",
"learning",
"algorithm",
"for",
"classification",
"and",
"regression",
".",
"It",
"supports",
"both",
"continuous",
"and",
"categorical",
"features",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/server/src/main/resources/eclairjs/mllib/tree/DecisionTree.js#L35-L48 | train | |
EclairJS/eclairjs | client/lib/index.js | EclairJS | 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 | 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... | [
"function",
"EclairJS",
"(",
"sessionName",
")",
"{",
"if",
"(",
"sessionName",
"&&",
"EJSCache",
"[",
"sessionName",
"]",
")",
"{",
"console",
".",
"log",
"(",
"\"got hit\"",
")",
"return",
"EJSCache",
"[",
"sessionName",
"]",
".",
"ejs",
";",
"}",
"els... | eclairjs module.
@example
var eclairjs = require('eclairjs');
@module eclairjs | [
"eclairjs",
"module",
"."
] | 336368b99f17674a2f86914abbfa5f3000bd028f | https://github.com/EclairJS/eclairjs/blob/336368b99f17674a2f86914abbfa5f3000bd028f/client/lib/index.js#L31-L82 | train |
mu29/react-radio-buttons | lib/index.js | componentWillReceiveProps | 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 | 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... | [
"function",
"componentWillReceiveProps",
"(",
"nextProps",
")",
"{",
"var",
"children",
"=",
"this",
".",
"props",
".",
"children",
";",
"var",
"index",
"=",
"children",
".",
"findIndex",
"(",
"function",
"(",
"c",
")",
"{",
"return",
"c",
".",
"props",
... | This is the case to handle late arriving props, and set the state according to the value as long as it's not disabled | [
"This",
"is",
"the",
"case",
"to",
"handle",
"late",
"arriving",
"props",
"and",
"set",
"the",
"state",
"according",
"to",
"the",
"value",
"as",
"long",
"as",
"it",
"s",
"not",
"disabled"
] | 6abd72a52d47e091597d687d8366477f25a3909c | https://github.com/mu29/react-radio-buttons/blob/6abd72a52d47e091597d687d8366477f25a3909c/lib/index.js#L76-L84 | train |
andig/fritzapi | index.js | executeCommand | 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 | 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);
} | [
"function",
"executeCommand",
"(",
"sid",
",",
"command",
",",
"ain",
",",
"options",
",",
"path",
")",
"{",
"path",
"=",
"path",
"||",
"'/webservices/homeautoswitch.lua?0=0'",
";",
"if",
"(",
"sid",
")",
"path",
"+=",
"'&sid='",
"+",
"sid",
";",
"if",
"... | Execute Fritz API command for device specified by AIN | [
"Execute",
"Fritz",
"API",
"command",
"for",
"device",
"specified",
"by",
"AIN"
] | 33d11eabd51c39bb0c1f409ab640dca93d77d173 | https://github.com/andig/fritzapi/blob/33d11eabd51c39bb0c1f409ab640dca93d77d173/index.js#L258-L270 | train |
andig/fritzapi | example.js | sequence | function sequence(promises) {
var result = Promise.resolve();
promises.forEach(function(promise,i) {
result = result.then(promise);
});
return result;
} | javascript | function sequence(promises) {
var result = Promise.resolve();
promises.forEach(function(promise,i) {
result = result.then(promise);
});
return result;
} | [
"function",
"sequence",
"(",
"promises",
")",
"{",
"var",
"result",
"=",
"Promise",
".",
"resolve",
"(",
")",
";",
"promises",
".",
"forEach",
"(",
"function",
"(",
"promise",
",",
"i",
")",
"{",
"result",
"=",
"result",
".",
"then",
"(",
"promise",
... | utility function to sequentialize promises | [
"utility",
"function",
"to",
"sequentialize",
"promises"
] | 33d11eabd51c39bb0c1f409ab640dca93d77d173 | https://github.com/andig/fritzapi/blob/33d11eabd51c39bb0c1f409ab640dca93d77d173/example.js#L16-L22 | train |
andig/fritzapi | example.js | switches | 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 | 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) {
... | [
"function",
"switches",
"(",
")",
"{",
"return",
"fritz",
".",
"getSwitchList",
"(",
")",
".",
"then",
"(",
"function",
"(",
"switches",
")",
"{",
"console",
".",
"log",
"(",
"\"Switches: \"",
"+",
"switches",
"+",
"\"\\n\"",
")",
";",
"return",
"sequenc... | display switch information | [
"display",
"switch",
"information"
] | 33d11eabd51c39bb0c1f409ab640dca93d77d173 | https://github.com/andig/fritzapi/blob/33d11eabd51c39bb0c1f409ab640dca93d77d173/example.js#L32-L64 | train |
andig/fritzapi | example.js | function() {
return fritz.getDevice(thermostat).then(function(device) {
console.log("[" + thermostat + "] " + device.name);
});
} | javascript | function() {
return fritz.getDevice(thermostat).then(function(device) {
console.log("[" + thermostat + "] " + device.name);
});
} | [
"function",
"(",
")",
"{",
"return",
"fritz",
".",
"getDevice",
"(",
"thermostat",
")",
".",
"then",
"(",
"function",
"(",
"device",
")",
"{",
"console",
".",
"log",
"(",
"\"[\"",
"+",
"thermostat",
"+",
"\"] \"",
"+",
"device",
".",
"name",
")",
";"... | there is no native getThermostatName function- use getDevice instead | [
"there",
"is",
"no",
"native",
"getThermostatName",
"function",
"-",
"use",
"getDevice",
"instead"
] | 33d11eabd51c39bb0c1f409ab640dca93d77d173 | https://github.com/andig/fritzapi/blob/33d11eabd51c39bb0c1f409ab640dca93d77d173/example.js#L75-L79 | train | |
andig/fritzapi | example.js | debug | function debug() {
return fritz.getDeviceList().then(function(devices) {
console.log("Raw devices\n");
console.log(devices);
});
} | javascript | function debug() {
return fritz.getDeviceList().then(function(devices) {
console.log("Raw devices\n");
console.log(devices);
});
} | [
"function",
"debug",
"(",
")",
"{",
"return",
"fritz",
".",
"getDeviceList",
"(",
")",
".",
"then",
"(",
"function",
"(",
"devices",
")",
"{",
"console",
".",
"log",
"(",
"\"Raw devices\\n\"",
")",
";",
"console",
".",
"log",
"(",
"devices",
")",
";",
... | display debug information | [
"display",
"debug",
"information"
] | 33d11eabd51c39bb0c1f409ab640dca93d77d173 | https://github.com/andig/fritzapi/blob/33d11eabd51c39bb0c1f409ab640dca93d77d173/example.js#L99-L104 | train |
lorenwest/node-monitor | lib/probes/ReplProbe.js | 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 | 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])|([_])... | [
"function",
"(",
"params",
",",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
";",
"if",
"(",
"typeof",
"(",
"params",
")",
"!==",
"'string'",
"||",
"params",
".",
"length",
"<",
"1",
")",
"{",
"callback",
"(",
"\"Autocomplete paramter must be a nonzero s... | Process an autocomplete request from the client
@method autocomplete
@param {Object} params Named parameters
@param {Function(error, returnParams)} callback Callback function | [
"Process",
"an",
"autocomplete",
"request",
"from",
"the",
"client"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/probes/ReplProbe.js#L106-L119 | train | |
lorenwest/node-monitor | lib/probes/ReplProbe.js | 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 | 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);
} | [
"function",
"(",
"params",
",",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
";",
"if",
"(",
"params",
"===",
"'.break'",
"&&",
"t",
".",
"shellCmd",
")",
"{",
"t",
".",
"shellCmd",
".",
"kill",
"(",
")",
";",
"}",
"if",
"(",
"NEW_REPL",
")",
... | Handle user input from the console line
@method input
@param {Object} params Named parameters
@param {Function(error, returnParams)} callback Callback function | [
"Handle",
"user",
"input",
"from",
"the",
"console",
"line"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/probes/ReplProbe.js#L128-L139 | train | |
lorenwest/node-monitor | lib/probes/ReplProbe.js | 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 | 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;
... | [
"function",
"(",
"command",
")",
"{",
"var",
"t",
"=",
"this",
";",
"t",
".",
"shellCmd",
"=",
"ChildProcess",
".",
"exec",
"(",
"command",
",",
"function",
"(",
"err",
",",
"stdout",
",",
"stderr",
")",
"{",
"if",
"(",
"err",
")",
"{",
"var",
"o... | Run a shell command and emit the output to the browser.
@private
@method _runShellCmd
@param {String} command - The shell command to invoke | [
"Run",
"a",
"shell",
"command",
"and",
"emit",
"the",
"output",
"to",
"the",
"browser",
"."
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/probes/ReplProbe.js#L160-L184 | train | |
lorenwest/node-monitor | lib/probes/ReplProbe.js | function(probe){
var t = this;
t.probe = probe;
events.EventEmitter.call(t);
if (t.setEncoding) {
t.setEncoding('utf8');
}
} | javascript | function(probe){
var t = this;
t.probe = probe;
events.EventEmitter.call(t);
if (t.setEncoding) {
t.setEncoding('utf8');
}
} | [
"function",
"(",
"probe",
")",
"{",
"var",
"t",
"=",
"this",
";",
"t",
".",
"probe",
"=",
"probe",
";",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"t",
")",
";",
"if",
"(",
"t",
".",
"setEncoding",
")",
"{",
"t",
".",
"setEncoding",
"(",
... | Define an internal stream class for the probe | [
"Define",
"an",
"internal",
"stream",
"class",
"for",
"the",
"probe"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/probes/ReplProbe.js#L189-L196 | train | |
lorenwest/node-monitor | lib/probes/InspectProbe.js | 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 | 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);
... | [
"function",
"(",
"attrs",
",",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
";",
"// Value is the only thing to set",
"if",
"(",
"typeof",
"attrs",
".",
"value",
"===",
"'undefined'",
")",
"{",
"return",
"callback",
"(",
"{",
"code",
":",
"'NO_VALUE'",
"... | Remotely set the inspected variable's value
@method set_control
@param attrs {Object} Name/Value attributes to set. All must be writable.
@param callback {Function(error)} Called when the attributes are set or error | [
"Remotely",
"set",
"the",
"inspected",
"variable",
"s",
"value"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/probes/InspectProbe.js#L101-L120 | train | |
lorenwest/node-monitor | lib/probes/InspectProbe.js | function() {
var t = this;
if (t.isModel) {
t.value.off('change', t.poll, t);
} else {
PollingProbe.prototype.release.apply(t, arguments);
}
} | javascript | function() {
var t = this;
if (t.isModel) {
t.value.off('change', t.poll, t);
} else {
PollingProbe.prototype.release.apply(t, arguments);
}
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"if",
"(",
"t",
".",
"isModel",
")",
"{",
"t",
".",
"value",
".",
"off",
"(",
"'change'",
",",
"t",
".",
"poll",
",",
"t",
")",
";",
"}",
"else",
"{",
"PollingProbe",
".",
"prototype",
... | Stop watching for change events or polling | [
"Stop",
"watching",
"for",
"change",
"events",
"or",
"polling"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/probes/InspectProbe.js#L123-L130 | train | |
lorenwest/node-monitor | lib/probes/InspectProbe.js | 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 | 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);
} | [
"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 an expression, returning the depth-limited results
@method eval_control
@param expression {String} Expression to evaluate
@param [depth=2] {Integer} Depth of the object to return
@return value {Mixed} Returns the depth-limited value | [
"Evaluate",
"an",
"expression",
"returning",
"the",
"depth",
"-",
"limited",
"results"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/probes/InspectProbe.js#L140-L151 | train | |
lorenwest/node-monitor | lib/probes/InspectProbe.js | 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 | 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});
}
} | [
"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"... | Poll for changes in the evaluation
@method poll | [
"Poll",
"for",
"changes",
"in",
"the",
"evaluation"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/probes/InspectProbe.js#L183-L191 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | 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
... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"hostName",
"=",
"t",
".",
"get",
"(",
"'hostName'",
")",
",",
"hostPort",
"=",
"t",
".",
"get",
"(",
"'hostPort'",
")",
",",
"url",
"=",
"t",
".",
"get",
"(",
"'url'",
")",
";",
"// Buil... | Initiate a connection with a remote server | [
"Initiate",
"a",
"connection",
"with",
"a",
"remote",
"server"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L108-L127 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | function(callback) {
var t = this;
callback = callback || function(){};
var onPong = function() {
t.off('pong', onPong);
callback();
};
t.on('pong', onPong);
t.emit('connection:ping');
} | [
"function",
"(",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
";",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"var",
"onPong",
"=",
"function",
"(",
")",
"{",
"t",
".",
"off",
"(",
"'pong'",
",",
"onPong",
")",
";",... | Ping a remote connection
@method ping
@param callback {Function(error)} Callback when response is returned | [
"Ping",
"a",
"remote",
"connection"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L135-L144 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | 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... | [
"function",
"(",
"reason",
")",
"{",
"var",
"t",
"=",
"this",
",",
"socket",
"=",
"t",
".",
"get",
"(",
"'socket'",
")",
";",
"t",
".",
"connecting",
"=",
"false",
";",
"t",
".",
"connected",
"=",
"false",
";",
"// Only disconnect once.",
"// This meth... | Disconnect from the remote process
This can be called from the underlying transport if it detects a disconnect,
or it can be manually called to force a disconnect.
@method disconnect
@param reason {String} Reason for the disconnect
<strong>Disconnected from a remote monitor process</strong>
This event is emitted a... | [
"Disconnect",
"from",
"the",
"remote",
"process"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L164-L178 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | 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... | [
"function",
"(",
"hostName",
")",
"{",
"var",
"t",
"=",
"this",
",",
"testHost",
"=",
"hostName",
".",
"toLowerCase",
"(",
")",
",",
"myHostName",
"=",
"t",
".",
"get",
"(",
"'hostName'",
")",
",",
"remoteHostName",
"=",
"t",
".",
"get",
"(",
"'remot... | Is this connection with the specified host?
@method isThisHost
@protected
@param hostName {String} The host name to check
@return withHost {Boolean} True if the connection is with this host | [
"Is",
"this",
"connection",
"with",
"the",
"specified",
"host?"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L188-L194 | train | |
lorenwest/node-monitor | lib/Connection.js | function() {
var t = this, socket = t.get('socket');
log.info(t.logId + 'emit', Monitor.deepCopy(arguments, 5));
socket.emit.apply(socket, arguments);
} | javascript | function() {
var t = this, socket = t.get('socket');
log.info(t.logId + 'emit', Monitor.deepCopy(arguments, 5));
socket.emit.apply(socket, arguments);
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"socket",
"=",
"t",
".",
"get",
"(",
"'socket'",
")",
";",
"log",
".",
"info",
"(",
"t",
".",
"logId",
"+",
"'emit'",
",",
"Monitor",
".",
"deepCopy",
"(",
"arguments",
",",
"5",
")",
")"... | Emit the specified message to the socket.
The other side of the connection can handle and respond to the message
using the 'on' method.
@method emit
@protected
@param name {String} The message name to send
@param args... {Mixed} Variable number of arguments to send with the message
@param callback {Function} Called w... | [
"Emit",
"the",
"specified",
"message",
"to",
"the",
"socket",
"."
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L208-L212 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | 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;
... | [
"function",
"(",
"eventName",
",",
"handler",
")",
"{",
"var",
"t",
"=",
"this",
",",
"socket",
"=",
"t",
".",
"get",
"(",
"'socket'",
")",
";",
"t",
".",
"socketEvents",
"=",
"t",
".",
"socketEvents",
"||",
"{",
"}",
";",
"if",
"(",
"t",
".",
... | Bind the specified handler to the remote socket message.
Only a single handler (per message name) can be bound using this method.
@method addEvent
@protected
@param eventName {String} The event name to handle
@param handler {Function (args..., callback)} Called when the message is received.
<ul>
<li>args... {Mixed} A... | [
"Bind",
"the",
"specified",
"handler",
"to",
"the",
"remote",
"socket",
"message",
"."
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L228-L237 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | 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;
} | [
"function",
"(",
"eventName",
")",
"{",
"var",
"t",
"=",
"this",
",",
"socket",
"=",
"t",
".",
"get",
"(",
"'socket'",
")",
";",
"if",
"(",
"t",
".",
"socketEvents",
"&&",
"t",
".",
"socketEvents",
"[",
"eventName",
"]",
")",
"{",
"socket",
".",
... | Remove the specified event from the socket | [
"Remove",
"the",
"specified",
"event",
"from",
"the",
"socket"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L240-L247 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | 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;
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"socket",
"=",
"t",
".",
"get",
"(",
"'socket'",
")",
";",
"for",
"(",
"var",
"event",
"in",
"t",
".",
"socketEvents",
")",
"{",
"socket",
".",
"removeListener",
"(",
"event",
",",
"t",
"."... | Remove all events bound to the socket | [
"Remove",
"all",
"events",
"bound",
"to",
"the",
"socket"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L250-L257 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | 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... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"socket",
"=",
"t",
".",
"get",
"(",
"'socket'",
")",
";",
"if",
"(",
"t",
".",
"socketEvents",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Already connected'",
")",
";",
"}",
"t",
".",
"sock... | An error has occurred on the connection
This event is triggered when an error occurs on the connection. Errors
may occur when network is unstable, and can be an indication of impending
disconnection.
@event error
@param err {Object} Reason for the error (from underlying transport) | [
"An",
"error",
"has",
"occurred",
"on",
"the",
"connection"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L269-L326 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | 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)... | [
"function",
"(",
"monitorJSON",
",",
"callback",
")",
"{",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"var",
"t",
"=",
"this",
",",
"errorText",
"=",
"''",
",",
"router",
"=",
"Monitor",
".",
"getRouter",
"(",
")",
",",
... | Process an inbound request to connect with a probe
This will fail if this connection was created as a firewall.
@method probeConnect
@protected
@param monitorJSON {Object} Probe connection parameters, including:
@param monitorJSON.probeClass {String} The probe class
@param monitorJSON.initParams {Object} Probe initia... | [
"Process",
"an",
"inbound",
"request",
"to",
"connect",
"with",
"a",
"probe"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L342-L422 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | 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,
... | [
"function",
"(",
"params",
",",
"callback",
")",
"{",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"var",
"t",
"=",
"this",
",",
"errorText",
"=",
"''",
",",
"router",
"=",
"Monitor",
".",
"getRouter",
"(",
")",
",",
"pro... | Process an inbound request to disconnect with a probe
@method probeDisconnect
@protected
@param params {Object} Disconnect parameters, including:
probeId {String} The unique probe id
@param callback {Function(error)} Callback function | [
"Process",
"an",
"inbound",
"request",
"to",
"disconnect",
"with",
"a",
"probe"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L433-L478 | train | |
lorenwest/node-monitor | lib/Connection.js | 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 | 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... | [
"function",
"(",
"params",
",",
"callback",
")",
"{",
"callback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"var",
"t",
"=",
"this",
",",
"errorText",
"=",
"''",
",",
"logId",
"=",
"t",
".",
"logId",
"+",
"'probeControl'",
",",
"s... | Process an inbound control request to a probe
@method probeControl
@protected
@param params {Object} Control parameters, including:
probeId {String} The unique probe id
name {String} The control message name
params {Object} Any control message parameters
@param callback {Function(error, returnParams)} Callback functio... | [
"Process",
"an",
"inbound",
"control",
"request",
"to",
"a",
"probe"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/lib/Connection.js#L491-L541 | train | |
lorenwest/node-monitor | dist/monitor-all.js | 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 | 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... | [
"function",
"(",
"name",
",",
"callback",
",",
"context",
")",
"{",
"if",
"(",
"!",
"(",
"eventsApi",
"(",
"this",
",",
"'on'",
",",
"name",
",",
"[",
"callback",
",",
"context",
"]",
")",
"&&",
"callback",
")",
")",
"return",
"this",
";",
"this",
... | Bind one or more space separated events, or an events map, to a `callback` function. Passing `"all"` will bind the callback to all events fired. | [
"Bind",
"one",
"or",
"more",
"space",
"separated",
"events",
"or",
"an",
"events",
"map",
"to",
"a",
"callback",
"function",
".",
"Passing",
"all",
"will",
"bind",
"the",
"callback",
"to",
"all",
"events",
"fired",
"."
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/dist/monitor-all.js#L1350-L1356 | train | |
lorenwest/node-monitor | dist/monitor-all.js | 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 | 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... | [
"function",
"(",
"loud",
")",
"{",
"this",
".",
"changed",
"=",
"{",
"}",
";",
"var",
"already",
"=",
"{",
"}",
";",
"var",
"triggers",
"=",
"[",
"]",
";",
"var",
"current",
"=",
"this",
".",
"_currentAttributes",
";",
"var",
"changes",
"=",
"this"... | Looking at the built up list of `set` attribute changes, compute how many of the attributes have actually changed. If `loud`, return a boiled-down list of only the real changes. | [
"Looking",
"at",
"the",
"built",
"up",
"list",
"of",
"set",
"attribute",
"changes",
"compute",
"how",
"many",
"of",
"the",
"attributes",
"have",
"actually",
"changed",
".",
"If",
"loud",
"return",
"a",
"boiled",
"-",
"down",
"list",
"of",
"only",
"the",
... | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/dist/monitor-all.js#L1755-L1783 | train | |
lorenwest/node-monitor | dist/monitor-all.js | 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 | 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... | [
"function",
"(",
"models",
",",
"options",
")",
"{",
"var",
"model",
",",
"i",
",",
"l",
",",
"existing",
";",
"var",
"add",
"=",
"[",
"]",
",",
"remove",
"=",
"[",
"]",
",",
"modelMap",
"=",
"{",
"}",
";",
"var",
"idAttr",
"=",
"this",
".",
... | Smartly update a collection with a change set of models, adding, removing, and merging as necessary. | [
"Smartly",
"update",
"a",
"collection",
"with",
"a",
"change",
"set",
"of",
"models",
"adding",
"removing",
"and",
"merging",
"as",
"necessary",
"."
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/dist/monitor-all.js#L2010-L2043 | train | |
lorenwest/node-monitor | dist/monitor-all.js | 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 | 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... | [
"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 callba... | Anonymous callback style interface for Backbone.js async methods.
Load this after Backbone.js to add an anonymous function callback style
interface for fetch(), save(), and destroy() in addition to the built-in
success/error style interface.
This adds a shim to the existing interface, allowing either style to be
used... | [
"Anonymous",
"callback",
"style",
"interface",
"for",
"Backbone",
".",
"js",
"async",
"methods",
"."
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/dist/monitor-all.js#L2802-L2838 | train | |
lorenwest/node-monitor | dist/monitor-all.js | 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 | 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... | [
"function",
"(",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
",",
"startTime",
"=",
"Date",
".",
"now",
"(",
")",
";",
"Monitor",
".",
"getRouter",
"(",
")",
".",
"connectMonitor",
"(",
"t",
",",
"function",
"(",
"error",
")",
"{",
"// Monitor cha... | Connect the monitor to the remote probe
Upon connection, the monitor data model is a proxy of the current state
of the probe.
@method connect
@param callback {Function(error)} Called when the probe is connected (or error)
The monitor has successfully connected with the probe
@event connect | [
"Connect",
"the",
"monitor",
"to",
"the",
"remote",
"probe"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/dist/monitor-all.js#L6889-L6917 | train | |
lorenwest/node-monitor | dist/monitor-all.js | function() {
var t = this;
return (t.probe && t.probe.connection ? t.probe.connection : null);
} | javascript | function() {
var t = this;
return (t.probe && t.probe.connection ? t.probe.connection : null);
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
";",
"return",
"(",
"t",
".",
"probe",
"&&",
"t",
".",
"probe",
".",
"connection",
"?",
"t",
".",
"probe",
".",
"connection",
":",
"null",
")",
";",
"}"
] | Get the connection to the remote probe
This method returns the Connection object that represents the remote
server used for communicating with the connected probe.
If the probe is running internally or the monitor isn't currently
connected, this will return null.
@method getConnection
@return connection {Connection}... | [
"Get",
"the",
"connection",
"to",
"the",
"remote",
"probe"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/dist/monitor-all.js#L6931-L6934 | train | |
lorenwest/node-monitor | dist/monitor-all.js | 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 | 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... | [
"function",
"(",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
",",
"reason",
"=",
"'manual_disconnect'",
",",
"startTime",
"=",
"Date",
".",
"now",
"(",
")",
",",
"probeId",
"=",
"t",
".",
"get",
"(",
"'probeId'",
")",
";",
"// Stop forwarding changes ... | Disconnect from the remote probe
This should be called when the monitor is no longer needed.
It releases resources associated with monitoring the probe.
If this was the last object monitoring the probe, the probe will be
stopped, releasing resources associated with running the probe.
@method disconnect
@param callba... | [
"Disconnect",
"from",
"the",
"remote",
"probe"
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/dist/monitor-all.js#L6969-L6990 | train | |
lorenwest/node-monitor | dist/monitor-all.js | 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 | 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 === '*'... | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"this",
",",
"writableAttributes",
"=",
"t",
".",
"get",
"(",
"'writableAttributes'",
")",
",",
"writableChanges",
"=",
"{",
"}",
";",
"// Add any writable changes",
"var",
"probeAttrs",
"=",
"t",
".",
"toProbeJSON... | Forward changes on to the probe, when connected.
This is called whenever a change trigger is fired. It forwards any
changes of writable attributes onto the probe using control('set'). | [
"Forward",
"changes",
"on",
"to",
"the",
"probe",
"when",
"connected",
"."
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/dist/monitor-all.js#L6998-L7021 | train | |
lorenwest/node-monitor | dist/monitor-all.js | 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 | 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;
... | [
"function",
"(",
"name",
",",
"params",
",",
"callback",
")",
"{",
"var",
"t",
"=",
"this",
",",
"probe",
"=",
"t",
".",
"probe",
",",
"logId",
"=",
"'control.'",
"+",
"t",
".",
"get",
"(",
"'probeClass'",
")",
"+",
"'.'",
"+",
"name",
",",
"star... | Send a control message to the probe.
Monitors can use this method to send a message and receive a response
from a connected probe.
The probe must implement the specified control method. All probes are
derived from the base <a href="Probe.html">Probe</a> class, which offers
a ping control.
To send a ping message to ... | [
"Send",
"a",
"control",
"message",
"to",
"the",
"probe",
"."
] | 7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8 | https://github.com/lorenwest/node-monitor/blob/7afd5d22c1d44b93c7cb2250ea9e05ef7b8451f8/dist/monitor-all.js#L7046-L7084 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.