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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
neyric/webhookit | public/javascripts/codemirror/js/editor.js | makeWhiteSpace | function makeWhiteSpace(n) {
var buffer = [], nb = true;
for (; n > 0; n--) {
buffer.push((nb || n == 1) ? nbsp : " ");
nb = !nb;
}
return buffer.join("");
} | javascript | function makeWhiteSpace(n) {
var buffer = [], nb = true;
for (; n > 0; n--) {
buffer.push((nb || n == 1) ? nbsp : " ");
nb = !nb;
}
return buffer.join("");
} | [
"function",
"makeWhiteSpace",
"(",
"n",
")",
"{",
"var",
"buffer",
"=",
"[",
"]",
",",
"nb",
"=",
"true",
";",
"for",
"(",
";",
"n",
">",
"0",
";",
"n",
"--",
")",
"{",
"buffer",
".",
"push",
"(",
"(",
"nb",
"||",
"n",
"==",
"1",
")",
"?",
... | Make sure a string does not contain two consecutive 'collapseable' whitespace characters. | [
"Make",
"sure",
"a",
"string",
"does",
"not",
"contain",
"two",
"consecutive",
"collapseable",
"whitespace",
"characters",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L14-L21 | train |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | fixSpaces | function fixSpaces(string) {
if (string.charAt(0) == " ") string = nbsp + string.slice(1);
return string.replace(/\t/g, function(){return makeWhiteSpace(indentUnit);})
.replace(/[ \u00a0]{2,}/g, function(s) {return makeWhiteSpace(s.length);});
} | javascript | function fixSpaces(string) {
if (string.charAt(0) == " ") string = nbsp + string.slice(1);
return string.replace(/\t/g, function(){return makeWhiteSpace(indentUnit);})
.replace(/[ \u00a0]{2,}/g, function(s) {return makeWhiteSpace(s.length);});
} | [
"function",
"fixSpaces",
"(",
"string",
")",
"{",
"if",
"(",
"string",
".",
"charAt",
"(",
"0",
")",
"==",
"\" \"",
")",
"string",
"=",
"nbsp",
"+",
"string",
".",
"slice",
"(",
"1",
")",
";",
"return",
"string",
".",
"replace",
"(",
"/",
"\\t",
... | Create a set of white-space characters that will not be collapsed by the browser, but will not break text-wrapping either. | [
"Create",
"a",
"set",
"of",
"white",
"-",
"space",
"characters",
"that",
"will",
"not",
"be",
"collapsed",
"by",
"the",
"browser",
"but",
"will",
"not",
"break",
"text",
"-",
"wrapping",
"either",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L25-L29 | train |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | makePartSpan | function makePartSpan(value, doc) {
var text = value;
if (value.nodeType == 3) text = value.nodeValue;
else value = doc.createTextNode(text);
var span = doc.createElement("SPAN");
span.isPart = true;
span.appendChild(value);
span.currentText = text;
return span;
} | javascript | function makePartSpan(value, doc) {
var text = value;
if (value.nodeType == 3) text = value.nodeValue;
else value = doc.createTextNode(text);
var span = doc.createElement("SPAN");
span.isPart = true;
span.appendChild(value);
span.currentText = text;
return span;
} | [
"function",
"makePartSpan",
"(",
"value",
",",
"doc",
")",
"{",
"var",
"text",
"=",
"value",
";",
"if",
"(",
"value",
".",
"nodeType",
"==",
"3",
")",
"text",
"=",
"value",
".",
"nodeValue",
";",
"else",
"value",
"=",
"doc",
".",
"createTextNode",
"(... | Create a SPAN node with the expected properties for document part spans. | [
"Create",
"a",
"SPAN",
"node",
"with",
"the",
"expected",
"properties",
"for",
"document",
"part",
"spans",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L37-L47 | train |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | pointAt | function pointAt(node){
var parent = node.parentNode;
var next = node.nextSibling;
return function(newnode) {
parent.insertBefore(newnode, next);
};
} | javascript | function pointAt(node){
var parent = node.parentNode;
var next = node.nextSibling;
return function(newnode) {
parent.insertBefore(newnode, next);
};
} | [
"function",
"pointAt",
"(",
"node",
")",
"{",
"var",
"parent",
"=",
"node",
".",
"parentNode",
";",
"var",
"next",
"=",
"node",
".",
"nextSibling",
";",
"return",
"function",
"(",
"newnode",
")",
"{",
"parent",
".",
"insertBefore",
"(",
"newnode",
",",
... | Create a function that can be used to insert nodes after the one given as argument. | [
"Create",
"a",
"function",
"that",
"can",
"be",
"used",
"to",
"insert",
"nodes",
"after",
"the",
"one",
"given",
"as",
"argument",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L123-L129 | train |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | writeNode | function writeNode(node, c, end) {
var toYield = [];
forEach(simplifyDOM(node, end), function(part) {
toYield.push(insertPart(part));
});
return yield(toYield.join(""), c);
} | javascript | function writeNode(node, c, end) {
var toYield = [];
forEach(simplifyDOM(node, end), function(part) {
toYield.push(insertPart(part));
});
return yield(toYield.join(""), c);
} | [
"function",
"writeNode",
"(",
"node",
",",
"c",
",",
"end",
")",
"{",
"var",
"toYield",
"=",
"[",
"]",
";",
"forEach",
"(",
"simplifyDOM",
"(",
"node",
",",
"end",
")",
",",
"function",
"(",
"part",
")",
"{",
"toYield",
".",
"push",
"(",
"insertPar... | Extract the text and newlines from a DOM node, insert them into the document, and yield the textual content. Used to replace non-normalized nodes. | [
"Extract",
"the",
"text",
"and",
"newlines",
"from",
"a",
"DOM",
"node",
"insert",
"them",
"into",
"the",
"document",
"and",
"yield",
"the",
"textual",
"content",
".",
"Used",
"to",
"replace",
"non",
"-",
"normalized",
"nodes",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L165-L171 | train |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
var line = cleanText(self.history.textAfter(self.line).slice(self.offset));
var match = (self.caseFold ? line.toLowerCase() : line).indexOf(string);
if (match > -1)
return {from: {node: self.line, offset: self.offset + match},
to: {node: self.line, offset... | javascript | function() {
var line = cleanText(self.history.textAfter(self.line).slice(self.offset));
var match = (self.caseFold ? line.toLowerCase() : line).indexOf(string);
if (match > -1)
return {from: {node: self.line, offset: self.offset + match},
to: {node: self.line, offset... | [
"function",
"(",
")",
"{",
"var",
"line",
"=",
"cleanText",
"(",
"self",
".",
"history",
".",
"textAfter",
"(",
"self",
".",
"line",
")",
".",
"slice",
"(",
"self",
".",
"offset",
")",
")",
";",
"var",
"match",
"=",
"(",
"self",
".",
"caseFold",
... | For one-line strings, searching can be done simply by calling indexOf on the current line. | [
"For",
"one",
"-",
"line",
"strings",
"searching",
"can",
"be",
"done",
"simply",
"by",
"calling",
"indexOf",
"on",
"the",
"current",
"line",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L273-L279 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
var firstLine = cleanText(self.history.textAfter(self.line).slice(self.offset));
var match = (self.caseFold ? firstLine.toLowerCase() : firstLine).lastIndexOf(target[0]);
if (match == -1 || match != firstLine.length - target[0].length)
return false;
var startOffset... | javascript | function() {
var firstLine = cleanText(self.history.textAfter(self.line).slice(self.offset));
var match = (self.caseFold ? firstLine.toLowerCase() : firstLine).lastIndexOf(target[0]);
if (match == -1 || match != firstLine.length - target[0].length)
return false;
var startOffset... | [
"function",
"(",
")",
"{",
"var",
"firstLine",
"=",
"cleanText",
"(",
"self",
".",
"history",
".",
"textAfter",
"(",
"self",
".",
"line",
")",
".",
"slice",
"(",
"self",
".",
"offset",
")",
")",
";",
"var",
"match",
"=",
"(",
"self",
".",
"caseFold... | Multi-line strings require internal iteration over lines, and some clunky checks to make sure the first match ends at the end of the line and the last match starts at the start. | [
"Multi",
"-",
"line",
"strings",
"require",
"internal",
"iteration",
"over",
"lines",
"and",
"some",
"clunky",
"checks",
"to",
"make",
"sure",
"the",
"first",
"match",
"ends",
"at",
"the",
"end",
"of",
"the",
"line",
"and",
"the",
"last",
"match",
"starts"... | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L283-L304 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | saveAfter | function saveAfter(pos) {
if (self.history.textAfter(pos.node).length > pos.offset) {
self.line = pos.node;
self.offset = pos.offset + 1;
}
else {
self.line = self.history.nodeAfter(pos.node);
self.offset = 0;
}
} | javascript | function saveAfter(pos) {
if (self.history.textAfter(pos.node).length > pos.offset) {
self.line = pos.node;
self.offset = pos.offset + 1;
}
else {
self.line = self.history.nodeAfter(pos.node);
self.offset = 0;
}
} | [
"function",
"saveAfter",
"(",
"pos",
")",
"{",
"if",
"(",
"self",
".",
"history",
".",
"textAfter",
"(",
"pos",
".",
"node",
")",
".",
"length",
">",
"pos",
".",
"offset",
")",
"{",
"self",
".",
"line",
"=",
"pos",
".",
"node",
";",
"self",
".",
... | Set the cursor's position one character after the given position. | [
"Set",
"the",
"cursor",
"s",
"position",
"one",
"character",
"after",
"the",
"given",
"position",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L322-L331 | train |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
if (!this.container.firstChild)
return "";
var accum = [];
select.markSelection(this.win);
forEach(traverseDOM(this.container.firstChild), method(accum, "push"));
webkitLastLineHack(this.container);
select.selectMarked();
return cleanText(accum.join(""));
... | javascript | function() {
if (!this.container.firstChild)
return "";
var accum = [];
select.markSelection(this.win);
forEach(traverseDOM(this.container.firstChild), method(accum, "push"));
webkitLastLineHack(this.container);
select.selectMarked();
return cleanText(accum.join(""));
... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"container",
".",
"firstChild",
")",
"return",
"\"\"",
";",
"var",
"accum",
"=",
"[",
"]",
";",
"select",
".",
"markSelection",
"(",
"this",
".",
"win",
")",
";",
"forEach",
"(",
"traverseDOM",
... | Extract the code from the editor. | [
"Extract",
"the",
"code",
"from",
"the",
"editor",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L472-L482 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
var h = this.history;
h.commit();
var start = select.cursorPos(this.container, true),
end = select.cursorPos(this.container, false);
if (!start || !end) return "";
if (start.node == end.node)
return h.textAfter(start.node).slice(start.offset, end.offset);
... | javascript | function() {
var h = this.history;
h.commit();
var start = select.cursorPos(this.container, true),
end = select.cursorPos(this.container, false);
if (!start || !end) return "";
if (start.node == end.node)
return h.textAfter(start.node).slice(start.offset, end.offset);
... | [
"function",
"(",
")",
"{",
"var",
"h",
"=",
"this",
".",
"history",
";",
"h",
".",
"commit",
"(",
")",
";",
"var",
"start",
"=",
"select",
".",
"cursorPos",
"(",
"this",
".",
"container",
",",
"true",
")",
",",
"end",
"=",
"select",
".",
"cursorP... | Retrieve the selected text. | [
"Retrieve",
"the",
"selected",
"text",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L589-L605 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(text) {
this.history.commit();
var start = select.cursorPos(this.container, true),
end = select.cursorPos(this.container, false);
if (!start || !end) return;
end = this.replaceRange(start, end, text);
select.setCursorPos(this.container, end);
webkitLastLineHack(t... | javascript | function(text) {
this.history.commit();
var start = select.cursorPos(this.container, true),
end = select.cursorPos(this.container, false);
if (!start || !end) return;
end = this.replaceRange(start, end, text);
select.setCursorPos(this.container, end);
webkitLastLineHack(t... | [
"function",
"(",
"text",
")",
"{",
"this",
".",
"history",
".",
"commit",
"(",
")",
";",
"var",
"start",
"=",
"select",
".",
"cursorPos",
"(",
"this",
".",
"container",
",",
"true",
")",
",",
"end",
"=",
"select",
".",
"cursorPos",
"(",
"this",
"."... | Replace the selection with another piece of text. | [
"Replace",
"the",
"selection",
"with",
"another",
"piece",
"of",
"text",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L608-L618 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(event) {
var electric = Editor.Parser.electricChars, self = this;
// Hack for Opera, and Firefox on OS X, in which stopping a
// keydown event does not prevent the associated keypress event
// from happening, so we have to cancel enter and tab again
// here.
if ((this.frozen... | javascript | function(event) {
var electric = Editor.Parser.electricChars, self = this;
// Hack for Opera, and Firefox on OS X, in which stopping a
// keydown event does not prevent the associated keypress event
// from happening, so we have to cancel enter and tab again
// here.
if ((this.frozen... | [
"function",
"(",
"event",
")",
"{",
"var",
"electric",
"=",
"Editor",
".",
"Parser",
".",
"electricChars",
",",
"self",
"=",
"this",
";",
"// Hack for Opera, and Firefox on OS X, in which stopping a",
"// keydown event does not prevent the associated keypress event",
"// from... | Check for characters that should re-indent the current line, and prevent Opera from handling enter and tab anyway. | [
"Check",
"for",
"characters",
"that",
"should",
"re",
"-",
"indent",
"the",
"current",
"line",
"and",
"prevent",
"Opera",
"from",
"handling",
"enter",
"and",
"tab",
"anyway",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L781-L796 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
var pos = select.selectionTopNode(this.container, true);
var to = select.selectionTopNode(this.container, false);
if (pos === false || to === false) return;
select.markSelection(this.win);
if (this.highlight(pos, endOfLine(to, this.container), true, 20) === false)
ret... | javascript | function() {
var pos = select.selectionTopNode(this.container, true);
var to = select.selectionTopNode(this.container, false);
if (pos === false || to === false) return;
select.markSelection(this.win);
if (this.highlight(pos, endOfLine(to, this.container), true, 20) === false)
ret... | [
"function",
"(",
")",
"{",
"var",
"pos",
"=",
"select",
".",
"selectionTopNode",
"(",
"this",
".",
"container",
",",
"true",
")",
";",
"var",
"to",
"=",
"select",
".",
"selectionTopNode",
"(",
"this",
".",
"container",
",",
"false",
")",
";",
"if",
"... | Re-highlight the selected part of the document. | [
"Re",
"-",
"highlight",
"the",
"selected",
"part",
"of",
"the",
"document",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L865-L875 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
var cur = select.selectionTopNode(this.container, true), start = cur;
if (cur === false || !(!cur || cur.isPart || isBR(cur)) || !this.container.firstChild)
return false;
while (cur && !isBR(cur)) cur = cur.previousSibling;
var next = cur ? cur.nextSibling : this.container.... | javascript | function() {
var cur = select.selectionTopNode(this.container, true), start = cur;
if (cur === false || !(!cur || cur.isPart || isBR(cur)) || !this.container.firstChild)
return false;
while (cur && !isBR(cur)) cur = cur.previousSibling;
var next = cur ? cur.nextSibling : this.container.... | [
"function",
"(",
")",
"{",
"var",
"cur",
"=",
"select",
".",
"selectionTopNode",
"(",
"this",
".",
"container",
",",
"true",
")",
",",
"start",
"=",
"cur",
";",
"if",
"(",
"cur",
"===",
"false",
"||",
"!",
"(",
"!",
"cur",
"||",
"cur",
".",
"isPa... | Custom home behaviour that doesn't land the cursor in front of leading whitespace unless pressed twice. | [
"Custom",
"home",
"behaviour",
"that",
"doesn",
"t",
"land",
"the",
"cursor",
"in",
"front",
"of",
"leading",
"whitespace",
"unless",
"pressed",
"twice",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L889-L903 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | highlight | function highlight(node, ok) {
if (!node) return;
if (self.options.markParen) {
self.options.markParen(node, ok);
}
else {
node.style.fontWeight = "bold";
node.style.color = ok ? "#8F8" : "#F88";
}
} | javascript | function highlight(node, ok) {
if (!node) return;
if (self.options.markParen) {
self.options.markParen(node, ok);
}
else {
node.style.fontWeight = "bold";
node.style.color = ok ? "#8F8" : "#F88";
}
} | [
"function",
"highlight",
"(",
"node",
",",
"ok",
")",
"{",
"if",
"(",
"!",
"node",
")",
"return",
";",
"if",
"(",
"self",
".",
"options",
".",
"markParen",
")",
"{",
"self",
".",
"options",
".",
"markParen",
"(",
"node",
",",
"ok",
")",
";",
"}",... | give the relevant nodes a colour. | [
"give",
"the",
"relevant",
"nodes",
"a",
"colour",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L931-L940 | train |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | paren | function paren(node) {
if (node.currentText) {
var match = node.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/);
return match && match[1];
}
} | javascript | function paren(node) {
if (node.currentText) {
var match = node.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/);
return match && match[1];
}
} | [
"function",
"paren",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"currentText",
")",
"{",
"var",
"match",
"=",
"node",
".",
"currentText",
".",
"match",
"(",
"/",
"^[\\s\\u00a0]*([\\(\\)\\[\\]{}])[\\s\\u00a0]*$",
"/",
")",
";",
"return",
"match",
"&&",
... | Extract a 'paren' from a piece of text. | [
"Extract",
"a",
"paren",
"from",
"a",
"piece",
"of",
"text",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L962-L967 | train |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | tryFindMatch | function tryFindMatch() {
var stack = [], ch, ok = true;;
for (var runner = cursor; runner; runner = dir ? runner.nextSibling : runner.previousSibling) {
if (runner.className == className && isSpan(runner) && (ch = paren(runner))) {
if (forward(ch) == dir)
stack.push(... | javascript | function tryFindMatch() {
var stack = [], ch, ok = true;;
for (var runner = cursor; runner; runner = dir ? runner.nextSibling : runner.previousSibling) {
if (runner.className == className && isSpan(runner) && (ch = paren(runner))) {
if (forward(ch) == dir)
stack.push(... | [
"function",
"tryFindMatch",
"(",
")",
"{",
"var",
"stack",
"=",
"[",
"]",
",",
"ch",
",",
"ok",
"=",
"true",
";",
";",
"for",
"(",
"var",
"runner",
"=",
"cursor",
";",
"runner",
";",
"runner",
"=",
"dir",
"?",
"runner",
".",
"nextSibling",
":",
"... | Since parts of the document might not have been properly highlighted, and it is hard to know in advance which part we have to scan, we just try, and when we find dirty nodes we abort, parse them, and re-try. | [
"Since",
"parts",
"of",
"the",
"document",
"might",
"not",
"have",
"been",
"properly",
"highlighted",
"and",
"it",
"is",
"hard",
"to",
"know",
"in",
"advance",
"which",
"part",
"we",
"have",
"to",
"scan",
"we",
"just",
"try",
"and",
"when",
"we",
"find",... | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L985-L1002 | train |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(direction) {
if (!this.container.firstChild) return;
// The line has to have up-to-date lexical information, so we
// highlight it first.
if (!this.highlightAtCursor()) return;
var cursor = select.selectionTopNode(this.container, false);
// If we couldn't determine the place... | javascript | function(direction) {
if (!this.container.firstChild) return;
// The line has to have up-to-date lexical information, so we
// highlight it first.
if (!this.highlightAtCursor()) return;
var cursor = select.selectionTopNode(this.container, false);
// If we couldn't determine the place... | [
"function",
"(",
"direction",
")",
"{",
"if",
"(",
"!",
"this",
".",
"container",
".",
"firstChild",
")",
"return",
";",
"// The line has to have up-to-date lexical information, so we",
"// highlight it first.",
"if",
"(",
"!",
"this",
".",
"highlightAtCursor",
"(",
... | Adjust the amount of whitespace at the start of the line that the cursor is on so that it is indented properly. | [
"Adjust",
"the",
"amount",
"of",
"whitespace",
"at",
"the",
"start",
"of",
"the",
"line",
"that",
"the",
"cursor",
"is",
"on",
"so",
"that",
"it",
"is",
"indented",
"properly",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1029-L1046 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(start, end, direction) {
var current = (start = startOfLine(start)), before = start && startOfLine(start.previousSibling);
if (!isBR(end)) end = endOfLine(end, this.container);
this.addDirtyNode(start);
do {
var next = endOfLine(current, this.container);
if (current) th... | javascript | function(start, end, direction) {
var current = (start = startOfLine(start)), before = start && startOfLine(start.previousSibling);
if (!isBR(end)) end = endOfLine(end, this.container);
this.addDirtyNode(start);
do {
var next = endOfLine(current, this.container);
if (current) th... | [
"function",
"(",
"start",
",",
"end",
",",
"direction",
")",
"{",
"var",
"current",
"=",
"(",
"start",
"=",
"startOfLine",
"(",
"start",
")",
")",
",",
"before",
"=",
"start",
"&&",
"startOfLine",
"(",
"start",
".",
"previousSibling",
")",
";",
"if",
... | Indent all lines whose start falls inside of the current selection. | [
"Indent",
"all",
"lines",
"whose",
"start",
"falls",
"inside",
"of",
"the",
"current",
"selection",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1050-L1063 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(safe) {
// pagehide event hack above
if (this.unloaded) {
this.win.document.designMode = "off";
this.win.document.designMode = "on";
this.unloaded = false;
}
if (internetExplorer) {
this.container.createTextRange().execCommand("unlink");
this.sel... | javascript | function(safe) {
// pagehide event hack above
if (this.unloaded) {
this.win.document.designMode = "off";
this.win.document.designMode = "on";
this.unloaded = false;
}
if (internetExplorer) {
this.container.createTextRange().execCommand("unlink");
this.sel... | [
"function",
"(",
"safe",
")",
"{",
"// pagehide event hack above",
"if",
"(",
"this",
".",
"unloaded",
")",
"{",
"this",
".",
"win",
".",
"document",
".",
"designMode",
"=",
"\"off\"",
";",
"this",
".",
"win",
".",
"document",
".",
"designMode",
"=",
"\"... | Find the node that the cursor is in, mark it as dirty, and make sure a highlight pass is scheduled. | [
"Find",
"the",
"node",
"that",
"the",
"cursor",
"is",
"in",
"mark",
"it",
"as",
"dirty",
"and",
"make",
"sure",
"a",
"highlight",
"pass",
"is",
"scheduled",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1067-L1091 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(node) {
node = node || this.container.firstChild;
if (!node) return;
for (var i = 0; i < this.dirty.length; i++)
if (this.dirty[i] == node) return;
if (node.nodeType != 3)
node.dirty = true;
this.dirty.push(node);
} | javascript | function(node) {
node = node || this.container.firstChild;
if (!node) return;
for (var i = 0; i < this.dirty.length; i++)
if (this.dirty[i] == node) return;
if (node.nodeType != 3)
node.dirty = true;
this.dirty.push(node);
} | [
"function",
"(",
"node",
")",
"{",
"node",
"=",
"node",
"||",
"this",
".",
"container",
".",
"firstChild",
";",
"if",
"(",
"!",
"node",
")",
"return",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"dirty",
".",
"length",
";... | Add a node to the set of dirty nodes, if it isn't already in there. | [
"Add",
"a",
"node",
"to",
"the",
"set",
"of",
"dirty",
"nodes",
"if",
"it",
"isn",
"t",
"already",
"in",
"there",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1101-L1111 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
// Timeouts are routed through the parent window, because on
// some browsers designMode windows do not fire timeouts.
var self = this;
this.parent.clearTimeout(this.highlightTimeout);
this.highlightTimeout = this.parent.setTimeout(function(){self.highlightDirty();}, this.opti... | javascript | function() {
// Timeouts are routed through the parent window, because on
// some browsers designMode windows do not fire timeouts.
var self = this;
this.parent.clearTimeout(this.highlightTimeout);
this.highlightTimeout = this.parent.setTimeout(function(){self.highlightDirty();}, this.opti... | [
"function",
"(",
")",
"{",
"// Timeouts are routed through the parent window, because on",
"// some browsers designMode windows do not fire timeouts.",
"var",
"self",
"=",
"this",
";",
"this",
".",
"parent",
".",
"clearTimeout",
"(",
"this",
".",
"highlightTimeout",
")",
";... | Cause a highlight pass to happen in options.passDelay milliseconds. Clear the existing timeout, if one exists. This way, the passes do not happen while the user is typing, and should as unobtrusive as possible. | [
"Cause",
"a",
"highlight",
"pass",
"to",
"happen",
"in",
"options",
".",
"passDelay",
"milliseconds",
".",
"Clear",
"the",
"existing",
"timeout",
"if",
"one",
"exists",
".",
"This",
"way",
"the",
"passes",
"do",
"not",
"happen",
"while",
"the",
"user",
"is... | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1121-L1127 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
while (this.dirty.length > 0) {
var found = this.dirty.pop();
// IE8 sometimes throws an unexplainable 'invalid argument'
// exception for found.parentNode
try {
// If the node has been coloured in the meantime, or is no
// longer in the document, i... | javascript | function() {
while (this.dirty.length > 0) {
var found = this.dirty.pop();
// IE8 sometimes throws an unexplainable 'invalid argument'
// exception for found.parentNode
try {
// If the node has been coloured in the meantime, or is no
// longer in the document, i... | [
"function",
"(",
")",
"{",
"while",
"(",
"this",
".",
"dirty",
".",
"length",
">",
"0",
")",
"{",
"var",
"found",
"=",
"this",
".",
"dirty",
".",
"pop",
"(",
")",
";",
"// IE8 sometimes throws an unexplainable 'invalid argument'",
"// exception for found.parentN... | Fetch one dirty node, and remove it from the dirty set. | [
"Fetch",
"one",
"dirty",
"node",
"and",
"remove",
"it",
"from",
"the",
"dirty",
"set",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1130-L1145 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(force) {
// Prevent FF from raising an error when it is firing timeouts
// on a page that's no longer loaded.
if (!window.select) return;
if (!this.options.readOnly) select.markSelection(this.win);
var start, endTime = force ? null : time() + this.options.passTime;
while ((... | javascript | function(force) {
// Prevent FF from raising an error when it is firing timeouts
// on a page that's no longer loaded.
if (!window.select) return;
if (!this.options.readOnly) select.markSelection(this.win);
var start, endTime = force ? null : time() + this.options.passTime;
while ((... | [
"function",
"(",
"force",
")",
"{",
"// Prevent FF from raising an error when it is firing timeouts",
"// on a page that's no longer loaded.",
"if",
"(",
"!",
"window",
".",
"select",
")",
"return",
";",
"if",
"(",
"!",
"this",
".",
"options",
".",
"readOnly",
")",
... | Pick dirty nodes, and highlight them, until options.passTime milliseconds have gone by. The highlight method will continue to next lines as long as it finds dirty nodes. It returns information about the place where it stopped. If there are dirty nodes left after this function has spent all its lines, it shedules anothe... | [
"Pick",
"dirty",
"nodes",
"and",
"highlight",
"them",
"until",
"options",
".",
"passTime",
"milliseconds",
"have",
"gone",
"by",
".",
"The",
"highlight",
"method",
"will",
"continue",
"to",
"next",
"lines",
"as",
"long",
"as",
"it",
"finds",
"dirty",
"nodes"... | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1153-L1168 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(passTime) {
var self = this, pos = null;
return function() {
// FF timeout weirdness workaround.
if (!window.select) return;
// If the current node is no longer in the document... oh
// well, we start over.
if (pos && pos.parentNode != self.container)
... | javascript | function(passTime) {
var self = this, pos = null;
return function() {
// FF timeout weirdness workaround.
if (!window.select) return;
// If the current node is no longer in the document... oh
// well, we start over.
if (pos && pos.parentNode != self.container)
... | [
"function",
"(",
"passTime",
")",
"{",
"var",
"self",
"=",
"this",
",",
"pos",
"=",
"null",
";",
"return",
"function",
"(",
")",
"{",
"// FF timeout weirdness workaround.",
"if",
"(",
"!",
"window",
".",
"select",
")",
"return",
";",
"// If the current node ... | Creates a function that, when called through a timeout, will continuously re-parse the document. | [
"Creates",
"a",
"function",
"that",
"when",
"called",
"through",
"a",
"timeout",
"will",
"continuously",
"re",
"-",
"parse",
"the",
"document",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1172-L1188 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function() {
if (this.scanner) {
this.parent.clearTimeout(this.documentScan);
this.documentScan = this.parent.setTimeout(this.scanner, this.options.continuousScanning);
}
} | javascript | function() {
if (this.scanner) {
this.parent.clearTimeout(this.documentScan);
this.documentScan = this.parent.setTimeout(this.scanner, this.options.continuousScanning);
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"scanner",
")",
"{",
"this",
".",
"parent",
".",
"clearTimeout",
"(",
"this",
".",
"documentScan",
")",
";",
"this",
".",
"documentScan",
"=",
"this",
".",
"parent",
".",
"setTimeout",
"(",
"this",
"... | Starts the continuous scanning process for this document after a given interval. | [
"Starts",
"the",
"continuous",
"scanning",
"process",
"for",
"this",
"document",
"after",
"a",
"given",
"interval",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1192-L1197 | train | |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | tokenPart | function tokenPart(token){
var part = makePartSpan(token.value, self.doc);
part.className = token.style;
return part;
} | javascript | function tokenPart(token){
var part = makePartSpan(token.value, self.doc);
part.className = token.style;
return part;
} | [
"function",
"tokenPart",
"(",
"token",
")",
"{",
"var",
"part",
"=",
"makePartSpan",
"(",
"token",
".",
"value",
",",
"self",
".",
"doc",
")",
";",
"part",
".",
"className",
"=",
"token",
".",
"style",
";",
"return",
"part",
";",
"}"
] | Create a part corresponding to a given token. | [
"Create",
"a",
"part",
"corresponding",
"to",
"a",
"given",
"token",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1246-L1250 | train |
neyric/webhookit | public/javascripts/codemirror/js/editor.js | function(){
var part = this.get();
// Allow empty nodes when they are alone on a line, needed
// for the FF cursor bug workaround (see select.js,
// insertNewlineAtCursor).
while (part && isSpan(part) && part.currentText == "") {
// Leave empty nodes that ar... | javascript | function(){
var part = this.get();
// Allow empty nodes when they are alone on a line, needed
// for the FF cursor bug workaround (see select.js,
// insertNewlineAtCursor).
while (part && isSpan(part) && part.currentText == "") {
// Leave empty nodes that ar... | [
"function",
"(",
")",
"{",
"var",
"part",
"=",
"this",
".",
"get",
"(",
")",
";",
"// Allow empty nodes when they are alone on a line, needed",
"// for the FF cursor bug workaround (see select.js,",
"// insertNewlineAtCursor).",
"while",
"(",
"part",
"&&",
"isSpan",
"(",
... | Advance to the next part that is not empty, discarding empty parts. | [
"Advance",
"to",
"the",
"next",
"part",
"that",
"is",
"not",
"empty",
"discarding",
"empty",
"parts",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/codemirror/js/editor.js#L1304-L1327 | train | |
neyric/webhookit | public/javascripts/WireIt/plugins/layout/js/Layout.js | function() {
this.nodes = [];
this.edges = [];
// Extract wires
for(var i = 0 ; i < this.layer.wires.length ; i++) {
var wire = this.layer.wires[i];
this.edges.push([this.layer.containers.indexOf(wire.terminal1.container), this.layer.containers.indexOf(wire.terminal2.container) ]);
}
} | javascript | function() {
this.nodes = [];
this.edges = [];
// Extract wires
for(var i = 0 ; i < this.layer.wires.length ; i++) {
var wire = this.layer.wires[i];
this.edges.push([this.layer.containers.indexOf(wire.terminal1.container), this.layer.containers.indexOf(wire.terminal2.container) ]);
}
} | [
"function",
"(",
")",
"{",
"this",
".",
"nodes",
"=",
"[",
"]",
";",
"this",
".",
"edges",
"=",
"[",
"]",
";",
"// Extract wires",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"layer",
".",
"wires",
".",
"length",
";",
"i",
"... | Init the default structure | [
"Init",
"the",
"default",
"structure"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/layout/js/Layout.js#L99-L110 | train | |
neyric/webhookit | public/javascripts/inputex/js/fields/IPv4Field.js | function(options) {
inputEx.IPv4Field.superclass.setOptions.call(this, options);
this.options.messages.invalid = inputEx.messages.invalidIPv4;
this.options.regexp = /^(?:1\d?\d?|2(?:[0-4]\d?|[6789]|5[0-5]?)?|[3-9]\d?|0)(?:\.(?:1\d?\d?|2(?:[0-4]\d?|[6789]|5[0-5]?)?|[3-9]\d?|0)){3}$/;
} | javascript | function(options) {
inputEx.IPv4Field.superclass.setOptions.call(this, options);
this.options.messages.invalid = inputEx.messages.invalidIPv4;
this.options.regexp = /^(?:1\d?\d?|2(?:[0-4]\d?|[6789]|5[0-5]?)?|[3-9]\d?|0)(?:\.(?:1\d?\d?|2(?:[0-4]\d?|[6789]|5[0-5]?)?|[3-9]\d?|0)){3}$/;
} | [
"function",
"(",
"options",
")",
"{",
"inputEx",
".",
"IPv4Field",
".",
"superclass",
".",
"setOptions",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"options",
".",
"messages",
".",
"invalid",
"=",
"inputEx",
".",
"messages",
".",
... | set IPv4 regexp and invalid string
@param {Object} options Options object as passed to the constructor | [
"set",
"IPv4",
"regexp",
"and",
"invalid",
"string"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/IPv4Field.js#L19-L23 | train | |
neyric/webhookit | public/javascripts/yui/calendar/calendar-debug.js | function(id, container, config) {
// Normalize 2.4.0, pre 2.4.0 args
var nArgs = this._parseArgs(arguments);
id = nArgs.id;
container = nArgs.container;
config = nArgs.config;
this.oDomContainer = Dom.get(container);
if (!this.oDomContainer) { this.logger.log("... | javascript | function(id, container, config) {
// Normalize 2.4.0, pre 2.4.0 args
var nArgs = this._parseArgs(arguments);
id = nArgs.id;
container = nArgs.container;
config = nArgs.config;
this.oDomContainer = Dom.get(container);
if (!this.oDomContainer) { this.logger.log("... | [
"function",
"(",
"id",
",",
"container",
",",
"config",
")",
"{",
"// Normalize 2.4.0, pre 2.4.0 args",
"var",
"nArgs",
"=",
"this",
".",
"_parseArgs",
"(",
"arguments",
")",
";",
"id",
"=",
"nArgs",
".",
"id",
";",
"container",
"=",
"nArgs",
".",
"contain... | Initializes the calendar group. All subclasses must call this method in order for the
group to be initialized properly.
@method init
@param {String} id optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.
@param {String | HTMLElement} container The i... | [
"Initializes",
"the",
"calendar",
"group",
".",
"All",
"subclasses",
"must",
"call",
"this",
"method",
"in",
"order",
"for",
"the",
"group",
"to",
"be",
"initialized",
"properly",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/calendar/calendar-debug.js#L4712-L4795 | train | |
neyric/webhookit | public/javascripts/inputex/js/fields/TreeField.js | function() {
// Add element button
this.addButton = inputEx.cn('img', {src: inputEx.spacerUrl, className: 'inputEx-ListField-addButton'});
Dom.setStyle(this.addButton, 'float', 'left');
this.fieldContainer.appendChild(this.addButton);
// Instanciate the new subField
this.su... | javascript | function() {
// Add element button
this.addButton = inputEx.cn('img', {src: inputEx.spacerUrl, className: 'inputEx-ListField-addButton'});
Dom.setStyle(this.addButton, 'float', 'left');
this.fieldContainer.appendChild(this.addButton);
// Instanciate the new subField
this.su... | [
"function",
"(",
")",
"{",
"// Add element button",
"this",
".",
"addButton",
"=",
"inputEx",
".",
"cn",
"(",
"'img'",
",",
"{",
"src",
":",
"inputEx",
".",
"spacerUrl",
",",
"className",
":",
"'inputEx-ListField-addButton'",
"}",
")",
";",
"Dom",
".",
"se... | Render the addButton and childContainer | [
"Render",
"the",
"addButton",
"and",
"childContainer"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/TreeField.js#L53-L75 | train | |
neyric/webhookit | public/javascripts/WireIt/plugins/composable/examples/jsBox/jsBox.js | function() {
jsBox.WiringEditor.superclass.renderButtons.call(this);
// Add the run button to the toolbar
var toolbar = YAHOO.util.Dom.get('toolbar');
var runButton = new YAHOO.widget.Button({ label:"Run", id:"WiringEditor-runButton", container: toolbar });
runButton.on("click", jsBox.run, js... | javascript | function() {
jsBox.WiringEditor.superclass.renderButtons.call(this);
// Add the run button to the toolbar
var toolbar = YAHOO.util.Dom.get('toolbar');
var runButton = new YAHOO.widget.Button({ label:"Run", id:"WiringEditor-runButton", container: toolbar });
runButton.on("click", jsBox.run, js... | [
"function",
"(",
")",
"{",
"jsBox",
".",
"WiringEditor",
".",
"superclass",
".",
"renderButtons",
".",
"call",
"(",
"this",
")",
";",
"// Add the run button to the toolbar",
"var",
"toolbar",
"=",
"YAHOO",
".",
"util",
".",
"Dom",
".",
"get",
"(",
"'toolbar'... | Add the "run" button | [
"Add",
"the",
"run",
"button"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/WireIt/plugins/composable/examples/jsBox/jsBox.js#L98-L105 | train | |
neyric/webhookit | public/javascripts/yui/menu/menu-debug.js | function (p_sType, p_aArgs, p_oItem) {
var sText = p_aArgs[0],
oConfig = this.cfg,
oAnchor = this._oAnchor,
sHelpText = oConfig.getProperty(_HELP_TEXT),
sHelpTextHTML = _EMPTY_STRING,
sEmphasisStartTag = _EMPTY_STRING,
sEmphasisEndTag = _E... | javascript | function (p_sType, p_aArgs, p_oItem) {
var sText = p_aArgs[0],
oConfig = this.cfg,
oAnchor = this._oAnchor,
sHelpText = oConfig.getProperty(_HELP_TEXT),
sHelpTextHTML = _EMPTY_STRING,
sEmphasisStartTag = _EMPTY_STRING,
sEmphasisEndTag = _E... | [
"function",
"(",
"p_sType",
",",
"p_aArgs",
",",
"p_oItem",
")",
"{",
"var",
"sText",
"=",
"p_aArgs",
"[",
"0",
"]",
",",
"oConfig",
"=",
"this",
".",
"cfg",
",",
"oAnchor",
"=",
"this",
".",
"_oAnchor",
",",
"sHelpText",
"=",
"oConfig",
".",
"getPro... | Event handlers for configuration properties
@method configText
@description Event handler for when the "text" configuration property of
the menu item changes.
@param {String} p_sType String representing the name of the event that
was fired.
@param {Array} p_aArgs Array of arguments sent when the event was fired.
@para... | [
"Event",
"handlers",
"for",
"configuration",
"properties"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/menu/menu-debug.js#L7361-L7402 | train | |
neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function() {
// Remove from DOM
if(Dom.inDocument(this.el)) {
this.el.parentNode.removeChild(this.el);
}
// recursively purge element
Event.purgeElement(this.el, true);
} | javascript | function() {
// Remove from DOM
if(Dom.inDocument(this.el)) {
this.el.parentNode.removeChild(this.el);
}
// recursively purge element
Event.purgeElement(this.el, true);
} | [
"function",
"(",
")",
"{",
"// Remove from DOM",
"if",
"(",
"Dom",
".",
"inDocument",
"(",
"this",
".",
"el",
")",
")",
"{",
"this",
".",
"el",
".",
"parentNode",
".",
"removeChild",
"(",
"this",
".",
"el",
")",
";",
"}",
"// recursively purge element",
... | Destroy the widget | [
"Destroy",
"the",
"widget"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L35-L44 | train | |
neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function(obj,parentEl) {
var ul = inputEx.cn('ul', {className: 'inputEx-JsonTreeInspector'});
for(var key in obj) {
if(obj.hasOwnProperty(key)) {
var value = obj[key];
var id = Dom.generateId();
var li = inputEx.cn('li', {id: id}, null,... | javascript | function(obj,parentEl) {
var ul = inputEx.cn('ul', {className: 'inputEx-JsonTreeInspector'});
for(var key in obj) {
if(obj.hasOwnProperty(key)) {
var value = obj[key];
var id = Dom.generateId();
var li = inputEx.cn('li', {id: id}, null,... | [
"function",
"(",
"obj",
",",
"parentEl",
")",
"{",
"var",
"ul",
"=",
"inputEx",
".",
"cn",
"(",
"'ul'",
",",
"{",
"className",
":",
"'inputEx-JsonTreeInspector'",
"}",
")",
";",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
"."... | Build the sub-branch for obj | [
"Build",
"the",
"sub",
"-",
"branch",
"for",
"obj"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L49-L93 | train | |
neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function(e, params) {
Event.stopEvent(e);
var tgt = Event.getTarget(e);
if( Dom.hasClass(tgt, 'expanded') || Dom.hasClass(tgt, 'collapsed') ) {
this.expandElement(tgt);
}
} | javascript | function(e, params) {
Event.stopEvent(e);
var tgt = Event.getTarget(e);
if( Dom.hasClass(tgt, 'expanded') || Dom.hasClass(tgt, 'collapsed') ) {
this.expandElement(tgt);
}
} | [
"function",
"(",
"e",
",",
"params",
")",
"{",
"Event",
".",
"stopEvent",
"(",
"e",
")",
";",
"var",
"tgt",
"=",
"Event",
".",
"getTarget",
"(",
"e",
")",
";",
"if",
"(",
"Dom",
".",
"hasClass",
"(",
"tgt",
",",
"'expanded'",
")",
"||",
"Dom",
... | When the user click on a node | [
"When",
"the",
"user",
"click",
"on",
"a",
"node"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L99-L106 | train | |
neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function(li) {
var isExpanded = Dom.hasClass(li, 'expanded');
Dom.replaceClass(li, isExpanded ? 'expanded' : 'collapsed' , isExpanded ? 'collapsed':'expanded');
var h = this.hash[li.id];
if(isExpanded) {
// hide the sub-branch
h.expanded.style.display = 'none';
}... | javascript | function(li) {
var isExpanded = Dom.hasClass(li, 'expanded');
Dom.replaceClass(li, isExpanded ? 'expanded' : 'collapsed' , isExpanded ? 'collapsed':'expanded');
var h = this.hash[li.id];
if(isExpanded) {
// hide the sub-branch
h.expanded.style.display = 'none';
}... | [
"function",
"(",
"li",
")",
"{",
"var",
"isExpanded",
"=",
"Dom",
".",
"hasClass",
"(",
"li",
",",
"'expanded'",
")",
";",
"Dom",
".",
"replaceClass",
"(",
"li",
",",
"isExpanded",
"?",
"'expanded'",
":",
"'collapsed'",
",",
"isExpanded",
"?",
"'collapse... | expand the node given the li element | [
"expand",
"the",
"node",
"given",
"the",
"li",
"element"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L112-L131 | train | |
neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function(li,maxLevel) {
this.expandElement(li);
var sub = Dom.getChildrenBy(li, function(c) {return c.tagName == "UL";})[0].childNodes;
for(var j = 0 ; j < sub.length ; j++) {
var s = sub[j];
if(Dom.hasClass(s,"collapsed") && maxLevel != 0) {
this.expandBranch(s,maxLevel-... | javascript | function(li,maxLevel) {
this.expandElement(li);
var sub = Dom.getChildrenBy(li, function(c) {return c.tagName == "UL";})[0].childNodes;
for(var j = 0 ; j < sub.length ; j++) {
var s = sub[j];
if(Dom.hasClass(s,"collapsed") && maxLevel != 0) {
this.expandBranch(s,maxLevel-... | [
"function",
"(",
"li",
",",
"maxLevel",
")",
"{",
"this",
".",
"expandElement",
"(",
"li",
")",
";",
"var",
"sub",
"=",
"Dom",
".",
"getChildrenBy",
"(",
"li",
",",
"function",
"(",
"c",
")",
"{",
"return",
"c",
".",
"tagName",
"==",
"\"UL\"",
";",... | Expand a branch given a li element
@param {HTMLElement} li
@param {Integer} maxLevel | [
"Expand",
"a",
"branch",
"given",
"a",
"li",
"element"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L138-L147 | train | |
neyric/webhookit | public/javascripts/inputex/js/widgets/json-tree-inspector.js | function(maxLevel) {
var ul = this.el.childNodes[0];
var liEls = ul.childNodes;
for(var i = 0 ; i < liEls.length ; i++) {
var li = liEls[i];
this.expandBranch(li,maxLevel);
}
} | javascript | function(maxLevel) {
var ul = this.el.childNodes[0];
var liEls = ul.childNodes;
for(var i = 0 ; i < liEls.length ; i++) {
var li = liEls[i];
this.expandBranch(li,maxLevel);
}
} | [
"function",
"(",
"maxLevel",
")",
"{",
"var",
"ul",
"=",
"this",
".",
"el",
".",
"childNodes",
"[",
"0",
"]",
";",
"var",
"liEls",
"=",
"ul",
".",
"childNodes",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"liEls",
".",
"length",
";",
... | Expand the root node
@param {Integer} maxLevel | [
"Expand",
"the",
"root",
"node"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/widgets/json-tree-inspector.js#L153-L160 | train | |
neyric/webhookit | public/javascripts/yui/storage/storage.js | function(key) {
Y.log("Fetching item at " + key);
var item = this._getItem(key);
return YL.isValue(item) ? this._getValue(item) : null; // required by HTML 5 spec
} | javascript | function(key) {
Y.log("Fetching item at " + key);
var item = this._getItem(key);
return YL.isValue(item) ? this._getValue(item) : null; // required by HTML 5 spec
} | [
"function",
"(",
"key",
")",
"{",
"Y",
".",
"log",
"(",
"\"Fetching item at \"",
"+",
"key",
")",
";",
"var",
"item",
"=",
"this",
".",
"_getItem",
"(",
"key",
")",
";",
"return",
"YL",
".",
"isValue",
"(",
"item",
")",
"?",
"this",
".",
"_getValu... | Fetches the data stored and the provided key.
@method getItem
@param key {String} Required. The key used to reference this value (DOMString in HTML 5 spec).
@return {String|NULL} The value stored at the provided key (DOMString in HTML 5 spec).
@public | [
"Fetches",
"the",
"data",
"stored",
"and",
"the",
"provided",
"key",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/storage/storage.js#L136-L140 | train | |
neyric/webhookit | public/javascripts/yui/storage/storage.js | function(index) {
Y.log("Fetching key at " + index);
if (YL.isNumber(index) && -1 < index && this.length > index) {
var value = this._key(index);
if (value) {return value;}
}
// this is thrown according to the HTML5 spec
throw('INDEX_SIZE_ERR - Storage.setItem - The provided index (' + index + ... | javascript | function(index) {
Y.log("Fetching key at " + index);
if (YL.isNumber(index) && -1 < index && this.length > index) {
var value = this._key(index);
if (value) {return value;}
}
// this is thrown according to the HTML5 spec
throw('INDEX_SIZE_ERR - Storage.setItem - The provided index (' + index + ... | [
"function",
"(",
"index",
")",
"{",
"Y",
".",
"log",
"(",
"\"Fetching key at \"",
"+",
"index",
")",
";",
"if",
"(",
"YL",
".",
"isNumber",
"(",
"index",
")",
"&&",
"-",
"1",
"<",
"index",
"&&",
"this",
".",
"length",
">",
"index",
")",
"{",
"var... | Retrieve the key stored at the provided index; should be overwritten by storage engine.
@method key
@param index {Number} Required. The index to retrieve (unsigned long in HTML 5 spec).
@return {String} Required. The key at the provided index (DOMString in HTML 5 spec).
@public | [
"Retrieve",
"the",
"key",
"stored",
"at",
"the",
"provided",
"index",
";",
"should",
"be",
"overwritten",
"by",
"storage",
"engine",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/storage/storage.js#L168-L178 | train | |
neyric/webhookit | public/javascripts/yui/storage/storage.js | function(key) {
Y.log("removing " + key);
if (this.hasKey(key)) {
var oldValue = this._getItem(key);
if (! oldValue) {oldValue = null;}
this._removeItem(key);
this.fireEvent(this.CE_CHANGE, new YU.StorageEvent(this, key, oldValue, null, YU.StorageEvent.TYPE_... | javascript | function(key) {
Y.log("removing " + key);
if (this.hasKey(key)) {
var oldValue = this._getItem(key);
if (! oldValue) {oldValue = null;}
this._removeItem(key);
this.fireEvent(this.CE_CHANGE, new YU.StorageEvent(this, key, oldValue, null, YU.StorageEvent.TYPE_... | [
"function",
"(",
"key",
")",
"{",
"Y",
".",
"log",
"(",
"\"removing \"",
"+",
"key",
")",
";",
"if",
"(",
"this",
".",
"hasKey",
"(",
"key",
")",
")",
"{",
"var",
"oldValue",
"=",
"this",
".",
"_getItem",
"(",
"key",
")",
";",
"if",
"(",
"!",
... | Remove an item from the data storage.
@method setItem
@param key {String} Required. The key to remove (DOMString in HTML 5 spec).
@public | [
"Remove",
"an",
"item",
"from",
"the",
"data",
"storage",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/storage/storage.js#L186-L198 | train | |
neyric/webhookit | public/javascripts/yui/storage/storage.js | function(key, data) {
Y.log("SETTING " + data + " to " + key);
if (YL.isString(key)) {
var eventType = this.hasKey(key) ? YU.StorageEvent.TYPE_UPDATE_ITEM : YU.StorageEvent.TYPE_ADD_ITEM,
oldValue = this._getItem(key);
if (! oldValue) {oldValue = null;}
if (this._setItem(key, this._createVal... | javascript | function(key, data) {
Y.log("SETTING " + data + " to " + key);
if (YL.isString(key)) {
var eventType = this.hasKey(key) ? YU.StorageEvent.TYPE_UPDATE_ITEM : YU.StorageEvent.TYPE_ADD_ITEM,
oldValue = this._getItem(key);
if (! oldValue) {oldValue = null;}
if (this._setItem(key, this._createVal... | [
"function",
"(",
"key",
",",
"data",
")",
"{",
"Y",
".",
"log",
"(",
"\"SETTING \"",
"+",
"data",
"+",
"\" to \"",
"+",
"key",
")",
";",
"if",
"(",
"YL",
".",
"isString",
"(",
"key",
")",
")",
"{",
"var",
"eventType",
"=",
"this",
".",
"hasKey",
... | Adds an item to the data storage.
@method setItem
@param key {String} Required. The key used to reference this value (DOMString in HTML 5 spec).
@param data {Object} Required. The data to store at key (DOMString in HTML 5 spec).
@public
@throws QUOTA_EXCEEDED_ERROR | [
"Adds",
"an",
"item",
"to",
"the",
"data",
"storage",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/storage/storage.js#L208-L228 | train | |
neyric/webhookit | public/javascripts/yui/storage/storage.js | function(s) {
var a = s ? s.split(this.DELIMITER) : [];
if (1 == a.length) {return s;}
switch (a[0]) {
case 'boolean': return 'true' === a[1];
case 'number': return parseFloat(a[1]);
case 'null': return null;
default: return a[1];
}
} | javascript | function(s) {
var a = s ? s.split(this.DELIMITER) : [];
if (1 == a.length) {return s;}
switch (a[0]) {
case 'boolean': return 'true' === a[1];
case 'number': return parseFloat(a[1]);
case 'null': return null;
default: return a[1];
}
} | [
"function",
"(",
"s",
")",
"{",
"var",
"a",
"=",
"s",
"?",
"s",
".",
"split",
"(",
"this",
".",
"DELIMITER",
")",
":",
"[",
"]",
";",
"if",
"(",
"1",
"==",
"a",
".",
"length",
")",
"{",
"return",
"s",
";",
"}",
"switch",
"(",
"a",
"[",
"0... | Converts the stored value into its appropriate type.
@method _getValue
@param s {String} Required. The stored value.
@protected | [
"Converts",
"the",
"stored",
"value",
"into",
"its",
"appropriate",
"type",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/storage/storage.js#L269-L279 | train | |
neyric/webhookit | public/javascripts/yui/storage/storage.js | function(engineType, location, conf) {
var _cfg = YL.isObject(conf) ? conf : {},
klass = _getClass(_registeredEngineMap[engineType]);
if (! klass && ! _cfg.force) {
var i, j;
if (_cfg.order) {
j = _cfg.order.length;
for (i = 0; i < j && ! klass; i += 1) {
klass = _getClass(_cfg.orde... | javascript | function(engineType, location, conf) {
var _cfg = YL.isObject(conf) ? conf : {},
klass = _getClass(_registeredEngineMap[engineType]);
if (! klass && ! _cfg.force) {
var i, j;
if (_cfg.order) {
j = _cfg.order.length;
for (i = 0; i < j && ! klass; i += 1) {
klass = _getClass(_cfg.orde... | [
"function",
"(",
"engineType",
",",
"location",
",",
"conf",
")",
"{",
"var",
"_cfg",
"=",
"YL",
".",
"isObject",
"(",
"conf",
")",
"?",
"conf",
":",
"{",
"}",
",",
"klass",
"=",
"_getClass",
"(",
"_registeredEngineMap",
"[",
"engineType",
"]",
")",
... | Fetches the desired engine type or first available engine type.
@method get
@param engineType {String} Optional. The engine type, see engines.
@param location {String} Optional. The storage location - LOCATION_SESSION & LOCATION_LOCAL; default is LOCAL.
@param conf {Object} Optional. Additional configuration for the ge... | [
"Fetches",
"the",
"desired",
"engine",
"type",
"or",
"first",
"available",
"engine",
"type",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/storage/storage.js#L423-L452 | train | |
neyric/webhookit | public/javascripts/yui/storage/storage.js | function(engineConstructor) {
if (YL.isFunction(engineConstructor) && YL.isFunction(engineConstructor.isAvailable) && YL.isString(engineConstructor.ENGINE_NAME)) {
_registeredEngineMap[engineConstructor.ENGINE_NAME] = engineConstructor;
_registeredEngineSet.push(engineConstructor);
return true;
}
... | javascript | function(engineConstructor) {
if (YL.isFunction(engineConstructor) && YL.isFunction(engineConstructor.isAvailable) && YL.isString(engineConstructor.ENGINE_NAME)) {
_registeredEngineMap[engineConstructor.ENGINE_NAME] = engineConstructor;
_registeredEngineSet.push(engineConstructor);
return true;
}
... | [
"function",
"(",
"engineConstructor",
")",
"{",
"if",
"(",
"YL",
".",
"isFunction",
"(",
"engineConstructor",
")",
"&&",
"YL",
".",
"isFunction",
"(",
"engineConstructor",
".",
"isAvailable",
")",
"&&",
"YL",
".",
"isString",
"(",
"engineConstructor",
".",
"... | Registers a engineType Class with the StorageManager singleton; first in is the first out.
@method register
@param engineConstructor {Function} Required. The engine constructor function, see engines.
@return {Boolean} When successfully registered.
@static | [
"Registers",
"a",
"engineType",
"Class",
"with",
"the",
"StorageManager",
"singleton",
";",
"first",
"in",
"is",
"the",
"first",
"out",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/storage/storage.js#L472-L480 | train | |
neyric/webhookit | public/javascripts/yui/storage/storage.js | function(key) {
this._keyMap[key] = this.length;
this._keys.push(key);
this.length = this._keys.length;
} | javascript | function(key) {
this._keyMap[key] = this.length;
this._keys.push(key);
this.length = this._keys.length;
} | [
"function",
"(",
"key",
")",
"{",
"this",
".",
"_keyMap",
"[",
"key",
"]",
"=",
"this",
".",
"length",
";",
"this",
".",
"_keys",
".",
"push",
"(",
"key",
")",
";",
"this",
".",
"length",
"=",
"this",
".",
"_keys",
".",
"length",
";",
"}"
] | Adds the key to the set.
@method _addKey
@param key {String} Required. The key to evaluate.
@protected | [
"Adds",
"the",
"key",
"to",
"the",
"set",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/storage/storage.js#L622-L626 | train | |
neyric/webhookit | public/javascripts/yui/storage/storage.js | function(key) {
var j = this._indexOfKey(key),
rest = this._keys.slice(j + 1);
delete this._keyMap[key];
for (var k in this._keyMap) {
if (j < this._keyMap[k]) {
this._keyMap[k] -= 1;
}
}
this._keys.length = j;
this._keys = this._keys.concat(rest);
this.length = this._keys.le... | javascript | function(key) {
var j = this._indexOfKey(key),
rest = this._keys.slice(j + 1);
delete this._keyMap[key];
for (var k in this._keyMap) {
if (j < this._keyMap[k]) {
this._keyMap[k] -= 1;
}
}
this._keys.length = j;
this._keys = this._keys.concat(rest);
this.length = this._keys.le... | [
"function",
"(",
"key",
")",
"{",
"var",
"j",
"=",
"this",
".",
"_indexOfKey",
"(",
"key",
")",
",",
"rest",
"=",
"this",
".",
"_keys",
".",
"slice",
"(",
"j",
"+",
"1",
")",
";",
"delete",
"this",
".",
"_keyMap",
"[",
"key",
"]",
";",
"for",
... | Removes a key from the keys array.
@method _removeKey
@param key {String} Required. The key to remove.
@protected | [
"Removes",
"a",
"key",
"from",
"the",
"keys",
"array",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/storage/storage.js#L645-L660 | train | |
neyric/webhookit | public/javascripts/yui/slider/slider-debug.js | function() {
this.logger.log("focus");
this.valueChangeSource = Slider.SOURCE_UI_EVENT;
// Focus the background element if possible
var el = this.getEl();
if (el.focus) {
try {
el.focus();
} catch(e) {
// Prevent permissio... | javascript | function() {
this.logger.log("focus");
this.valueChangeSource = Slider.SOURCE_UI_EVENT;
// Focus the background element if possible
var el = this.getEl();
if (el.focus) {
try {
el.focus();
} catch(e) {
// Prevent permissio... | [
"function",
"(",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"focus\"",
")",
";",
"this",
".",
"valueChangeSource",
"=",
"Slider",
".",
"SOURCE_UI_EVENT",
";",
"// Focus the background element if possible",
"var",
"el",
"=",
"this",
".",
"getEl",
"(",
... | Try to focus the element when clicked so we can add
accessibility features
@method focus
@private | [
"Try",
"to",
"focus",
"the",
"element",
"when",
"clicked",
"so",
"we",
"can",
"add",
"accessibility",
"features"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider-debug.js#L603-L624 | train | |
neyric/webhookit | public/javascripts/yui/slider/slider-debug.js | function(source, newOffset, skipAnim, force, silent) {
var t = this.thumb, newX, newY;
if (!t.available) {
this.logger.log("defer setValue until after onAvailble");
this.deferredSetValue = arguments;
return false;
}
if (this.isLocked() && !force) {
... | javascript | function(source, newOffset, skipAnim, force, silent) {
var t = this.thumb, newX, newY;
if (!t.available) {
this.logger.log("defer setValue until after onAvailble");
this.deferredSetValue = arguments;
return false;
}
if (this.isLocked() && !force) {
... | [
"function",
"(",
"source",
",",
"newOffset",
",",
"skipAnim",
",",
"force",
",",
"silent",
")",
"{",
"var",
"t",
"=",
"this",
".",
"thumb",
",",
"newX",
",",
"newY",
";",
"if",
"(",
"!",
"t",
".",
"available",
")",
"{",
"this",
".",
"logger",
"."... | Worker function to execute the value set operation. Accepts type of
set operation in addition to the usual setValue params.
@method _setValue
@param source {int} what triggered the set (e.g. Slider.SOURCE_SET_VALUE)
@param {int} newOffset the number of pixels the thumb should be
positioned away from the initial start... | [
"Worker",
"function",
"to",
"execute",
"the",
"value",
"set",
"operation",
".",
"Accepts",
"type",
"of",
"set",
"operation",
"in",
"addition",
"to",
"the",
"usual",
"setValue",
"params",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider-debug.js#L721-L764 | train | |
neyric/webhookit | public/javascripts/yui/slider/slider-debug.js | function() {
var xy = getXY(this.getEl()),
t = this.thumb;
if (!this.thumbCenterPoint || !this.thumbCenterPoint.x) {
this.setThumbCenterPoint();
}
if (xy) {
this.logger.log("newPos: " + xy);
if (xy[0] != this.baselinePos[0] || xy[1] !... | javascript | function() {
var xy = getXY(this.getEl()),
t = this.thumb;
if (!this.thumbCenterPoint || !this.thumbCenterPoint.x) {
this.setThumbCenterPoint();
}
if (xy) {
this.logger.log("newPos: " + xy);
if (xy[0] != this.baselinePos[0] || xy[1] !... | [
"function",
"(",
")",
"{",
"var",
"xy",
"=",
"getXY",
"(",
"this",
".",
"getEl",
"(",
")",
")",
",",
"t",
"=",
"this",
".",
"thumb",
";",
"if",
"(",
"!",
"this",
".",
"thumbCenterPoint",
"||",
"!",
"this",
".",
"thumbCenterPoint",
".",
"x",
")",
... | Checks the background position element position. If it has moved from the
baseline position, the constraints for the thumb are reset
@method verifyOffset
@return {boolean} True if the offset is the same as the baseline. | [
"Checks",
"the",
"background",
"position",
"element",
"position",
".",
"If",
"it",
"has",
"moved",
"from",
"the",
"baseline",
"position",
"the",
"constraints",
"for",
"the",
"thumb",
"are",
"reset"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider-debug.js#L848-L879 | train | |
neyric/webhookit | public/javascripts/yui/slider/slider-debug.js | function(x, y, skipAnim, midMove) {
var t = this.thumb,
self = this,
p,_p,anim;
if (!t.available) {
this.logger.log("thumb is not available yet, aborting move");
return;
}
this.logger.log("move thumb, x: " + x + ", y: " + y);
t... | javascript | function(x, y, skipAnim, midMove) {
var t = this.thumb,
self = this,
p,_p,anim;
if (!t.available) {
this.logger.log("thumb is not available yet, aborting move");
return;
}
this.logger.log("move thumb, x: " + x + ", y: " + y);
t... | [
"function",
"(",
"x",
",",
"y",
",",
"skipAnim",
",",
"midMove",
")",
"{",
"var",
"t",
"=",
"this",
".",
"thumb",
",",
"self",
"=",
"this",
",",
"p",
",",
"_p",
",",
"anim",
";",
"if",
"(",
"!",
"t",
".",
"available",
")",
"{",
"this",
".",
... | Move the associated slider moved to a timeout to try to get around the
mousedown stealing moz does when I move the slider element between the
cursor and the background during the mouseup event
@method moveThumb
@param {int} x the X coordinate of the click
@param {int} y the Y coordinate of the click
@param {boolean} sk... | [
"Move",
"the",
"associated",
"slider",
"moved",
"to",
"a",
"timeout",
"to",
"try",
"to",
"get",
"around",
"the",
"mousedown",
"stealing",
"moz",
"does",
"when",
"I",
"move",
"the",
"slider",
"element",
"between",
"the",
"cursor",
"and",
"the",
"background",
... | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider-debug.js#L893-L946 | train | |
neyric/webhookit | public/javascripts/yui/slider/slider-debug.js | function(curCoord, finalCoord) {
this.logger.log("getNextX: " + curCoord + ", " + finalCoord);
var t = this.thumb,
thresh,
tmp = [],
nextCoord = null;
if (curCoord[0] > finalCoord[0]) {
thresh = t.tickSize - this.thumbCenterPoint.x;
tm... | javascript | function(curCoord, finalCoord) {
this.logger.log("getNextX: " + curCoord + ", " + finalCoord);
var t = this.thumb,
thresh,
tmp = [],
nextCoord = null;
if (curCoord[0] > finalCoord[0]) {
thresh = t.tickSize - this.thumbCenterPoint.x;
tm... | [
"function",
"(",
"curCoord",
",",
"finalCoord",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"getNextX: \"",
"+",
"curCoord",
"+",
"\", \"",
"+",
"finalCoord",
")",
";",
"var",
"t",
"=",
"this",
".",
"thumb",
",",
"thresh",
",",
"tmp",
"=",
"[... | Returns the next X tick value based on the current coord and the target coord.
@method _getNextX
@private | [
"Returns",
"the",
"next",
"X",
"tick",
"value",
"based",
"on",
"the",
"current",
"coord",
"and",
"the",
"target",
"coord",
"."
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider-debug.js#L1037-L1057 | train | |
neyric/webhookit | public/javascripts/yui/slider/slider-debug.js | function(e) {
this.logger.log("background drag");
if (this.backgroundEnabled && !this.isLocked()) {
var x = Event.getPageX(e),
y = Event.getPageY(e);
this.moveThumb(x, y, true, true);
this.fireEvents();
}
} | javascript | function(e) {
this.logger.log("background drag");
if (this.backgroundEnabled && !this.isLocked()) {
var x = Event.getPageX(e),
y = Event.getPageY(e);
this.moveThumb(x, y, true, true);
this.fireEvents();
}
} | [
"function",
"(",
"e",
")",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"\"background drag\"",
")",
";",
"if",
"(",
"this",
".",
"backgroundEnabled",
"&&",
"!",
"this",
".",
"isLocked",
"(",
")",
")",
"{",
"var",
"x",
"=",
"Event",
".",
"getPageX",
... | Handles the onDrag event for the slider background
@method onDrag
@private | [
"Handles",
"the",
"onDrag",
"event",
"for",
"the",
"slider",
"background"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider-debug.js#L1126-L1134 | train | |
neyric/webhookit | public/javascripts/yui/slider/slider-debug.js | function (thumbEvent) {
var t = this.thumb, newX, newY, newVal;
if (!thumbEvent) {
t.cachePosition();
}
if (! this.isLocked()) {
if (t._isRegion) {
newX = t.getXValue();
newY = t.getYValue();
if (newX != this.pre... | javascript | function (thumbEvent) {
var t = this.thumb, newX, newY, newVal;
if (!thumbEvent) {
t.cachePosition();
}
if (! this.isLocked()) {
if (t._isRegion) {
newX = t.getXValue();
newY = t.getYValue();
if (newX != this.pre... | [
"function",
"(",
"thumbEvent",
")",
"{",
"var",
"t",
"=",
"this",
".",
"thumb",
",",
"newX",
",",
"newY",
",",
"newVal",
";",
"if",
"(",
"!",
"thumbEvent",
")",
"{",
"t",
".",
"cachePosition",
"(",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"i... | Fires the change event if the value has been changed. Ignored if we are in
the middle of an animation as the event will fire when the animation is
complete
@method fireEvents
@param {boolean} thumbEvent set to true if this event is fired from an event
that occurred on the thumb. If it is, the state of the
thumb dd ob... | [
"Fires",
"the",
"change",
"event",
"if",
"the",
"value",
"has",
"been",
"changed",
".",
"Ignored",
"if",
"we",
"are",
"in",
"the",
"middle",
"of",
"an",
"animation",
"as",
"the",
"event",
"will",
"fire",
"when",
"the",
"animation",
"is",
"complete"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/yui/slider/slider-debug.js#L1174-L1210 | train | |
neyric/webhookit | public/javascripts/inputex/js/fields/ColorPickerField.js | function(options) {
inputEx.ColorPickerField.superclass.setOptions.call(this, options);
// Overwrite options
this.options.className = options.className ? options.className : 'inputEx-Field inputEx-ColorPickerField';
// Color Picker options object
this.options.colorPickerOptions = YAHOO.lang.isUnde... | javascript | function(options) {
inputEx.ColorPickerField.superclass.setOptions.call(this, options);
// Overwrite options
this.options.className = options.className ? options.className : 'inputEx-Field inputEx-ColorPickerField';
// Color Picker options object
this.options.colorPickerOptions = YAHOO.lang.isUnde... | [
"function",
"(",
"options",
")",
"{",
"inputEx",
".",
"ColorPickerField",
".",
"superclass",
".",
"setOptions",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"// Overwrite options",
"this",
".",
"options",
".",
"className",
"=",
"options",
".",
"classN... | Adds the 'inputEx-ColorPickerField' default className
@param {Object} options Options object as passed to the constructor | [
"Adds",
"the",
"inputEx",
"-",
"ColorPickerField",
"default",
"className"
] | 13abf6f072e23d536432235da78fd3e4e5d742b6 | https://github.com/neyric/webhookit/blob/13abf6f072e23d536432235da78fd3e4e5d742b6/public/javascripts/inputex/js/fields/ColorPickerField.js#L24-L39 | train | |
perak/meteor-user-roles | src/index.js | function (userId, doc, fieldNames, modifier) {
// only admins can update user roles via the client
return Users.isAdmin(userId) || (doc._id === userId && fieldNames.indexOf("roles") < 0);
} | javascript | function (userId, doc, fieldNames, modifier) {
// only admins can update user roles via the client
return Users.isAdmin(userId) || (doc._id === userId && fieldNames.indexOf("roles") < 0);
} | [
"function",
"(",
"userId",
",",
"doc",
",",
"fieldNames",
",",
"modifier",
")",
"{",
"// only admins can update user roles via the client",
"return",
"Users",
".",
"isAdmin",
"(",
"userId",
")",
"||",
"(",
"doc",
".",
"_id",
"===",
"userId",
"&&",
"fieldNames",
... | doesn't allow insert or removal of users from untrusted code | [
"doesn",
"t",
"allow",
"insert",
"or",
"removal",
"of",
"users",
"from",
"untrusted",
"code"
] | 7aa840db6656613f15e4c30dab27257675dc4313 | https://github.com/perak/meteor-user-roles/blob/7aa840db6656613f15e4c30dab27257675dc4313/src/index.js#L152-L155 | train | |
reelyactive/raddec | lib/events.js | encode | function encode(events) {
if(!Array.isArray(events)) {
return '00';
}
let bitmask = 0;
for(event in events) {
let index = events[event];
bitmask += (1 << index);
}
return ('00' + bitmask.toString(16)).substr(-2);
} | javascript | function encode(events) {
if(!Array.isArray(events)) {
return '00';
}
let bitmask = 0;
for(event in events) {
let index = events[event];
bitmask += (1 << index);
}
return ('00' + bitmask.toString(16)).substr(-2);
} | [
"function",
"encode",
"(",
"events",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"events",
")",
")",
"{",
"return",
"'00'",
";",
"}",
"let",
"bitmask",
"=",
"0",
";",
"for",
"(",
"event",
"in",
"events",
")",
"{",
"let",
"index",
"=",... | Encode the given events index list as a hexadecimal string byte.
@param {Array} events The given events as an index list.
@return {String} The resulting hexadecimal string. | [
"Encode",
"the",
"given",
"events",
"index",
"list",
"as",
"a",
"hexadecimal",
"string",
"byte",
"."
] | 6bd2c73ce63c5e45fb9e77c245491939a690a76a | https://github.com/reelyactive/raddec/blob/6bd2c73ce63c5e45fb9e77c245491939a690a76a/lib/events.js#L25-L35 | train |
reelyactive/raddec | lib/events.js | decode | function decode(events) {
let indexList = [];
let eventsByte = parseInt(events, 16);
if(eventsByte & APPEARANCE_MASK) {
indexList.push(APPEARANCE);
}
if(eventsByte & DISPLACEMENT_MASK) {
indexList.push(DISPLACEMENT);
}
if(eventsByte & PACKETS_MASK) {
indexList.push(PACKETS);
}
if(eventsBy... | javascript | function decode(events) {
let indexList = [];
let eventsByte = parseInt(events, 16);
if(eventsByte & APPEARANCE_MASK) {
indexList.push(APPEARANCE);
}
if(eventsByte & DISPLACEMENT_MASK) {
indexList.push(DISPLACEMENT);
}
if(eventsByte & PACKETS_MASK) {
indexList.push(PACKETS);
}
if(eventsBy... | [
"function",
"decode",
"(",
"events",
")",
"{",
"let",
"indexList",
"=",
"[",
"]",
";",
"let",
"eventsByte",
"=",
"parseInt",
"(",
"events",
",",
"16",
")",
";",
"if",
"(",
"eventsByte",
"&",
"APPEARANCE_MASK",
")",
"{",
"indexList",
".",
"push",
"(",
... | Decode the given hexadecimal string byte as an index list of events.
@param {String} rssi The given events as a bitmask hexadecimal string.
@return {Array} The corresponding index list of events. | [
"Decode",
"the",
"given",
"hexadecimal",
"string",
"byte",
"as",
"an",
"index",
"list",
"of",
"events",
"."
] | 6bd2c73ce63c5e45fb9e77c245491939a690a76a | https://github.com/reelyactive/raddec/blob/6bd2c73ce63c5e45fb9e77c245491939a690a76a/lib/events.js#L43-L64 | train |
danigb/scorejs | lib/measures.js | measures | function measures (meter, measures, builder) {
var list
var mLen = measureLength(meter)
if (!mLen) throw Error('Not valid meter: ' + meter)
var seq = []
builder = builder || score.note
splitMeasures(measures).forEach(function (measure) {
measure = measure.trim()
if (measure.length > 0) {
list... | javascript | function measures (meter, measures, builder) {
var list
var mLen = measureLength(meter)
if (!mLen) throw Error('Not valid meter: ' + meter)
var seq = []
builder = builder || score.note
splitMeasures(measures).forEach(function (measure) {
measure = measure.trim()
if (measure.length > 0) {
list... | [
"function",
"measures",
"(",
"meter",
",",
"measures",
",",
"builder",
")",
"{",
"var",
"list",
"var",
"mLen",
"=",
"measureLength",
"(",
"meter",
")",
"if",
"(",
"!",
"mLen",
")",
"throw",
"Error",
"(",
"'Not valid meter: '",
"+",
"meter",
")",
"var",
... | Parse masures using a time meter to get a sequence
@param {String} meter - the time meter
@param {String} measures - the measures string
@param {Function} builder - (Optional) the function used to build the notes
@return {Score} the score object
@example
measures('4/4', 'c d (e f) | g | (a b c) d') | [
"Parse",
"masures",
"using",
"a",
"time",
"meter",
"to",
"get",
"a",
"sequence"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/lib/measures.js#L16-L31 | train |
danigb/scorejs | lib/measures.js | chords | function chords (meter, data) {
return measures(meter, data, function (dur, el) {
return score.el({ duration: dur, chord: el })
})
} | javascript | function chords (meter, data) {
return measures(meter, data, function (dur, el) {
return score.el({ duration: dur, chord: el })
})
} | [
"function",
"chords",
"(",
"meter",
",",
"data",
")",
"{",
"return",
"measures",
"(",
"meter",
",",
"data",
",",
"function",
"(",
"dur",
",",
"el",
")",
"{",
"return",
"score",
".",
"el",
"(",
"{",
"duration",
":",
"dur",
",",
"chord",
":",
"el",
... | Create a chord names sequence
@param {String} meter - the meter used in the measures
@param {String} measures - the chords
@param {Sequence} a sequence of chords
@example
score.chords('4/4', 'C6 | Dm7 G7 | Cmaj7')
@example
score(['chords', '4/4', 'Cmaj7 | Dm7 G7']) | [
"Create",
"a",
"chord",
"names",
"sequence"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/lib/measures.js#L52-L56 | train |
danigb/scorejs | lib/measures.js | measureLength | function measureLength (meter) {
var m = meter.split('/').map(function (n) {
return +n.trim()
})
return m[0] * (4 / m[1])
} | javascript | function measureLength (meter) {
var m = meter.split('/').map(function (n) {
return +n.trim()
})
return m[0] * (4 / m[1])
} | [
"function",
"measureLength",
"(",
"meter",
")",
"{",
"var",
"m",
"=",
"meter",
".",
"split",
"(",
"'/'",
")",
".",
"map",
"(",
"function",
"(",
"n",
")",
"{",
"return",
"+",
"n",
".",
"trim",
"(",
")",
"}",
")",
"return",
"m",
"[",
"0",
"]",
... | get the length of one measure | [
"get",
"the",
"length",
"of",
"one",
"measure"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/lib/measures.js#L59-L64 | train |
niksy/fetch-google-maps | index.js | internalResolve | function internalResolve ( resolve ) {
resolve(window.google && window.google.maps ? window.google.maps : false);
} | javascript | function internalResolve ( resolve ) {
resolve(window.google && window.google.maps ? window.google.maps : false);
} | [
"function",
"internalResolve",
"(",
"resolve",
")",
"{",
"resolve",
"(",
"window",
".",
"google",
"&&",
"window",
".",
"google",
".",
"maps",
"?",
"window",
".",
"google",
".",
"maps",
":",
"false",
")",
";",
"}"
] | Declare internal resolve function, pass google.maps for the Promise resolve
@param {Function} resolve | [
"Declare",
"internal",
"resolve",
"function",
"pass",
"google",
".",
"maps",
"for",
"the",
"Promise",
"resolve"
] | db0d402206aa7fd592a46ee32e728b89c4801696 | https://github.com/niksy/fetch-google-maps/blob/db0d402206aa7fd592a46ee32e728b89c4801696/index.js#L15-L17 | train |
reelyactive/raddec | lib/raddec.js | constructFromObject | function constructFromObject(instance, source) {
instance.transmitterId = identifiers.format(source.transmitterId);
instance.transmitterIdType = source.transmitterIdType;
instance.rssiSignature = source.rssiSignature || [];
instance.rssiSignature.forEach(function(entry) {
entry.receiverIdType = entry.recei... | javascript | function constructFromObject(instance, source) {
instance.transmitterId = identifiers.format(source.transmitterId);
instance.transmitterIdType = source.transmitterIdType;
instance.rssiSignature = source.rssiSignature || [];
instance.rssiSignature.forEach(function(entry) {
entry.receiverIdType = entry.recei... | [
"function",
"constructFromObject",
"(",
"instance",
",",
"source",
")",
"{",
"instance",
".",
"transmitterId",
"=",
"identifiers",
".",
"format",
"(",
"source",
".",
"transmitterId",
")",
";",
"instance",
".",
"transmitterIdType",
"=",
"source",
".",
"transmitte... | Construct the Raddec from an Object.
@param {Raddec} instance The given Raddec instance.
@param {Object} source The source as an Object. | [
"Construct",
"the",
"Raddec",
"from",
"an",
"Object",
"."
] | 6bd2c73ce63c5e45fb9e77c245491939a690a76a | https://github.com/reelyactive/raddec/blob/6bd2c73ce63c5e45fb9e77c245491939a690a76a/lib/raddec.js#L446-L471 | train |
reelyactive/raddec | lib/raddec.js | mergeTimes | function mergeTimes(source, destination) {
if(source.hasOwnProperty('earliestDecodingTime')) {
if(destination.hasOwnProperty('earliestDecodingTime')) {
let isSourceEarlier = (source.earliestDecodingTime <
destination.earliestDecodingTime);
if(isSourceEarlier) {
... | javascript | function mergeTimes(source, destination) {
if(source.hasOwnProperty('earliestDecodingTime')) {
if(destination.hasOwnProperty('earliestDecodingTime')) {
let isSourceEarlier = (source.earliestDecodingTime <
destination.earliestDecodingTime);
if(isSourceEarlier) {
... | [
"function",
"mergeTimes",
"(",
"source",
",",
"destination",
")",
"{",
"if",
"(",
"source",
".",
"hasOwnProperty",
"(",
"'earliestDecodingTime'",
")",
")",
"{",
"if",
"(",
"destination",
".",
"hasOwnProperty",
"(",
"'earliestDecodingTime'",
")",
")",
"{",
"let... | Merge the times of the source Raddec into those of the destination Raddec.
@param {Raddec} source The source Raddec instance.
@param {Raddec} destination The destination Raddec instance. | [
"Merge",
"the",
"times",
"of",
"the",
"source",
"Raddec",
"into",
"those",
"of",
"the",
"destination",
"Raddec",
"."
] | 6bd2c73ce63c5e45fb9e77c245491939a690a76a | https://github.com/reelyactive/raddec/blob/6bd2c73ce63c5e45fb9e77c245491939a690a76a/lib/raddec.js#L479-L492 | train |
reelyactive/raddec | lib/raddec.js | toHexString | function toHexString(number, numberOfBytes) {
numberOfBytes = numberOfBytes || 1;
let hexString = '00'.repeat(numberOfBytes) + number.toString(16);
return hexString.substr(-2 * numberOfBytes);
} | javascript | function toHexString(number, numberOfBytes) {
numberOfBytes = numberOfBytes || 1;
let hexString = '00'.repeat(numberOfBytes) + number.toString(16);
return hexString.substr(-2 * numberOfBytes);
} | [
"function",
"toHexString",
"(",
"number",
",",
"numberOfBytes",
")",
"{",
"numberOfBytes",
"=",
"numberOfBytes",
"||",
"1",
";",
"let",
"hexString",
"=",
"'00'",
".",
"repeat",
"(",
"numberOfBytes",
")",
"+",
"number",
".",
"toString",
"(",
"16",
")",
";",... | Convert the given number to a hexadecimal string of the given length.
@param {Number} number The given number.
@param {Number} numberOfBytes The number of bytes of hex string.
@return {String} The resulting hexadecimal string. | [
"Convert",
"the",
"given",
"number",
"to",
"a",
"hexadecimal",
"string",
"of",
"the",
"given",
"length",
"."
] | 6bd2c73ce63c5e45fb9e77c245491939a690a76a | https://github.com/reelyactive/raddec/blob/6bd2c73ce63c5e45fb9e77c245491939a690a76a/lib/raddec.js#L501-L506 | train |
MingweiSamuel/TeemoJS | index.js | Region | function Region(config) {
this.config = config;
this.appLimit = new RateLimit(this.config.rateLimitTypeApplication, 1, this.config);
this.methodLimits = {};
this.liveRequests = 0;
} | javascript | function Region(config) {
this.config = config;
this.appLimit = new RateLimit(this.config.rateLimitTypeApplication, 1, this.config);
this.methodLimits = {};
this.liveRequests = 0;
} | [
"function",
"Region",
"(",
"config",
")",
"{",
"this",
".",
"config",
"=",
"config",
";",
"this",
".",
"appLimit",
"=",
"new",
"RateLimit",
"(",
"this",
".",
"config",
".",
"rateLimitTypeApplication",
",",
"1",
",",
"this",
".",
"config",
")",
";",
"th... | RateLimits for a region. One app limit and any number of method limits. | [
"RateLimits",
"for",
"a",
"region",
".",
"One",
"app",
"limit",
"and",
"any",
"number",
"of",
"method",
"limits",
"."
] | cc0bb94ceaa232c11e573111b375df44920e2b33 | https://github.com/MingweiSamuel/TeemoJS/blob/cc0bb94ceaa232c11e573111b375df44920e2b33/index.js#L50-L55 | train |
MingweiSamuel/TeemoJS | index.js | RateLimit | function RateLimit(type, distFactor, config) {
this.config = config;
this.type = type;
this.buckets = this.config.defaultBuckets.map(b => new TokenBucket(b.timespan, b.limit, b));
this.retryAfter = 0;
this.distFactor = distFactor;
} | javascript | function RateLimit(type, distFactor, config) {
this.config = config;
this.type = type;
this.buckets = this.config.defaultBuckets.map(b => new TokenBucket(b.timespan, b.limit, b));
this.retryAfter = 0;
this.distFactor = distFactor;
} | [
"function",
"RateLimit",
"(",
"type",
",",
"distFactor",
",",
"config",
")",
"{",
"this",
".",
"config",
"=",
"config",
";",
"this",
".",
"type",
"=",
"type",
";",
"this",
".",
"buckets",
"=",
"this",
".",
"config",
".",
"defaultBuckets",
".",
"map",
... | Rate limit. A collection of token buckets, updated when needed. | [
"Rate",
"limit",
".",
"A",
"collection",
"of",
"token",
"buckets",
"updated",
"when",
"needed",
"."
] | cc0bb94ceaa232c11e573111b375df44920e2b33 | https://github.com/MingweiSamuel/TeemoJS/blob/cc0bb94ceaa232c11e573111b375df44920e2b33/index.js#L128-L134 | train |
JamieMason/grunt-rewrite | tasks/lib/rewrite.js | dependency | function dependency(deps, name) {
if (name in deps && typeof deps[name] !== 'undefined') {
return deps[name];
}
throw new Error('grunt-rewrite.registerTask requires dependency "' + name + '"');
} | javascript | function dependency(deps, name) {
if (name in deps && typeof deps[name] !== 'undefined') {
return deps[name];
}
throw new Error('grunt-rewrite.registerTask requires dependency "' + name + '"');
} | [
"function",
"dependency",
"(",
"deps",
",",
"name",
")",
"{",
"if",
"(",
"name",
"in",
"deps",
"&&",
"typeof",
"deps",
"[",
"name",
"]",
"!==",
"'undefined'",
")",
"{",
"return",
"deps",
"[",
"name",
"]",
";",
"}",
"throw",
"new",
"Error",
"(",
"'g... | Return the named dependency or throw an error that it is absent.
@param {Object} deps
@param {String} name
@throws {Error}
@return {Mixed} | [
"Return",
"the",
"named",
"dependency",
"or",
"throw",
"an",
"error",
"that",
"it",
"is",
"absent",
"."
] | e27c8d4b78da18087c012f87b458dff8e6088376 | https://github.com/JamieMason/grunt-rewrite/blob/e27c8d4b78da18087c012f87b458dff8e6088376/tasks/lib/rewrite.js#L11-L16 | train |
JamieMason/grunt-rewrite | tasks/lib/rewrite.js | function(deps) {
deps = deps || {};
var grunt = dependency(deps, 'grunt');
var task = dependency(deps, 'task');
var done = task.async();
task.files.forEach(function(subTask) {
// make sure an editing function has been provided
if (typeof subTask.editor !== 'function') {
retu... | javascript | function(deps) {
deps = deps || {};
var grunt = dependency(deps, 'grunt');
var task = dependency(deps, 'task');
var done = task.async();
task.files.forEach(function(subTask) {
// make sure an editing function has been provided
if (typeof subTask.editor !== 'function') {
retu... | [
"function",
"(",
"deps",
")",
"{",
"deps",
"=",
"deps",
"||",
"{",
"}",
";",
"var",
"grunt",
"=",
"dependency",
"(",
"deps",
",",
"'grunt'",
")",
";",
"var",
"task",
"=",
"dependency",
"(",
"deps",
",",
"'task'",
")",
";",
"var",
"done",
"=",
"ta... | Improve testability by allowing mock dependencies to be passed into the task.
@param {Object} deps.grunt
@param {Object} deps.task | [
"Improve",
"testability",
"by",
"allowing",
"mock",
"dependencies",
"to",
"be",
"passed",
"into",
"the",
"task",
"."
] | e27c8d4b78da18087c012f87b458dff8e6088376 | https://github.com/JamieMason/grunt-rewrite/blob/e27c8d4b78da18087c012f87b458dff8e6088376/tasks/lib/rewrite.js#L26-L66 | train | |
giapnguyen74/gstate | src/apply.js | create_node | function create_node(length) {
const node = {};
Object.defineProperty(node, "_", {
value: {
length: length, //record array length
watchers: {},
watcher_key: new Set(),
watcher_props: new Set(),
on_watch_callback: undefined
},
writable: true,
enumerable: false
});
return node;
} | javascript | function create_node(length) {
const node = {};
Object.defineProperty(node, "_", {
value: {
length: length, //record array length
watchers: {},
watcher_key: new Set(),
watcher_props: new Set(),
on_watch_callback: undefined
},
writable: true,
enumerable: false
});
return node;
} | [
"function",
"create_node",
"(",
"length",
")",
"{",
"const",
"node",
"=",
"{",
"}",
";",
"Object",
".",
"defineProperty",
"(",
"node",
",",
"\"_\"",
",",
"{",
"value",
":",
"{",
"length",
":",
"length",
",",
"//record array length",
"watchers",
":",
"{",... | Create a node
@param {*} [length] | [
"Create",
"a",
"node"
] | 3a4f426ce95162518974eb10309afd342ec80006 | https://github.com/giapnguyen74/gstate/blob/3a4f426ce95162518974eb10309afd342ec80006/src/apply.js#L7-L22 | train |
giapnguyen74/gstate | src/apply.js | create_node_by_path | function create_node_by_path(context, path, len, tracker) {
let node = context.state.rootNode;
for (let i = 0; i < len; i++) {
const k = path[i];
if (k == "_") continue;
if (k == "#") {
node = context.state.rootNode;
continue;
}
if (node_type(node[k]) != NodeTypes.NODE) {
commit_node_prop(context, ... | javascript | function create_node_by_path(context, path, len, tracker) {
let node = context.state.rootNode;
for (let i = 0; i < len; i++) {
const k = path[i];
if (k == "_") continue;
if (k == "#") {
node = context.state.rootNode;
continue;
}
if (node_type(node[k]) != NodeTypes.NODE) {
commit_node_prop(context, ... | [
"function",
"create_node_by_path",
"(",
"context",
",",
"path",
",",
"len",
",",
"tracker",
")",
"{",
"let",
"node",
"=",
"context",
".",
"state",
".",
"rootNode",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
... | Follow path create node if not existed
@param {*} context
@param {*} node
@param {*} keys
@param {*} len
@param {*} tracker | [
"Follow",
"path",
"create",
"node",
"if",
"not",
"existed"
] | 3a4f426ce95162518974eb10309afd342ec80006 | https://github.com/giapnguyen74/gstate/blob/3a4f426ce95162518974eb10309afd342ec80006/src/apply.js#L89-L104 | train |
giapnguyen74/gstate | src/apply.js | apply_patch | function apply_patch(context, patch, tracker) {
const path = patch[0];
if (path.length == 0) return; //ignore replace root node
const value = patch[1];
const len = path.length - 1;
const prop = path[len];
if (!Array.isArray(value)) {
const node = create_node_by_path(context, path, len, tracker);
commit_node_... | javascript | function apply_patch(context, patch, tracker) {
const path = patch[0];
if (path.length == 0) return; //ignore replace root node
const value = patch[1];
const len = path.length - 1;
const prop = path[len];
if (!Array.isArray(value)) {
const node = create_node_by_path(context, path, len, tracker);
commit_node_... | [
"function",
"apply_patch",
"(",
"context",
",",
"patch",
",",
"tracker",
")",
"{",
"const",
"path",
"=",
"patch",
"[",
"0",
"]",
";",
"if",
"(",
"path",
".",
"length",
"==",
"0",
")",
"return",
";",
"//ignore replace root node",
"const",
"value",
"=",
... | Apply single patch
@param {*} context
@param {*} patch
@param {*} [tracker] | [
"Apply",
"single",
"patch"
] | 3a4f426ce95162518974eb10309afd342ec80006 | https://github.com/giapnguyen74/gstate/blob/3a4f426ce95162518974eb10309afd342ec80006/src/apply.js#L145-L188 | train |
giapnguyen74/gstate | src/patch.js | calc_patches_any | function calc_patches_any(context, patches, path, value, tracker) {
const valueType = value_type(value);
if (valueType == ValueTypes.OBJECT) {
if (value.propertyIsEnumerable("_")) {
if (value["_"] == "$ref") {
return patches.push([path, [PatchTypes.REFERENCE, value.path]]);
}
throw new Error("Underscor... | javascript | function calc_patches_any(context, patches, path, value, tracker) {
const valueType = value_type(value);
if (valueType == ValueTypes.OBJECT) {
if (value.propertyIsEnumerable("_")) {
if (value["_"] == "$ref") {
return patches.push([path, [PatchTypes.REFERENCE, value.path]]);
}
throw new Error("Underscor... | [
"function",
"calc_patches_any",
"(",
"context",
",",
"patches",
",",
"path",
",",
"value",
",",
"tracker",
")",
"{",
"const",
"valueType",
"=",
"value_type",
"(",
"value",
")",
";",
"if",
"(",
"valueType",
"==",
"ValueTypes",
".",
"OBJECT",
")",
"{",
"if... | Given path and value , calculate patches
@param {*} context
@param {*} patches
@param {*} path
@param {*} value
@param {*} tracker | [
"Given",
"path",
"and",
"value",
"calculate",
"patches"
] | 3a4f426ce95162518974eb10309afd342ec80006 | https://github.com/giapnguyen74/gstate/blob/3a4f426ce95162518974eb10309afd342ec80006/src/patch.js#L66-L82 | train |
danigb/scorejs | ext/pianoroll.js | draw | function draw (ctx, score) {
console.log(score)
drawStripes(box, ctx)
forEachTime(function (time, note) {
var midi = toMidi(note.pitch)
console.log(time, note, midi)
ctx.fillRect(box.x(time), box.y(midi), box.nw(note.duration), box.nh())
}, null, score)
} | javascript | function draw (ctx, score) {
console.log(score)
drawStripes(box, ctx)
forEachTime(function (time, note) {
var midi = toMidi(note.pitch)
console.log(time, note, midi)
ctx.fillRect(box.x(time), box.y(midi), box.nw(note.duration), box.nh())
}, null, score)
} | [
"function",
"draw",
"(",
"ctx",
",",
"score",
")",
"{",
"console",
".",
"log",
"(",
"score",
")",
"drawStripes",
"(",
"box",
",",
"ctx",
")",
"forEachTime",
"(",
"function",
"(",
"time",
",",
"note",
")",
"{",
"var",
"midi",
"=",
"toMidi",
"(",
"no... | Draw a piano roll | [
"Draw",
"a",
"piano",
"roll"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/ext/pianoroll.js#L30-L38 | train |
danigb/scorejs | lib/build.js | exec | function exec (ctx, scope, data) {
console.log('exec', ctx, scope, data)
var fn = getFunction(ctx, scope, data[0])
var elements = data.slice(1)
var params = elements.map(function (p) {
return Array.isArray(p) ? exec(ctx, scope, p)
: (p[0] === '$') ? ctx[p] : p
}).filter(function (p) { return p !== V... | javascript | function exec (ctx, scope, data) {
console.log('exec', ctx, scope, data)
var fn = getFunction(ctx, scope, data[0])
var elements = data.slice(1)
var params = elements.map(function (p) {
return Array.isArray(p) ? exec(ctx, scope, p)
: (p[0] === '$') ? ctx[p] : p
}).filter(function (p) { return p !== V... | [
"function",
"exec",
"(",
"ctx",
",",
"scope",
",",
"data",
")",
"{",
"console",
".",
"log",
"(",
"'exec'",
",",
"ctx",
",",
"scope",
",",
"data",
")",
"var",
"fn",
"=",
"getFunction",
"(",
"ctx",
",",
"scope",
",",
"data",
"[",
"0",
"]",
")",
"... | exec a data array | [
"exec",
"a",
"data",
"array"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/lib/build.js#L14-L23 | train |
reelyactive/raddec | lib/identifiers.js | format | function format(identifier) {
if(typeof identifier === 'string') {
var hexIdentifier = identifier.replace(/[^A-Fa-f0-9]/g, '');
return hexIdentifier.toLowerCase();
}
return null;
} | javascript | function format(identifier) {
if(typeof identifier === 'string') {
var hexIdentifier = identifier.replace(/[^A-Fa-f0-9]/g, '');
return hexIdentifier.toLowerCase();
}
return null;
} | [
"function",
"format",
"(",
"identifier",
")",
"{",
"if",
"(",
"typeof",
"identifier",
"===",
"'string'",
")",
"{",
"var",
"hexIdentifier",
"=",
"identifier",
".",
"replace",
"(",
"/",
"[^A-Fa-f0-9]",
"/",
"g",
",",
"''",
")",
";",
"return",
"hexIdentifier"... | Convert the given identifier to a valid identifier string, if possible.
@param {String} identifier The given identifier.
@return {String} Valid identifier string, or null if invalid input. | [
"Convert",
"the",
"given",
"identifier",
"to",
"a",
"valid",
"identifier",
"string",
"if",
"possible",
"."
] | 6bd2c73ce63c5e45fb9e77c245491939a690a76a | https://github.com/reelyactive/raddec/blob/6bd2c73ce63c5e45fb9e77c245491939a690a76a/lib/identifiers.js#L25-L31 | train |
reelyactive/raddec | lib/identifiers.js | lengthInBytes | function lengthInBytes(type) {
switch(type) {
case TYPE_UNKNOWN:
return LENGTH_UNKNOWN;
case TYPE_EUI64:
return LENGTH_EUI64;
case TYPE_EUI48:
return LENGTH_EUI48;
case TYPE_RND48:
return LENGTH_RND48;
default:
return null;
}
} | javascript | function lengthInBytes(type) {
switch(type) {
case TYPE_UNKNOWN:
return LENGTH_UNKNOWN;
case TYPE_EUI64:
return LENGTH_EUI64;
case TYPE_EUI48:
return LENGTH_EUI48;
case TYPE_RND48:
return LENGTH_RND48;
default:
return null;
}
} | [
"function",
"lengthInBytes",
"(",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"TYPE_UNKNOWN",
":",
"return",
"LENGTH_UNKNOWN",
";",
"case",
"TYPE_EUI64",
":",
"return",
"LENGTH_EUI64",
";",
"case",
"TYPE_EUI48",
":",
"return",
"LENGTH_EUI48",
";... | Return the length in bytes of the given identifier type.
@param {Number} identifier The given identifier type.
@return {Number} The length of the identifier in bytes. | [
"Return",
"the",
"length",
"in",
"bytes",
"of",
"the",
"given",
"identifier",
"type",
"."
] | 6bd2c73ce63c5e45fb9e77c245491939a690a76a | https://github.com/reelyactive/raddec/blob/6bd2c73ce63c5e45fb9e77c245491939a690a76a/lib/identifiers.js#L39-L52 | train |
netproteus/protobuf2flowtype | build/generate.js | buildType | function buildType(t, typeClassification) {
let typeDef;
switch (typeClassification) {
case 'primative':
typeDef = {
interface: t,
builder: t
};
break;
case... | javascript | function buildType(t, typeClassification) {
let typeDef;
switch (typeClassification) {
case 'primative':
typeDef = {
interface: t,
builder: t
};
break;
case... | [
"function",
"buildType",
"(",
"t",
",",
"typeClassification",
")",
"{",
"let",
"typeDef",
";",
"switch",
"(",
"typeClassification",
")",
"{",
"case",
"'primative'",
":",
"typeDef",
"=",
"{",
"interface",
":",
"t",
",",
"builder",
":",
"t",
"}",
";",
"bre... | Builds the typedef needed for the template
@param t - base type name
@param primative - is it a built in type - i.e. leave it alone
@returns {{interface: string, builder: string}} | [
"Builds",
"the",
"typedef",
"needed",
"for",
"the",
"template"
] | 105fa5dea8769ef71267e01e25d32a39baf31176 | https://github.com/netproteus/protobuf2flowtype/blob/105fa5dea8769ef71267e01e25d32a39baf31176/build/generate.js#L233-L263 | train |
netproteus/protobuf2flowtype | build/generate.js | strip | function strip(obj) {
if (!obj || ! obj instanceof Object || typeof obj === 'string') {
return undefined;
}
if (obj instanceof Array) {
for (const value of obj) {
strip(value);
}
} else {
delete obj['loc'];
delete obj['start'];
delete obj['e... | javascript | function strip(obj) {
if (!obj || ! obj instanceof Object || typeof obj === 'string') {
return undefined;
}
if (obj instanceof Array) {
for (const value of obj) {
strip(value);
}
} else {
delete obj['loc'];
delete obj['start'];
delete obj['e... | [
"function",
"strip",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"obj",
"||",
"!",
"obj",
"instanceof",
"Object",
"||",
"typeof",
"obj",
"===",
"'string'",
")",
"{",
"return",
"undefined",
";",
"}",
"if",
"(",
"obj",
"instanceof",
"Array",
")",
"{",
"for",... | Strips location information out of babel ast, so we can regen clean code from the ast
@param obj - babylon ast
@returns ast | [
"Strips",
"location",
"information",
"out",
"of",
"babel",
"ast",
"so",
"we",
"can",
"regen",
"clean",
"code",
"from",
"the",
"ast"
] | 105fa5dea8769ef71267e01e25d32a39baf31176 | https://github.com/netproteus/protobuf2flowtype/blob/105fa5dea8769ef71267e01e25d32a39baf31176/build/generate.js#L385-L405 | train |
netproteus/protobuf2flowtype | build/generate.js | clean | function clean(code) {
try {
const ast = babylon.parse(code, {
// parse in strict mode and allow module declarations
sourceType: 'module',
plugins: [
// enable jsx and flow syntax
'jsx',
'flow'
]
});
... | javascript | function clean(code) {
try {
const ast = babylon.parse(code, {
// parse in strict mode and allow module declarations
sourceType: 'module',
plugins: [
// enable jsx and flow syntax
'jsx',
'flow'
]
});
... | [
"function",
"clean",
"(",
"code",
")",
"{",
"try",
"{",
"const",
"ast",
"=",
"babylon",
".",
"parse",
"(",
"code",
",",
"{",
"// parse in strict mode and allow module declarations",
"sourceType",
":",
"'module'",
",",
"plugins",
":",
"[",
"// enable jsx and flow s... | Takes JS code as string, parses it to AST, strips out formating information
And regenerates clean code as a result
@param code
@returns code | [
"Takes",
"JS",
"code",
"as",
"string",
"parses",
"it",
"to",
"AST",
"strips",
"out",
"formating",
"information",
"And",
"regenerates",
"clean",
"code",
"as",
"a",
"result"
] | 105fa5dea8769ef71267e01e25d32a39baf31176 | https://github.com/netproteus/protobuf2flowtype/blob/105fa5dea8769ef71267e01e25d32a39baf31176/build/generate.js#L414-L437 | train |
netproteus/protobuf2flowtype | build/generate.js | camelCase | function camelCase(str, next) {
let output = '';
for (const c of str) {
if (c === '_') {
next = true;
continue;
}
output += next ? c.toUpperCase() : c;
next = false;
}
return output;
} | javascript | function camelCase(str, next) {
let output = '';
for (const c of str) {
if (c === '_') {
next = true;
continue;
}
output += next ? c.toUpperCase() : c;
next = false;
}
return output;
} | [
"function",
"camelCase",
"(",
"str",
",",
"next",
")",
"{",
"let",
"output",
"=",
"''",
";",
"for",
"(",
"const",
"c",
"of",
"str",
")",
"{",
"if",
"(",
"c",
"===",
"'_'",
")",
"{",
"next",
"=",
"true",
";",
"continue",
";",
"}",
"output",
"+="... | Converts foo_bar -> fooBar
@param str
@param next
@returns {string} | [
"Converts",
"foo_bar",
"-",
">",
"fooBar"
] | 105fa5dea8769ef71267e01e25d32a39baf31176 | https://github.com/netproteus/protobuf2flowtype/blob/105fa5dea8769ef71267e01e25d32a39baf31176/build/generate.js#L445-L456 | train |
netproteus/protobuf2flowtype | build/generate.js | processProto | function processProto(protoFile, root, imported = []) {
const protPath = path.format({
dir: root,
base: protoFile
});
const parser = new ProtoBuf.DotProto.Parser(fs.readFileSync(protPath));
const protoAst = parser.parse();
imported.push(protoFile);
protoAst.imports.forEach(file ... | javascript | function processProto(protoFile, root, imported = []) {
const protPath = path.format({
dir: root,
base: protoFile
});
const parser = new ProtoBuf.DotProto.Parser(fs.readFileSync(protPath));
const protoAst = parser.parse();
imported.push(protoFile);
protoAst.imports.forEach(file ... | [
"function",
"processProto",
"(",
"protoFile",
",",
"root",
",",
"imported",
"=",
"[",
"]",
")",
"{",
"const",
"protPath",
"=",
"path",
".",
"format",
"(",
"{",
"dir",
":",
"root",
",",
"base",
":",
"protoFile",
"}",
")",
";",
"const",
"parser",
"=",
... | Parses protofile recursively, resolving all imports
To create Nampespace that can be used for generation
@param protoFile
@returns {Namespace} | [
"Parses",
"protofile",
"recursively",
"resolving",
"all",
"imports"
] | 105fa5dea8769ef71267e01e25d32a39baf31176 | https://github.com/netproteus/protobuf2flowtype/blob/105fa5dea8769ef71267e01e25d32a39baf31176/build/generate.js#L467-L483 | train |
netproteus/protobuf2flowtype | build/generate.js | generateFromProto | function generateFromProto(outputDir, inputProto, protoDir) {
try {
fs.accessSync(path.format({
dir: protoDir,
base: inputProto
}));
if (!protoDir) {
const absolutePath = fs.realpathSync(inputProto);
protoDir = path.dirname(absolutePath);
... | javascript | function generateFromProto(outputDir, inputProto, protoDir) {
try {
fs.accessSync(path.format({
dir: protoDir,
base: inputProto
}));
if (!protoDir) {
const absolutePath = fs.realpathSync(inputProto);
protoDir = path.dirname(absolutePath);
... | [
"function",
"generateFromProto",
"(",
"outputDir",
",",
"inputProto",
",",
"protoDir",
")",
"{",
"try",
"{",
"fs",
".",
"accessSync",
"(",
"path",
".",
"format",
"(",
"{",
"dir",
":",
"protoDir",
",",
"base",
":",
"inputProto",
"}",
")",
")",
";",
"if"... | Exported function from this module
Given the proto input will generate the modules with flowtype bindings in outputDir
@param outputDir - Directory to output files
@param inputProto - Root proto file
@param protoDir - directory to load proto files from - can be ommited and absolute path used in inputProto if imports
... | [
"Exported",
"function",
"from",
"this",
"module"
] | 105fa5dea8769ef71267e01e25d32a39baf31176 | https://github.com/netproteus/protobuf2flowtype/blob/105fa5dea8769ef71267e01e25d32a39baf31176/build/generate.js#L496-L569 | train |
danigb/scorejs | lib/score.js | note | function note (dur, pitch, data) {
if (arguments.length === 1) return function (p, d) { return note(dur, p, d) }
return assign({ pitch: pitch, duration: dur || 1 }, data)
} | javascript | function note (dur, pitch, data) {
if (arguments.length === 1) return function (p, d) { return note(dur, p, d) }
return assign({ pitch: pitch, duration: dur || 1 }, data)
} | [
"function",
"note",
"(",
"dur",
",",
"pitch",
",",
"data",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"===",
"1",
")",
"return",
"function",
"(",
"p",
",",
"d",
")",
"{",
"return",
"note",
"(",
"dur",
",",
"p",
",",
"d",
")",
"}",
"return... | Create a note from duration and pitch. It's a helper function to create
score elements easely.
A note is any object with duration and pitch attributes. The duration
must be a number and the pitch can be any value (but usually expressed by
integers, floats or strings)
If only duration is provided, a partially applied ... | [
"Create",
"a",
"note",
"from",
"duration",
"and",
"pitch",
".",
"It",
"s",
"a",
"helper",
"function",
"to",
"create",
"score",
"elements",
"easely",
"."
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/lib/score.js#L61-L64 | train |
danigb/scorejs | lib/score.js | transform | function transform (nt, st, pt, ctx, obj) {
switch (arguments.length) {
case 0: return transform
case 1:
case 2:
case 3: return transformer(nt, st, pt)
case 4: return function (o) { return transformer(nt, st, pt)(ctx, o) }
default: return transformer(nt, st, pt)(ctx, obj)
}
} | javascript | function transform (nt, st, pt, ctx, obj) {
switch (arguments.length) {
case 0: return transform
case 1:
case 2:
case 3: return transformer(nt, st, pt)
case 4: return function (o) { return transformer(nt, st, pt)(ctx, o) }
default: return transformer(nt, st, pt)(ctx, obj)
}
} | [
"function",
"transform",
"(",
"nt",
",",
"st",
",",
"pt",
",",
"ctx",
",",
"obj",
")",
"{",
"switch",
"(",
"arguments",
".",
"length",
")",
"{",
"case",
"0",
":",
"return",
"transform",
"case",
"1",
":",
"case",
"2",
":",
"case",
"3",
":",
"retur... | Transform a musical structure
This is probably the most important function. It allows complex
transformations of musical structures using three functions
@param {Function} elTransform - element transform function
@param {Function} seqTransform - sequential structure transform function
@param {Function} parTransform -... | [
"Transform",
"a",
"musical",
"structure"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/lib/score.js#L100-L109 | train |
danigb/scorejs | lib/score.js | map | function map (fn, ctx, obj) {
switch (arguments.length) {
case 0: return map
case 1: return transform(fn, buildSeq, buildSim)
case 2: return function (obj) { return map(fn)(ctx, obj) }
case 3: return map(fn)(ctx, obj)
}
} | javascript | function map (fn, ctx, obj) {
switch (arguments.length) {
case 0: return map
case 1: return transform(fn, buildSeq, buildSim)
case 2: return function (obj) { return map(fn)(ctx, obj) }
case 3: return map(fn)(ctx, obj)
}
} | [
"function",
"map",
"(",
"fn",
",",
"ctx",
",",
"obj",
")",
"{",
"switch",
"(",
"arguments",
".",
"length",
")",
"{",
"case",
"0",
":",
"return",
"map",
"case",
"1",
":",
"return",
"transform",
"(",
"fn",
",",
"buildSeq",
",",
"buildSim",
")",
"case... | Map the notes of a musical structure using a function
@param {Function} fn - the function used to map the notes
@param {Object} ctx - a context object passed to the function
@param {Score} score - the score to transform
@return {Score} the transformed score | [
"Map",
"the",
"notes",
"of",
"a",
"musical",
"structure",
"using",
"a",
"function"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/lib/score.js#L132-L139 | train |
avinoamr/blueprint.js | lib/blueprint.js | extend | function extend( obj, var_args ) {
for ( var i = 1; i < arguments.length ; i += 1 ) {
var other = arguments[ i ];
for ( var p in other ) {
var v = Object.getOwnPropertyDescriptor( other, p );
if ( typeof v == "undefined" || typeof v.value == "undefined" ) ... | javascript | function extend( obj, var_args ) {
for ( var i = 1; i < arguments.length ; i += 1 ) {
var other = arguments[ i ];
for ( var p in other ) {
var v = Object.getOwnPropertyDescriptor( other, p );
if ( typeof v == "undefined" || typeof v.value == "undefined" ) ... | [
"function",
"extend",
"(",
"obj",
",",
"var_args",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"1",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"+=",
"1",
")",
"{",
"var",
"other",
"=",
"arguments",
"[",
"i",
"]",
";",
"for",
"(",
"var",
... | helper function for extending objects | [
"helper",
"function",
"for",
"extending",
"objects"
] | f6bef30e759bff91be564c071afe3556d2ac82ef | https://github.com/avinoamr/blueprint.js/blob/f6bef30e759bff91be564c071afe3556d2ac82ef/lib/blueprint.js#L700-L713 | train |
sperka/node-sshclient | lib/ssh.js | SSH | function SSH(options) {
this.options = options || {};
console.assert(this.options.hostname, "Hostname required!");
this.debug = !!options.debug;
this.listener = new Listener({
debug: options.debug
});
} | javascript | function SSH(options) {
this.options = options || {};
console.assert(this.options.hostname, "Hostname required!");
this.debug = !!options.debug;
this.listener = new Listener({
debug: options.debug
});
} | [
"function",
"SSH",
"(",
"options",
")",
"{",
"this",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"console",
".",
"assert",
"(",
"this",
".",
"options",
".",
"hostname",
",",
"\"Hostname required!\"",
")",
";",
"this",
".",
"debug",
"=",
"!",
... | SSH manager.
@param options The options to use when sending the command to the remote server.
@constructor | [
"SSH",
"manager",
"."
] | 83212209fee784f4474b8135b0f6d39a39077cd4 | https://github.com/sperka/node-sshclient/blob/83212209fee784f4474b8135b0f6d39a39077cd4/lib/ssh.js#L28-L36 | train |
danigb/scorejs | lib/timed.js | forEachTime | function forEachTime (fn, ctx, obj) {
if (arguments.length > 1) return forEachTime(fn)(ctx, obj)
return function (ctx, obj) {
return score.transform(
function (note) {
return function (time, ctx) {
fn(time, note, ctx)
return note.duration
}
},
function (seq... | javascript | function forEachTime (fn, ctx, obj) {
if (arguments.length > 1) return forEachTime(fn)(ctx, obj)
return function (ctx, obj) {
return score.transform(
function (note) {
return function (time, ctx) {
fn(time, note, ctx)
return note.duration
}
},
function (seq... | [
"function",
"forEachTime",
"(",
"fn",
",",
"ctx",
",",
"obj",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
">",
"1",
")",
"return",
"forEachTime",
"(",
"fn",
")",
"(",
"ctx",
",",
"obj",
")",
"return",
"function",
"(",
"ctx",
",",
"obj",
")",
... | Get all notes for side-effects
__Important:__ ascending time ordered is not guaranteed
@param {Function} fn - the function
@param {Object} ctx - (Optional) a context object passed to the function
@param {Score} score - the score object | [
"Get",
"all",
"notes",
"for",
"side",
"-",
"effects"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/lib/timed.js#L21-L48 | train |
danigb/scorejs | lib/timed.js | events | function events (obj, build, compare) {
var e = []
forEachTime(function (time, obj) {
e.push(build ? build(time, obj) : [time, obj])
}, null, obj)
return e.sort(compare || function (a, b) { return a[0] - b[0] })
} | javascript | function events (obj, build, compare) {
var e = []
forEachTime(function (time, obj) {
e.push(build ? build(time, obj) : [time, obj])
}, null, obj)
return e.sort(compare || function (a, b) { return a[0] - b[0] })
} | [
"function",
"events",
"(",
"obj",
",",
"build",
",",
"compare",
")",
"{",
"var",
"e",
"=",
"[",
"]",
"forEachTime",
"(",
"function",
"(",
"time",
",",
"obj",
")",
"{",
"e",
".",
"push",
"(",
"build",
"?",
"build",
"(",
"time",
",",
"obj",
")",
... | Get a sorted events array from a score | [
"Get",
"a",
"sorted",
"events",
"array",
"from",
"a",
"score"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/lib/timed.js#L54-L60 | train |
sperka/node-sshclient | lib/scp.js | SCP | function SCP(options) {
this.options = options || {};
console.assert(this.options.hostname, "Hostname required!");
this.debug = !!options.debug;
this.listener = new Listener({
debug: options.debug
});
} | javascript | function SCP(options) {
this.options = options || {};
console.assert(this.options.hostname, "Hostname required!");
this.debug = !!options.debug;
this.listener = new Listener({
debug: options.debug
});
} | [
"function",
"SCP",
"(",
"options",
")",
"{",
"this",
".",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"console",
".",
"assert",
"(",
"this",
".",
"options",
".",
"hostname",
",",
"\"Hostname required!\"",
")",
";",
"this",
".",
"debug",
"=",
"!",
... | SCP manager.
@param options The options to use when sending the command to the remote server.
@constructor | [
"SCP",
"manager",
"."
] | 83212209fee784f4474b8135b0f6d39a39077cd4 | https://github.com/sperka/node-sshclient/blob/83212209fee784f4474b8135b0f6d39a39077cd4/lib/scp.js#L23-L32 | train |
reelyactive/raddec | lib/rssiSignature.js | merge | function merge(source, destination) {
source.forEach(function(current) {
let matchFound = false;
destination.forEach(function(target) {
let isSameReceiver = identifiers.areMatch(current.receiverId,
current.receiverIdType,
... | javascript | function merge(source, destination) {
source.forEach(function(current) {
let matchFound = false;
destination.forEach(function(target) {
let isSameReceiver = identifiers.areMatch(current.receiverId,
current.receiverIdType,
... | [
"function",
"merge",
"(",
"source",
",",
"destination",
")",
"{",
"source",
".",
"forEach",
"(",
"function",
"(",
"current",
")",
"{",
"let",
"matchFound",
"=",
"false",
";",
"destination",
".",
"forEach",
"(",
"function",
"(",
"target",
")",
"{",
"let",... | Merge the source rssiSignature into the destination rssiSignature.
@param {Array} source The source rssiSignature.
@param {Array} destination The destination rssiSignature. | [
"Merge",
"the",
"source",
"rssiSignature",
"into",
"the",
"destination",
"rssiSignature",
"."
] | 6bd2c73ce63c5e45fb9e77c245491939a690a76a | https://github.com/reelyactive/raddec/blob/6bd2c73ce63c5e45fb9e77c245491939a690a76a/lib/rssiSignature.js#L15-L38 | train |
reelyactive/raddec | lib/rssiSignature.js | compareRssi | function compareRssi(a,b) {
if(a.rssi < b.rssi)
return 1;
if(a.rssi > b.rssi)
return -1;
return 0;
} | javascript | function compareRssi(a,b) {
if(a.rssi < b.rssi)
return 1;
if(a.rssi > b.rssi)
return -1;
return 0;
} | [
"function",
"compareRssi",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"a",
".",
"rssi",
"<",
"b",
".",
"rssi",
")",
"return",
"1",
";",
"if",
"(",
"a",
".",
"rssi",
">",
"b",
".",
"rssi",
")",
"return",
"-",
"1",
";",
"return",
"0",
";",
"}"
... | Compare rssi values for array sorting.
@param {Object} a An rssiSignature entry.
@param {Object} b Another rssiSignature entry. | [
"Compare",
"rssi",
"values",
"for",
"array",
"sorting",
"."
] | 6bd2c73ce63c5e45fb9e77c245491939a690a76a | https://github.com/reelyactive/raddec/blob/6bd2c73ce63c5e45fb9e77c245491939a690a76a/lib/rssiSignature.js#L46-L52 | train |
reelyactive/raddec | lib/rssi.js | encode | function encode(rssi) {
if(rssi < MIN_RSSI_DBM) {
rssi = MIN_RSSI_DBM;
}
else if(rssi > MAX_RSSI_DBM) {
rssi = MAX_RSSI_DBM;
}
else {
rssi = Math.round(rssi);
}
return ('00' + (rssi - MIN_RSSI_DBM).toString(16)).substr(-2);
} | javascript | function encode(rssi) {
if(rssi < MIN_RSSI_DBM) {
rssi = MIN_RSSI_DBM;
}
else if(rssi > MAX_RSSI_DBM) {
rssi = MAX_RSSI_DBM;
}
else {
rssi = Math.round(rssi);
}
return ('00' + (rssi - MIN_RSSI_DBM).toString(16)).substr(-2);
} | [
"function",
"encode",
"(",
"rssi",
")",
"{",
"if",
"(",
"rssi",
"<",
"MIN_RSSI_DBM",
")",
"{",
"rssi",
"=",
"MIN_RSSI_DBM",
";",
"}",
"else",
"if",
"(",
"rssi",
">",
"MAX_RSSI_DBM",
")",
"{",
"rssi",
"=",
"MAX_RSSI_DBM",
";",
"}",
"else",
"{",
"rssi"... | Encode the given RSSI value as a hexadecimal string byte.
@param {Number} rssi The given RSSI in dBm.
@return {String} The resulting hexadecimal string. | [
"Encode",
"the",
"given",
"RSSI",
"value",
"as",
"a",
"hexadecimal",
"string",
"byte",
"."
] | 6bd2c73ce63c5e45fb9e77c245491939a690a76a | https://github.com/reelyactive/raddec/blob/6bd2c73ce63c5e45fb9e77c245491939a690a76a/lib/rssi.js#L16-L28 | train |
danigb/scorejs | examples/twelveTone.js | ttone1 | function ttone1 (reps, row, key, beat, amp) {
var tr = row.split(' ').map(function (n) {
return +n + key
})
var r = score.repeat(reps, score.phrase(tr, beat, amp))
return score.map(function (e) {
return randDur(randOct(e), beat)
}, null, r)
} | javascript | function ttone1 (reps, row, key, beat, amp) {
var tr = row.split(' ').map(function (n) {
return +n + key
})
var r = score.repeat(reps, score.phrase(tr, beat, amp))
return score.map(function (e) {
return randDur(randOct(e), beat)
}, null, r)
} | [
"function",
"ttone1",
"(",
"reps",
",",
"row",
",",
"key",
",",
"beat",
",",
"amp",
")",
"{",
"var",
"tr",
"=",
"row",
".",
"split",
"(",
"' '",
")",
".",
"map",
"(",
"function",
"(",
"n",
")",
"{",
"return",
"+",
"n",
"+",
"key",
"}",
")",
... | Metalevel, pg 124 | [
"Metalevel",
"pg",
"124"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/examples/twelveTone.js#L20-L28 | train |
danigb/scorejs | core/score.js | structureAs | function structureAs (name) {
return function () {
return [name].concat(isCollection(arguments[0]) ? arguments[0] : slice.call(arguments))
}
} | javascript | function structureAs (name) {
return function () {
return [name].concat(isCollection(arguments[0]) ? arguments[0] : slice.call(arguments))
}
} | [
"function",
"structureAs",
"(",
"name",
")",
"{",
"return",
"function",
"(",
")",
"{",
"return",
"[",
"name",
"]",
".",
"concat",
"(",
"isCollection",
"(",
"arguments",
"[",
"0",
"]",
")",
"?",
"arguments",
"[",
"0",
"]",
":",
"slice",
".",
"call",
... | Create musical structures from function arguments | [
"Create",
"musical",
"structures",
"from",
"function",
"arguments"
] | fc95215d7efef72aeaa22cf375b7839091ba35ff | https://github.com/danigb/scorejs/blob/fc95215d7efef72aeaa22cf375b7839091ba35ff/core/score.js#L95-L99 | train |
hhromic/e131-node | lib/client.js | Client | function Client(arg, port) {
if (this instanceof Client === false) {
return new Client(arg, port);
}
if (arg === undefined) {
throw new TypeError('arg should be a host address, name or universe');
}
this.host = Number.isInteger(arg) ? e131.getMulticastGroup(arg) : arg;
this.port = port || e131.DEF... | javascript | function Client(arg, port) {
if (this instanceof Client === false) {
return new Client(arg, port);
}
if (arg === undefined) {
throw new TypeError('arg should be a host address, name or universe');
}
this.host = Number.isInteger(arg) ? e131.getMulticastGroup(arg) : arg;
this.port = port || e131.DEF... | [
"function",
"Client",
"(",
"arg",
",",
"port",
")",
"{",
"if",
"(",
"this",
"instanceof",
"Client",
"===",
"false",
")",
"{",
"return",
"new",
"Client",
"(",
"arg",
",",
"port",
")",
";",
"}",
"if",
"(",
"arg",
"===",
"undefined",
")",
"{",
"throw"... | E1.31 client object constructor | [
"E1",
".",
"31",
"client",
"object",
"constructor"
] | 3a33b9219d917f46c52d1cb02bf36447f5fa6172 | https://github.com/hhromic/e131-node/blob/3a33b9219d917f46c52d1cb02bf36447f5fa6172/lib/client.js#L27-L39 | train |
nakardo/node-gameboy | lib/cpu/opcodes.js | add_sp_n | function add_sp_n (cpu, mmu) {
const n = mmu.readByte(cpu.pc + 1).signed();
const r = cpu.sp + n;
const op = cpu.sp ^ n ^ r;
cpu.f = 0;
if ((op & 0x10) != 0) cpu.f |= FLAG_H;
if ((op & 0x100) != 0) cpu.f |= FLAG_C;
return r;
} | javascript | function add_sp_n (cpu, mmu) {
const n = mmu.readByte(cpu.pc + 1).signed();
const r = cpu.sp + n;
const op = cpu.sp ^ n ^ r;
cpu.f = 0;
if ((op & 0x10) != 0) cpu.f |= FLAG_H;
if ((op & 0x100) != 0) cpu.f |= FLAG_C;
return r;
} | [
"function",
"add_sp_n",
"(",
"cpu",
",",
"mmu",
")",
"{",
"const",
"n",
"=",
"mmu",
".",
"readByte",
"(",
"cpu",
".",
"pc",
"+",
"1",
")",
".",
"signed",
"(",
")",
";",
"const",
"r",
"=",
"cpu",
".",
"sp",
"+",
"n",
";",
"const",
"op",
"=",
... | LD HL,SP+n
LDHL SP,n
Description
Put SP + n effective address into HL.
Use with:
n = one byte signed immediate value.
Flags affected:
Z - Reset.
N - Reset.
H - Set or reset according to operation.
C - Set or reset according to operation.
Opcodes:
Instruction Parameters Opcode Cycles
LDHL SP,n ... | [
"LD",
"HL",
"SP",
"+",
"n",
"LDHL",
"SP",
"n"
] | 93d112cddf7c9fd914f597be4d110b922d7cb59f | https://github.com/nakardo/node-gameboy/blob/93d112cddf7c9fd914f597be4d110b922d7cb59f/lib/cpu/opcodes.js#L600-L611 | 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.