_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 52 373k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q45400 | gaussian | train | function gaussian(src, s, kernelSize) {
if (typeof s === 'undefined') s = 1;
if (typeof kernelSize === 'undefined') kernelSize = 7;
var kernel = gaussianKernel1D(s, kernelSize),
l = kernelSize || kernel.length,
kernelH = [kernel],
kernelV = new Array(l);
for (var i = 0; i < l; i+... | javascript | {
"resource": ""
} |
q45401 | train | function(SOAPEnvelope, siteDataOperation) {
var siteDataOp = siteDataOperation.substring(8);
SOAPEnvelope.opheader = SOAPEnvelope.opheader.replace(siteDataOperation, siteDataOp);
SOAPEnvelope.opfooter = SOAPEnvelope.opfooter.replace(siteDataOperation, siteDataOp);
return ... | javascript | {
"resource": ""
} | |
q45402 | getScriptAttribute | train | function getScriptAttribute(source, attribute) {
var matches;
var regex = RegExp(attribute + "=(\"([^\"]*)\")|('([^']*)')", "gi");
if (matches = regex.exec(source)) {
return matches[2];
}
return null;
} | javascript | {
"resource": ""
} |
q45403 | showAttrs | train | function showAttrs(node) {
var i;
var out = "<table class='ms-vb' width='100%'>";
for (i = 0; i < node.attributes.length; i++) {
out += "<tr><td width='10px' style='font-weight:bold;'>" + i + "</td><td width='100px'>" +
node.attributes.item(i).nodeName + "</td><td>" + che... | javascript | {
"resource": ""
} |
q45404 | errBox | train | function errBox(func, param, msg) {
var errMsg = "<b>Error in function</b><br/>" + func + "<br/>" +
"<b>Parameter</b><br/>" + param + "<br/>" +
"<b>Message</b><br/>" + msg + "<br/><br/>" +
"<span onmouseover='this.style.cursor=\"hand\";' onmouseout='this.style.cursor=\"inheri... | javascript | {
"resource": ""
} |
q45405 | modalBox | train | function modalBox(msg) {
var boxCSS = "position:absolute;width:300px;height:150px;padding:10px;background-color:#000000;color:#ffffff;z-index:30;font-family:'Arial';font-size:12px;display:none;";
$("#aspnetForm").parent().append("<div id='SPServices_msgBox' style=" + boxCSS + ">" + msg);
var msg... | javascript | {
"resource": ""
} |
q45406 | genContainerId | train | function genContainerId(funcname, columnName, listName) {
var l = listName !== undefined ? listName : $().SPServices.SPListNameFromUrl();
return funcname + "_" + $().SPServices.SPGetStaticFromDisplay({
listName: l,
columnDisplayName: columnName
});
} | javascript | {
"resource": ""
} |
q45407 | getListFormUrl | train | function getListFormUrl(l, f) {
var u;
$().SPServices({
operation: "GetFormCollection",
async: false,
listName: l,
completefunc: function (xData) {
u = $(xData.responseXML).find("Form[Type='" + f + "']").attr("Url");
}
... | javascript | {
"resource": ""
} |
q45408 | checkLink | train | function checkLink(s) {
return ((s.indexOf("http") === 0) || (s.indexOf(SLASH) === 0)) ? "<a href='" + s + "'>" + s + "</a>" : s;
} | javascript | {
"resource": ""
} |
q45409 | coreScript | train | function coreScript(src) {
var coreScriptLocations = ["WebResource.axd", "_layouts"];
for (var i = 0; i < coreScriptLocations.length; i++) {
if (src.indexOf(coreScriptLocations[i]) > -1) {
return true;
}
}
return false;
} | javascript | {
"resource": ""
} |
q45410 | getSvgHeight | train | function getSvgHeight (svg, filename) {
const parseSvg = /<svg[^>]+height\s*=\s*["']?(\d+)\s*(pt|px|)["']?/i.exec(svg);
if (!parseSvg) {
throw new Error(`could not read height for '${filename}'.`);
}
return parseSvg[1];
} | javascript | {
"resource": ""
} |
q45411 | train | function (address, cb) {
setupMultiserver()
ms_client.client(coearseAddress(address), function (err, stream) {
return err ? cb(err) : cb(null, setupRPC(stream, null, true))
})
} | javascript | {
"resource": ""
} | |
q45412 | train | function (done) {
fs.readdir(globalConfig.root, function (err, files) {
if (err) return callback(err)
async.map(files, function (f, next) {
if (f !== 'apps' && f !== 'repos') {
f = globalConfig.root + '/' + f
... | javascript | {
"resource": ""
} | |
q45413 | initialize | train | function initialize(success, error, opts) {
console.log("AudioInputCaptureProxy: initialize: " + JSON.stringify(opts));
onInitialized = success;
if (!intialized) {
sampleRate = opts[0] || sampleRate;
bufferSize = opts[1] || bufferSize;
channels = opts[2] || channels;
format =... | javascript | {
"resource": ""
} |
q45414 | gotBuffers | train | function gotBuffers(wav) {
if (channels == 1) {
audioRecorder.exportMonoWAV(doneEncoding, wav);
}
else {
audioRecorder.exportWAV(doneEncoding, wav);
}
} | javascript | {
"resource": ""
} |
q45415 | train | function () {
if (window.cordova && window.cordova.file && window.audioinput) {
initUIEvents();
consoleMessage("Use 'Start Capture' to begin...");
// Subscribe to audioinput events
//
window.addEventListener('audioinput', onAudioInputCapture, false);
window.addEve... | javascript | {
"resource": ""
} | |
q45416 | train | function (bufferSize, numberOfIterations) {
var bufSize = bufferSize || 16000,
iterations = numberOfIterations || 100;
for (var i = 0; i < iterations; i++) {
var data = [];
for (var k = 0; k < bufSize; k++) {
data.push((parseFloat(Math.random() * 1.0) - 0.5));
}
... | javascript | {
"resource": ""
} | |
q45417 | train | function () {
var duration = 50;
// Check if there is any data in the queue
if (audioDataQueue.length > 0) {
// Concatenate up to concatenateMaxChunks data arrays from the queue
var concatenatedData = [];
for (var i = 0; i < concatenateMaxChunks; i++) {
if (audioDataQue... | javascript | {
"resource": ""
} | |
q45418 | train | function (data) {
try {
// Create an audio buffer to hold the data
var audioBuffer = audioContext.createBuffer(captureCfg.channels, (data.length / captureCfg.channels),
captureCfg.sampleRate);
// Initialize the audio buffer with the data
if (captureCfg.channels > 1) {
... | javascript | {
"resource": ""
} | |
q45419 | train | function () {
try {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
audioContext = new window.AudioContext();
consoleMessage("Web Audio Context is ready");
}
catch (e) {
consoleMessage('Web Audio API is not supported in this browser: ' + e);
re... | javascript | {
"resource": ""
} | |
q45420 | train | function(header,msg,opts){
opts = _setOpts(opts);
return $uibModal.open({
templateUrl : '/dialogs/notify.html',
controller : 'notifyDialogCtrl',
backdrop: opts.bd,
backdropClass: opts.bdc,
keyboard: opts.kb,
windowClass: opts.wc,
size: opts.ws,
animation: opts.... | javascript | {
"resource": ""
} | |
q45421 | train | function(url,ctrlr,data,opts,ctrlAs){
var copy = (opts && angular.isDefined(opts.copy)) ? opts.copy : _copy;
opts = _setOpts(opts);
return $uibModal.open({
templateUrl : url,
controller : ctrlr,
controllerAs : ctrlAs,
keyboard : opts.kb,
backdrop : opts.bd,
backdropCl... | javascript | {
"resource": ""
} | |
q45422 | train | function(component, data, opts) {
var copy = (opts && angular.isDefined(opts.copy)) ? opts.copy : _copy;
opts = _setOpts(opts);
return $uibModal.open({
component : component,
keyboard : opts.kb,
backdrop : opts.bd,
backdropClass: opts.bdc,
windowClass: opts.wc,
size: ... | javascript | {
"resource": ""
} | |
q45423 | pushToken | train | function pushToken(type, value, column) {
tokens.push({
tn: tn++,
ln: ln,
col: column,
type: type,
value: value
});
} | javascript | {
"resource": ""
} |
q45424 | parseMLComment | train | function parseMLComment(css) {
var start = pos;
// Read the string until we meet `*/`.
// Since we already know first 2 characters (`/*`), start reading
// from `pos + 2`:
for (pos += 2; pos < css.length; pos++) {
if (css.charAt(pos) === '*' && css.charAt(pos + 1) === '/') {
pos++;
... | javascript | {
"resource": ""
} |
q45425 | parseSLComment | train | function parseSLComment(css) {
var start = pos;
// Read the string until we meet line break.
// Since we already know first 2 characters (`//`), start reading
// from `pos + 2`:
for (pos += 2; pos < css.length; pos++) {
if (css.charAt(pos) === '\n' || css.charAt(pos) === '\r') {
break... | javascript | {
"resource": ""
} |
q45426 | getTokens | train | function getTokens(css) {
// Parse string, character by character:
for (pos = 0; pos < css.length; col++, pos++) {
c = css.charAt(pos);
cn = css.charAt(pos + 1);
// If we meet `/*`, it's a start of a multiline comment.
// Parse following characters as a multiline comment:
if (c ==... | javascript | {
"resource": ""
} |
q45427 | checkArgument | train | function checkArgument(i) {
let l;
if (l = checkBrackets(i)) tokens[i].argument_child = 1;
else if (l = checkParentheses(i)) tokens[i].argument_child = 2;
else if (l = checkSingleValueDeclaration(i)) tokens[i].argument_child = 3;
else if (l = checkFunctionsList(i)) tokens[i].argument_child = 4;
else if (l ... | javascript | {
"resource": ""
} |
q45428 | getClass | train | function getClass() {
const type = NodeType.ClassType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const end = token.classEnd;
let content = [];
// Skip `.`
pos++;
while (pos < end) {
if (checkIdentOrInterpolation(pos)) {
content = content.concat(getIdentOrI... | javascript | {
"resource": ""
} |
q45429 | getCommentSL | train | function getCommentSL() {
const type = NodeType.CommentSLType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = tokens[pos++].value.substring(2);
const end = !content ? [line, column + 1]
: getLastPosition(content, line, column + 2);
return newNode(type, con... | javascript | {
"resource": ""
} |
q45430 | checkDeclDelim | train | function checkDeclDelim(i) {
if (i >= tokensLength) return 0;
return (tokens[i].type === TokenType.Newline ||
tokens[i].type === TokenType.Semicolon) ? 1 : 0;
} | javascript | {
"resource": ""
} |
q45431 | getDeclDelim | train | function getDeclDelim() {
const type = NodeType.DeclDelimType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = '\n';
pos++;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45432 | getDefault | train | function getDefault() {
const type = NodeType.DefaultType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = joinValues(pos, token.defaultEnd);
pos = token.defaultEnd + 1;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45433 | getDelim | train | function getDelim() {
const type = NodeType.DelimType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = ',';
pos++;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45434 | getDimension | train | function getDimension() {
const type = NodeType.DimensionType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = [
getNumber(),
getUnit()
];
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45435 | getFunctionsList | train | function getFunctionsList() {
const type = NodeType.FunctionsListType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = [getFunction()];
const end = getLastPosition(content, line, column, 3);
// Skip `...`.
pos += 3;
return newNode(type, content, line, colu... | javascript | {
"resource": ""
} |
q45436 | getIdent | train | function getIdent() {
const type = NodeType.IdentType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = joinValues(pos, tokens[pos].ident_last);
pos = tokens[pos].ident_last + 1;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45437 | checkImportant | train | function checkImportant(i) {
const start = i;
let l;
if (i >= tokensLength ||
tokens[i++].type !== TokenType.ExclamationMark) return 0;
if (l = checkSC(i)) i += l;
if (tokens[i].value === 'important') {
tokens[start].importantEnd = i;
return i - start + 1;
} else {
return 0;
}
} | javascript | {
"resource": ""
} |
q45438 | checkInclude | train | function checkInclude(i) {
let l;
if (i >= tokensLength) return 0;
if (l = checkIncludeWithKeyframes1(i)) tokens[i].include_type = 9;
else if (l = checkInclude1(i)) tokens[i].include_type = 1;
else if (l = checkInclude2(i)) tokens[i].include_type = 2;
else if (l = checkInclude3(i)) tokens[i].include_type ... | javascript | {
"resource": ""
} |
q45439 | getInterpolation | train | function getInterpolation() {
const type = NodeType.InterpolationType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
let content = [];
// Skip `#{`:
pos += 2;
while (pos < tokensLength &&
tokens[pos].type !== TokenType.RightCurlyBracket) {
const body = getArgume... | javascript | {
"resource": ""
} |
q45440 | checkKeyframesRule | train | function checkKeyframesRule(i) {
const start = i;
let l;
if (i >= tokensLength) return 0;
if (l = checkAtkeyword(i)) i += l;
else return 0;
const atruleName = joinValues2(i - l, l);
if (atruleName.toLowerCase().indexOf('keyframes') === -1) return 0;
if (l = checkSC(i)) i += l;
else return 0;
if... | javascript | {
"resource": ""
} |
q45441 | checkKeyframesSelector | train | function checkKeyframesSelector(i) {
const start = i;
let l;
if (i >= tokensLength) return 0;
if (l = checkIdent(i)) {
// Valid selectors are only `from` and `to`.
const selector = joinValues2(i, l);
if (selector !== 'from' && selector !== 'to') return 0;
i += l;
tokens[start].keyframesSe... | javascript | {
"resource": ""
} |
q45442 | getLoop | train | function getLoop() {
const type = NodeType.LoopType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
let content = [];
content.push(getAtkeyword());
while (pos < tokensLength) {
if (checkBlock(pos)) {
content.push(getBlock());
break;
}
else if (checkVa... | javascript | {
"resource": ""
} |
q45443 | getNamespace | train | function getNamespace() {
const type = NodeType.NamespaceType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = '|';
pos++;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45444 | checkNumber | train | function checkNumber(i) {
if (i >= tokensLength) return 0;
if (tokens[i].number_l) return tokens[i].number_l;
// `10`:
if (i < tokensLength && tokens[i].type === TokenType.DecimalNumber &&
(!tokens[i + 1] ||
(tokens[i + 1] && tokens[i + 1].type !== TokenType.FullStop))) {
tokens[i].number_l = ... | javascript | {
"resource": ""
} |
q45445 | getNumber | train | function getNumber() {
const type = NodeType.NumberType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const l = tokens[pos].number_l;
let content = '';
for (let j = 0; j < l; j++) {
content += tokens[pos + j].value;
}
pos += l;
return newNode(type, content, line... | javascript | {
"resource": ""
} |
q45446 | getOperator | train | function getOperator() {
const type = NodeType.OperatorType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = token.value;
pos++;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45447 | getParentSelector | train | function getParentSelector() {
const type = NodeType.ParentSelectorType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = '&';
pos++;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45448 | getPercentage | train | function getPercentage() {
const type = NodeType.PercentageType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = getNumberOrInterpolation();
const end = getLastPosition(content, line, column, 1);
// Skip `%`.
pos++;
return newNode(type, content, line, colu... | javascript | {
"resource": ""
} |
q45449 | checkNumberOrInterpolation | train | function checkNumberOrInterpolation(i) {
const start = i;
let l;
while (i < tokensLength) {
if (l = checkInterpolation(i) || checkNumber(i)) i += l;
else break;
}
return i - start;
} | javascript | {
"resource": ""
} |
q45450 | getPlaceholder | train | function getPlaceholder() {
const type = NodeType.PlaceholderType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
let content = [];
// Skip `%`.
pos++;
content = content.concat(getIdentOrInterpolation());
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45451 | checkCustomProperty | train | function checkCustomProperty(i) {
const start = i;
let l;
if (i >= tokensLength) return 0;
if (tokens[i].type !== TokenType.HyphenMinus ||
tokens[i + 1] && tokens[i + 1].type !== TokenType.HyphenMinus) return 0;
// Skip `--`
i += 2;
if (l = checkIdentOrInterpolation(i)) i += l;
else return 0;
... | javascript | {
"resource": ""
} |
q45452 | getCustomProperty | train | function getCustomProperty() {
const type = NodeType.CustomPropertyType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
// Skip `--`
pos += 2;
const content = getIdentOrInterpolation();
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45453 | getPropertyDelim | train | function getPropertyDelim() {
const type = NodeType.PropertyDelimType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = ':';
// Skip `:`.
pos++;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45454 | getS | train | function getS() {
const type = NodeType.SType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = joinValues(pos, tokens[pos].ws_last);
pos = tokens[pos].ws_last + 1;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45455 | checkMultilineSC | train | function checkMultilineSC(i) {
if (!tokens[i]) return 0;
let l;
let lsc = 0;
while (i < tokensLength) {
if (!(l = checkS(i)) &&
!(l = checkCommentML(i)) &&
!(l = checkCommentSL(i))) break;
i += l;
lsc += l;
}
return lsc || 0;
} | javascript | {
"resource": ""
} |
q45456 | getString | train | function getString() {
const type = NodeType.StringType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = token.value;
pos++;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45457 | getUnicodeRange | train | function getUnicodeRange() {
const type = NodeType.UnicodeRangeType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
let content = [];
while (pos < tokensLength) {
if (checkSC(pos)) content = content.concat(getSC());
else if (checkDelim(pos)) content.push(getDelim());
... | javascript | {
"resource": ""
} |
q45458 | getUnit | train | function getUnit() {
const type = NodeType.IdentType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = token.value;
pos++;
return newNode(type, content, line, column);
} | javascript | {
"resource": ""
} |
q45459 | _checkUnicodeWildcard | train | function _checkUnicodeWildcard(i) {
const start = i;
if (i >= tokensLength) return 0;
while (i < tokensLength) {
if (tokens[i].type === TokenType.QuestionMark) i += 1;
else break;
}
return i - start;
} | javascript | {
"resource": ""
} |
q45460 | getUri | train | function getUri() {
const startPos = pos;
const type = NodeType.UriType;
const token = tokens[startPos];
const line = token.ln;
const column = token.col;
let content = [];
let end;
const uriType = tokens[startPos].uriType;
// Skip `url` and `(`.
pos += 2;
if (uriType === 1) content = content.co... | javascript | {
"resource": ""
} |
q45461 | checkUriRawCharacters | train | function checkUriRawCharacters(i) {
const start = i;
let l;
if (l = checkIdent(i)) i += l;
else if (l = checkNumber(i)) i += l;
else {
switch (tokens[i].type) {
case TokenType.ExclamationMark:
case TokenType.NumberSign:
case TokenType.DollarSign:
case TokenType.PercentSign:
... | javascript | {
"resource": ""
} |
q45462 | checkUriRaw | train | function checkUriRaw(i) {
const start = i;
let l;
while (i < tokensLength) {
if (checkInterpolation(i) || checkVariable(i)) break;
else if (l = checkUriRawCharacters(i)) i += l;
else break;
}
tokens[start].uri_raw_end = i;
return i - start;
} | javascript | {
"resource": ""
} |
q45463 | getUriRaw | train | function getUriRaw() {
const startPos = pos;
const type = NodeType.RawType;
const token = tokens[startPos];
const line = token.ln;
const column = token.col;
let content = [];
let l;
while (pos < tokens[startPos].uri_raw_end) {
if (checkInterpolation(pos) || checkVariable(pos)) break;
else if (l... | javascript | {
"resource": ""
} |
q45464 | checkVariable | train | function checkVariable(i) {
const start = i;
let l;
if (i >= tokensLength) return 0;
// Skip `$`.
if (tokens[i].type === TokenType.DollarSign) i++;
else return 0;
if (l = checkIdent(i)) i += l;
else return 0;
return i - start;
} | javascript | {
"resource": ""
} |
q45465 | getVariablesList | train | function getVariablesList() {
const type = NodeType.VariablesListType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = [getVariable()];
const end = getLastPosition(content, line, column, 3);
// Skip `...`.
pos += 3;
return newNode(type, content, line, colu... | javascript | {
"resource": ""
} |
q45466 | checkSelector1 | train | function checkSelector1(i) {
if (i >= tokensLength) return 0;
const start = i;
let l;
if (l = checkCompoundSelector(i)) i += l;
else return 0;
while (i < tokensLength) {
let space = checkSC(i);
const comma = checkCombinator(i + space);
if (!space && !comma) break;
if (comma) {
i +=... | javascript | {
"resource": ""
} |
q45467 | checkSelector2 | train | function checkSelector2(i) {
if (i >= tokensLength) return 0;
const start = i;
let l;
if (l = checkCombinator(i)) i += l;
else return 0;
while (i < tokensLength) {
const spaceBefore = checkSC(i);
if (l = checkCompoundSelector(i + spaceBefore)) i += spaceBefore + l;
else break;
const spac... | javascript | {
"resource": ""
} |
q45468 | checkTypeSelector | train | function checkTypeSelector(i) {
if (i >= tokensLength) return 0;
const start = i;
let l;
if (l = checkNamePrefix(i)) i += l;
if (l = checkIdentOrInterpolation(i)) i += l;
else return 0;
return i - start;
} | javascript | {
"resource": ""
} |
q45469 | getTypeSelector | train | function getTypeSelector() {
const type = NodeType.TypeSelectorType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
let content = [];
if (checkNamePrefix(pos)) content.push(getNamePrefix());
content = content.concat(getIdentOrInterpolation());
return newNode(type, content... | javascript | {
"resource": ""
} |
q45470 | checkArgument | train | function checkArgument(i) {
let l;
if (l = checkEscapedString(i)) tokens[i].argument_child = 1;
else if (l = checkDeclaration(i)) tokens[i].argument_child = 2;
else if (l = checkVariablesList(i)) tokens[i].argument_child = 3;
else if (l = checkVariable(i)) tokens[i].argument_child = 4;
else if (l = checkSC... | javascript | {
"resource": ""
} |
q45471 | checkAtrule | train | function checkAtrule(i) {
let l;
if (i >= tokensLength) return 0;
// If token already has a record of being part of an @-rule,
// return the @-rule's length:
if (tokens[i].atrule_l !== undefined) return tokens[i].atrule_l;
// If token is part of an @-rule, save the rule's type to token.
if (l = checkKe... | javascript | {
"resource": ""
} |
q45472 | checkAtruler | train | function checkAtruler(i) {
const start = i;
let l;
if (i >= tokensLength) return 0;
if (l = checkAtkeyword(i)) i += l;
else return 0;
if (l = checkTsets(i)) i += l;
if (i < tokensLength && tokens[i].type === TokenType.LeftCurlyBracket) i++;
else return 0;
if (l = checkAtrulers(i)) i += l;
if (... | javascript | {
"resource": ""
} |
q45473 | getBlock | train | function getBlock() {
const type = NodeType.BlockType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const end = tokens[pos].right;
let content = [];
// Skip `{`.
pos++;
while (pos < end) {
if (checkBlockdecl(pos)) content = content.concat(getBlockdecl());
else ... | javascript | {
"resource": ""
} |
q45474 | getCommentML | train | function getCommentML() {
const type = NodeType.CommentMLType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
let content = tokens[pos].value.substring(2);
const l = content.length;
if (content.charAt(l - 2) === '*' && content.charAt(l - 1) === '/')
content = content.subs... | javascript | {
"resource": ""
} |
q45475 | checkCondition | train | function checkCondition(i) {
const start = i;
let l;
if (i >= tokensLength) return 0;
if ((l = checkIdent(i)) && tokens[i].value === 'when') i += l;
else return 0;
while (i < tokensLength) {
if (l = checkBlock(i)) {
tokens[i].condition_child = 0;
break;
} else if (l = checkFunction(i)... | javascript | {
"resource": ""
} |
q45476 | getEscapedString | train | function getEscapedString() {
const type = NodeType.EscapedStringType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
pos++;
const content = tokens[pos].value;
const end = getLastPosition(content, line, column + 1);
pos++;
return newNode(type, content, line, column, en... | javascript | {
"resource": ""
} |
q45477 | checkIdent | train | function checkIdent(i) {
const start = i;
if (i >= tokensLength) return 0;
if (tokens[i].type === TokenType.HyphenMinus) i++;
if (tokens[i].type === TokenType.LowLine ||
tokens[i].type === TokenType.Identifier) i++;
else return 0;
for (; i < tokensLength; i++) {
if (tokens[i].type !== TokenTyp... | javascript | {
"resource": ""
} |
q45478 | checkInclude | train | function checkInclude(i) {
let l;
if (i >= tokensLength) return 0;
if (l = checkInclude1(i)) tokens[i].include_type = 1;
else if (l = checkInclude2(i)) tokens[i].include_type = 2;
return l;
} | javascript | {
"resource": ""
} |
q45479 | checkInterpolatedVariable | train | function checkInterpolatedVariable(i) {
const start = i;
let l;
if (i >= tokensLength) return 0;
if (tokens[i].type !== TokenType.CommercialAt ||
!tokens[i + 1] || tokens[i + 1].type !== TokenType.LeftCurlyBracket) {
return 0;
}
i += 2;
if (l = checkIdent(i)) i += l;
else return 0;
retu... | javascript | {
"resource": ""
} |
q45480 | getInterpolatedVariable | train | function getInterpolatedVariable() {
const type = NodeType.InterpolatedVariableType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = [];
// Skip `@{`:
pos += 2;
content.push(getIdent());
const end = getLastPosition(content, line, column, 1);
// Skip `}... | javascript | {
"resource": ""
} |
q45481 | getUri | train | function getUri() {
const startPos = pos;
const uriExcluding = {};
let uri;
let token;
let l;
let raw;
pos += 2;
uriExcluding[TokenType.Space] = 1;
uriExcluding[TokenType.Tab] = 1;
uriExcluding[TokenType.Newline] = 1;
uriExcluding[TokenType.LeftParenthesis] = 1;
uriExcluding[TokenType.RightPar... | javascript | {
"resource": ""
} |
q45482 | checkVariable | train | function checkVariable(i) {
let l;
if (i >= tokensLength || tokens[i].type !== TokenType.CommercialAt) return 0;
if (tokens[i - 1] &&
tokens[i - 1].type === TokenType.CommercialAt &&
tokens[i - 2] &&
tokens[i - 2].type === TokenType.CommercialAt) return 0;
return (l = checkVariable(i + 1) |... | javascript | {
"resource": ""
} |
q45483 | getVariable | train | function getVariable() {
const type = NodeType.VariableType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = [];
// Skip `$`.
pos++;
if (checkVariable(pos)) content.push(getVariable());
else content.push(getIdent());
return newNode(type, content, line, ... | javascript | {
"resource": ""
} |
q45484 | checkInclude3 | train | function checkInclude3(i) {
const start = i;
let l;
if (l = checkAtkeyword(i)) i += l;
else return 0;
if (tokens[start + 1].value !== 'include') return 0;
if (l = checkSC(i)) i += l;
else return 0;
if (l = checkIdentOrInterpolation(i)) i += l;
else return 0;
if (l = checkSC(i)) i += l;
if (l... | javascript | {
"resource": ""
} |
q45485 | getInclude3 | train | function getInclude3() {
const type = NodeType.IncludeType;
const token = tokens[pos];
const line = token.ln;
const column = token.col;
const content = [].concat(
getAtkeyword(),
getSC(),
getIdentOrInterpolation(),
getSC(),
getArguments()
);
return newNode(type, content, line, column)... | javascript | {
"resource": ""
} |
q45486 | train | function () {
var bones = this.bones;
var updateCache = this.cache;
var ikConstraints = this.ikConstraints;
var transformConstraints = this.transformConstraints;
var ikConstraintsCount = ikConstraints.length;
var transformConstraintsCount = transformConstraints.length;
updateCache.length = 0;
for (var ... | javascript | {
"resource": ""
} | |
q45487 | train | function () {
var updateCache = this.cache;
for (var i = 0, n = updateCache.length; i < n; i++)
updateCache[i].update();
} | javascript | {
"resource": ""
} | |
q45488 | train | function () {
var bones = this.bones;
for (var i = 0, n = bones.length; i < n; i++)
bones[i].setToSetupPose();
var ikConstraints = this.ikConstraints;
for (var i = 0, n = ikConstraints.length; i < n; i++) {
var constraint = ikConstraints[i];
constraint.bendDirection = constraint.data.bendDirection;
... | javascript | {
"resource": ""
} | |
q45489 | train | function (trackIndex, animation, loop) {
var entry = new spine.TrackEntry();
entry.animation = animation;
entry.loop = loop;
entry.endTime = animation.duration;
this.setCurrent(trackIndex, entry);
return entry;
} | javascript | {
"resource": ""
} | |
q45490 | train | function (x, y) {
return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
} | javascript | {
"resource": ""
} | |
q45491 | train | function (x1, y1, x2, y2) {
var minX = this.minX, minY = this.minY, maxX = this.maxX, maxY = this.maxY;
if ((x1 <= minX && x2 <= minX) || (y1 <= minY && y2 <= minY) || (x1 >= maxX && x2 >= maxX) || (y1 >= maxY && y2 >= maxY))
return false;
var m = (y2 - y1) / (x2 - x1);
var y = m * (minX - x1) + y1;
if (y ... | javascript | {
"resource": ""
} | |
q45492 | train | function (bounds) {
return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;
} | javascript | {
"resource": ""
} | |
q45493 | train | function (polygon, x, y) {
var nn = polygon.length;
var prevIndex = nn - 2;
var inside = false;
for (var ii = 0; ii < nn; ii += 2) {
var vertexY = polygon[ii + 1];
var prevY = polygon[prevIndex + 1];
if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y)) {
var vertexX = polygon[ii];
if... | javascript | {
"resource": ""
} | |
q45494 | train | function (polygon, x1, y1, x2, y2) {
var nn = polygon.length;
var width12 = x1 - x2, height12 = y1 - y2;
var det1 = x1 * y2 - y1 * x2;
var x3 = polygon[nn - 2], y3 = polygon[nn - 1];
for (var ii = 0; ii < nn; ii += 2) {
var x4 = polygon[ii], y4 = polygon[ii + 1];
var det2 = x3 * y4 - y3 * x4;
var wid... | javascript | {
"resource": ""
} | |
q45495 | MultipleInput | train | function MultipleInput(options) {
Selectivity.call(
this,
assign(
{
// dropdowns for multiple-value inputs should open below the select box,
// unless there is not enough space below, but there is space enough above, then it should
// open ... | javascript | {
"resource": ""
} |
q45496 | train | function(el, selectEl) {
var rect = selectEl.getBoundingClientRect();
var dropdownHeight = el.clientHeight;
var openUpwards =
rect.bottom + dropdownHeight > window.innerHeight &&
rect.top - dropdownHeight > 0;
... | javascript | {
"resource": ""
} | |
q45497 | train | function(item) {
var itemIsId = Selectivity.isValidId(item);
var id = itemIsId ? item : this.validateItem(item) && item.id;
if (this.options.allowDuplicates || this._value.indexOf(id) === -1) {
this._value.push(id);
if (itemIsId && this.options.initSelection) {
... | javascript | {
"resource": ""
} | |
q45498 | train | function(item) {
var id = item.id || item;
var removedItem;
var index = Selectivity.findIndexById(this._data, id);
if (index > -1) {
removedItem = this._data[index];
this._data.splice(index, 1);
}
if (this._value[index] !== id) {
inde... | javascript | {
"resource": ""
} | |
q45499 | train | function(data) {
if (data === null) {
return [];
} else if (Array.isArray(data)) {
return data.map(this.validateItem, this);
} else {
throw new Error('Data for MultiSelectivity instance should be an array');
}
} | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.