id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
10,400 | jsbin/jsbin | public/js/vendor/codemirror3/keymap/vim.js | repeatLastEdit | function repeatLastEdit(cm, vim, repeat, repeatForInsert) {
var macroModeState = vimGlobalState.macroModeState;
macroModeState.inReplay = true;
var isAction = !!vim.lastEditActionCommand;
var cachedInputState = vim.inputState;
function repeatCommand() {
if (isAction) {
co... | javascript | function repeatLastEdit(cm, vim, repeat, repeatForInsert) {
var macroModeState = vimGlobalState.macroModeState;
macroModeState.inReplay = true;
var isAction = !!vim.lastEditActionCommand;
var cachedInputState = vim.inputState;
function repeatCommand() {
if (isAction) {
co... | [
"function",
"repeatLastEdit",
"(",
"cm",
",",
"vim",
",",
"repeat",
",",
"repeatForInsert",
")",
"{",
"var",
"macroModeState",
"=",
"vimGlobalState",
".",
"macroModeState",
";",
"macroModeState",
".",
"inReplay",
"=",
"true",
";",
"var",
"isAction",
"=",
"!",
... | Repeats the last edit, which includes exactly 1 command and at most 1
insert. Operator and motion commands are read from lastEditInputState,
while action commands are read from lastEditActionCommand.
If repeatForInsert is true, then the function was called by
exitInsertMode to repeat the insert mode changes the user j... | [
"Repeats",
"the",
"last",
"edit",
"which",
"includes",
"exactly",
"1",
"command",
"and",
"at",
"most",
"1",
"insert",
".",
"Operator",
"and",
"motion",
"commands",
"are",
"read",
"from",
"lastEditInputState",
"while",
"action",
"commands",
"are",
"read",
"from... | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/keymap/vim.js#L3710-L3754 |
10,401 | jsbin/jsbin | public/js/vendor/pretty-date.js | prettyDate | function prettyDate(time){
'use strict';
// Remy Sharp edit: July 13, 2014 specific to JS Bin
// Need to replace Z in ISO8601 timestamp with +0000 so prettyDate() doesn't
// completely remove it (and parse the date using the local timezone).
var date = new Date((time || '').replace('Z', '+0000').replace(/-/... | javascript | function prettyDate(time){
'use strict';
// Remy Sharp edit: July 13, 2014 specific to JS Bin
// Need to replace Z in ISO8601 timestamp with +0000 so prettyDate() doesn't
// completely remove it (and parse the date using the local timezone).
var date = new Date((time || '').replace('Z', '+0000').replace(/-/... | [
"function",
"prettyDate",
"(",
"time",
")",
"{",
"'use strict'",
";",
"// Remy Sharp edit: July 13, 2014 specific to JS Bin",
"// Need to replace Z in ISO8601 timestamp with +0000 so prettyDate() doesn't",
"// completely remove it (and parse the date using the local timezone).",
"var",
"date... | Takes an ISO time and returns a string representing how long ago the date represents. | [
"Takes",
"an",
"ISO",
"time",
"and",
"returns",
"a",
"string",
"representing",
"how",
"long",
"ago",
"the",
"date",
"represents",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/pretty-date.js#L9-L31 |
10,402 | jsbin/jsbin | public/js/editors/tern.js | function(name, file) {
if (!ternLoaded[name]) {
$.ajax({
url: file,
dataType: 'json',
success: function(data) {
addTernDefinition(data);
ternLoaded[name] = true;
}
});
}
} | javascript | function(name, file) {
if (!ternLoaded[name]) {
$.ajax({
url: file,
dataType: 'json',
success: function(data) {
addTernDefinition(data);
ternLoaded[name] = true;
}
});
}
} | [
"function",
"(",
"name",
",",
"file",
")",
"{",
"if",
"(",
"!",
"ternLoaded",
"[",
"name",
"]",
")",
"{",
"$",
".",
"ajax",
"(",
"{",
"url",
":",
"file",
",",
"dataType",
":",
"'json'",
",",
"success",
":",
"function",
"(",
"data",
")",
"{",
"a... | Load the json defition of the library | [
"Load",
"the",
"json",
"defition",
"of",
"the",
"library"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/editors/tern.js#L43-L54 | |
10,403 | jsbin/jsbin | public/js/editors/tern.js | function(name, file) {
if (!ternLoaded[name]) {
$.ajax({
url: file,
dataType: 'script',
success: function(data) {
ternServer.server.addFile(name, data);
ternLoaded[name] = true;
}
});
}
} | javascript | function(name, file) {
if (!ternLoaded[name]) {
$.ajax({
url: file,
dataType: 'script',
success: function(data) {
ternServer.server.addFile(name, data);
ternLoaded[name] = true;
}
});
}
} | [
"function",
"(",
"name",
",",
"file",
")",
"{",
"if",
"(",
"!",
"ternLoaded",
"[",
"name",
"]",
")",
"{",
"$",
".",
"ajax",
"(",
"{",
"url",
":",
"file",
",",
"dataType",
":",
"'script'",
",",
"success",
":",
"function",
"(",
"data",
")",
"{",
... | Load the actual js library | [
"Load",
"the",
"actual",
"js",
"library"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/editors/tern.js#L57-L68 | |
10,404 | jsbin/jsbin | lib/models/bin.js | function (data, fn) {
this.store.generateBinId(data.length, 0, function generateBinId(err, id) {
if (err) {
return fn(err);
}
data.url = id;
data.revision = 1;
data.latest = true;
data.streamingKey = this.createStreamingKey(id, data.revision);
this.store.setBin(dat... | javascript | function (data, fn) {
this.store.generateBinId(data.length, 0, function generateBinId(err, id) {
if (err) {
return fn(err);
}
data.url = id;
data.revision = 1;
data.latest = true;
data.streamingKey = this.createStreamingKey(id, data.revision);
this.store.setBin(dat... | [
"function",
"(",
"data",
",",
"fn",
")",
"{",
"this",
".",
"store",
".",
"generateBinId",
"(",
"data",
".",
"length",
",",
"0",
",",
"function",
"generateBinId",
"(",
"err",
",",
"id",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"fn",
"(",
"e... | Create a new bin. | [
"Create",
"a",
"new",
"bin",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/models/bin.js#L103-L118 | |
10,405 | jsbin/jsbin | lib/models/bin.js | function (data, fn) {
data.streamingKey = this.createStreamingKey(data.url, data.revision);
this.store.setBin(data, function (err, id) {
data.id = id;
fn(err || null, err ? undefined : data);
});
} | javascript | function (data, fn) {
data.streamingKey = this.createStreamingKey(data.url, data.revision);
this.store.setBin(data, function (err, id) {
data.id = id;
fn(err || null, err ? undefined : data);
});
} | [
"function",
"(",
"data",
",",
"fn",
")",
"{",
"data",
".",
"streamingKey",
"=",
"this",
".",
"createStreamingKey",
"(",
"data",
".",
"url",
",",
"data",
".",
"revision",
")",
";",
"this",
".",
"store",
".",
"setBin",
"(",
"data",
",",
"function",
"("... | Create a new revision. | [
"Create",
"a",
"new",
"revision",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/models/bin.js#L120-L126 | |
10,406 | jsbin/jsbin | lib/spike/index.js | function (req, res, next) {
// Check request's accepts header for event-stream. Move on if it doesn't
// support it.
if (!req.headers.accept || req.headers.accept.indexOf('text/event-stream') === -1) {
return next();
}
// Restore or create a session for the bin
var session = utils.sessio... | javascript | function (req, res, next) {
// Check request's accepts header for event-stream. Move on if it doesn't
// support it.
if (!req.headers.accept || req.headers.accept.indexOf('text/event-stream') === -1) {
return next();
}
// Restore or create a session for the bin
var session = utils.sessio... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"// Check request's accepts header for event-stream. Move on if it doesn't",
"// support it.",
"if",
"(",
"!",
"req",
".",
"headers",
".",
"accept",
"||",
"req",
".",
"headers",
".",
"accept",
".",
"indexO... | Setup an event stream for the client. This is hit on all bin endpoints. | [
"Setup",
"an",
"event",
"stream",
"for",
"the",
"client",
".",
"This",
"is",
"hit",
"on",
"all",
"bin",
"endpoints",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/spike/index.js#L174-L267 | |
10,407 | jsbin/jsbin | lib/spike/index.js | function (bin) {
var session = utils.sessionForBin(bin);
if (session) {
session.res.forEach(function (res) {
res.write('event: reload\ndata: 0\n\n');
if (res.ajax) {
res.end(); // lets older browsers finish their xhr request
res.req.emit('close');
}
});
... | javascript | function (bin) {
var session = utils.sessionForBin(bin);
if (session) {
session.res.forEach(function (res) {
res.write('event: reload\ndata: 0\n\n');
if (res.ajax) {
res.end(); // lets older browsers finish their xhr request
res.req.emit('close');
}
});
... | [
"function",
"(",
"bin",
")",
"{",
"var",
"session",
"=",
"utils",
".",
"sessionForBin",
"(",
"bin",
")",
";",
"if",
"(",
"session",
")",
"{",
"session",
".",
"res",
".",
"forEach",
"(",
"function",
"(",
"res",
")",
"{",
"res",
".",
"write",
"(",
... | Reload all connected clients | [
"Reload",
"all",
"connected",
"clients"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/spike/index.js#L272-L285 | |
10,408 | jsbin/jsbin | lib/spike/index.js | function (oldBin, newBin) {
if (!newBin || !newBin.url) {
// FIXME this is just patching a problem, the source of which I'm not sure
console.error('spike/index.js#bump-revision - missing newBin', newBin);
return;
}
var oldSession = utils.sessionForBin(oldBin),
oldKey = utils.keyF... | javascript | function (oldBin, newBin) {
if (!newBin || !newBin.url) {
// FIXME this is just patching a problem, the source of which I'm not sure
console.error('spike/index.js#bump-revision - missing newBin', newBin);
return;
}
var oldSession = utils.sessionForBin(oldBin),
oldKey = utils.keyF... | [
"function",
"(",
"oldBin",
",",
"newBin",
")",
"{",
"if",
"(",
"!",
"newBin",
"||",
"!",
"newBin",
".",
"url",
")",
"{",
"// FIXME this is just patching a problem, the source of which I'm not sure",
"console",
".",
"error",
"(",
"'spike/index.js#bump-revision - missing ... | Update spikes when a new revision is created. | [
"Update",
"spikes",
"when",
"a",
"new",
"revision",
"is",
"created",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/spike/index.js#L318-L353 | |
10,409 | jsbin/jsbin | lib/spike/index.js | function (bin, data, statsRequest) {
var id = bin.id,
delayTrigger = 500;
if (!pending[id]) {
pending[id] = {};
}
pending[id].bin = bin;
pending[id][data.panelId] = utils.process(data, bin.settings);
// Clear the previous ping
clearTimeout(pending[id].timer);
// NOTE: t... | javascript | function (bin, data, statsRequest) {
var id = bin.id,
delayTrigger = 500;
if (!pending[id]) {
pending[id] = {};
}
pending[id].bin = bin;
pending[id][data.panelId] = utils.process(data, bin.settings);
// Clear the previous ping
clearTimeout(pending[id].timer);
// NOTE: t... | [
"function",
"(",
"bin",
",",
"data",
",",
"statsRequest",
")",
"{",
"var",
"id",
"=",
"bin",
".",
"id",
",",
"delayTrigger",
"=",
"500",
";",
"if",
"(",
"!",
"pending",
"[",
"id",
"]",
")",
"{",
"pending",
"[",
"id",
"]",
"=",
"{",
"}",
";",
... | Notify connected clients of an update to a bin | [
"Notify",
"connected",
"clients",
"of",
"an",
"update",
"to",
"a",
"bin"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/spike/index.js#L358-L408 | |
10,410 | jsbin/jsbin | lib/middleware.js | function () {
return function (req, res, next) {
var headers = req.header('Access-Control-Request-Headers');
var origin = req.header('Origin');
// TODO should this check if the request is via the API?
if (req.method === 'OPTIONS' || (req.method === 'GET' && req.headers.origin)) {
re... | javascript | function () {
return function (req, res, next) {
var headers = req.header('Access-Control-Request-Headers');
var origin = req.header('Origin');
// TODO should this check if the request is via the API?
if (req.method === 'OPTIONS' || (req.method === 'GET' && req.headers.origin)) {
re... | [
"function",
"(",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"headers",
"=",
"req",
".",
"header",
"(",
"'Access-Control-Request-Headers'",
")",
";",
"var",
"origin",
"=",
"req",
".",
"header",
"(",
"'Origin'",
... | Add relevant CORS headers for the application. | [
"Add",
"relevant",
"CORS",
"headers",
"for",
"the",
"application",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/middleware.js#L40-L61 | |
10,411 | jsbin/jsbin | lib/middleware.js | function (options) {
var ignore = options.ignore || [],
csrf = csurf(options),
always = {OPTIONS: 1, GET: 1, HEAD: 1};
return function (req, res, next) {
if (always[req.method]) {
return csrf(req, res, next);
} else {
var url = parse(req.url);
var skipCSRF = ... | javascript | function (options) {
var ignore = options.ignore || [],
csrf = csurf(options),
always = {OPTIONS: 1, GET: 1, HEAD: 1};
return function (req, res, next) {
if (always[req.method]) {
return csrf(req, res, next);
} else {
var url = parse(req.url);
var skipCSRF = ... | [
"function",
"(",
"options",
")",
"{",
"var",
"ignore",
"=",
"options",
".",
"ignore",
"||",
"[",
"]",
",",
"csrf",
"=",
"csurf",
"(",
"options",
")",
",",
"always",
"=",
"{",
"OPTIONS",
":",
"1",
",",
"GET",
":",
"1",
",",
"HEAD",
":",
"1",
"}"... | monkey patch for express' own csrf method, so we can ignore specific url patterns | [
"monkey",
"patch",
"for",
"express",
"own",
"csrf",
"method",
"so",
"we",
"can",
"ignore",
"specific",
"url",
"patterns"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/middleware.js#L118-L149 | |
10,412 | jsbin/jsbin | lib/middleware.js | function () {
return function (req, res, next) {
var apphost = config.url.host,
outputHost = undefsafe(config, 'security.preview'),
host = req.header('Host', ''),
offset = host.indexOf(apphost);
if (host === outputHost) {
offset = host.indexOf(outputHost);
}
... | javascript | function () {
return function (req, res, next) {
var apphost = config.url.host,
outputHost = undefsafe(config, 'security.preview'),
host = req.header('Host', ''),
offset = host.indexOf(apphost);
if (host === outputHost) {
offset = host.indexOf(outputHost);
}
... | [
"function",
"(",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"apphost",
"=",
"config",
".",
"url",
".",
"host",
",",
"outputHost",
"=",
"undefsafe",
"(",
"config",
",",
"'security.preview'",
")",
",",
"host",
... | Checks for a subdomain in the current url, if found it sets the req.subdomain property. This supports existing behaviour that allows subdomains to load custom config files. | [
"Checks",
"for",
"a",
"subdomain",
"in",
"the",
"current",
"url",
"if",
"found",
"it",
"sets",
"the",
"req",
".",
"subdomain",
"property",
".",
"This",
"supports",
"existing",
"behaviour",
"that",
"allows",
"subdomains",
"to",
"load",
"custom",
"config",
"fi... | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/middleware.js#L153-L171 | |
10,413 | jsbin/jsbin | lib/middleware.js | function (options) {
// Parse a string representing a file size and convert it into bytes.
// A number on it's own will be assumed to be bytes. A multiple such as
// "k" or "m" can be appended to the string to handle larger numbers. This
// is case insensitive and uses powers of 1024 rather than (1000).... | javascript | function (options) {
// Parse a string representing a file size and convert it into bytes.
// A number on it's own will be assumed to be bytes. A multiple such as
// "k" or "m" can be appended to the string to handle larger numbers. This
// is case insensitive and uses powers of 1024 rather than (1000).... | [
"function",
"(",
"options",
")",
"{",
"// Parse a string representing a file size and convert it into bytes.",
"// A number on it's own will be assumed to be bytes. A multiple such as",
"// \"k\" or \"m\" can be appended to the string to handle larger numbers. This",
"// is case insensitive and uses... | Limit the file size that can be uploaded. | [
"Limit",
"the",
"file",
"size",
"that",
"can",
"be",
"uploaded",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/middleware.js#L174-L211 | |
10,414 | jsbin/jsbin | lib/middleware.js | function () {
return function (req, res, next) {
var userModel = models.user;
if (req.url.indexOf('/api') === 0) {
req.isApi = true;
// Make the API requests stateless by removin the cookie set by middleware cookieSession
onHeaders(res, () => res.removeHeader('Set-Cookie'));
... | javascript | function () {
return function (req, res, next) {
var userModel = models.user;
if (req.url.indexOf('/api') === 0) {
req.isApi = true;
// Make the API requests stateless by removin the cookie set by middleware cookieSession
onHeaders(res, () => res.removeHeader('Set-Cookie'));
... | [
"function",
"(",
")",
"{",
"return",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"userModel",
"=",
"models",
".",
"user",
";",
"if",
"(",
"req",
".",
"url",
".",
"indexOf",
"(",
"'/api'",
")",
"===",
"0",
")",
"{",
"req",
... | detect if this is an API request and add flag isApi to the request object | [
"detect",
"if",
"this",
"is",
"an",
"API",
"request",
"and",
"add",
"flag",
"isApi",
"to",
"the",
"request",
"object"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/lib/middleware.js#L214-L278 | |
10,415 | jsbin/jsbin | public/js/render/console.js | function (cmd, cb) {
var internalCmd = internalCommand(cmd);
if (internalCmd) {
return cb(['info', internalCmd]);
}
$document.trigger('console:run', cmd);
} | javascript | function (cmd, cb) {
var internalCmd = internalCommand(cmd);
if (internalCmd) {
return cb(['info', internalCmd]);
}
$document.trigger('console:run', cmd);
} | [
"function",
"(",
"cmd",
",",
"cb",
")",
"{",
"var",
"internalCmd",
"=",
"internalCommand",
"(",
"cmd",
")",
";",
"if",
"(",
"internalCmd",
")",
"{",
"return",
"cb",
"(",
"[",
"'info'",
",",
"internalCmd",
"]",
")",
";",
"}",
"$document",
".",
"trigge... | Run a console command. | [
"Run",
"a",
"console",
"command",
"."
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/render/console.js#L22-L28 | |
10,416 | jsbin/jsbin | public/js/render/console.js | function (cmd, blind, response) {
var toecho = '';
if (typeof cmd !== 'string') {
toecho = cmd.echo;
blind = cmd.blind;
response = cmd.response;
cmd = cmd.cmd;
} else {
toecho = cmd;
}
cmd = trim(cmd);
// Add the command to the user's history – unless this was blind
if (!blind) {
... | javascript | function (cmd, blind, response) {
var toecho = '';
if (typeof cmd !== 'string') {
toecho = cmd.echo;
blind = cmd.blind;
response = cmd.response;
cmd = cmd.cmd;
} else {
toecho = cmd;
}
cmd = trim(cmd);
// Add the command to the user's history – unless this was blind
if (!blind) {
... | [
"function",
"(",
"cmd",
",",
"blind",
",",
"response",
")",
"{",
"var",
"toecho",
"=",
"''",
";",
"if",
"(",
"typeof",
"cmd",
"!==",
"'string'",
")",
"{",
"toecho",
"=",
"cmd",
".",
"echo",
";",
"blind",
"=",
"cmd",
".",
"blind",
";",
"response",
... | Run and show response to a command fired from the console | [
"Run",
"and",
"show",
"response",
"to",
"a",
"command",
"fired",
"from",
"the",
"console"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/render/console.js#L33-L62 | |
10,417 | jsbin/jsbin | public/js/render/console.js | function (response) {
// order so it appears at the top
var el = document.createElement('div'),
li = document.createElement('li'),
span = document.createElement('span'),
parent = output.parentNode;
historyPosition = history.length;
if (typeof response === 'undefined') return;
el.classNam... | javascript | function (response) {
// order so it appears at the top
var el = document.createElement('div'),
li = document.createElement('li'),
span = document.createElement('span'),
parent = output.parentNode;
historyPosition = history.length;
if (typeof response === 'undefined') return;
el.classNam... | [
"function",
"(",
"response",
")",
"{",
"// order so it appears at the top",
"var",
"el",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
",",
"li",
"=",
"document",
".",
"createElement",
"(",
"'li'",
")",
",",
"span",
"=",
"document",
".",
"createE... | Display the result of a command to the user | [
"Display",
"the",
"result",
"of",
"a",
"command",
"to",
"the",
"user"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/render/console.js#L67-L104 | |
10,418 | jsbin/jsbin | public/js/vendor/codemirror3/mode/stex/stex.js | getMostPowerful | function getMostPowerful(state) {
var context = state.cmdState;
for (var i = context.length - 1; i >= 0; i--) {
var plug = context[i];
if (plug.name == "DEFAULT") {
continue;
}
return plug;
}
return { styleIdentifier: functi... | javascript | function getMostPowerful(state) {
var context = state.cmdState;
for (var i = context.length - 1; i >= 0; i--) {
var plug = context[i];
if (plug.name == "DEFAULT") {
continue;
}
return plug;
}
return { styleIdentifier: functi... | [
"function",
"getMostPowerful",
"(",
"state",
")",
"{",
"var",
"context",
"=",
"state",
".",
"cmdState",
";",
"for",
"(",
"var",
"i",
"=",
"context",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"var",
"plug",
"=",
"cont... | returns the non-default plugin closest to the end of the list | [
"returns",
"the",
"non",
"-",
"default",
"plugin",
"closest",
"to",
"the",
"end",
"of",
"the",
"list"
] | d962c36fff71104acad98ac07629c1331704d420 | https://github.com/jsbin/jsbin/blob/d962c36fff71104acad98ac07629c1331704d420/public/js/vendor/codemirror3/mode/stex/stex.js#L29-L39 |
10,419 | 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 | |
10,420 | 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 | |
10,421 | 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 | |
10,422 | 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 | |
10,423 | 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 |
10,424 | 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 |
10,425 | 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 |
10,426 | 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 | |
10,427 | 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 |
10,428 | 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 |
10,429 | 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 |
10,430 | 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 |
10,431 | 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 | |
10,432 | 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 |
10,433 | 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 |
10,434 | 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 | |
10,435 | 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 | |
10,436 | 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 |
10,437 | 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 |
10,438 | 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 |
10,439 | 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 | |
10,440 | 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 | |
10,441 | 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 |
10,442 | 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 |
10,443 | 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 | |
10,444 | 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 |
10,445 | 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 |
10,446 | 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 |
10,447 | 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 |
10,448 | 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 |
10,449 | 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 |
10,450 | 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 |
10,451 | 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 |
10,452 | 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 |
10,453 | 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 |
10,454 | 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 |
10,455 | 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 |
10,456 | 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 |
10,457 | 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 |
10,458 | 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 |
10,459 | 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 |
10,460 | 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 |
10,461 | 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 |
10,462 | 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 |
10,463 | 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 |
10,464 | 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 |
10,465 | 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 |
10,466 | 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 | |
10,467 | 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 | |
10,468 | 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 | |
10,469 | 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 | |
10,470 | 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 | |
10,471 | 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 |
10,472 | 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 | |
10,473 | 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 | |
10,474 | 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 | |
10,475 | 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 | |
10,476 | 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 | |
10,477 | 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 | |
10,478 | 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 |
10,479 | 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 | |
10,480 | 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 | |
10,481 | 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 |
10,482 | 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 |
10,483 | 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 |
10,484 | 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 |
10,485 | 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 |
10,486 | 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 | |
10,487 | 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 | |
10,488 | 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 | |
10,489 | 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 | |
10,490 | 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 | |
10,491 | 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 | |
10,492 | 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 | |
10,493 | 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 | |
10,494 | 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 | |
10,495 | 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 | |
10,496 | 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 | |
10,497 | 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 | |
10,498 | 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 | |
10,499 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.