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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
jsbin/jsbin | lib/helpers.js | function(render, fn) {
if (typeof render === 'function') {
fn = render;
render = false;
}
// separate the tracking of the application over rendered pages
if (render) {
app.render('partials/analytics', function(error, html) {
if (error) {
return fn(e... | javascript | function(render, fn) {
if (typeof render === 'function') {
fn = render;
render = false;
}
// separate the tracking of the application over rendered pages
if (render) {
app.render('partials/analytics', function(error, html) {
if (error) {
return fn(e... | [
"function",
"(",
"render",
",",
"fn",
")",
"{",
"if",
"(",
"typeof",
"render",
"===",
"'function'",
")",
"{",
"fn",
"=",
"render",
";",
"render",
"=",
"false",
";",
"}",
"// separate the tracking of the application over rendered pages",
"if",
"(",
"render",
")... | Renders the analytics snippet. Accepts a callback that recieves and error and html object. | [
"Renders",
"the",
"analytics",
"snippet",
".",
"Accepts",
"a",
"callback",
"that",
"recieves",
"and",
"error",
"and",
"html",
"object",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/helpers.js#L30-L53 | train | |
jsbin/jsbin | lib/helpers.js | function(path, full, secure) {
var root = '';
if (full) {
root = app.set('url full');
} else {
root = app.set('url prefix');
}
// Remove preceding slash if one exists.
if (path && path[0] === '/') {
path = path.slice(1);
}
if (secure) {
... | javascript | function(path, full, secure) {
var root = '';
if (full) {
root = app.set('url full');
} else {
root = app.set('url prefix');
}
// Remove preceding slash if one exists.
if (path && path[0] === '/') {
path = path.slice(1);
}
if (secure) {
... | [
"function",
"(",
"path",
",",
"full",
",",
"secure",
")",
"{",
"var",
"root",
"=",
"''",
";",
"if",
"(",
"full",
")",
"{",
"root",
"=",
"app",
".",
"set",
"(",
"'url full'",
")",
";",
"}",
"else",
"{",
"root",
"=",
"app",
".",
"set",
"(",
"'u... | Generates a url for the path provided including prefix. If the second full parameter is provided then a full url including domain and protocol will be returned. | [
"Generates",
"a",
"url",
"for",
"the",
"path",
"provided",
"including",
"prefix",
".",
"If",
"the",
"second",
"full",
"parameter",
"is",
"provided",
"then",
"a",
"full",
"url",
"including",
"domain",
"and",
"protocol",
"will",
"be",
"returned",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/helpers.js#L58-L79 | train | |
jsbin/jsbin | lib/helpers.js | function(user, size) {
var email = (user.email || '').trim().toLowerCase();
var name = user.name || 'default';
var d = 'd=blank';
if (!size || size < 120) {
d =
'd=' +
encodeURIComponent(
'https://jsbin-gravatar.herokuapp.com/' + name + '.png'
)... | javascript | function(user, size) {
var email = (user.email || '').trim().toLowerCase();
var name = user.name || 'default';
var d = 'd=blank';
if (!size || size < 120) {
d =
'd=' +
encodeURIComponent(
'https://jsbin-gravatar.herokuapp.com/' + name + '.png'
)... | [
"function",
"(",
"user",
",",
"size",
")",
"{",
"var",
"email",
"=",
"(",
"user",
".",
"email",
"||",
"''",
")",
".",
"trim",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"var",
"name",
"=",
"user",
".",
"name",
"||",
"'default'",
";",
"var",
"... | Returns a gravatar url for the email address provided. An optional size parameter can be provided to specify the size of the avatar to generate. | [
"Returns",
"a",
"gravatar",
"url",
"for",
"the",
"email",
"address",
"provided",
".",
"An",
"optional",
"size",
"parameter",
"can",
"be",
"provided",
"to",
"specify",
"the",
"size",
"of",
"the",
"avatar",
"to",
"generate",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/helpers.js#L121-L146 | train | |
jsbin/jsbin | lib/helpers.js | function(path, secure) {
var root = app.get('static url').replace(/.*:\/\//, '');
var proto = 'http';
if (path && path[0] === '/') {
path = path.slice(1);
}
if (secure) {
root =
undefsafe(config, 'url.ssl.static') ||
undefsafe(config, 'url.static') ||
... | javascript | function(path, secure) {
var root = app.get('static url').replace(/.*:\/\//, '');
var proto = 'http';
if (path && path[0] === '/') {
path = path.slice(1);
}
if (secure) {
root =
undefsafe(config, 'url.ssl.static') ||
undefsafe(config, 'url.static') ||
... | [
"function",
"(",
"path",
",",
"secure",
")",
"{",
"var",
"root",
"=",
"app",
".",
"get",
"(",
"'static url'",
")",
".",
"replace",
"(",
"/",
".*:\\/\\/",
"/",
",",
"''",
")",
";",
"var",
"proto",
"=",
"'http'",
";",
"if",
"(",
"path",
"&&",
"path... | Returns a url for a static resource. | [
"Returns",
"a",
"url",
"for",
"a",
"static",
"resource",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/helpers.js#L149-L168 | train | |
jsbin/jsbin | public/js/vendor/codemirror3/addon/merge/merge.js | clearMarks | function clearMarks(editor, arr, classes) {
for (var i = 0; i < arr.length; ++i) {
var mark = arr[i];
if (mark instanceof CodeMirror.TextMarker) {
mark.clear();
} else {
editor.removeLineClass(mark, "background", classes.chunk);
editor.removeLineClass(mark, "background", cl... | javascript | function clearMarks(editor, arr, classes) {
for (var i = 0; i < arr.length; ++i) {
var mark = arr[i];
if (mark instanceof CodeMirror.TextMarker) {
mark.clear();
} else {
editor.removeLineClass(mark, "background", classes.chunk);
editor.removeLineClass(mark, "background", cl... | [
"function",
"clearMarks",
"(",
"editor",
",",
"arr",
",",
"classes",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"length",
";",
"++",
"i",
")",
"{",
"var",
"mark",
"=",
"arr",
"[",
"i",
"]",
";",
"if",
"(",
"mark",
... | Updating the marks for editor content | [
"Updating",
"the",
"marks",
"for",
"editor",
"content"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/addon/merge/merge.js#L152-L164 | train |
jsbin/jsbin | public/js/vendor/codemirror3/addon/merge/merge.js | updateMarks | function updateMarks(editor, diff, state, type, classes) {
var vp = editor.getViewport();
editor.operation(function() {
if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
clearMarks(editor, state.marked, classes);
markChanges(editor, diff, type, state.marke... | javascript | function updateMarks(editor, diff, state, type, classes) {
var vp = editor.getViewport();
editor.operation(function() {
if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
clearMarks(editor, state.marked, classes);
markChanges(editor, diff, type, state.marke... | [
"function",
"updateMarks",
"(",
"editor",
",",
"diff",
",",
"state",
",",
"type",
",",
"classes",
")",
"{",
"var",
"vp",
"=",
"editor",
".",
"getViewport",
"(",
")",
";",
"editor",
".",
"operation",
"(",
"function",
"(",
")",
"{",
"if",
"(",
"state",... | FIXME maybe add a margin around viewport to prevent too many updates | [
"FIXME",
"maybe",
"add",
"a",
"margin",
"around",
"viewport",
"to",
"prevent",
"too",
"many",
"updates"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/addon/merge/merge.js#L167-L185 | train |
jsbin/jsbin | public/js/vendor/codemirror3/addon/merge/merge.js | drawConnectors | function drawConnectors(dv) {
if (!dv.showDifferences) return;
if (dv.svg) {
clear(dv.svg);
var w = dv.gap.offsetWidth;
attrs(dv.svg, "width", w, "height", dv.gap.offsetHeight);
}
clear(dv.copyButtons);
var flip = dv.type == "left";
var vpEdit = dv.edit.getViewport(), vpOrig ... | javascript | function drawConnectors(dv) {
if (!dv.showDifferences) return;
if (dv.svg) {
clear(dv.svg);
var w = dv.gap.offsetWidth;
attrs(dv.svg, "width", w, "height", dv.gap.offsetHeight);
}
clear(dv.copyButtons);
var flip = dv.type == "left";
var vpEdit = dv.edit.getViewport(), vpOrig ... | [
"function",
"drawConnectors",
"(",
"dv",
")",
"{",
"if",
"(",
"!",
"dv",
".",
"showDifferences",
")",
"return",
";",
"if",
"(",
"dv",
".",
"svg",
")",
"{",
"clear",
"(",
"dv",
".",
"svg",
")",
";",
"var",
"w",
"=",
"dv",
".",
"gap",
".",
"offse... | Updating the gap between editor and original | [
"Updating",
"the",
"gap",
"between",
"editor",
"and",
"original"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/addon/merge/merge.js#L234-L270 | train |
jsbin/jsbin | lib/handlers/bin.js | function(bin) {
var binSettings = {};
// self defence against muppertary
if (typeof bin.settings === 'string') {
try {
binSettings = JSON.parse(bin.settings);
} catch (e) {}
} else {
binSettings = bin.settings;
}
if (
binSettings &&
binSettings.processors ... | javascript | function(bin) {
var binSettings = {};
// self defence against muppertary
if (typeof bin.settings === 'string') {
try {
binSettings = JSON.parse(bin.settings);
} catch (e) {}
} else {
binSettings = bin.settings;
}
if (
binSettings &&
binSettings.processors ... | [
"function",
"(",
"bin",
")",
"{",
"var",
"binSettings",
"=",
"{",
"}",
";",
"// self defence against muppertary",
"if",
"(",
"typeof",
"bin",
".",
"settings",
"===",
"'string'",
")",
"{",
"try",
"{",
"binSettings",
"=",
"JSON",
".",
"parse",
"(",
"bin",
... | applies the processors to the bin and generates the html, js, etc based on the appropriate processor. Used in the previews and the API requests. | [
"applies",
"the",
"processors",
"to",
"the",
"bin",
"and",
"generates",
"the",
"html",
"js",
"etc",
"based",
"on",
"the",
"appropriate",
"processor",
".",
"Used",
"in",
"the",
"previews",
"and",
"the",
"API",
"requests",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/handlers/bin.js#L1674-L1736 | train | |
jsbin/jsbin | public/js/embed.js | getLinks | function getLinks() {
var links = [], alllinks, i = 0, length;
alllinks = document.getElementsByTagName('a');
length = alllinks.length;
for (; i < length; i++) {
if ((' ' + alllinks[i].className).indexOf(' jsbin-') !== -1) {
links.push(alllinks[i]);
}
}
return links;
} | javascript | function getLinks() {
var links = [], alllinks, i = 0, length;
alllinks = document.getElementsByTagName('a');
length = alllinks.length;
for (; i < length; i++) {
if ((' ' + alllinks[i].className).indexOf(' jsbin-') !== -1) {
links.push(alllinks[i]);
}
}
return links;
} | [
"function",
"getLinks",
"(",
")",
"{",
"var",
"links",
"=",
"[",
"]",
",",
"alllinks",
",",
"i",
"=",
"0",
",",
"length",
";",
"alllinks",
"=",
"document",
".",
"getElementsByTagName",
"(",
"'a'",
")",
";",
"length",
"=",
"alllinks",
".",
"length",
"... | 1. find all links with class=jsbin | [
"1",
".",
"find",
"all",
"links",
"with",
"class",
"=",
"jsbin"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/embed.js#L105-L116 | train |
jsbin/jsbin | public/js/vendor/jshint/jshint.js | peek | function peek(p) {
var i = p || 0, j = 0, t;
while (j <= i) {
t = lookahead[j];
if (!t) {
t = lookahead[j] = lex.token();
}
j += 1;
}
return t;
} | javascript | function peek(p) {
var i = p || 0, j = 0, t;
while (j <= i) {
t = lookahead[j];
if (!t) {
t = lookahead[j] = lex.token();
}
j += 1;
}
return t;
} | [
"function",
"peek",
"(",
"p",
")",
"{",
"var",
"i",
"=",
"p",
"||",
"0",
",",
"j",
"=",
"0",
",",
"t",
";",
"while",
"(",
"j",
"<=",
"i",
")",
"{",
"t",
"=",
"lookahead",
"[",
"j",
"]",
";",
"if",
"(",
"!",
"t",
")",
"{",
"t",
"=",
"l... | We need a peek function. If it has an argument, it peeks that much farther ahead. It is used to distinguish for ( var i in ... from for ( var i = ... | [
"We",
"need",
"a",
"peek",
"function",
".",
"If",
"it",
"has",
"an",
"argument",
"it",
"peeks",
"that",
"much",
"farther",
"ahead",
".",
"It",
"is",
"used",
"to",
"distinguish",
"for",
"(",
"var",
"i",
"in",
"...",
"from",
"for",
"(",
"var",
"i",
"... | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/jshint/jshint.js#L53595-L53606 | train |
jsbin/jsbin | public/js/vendor/jshint/jshint.js | nobreaknonadjacent | function nobreaknonadjacent(left, right) {
left = left || state.tokens.curr;
right = right || state.tokens.next;
if (!state.option.laxbreak && left.line !== right.line) {
warning("W014", right, right.value);
}
} | javascript | function nobreaknonadjacent(left, right) {
left = left || state.tokens.curr;
right = right || state.tokens.next;
if (!state.option.laxbreak && left.line !== right.line) {
warning("W014", right, right.value);
}
} | [
"function",
"nobreaknonadjacent",
"(",
"left",
",",
"right",
")",
"{",
"left",
"=",
"left",
"||",
"state",
".",
"tokens",
".",
"curr",
";",
"right",
"=",
"right",
"||",
"state",
".",
"tokens",
".",
"next",
";",
"if",
"(",
"!",
"state",
".",
"option",... | Functions for conformance of style. | [
"Functions",
"for",
"conformance",
"of",
"style",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/jshint/jshint.js#L53795-L53801 | train |
jsbin/jsbin | public/js/vendor/jshint/jshint.js | identifier | function identifier(fnparam, prop) {
var i = optionalidentifier(fnparam, prop);
if (i) {
return i;
}
if (state.tokens.curr.id === "function" && state.tokens.next.id === "(") {
warning("W025");
} else {
error("E030", state.tokens.next, state.tokens.next.value);
}
} | javascript | function identifier(fnparam, prop) {
var i = optionalidentifier(fnparam, prop);
if (i) {
return i;
}
if (state.tokens.curr.id === "function" && state.tokens.next.id === "(") {
warning("W025");
} else {
error("E030", state.tokens.next, state.tokens.next.value);
}
} | [
"function",
"identifier",
"(",
"fnparam",
",",
"prop",
")",
"{",
"var",
"i",
"=",
"optionalidentifier",
"(",
"fnparam",
",",
"prop",
")",
";",
"if",
"(",
"i",
")",
"{",
"return",
"i",
";",
"}",
"if",
"(",
"state",
".",
"tokens",
".",
"curr",
".",
... | fnparam means that this identifier is being defined as a function argument prop means that this identifier is that of an object property | [
"fnparam",
"means",
"that",
"this",
"identifier",
"is",
"being",
"defined",
"as",
"a",
"function",
"argument",
"prop",
"means",
"that",
"this",
"identifier",
"is",
"that",
"of",
"an",
"object",
"property"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/jshint/jshint.js#L54267-L54277 | train |
jsbin/jsbin | public/js/vendor/jshint/jshint.js | function () {
var pn, pn1;
var i = -1;
var bracketStack = 0;
var ret = {};
if (_.contains(["[", "{"], state.tokens.curr.value))
bracketStack += 1;
do {
pn = (i === -1) ? state.tokens.next : peek(i);
pn1 = peek(i + 1);
i = i + 1;
if (_.contains(["[", "{"], pn.value))... | javascript | function () {
var pn, pn1;
var i = -1;
var bracketStack = 0;
var ret = {};
if (_.contains(["[", "{"], state.tokens.curr.value))
bracketStack += 1;
do {
pn = (i === -1) ? state.tokens.next : peek(i);
pn1 = peek(i + 1);
i = i + 1;
if (_.contains(["[", "{"], pn.value))... | [
"function",
"(",
")",
"{",
"var",
"pn",
",",
"pn1",
";",
"var",
"i",
"=",
"-",
"1",
";",
"var",
"bracketStack",
"=",
"0",
";",
"var",
"ret",
"=",
"{",
"}",
";",
"if",
"(",
"_",
".",
"contains",
"(",
"[",
"\"[\"",
",",
"\"{\"",
"]",
",",
"st... | this function is used to determine wether a squarebracket or a curlybracket expression is a comprehension array, destructuring assignment or a json value. | [
"this",
"function",
"is",
"used",
"to",
"determine",
"wether",
"a",
"squarebracket",
"or",
"a",
"curlybracket",
"expression",
"is",
"a",
"comprehension",
"array",
"destructuring",
"assignment",
"or",
"a",
"json",
"value",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/jshint/jshint.js#L56974-L57006 | train | |
jsbin/jsbin | public/js/vendor/jshint/jshint.js | commentToken | function commentToken(label, body, opt) {
var special = ["jshint", "jslint", "members", "member", "globals", "global", "exported"];
var isSpecial = false;
var value = label + body;
var commentType = "plain";
opt = opt || {};
if (opt.isMultiline) {
value += "*/";
}
... | javascript | function commentToken(label, body, opt) {
var special = ["jshint", "jslint", "members", "member", "globals", "global", "exported"];
var isSpecial = false;
var value = label + body;
var commentType = "plain";
opt = opt || {};
if (opt.isMultiline) {
value += "*/";
}
... | [
"function",
"commentToken",
"(",
"label",
",",
"body",
",",
"opt",
")",
"{",
"var",
"special",
"=",
"[",
"\"jshint\"",
",",
"\"jslint\"",
",",
"\"members\"",
",",
"\"member\"",
",",
"\"globals\"",
",",
"\"global\"",
",",
"\"exported\"",
"]",
";",
"var",
"i... | Create a comment token object and make sure it has all the data JSHint needs to work with special comments. | [
"Create",
"a",
"comment",
"token",
"object",
"and",
"make",
"sure",
"it",
"has",
"all",
"the",
"data",
"JSHint",
"needs",
"to",
"work",
"with",
"special",
"comments",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/jshint/jshint.js#L58134-L58193 | train |
jsbin/jsbin | public/js/vendor/beautify/beautify.js | split_newlines | function split_newlines(s) {
//return s.split(/\x0d\x0a|\x0a/);
s = s.replace(/\x0d/g, '');
var out = [],
idx = s.indexOf("\n");
while (idx !== -1) {
out.push(s.substring(0, idx));
s = s.substring(idx + 1);
... | javascript | function split_newlines(s) {
//return s.split(/\x0d\x0a|\x0a/);
s = s.replace(/\x0d/g, '');
var out = [],
idx = s.indexOf("\n");
while (idx !== -1) {
out.push(s.substring(0, idx));
s = s.substring(idx + 1);
... | [
"function",
"split_newlines",
"(",
"s",
")",
"{",
"//return s.split(/\\x0d\\x0a|\\x0a/);",
"s",
"=",
"s",
".",
"replace",
"(",
"/",
"\\x0d",
"/",
"g",
",",
"''",
")",
";",
"var",
"out",
"=",
"[",
"]",
",",
"idx",
"=",
"s",
".",
"indexOf",
"(",
"\"\\n... | we could use just string.split, but IE doesn't like returning empty strings | [
"we",
"could",
"use",
"just",
"string",
".",
"split",
"but",
"IE",
"doesn",
"t",
"like",
"returning",
"empty",
"strings"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/beautify/beautify.js#L382-L397 | train |
jsbin/jsbin | lib/stripe/handlers/index.js | function (req, res) {
var event = req.stripeEvent;
var data = event.data.object;
// takes care of unexpected event types
var transactionMethod = stripeTransactions[event.type] || stripeTransactions.unhandled;
transactionMethod(req, data, function (err){
if ( !err ) {
r... | javascript | function (req, res) {
var event = req.stripeEvent;
var data = event.data.object;
// takes care of unexpected event types
var transactionMethod = stripeTransactions[event.type] || stripeTransactions.unhandled;
transactionMethod(req, data, function (err){
if ( !err ) {
r... | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"event",
"=",
"req",
".",
"stripeEvent",
";",
"var",
"data",
"=",
"event",
".",
"data",
".",
"object",
";",
"// takes care of unexpected event types",
"var",
"transactionMethod",
"=",
"stripeTransactions",
"... | stripe sent us a webhook, so respond appropriately | [
"stripe",
"sent",
"us",
"a",
"webhook",
"so",
"respond",
"appropriately"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/stripe/handlers/index.js#L47-L65 | train | |
jsbin/jsbin | public/js/render/live.js | function (requested) {
// No postMessage? Don't render – the event-stream will handle it.
if (!window.postMessage) { return; }
// Inform other pages event streaming render to reload
if (requested) {
sendReload();
jsbin.state.hasBody = false;
}
getPreparedCode().then(function (source... | javascript | function (requested) {
// No postMessage? Don't render – the event-stream will handle it.
if (!window.postMessage) { return; }
// Inform other pages event streaming render to reload
if (requested) {
sendReload();
jsbin.state.hasBody = false;
}
getPreparedCode().then(function (source... | [
"function",
"(",
"requested",
")",
"{",
"// No postMessage? Don't render – the event-stream will handle it.",
"if",
"(",
"!",
"window",
".",
"postMessage",
")",
"{",
"return",
";",
"}",
"// Inform other pages event streaming render to reload",
"if",
"(",
"requested",
")",
... | The big daddy that handles postmessaging the runner. | [
"The",
"big",
"daddy",
"that",
"handles",
"postmessaging",
"the",
"runner",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/render/live.js#L365-L402 | train | |
jsbin/jsbin | public/js/vendor/codemirror3/addon/tern/tern.js | updateArgHints | function updateArgHints(ts, cm) {
closeArgHints(ts);
if (cm.somethingSelected()) return;
var state = cm.getTokenAt(cm.getCursor()).state;
var inner = CodeMirror.innerMode(cm.getMode(), state);
if (inner.mode.name != "javascript") return;
var lex = inner.state.lexical;
if (lex.info != "call"... | javascript | function updateArgHints(ts, cm) {
closeArgHints(ts);
if (cm.somethingSelected()) return;
var state = cm.getTokenAt(cm.getCursor()).state;
var inner = CodeMirror.innerMode(cm.getMode(), state);
if (inner.mode.name != "javascript") return;
var lex = inner.state.lexical;
if (lex.info != "call"... | [
"function",
"updateArgHints",
"(",
"ts",
",",
"cm",
")",
"{",
"closeArgHints",
"(",
"ts",
")",
";",
"if",
"(",
"cm",
".",
"somethingSelected",
"(",
")",
")",
"return",
";",
"var",
"state",
"=",
"cm",
".",
"getTokenAt",
"(",
"cm",
".",
"getCursor",
"(... | Maintaining argument hints | [
"Maintaining",
"argument",
"hints"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/addon/tern/tern.js#L246-L286 | train |
jsbin/jsbin | public/js/vendor/codemirror3/addon/tern/tern.js | buildRequest | function buildRequest(ts, doc, query, pos) {
var files = [], offsetLines = 0, allowFragments = !query.fullDocs;
if (!allowFragments) delete query.fullDocs;
if (typeof query == "string") query = {type: query};
query.lineCharPositions = true;
if (query.end == null) {
query.end = pos || doc.doc.g... | javascript | function buildRequest(ts, doc, query, pos) {
var files = [], offsetLines = 0, allowFragments = !query.fullDocs;
if (!allowFragments) delete query.fullDocs;
if (typeof query == "string") query = {type: query};
query.lineCharPositions = true;
if (query.end == null) {
query.end = pos || doc.doc.g... | [
"function",
"buildRequest",
"(",
"ts",
",",
"doc",
",",
"query",
",",
"pos",
")",
"{",
"var",
"files",
"=",
"[",
"]",
",",
"offsetLines",
"=",
"0",
",",
"allowFragments",
"=",
"!",
"query",
".",
"fullDocs",
";",
"if",
"(",
"!",
"allowFragments",
")",... | Generic request-building helper | [
"Generic",
"request",
"-",
"building",
"helper"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/addon/tern/tern.js#L455-L495 | train |
jsbin/jsbin | public/js/spike.js | stringify | function stringify(o, simple) {
var json = '', i, type = ({}).toString.call(o), parts = [], names = [];
if (type == '[object String]') {
json = '"' + o.replace(/\n/g, '\\n').replace(/"/g, '\\"') + '"';
} else if (type == '[object Array]') {
json = '[';
for (i = 0; i < o.length; i++) {
... | javascript | function stringify(o, simple) {
var json = '', i, type = ({}).toString.call(o), parts = [], names = [];
if (type == '[object String]') {
json = '"' + o.replace(/\n/g, '\\n').replace(/"/g, '\\"') + '"';
} else if (type == '[object Array]') {
json = '[';
for (i = 0; i < o.length; i++) {
... | [
"function",
"stringify",
"(",
"o",
",",
"simple",
")",
"{",
"var",
"json",
"=",
"''",
",",
"i",
",",
"type",
"=",
"(",
"{",
"}",
")",
".",
"toString",
".",
"call",
"(",
"o",
")",
",",
"parts",
"=",
"[",
"]",
",",
"names",
"=",
"[",
"]",
";"... | from console.js | [
"from",
"console",
".",
"js"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/spike.js#L28-L76 | train |
jsbin/jsbin | public/js/spike.js | function (rawData) {
var data = stringify(rawData);
if (useSS) {
sessionStorage.spike = data;
} else {
window.name = data;
}
return data;
} | javascript | function (rawData) {
var data = stringify(rawData);
if (useSS) {
sessionStorage.spike = data;
} else {
window.name = data;
}
return data;
} | [
"function",
"(",
"rawData",
")",
"{",
"var",
"data",
"=",
"stringify",
"(",
"rawData",
")",
";",
"if",
"(",
"useSS",
")",
"{",
"sessionStorage",
".",
"spike",
"=",
"data",
";",
"}",
"else",
"{",
"window",
".",
"name",
"=",
"data",
";",
"}",
"return... | Save data to SS or window.name | [
"Save",
"data",
"to",
"SS",
"or",
"window",
".",
"name"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/spike.js#L109-L117 | train | |
jsbin/jsbin | public/js/spike.js | function () {
var rawData = useSS ? sessionStorage.spike : window.name, data;
if ((!useSS && window.name == 1) || !rawData) return data;
try {
// sketchy, but doesn't rely on native json support which might be a
// problem in old mobiles
eval('data = ' + rawData);
... | javascript | function () {
var rawData = useSS ? sessionStorage.spike : window.name, data;
if ((!useSS && window.name == 1) || !rawData) return data;
try {
// sketchy, but doesn't rely on native json support which might be a
// problem in old mobiles
eval('data = ' + rawData);
... | [
"function",
"(",
")",
"{",
"var",
"rawData",
"=",
"useSS",
"?",
"sessionStorage",
".",
"spike",
":",
"window",
".",
"name",
",",
"data",
";",
"if",
"(",
"(",
"!",
"useSS",
"&&",
"window",
".",
"name",
"==",
"1",
")",
"||",
"!",
"rawData",
")",
"r... | Get data back from SS or window.name | [
"Get",
"data",
"back",
"from",
"SS",
"or",
"window",
".",
"name"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/spike.js#L121-L130 | train | |
jsbin/jsbin | public/js/spike.js | restore | function restore() {
var data = store.get() || {};
addEvent('load', function () {
//console.log('scrolling to', data.y);
window.scrollTo(data.x, data.y);
});
} | javascript | function restore() {
var data = store.get() || {};
addEvent('load', function () {
//console.log('scrolling to', data.y);
window.scrollTo(data.x, data.y);
});
} | [
"function",
"restore",
"(",
")",
"{",
"var",
"data",
"=",
"store",
".",
"get",
"(",
")",
"||",
"{",
"}",
";",
"addEvent",
"(",
"'load'",
",",
"function",
"(",
")",
"{",
"//console.log('scrolling to', data.y);",
"window",
".",
"scrollTo",
"(",
"data",
"."... | Restore data from sessionStorage or the window.name when page is reloaded. | [
"Restore",
"data",
"from",
"sessionStorage",
"or",
"the",
"window",
".",
"name",
"when",
"page",
"is",
"reloaded",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/spike.js#L137-L143 | train |
jsbin/jsbin | public/js/vendor/acorn/util/walk.js | makeScope | function makeScope(prev, isCatch) {
return {vars: Object.create(null), prev: prev, isCatch: isCatch};
} | javascript | function makeScope(prev, isCatch) {
return {vars: Object.create(null), prev: prev, isCatch: isCatch};
} | [
"function",
"makeScope",
"(",
"prev",
",",
"isCatch",
")",
"{",
"return",
"{",
"vars",
":",
"Object",
".",
"create",
"(",
"null",
")",
",",
"prev",
":",
"prev",
",",
"isCatch",
":",
"isCatch",
"}",
";",
"}"
] | A custom walker that keeps track of the scope chain and the variables defined in it. | [
"A",
"custom",
"walker",
"that",
"keeps",
"track",
"of",
"the",
"scope",
"chain",
"and",
"the",
"variables",
"defined",
"in",
"it",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/acorn/util/walk.js#L275-L277 | train |
jsbin/jsbin | public/js/editors/panel.js | function(cm) {
if (CodeMirror.snippets(cm) === CodeMirror.Pass) {
return CodeMirror.simpleHint(cm, CodeMirror.hint.javascript);
}
} | javascript | function(cm) {
if (CodeMirror.snippets(cm) === CodeMirror.Pass) {
return CodeMirror.simpleHint(cm, CodeMirror.hint.javascript);
}
} | [
"function",
"(",
"cm",
")",
"{",
"if",
"(",
"CodeMirror",
".",
"snippets",
"(",
"cm",
")",
"===",
"CodeMirror",
".",
"Pass",
")",
"{",
"return",
"CodeMirror",
".",
"simpleHint",
"(",
"cm",
",",
"CodeMirror",
".",
"hint",
".",
"javascript",
")",
";",
... | Save a reference to this autocomplete function to use it when Tern scripts are loaded but not used, since they will automatically overwrite the CodeMirror autocomplete function with CodeMirror.showHint | [
"Save",
"a",
"reference",
"to",
"this",
"autocomplete",
"function",
"to",
"use",
"it",
"when",
"Tern",
"scripts",
"are",
"loaded",
"but",
"not",
"used",
"since",
"they",
"will",
"automatically",
"overwrite",
"the",
"CodeMirror",
"autocomplete",
"function",
"with... | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/editors/panel.js#L38-L42 | train | |
rickbergfalk/sqlpad | server/drivers/presto/_presto.js | getHeaders | function getHeaders(config) {
const headers = { 'X-Presto-User': config.user };
if (config.catalog) {
headers['X-Presto-Catalog'] = config.catalog;
}
if (config.schema) {
headers['X-Presto-Schema'] = config.schema;
}
return headers;
} | javascript | function getHeaders(config) {
const headers = { 'X-Presto-User': config.user };
if (config.catalog) {
headers['X-Presto-Catalog'] = config.catalog;
}
if (config.schema) {
headers['X-Presto-Schema'] = config.schema;
}
return headers;
} | [
"function",
"getHeaders",
"(",
"config",
")",
"{",
"const",
"headers",
"=",
"{",
"'X-Presto-User'",
":",
"config",
".",
"user",
"}",
";",
"if",
"(",
"config",
".",
"catalog",
")",
"{",
"headers",
"[",
"'X-Presto-Catalog'",
"]",
"=",
"config",
".",
"catal... | Get Presto headers from config | [
"Get",
"Presto",
"headers",
"from",
"config"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/presto/_presto.js#L12-L21 | train |
rickbergfalk/sqlpad | server/drivers/presto/_presto.js | send | function send(config, query) {
if (!config.url) {
return Promise.reject(new Error('config.url is required'));
}
const results = {
data: []
};
return fetch(`${config.url}/v1/statement`, {
method: 'POST',
body: query,
headers: getHeaders(config)
})
.then(response => response.json())
... | javascript | function send(config, query) {
if (!config.url) {
return Promise.reject(new Error('config.url is required'));
}
const results = {
data: []
};
return fetch(`${config.url}/v1/statement`, {
method: 'POST',
body: query,
headers: getHeaders(config)
})
.then(response => response.json())
... | [
"function",
"send",
"(",
"config",
",",
"query",
")",
"{",
"if",
"(",
"!",
"config",
".",
"url",
")",
"{",
"return",
"Promise",
".",
"reject",
"(",
"new",
"Error",
"(",
"'config.url is required'",
")",
")",
";",
"}",
"const",
"results",
"=",
"{",
"da... | Given config and query, returns promise with the results | [
"Given",
"config",
"and",
"query",
"returns",
"promise",
"with",
"the",
"results"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/presto/_presto.js#L24-L38 | train |
rickbergfalk/sqlpad | server/drivers/cassandra/index.js | getSchema | function getSchema(connection) {
connection.maxRows = 1000000;
return runQuery(SCHEMA_SQL, connection).then(queryResult =>
formatSchemaQueryResults(queryResult)
);
} | javascript | function getSchema(connection) {
connection.maxRows = 1000000;
return runQuery(SCHEMA_SQL, connection).then(queryResult =>
formatSchemaQueryResults(queryResult)
);
} | [
"function",
"getSchema",
"(",
"connection",
")",
"{",
"connection",
".",
"maxRows",
"=",
"1000000",
";",
"return",
"runQuery",
"(",
"SCHEMA_SQL",
",",
"connection",
")",
".",
"then",
"(",
"queryResult",
"=>",
"formatSchemaQueryResults",
"(",
"queryResult",
")",
... | Get schema for connection
Cassandra driver doesn't accept MAX_SAFE_INTEGER as a fetch limit so we default to one million
@param {*} connection | [
"Get",
"schema",
"for",
"connection",
"Cassandra",
"driver",
"doesn",
"t",
"accept",
"MAX_SAFE_INTEGER",
"as",
"a",
"fetch",
"limit",
"so",
"we",
"default",
"to",
"one",
"million"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/cassandra/index.js#L83-L88 | train |
rickbergfalk/sqlpad | server/lib/migrate-schema.js | runMigrations | function runMigrations(db, currentVersion) {
return new Promise((resolve, reject) => {
const nextVersion = currentVersion + 1;
if (!migrations[nextVersion]) {
return resolve();
}
if (debug) {
console.log('Migrating schema to v%d', nextVersion);
}
migrations[nextVersion](db)
... | javascript | function runMigrations(db, currentVersion) {
return new Promise((resolve, reject) => {
const nextVersion = currentVersion + 1;
if (!migrations[nextVersion]) {
return resolve();
}
if (debug) {
console.log('Migrating schema to v%d', nextVersion);
}
migrations[nextVersion](db)
... | [
"function",
"runMigrations",
"(",
"db",
",",
"currentVersion",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"nextVersion",
"=",
"currentVersion",
"+",
"1",
";",
"if",
"(",
"!",
"migrations",
"[",
"nex... | Run migrations until latest version
@param {*} db
@param {*} currentVersion
@returns {Promise} | [
"Run",
"migrations",
"until",
"latest",
"version"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/lib/migrate-schema.js#L68-L92 | train |
rickbergfalk/sqlpad | server/drivers/index.js | validateFunction | function validateFunction(path, driver, functionName) {
if (typeof driver[functionName] !== 'function') {
console.error(`${path} missing .${functionName}() implementation`);
process.exit(1);
}
} | javascript | function validateFunction(path, driver, functionName) {
if (typeof driver[functionName] !== 'function') {
console.error(`${path} missing .${functionName}() implementation`);
process.exit(1);
}
} | [
"function",
"validateFunction",
"(",
"path",
",",
"driver",
",",
"functionName",
")",
"{",
"if",
"(",
"typeof",
"driver",
"[",
"functionName",
"]",
"!==",
"'function'",
")",
"{",
"console",
".",
"error",
"(",
"`",
"${",
"path",
"}",
"${",
"functionName",
... | Validate that the driver implementation has a function by name provided
@param {string} path
@param {object} driver
@param {string} functionName | [
"Validate",
"that",
"the",
"driver",
"implementation",
"has",
"a",
"function",
"by",
"name",
"provided"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/index.js#L14-L19 | train |
rickbergfalk/sqlpad | server/drivers/index.js | validateArray | function validateArray(path, driver, arrayName) {
const arr = driver[arrayName];
if (!Array.isArray(arr)) {
console.error(`${path} missing ${arrayName} array`);
process.exit(1);
}
} | javascript | function validateArray(path, driver, arrayName) {
const arr = driver[arrayName];
if (!Array.isArray(arr)) {
console.error(`${path} missing ${arrayName} array`);
process.exit(1);
}
} | [
"function",
"validateArray",
"(",
"path",
",",
"driver",
",",
"arrayName",
")",
"{",
"const",
"arr",
"=",
"driver",
"[",
"arrayName",
"]",
";",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"arr",
")",
")",
"{",
"console",
".",
"error",
"(",
"`",
"... | Validate that the driver implementation has an array by name provided
@param {string} path
@param {object} driver
@param {string} arrayName | [
"Validate",
"that",
"the",
"driver",
"implementation",
"has",
"an",
"array",
"by",
"name",
"provided"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/index.js#L27-L33 | train |
rickbergfalk/sqlpad | server/drivers/index.js | requireValidate | function requireValidate(path, optional = false) {
let driver;
try {
driver = require(path);
} catch (er) {
if (optional) {
console.log('optional driver ' + path + ' not available');
return;
} else {
// rethrow
throw er;
}
}
if (!driver.id) {
console.error(`${path... | javascript | function requireValidate(path, optional = false) {
let driver;
try {
driver = require(path);
} catch (er) {
if (optional) {
console.log('optional driver ' + path + ' not available');
return;
} else {
// rethrow
throw er;
}
}
if (!driver.id) {
console.error(`${path... | [
"function",
"requireValidate",
"(",
"path",
",",
"optional",
"=",
"false",
")",
"{",
"let",
"driver",
";",
"try",
"{",
"driver",
"=",
"require",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"er",
")",
"{",
"if",
"(",
"optional",
")",
"{",
"console",
"... | Require driver implementation for provided path
and validate that it meets implementation spec as possible
@param {string} path | [
"Require",
"driver",
"implementation",
"for",
"provided",
"path",
"and",
"validate",
"that",
"it",
"meets",
"implementation",
"spec",
"as",
"possible"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/index.js#L40-L83 | train |
rickbergfalk/sqlpad | server/drivers/index.js | runQuery | function runQuery(query, connection, user) {
const driver = drivers[connection.driver];
const queryResult = {
id: uuid.v4(),
cacheKey: null,
startTime: new Date(),
stopTime: null,
queryRunTime: null,
fields: [],
incomplete: false,
meta: {},
rows: []
};
return driver.runQuer... | javascript | function runQuery(query, connection, user) {
const driver = drivers[connection.driver];
const queryResult = {
id: uuid.v4(),
cacheKey: null,
startTime: new Date(),
stopTime: null,
queryRunTime: null,
fields: [],
incomplete: false,
meta: {},
rows: []
};
return driver.runQuer... | [
"function",
"runQuery",
"(",
"query",
",",
"connection",
",",
"user",
")",
"{",
"const",
"driver",
"=",
"drivers",
"[",
"connection",
".",
"driver",
"]",
";",
"const",
"queryResult",
"=",
"{",
"id",
":",
"uuid",
".",
"v4",
"(",
")",
",",
"cacheKey",
... | Run query using driver implementation of connection
@param {*} query
@param {*} connection
@param {object} [user] user may not be provided if chart links turned on
@returns {Promise} | [
"Run",
"query",
"using",
"driver",
"implementation",
"of",
"connection"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/index.js#L109-L158 | train |
rickbergfalk/sqlpad | server/drivers/index.js | getDrivers | function getDrivers() {
return Object.keys(drivers).map(id => {
return {
id,
name: drivers[id].name,
fields: drivers[id].fields
};
});
} | javascript | function getDrivers() {
return Object.keys(drivers).map(id => {
return {
id,
name: drivers[id].name,
fields: drivers[id].fields
};
});
} | [
"function",
"getDrivers",
"(",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"drivers",
")",
".",
"map",
"(",
"id",
"=>",
"{",
"return",
"{",
"id",
",",
"name",
":",
"drivers",
"[",
"id",
"]",
".",
"name",
",",
"fields",
":",
"drivers",
"[",
"i... | Gets array of driver objects
@returns {array} drivers | [
"Gets",
"array",
"of",
"driver",
"objects"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/index.js#L187-L195 | train |
rickbergfalk/sqlpad | server/drivers/index.js | validateConnection | function validateConnection(connection) {
const coreFields = ['_id', 'name', 'driver', 'createdDate', 'modifiedDate'];
if (!connection.name) {
throw new Error('connection.name required');
}
if (!connection.driver) {
throw new Error('connection.driver required');
}
const driver = drivers[connection.d... | javascript | function validateConnection(connection) {
const coreFields = ['_id', 'name', 'driver', 'createdDate', 'modifiedDate'];
if (!connection.name) {
throw new Error('connection.name required');
}
if (!connection.driver) {
throw new Error('connection.driver required');
}
const driver = drivers[connection.d... | [
"function",
"validateConnection",
"(",
"connection",
")",
"{",
"const",
"coreFields",
"=",
"[",
"'_id'",
",",
"'name'",
",",
"'driver'",
",",
"'createdDate'",
",",
"'modifiedDate'",
"]",
";",
"if",
"(",
"!",
"connection",
".",
"name",
")",
"{",
"throw",
"n... | Validates connection object based on its driver
Unnecessary fields will be stripped out
@param {object} connection | [
"Validates",
"connection",
"object",
"based",
"on",
"its",
"driver",
"Unnecessary",
"fields",
"will",
"be",
"stripped",
"out"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/index.js#L202-L238 | train |
rickbergfalk/sqlpad | server/drivers/utils.js | formatSchemaQueryResults | function formatSchemaQueryResults(queryResult) {
if (!queryResult || !queryResult.rows || !queryResult.rows.length) {
return {};
}
// queryResult row casing may not always be consistent with what is specified in query
// HANA is always uppercase despire aliasing as lower case for example
// To account fo... | javascript | function formatSchemaQueryResults(queryResult) {
if (!queryResult || !queryResult.rows || !queryResult.rows.length) {
return {};
}
// queryResult row casing may not always be consistent with what is specified in query
// HANA is always uppercase despire aliasing as lower case for example
// To account fo... | [
"function",
"formatSchemaQueryResults",
"(",
"queryResult",
")",
"{",
"if",
"(",
"!",
"queryResult",
"||",
"!",
"queryResult",
".",
"rows",
"||",
"!",
"queryResult",
".",
"rows",
".",
"length",
")",
"{",
"return",
"{",
"}",
";",
"}",
"// queryResult row casi... | Formats schema query results into
a nested map of objects representing schema tree
@param {object} queryResult | [
"Formats",
"schema",
"query",
"results",
"into",
"a",
"nested",
"map",
"of",
"objects",
"representing",
"schema",
"tree"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/utils.js#L8-L51 | train |
rickbergfalk/sqlpad | server/drivers/utils.js | ensureBoolean | function ensureBoolean(value) {
if (typeof value === 'boolean') {
return value;
}
if (typeof value === 'string' && value.toLowerCase() === 'true') {
return true;
} else if (typeof value === 'string' && value.toLowerCase() === 'false') {
return false;
} else if (value === 1) {
return true;
} ... | javascript | function ensureBoolean(value) {
if (typeof value === 'boolean') {
return value;
}
if (typeof value === 'string' && value.toLowerCase() === 'true') {
return true;
} else if (typeof value === 'string' && value.toLowerCase() === 'false') {
return false;
} else if (value === 1) {
return true;
} ... | [
"function",
"ensureBoolean",
"(",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"===",
"'boolean'",
")",
"{",
"return",
"value",
";",
"}",
"if",
"(",
"typeof",
"value",
"===",
"'string'",
"&&",
"value",
".",
"toLowerCase",
"(",
")",
"===",
"'true'",
... | Clean value to boolean
If value is not a boolean or can't be converted, an error is thrown
This is probably unnecessary but more a precaution
@param {any} value | [
"Clean",
"value",
"to",
"boolean",
"If",
"value",
"is",
"not",
"a",
"boolean",
"or",
"can",
"t",
"be",
"converted",
"an",
"error",
"is",
"thrown",
"This",
"is",
"probably",
"unnecessary",
"but",
"more",
"a",
"precaution"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/drivers/utils.js#L59-L73 | train |
rickbergfalk/sqlpad | server/lib/getMeta.js | isNumeric | function isNumeric(value) {
if (_.isNumber(value)) {
return true;
}
if (_.isString(value)) {
if (!isFinite(value)) {
return false;
}
// str is a finite number, but not all number strings should be numbers
// If the string starts with 0, is more than 1 character, and does not have a perio... | javascript | function isNumeric(value) {
if (_.isNumber(value)) {
return true;
}
if (_.isString(value)) {
if (!isFinite(value)) {
return false;
}
// str is a finite number, but not all number strings should be numbers
// If the string starts with 0, is more than 1 character, and does not have a perio... | [
"function",
"isNumeric",
"(",
"value",
")",
"{",
"if",
"(",
"_",
".",
"isNumber",
"(",
"value",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"_",
".",
"isString",
"(",
"value",
")",
")",
"{",
"if",
"(",
"!",
"isFinite",
"(",
"value",
"... | Derive whether value is a number number or number as a string
If value is a string, it'll determine whether the string is numeric
Zero-padded number strings are not considered numeric
@param {*} value | [
"Derive",
"whether",
"value",
"is",
"a",
"number",
"number",
"or",
"number",
"as",
"a",
"string",
"If",
"value",
"is",
"a",
"string",
"it",
"ll",
"determine",
"whether",
"the",
"string",
"is",
"numeric",
"Zero",
"-",
"padded",
"number",
"strings",
"are",
... | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/lib/getMeta.js#L9-L27 | train |
rickbergfalk/sqlpad | server/lib/email.js | fullUrl | function fullUrl(path) {
const urlPort = port === 80 ? '' : ':' + port;
const urlPublicUrl = publicUrl;
const urlBaseUrl = baseUrl;
return `${urlPublicUrl}${urlPort}${urlBaseUrl}${path}`;
} | javascript | function fullUrl(path) {
const urlPort = port === 80 ? '' : ':' + port;
const urlPublicUrl = publicUrl;
const urlBaseUrl = baseUrl;
return `${urlPublicUrl}${urlPort}${urlBaseUrl}${path}`;
} | [
"function",
"fullUrl",
"(",
"path",
")",
"{",
"const",
"urlPort",
"=",
"port",
"===",
"80",
"?",
"''",
":",
"':'",
"+",
"port",
";",
"const",
"urlPublicUrl",
"=",
"publicUrl",
";",
"const",
"urlBaseUrl",
"=",
"baseUrl",
";",
"return",
"`",
"${",
"urlPu... | Get full sqlpad url
@param {string} path - path (leading slash) | [
"Get",
"full",
"sqlpad",
"url"
] | 84525a66a5480e9bffc559a1f34d59e1cea88d14 | https://github.com/rickbergfalk/sqlpad/blob/84525a66a5480e9bffc559a1f34d59e1cea88d14/server/lib/email.js#L10-L15 | train |
xiazeyu/live2d-widget.js | src/wpPublicPath.js | getCurrentPath | function getCurrentPath(){
try{
// FF, Chrome, Modern browsers
// use their API to get the path of current script
// a.b();
// console.log('wpStage1');
return document.currentScript.src;
if(DOC.currentScript){ // FF 4+
return DOC.currentScript.src;
}
}catch(e){
// docume... | javascript | function getCurrentPath(){
try{
// FF, Chrome, Modern browsers
// use their API to get the path of current script
// a.b();
// console.log('wpStage1');
return document.currentScript.src;
if(DOC.currentScript){ // FF 4+
return DOC.currentScript.src;
}
}catch(e){
// docume... | [
"function",
"getCurrentPath",
"(",
")",
"{",
"try",
"{",
"// FF, Chrome, Modern browsers",
"// use their API to get the path of current script",
"// a.b();",
"// console.log('wpStage1');",
"return",
"document",
".",
"currentScript",
".",
"src",
";",
"if",
"(",
"DOC",
".",
... | Get current script path
@return {String} The path of current script
@example
get 'file:///C:/git/live2d-widget/dev/bundle.js' or 'https://www.host.com/test/js/bundle.js' | [
"Get",
"current",
"script",
"path"
] | fa8f2d831a1a9e96cd85bd1ef593a3336aeac720 | https://github.com/xiazeyu/live2d-widget.js/blob/fa8f2d831a1a9e96cd85bd1ef593a3336aeac720/src/wpPublicPath.js#L15-L94 | train |
xiazeyu/live2d-widget.js | src/cLive2DApp.js | theRealInit | function theRealInit (){
createElement();
initEvent();
live2DMgr = new cManager(L2Dwidget)
dragMgr = new L2DTargetPoint();
let rect = currCanvas.getBoundingClientRect();
let ratio = rect.height / rect.width;
let left = cDefine.VIEW_LOGICAL_LEFT;
let right = cDefine.VIEW_LOGICAL_RIGHT;
let bottom = -... | javascript | function theRealInit (){
createElement();
initEvent();
live2DMgr = new cManager(L2Dwidget)
dragMgr = new L2DTargetPoint();
let rect = currCanvas.getBoundingClientRect();
let ratio = rect.height / rect.width;
let left = cDefine.VIEW_LOGICAL_LEFT;
let right = cDefine.VIEW_LOGICAL_RIGHT;
let bottom = -... | [
"function",
"theRealInit",
"(",
")",
"{",
"createElement",
"(",
")",
";",
"initEvent",
"(",
")",
";",
"live2DMgr",
"=",
"new",
"cManager",
"(",
"L2Dwidget",
")",
"dragMgr",
"=",
"new",
"L2DTargetPoint",
"(",
")",
";",
"let",
"rect",
"=",
"currCanvas",
".... | Main function of live2d-widget
@return {null} | [
"Main",
"function",
"of",
"live2d",
"-",
"widget"
] | fa8f2d831a1a9e96cd85bd1ef593a3336aeac720 | https://github.com/xiazeyu/live2d-widget.js/blob/fa8f2d831a1a9e96cd85bd1ef593a3336aeac720/src/cLive2DApp.js#L49-L88 | train |
xiazeyu/live2d-widget.js | src/elementMgr.js | createElement | function createElement() {
let e = document.getElementById(config.name.div)
if (e !== null) {
document.body.removeChild(e);
}
let newElem = document.createElement('div');
newElem.id = config.name.div;
newElem.className = 'live2d-widget-container';
newElem.style.setProperty('position', 'fixed');
ne... | javascript | function createElement() {
let e = document.getElementById(config.name.div)
if (e !== null) {
document.body.removeChild(e);
}
let newElem = document.createElement('div');
newElem.id = config.name.div;
newElem.className = 'live2d-widget-container';
newElem.style.setProperty('position', 'fixed');
ne... | [
"function",
"createElement",
"(",
")",
"{",
"let",
"e",
"=",
"document",
".",
"getElementById",
"(",
"config",
".",
"name",
".",
"div",
")",
"if",
"(",
"e",
"!==",
"null",
")",
"{",
"document",
".",
"body",
".",
"removeChild",
"(",
"e",
")",
";",
"... | Create the canvas and styles using DOM
@return {null} | [
"Create",
"the",
"canvas",
"and",
"styles",
"using",
"DOM"
] | fa8f2d831a1a9e96cd85bd1ef593a3336aeac720 | https://github.com/xiazeyu/live2d-widget.js/blob/fa8f2d831a1a9e96cd85bd1ef593a3336aeac720/src/elementMgr.js#L30-L71 | train |
xiazeyu/live2d-widget.js | src/elementMgr.js | initWebGL | function initWebGL() {
var NAMES = ['webgl2', 'webgl', 'experimental-webgl2', 'experimental-webgl', 'webkit-3d', 'moz-webgl'];
for (let i = 0; i < NAMES.length; i++) {
try {
let ctx = currCanvas.getContext(NAMES[i], {
alpha: true,
antialias: true,
premultipliedAlpha: true,
... | javascript | function initWebGL() {
var NAMES = ['webgl2', 'webgl', 'experimental-webgl2', 'experimental-webgl', 'webkit-3d', 'moz-webgl'];
for (let i = 0; i < NAMES.length; i++) {
try {
let ctx = currCanvas.getContext(NAMES[i], {
alpha: true,
antialias: true,
premultipliedAlpha: true,
... | [
"function",
"initWebGL",
"(",
")",
"{",
"var",
"NAMES",
"=",
"[",
"'webgl2'",
",",
"'webgl'",
",",
"'experimental-webgl2'",
",",
"'experimental-webgl'",
",",
"'webkit-3d'",
",",
"'moz-webgl'",
"]",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"N... | Find and set the current WebGL element to the container
@return {null} | [
"Find",
"and",
"set",
"the",
"current",
"WebGL",
"element",
"to",
"the",
"container"
] | fa8f2d831a1a9e96cd85bd1ef593a3336aeac720 | https://github.com/xiazeyu/live2d-widget.js/blob/fa8f2d831a1a9e96cd85bd1ef593a3336aeac720/src/elementMgr.js#L78-L99 | train |
NUKnightLab/TimelineJS3 | source/js/animation/TL.Animate.js | tween | function tween(duration, fn, done, ease, from, to) {
ease = fun(ease) ? ease : morpheus.easings[ease] || nativeTween
var time = duration || thousand
, self = this
, diff = to - from
, start = now()
, stop = 0
, end = 0
function run(t) {
var delta = t - start
if (de... | javascript | function tween(duration, fn, done, ease, from, to) {
ease = fun(ease) ? ease : morpheus.easings[ease] || nativeTween
var time = duration || thousand
, self = this
, diff = to - from
, start = now()
, stop = 0
, end = 0
function run(t) {
var delta = t - start
if (de... | [
"function",
"tween",
"(",
"duration",
",",
"fn",
",",
"done",
",",
"ease",
",",
"from",
",",
"to",
")",
"{",
"ease",
"=",
"fun",
"(",
"ease",
")",
"?",
"ease",
":",
"morpheus",
".",
"easings",
"[",
"ease",
"]",
"||",
"nativeTween",
"var",
"time",
... | Core tween method that requests each frame
@param duration: time in milliseconds. defaults to 1000
@param fn: tween frame callback function receiving 'position'
@param done {optional}: complete callback function
@param ease {optional}: easing method. defaults to easeOut
@param from {optional}: integer to start from
@pa... | [
"Core",
"tween",
"method",
"that",
"requests",
"each",
"frame"
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/animation/TL.Animate.js#L210-L243 | train |
NUKnightLab/TimelineJS3 | source/js/animation/TL.Animate.js | nextColor | function nextColor(pos, start, finish) {
var r = [], i, e, from, to
for (i = 0; i < 6; i++) {
from = Math.min(15, parseInt(start.charAt(i), 16))
to = Math.min(15, parseInt(finish.charAt(i), 16))
e = Math.floor((to - from) * pos + from)
e = e > 15 ? 15 : e < 0 ? 0 : e
r[i] = e.to... | javascript | function nextColor(pos, start, finish) {
var r = [], i, e, from, to
for (i = 0; i < 6; i++) {
from = Math.min(15, parseInt(start.charAt(i), 16))
to = Math.min(15, parseInt(finish.charAt(i), 16))
e = Math.floor((to - from) * pos + from)
e = e > 15 ? 15 : e < 0 ? 0 : e
r[i] = e.to... | [
"function",
"nextColor",
"(",
"pos",
",",
"start",
",",
"finish",
")",
"{",
"var",
"r",
"=",
"[",
"]",
",",
"i",
",",
"e",
",",
"from",
",",
"to",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"6",
";",
"i",
"++",
")",
"{",
"from",
"=",
"Math... | this gets you the next hex in line according to a 'position' | [
"this",
"gets",
"you",
"the",
"next",
"hex",
"in",
"line",
"according",
"to",
"a",
"position"
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/animation/TL.Animate.js#L270-L280 | train |
NUKnightLab/TimelineJS3 | source/js/animation/TL.Animate.js | getTweenVal | function getTweenVal(pos, units, begin, end, k, i, v) {
if (k == 'transform') {
v = {}
for (var t in begin[i][k]) {
v[t] = (t in end[i][k]) ? Math.round(((end[i][k][t] - begin[i][k][t]) * pos + begin[i][k][t]) * thousand) / thousand : begin[i][k][t]
}
return v
} else if (typeof b... | javascript | function getTweenVal(pos, units, begin, end, k, i, v) {
if (k == 'transform') {
v = {}
for (var t in begin[i][k]) {
v[t] = (t in end[i][k]) ? Math.round(((end[i][k][t] - begin[i][k][t]) * pos + begin[i][k][t]) * thousand) / thousand : begin[i][k][t]
}
return v
} else if (typeof b... | [
"function",
"getTweenVal",
"(",
"pos",
",",
"units",
",",
"begin",
",",
"end",
",",
"k",
",",
"i",
",",
"v",
")",
"{",
"if",
"(",
"k",
"==",
"'transform'",
")",
"{",
"v",
"=",
"{",
"}",
"for",
"(",
"var",
"t",
"in",
"begin",
"[",
"i",
"]",
... | this retreives the frame value within a sequence | [
"this",
"retreives",
"the",
"frame",
"value",
"within",
"a",
"sequence"
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/animation/TL.Animate.js#L283-L299 | train |
NUKnightLab/TimelineJS3 | source/js/animation/TL.Animate.js | by | function by(val, start, m, r, i) {
return (m = relVal.exec(val)) ?
(i = parseFloat(m[2])) && (start + (m[1] == '+' ? 1 : -1) * i) :
parseFloat(val)
} | javascript | function by(val, start, m, r, i) {
return (m = relVal.exec(val)) ?
(i = parseFloat(m[2])) && (start + (m[1] == '+' ? 1 : -1) * i) :
parseFloat(val)
} | [
"function",
"by",
"(",
"val",
",",
"start",
",",
"m",
",",
"r",
",",
"i",
")",
"{",
"return",
"(",
"m",
"=",
"relVal",
".",
"exec",
"(",
"val",
")",
")",
"?",
"(",
"i",
"=",
"parseFloat",
"(",
"m",
"[",
"2",
"]",
")",
")",
"&&",
"(",
"sta... | support for relative movement via '+=n' or '-=n' | [
"support",
"for",
"relative",
"movement",
"via",
"+",
"=",
"n",
"or",
"-",
"=",
"n"
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/animation/TL.Animate.js#L302-L306 | train |
NUKnightLab/TimelineJS3 | source/js/slider/TL.StorySlider.js | function() {
var _layout = this.options.layout;
for (var i = 0; i < this._slides.length; i++) {
this._slides[i].updateDisplay(this.options.width, this.options.height, _layout);
this._slides[i].setPosition({left:(this.slide_spacing * i), top:0});
};
this.goToId(this.current_id, true, false);
} | javascript | function() {
var _layout = this.options.layout;
for (var i = 0; i < this._slides.length; i++) {
this._slides[i].updateDisplay(this.options.width, this.options.height, _layout);
this._slides[i].setPosition({left:(this.slide_spacing * i), top:0});
};
this.goToId(this.current_id, true, false);
} | [
"function",
"(",
")",
"{",
"var",
"_layout",
"=",
"this",
".",
"options",
".",
"layout",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"_slides",
".",
"length",
";",
"i",
"++",
")",
"{",
"this",
".",
"_slides",
"[",
"i",
... | Reposition and redraw slides | [
"Reposition",
"and",
"redraw",
"slides"
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/slider/TL.StorySlider.js#L390-L399 | train | |
NUKnightLab/TimelineJS3 | source/js/core/TL.TimelineConfig.js | function(slide) {
var slide_id = slide.unique_id;
if (!TL.Util.trim(slide_id)) {
// give it an ID if it doesn't have one
slide_id = (slide.text) ? TL.Util.slugify(slide.text.headline) : null;
}
// make sure it's unique and add it.
slide.unique_id = TL.Util.ensureUniqueKey(this.event_dict,slide_id);
re... | javascript | function(slide) {
var slide_id = slide.unique_id;
if (!TL.Util.trim(slide_id)) {
// give it an ID if it doesn't have one
slide_id = (slide.text) ? TL.Util.slugify(slide.text.headline) : null;
}
// make sure it's unique and add it.
slide.unique_id = TL.Util.ensureUniqueKey(this.event_dict,slide_id);
re... | [
"function",
"(",
"slide",
")",
"{",
"var",
"slide_id",
"=",
"slide",
".",
"unique_id",
";",
"if",
"(",
"!",
"TL",
".",
"Util",
".",
"trim",
"(",
"slide_id",
")",
")",
"{",
"// give it an ID if it doesn't have one",
"slide_id",
"=",
"(",
"slide",
".",
"te... | Given a slide, verify that its ID is unique, or assign it one which is.
The assignment happens in this function, and the assigned ID is also
the return value. Not thread-safe, because ids are not reserved
when assigned here. | [
"Given",
"a",
"slide",
"verify",
"that",
"its",
"ID",
"is",
"unique",
"or",
"assign",
"it",
"one",
"which",
"is",
".",
"The",
"assignment",
"happens",
"in",
"this",
"function",
"and",
"the",
"assigned",
"ID",
"is",
"also",
"the",
"return",
"value",
".",
... | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/core/TL.TimelineConfig.js#L144-L153 | train | |
NUKnightLab/TimelineJS3 | source/js/core/TL.TimelineConfig.js | function() {
// counting that dates were sorted in initialization
var date = this.events[0].start_date;
if (this.eras && this.eras.length > 0) {
if (this.eras[0].start_date.isBefore(date)) {
return this.eras[0].start_date;
}
}
return date;
} | javascript | function() {
// counting that dates were sorted in initialization
var date = this.events[0].start_date;
if (this.eras && this.eras.length > 0) {
if (this.eras[0].start_date.isBefore(date)) {
return this.eras[0].start_date;
}
}
return date;
} | [
"function",
"(",
")",
"{",
"// counting that dates were sorted in initialization",
"var",
"date",
"=",
"this",
".",
"events",
"[",
"0",
"]",
".",
"start_date",
";",
"if",
"(",
"this",
".",
"eras",
"&&",
"this",
".",
"eras",
".",
"length",
">",
"0",
")",
... | Return the earliest date that this config knows about, whether it's a slide or an era | [
"Return",
"the",
"earliest",
"date",
"that",
"this",
"config",
"knows",
"about",
"whether",
"it",
"s",
"a",
"slide",
"or",
"an",
"era"
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/core/TL.TimelineConfig.js#L248-L258 | train | |
NUKnightLab/TimelineJS3 | source/js/core/TL.TimelineConfig.js | function() {
var dates = [];
for (var i = 0; i < this.events.length; i++) {
if (this.events[i].end_date) {
dates.push({ date: this.events[i].end_date });
} else {
dates.push({ date: this.events[i].start_date });
}
}
for (var i = 0; i < this.eras.length; i++) {
if (this.eras[i].end_date) {
... | javascript | function() {
var dates = [];
for (var i = 0; i < this.events.length; i++) {
if (this.events[i].end_date) {
dates.push({ date: this.events[i].end_date });
} else {
dates.push({ date: this.events[i].start_date });
}
}
for (var i = 0; i < this.eras.length; i++) {
if (this.eras[i].end_date) {
... | [
"function",
"(",
")",
"{",
"var",
"dates",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"events",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"events",
"[",
"i",
"]",
".",
"end_date"... | Return the latest date that this config knows about, whether it's a slide or an era, taking end_dates into account. | [
"Return",
"the",
"latest",
"date",
"that",
"this",
"config",
"knows",
"about",
"whether",
"it",
"s",
"a",
"slide",
"or",
"an",
"era",
"taking",
"end_dates",
"into",
"account",
"."
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/core/TL.TimelineConfig.js#L262-L280 | train | |
NUKnightLab/TimelineJS3 | source/js/core/TL.Util.js | function (/*Object*/ dest) /*-> Object*/ { // merge src properties into dest
var sources = Array.prototype.slice.call(arguments, 1);
for (var j = 0, len = sources.length, src; j < len; j++) {
src = sources[j] || {};
TL.Util.mergeData(dest, src);
}
return dest;
} | javascript | function (/*Object*/ dest) /*-> Object*/ { // merge src properties into dest
var sources = Array.prototype.slice.call(arguments, 1);
for (var j = 0, len = sources.length, src; j < len; j++) {
src = sources[j] || {};
TL.Util.mergeData(dest, src);
}
return dest;
} | [
"function",
"(",
"/*Object*/",
"dest",
")",
"/*-> Object*/",
"{",
"// merge src properties into dest",
"var",
"sources",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
";",
"for",
"(",
"var",
"j",
"=",
"0",
",",... | like TL.Util.mergeData but takes an arbitrarily long list of sources to merge. | [
"like",
"TL",
".",
"Util",
".",
"mergeData",
"but",
"takes",
"an",
"arbitrarily",
"long",
"list",
"of",
"sources",
"to",
"merge",
"."
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/core/TL.Util.js#L17-L24 | train | |
NUKnightLab/TimelineJS3 | source/js/core/TL.Load.js | load | function load(type, urls, callback, obj, context) {
var _finish = function () { finish(type); },
isCSS = type === 'css',
nodes = [],
i, len, node, p, pendingUrls, url;
env || getEnv();
if (urls) {
// If urls is a string, wrap it in an array. Otherwise assume it's an
... | javascript | function load(type, urls, callback, obj, context) {
var _finish = function () { finish(type); },
isCSS = type === 'css',
nodes = [],
i, len, node, p, pendingUrls, url;
env || getEnv();
if (urls) {
// If urls is a string, wrap it in an array. Otherwise assume it's an
... | [
"function",
"load",
"(",
"type",
",",
"urls",
",",
"callback",
",",
"obj",
",",
"context",
")",
"{",
"var",
"_finish",
"=",
"function",
"(",
")",
"{",
"finish",
"(",
"type",
")",
";",
"}",
",",
"isCSS",
"=",
"type",
"===",
"'css'",
",",
"nodes",
... | Loads the specified resources, or the next resource of the specified type
in the queue if no resources are specified. If a resource of the specified
type is already being loaded, the new request will be queued until the
first request has been finished.
When an array of resource URLs is specified, those URLs will be lo... | [
"Loads",
"the",
"specified",
"resources",
"or",
"the",
"next",
"resource",
"of",
"the",
"specified",
"type",
"in",
"the",
"queue",
"if",
"no",
"resources",
"are",
"specified",
".",
"If",
"a",
"resource",
"of",
"the",
"specified",
"type",
"is",
"already",
"... | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/core/TL.Load.js#L211-L312 | train |
NUKnightLab/TimelineJS3 | source/js/date/TL.Date.js | function(scale) {
var d = new Date(this.data.date_obj.getTime());
for (var i = 0; i < TL.Date.SCALES.length; i++) {
// for JS dates, we iteratively apply flooring functions
TL.Date.SCALES[i][2](d);
if (TL.Date.SCALES[i][0] == scale) return new TL.Date(d);
};
... | javascript | function(scale) {
var d = new Date(this.data.date_obj.getTime());
for (var i = 0; i < TL.Date.SCALES.length; i++) {
// for JS dates, we iteratively apply flooring functions
TL.Date.SCALES[i][2](d);
if (TL.Date.SCALES[i][0] == scale) return new TL.Date(d);
};
... | [
"function",
"(",
"scale",
")",
"{",
"var",
"d",
"=",
"new",
"Date",
"(",
"this",
".",
"data",
".",
"date_obj",
".",
"getTime",
"(",
")",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"TL",
".",
"Date",
".",
"SCALES",
".",
"length... | Return a new TL.Date which has been 'floored' at the given scale. @scale = string value from TL.Date.SCALES | [
"Return",
"a",
"new",
"TL",
".",
"Date",
"which",
"has",
"been",
"floored",
"at",
"the",
"given",
"scale",
"."
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/date/TL.Date.js#L82-L91 | train | |
NUKnightLab/TimelineJS3 | source/js/date/TL.Date.js | function(scale) {
for (var i = 0; i < TL.BigDate.SCALES.length; i++) {
if (TL.BigDate.SCALES[i][0] == scale) {
var floored = TL.BigDate.SCALES[i][2](this.data.date_obj);
return new TL.BigDate(floored);
}
};
throw new TL.Error("invalid_scal... | javascript | function(scale) {
for (var i = 0; i < TL.BigDate.SCALES.length; i++) {
if (TL.BigDate.SCALES[i][0] == scale) {
var floored = TL.BigDate.SCALES[i][2](this.data.date_obj);
return new TL.BigDate(floored);
}
};
throw new TL.Error("invalid_scal... | [
"function",
"(",
"scale",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"TL",
".",
"BigDate",
".",
"SCALES",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"TL",
".",
"BigDate",
".",
"SCALES",
"[",
"i",
"]",
"[",
"0",
"]",... | Return a new TL.BigDate which has been 'floored' at the given scale. @scale = string value from TL.BigDate.SCALES | [
"Return",
"a",
"new",
"TL",
".",
"BigDate",
"which",
"has",
"been",
"floored",
"at",
"the",
"given",
"scale",
"."
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/date/TL.Date.js#L383-L392 | train | |
NUKnightLab/TimelineJS3 | source/js/TL.Timeline.js | function(n) {
if(this.config.title) {
if(n == 0) {
this.goToId(this.config.title.unique_id);
} else {
this.goToId(this.config.events[n - 1].unique_id);
}
} else {
this.goToId(this.config.events[n].unique_id);
}
} | javascript | function(n) {
if(this.config.title) {
if(n == 0) {
this.goToId(this.config.title.unique_id);
} else {
this.goToId(this.config.events[n - 1].unique_id);
}
} else {
this.goToId(this.config.events[n].unique_id);
}
} | [
"function",
"(",
"n",
")",
"{",
"if",
"(",
"this",
".",
"config",
".",
"title",
")",
"{",
"if",
"(",
"n",
"==",
"0",
")",
"{",
"this",
".",
"goToId",
"(",
"this",
".",
"config",
".",
"title",
".",
"unique_id",
")",
";",
"}",
"else",
"{",
"thi... | Goto slide n | [
"Goto",
"slide",
"n"
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/TL.Timeline.js#L307-L317 | train | |
NUKnightLab/TimelineJS3 | source/js/TL.Timeline.js | function(n) {
if(n >= 0 && n < this.config.events.length) {
// If removing the current, nav to new one first
if(this.config.events[n].unique_id == this.current_id) {
if(n < this.config.events.length - 1) {
this.goTo(n + 1);
} else {
this.goTo(n - 1);
}
}
var event = this.config.eve... | javascript | function(n) {
if(n >= 0 && n < this.config.events.length) {
// If removing the current, nav to new one first
if(this.config.events[n].unique_id == this.current_id) {
if(n < this.config.events.length - 1) {
this.goTo(n + 1);
} else {
this.goTo(n - 1);
}
}
var event = this.config.eve... | [
"function",
"(",
"n",
")",
"{",
"if",
"(",
"n",
">=",
"0",
"&&",
"n",
"<",
"this",
".",
"config",
".",
"events",
".",
"length",
")",
"{",
"// If removing the current, nav to new one first",
"if",
"(",
"this",
".",
"config",
".",
"events",
"[",
"n",
"]"... | Remove an event | [
"Remove",
"an",
"event"
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/TL.Timeline.js#L360-L381 | train | |
NUKnightLab/TimelineJS3 | source/js/TL.Timeline.js | function(id) {
var hash = "#" + "event-" + id.toString();
if (window.location.protocol != 'file:') {
window.history.replaceState(null, "Browsing TimelineJS", hash);
}
this.fire("hash_updated", {unique_id:this.current_id, hashbookmark:"#" + "event-" + id.toString()}, this);
} | javascript | function(id) {
var hash = "#" + "event-" + id.toString();
if (window.location.protocol != 'file:') {
window.history.replaceState(null, "Browsing TimelineJS", hash);
}
this.fire("hash_updated", {unique_id:this.current_id, hashbookmark:"#" + "event-" + id.toString()}, this);
} | [
"function",
"(",
"id",
")",
"{",
"var",
"hash",
"=",
"\"#\"",
"+",
"\"event-\"",
"+",
"id",
".",
"toString",
"(",
")",
";",
"if",
"(",
"window",
".",
"location",
".",
"protocol",
"!=",
"'file:'",
")",
"{",
"window",
".",
"history",
".",
"replaceState... | Update hashbookmark in the url bar | [
"Update",
"hashbookmark",
"in",
"the",
"url",
"bar"
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/TL.Timeline.js#L614-L620 | train | |
NUKnightLab/TimelineJS3 | source/js/TL.Timeline.js | function () {
var self = this;
this.message.removeFrom(this._el.container);
this._el.container.innerHTML = "";
// Create Layout
if (this.options.timenav_position == "top") {
this._el.timenav = TL.Dom.create('div', 'tl-timenav', this._el.container);
this._el.storyslider = TL.Dom.create('div', 't... | javascript | function () {
var self = this;
this.message.removeFrom(this._el.container);
this._el.container.innerHTML = "";
// Create Layout
if (this.options.timenav_position == "top") {
this._el.timenav = TL.Dom.create('div', 'tl-timenav', this._el.container);
this._el.storyslider = TL.Dom.create('div', 't... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"message",
".",
"removeFrom",
"(",
"this",
".",
"_el",
".",
"container",
")",
";",
"this",
".",
"_el",
".",
"container",
".",
"innerHTML",
"=",
"\"\"",
";",
"// Create Layout",
... | Initialize the layout | [
"Initialize",
"the",
"layout"
] | e06ea96ea3384aece169044a0091d5f316db7254 | https://github.com/NUKnightLab/TimelineJS3/blob/e06ea96ea3384aece169044a0091d5f316db7254/source/js/TL.Timeline.js#L682-L740 | train | |
jhen0409/react-chrome-extension-boilerplate | app/utils/storage.js | setBadge | function setBadge(todos) {
if (chrome.browserAction) {
const count = todos.filter(todo => !todo.marked).length;
chrome.browserAction.setBadgeText({ text: count > 0 ? count.toString() : '' });
}
} | javascript | function setBadge(todos) {
if (chrome.browserAction) {
const count = todos.filter(todo => !todo.marked).length;
chrome.browserAction.setBadgeText({ text: count > 0 ? count.toString() : '' });
}
} | [
"function",
"setBadge",
"(",
"todos",
")",
"{",
"if",
"(",
"chrome",
".",
"browserAction",
")",
"{",
"const",
"count",
"=",
"todos",
".",
"filter",
"(",
"todo",
"=>",
"!",
"todo",
".",
"marked",
")",
".",
"length",
";",
"chrome",
".",
"browserAction",
... | todos unmarked count | [
"todos",
"unmarked",
"count"
] | 81284bbc7a949b37c1612966889b97232bc99d90 | https://github.com/jhen0409/react-chrome-extension-boilerplate/blob/81284bbc7a949b37c1612966889b97232bc99d90/app/utils/storage.js#L6-L11 | train |
FortAwesome/react-fontawesome | index.js | function(string, options) {
options = options || {};
var separator = options.separator || '_';
var split = options.split || /(?=[A-Z])/;
return string.split(split).join(separator);
} | javascript | function(string, options) {
options = options || {};
var separator = options.separator || '_';
var split = options.split || /(?=[A-Z])/;
return string.split(split).join(separator);
} | [
"function",
"(",
"string",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"separator",
"=",
"options",
".",
"separator",
"||",
"'_'",
";",
"var",
"split",
"=",
"options",
".",
"split",
"||",
"/",
"(?=[A-Z])",
"/",
";... | String conversion methods | [
"String",
"conversion",
"methods"
] | d79839bbf39a775702c9488deb0cb53cb13ce740 | https://github.com/FortAwesome/react-fontawesome/blob/d79839bbf39a775702c9488deb0cb53cb13ce740/index.js#L151-L157 | train | |
FortAwesome/react-fontawesome | index.js | function(convert, options) {
var callback = options && 'process' in options ? options.process : options;
if(typeof(callback) !== 'function') {
return convert;
}
return function(string, options) {
return callback(string, convert, options);
}
} | javascript | function(convert, options) {
var callback = options && 'process' in options ? options.process : options;
if(typeof(callback) !== 'function') {
return convert;
}
return function(string, options) {
return callback(string, convert, options);
}
} | [
"function",
"(",
"convert",
",",
"options",
")",
"{",
"var",
"callback",
"=",
"options",
"&&",
"'process'",
"in",
"options",
"?",
"options",
".",
"process",
":",
"options",
";",
"if",
"(",
"typeof",
"(",
"callback",
")",
"!==",
"'function'",
")",
"{",
... | Sets up function which handles processing keys allowing the convert function to be modified by a callback | [
"Sets",
"up",
"function",
"which",
"handles",
"processing",
"keys",
"allowing",
"the",
"convert",
"function",
"to",
"be",
"modified",
"by",
"a",
"callback"
] | d79839bbf39a775702c9488deb0cb53cb13ce740 | https://github.com/FortAwesome/react-fontawesome/blob/d79839bbf39a775702c9488deb0cb53cb13ce740/index.js#L212-L222 | train | |
angular/in-memory-web-api | bundles/in-memory-web-api.umd.js | httpClientInMemBackendServiceFactory | function httpClientInMemBackendServiceFactory(dbService, options, xhrFactory) {
var backend = new HttpClientBackendService(dbService, options, xhrFactory);
return backend;
} | javascript | function httpClientInMemBackendServiceFactory(dbService, options, xhrFactory) {
var backend = new HttpClientBackendService(dbService, options, xhrFactory);
return backend;
} | [
"function",
"httpClientInMemBackendServiceFactory",
"(",
"dbService",
",",
"options",
",",
"xhrFactory",
")",
"{",
"var",
"backend",
"=",
"new",
"HttpClientBackendService",
"(",
"dbService",
",",
"options",
",",
"xhrFactory",
")",
";",
"return",
"backend",
";",
"}... | Internal - Creates the in-mem backend for the HttpClient module AoT requires factory to be exported | [
"Internal",
"-",
"Creates",
"the",
"in",
"-",
"mem",
"backend",
"for",
"the",
"HttpClient",
"module",
"AoT",
"requires",
"factory",
"to",
"be",
"exported"
] | b71d39fd48cf189c831603e3ae8fd954216ce2ef | https://github.com/angular/in-memory-web-api/blob/b71d39fd48cf189c831603e3ae8fd954216ce2ef/bundles/in-memory-web-api.umd.js#L1294-L1297 | train |
wilddeer/stickyfill | dist/stickyfill.js | _loop2 | function _loop2(i) {
var node = nodeList[i];
stickies.some(function (sticky) {
if (sticky._node === node) {
sticky.remove();
return true;
}
});
} | javascript | function _loop2(i) {
var node = nodeList[i];
stickies.some(function (sticky) {
if (sticky._node === node) {
sticky.remove();
return true;
}
});
} | [
"function",
"_loop2",
"(",
"i",
")",
"{",
"var",
"node",
"=",
"nodeList",
"[",
"i",
"]",
";",
"stickies",
".",
"some",
"(",
"function",
"(",
"sticky",
")",
"{",
"if",
"(",
"sticky",
".",
"_node",
"===",
"node",
")",
"{",
"sticky",
".",
"remove",
... | Remove the stickies bound to the nodes in the list | [
"Remove",
"the",
"stickies",
"bound",
"to",
"the",
"nodes",
"in",
"the",
"list"
] | bae6e31466defc8ff3594509055ed36b068ee257 | https://github.com/wilddeer/stickyfill/blob/bae6e31466defc8ff3594509055ed36b068ee257/dist/stickyfill.js#L439-L448 | train |
bitjson/typescript-starter | .vscode/debug-ts.js | TS2JS | function TS2JS(tsFile) {
const srcFolder = path.join(__dirname, '..', 'src');
const distFolder = path.join(__dirname, '..', 'build', 'main');
const tsPathObj = path.parse(tsFile);
return path.format({
dir: tsPathObj.dir.replace(srcFolder, distFolder),
ext: '.js',
name: tsPathObj.name,
root: ts... | javascript | function TS2JS(tsFile) {
const srcFolder = path.join(__dirname, '..', 'src');
const distFolder = path.join(__dirname, '..', 'build', 'main');
const tsPathObj = path.parse(tsFile);
return path.format({
dir: tsPathObj.dir.replace(srcFolder, distFolder),
ext: '.js',
name: tsPathObj.name,
root: ts... | [
"function",
"TS2JS",
"(",
"tsFile",
")",
"{",
"const",
"srcFolder",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'..'",
",",
"'src'",
")",
";",
"const",
"distFolder",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'..'",
",",
"'build'",
",",
... | get associated compiled js file path
@param tsFile path
@return string path | [
"get",
"associated",
"compiled",
"js",
"file",
"path"
] | 8eaf9636c6cfbd9b1b5c0b4393c32f35f06e8d7d | https://github.com/bitjson/typescript-starter/blob/8eaf9636c6cfbd9b1b5c0b4393c32f35f06e8d7d/.vscode/debug-ts.js#L29-L41 | train |
bitjson/typescript-starter | .vscode/debug-ts.js | replaceCLIArg | function replaceCLIArg(search, replace) {
process.argv[process.argv.indexOf(search)] = replace;
} | javascript | function replaceCLIArg(search, replace) {
process.argv[process.argv.indexOf(search)] = replace;
} | [
"function",
"replaceCLIArg",
"(",
"search",
",",
"replace",
")",
"{",
"process",
".",
"argv",
"[",
"process",
".",
"argv",
".",
"indexOf",
"(",
"search",
")",
"]",
"=",
"replace",
";",
"}"
] | replace a value in CLI args
@param search value to search
@param replace value to replace
@return void | [
"replace",
"a",
"value",
"in",
"CLI",
"args"
] | 8eaf9636c6cfbd9b1b5c0b4393c32f35f06e8d7d | https://github.com/bitjson/typescript-starter/blob/8eaf9636c6cfbd9b1b5c0b4393c32f35f06e8d7d/.vscode/debug-ts.js#L50-L52 | train |
krasimir/navigo | demo/html-template-demo/scripts.js | loadHTML | function loadHTML(url, id) {
req = new XMLHttpRequest();
req.open('GET', url);
req.send();
req.onload = () => {
$id(id).innerHTML = req.responseText;
};
} | javascript | function loadHTML(url, id) {
req = new XMLHttpRequest();
req.open('GET', url);
req.send();
req.onload = () => {
$id(id).innerHTML = req.responseText;
};
} | [
"function",
"loadHTML",
"(",
"url",
",",
"id",
")",
"{",
"req",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"req",
".",
"open",
"(",
"'GET'",
",",
"url",
")",
";",
"req",
".",
"send",
"(",
")",
";",
"req",
".",
"onload",
"=",
"(",
")",
"=>",
... | asyncrhonously fetch the html template partial from the file directory, then set its contents to the html of the parent element | [
"asyncrhonously",
"fetch",
"the",
"html",
"template",
"partial",
"from",
"the",
"file",
"directory",
"then",
"set",
"its",
"contents",
"to",
"the",
"html",
"of",
"the",
"parent",
"element"
] | 15823891c91d0d8edb3dbcba4e9c57ae78206a8d | https://github.com/krasimir/navigo/blob/15823891c91d0d8edb3dbcba4e9c57ae78206a8d/demo/html-template-demo/scripts.js#L8-L15 | train |
NASAWorldWind/WebWorldWind | src/shapes/AnnotationAttributes.js | function (attributes) {
// These are all documented with their property accessors below.
this._cornerRadius = attributes ? attributes._cornerRadius : 0;
this._insets = attributes ? attributes._insets : new Insets(0, 0, 0, 0);
this._backgroundColor = attributes ? attribut... | javascript | function (attributes) {
// These are all documented with their property accessors below.
this._cornerRadius = attributes ? attributes._cornerRadius : 0;
this._insets = attributes ? attributes._insets : new Insets(0, 0, 0, 0);
this._backgroundColor = attributes ? attribut... | [
"function",
"(",
"attributes",
")",
"{",
"// These are all documented with their property accessors below.",
"this",
".",
"_cornerRadius",
"=",
"attributes",
"?",
"attributes",
".",
"_cornerRadius",
":",
"0",
";",
"this",
".",
"_insets",
"=",
"attributes",
"?",
"attri... | Constructs an annotation attributes bundle.
@alias AnnotationAttributes
@constructor
@classdesc Holds attributes applied to {@link Annotation} shapes.
@param {AnnotationAttributes} attributes Attributes to initialize this attributes instance to. May be null,
in which case the new instance contains default attributes. | [
"Constructs",
"an",
"annotation",
"attributes",
"bundle",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/shapes/AnnotationAttributes.js#L37-L60 | train | |
NASAWorldWind/WebWorldWind | src/cache/MemoryCache.js | function (capacity, lowWater) {
if (!capacity || capacity < 1) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "MemoryCache", "constructor",
"The specified capacity is undefined, zero or negative"));
}
if (!lowWater || lowWater >=... | javascript | function (capacity, lowWater) {
if (!capacity || capacity < 1) {
throw new ArgumentError(Logger.logMessage(Logger.LEVEL_SEVERE, "MemoryCache", "constructor",
"The specified capacity is undefined, zero or negative"));
}
if (!lowWater || lowWater >=... | [
"function",
"(",
"capacity",
",",
"lowWater",
")",
"{",
"if",
"(",
"!",
"capacity",
"||",
"capacity",
"<",
"1",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LEVEL_SEVERE",
",",
"\"MemoryCache\"",
",",
... | Constructs a memory cache of a specified size.
@alias MemoryCache
@constructor
@classdesc Provides a limited-size memory cache of key-value pairs. The meaning of size depends on usage.
Some instances of this class work in bytes while others work in counts. See the documentation for the
specific use to determine the siz... | [
"Constructs",
"a",
"memory",
"cache",
"of",
"a",
"specified",
"size",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/cache/MemoryCache.js#L40-L76 | train | |
NASAWorldWind/WebWorldWind | src/geom/Matrix.js | function (m11, m12, m13, m14,
m21, m22, m23, m24,
m31, m32, m33, m34,
m41, m42, m43, m44) {
this[0] = m11;
this[1] = m12;
this[2] = m13;
this[3] = m14;
this[4] = m21;
... | javascript | function (m11, m12, m13, m14,
m21, m22, m23, m24,
m31, m32, m33, m34,
m41, m42, m43, m44) {
this[0] = m11;
this[1] = m12;
this[2] = m13;
this[3] = m14;
this[4] = m21;
... | [
"function",
"(",
"m11",
",",
"m12",
",",
"m13",
",",
"m14",
",",
"m21",
",",
"m22",
",",
"m23",
",",
"m24",
",",
"m31",
",",
"m32",
",",
"m33",
",",
"m34",
",",
"m41",
",",
"m42",
",",
"m43",
",",
"m44",
")",
"{",
"this",
"[",
"0",
"]",
"... | Constructs a matrix.
@alias Matrix
@constructor
@classdesc Represents a 4 x 4 double precision matrix stored in a Float64Array in row-major order.
@param {Number} m11 matrix element at row 1, column 1.
@param {Number} m12 matrix element at row 1, column 2.
@param {Number} m13 matrix element at row 1, column 3.
@param {... | [
"Constructs",
"a",
"matrix",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/geom/Matrix.js#L64-L84 | train | |
NASAWorldWind/WebWorldWind | src/BasicWorldWindowController.js | function (worldWindow) {
WorldWindowController.call(this, worldWindow); // base class checks for a valid worldWindow
// Intentionally not documented.
this.primaryDragRecognizer = new DragRecognizer(this.wwd, null);
this.primaryDragRecognizer.addListener(this);
... | javascript | function (worldWindow) {
WorldWindowController.call(this, worldWindow); // base class checks for a valid worldWindow
// Intentionally not documented.
this.primaryDragRecognizer = new DragRecognizer(this.wwd, null);
this.primaryDragRecognizer.addListener(this);
... | [
"function",
"(",
"worldWindow",
")",
"{",
"WorldWindowController",
".",
"call",
"(",
"this",
",",
"worldWindow",
")",
";",
"// base class checks for a valid worldWindow",
"// Intentionally not documented.",
"this",
".",
"primaryDragRecognizer",
"=",
"new",
"DragRecognizer",... | Constructs a window controller with basic capabilities.
@alias BasicWorldWindowController
@constructor
@augments WorldWindowController
@classDesc This class provides the default window controller for WorldWind for controlling the globe via user interaction.
@param {WorldWindow} worldWindow The WorldWindow associated wi... | [
"Constructs",
"a",
"window",
"controller",
"with",
"basic",
"capabilities",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/BasicWorldWindowController.js#L66-L122 | train | |
NASAWorldWind/WebWorldWind | src/projections/ProjectionUPS.js | function (pole) {
// Internal. Intentionally not documented.
this.north = !(pole === "South");
var limits = this.north ? new Sector(0, 90, -180, 180) : new Sector(-90, 0, -180, 180);
GeographicProjection.call(this, "Uniform Polar Stereographic", false, limits);
... | javascript | function (pole) {
// Internal. Intentionally not documented.
this.north = !(pole === "South");
var limits = this.north ? new Sector(0, 90, -180, 180) : new Sector(-90, 0, -180, 180);
GeographicProjection.call(this, "Uniform Polar Stereographic", false, limits);
... | [
"function",
"(",
"pole",
")",
"{",
"// Internal. Intentionally not documented.",
"this",
".",
"north",
"=",
"!",
"(",
"pole",
"===",
"\"South\"",
")",
";",
"var",
"limits",
"=",
"this",
".",
"north",
"?",
"new",
"Sector",
"(",
"0",
",",
"90",
",",
"-",
... | Constructs a Uniform Polar Stereographic geographic projection.
@alias ProjectionUPS
@constructor
@augments GeographicProjection
@classdesc Represents a Uniform Polar Stereographic geographic projection.
@param {String} pole Indicates the north or south aspect. Specify "North" for the north aspect or "South"
for the so... | [
"Constructs",
"a",
"Uniform",
"Polar",
"Stereographic",
"geographic",
"projection",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/projections/ProjectionUPS.js#L47-L64 | train | |
NASAWorldWind/WebWorldWind | src/gesture/RotationRecognizer.js | function (target, callback) {
GestureRecognizer.call(this, target, callback);
// Intentionally not documented.
this._rotation = 0;
// Intentionally not documented.
this._offsetRotation = 0;
// Intentionally not documented.
this.refer... | javascript | function (target, callback) {
GestureRecognizer.call(this, target, callback);
// Intentionally not documented.
this._rotation = 0;
// Intentionally not documented.
this._offsetRotation = 0;
// Intentionally not documented.
this.refer... | [
"function",
"(",
"target",
",",
"callback",
")",
"{",
"GestureRecognizer",
".",
"call",
"(",
"this",
",",
"target",
",",
"callback",
")",
";",
"// Intentionally not documented.",
"this",
".",
"_rotation",
"=",
"0",
";",
"// Intentionally not documented.",
"this",
... | Constructs a rotation gesture recognizer.
@alias RotationRecognizer
@constructor
@augments GestureRecognizer
@classdesc A concrete gesture recognizer subclass that looks for two finger rotation gestures.
@param {EventTarget} target The document element this gesture recognizer observes for mouse and touch events.
@param... | [
"Constructs",
"a",
"rotation",
"gesture",
"recognizer",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/gesture/RotationRecognizer.js#L40-L60 | train | |
NASAWorldWind/WebWorldWind | src/util/measure/MeasurerUtils.js | function (globe, positions, position, followTerrain) {
var elevation = position.altitude;
if (followTerrain) {
elevation = globe.elevationAtLocation(position.latitude, position.longitude);
}
positions.push(new Position(position.latitude... | javascript | function (globe, positions, position, followTerrain) {
var elevation = position.altitude;
if (followTerrain) {
elevation = globe.elevationAtLocation(position.latitude, position.longitude);
}
positions.push(new Position(position.latitude... | [
"function",
"(",
"globe",
",",
"positions",
",",
"position",
",",
"followTerrain",
")",
"{",
"var",
"elevation",
"=",
"position",
".",
"altitude",
";",
"if",
"(",
"followTerrain",
")",
"{",
"elevation",
"=",
"globe",
".",
"elevationAtLocation",
"(",
"positio... | Adds a position to a list of positions.
If the path is following the terrain the elevation is also computed.
@param {Globe} globe
@param {Position[]} positions The list of positions to add to
@param {Position} position The position to add to the list
@param {Boolean} followTerrain
@return {Position[]} The list of pos... | [
"Adds",
"a",
"position",
"to",
"a",
"list",
"of",
"positions",
".",
"If",
"the",
"path",
"is",
"following",
"the",
"terrain",
"the",
"elevation",
"is",
"also",
"computed",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/measure/MeasurerUtils.js#L124-L131 | train | |
NASAWorldWind/WebWorldWind | src/util/measure/MeasurerUtils.js | function (location, locations) {
var result = false;
var p1 = locations[0];
for (var i = 1, len = locations.length; i < len; i++) {
var p2 = locations[i];
if (((p2.latitude <= location.latitude && location.latitude < p1.latitude) ||... | javascript | function (location, locations) {
var result = false;
var p1 = locations[0];
for (var i = 1, len = locations.length; i < len; i++) {
var p2 = locations[i];
if (((p2.latitude <= location.latitude && location.latitude < p1.latitude) ||... | [
"function",
"(",
"location",
",",
"locations",
")",
"{",
"var",
"result",
"=",
"false",
";",
"var",
"p1",
"=",
"locations",
"[",
"0",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"1",
",",
"len",
"=",
"locations",
".",
"length",
";",
"i",
"<",
"len",
... | Determines whether a location is located inside a given polygon.
@param {Location} location
@param {Location[]}locations The list of positions describing the polygon.
Last one should be the same as the first one.
@return {Boolean} true if the location is inside the polygon. | [
"Determines",
"whether",
"a",
"location",
"is",
"located",
"inside",
"a",
"given",
"polygon",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/measure/MeasurerUtils.js#L142-L156 | train | |
NASAWorldWind/WebWorldWind | src/util/measure/MeasurerUtils.js | function (v1, v2) {
var dot = v1.dot(v2);
// Compute the sum of magnitudes.
var length = v1.magnitude() * v2.magnitude();
// Normalize the dot product, if necessary.
if (!(length === 0) && (length !== 1.0)) {
dot /= leng... | javascript | function (v1, v2) {
var dot = v1.dot(v2);
// Compute the sum of magnitudes.
var length = v1.magnitude() * v2.magnitude();
// Normalize the dot product, if necessary.
if (!(length === 0) && (length !== 1.0)) {
dot /= leng... | [
"function",
"(",
"v1",
",",
"v2",
")",
"{",
"var",
"dot",
"=",
"v1",
".",
"dot",
"(",
"v2",
")",
";",
"// Compute the sum of magnitudes.",
"var",
"length",
"=",
"v1",
".",
"magnitude",
"(",
")",
"*",
"v2",
".",
"magnitude",
"(",
")",
";",
"// Normali... | Computes the angle between two Vec3 in radians.
@param {Vec3} v1
@param {Vec3} v2
@return {Number} The ange in radians | [
"Computes",
"the",
"angle",
"between",
"two",
"Vec3",
"in",
"radians",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/measure/MeasurerUtils.js#L166-L187 | train | |
NASAWorldWind/WebWorldWind | src/geom/TileMatrixSet.js | function (sector, tileMatrixList) {
if (!sector) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "TileMatrixSet", "constructor", "missingSector"));
}
if (!tileMatrixList) {
throw new ArgumentError(
... | javascript | function (sector, tileMatrixList) {
if (!sector) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "TileMatrixSet", "constructor", "missingSector"));
}
if (!tileMatrixList) {
throw new ArgumentError(
... | [
"function",
"(",
"sector",
",",
"tileMatrixList",
")",
"{",
"if",
"(",
"!",
"sector",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LEVEL_SEVERE",
",",
"\"TileMatrixSet\"",
",",
"\"constructor\"",
",",
"\"m... | TileMatrixSet defines a generic tiled space as defined by a geographic bounding area and an array of
TileMatrix objects which define the tiled space at different resolutions.
@param sector the geographic bounding area of this TileMatrixSet
@param tileMatrixList the array of TileMatrix objects forming this TileMatrixSet... | [
"TileMatrixSet",
"defines",
"a",
"generic",
"tiled",
"space",
"as",
"defined",
"by",
"a",
"geographic",
"bounding",
"area",
"and",
"an",
"array",
"of",
"TileMatrix",
"objects",
"which",
"define",
"the",
"tiled",
"space",
"at",
"different",
"resolutions",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/geom/TileMatrixSet.js#L39-L60 | train | |
NASAWorldWind/WebWorldWind | src/layer/BingWMSLayer.js | function () {
TiledImageLayer.call(this,
Sector.FULL_SPHERE, new Location(45, 45), 16, "image/png", "BingWMS", 256, 256);
this.displayName = "Bing WMS";
this.pickEnabled = false;
this.maxActiveAltitude = 10e3;
this.urlBuilder = new WmsUrlBuil... | javascript | function () {
TiledImageLayer.call(this,
Sector.FULL_SPHERE, new Location(45, 45), 16, "image/png", "BingWMS", 256, 256);
this.displayName = "Bing WMS";
this.pickEnabled = false;
this.maxActiveAltitude = 10e3;
this.urlBuilder = new WmsUrlBuil... | [
"function",
"(",
")",
"{",
"TiledImageLayer",
".",
"call",
"(",
"this",
",",
"Sector",
".",
"FULL_SPHERE",
",",
"new",
"Location",
"(",
"45",
",",
"45",
")",
",",
"16",
",",
"\"image/png\"",
",",
"\"BingWMS\"",
",",
"256",
",",
"256",
")",
";",
"this... | Intentionally not documented. For diagnostic use only. | [
"Intentionally",
"not",
"documented",
".",
"For",
"diagnostic",
"use",
"only",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/layer/BingWMSLayer.js#L33-L42 | train | |
NASAWorldWind/WebWorldWind | src/globe/EarthRestElevationCoverage.js | function (serverAddress, pathToData, displayName) {
TiledElevationCoverage.call(this, {
coverageSector: Sector.FULL_SPHERE,
resolution: 0.00732421875,
retrievalImageFormat: "application/bil16",
minElevation: -11000,
maxElevation... | javascript | function (serverAddress, pathToData, displayName) {
TiledElevationCoverage.call(this, {
coverageSector: Sector.FULL_SPHERE,
resolution: 0.00732421875,
retrievalImageFormat: "application/bil16",
minElevation: -11000,
maxElevation... | [
"function",
"(",
"serverAddress",
",",
"pathToData",
",",
"displayName",
")",
"{",
"TiledElevationCoverage",
".",
"call",
"(",
"this",
",",
"{",
"coverageSector",
":",
"Sector",
".",
"FULL_SPHERE",
",",
"resolution",
":",
"0.00732421875",
",",
"retrievalImageForma... | Constructs an elevation coverage for Earth using a REST interface to retrieve the elevations from the server.
@alias EarthRestElevationCoverage
@constructor
@classdesc Represents an Earth elevation coverage spanning the globe and using a REST interface to retrieve
the elevations from the server.
See [LevelRowColumnUrlB... | [
"Constructs",
"an",
"elevation",
"coverage",
"for",
"Earth",
"using",
"a",
"REST",
"interface",
"to",
"retrieve",
"the",
"elevations",
"from",
"the",
"server",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/globe/EarthRestElevationCoverage.js#L47-L62 | train | |
NASAWorldWind/WebWorldWind | src/util/Tile.js | function (sector, level, row, column) {
if (!sector) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "Tile", "constructor", "missingSector"));
}
if (!level) {
throw new ArgumentError(
Logger.lo... | javascript | function (sector, level, row, column) {
if (!sector) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "Tile", "constructor", "missingSector"));
}
if (!level) {
throw new ArgumentError(
Logger.lo... | [
"function",
"(",
"sector",
",",
"level",
",",
"row",
",",
"column",
")",
"{",
"if",
"(",
"!",
"sector",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LEVEL_SEVERE",
",",
"\"Tile\"",
",",
"\"constructor\... | Constructs a tile for a specified sector, level, row and column.
@alias Tile
@constructor
@classdesc Represents a tile of terrain or imagery.
Provides a base class for texture tiles used by tiled image layers and elevation tiles used by elevation models.
Applications typically do not interact with this class.
@param {S... | [
"Constructs",
"a",
"tile",
"for",
"a",
"specified",
"sector",
"level",
"row",
"and",
"column",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/Tile.js#L50-L155 | train | |
NASAWorldWind/WebWorldWind | src/formats/geotiff/GeoTiffUtil.js | function (geoTiffData, byteOffset, numOfBytes, isLittleEndian, isSigned) {
if (numOfBytes <= 0) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "GeoTiffReader", "getBytes", "noBytesRequested"));
} else if (numOfBytes <= 1) {
... | javascript | function (geoTiffData, byteOffset, numOfBytes, isLittleEndian, isSigned) {
if (numOfBytes <= 0) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "GeoTiffReader", "getBytes", "noBytesRequested"));
} else if (numOfBytes <= 1) {
... | [
"function",
"(",
"geoTiffData",
",",
"byteOffset",
",",
"numOfBytes",
",",
"isLittleEndian",
",",
"isSigned",
")",
"{",
"if",
"(",
"numOfBytes",
"<=",
"0",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LE... | Get bytes from an arraybuffer depending on the size. Internal use only. | [
"Get",
"bytes",
"from",
"an",
"arraybuffer",
"depending",
"on",
"the",
"size",
".",
"Internal",
"use",
"only",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/formats/geotiff/GeoTiffUtil.js#L33-L71 | train | |
NASAWorldWind/WebWorldWind | src/formats/geotiff/GeoTiffUtil.js | function (geoTiffData, byteOffset, numOfBytes, sampleFormat, isLittleEndian) {
var res;
switch (sampleFormat) {
case TiffConstants.SampleFormat.UNSIGNED:
res = this.getBytes(geoTiffData, byteOffset, numOfBytes, isLittleEndian, false);
... | javascript | function (geoTiffData, byteOffset, numOfBytes, sampleFormat, isLittleEndian) {
var res;
switch (sampleFormat) {
case TiffConstants.SampleFormat.UNSIGNED:
res = this.getBytes(geoTiffData, byteOffset, numOfBytes, isLittleEndian, false);
... | [
"function",
"(",
"geoTiffData",
",",
"byteOffset",
",",
"numOfBytes",
",",
"sampleFormat",
",",
"isLittleEndian",
")",
"{",
"var",
"res",
";",
"switch",
"(",
"sampleFormat",
")",
"{",
"case",
"TiffConstants",
".",
"SampleFormat",
".",
"UNSIGNED",
":",
"res",
... | Get sample value from an arraybuffer depending on the sample format. Internal use only. | [
"Get",
"sample",
"value",
"from",
"an",
"arraybuffer",
"depending",
"on",
"the",
"sample",
"format",
".",
"Internal",
"use",
"only",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/formats/geotiff/GeoTiffUtil.js#L74-L104 | train | |
NASAWorldWind/WebWorldWind | src/formats/geotiff/GeoTiffUtil.js | function (colorSample, bitsPerSample) {
var multiplier = Math.pow(2, 8 - bitsPerSample);
return Math.floor((colorSample * multiplier) + (multiplier - 1));
} | javascript | function (colorSample, bitsPerSample) {
var multiplier = Math.pow(2, 8 - bitsPerSample);
return Math.floor((colorSample * multiplier) + (multiplier - 1));
} | [
"function",
"(",
"colorSample",
",",
"bitsPerSample",
")",
"{",
"var",
"multiplier",
"=",
"Math",
".",
"pow",
"(",
"2",
",",
"8",
"-",
"bitsPerSample",
")",
";",
"return",
"Math",
".",
"floor",
"(",
"(",
"colorSample",
"*",
"multiplier",
")",
"+",
"(",... | Clamp color sample from color sample value and number of bits per sample. Internal use only. | [
"Clamp",
"color",
"sample",
"from",
"color",
"sample",
"value",
"and",
"number",
"of",
"bits",
"per",
"sample",
".",
"Internal",
"use",
"only",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/formats/geotiff/GeoTiffUtil.js#L115-L118 | train | |
NASAWorldWind/WebWorldWind | src/gesture/PinchRecognizer.js | function (target, callback) {
GestureRecognizer.call(this, target, callback);
// Intentionally not documented.
this._scale = 1;
// Intentionally not documented.
this._offsetScale = 1;
// Intentionally not documented.
this.referenceDi... | javascript | function (target, callback) {
GestureRecognizer.call(this, target, callback);
// Intentionally not documented.
this._scale = 1;
// Intentionally not documented.
this._offsetScale = 1;
// Intentionally not documented.
this.referenceDi... | [
"function",
"(",
"target",
",",
"callback",
")",
"{",
"GestureRecognizer",
".",
"call",
"(",
"this",
",",
"target",
",",
"callback",
")",
";",
"// Intentionally not documented.",
"this",
".",
"_scale",
"=",
"1",
";",
"// Intentionally not documented.",
"this",
"... | Constructs a pinch gesture recognizer.
@alias PinchRecognizer
@constructor
@augments GestureRecognizer
@classdesc A concrete gesture recognizer subclass that looks for two finger pinch gestures.
@param {EventTarget} target The document element this gesture recognizer observes for mouse and touch events.
@param {Functio... | [
"Constructs",
"a",
"pinch",
"gesture",
"recognizer",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/gesture/PinchRecognizer.js#L36-L56 | train | |
NASAWorldWind/WebWorldWind | performance/VeryManyPolygons.js | function (o) {
// The input argument is either an Event or a TapRecognizer. Both have the same properties for determining
// the mouse or tap location.
var x = o.clientX,
y = o.clientY;
var redrawRequired = highlightedItems.length > 0; // must redraw if w... | javascript | function (o) {
// The input argument is either an Event or a TapRecognizer. Both have the same properties for determining
// the mouse or tap location.
var x = o.clientX,
y = o.clientY;
var redrawRequired = highlightedItems.length > 0; // must redraw if w... | [
"function",
"(",
"o",
")",
"{",
"// The input argument is either an Event or a TapRecognizer. Both have the same properties for determining",
"// the mouse or tap location.",
"var",
"x",
"=",
"o",
".",
"clientX",
",",
"y",
"=",
"o",
".",
"clientY",
";",
"var",
"redrawRequir... | The pick-handling callback function. | [
"The",
"pick",
"-",
"handling",
"callback",
"function",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/performance/VeryManyPolygons.js#L104-L140 | train | |
NASAWorldWind/WebWorldWind | src/geom/Frustum.js | function (left, right, bottom, top, near, far) {
if (!left || !right || !bottom || !top || !near || !far) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "Frustum", "constructor", "missingPlane"));
}
// Internal. Intentionally no... | javascript | function (left, right, bottom, top, near, far) {
if (!left || !right || !bottom || !top || !near || !far) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "Frustum", "constructor", "missingPlane"));
}
// Internal. Intentionally no... | [
"function",
"(",
"left",
",",
"right",
",",
"bottom",
",",
"top",
",",
"near",
",",
"far",
")",
"{",
"if",
"(",
"!",
"left",
"||",
"!",
"right",
"||",
"!",
"bottom",
"||",
"!",
"top",
"||",
"!",
"near",
"||",
"!",
"far",
")",
"{",
"throw",
"n... | Constructs a frustum.
@alias Frustum
@constructor
@classdesc Represents a six-sided view frustum in Cartesian coordinates.
@param {Plane} left The frustum's left plane.
@param {Plane} right The frustum's right plane.
@param {Plane} bottom The frustum's bottom plane.
@param {Plane} top The frustum's top plane.
@param {P... | [
"Constructs",
"a",
"frustum",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/geom/Frustum.js#L45-L61 | train | |
NASAWorldWind/WebWorldWind | src/gesture/Touch.js | function (identifier, clientX, clientY) {
/**
* A number uniquely identifying this touch point.
* @type {Number}
* @readonly
*/
this.identifier = identifier;
// Intentionally not documented.
this._clientX = clientX;
... | javascript | function (identifier, clientX, clientY) {
/**
* A number uniquely identifying this touch point.
* @type {Number}
* @readonly
*/
this.identifier = identifier;
// Intentionally not documented.
this._clientX = clientX;
... | [
"function",
"(",
"identifier",
",",
"clientX",
",",
"clientY",
")",
"{",
"/**\n * A number uniquely identifying this touch point.\n * @type {Number}\n * @readonly\n */",
"this",
".",
"identifier",
"=",
"identifier",
";",
"// Intentional... | Constructs a touch point.
@alias Touch
@constructor
@classdesc Represents a touch point.
@param {Color} identifier A number uniquely identifying the touch point
@param {Number} clientX The X coordinate of the touch point's location.
@param {Number} clientY The Y coordinate of the touch point's location. | [
"Constructs",
"a",
"touch",
"point",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/gesture/Touch.js#L33-L53 | train | |
NASAWorldWind/WebWorldWind | src/util/Insets.js | function (top, left, bottom, right) {
if (arguments.length !== 4) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "Insets", "constructor", "invalidArgumentCount"));
}
// These are all documented with their property accessors bel... | javascript | function (top, left, bottom, right) {
if (arguments.length !== 4) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "Insets", "constructor", "invalidArgumentCount"));
}
// These are all documented with their property accessors bel... | [
"function",
"(",
"top",
",",
"left",
",",
"bottom",
",",
"right",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"!==",
"4",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LEVEL_SEVERE",
",",
"\"Inse... | Constructs an Insets object that is a representation of the borders of a container.
It specifies the space that a container must leave at each of its edges.
@alias Insets
@param {Number} top The inset from the top.
@param {Number} left The inset from the left.
@param {Number} bottom The inset from the bottom.
@param {N... | [
"Constructs",
"an",
"Insets",
"object",
"that",
"is",
"a",
"representation",
"of",
"the",
"borders",
"of",
"a",
"container",
".",
"It",
"specifies",
"the",
"space",
"that",
"a",
"container",
"must",
"leave",
"at",
"each",
"of",
"its",
"edges",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/Insets.js#L34-L46 | train | |
NASAWorldWind/WebWorldWind | src/ogc/ows/OwsServiceProvider.js | function (element) {
if (!element) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "OwsServiceProvider", "constructor", "missingDomElement"));
}
var children = element.children || element.childNodes;
for (var c = 0; c... | javascript | function (element) {
if (!element) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "OwsServiceProvider", "constructor", "missingDomElement"));
}
var children = element.children || element.childNodes;
for (var c = 0; c... | [
"function",
"(",
"element",
")",
"{",
"if",
"(",
"!",
"element",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LEVEL_SEVERE",
",",
"\"OwsServiceProvider\"",
",",
"\"constructor\"",
",",
"\"missingDomElement\"",... | Constructs an OWS Service Provider instance from an XML DOM.
@alias OwsServiceProvider
@constructor
@classdesc Represents an OWS Service Provider section of an OGC capabilities document.
This object holds as properties all the fields specified in the OWS Service Provider section.
Fields can be accessed as properties na... | [
"Constructs",
"an",
"OWS",
"Service",
"Provider",
"instance",
"from",
"an",
"XML",
"DOM",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/ogc/ows/OwsServiceProvider.js#L39-L57 | train | |
NASAWorldWind/WebWorldWind | src/formats/collada/ColladaLoader.js | function (position, config) {
if (!position) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "ColladaLoader", "constructor", "missingPosition"));
}
this.position = position;
this.dirPath = '/';
this.ini... | javascript | function (position, config) {
if (!position) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "ColladaLoader", "constructor", "missingPosition"));
}
this.position = position;
this.dirPath = '/';
this.ini... | [
"function",
"(",
"position",
",",
"config",
")",
"{",
"if",
"(",
"!",
"position",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LEVEL_SEVERE",
",",
"\"ColladaLoader\"",
",",
"\"constructor\"",
",",
"\"missi... | Constructs a ColladaLoader
@alias ColladaLoader
@constructor
@classdesc Represents a Collada Loader. Fetches and parses a collada document and returns the
necessary information to render the collada model.
@param {Position} position The model's geographic position.
@param {Object} config Configuration options for the l... | [
"Constructs",
"a",
"ColladaLoader"
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/formats/collada/ColladaLoader.js#L55-L67 | train | |
NASAWorldWind/WebWorldWind | src/gesture/TapRecognizer.js | function (target, callback) {
GestureRecognizer.call(this, target, callback);
/**
*
* @type {Number}
*/
this.numberOfTaps = 1;
/**
*
* @type {Number}
*/
this.numberOfTouches = 1;
... | javascript | function (target, callback) {
GestureRecognizer.call(this, target, callback);
/**
*
* @type {Number}
*/
this.numberOfTaps = 1;
/**
*
* @type {Number}
*/
this.numberOfTouches = 1;
... | [
"function",
"(",
"target",
",",
"callback",
")",
"{",
"GestureRecognizer",
".",
"call",
"(",
"this",
",",
"target",
",",
"callback",
")",
";",
"/**\n *\n * @type {Number}\n */",
"this",
".",
"numberOfTaps",
"=",
"1",
";",
"/**\n ... | Constructs a tap gesture recognizer.
@alias TapRecognizer
@constructor
@augments GestureRecognizer
@classdesc A concrete gesture recognizer subclass that looks for single or multiple taps.
@param {EventTarget} target The document element this gesture recognizer observes for mouse and touch events.
@param {Function} cal... | [
"Constructs",
"a",
"tap",
"gesture",
"recognizer",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/gesture/TapRecognizer.js#L36-L65 | train | |
NASAWorldWind/WebWorldWind | src/globe/ElevationCoverage.js | function (resolution) {
if (!resolution) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "ElevationCoverage", "constructor",
"missingResolution"));
}
/**
* Indicates the last time this coverag... | javascript | function (resolution) {
if (!resolution) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "ElevationCoverage", "constructor",
"missingResolution"));
}
/**
* Indicates the last time this coverag... | [
"function",
"(",
"resolution",
")",
"{",
"if",
"(",
"!",
"resolution",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LEVEL_SEVERE",
",",
"\"ElevationCoverage\"",
",",
"\"constructor\"",
",",
"\"missingResolutio... | Constructs an ElevationCoverage
@alias ElevationCoverage
@constructor
@classdesc When used directly and not through a subclass, this class represents an elevation coverage
whose elevations are zero at all locations.
@param {Number} resolution The resolution of the coverage, in degrees. (To compute degrees from
meters, ... | [
"Constructs",
"an",
"ElevationCoverage"
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/globe/ElevationCoverage.js#L38-L79 | train | |
NASAWorldWind/WebWorldWind | src/globe/UsgsNedElevationCoverage.js | function () {
// CONUS Extent: (-124.848974, 24.396308) - (-66.885444, 49.384358)
// TODO: Expand this extent to cover HI when the server NO_DATA value issue is resolved.
TiledElevationCoverage.call(this, {
coverageSector: new Sector(24.396308, 49.384358, -124.848974,... | javascript | function () {
// CONUS Extent: (-124.848974, 24.396308) - (-66.885444, 49.384358)
// TODO: Expand this extent to cover HI when the server NO_DATA value issue is resolved.
TiledElevationCoverage.call(this, {
coverageSector: new Sector(24.396308, 49.384358, -124.848974,... | [
"function",
"(",
")",
"{",
"// CONUS Extent: (-124.848974, 24.396308) - (-66.885444, 49.384358)",
"// TODO: Expand this extent to cover HI when the server NO_DATA value issue is resolved.",
"TiledElevationCoverage",
".",
"call",
"(",
"this",
",",
"{",
"coverageSector",
":",
"new",
"S... | Constructs an Earth elevation coverage using USGS NED data.
@alias UsgsNedElevationCoverage
@constructor
@augments TiledElevationCoverage
@classdesc Provides elevations for Earth. Elevations are drawn from the NASA WorldWind elevation service. | [
"Constructs",
"an",
"Earth",
"elevation",
"coverage",
"using",
"USGS",
"NED",
"data",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/globe/UsgsNedElevationCoverage.js#L39-L52 | train | |
NASAWorldWind/WebWorldWind | src/layer/TectonicPlatesLayer.js | function (shapeAttributes) {
RenderableLayer.call(this, "Tectonic Plates");
if (shapeAttributes) {
this._attributes = shapeAttributes;
} else {
this._attributes = new ShapeAttributes(null);
this._attributes.drawInterior = false;
this._attributes.d... | javascript | function (shapeAttributes) {
RenderableLayer.call(this, "Tectonic Plates");
if (shapeAttributes) {
this._attributes = shapeAttributes;
} else {
this._attributes = new ShapeAttributes(null);
this._attributes.drawInterior = false;
this._attributes.d... | [
"function",
"(",
"shapeAttributes",
")",
"{",
"RenderableLayer",
".",
"call",
"(",
"this",
",",
"\"Tectonic Plates\"",
")",
";",
"if",
"(",
"shapeAttributes",
")",
"{",
"this",
".",
"_attributes",
"=",
"shapeAttributes",
";",
"}",
"else",
"{",
"this",
".",
... | Constructs a layer showing the Earth's tectonic plates.
@alias TectonicPlatesLayer
@constructor
@classdesc Provides a layer showing the Earth's tectonic plates. The plates are drawn as
[SurfacePolygons]{@link SurfacePolygon}.
@param {ShapeAttributes} shapeAttributes The attributes to use when drawing the plates.
May be... | [
"Constructs",
"a",
"layer",
"showing",
"the",
"Earth",
"s",
"tectonic",
"plates",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/layer/TectonicPlatesLayer.js#L48-L61 | train | |
NASAWorldWind/WebWorldWind | src/util/SunPosition.js | function (date) {
if (date instanceof Date === false) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "SunPosition", "getAsGeographicLocation",
"missingDate"));
}
var celestialLocat... | javascript | function (date) {
if (date instanceof Date === false) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "SunPosition", "getAsGeographicLocation",
"missingDate"));
}
var celestialLocat... | [
"function",
"(",
"date",
")",
"{",
"if",
"(",
"date",
"instanceof",
"Date",
"===",
"false",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LEVEL_SEVERE",
",",
"\"SunPosition\"",
",",
"\"getAsGeographicLocation... | Computes the geographic location of the sun for a given date
@param {Date} date
@throws {ArgumentError} if the date is missing
@return {{latitude: Number, longitude: Number}} the geographic location | [
"Computes",
"the",
"geographic",
"location",
"of",
"the",
"sun",
"for",
"a",
"given",
"date"
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/SunPosition.js#L42-L51 | train | |
NASAWorldWind/WebWorldWind | src/util/SunPosition.js | function (date) {
if (date instanceof Date === false) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "SunPosition", "getAsCelestialLocation",
"missingDate"));
}
var julianDate = th... | javascript | function (date) {
if (date instanceof Date === false) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "SunPosition", "getAsCelestialLocation",
"missingDate"));
}
var julianDate = th... | [
"function",
"(",
"date",
")",
"{",
"if",
"(",
"date",
"instanceof",
"Date",
"===",
"false",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LEVEL_SEVERE",
",",
"\"SunPosition\"",
",",
"\"getAsCelestialLocation\... | Computes the celestial location of the sun for a given julianDate
@param {Date} date
@throws {ArgumentError} if the date is missing
@return {{declination: Number, rightAscension: Number}} the celestial location | [
"Computes",
"the",
"celestial",
"location",
"of",
"the",
"sun",
"for",
"a",
"given",
"julianDate"
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/SunPosition.js#L59-L96 | train | |
NASAWorldWind/WebWorldWind | src/util/SunPosition.js | function (date) {
if (date instanceof Date === false) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "SunPosition", "computeJulianDate", "missingDate"));
}
var year = date.getUTCFullYear();
va... | javascript | function (date) {
if (date instanceof Date === false) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "SunPosition", "computeJulianDate", "missingDate"));
}
var year = date.getUTCFullYear();
va... | [
"function",
"(",
"date",
")",
"{",
"if",
"(",
"date",
"instanceof",
"Date",
"===",
"false",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logMessage",
"(",
"Logger",
".",
"LEVEL_SEVERE",
",",
"\"SunPosition\"",
",",
"\"computeJulianDate\"",
... | Computes the julian date from a javascript date object
@param {Date} date
@throws {ArgumentError} if the date is missing
@return {Number} the julian date | [
"Computes",
"the",
"julian",
"date",
"from",
"a",
"javascript",
"date",
"object"
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/util/SunPosition.js#L142-L167 | train | |
NASAWorldWind/WebWorldWind | apps/util/TimeSeriesPlayer.js | function (worldWindow) {
var self = this;
this.createPlayer();
// Intentionally not documented.
this.slider = $("#timeSeriesSlider");
this.sliderThumb = $(this.slider.children('.ui-slider-handle'));
this.timeDisplay = $("#timeSeriesDisplay");// $('<span style="position:... | javascript | function (worldWindow) {
var self = this;
this.createPlayer();
// Intentionally not documented.
this.slider = $("#timeSeriesSlider");
this.sliderThumb = $(this.slider.children('.ui-slider-handle'));
this.timeDisplay = $("#timeSeriesDisplay");// $('<span style="position:... | [
"function",
"(",
"worldWindow",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"createPlayer",
"(",
")",
";",
"// Intentionally not documented.",
"this",
".",
"slider",
"=",
"$",
"(",
"\"#timeSeriesSlider\"",
")",
";",
"this",
".",
"sliderThumb",
"=... | Constructs a TimeSeriesPlayer. A time sequence and layer must be specified after construction.
@alias TimeSeriesPlayer
@constructor
@classdesc Provides a control for time-series layers.
@param {WorldWindow} worldWindow The WorldWindow to associate this player. | [
"Constructs",
"a",
"TimeSeriesPlayer",
".",
"A",
"time",
"sequence",
"and",
"layer",
"must",
"be",
"specified",
"after",
"construction",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/apps/util/TimeSeriesPlayer.js#L30-L93 | train | |
NASAWorldWind/WebWorldWind | src/formats/kml/KmlObject.js | function (options) {
Renderable.call(this);
options = options || {};
if (!options.objectNode) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "KmlObject", "constructor", "Passed node isn't defined.")
);
}
this._node = opt... | javascript | function (options) {
Renderable.call(this);
options = options || {};
if (!options.objectNode) {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "KmlObject", "constructor", "Passed node isn't defined.")
);
}
this._node = opt... | [
"function",
"(",
"options",
")",
"{",
"Renderable",
".",
"call",
"(",
"this",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"options",
".",
"objectNode",
")",
"{",
"throw",
"new",
"ArgumentError",
"(",
"Logger",
".",
"logM... | Constructs an Kml object. Every node in the Kml document is either basic type or Kml object. Applications usually
don't call this constructor. It is usually called only by its descendants.
It should be treated as mixin.
@alias KmlObject
@classdesc Contains the data associated with every Kml object.
@param options {Obje... | [
"Constructs",
"an",
"Kml",
"object",
".",
"Every",
"node",
"in",
"the",
"Kml",
"document",
"is",
"either",
"basic",
"type",
"or",
"Kml",
"object",
".",
"Applications",
"usually",
"don",
"t",
"call",
"this",
"constructor",
".",
"It",
"is",
"usually",
"calle... | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/formats/kml/KmlObject.js#L51-L68 | train | |
NASAWorldWind/WebWorldWind | src/layer/StarFieldLayer.js | function (starDataSource) {
Layer.call(this, 'StarField');
// The StarField Layer is not pickable.
this.pickEnabled = false;
/**
* The size of the Sun in pixels.
* This can not exceed the maximum allowed pointSize of the GPU.
* A w... | javascript | function (starDataSource) {
Layer.call(this, 'StarField');
// The StarField Layer is not pickable.
this.pickEnabled = false;
/**
* The size of the Sun in pixels.
* This can not exceed the maximum allowed pointSize of the GPU.
* A w... | [
"function",
"(",
"starDataSource",
")",
"{",
"Layer",
".",
"call",
"(",
"this",
",",
"'StarField'",
")",
";",
"// The StarField Layer is not pickable.",
"this",
".",
"pickEnabled",
"=",
"false",
";",
"/**\n * The size of the Sun in pixels.\n * This c... | Constructs a layer showing stars and the Sun around the Earth.
If used together with the AtmosphereLayer, the StarFieldLayer must be inserted before the AtmosphereLayer.
If you want to use your own star data, the file provided must be .json
and the fields 'ra', 'dec' and 'vmag' must be present in the metadata.
ra and ... | [
"Constructs",
"a",
"layer",
"showing",
"stars",
"and",
"the",
"Sun",
"around",
"the",
"Earth",
".",
"If",
"used",
"together",
"with",
"the",
"AtmosphereLayer",
"the",
"StarFieldLayer",
"must",
"be",
"inserted",
"before",
"the",
"AtmosphereLayer",
"."
] | 399daee66deded581a2d1067a2ac04232c954b8f | https://github.com/NASAWorldWind/WebWorldWind/blob/399daee66deded581a2d1067a2ac04232c954b8f/src/layer/StarFieldLayer.js#L53-L110 | 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.