Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Factory to get the `offset` for a line and columnbased `position` in the bound indices.
function positionToOffsetFactory(indices) { return positionToOffset /* Get the `offset` for a line and column-based * `position` in the bound indices. */ function positionToOffset(position) { var line = position && position.line var column = position && position.column if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { return (indices[line - 2] || 0) + column - 1 || 0 } return -1 } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n // Get the `offset` for a line and column-based `position` in the bound\n // indices.\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line)...
[ "0.72743964", "0.72743964", "0.72743964", "0.6972963", "0.65917194", "0.65917194", "0.65917194", "0.65787613", "0.65787613", "0.64917874", "0.63492453", "0.63492453", "0.63492453", "0.63492453", "0.63492453", "0.63478184", "0.6271752", "0.6181949", "0.6181949", "0.6181949", "...
0.7171669
4
Get the `offset` for a line and columnbased `position` in the bound indices.
function positionToOffset(position) { var line = position && position.line var column = position && position.column if (!isNaN(line) && !isNaN(column) && line - 1 in indices) { return (indices[line - 2] || 0) + column - 1 || 0 } return -1 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function positionToOffsetFactory(indices) {\n return positionToOffset\n\n // Get the `offset` for a line and column-based `position` in the bound\n // indices.\n function positionToOffset(position) {\n var line = position && position.line\n var column = position && position.column\n\n if (!isNaN(line)...
[ "0.6477924", "0.6477924", "0.6477924", "0.64409935", "0.6405255", "0.63719386", "0.63719386", "0.63099563", "0.6148568", "0.6017814", "0.59841573", "0.59635794", "0.59635794", "0.59635794", "0.59635794", "0.59635794", "0.59635794", "0.59635794", "0.59635794", "0.5934817", "0....
0.68115723
3
Get indices of linebreaks in `value`.
function indices(value) { var result = [] var index = value.indexOf('\n') while (index !== -1) { result.push(index + 1) index = value.indexOf('\n', index + 1) } result.push(value.length + 1) return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lineCount(value) {\n var count = 0;\n for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {\n var char = value_1[_i];\n if (char === '\\n') {\n count++;\n }\n }\n return count;\n}", "function computeLineStartsMap(text) {\n const result = [0];\n...
[ "0.6593344", "0.5705357", "0.54353976", "0.534493", "0.52009326", "0.5176218", "0.50794375", "0.5011325", "0.49926913", "0.4962433", "0.49470544", "0.49330306", "0.4925403", "0.48779956", "0.48668548", "0.48626712", "0.4852999", "0.4852999", "0.48362988", "0.48362988", "0.483...
0.8064472
4
Factory to deescape a value, based on a list at `key` in `ctx`.
function factory(ctx, key) { return unescape; /* De-escape a string using the expression at `key` * in `ctx`. */ function unescape(value) { var prev = 0; var index = value.indexOf('\\'); var escape = ctx[key]; var queue = []; var character; while (index !== -1) { queue.push(value.slice(prev, index)); prev = index + 1; character = value.charAt(prev); /* If the following character is not a valid escape, * add the slash. */ if (!character || escape.indexOf(character) === -1) { queue.push('\\'); } index = value.indexOf('\\', prev); } queue.push(value.slice(prev)); return queue.join(''); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function factory(ctx, key) {\n return unescape\n\n // De-escape a string using the expression at `key` in `ctx`.\n function unescape(value) {\n var previous = 0\n var index = value.indexOf(backslash)\n var escape = ctx[key]\n var queue = []\n var character\n\n while (index !== -1) {\n que...
[ "0.72508484", "0.53620976", "0.53620976", "0.53620976", "0.53620976", "0.53620976", "0.53620976", "0.5162921", "0.50055116", "0.49855182", "0.4866783", "0.47823897", "0.46672222", "0.46518078", "0.46498412", "0.4647973", "0.4647973", "0.4647973", "0.4647973", "0.4647973", "0....
0.73270625
4
Deescape a string using the expression at `key` in `ctx`.
function unescape(value) { var prev = 0; var index = value.indexOf('\\'); var escape = ctx[key]; var queue = []; var character; while (index !== -1) { queue.push(value.slice(prev, index)); prev = index + 1; character = value.charAt(prev); /* If the following character is not a valid escape, * add the slash. */ if (!character || escape.indexOf(character) === -1) { queue.push('\\'); } index = value.indexOf('\\', prev); } queue.push(value.slice(prev)); return queue.join(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function factory(ctx, key) {\n return unescape\n\n // De-escape a string using the expression at `key` in `ctx`.\n function unescape(value) {\n var previous = 0\n var index = value.indexOf(backslash)\n var escape = ctx[key]\n var queue = []\n var character\n\n while (index !== -1) {\n que...
[ "0.7561866", "0.7528921", "0.7528921", "0.7528921", "0.7528921", "0.7528921", "0.7528921", "0.5832895", "0.5587644", "0.5571861", "0.5535866", "0.5103396", "0.50936323", "0.509159", "0.50825775", "0.50825775", "0.50825775", "0.50825775", "0.50825775", "0.50633633", "0.4994987...
0.59767973
12
Factory to create an entity decoder.
function factory(ctx) { decoder.raw = decodeRaw; return decoder; /* Normalize `position` to add an `indent`. */ function normalize(position) { var offsets = ctx.offset; var line = position.line; var result = []; while (++line) { if (!(line in offsets)) { break; } result.push((offsets[line] || 0) + 1); } return { start: position, indent: result }; } /* Handle a warning. * See https://github.com/wooorm/parse-entities * for the warnings. */ function handleWarning(reason, position, code) { if (code === 3) { return; } ctx.file.message(reason, position); } /* Decode `value` (at `position`) into text-nodes. */ function decoder(value, position, handler) { entities(value, { position: normalize(position), warning: handleWarning, text: handler, reference: handler, textContext: ctx, referenceContext: ctx }); } /* Decode `value` (at `position`) into a string. */ function decodeRaw(value, position, options) { return entities(value, xtend(options, { position: normalize(position), warning: handleWarning })); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function factory(ctx) {\n decoder.raw = decodeRaw\n\n return decoder\n\n // Normalize `position` to add an `indent`.\n function normalize(position) {\n var offsets = ctx.offset\n var line = position.line\n var result = []\n\n while (++line) {\n if (!(line in offsets)) {\n break\n }...
[ "0.72203225", "0.713676", "0.713676", "0.5710261", "0.5624475", "0.5407892", "0.5357135", "0.53248423", "0.52812004", "0.52333295", "0.52305025", "0.52305025", "0.5223736", "0.5223736", "0.5223736", "0.5223736", "0.5223736", "0.5223736", "0.5190777", "0.5147969", "0.506329", ...
0.71604043
3
Normalize `position` to add an `indent`.
function normalize(position) { var offsets = ctx.offset; var line = position.line; var result = []; while (++line) { if (!(line in offsets)) { break; } result.push((offsets[line] || 0) + 1); } return { start: position, indent: result }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalize(position) {\n var offsets = ctx.offset\n var line = position.line\n var result = []\n\n while (++line) {\n if (!(line in offsets)) {\n break\n }\n\n result.push((offsets[line] || 0) + 1)\n }\n\n return {start: position, indent: result}\n }", "function p...
[ "0.7571608", "0.6309173", "0.62552965", "0.62552965", "0.62552965", "0.62552965", "0.62552965", "0.57631075", "0.5705283", "0.5705283", "0.5705283", "0.5705283", "0.5705283", "0.5657433", "0.5641791", "0.5555849", "0.5442625", "0.54328084", "0.5428162", "0.5391513", "0.539151...
0.7537022
5
Handle a warning. See for the warnings.
function handleWarning(reason, position, code) { if (code === 3) { return; } ctx.file.message(reason, position); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onwarn(warning) {\n if (warning.code === 'THIS_IS_UNDEFINED') return;\n console.error(warning.message);\n}", "function handleWarning(reason, position, code) {\n if (code !== 3) {\n ctx.file.message(reason, position)\n }\n }", "issueWarning(args) {\n this.emit('warning', args);\n }", ...
[ "0.7490234", "0.74281955", "0.71471065", "0.677067", "0.677067", "0.677067", "0.677067", "0.677067", "0.66602415", "0.6655821", "0.6655821", "0.6630893", "0.6614084", "0.6555695", "0.65171844", "0.6493037", "0.6445884", "0.64053947", "0.64053947", "0.64053947", "0.64053947", ...
0.752049
4
Decode `value` (at `position`) into textnodes.
function decoder(value, position, handler) { entities(value, { position: normalize(position), warning: handleWarning, text: handler, reference: handler, textContext: ctx, referenceContext: ctx }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function decoder(value, position, handler) {\n entities(value, {\n position: normalize(position),\n warning: handleWarning,\n text: handler,\n reference: handler,\n textContext: ctx,\n referenceContext: ctx\n })\n }", "function decodeRaw(value, position, options) {\n retur...
[ "0.68272823", "0.6593941", "0.6593941", "0.6593941", "0.6593941", "0.65714216", "0.65416", "0.65416", "0.55718887", "0.55301964", "0.5365679", "0.5365679", "0.53418416", "0.5195671", "0.51646066", "0.51535314", "0.51535314", "0.51535314", "0.51535314", "0.51510835", "0.515108...
0.68176234
5
Decode `value` (at `position`) into a string.
function decodeRaw(value, position, options) { return entities(value, xtend(options, { position: normalize(position), warning: handleWarning })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function decodeRaw(value, position) {\n return entities(value, {\n position: normalize(position),\n warning: handleWarning\n });\n }", "function decodeRaw(value, position) {\n return entities(value, {\n position: normalize(position),\n warning: handleWarning\n });\n }", "funct...
[ "0.6970498", "0.6970498", "0.67748314", "0.6491086", "0.6473212", "0.6473212", "0.6473212", "0.6473212", "0.6473212", "0.6473212", "0.6250951", "0.6250951", "0.611467", "0.60424435", "0.5989474", "0.5989474", "0.5989474", "0.5989474", "0.5969304", "0.5969304", "0.5969304", ...
0.690921
4
Check if the given character code, or the character code at the first character, is hexadecimal.
function hexadecimal(character) { var code = typeof character === 'string' ? character.charCodeAt(0) : character return ( (code >= 97 /* a */ && code <= 102) /* z */ || (code >= 65 /* A */ && code <= 70) /* Z */ || (code >= 48 /* A */ && code <= 57) /* Z */ ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isHexDigit(code) {\n return (\n isDigit(code) || // 0 .. 9\n (code >= 0x0041 && code <= 0x0046) || // A .. F\n (code >= 0x0061 && code <= 0x0066) // a .. f\n );\n}", "function hexadecimal(character) {\n var code = typeof character === 'string' ? character.charCodeAt(0) : c...
[ "0.7582988", "0.7505748", "0.75000715", "0.742736", "0.7207336", "0.7128968", "0.70687914", "0.7053852", "0.7018759", "0.7012731", "0.7010884", "0.7001609", "0.6998167", "0.6945509", "0.6937618", "0.6935108", "0.6926119", "0.6874406", "0.67849517", "0.67849517", "0.67849517",...
0.7386119
8
Check if the given character code, or the character code at the first character, is alphanumerical.
function alphanumerical(character) { return alphabetical(character) || decimal(character) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function is_alphanum(str) {\n let curr_char\n for (let i = 0; i < str.length; i ++) {\n curr_char = str.charCodeAt(i)\n if (!(curr_char == 95 || curr_char == 46) &&\n !(curr_char > 47 && curr_char < 58) &&\n !(curr_char > 64 && curr_char < 91) &&\n !(curr_char > 96 && curr_char < 123))...
[ "0.8023756", "0.7737026", "0.75667596", "0.7555502", "0.75216365", "0.7503981", "0.7494961", "0.74834013", "0.74418956", "0.7439725", "0.7439123", "0.7418856", "0.7418002", "0.7370794", "0.736314", "0.7352303", "0.7349926", "0.7342892", "0.73375565", "0.73345226", "0.7322956"...
0.6999279
79
Check whether a node is mergeable with adjacent nodes.
function mergeable(node) { var start; var end; if (node.type !== 'text' || !node.position) { return true; } start = node.position.start; end = node.position.end; /* Only merge nodes which occupy the same size as their * `value`. */ return start.line !== end.line || end.column - start.column === node.value.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mergeable(node) {\n var start\n var end\n\n if (node.type !== 'text' || !node.position) {\n return true\n }\n\n start = node.position.start\n end = node.position.end\n\n // Only merge nodes which occupy the same size as their `value`.\n return (\n start.line !== end.line || end.column - star...
[ "0.7134994", "0.62617314", "0.6231172", "0.6230404", "0.61173457", "0.60287595", "0.58044505", "0.5802731", "0.5750507", "0.5740649", "0.56971484", "0.56971484", "0.5686166", "0.56212604", "0.5617487", "0.55912936", "0.5573064", "0.5573064", "0.55617875", "0.55531865", "0.555...
0.7072907
5
Merge two text nodes: `node` into `prev`.
function mergeText(prev, node) { prev.value += node.value; return prev; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mergeText(previous, node) {\n previous.value += node.value\n\n return previous\n}", "function mergeBlockquote(prev, node) {\n if (this.options.commonmark) {\n return node;\n }\n\n prev.children = prev.children.concat(node.children);\n\n return prev;\n}", "function mergeBlockquote(prev, node) ...
[ "0.7846261", "0.62798476", "0.62798476", "0.62798476", "0.62798476", "0.62798476", "0.62798476", "0.62279105", "0.6168461", "0.6093209", "0.60050935", "0.5993574", "0.5974843", "0.59083056", "0.58984995", "0.5685879", "0.565117", "0.562197", "0.5571429", "0.55681014", "0.5546...
0.80958956
4
Merge two blockquotes: `node` into `prev`, unless in CommonMark mode.
function mergeBlockquote(prev, node) { if (this.options.commonmark) { return node; } prev.children = prev.children.concat(node.children); return prev; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mergeBlockquote(previous, node) {\n if (this.options.commonmark || this.options.gfm) {\n return node\n }\n\n previous.children = previous.children.concat(node.children)\n\n return previous\n}", "function mergeText(prev, node) {\n prev.value += node.value;\n\n return prev;\n}", "function merge...
[ "0.8367985", "0.61349255", "0.61349255", "0.61349255", "0.61349255", "0.61349255", "0.61349255", "0.5929898", "0.57884717", "0.56467134", "0.5552458", "0.5434768", "0.54283446", "0.53055257", "0.52956045", "0.5261775", "0.519828", "0.51654506", "0.51654506", "0.51654506", "0....
0.8524703
4
Construct a tokenizer. This creates both `tokenizeInline` and `tokenizeBlock`.
function factory(type) { return tokenize; /* Tokenizer for a bound `type`. */ function tokenize(value, location) { var self = this; var offset = self.offset; var tokens = []; var methods = self[type + 'Methods']; var tokenizers = self[type + 'Tokenizers']; var line = location.line; var column = location.column; var index; var length; var method; var name; var matched; var valueLength; /* Trim white space only lines. */ if (!value) { return tokens; } /* Expose on `eat`. */ eat.now = now; eat.file = self.file; /* Sync initial offset. */ updatePosition(''); /* Iterate over `value`, and iterate over all * tokenizers. When one eats something, re-iterate * with the remaining value. If no tokenizer eats, * something failed (should not happen) and an * exception is thrown. */ while (value) { index = -1; length = methods.length; matched = false; while (++index < length) { name = methods[index]; method = tokenizers[name]; if ( method && /* istanbul ignore next */ (!method.onlyAtStart || self.atStart) && (!method.notInList || !self.inList) && (!method.notInBlock || !self.inBlock) && (!method.notInLink || !self.inLink) ) { valueLength = value.length; method.apply(self, [eat, value]); matched = valueLength !== value.length; if (matched) { break; } } } /* istanbul ignore if */ if (!matched) { self.file.fail(new Error('Infinite loop'), eat.now()); } } self.eof = now(); return tokens; /* Update line, column, and offset based on * `value`. */ function updatePosition(subvalue) { var lastIndex = -1; var index = subvalue.indexOf('\n'); while (index !== -1) { line++; lastIndex = index; index = subvalue.indexOf('\n', index + 1); } if (lastIndex === -1) { column += subvalue.length; } else { column = subvalue.length - lastIndex; } if (line in offset) { if (lastIndex !== -1) { column += offset[line]; } else if (column <= offset[line]) { column = offset[line] + 1; } } } /* Get offset. Called before the first character is * eaten to retrieve the range's offsets. */ function getOffset() { var indentation = []; var pos = line + 1; /* Done. Called when the last character is * eaten to retrieve the range’s offsets. */ return function () { var last = line + 1; while (pos < last) { indentation.push((offset[pos] || 0) + 1); pos++; } return indentation; }; } /* Get the current position. */ function now() { var pos = {line: line, column: column}; pos.offset = self.toOffset(pos); return pos; } /* Store position information for a node. */ function Position(start) { this.start = start; this.end = now(); } /* Throw when a value is incorrectly eaten. * This shouldn’t happen but will throw on new, * incorrect rules. */ function validateEat(subvalue) { /* istanbul ignore if */ if (value.substring(0, subvalue.length) !== subvalue) { /* Capture stack-trace. */ self.file.fail( new Error( 'Incorrectly eaten value: please report this ' + 'warning on http://git.io/vg5Ft' ), now() ); } } /* Mark position and patch `node.position`. */ function position() { var before = now(); return update; /* Add the position to a node. */ function update(node, indent) { var prev = node.position; var start = prev ? prev.start : before; var combined = []; var n = prev && prev.end.line; var l = before.line; node.position = new Position(start); /* If there was already a `position`, this * node was merged. Fixing `start` wasn’t * hard, but the indent is different. * Especially because some information, the * indent between `n` and `l` wasn’t * tracked. Luckily, that space is * (should be?) empty, so we can safely * check for it now. */ if (prev && indent && prev.indent) { combined = prev.indent; if (n < l) { while (++n < l) { combined.push((offset[n] || 0) + 1); } combined.push(before.column); } indent = combined.concat(indent); } node.position.indent = indent || []; return node; } } /* Add `node` to `parent`s children or to `tokens`. * Performs merges where possible. */ function add(node, parent) { var children = parent ? parent.children : tokens; var prev = children[children.length - 1]; if ( prev && node.type === prev.type && node.type in MERGEABLE_NODES && mergeable(prev) && mergeable(node) ) { node = MERGEABLE_NODES[node.type].call(self, prev, node); } if (node !== prev) { children.push(node); } if (self.atStart && tokens.length !== 0) { self.exitStart(); } return node; } /* Remove `subvalue` from `value`. * `subvalue` must be at the start of `value`. */ function eat(subvalue) { var indent = getOffset(); var pos = position(); var current = now(); validateEat(subvalue); apply.reset = reset; reset.test = test; apply.test = test; value = value.substring(subvalue.length); updatePosition(subvalue); indent = indent(); return apply; /* Add the given arguments, add `position` to * the returned node, and return the node. */ function apply(node, parent) { return pos(add(pos(node), parent), indent); } /* Functions just like apply, but resets the * content: the line and column are reversed, * and the eaten value is re-added. * This is useful for nodes with a single * type of content, such as lists and tables. * See `apply` above for what parameters are * expected. */ function reset() { var node = apply.apply(null, arguments); line = current.line; column = current.column; value = subvalue + value; return node; } /* Test the position, after eating, and reverse * to a not-eaten state. */ function test() { var result = pos({}); line = current.line; column = current.column; value = subvalue + value; return result.position; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tokenizer(input, options) {\n return Parser.tokenizer(input, options)\n }", "function tokenizer(input, options) {\n return Parser.tokenizer(input, options)\n }", "function tokenizer(input, options) {\n return Parser.tokenizer(input, options)\n }", "function tokenizer(input, options) {\n ...
[ "0.6646729", "0.6646729", "0.6646729", "0.6635544", "0.6635544", "0.6635544", "0.65058005", "0.65058005", "0.65058005", "0.65058005", "0.65058005", "0.65058005", "0.65058005", "0.6393914", "0.6288154", "0.6116398", "0.60865617", "0.5903005", "0.58500975", "0.58098423", "0.580...
0.57973605
24
Tokenizer for a bound `type`.
function tokenize(value, location) { var self = this; var offset = self.offset; var tokens = []; var methods = self[type + 'Methods']; var tokenizers = self[type + 'Tokenizers']; var line = location.line; var column = location.column; var index; var length; var method; var name; var matched; var valueLength; /* Trim white space only lines. */ if (!value) { return tokens; } /* Expose on `eat`. */ eat.now = now; eat.file = self.file; /* Sync initial offset. */ updatePosition(''); /* Iterate over `value`, and iterate over all * tokenizers. When one eats something, re-iterate * with the remaining value. If no tokenizer eats, * something failed (should not happen) and an * exception is thrown. */ while (value) { index = -1; length = methods.length; matched = false; while (++index < length) { name = methods[index]; method = tokenizers[name]; if ( method && /* istanbul ignore next */ (!method.onlyAtStart || self.atStart) && (!method.notInList || !self.inList) && (!method.notInBlock || !self.inBlock) && (!method.notInLink || !self.inLink) ) { valueLength = value.length; method.apply(self, [eat, value]); matched = valueLength !== value.length; if (matched) { break; } } } /* istanbul ignore if */ if (!matched) { self.file.fail(new Error('Infinite loop'), eat.now()); } } self.eof = now(); return tokens; /* Update line, column, and offset based on * `value`. */ function updatePosition(subvalue) { var lastIndex = -1; var index = subvalue.indexOf('\n'); while (index !== -1) { line++; lastIndex = index; index = subvalue.indexOf('\n', index + 1); } if (lastIndex === -1) { column += subvalue.length; } else { column = subvalue.length - lastIndex; } if (line in offset) { if (lastIndex !== -1) { column += offset[line]; } else if (column <= offset[line]) { column = offset[line] + 1; } } } /* Get offset. Called before the first character is * eaten to retrieve the range's offsets. */ function getOffset() { var indentation = []; var pos = line + 1; /* Done. Called when the last character is * eaten to retrieve the range’s offsets. */ return function () { var last = line + 1; while (pos < last) { indentation.push((offset[pos] || 0) + 1); pos++; } return indentation; }; } /* Get the current position. */ function now() { var pos = {line: line, column: column}; pos.offset = self.toOffset(pos); return pos; } /* Store position information for a node. */ function Position(start) { this.start = start; this.end = now(); } /* Throw when a value is incorrectly eaten. * This shouldn’t happen but will throw on new, * incorrect rules. */ function validateEat(subvalue) { /* istanbul ignore if */ if (value.substring(0, subvalue.length) !== subvalue) { /* Capture stack-trace. */ self.file.fail( new Error( 'Incorrectly eaten value: please report this ' + 'warning on http://git.io/vg5Ft' ), now() ); } } /* Mark position and patch `node.position`. */ function position() { var before = now(); return update; /* Add the position to a node. */ function update(node, indent) { var prev = node.position; var start = prev ? prev.start : before; var combined = []; var n = prev && prev.end.line; var l = before.line; node.position = new Position(start); /* If there was already a `position`, this * node was merged. Fixing `start` wasn’t * hard, but the indent is different. * Especially because some information, the * indent between `n` and `l` wasn’t * tracked. Luckily, that space is * (should be?) empty, so we can safely * check for it now. */ if (prev && indent && prev.indent) { combined = prev.indent; if (n < l) { while (++n < l) { combined.push((offset[n] || 0) + 1); } combined.push(before.column); } indent = combined.concat(indent); } node.position.indent = indent || []; return node; } } /* Add `node` to `parent`s children or to `tokens`. * Performs merges where possible. */ function add(node, parent) { var children = parent ? parent.children : tokens; var prev = children[children.length - 1]; if ( prev && node.type === prev.type && node.type in MERGEABLE_NODES && mergeable(prev) && mergeable(node) ) { node = MERGEABLE_NODES[node.type].call(self, prev, node); } if (node !== prev) { children.push(node); } if (self.atStart && tokens.length !== 0) { self.exitStart(); } return node; } /* Remove `subvalue` from `value`. * `subvalue` must be at the start of `value`. */ function eat(subvalue) { var indent = getOffset(); var pos = position(); var current = now(); validateEat(subvalue); apply.reset = reset; reset.test = test; apply.test = test; value = value.substring(subvalue.length); updatePosition(subvalue); indent = indent(); return apply; /* Add the given arguments, add `position` to * the returned node, and return the node. */ function apply(node, parent) { return pos(add(pos(node), parent), indent); } /* Functions just like apply, but resets the * content: the line and column are reversed, * and the eaten value is re-added. * This is useful for nodes with a single * type of content, such as lists and tables. * See `apply` above for what parameters are * expected. */ function reset() { var node = apply.apply(null, arguments); line = current.line; column = current.column; value = subvalue + value; return node; } /* Test the position, after eating, and reverse * to a not-eaten state. */ function test() { var result = pos({}); line = current.line; column = current.column; value = subvalue + value; return result.position; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function factory(type) {\n return tokenize;\n\n /* Tokenizer for a bound `type`. */\n function tokenize(value, location) {\n var self = this;\n var offset = self.offset;\n var tokens = [];\n var methods = self[type + 'Methods'];\n var tokenizers = self[type + 'Tokenizers'];\n var line = locati...
[ "0.6440441", "0.6440441", "0.6440441", "0.6440441", "0.6440441", "0.63420445", "0.63303924", "0.60194075", "0.5882372", "0.5778136", "0.57694876", "0.57538456", "0.5736236", "0.5673441", "0.5641058", "0.5611508", "0.5604817", "0.5583866", "0.55630934", "0.5543313", "0.5537373...
0.0
-1
Update line, column, and offset based on `value`.
function updatePosition(subvalue) { var lastIndex = -1; var index = subvalue.indexOf('\n'); while (index !== -1) { line++; lastIndex = index; index = subvalue.indexOf('\n', index + 1); } if (lastIndex === -1) { column += subvalue.length; } else { column = subvalue.length - lastIndex; } if (line in offset) { if (lastIndex !== -1) { column += offset[line]; } else if (column <= offset[line]) { column = offset[line] + 1; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatePosition(subvalue) {\n var lastIndex = -1\n var index = subvalue.indexOf('\\n')\n\n while (index !== -1) {\n line++\n lastIndex = index\n index = subvalue.indexOf('\\n', index + 1)\n }\n\n if (lastIndex === -1) {\n column += subvalue.length\n ...
[ "0.7200816", "0.6309424", "0.60053426", "0.59290123", "0.5819368", "0.5707939", "0.570109", "0.567639", "0.560666", "0.55809885", "0.5569548", "0.5569548", "0.5569548", "0.5569548", "0.5569548", "0.5548626", "0.55301285", "0.5474081", "0.54643226", "0.54447085", "0.54388785",...
0.7229543
4
Get offset. Called before the first character is eaten to retrieve the range's offsets.
function getOffset() { var indentation = []; var pos = line + 1; /* Done. Called when the last character is * eaten to retrieve the range’s offsets. */ return function () { var last = line + 1; while (pos < last) { indentation.push((offset[pos] || 0) + 1); pos++; } return indentation; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStartOffSet() {\n var selObj = window.getSelection();\n var selRange = selObj.getRangeAt(0);\n return selRange['startOffset'];\n }", "function getOffset() {\n\t\t\treturn offset;\n\t\t}", "getOffset() {\r\n return this.builder.o...
[ "0.68127346", "0.6555926", "0.63602346", "0.62810284", "0.6277667", "0.62405443", "0.62127423", "0.6079076", "0.6078199", "0.6076148", "0.60605866", "0.60522854", "0.60417366", "0.60320246", "0.6025202", "0.60207105", "0.6010249", "0.60081047", "0.6007811", "0.59976846", "0.5...
0.76455736
4
Get the current position.
function now() { var pos = {line: line, column: column}; pos.offset = self.toOffset(pos); return pos; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCurrentPosition() {\n return $._getCurrentPosition();\n}", "function getPos() {\n\t\treturn _this.position;\n\t}", "function getPosition() {\n return _character.getPosition();\n }", "async getPosition() {\n return this._position;\n }", "getPosition() {\n return this._las...
[ "0.8059421", "0.7960642", "0.788338", "0.7707294", "0.75241387", "0.7512489", "0.7508141", "0.73519945", "0.7219399", "0.7159119", "0.7157245", "0.7149591", "0.71272236", "0.70371795", "0.70171124", "0.7005105", "0.7005105", "0.7004674", "0.6965421", "0.6886338", "0.6807483",...
0.668909
30
Store position information for a node.
function Position(start) { this.start = start; this.end = now(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setNodePosition(Pos, node) {\n let currrentNode = this.nodes.find(n => n === node);\n currrentNode.x = Pos.x;\n currrentNode.y = Pos.y;\n }", "savePosition() {\n this.savedX = this.x;\n this.savedY = this.y;\n }", "function savePositions () {\n var updateTheseNodes = {...
[ "0.6429529", "0.6342312", "0.6323051", "0.6272802", "0.62619543", "0.62437344", "0.6160176", "0.6146154", "0.605768", "0.60570323", "0.5981281", "0.5944375", "0.5837915", "0.58164245", "0.57895595", "0.57648104", "0.57380444", "0.57083964", "0.56974506", "0.5696474", "0.56964...
0.0
-1
Mark position and patch `node.position`.
function position() { var before = now(); return update; /* Add the position to a node. */ function update(node, indent) { var prev = node.position; var start = prev ? prev.start : before; var combined = []; var n = prev && prev.end.line; var l = before.line; node.position = new Position(start); /* If there was already a `position`, this * node was merged. Fixing `start` wasn’t * hard, but the indent is different. * Especially because some information, the * indent between `n` and `l` wasn’t * tracked. Luckily, that space is * (should be?) empty, so we can safely * check for it now. */ if (prev && indent && prev.indent) { combined = prev.indent; if (n < l) { while (++n < l) { combined.push((offset[n] || 0) + 1); } combined.push(before.column); } indent = combined.concat(indent); } node.position.indent = indent || []; return node; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function patch(node) {\n if (!node.position) {\n node.position = {}\n }\n}", "setNodePosition(Pos, node) {\n let currrentNode = this.nodes.find(n => n === node);\n currrentNode.x = Pos.x;\n currrentNode.y = Pos.y;\n }", "assignPosition(node, position) {\n // update the posit...
[ "0.7862141", "0.6787863", "0.66805166", "0.6609155", "0.6173004", "0.6159076", "0.6156995", "0.60025716", "0.599988", "0.5988381", "0.59879845", "0.59078616", "0.58900505", "0.5886544", "0.5858589", "0.58463717", "0.58296645", "0.5808339", "0.57834077", "0.57740074", "0.57380...
0.61260253
10
Add the position to a node.
function update(node, indent) { var prev = node.position; var start = prev ? prev.start : before; var combined = []; var n = prev && prev.end.line; var l = before.line; node.position = new Position(start); /* If there was already a `position`, this * node was merged. Fixing `start` wasn’t * hard, but the indent is different. * Especially because some information, the * indent between `n` and `l` wasn’t * tracked. Luckily, that space is * (should be?) empty, so we can safely * check for it now. */ if (prev && indent && prev.indent) { combined = prev.indent; if (n < l) { while (++n < l) { combined.push((offset[n] || 0) + 1); } combined.push(before.column); } indent = combined.concat(indent); } node.position.indent = indent || []; return node; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add (node, parent) {\n parent.children.push(node)\n if (parser.position) {\n parent.position = {\n start: parent.children[0].position.start,\n end: node.position.end\n }\n }\n }", "addPosition(pos) {\n this.positions += '=\"'+pos.line + ':' + pos.linePosition + '...
[ "0.658252", "0.6516254", "0.6485225", "0.6460037", "0.6390183", "0.6232858", "0.62273777", "0.61630327", "0.61246794", "0.6046579", "0.6042932", "0.59990585", "0.5977073", "0.59656715", "0.59656715", "0.59656715", "0.59656715", "0.59656715", "0.5927004", "0.5904087", "0.59013...
0.0
-1
Add `node` to `parent`s children or to `tokens`. Performs merges where possible.
function add(node, parent) { var children = parent ? parent.children : tokens; var prev = children[children.length - 1]; if ( prev && node.type === prev.type && node.type in MERGEABLE_NODES && mergeable(prev) && mergeable(node) ) { node = MERGEABLE_NODES[node.type].call(self, prev, node); } if (node !== prev) { children.push(node); } if (self.atStart && tokens.length !== 0) { self.exitStart(); } return node; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add(node, parent) {\n var children = parent ? parent.children : tokens\n var previous = children[children.length - 1]\n var fn\n\n if (\n previous &&\n node.type === previous.type &&\n (node.type === 'text' || node.type === 'blockquote') &&\n mergeable(previ...
[ "0.74632514", "0.59985286", "0.5736341", "0.57050353", "0.5690707", "0.55368066", "0.55368066", "0.55368066", "0.55368066", "0.55368066", "0.55221415", "0.5491665", "0.54881227", "0.54389185", "0.54165894", "0.5414174", "0.5388163", "0.53780395", "0.53780395", "0.53780395", "...
0.7813251
4
Remove `subvalue` from `value`. `subvalue` must be at the start of `value`.
function eat(subvalue) { var indent = getOffset(); var pos = position(); var current = now(); validateEat(subvalue); apply.reset = reset; reset.test = test; apply.test = test; value = value.substring(subvalue.length); updatePosition(subvalue); indent = indent(); return apply; /* Add the given arguments, add `position` to * the returned node, and return the node. */ function apply(node, parent) { return pos(add(pos(node), parent), indent); } /* Functions just like apply, but resets the * content: the line and column are reversed, * and the eaten value is re-added. * This is useful for nodes with a single * type of content, such as lists and tables. * See `apply` above for what parameters are * expected. */ function reset() { var node = apply.apply(null, arguments); line = current.line; column = current.column; value = subvalue + value; return node; } /* Test the position, after eating, and reverse * to a not-eaten state. */ function test() { var result = pos({}); line = current.line; column = current.column; value = subvalue + value; return result.position; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function subInputValue(val, sub)\n{\n var dataArray = '';\n var data = \"\";\n if (val == sub) return 0;\n dataArray = val.toString().split(',');\n var index = $.inArray(sub, dataArray);\n dataArray.splice(index, 1);\n return dataArray.join();\n}", "deleteVal(str) {\n\t\tvar sub...
[ "0.6700181", "0.615384", "0.60974056", "0.607876", "0.5916318", "0.58879244", "0.57502335", "0.5706556", "0.5593472", "0.5556735", "0.5489102", "0.54677486", "0.5467472", "0.53538615", "0.53393024", "0.531904", "0.53051805", "0.5301847", "0.5237087", "0.52169204", "0.5209073"...
0.5133321
31
Add the given arguments, add `position` to the returned node, and return the node.
function apply(node, parent) { return pos(add(pos(node), parent), indent); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "assignPosition(node, position) {\n // update the position of the node\n node.position = position;\n \n // the base case\n if (node.children.length === 0)\n {\n leafNodeCounter = leafNodeCounter + 1;\n return node;\n }\n // recursive case...
[ "0.61838925", "0.5975954", "0.5896411", "0.5889737", "0.5836782", "0.5836782", "0.5836782", "0.5836782", "0.5836782", "0.5836782", "0.5797241", "0.5789583", "0.5781526", "0.57615995", "0.57338274", "0.57241637", "0.5719491", "0.5719491", "0.5719491", "0.5719491", "0.5719491",...
0.0
-1
Functions just like apply, but resets the content: the line and column are reversed, and the eaten value is readded. This is useful for nodes with a single type of content, such as lists and tables. See `apply` above for what parameters are expected.
function reset() { var node = apply.apply(null, arguments); line = current.line; column = current.column; value = subvalue + value; return node; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() {\n var node = apply.apply(null, arguments)\n\n line = current.line\n column = current.column\n value = subvalue + value\n\n return node\n }", "_reset(line, column) {\n this.tagName = '';\n this.attributes = [];\n this.endTag = false;\n this.en...
[ "0.7279967", "0.53816366", "0.5181726", "0.5181726", "0.5181726", "0.5181726", "0.5181726", "0.5181726", "0.518022", "0.5168249", "0.51546454", "0.5096495", "0.50748134", "0.49779323", "0.48814023", "0.48670864", "0.48515305", "0.48410198", "0.48259494", "0.4816414", "0.47779...
0.71733314
5
Test the position, after eating, and reverse to a noteaten state.
function test() { var result = pos({}); line = current.line; column = current.column; value = subvalue + value; return result.position; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "backToPosition() {\n while (this.current_position != this.position) {\n this.closeDoors();\n if (this.current_position > this.position) {\n this.moveDown();\n console.log(this.current_position);\n } else if (this.current_position < this.position) {\n this.moveUp();\n }\n...
[ "0.5746375", "0.55368257", "0.5535701", "0.5489478", "0.5477091", "0.5469835", "0.54641306", "0.54497474", "0.5448987", "0.539226", "0.5390116", "0.5381963", "0.53652453", "0.53529024", "0.5351886", "0.5329601", "0.5325161", "0.5320744", "0.53071916", "0.5306592", "0.5287621"...
0.49260256
98
Parse the bound file.
function parse() { var self = this; var value = String(self.file); var start = {line: 1, column: 1, offset: 0}; var content = xtend(start); var node; /* Clean non-unix newlines: `\r\n` and `\r` are all * changed to `\n`. This should not affect positional * information. */ value = value.replace(EXPRESSION_LINE_BREAKS, C_NEWLINE); if (value.charCodeAt(0) === 0xFEFF) { value = value.slice(1); content.column++; content.offset++; } node = { type: 'root', children: self.tokenizeBlock(value, content), position: { start: start, end: self.eof || xtend(start) } }; if (!self.options.position) { removePosition(node, true); } return node; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse(fileName) {\n\n var baseDir = path.dirname(fileName);\n\n var jsonData = parseFile(fileName);\n if (!jsonData) {\n return null;\n }\n\n jsonData = replace(baseDir, jsonData, 'segment');\n if (!jsonData) {\n return null;\n }\n\n\n if (jsonData.hasOwnProperty('seg...
[ "0.5563986", "0.5403343", "0.5403343", "0.5403343", "0.5403343", "0.5403343", "0.5381377", "0.53696966", "0.5363159", "0.53530675", "0.52683973", "0.5242919", "0.5242448", "0.5168644", "0.5167792", "0.51590085", "0.5139131", "0.5129", "0.51248896", "0.5115655", "0.51112175", ...
0.46091342
79
Remove `position`s from `tree`.
function removePosition(node, force) { visit(node, force ? hard : soft) return node }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeNodes(editor) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Editor.withoutNormalizing(editor, () => {\n var {\n hanging = false,\n voids = false,\n mode = 'lowest'\n } = options;\n var {\n at = editor.selection,\n ...
[ "0.5964429", "0.5954956", "0.59464526", "0.59115714", "0.59062433", "0.54606396", "0.5458419", "0.5424383", "0.538081", "0.5371807", "0.532336", "0.5269275", "0.52399844", "0.52399844", "0.52332664", "0.52272236", "0.520304", "0.5202644", "0.51978296", "0.5182264", "0.5175965...
0.60244095
2
Visit a single node.
function one(node, index, parents) { var result if (!test || is(test, node, index, parents[parents.length - 1] || null)) { result = visitor(node, parents) if (result === EXIT) { return result } } if (node.children && result !== SKIP) { return all(node.children, parents.concat(node)) === EXIT ? EXIT : result } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "visitNode(node) { }", "visit() {\n if(this.state) this.state = Node.VISITED;\n }", "function node(){}", "function one(node, index, parent) {\n var result;\n\n index = index || (parent ? 0 : null);\n\n if (!type || node.type === type) {\n result = visitor(node, index, parent || null);\...
[ "0.7660978", "0.64456815", "0.6444978", "0.6280553", "0.6108867", "0.60755324", "0.60506946", "0.60506946", "0.60448086", "0.59708697", "0.59514207", "0.5924221", "0.59024817", "0.59024817", "0.59024817", "0.59024817", "0.5810606", "0.5810606", "0.5810606", "0.5810606", "0.58...
0.5601799
29
Visit children in `parent`.
function all(children, parents) { var min = -1 var step = reverse ? -1 : 1 var index = (reverse ? children.length : min) + step var child var result while (index > min && index < children.length) { child = children[index] result = child && one(child, index, parents) if (result === EXIT) { return result } index = typeof result === 'number' ? result : index + step } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visit(parent, visitFn, childrenFn) {\n if (!parent) return;\n\n visitFn(parent);\n\n var children = childrenFn(parent);\n if (children) {\n var count = children.length;\n for (var i = 0; i < count; i++) {\n visit(children[i], visitFn, childrenFn);\n ...
[ "0.79614055", "0.79312193", "0.7884905", "0.78685194", "0.78685194", "0.78685194", "0.77841", "0.72736555", "0.676731", "0.6584016", "0.6529354", "0.62057847", "0.6133546", "0.6133546", "0.6120903", "0.6087371", "0.6087371", "0.6032075", "0.60211647", "0.60132015", "0.6013201...
0.53865093
73
Assert if `test` passes for `node`. When a `parent` node is known the `index` of node
function is(test, node, index, parent, context) { var hasParent = parent !== null && parent !== undefined var hasIndex = index !== null && index !== undefined var check = convert(test) if ( hasIndex && (typeof index !== 'number' || index < 0 || index === Infinity) ) { throw new Error('Expected positive finite index or child node') } if (hasParent && (!is(null, parent) || !parent.children)) { throw new Error('Expected parent node') } if (!node || !node.type || typeof node.type !== 'string') { return false } if (hasParent !== hasIndex) { throw new Error('Expected both parent and index') } return Boolean(check.call(context, node, index, parent)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hc_nodelistindexnotzero() {\n var success;\n var doc;\n var elementList;\n var employeeNode;\n var employeeList;\n var child;\n var childName;\n doc = load(\"hc_staff\");\n elementList = doc.getElementsByTagName(\"p\");\n employeeNode = elementList.item(2);\n ...
[ "0.5934694", "0.5916615", "0.5916615", "0.58997786", "0.57375354", "0.5579333", "0.55362296", "0.55297947", "0.55297947", "0.5520433", "0.54580474", "0.54539543", "0.5440975", "0.5426031", "0.5399161", "0.53722084", "0.53722084", "0.53722084", "0.5353079", "0.5337234", "0.530...
0.74535584
2
Utility assert each property in `test` is represented in `node`, and each values are strictly equal.
function matchesFactory(test) { return matches function matches(node) { var key for (key in test) { if (node[key] !== test[key]) { return false } } return true } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function assertObjectsEqual(actual, expected, testName) {\n // your code here\n var check = 0;\n if ( Object.keys(actual).length === Object.keys(expected).length) {\n for ( var key in actual ) {\n if( actual[key] === expected[key] ) {\n check ++;\n }\n }\n if( Object.keys(actual).leng...
[ "0.5930918", "0.5843045", "0.58396417", "0.58396417", "0.5833019", "0.5833019", "0.5833019", "0.5833019", "0.5833019", "0.5833019", "0.5833019", "0.5833019", "0.5833019", "0.5833019", "0.5689097", "0.5685757", "0.5666196", "0.56645775", "0.56365645", "0.55471885", "0.5543608"...
0.49062204
52
Utility to return true.
function ok() { return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function returnTrue() {\n\t\t\treturn true;\n\t\t}", "function returnTrue() {\n\t\t\treturn true;\n\t\t}", "function returnTrue() {\n\t\t\treturn true;\n\t\t}", "function returnTrue() {\n\t\t\treturn true;\n\t\t}", "isValid() {\n return true;\n }", "isValid() {\n return true;\n }", ...
[ "0.734517", "0.734517", "0.734517", "0.734517", "0.6982932", "0.6982932", "0.6877149", "0.67819715", "0.65770674", "0.65770674", "0.6514151", "0.6514151", "0.6514151", "0.6514151", "0.6514151", "0.6514151", "0.6514151", "0.6514151", "0.6514151", "0.6514151", "0.6514151", "0...
0.60580045
54
Create a listitem using overly simple mechanics.
function pedanticListItem(ctx, value, position) { var offsets = ctx.offset; var line = position.line; /* Remove the list-item’s bullet. */ value = value.replace(EXPRESSION_PEDANTIC_BULLET, replacer); /* The initial line was also matched by the below, so * we reset the `line`. */ line = position.line; return value.replace(EXPRESSION_INITIAL_INDENT, replacer); /* A simple replacer which removed all matches, * and adds their length to `offset`. */ function replacer($0) { offsets[line] = (offsets[line] || 0) + $0.length; line++; return ''; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ListItem() {}", "function ListItem() {}", "function ListItem() {}", "function listItem() {\n // To do: remove `loose` in next major.\n return {type: LIST_ITEM, loose: false, spread: false, children: []}\n}", "function createListItem(item) {\n text += '<li>' + item + '</li>\\n';\n}", "functi...
[ "0.7933701", "0.7933701", "0.7933701", "0.7513478", "0.7332212", "0.7329313", "0.73014504", "0.72095823", "0.71312386", "0.7061145", "0.705334", "0.7006667", "0.6954094", "0.6950646", "0.6912602", "0.6853206", "0.68186045", "0.68030655", "0.6799364", "0.67781395", "0.67691636...
0.0
-1
A simple replacer which removed all matches, and adds their length to `offset`.
function replacer($0) { offsets[line] = (offsets[line] || 0) + $0.length; line++; return ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function replacer($0) {\n offsets[line] = (offsets[line] || 0) + $0.length\n line++\n\n return ''\n }", "function replacer(match, p1, p2, p3, offset, string) {\n // p1 is nondigits, p2 digits, and p3 non-alphanumerics\n return [p1, p2, p3].join(' - ');\n}", "function replacer(match, p1, p2, p3, off...
[ "0.6296207", "0.559481", "0.55830425", "0.5538571", "0.5422427", "0.5382617", "0.5370716", "0.53604054", "0.5274566", "0.52705044", "0.52705044", "0.52705044", "0.52705044", "0.50347", "0.49950847", "0.49840543", "0.49545303", "0.49316037", "0.49072933", "0.4901916", "0.49019...
0.6274156
6
Create a listitem using sane mechanics.
function normalListItem(ctx, value, position) { var offsets = ctx.offset; var line = position.line; var max; var bullet; var rest; var lines; var trimmedLines; var index; var length; /* Remove the list-item’s bullet. */ value = value.replace(EXPRESSION_BULLET, replacer); lines = value.split(C_NEWLINE); trimmedLines = removeIndent(value, getIndent(max).indent).split(C_NEWLINE); /* We replaced the initial bullet with something * else above, which was used to trick * `removeIndentation` into removing some more * characters when possible. However, that could * result in the initial line to be stripped more * than it should be. */ trimmedLines[0] = rest; offsets[line] = (offsets[line] || 0) + bullet.length; line++; index = 0; length = lines.length; while (++index < length) { offsets[line] = (offsets[line] || 0) + lines[index].length - trimmedLines[index].length; line++; } return trimmedLines.join(C_NEWLINE); function replacer($0, $1, $2, $3, $4) { bullet = $1 + $2 + $3; rest = $4; /* Make sure that the first nine numbered list items * can indent with an extra space. That is, when * the bullet did not receive an extra final space. */ if (Number($2) < 10 && bullet.length % 2 === 1) { $2 = C_SPACE + $2; } max = $1 + repeat(C_SPACE, $2.length) + $3; return max + rest; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ListItem() {}", "function ListItem() {}", "function ListItem() {}", "function listItem() {\n // To do: remove `loose` in next major.\n return {type: LIST_ITEM, loose: false, spread: false, children: []}\n}", "function createListItem(item) {\n text += '<li>' + item + '</li>\\n';\n}", "functi...
[ "0.7538813", "0.7538813", "0.7538813", "0.72953385", "0.7107234", "0.70372385", "0.69638634", "0.6959297", "0.69405633", "0.6763425", "0.6760879", "0.6736523", "0.67340475", "0.67221624", "0.6704038", "0.668557", "0.6667603", "0.6602694", "0.65954953", "0.65859795", "0.658109...
0.0
-1
Remove the minimum indent from every line in `value`. Supports both tab, spaced, and mixed indentation (as well as possible).
function indentation(value, maximum) { var values = value.split(C_NEWLINE); var position = values.length + 1; var minIndent = Infinity; var matrix = []; var index; var indentation; var stops; var padding; values.unshift(repeat(C_SPACE, maximum) + '!'); while (position--) { indentation = getIndent(values[position]); matrix[position] = indentation.stops; if (trim(values[position]).length === 0) { continue; } if (indentation.indent) { if (indentation.indent > 0 && indentation.indent < minIndent) { minIndent = indentation.indent; } } else { minIndent = Infinity; break; } } if (minIndent !== Infinity) { position = values.length; while (position--) { stops = matrix[position]; index = minIndent; while (index && !(index in stops)) { index--; } if ( trim(values[position]).length !== 0 && minIndent && index !== minIndent ) { padding = C_TAB; } else { padding = ''; } values[position] = padding + values[position].slice( index in stops ? stops[index] + 1 : 0 ); } } values.shift(); return values.join(C_NEWLINE); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function indentation(value, maximum) {\n var values = value.split(lineFeed)\n var position = values.length + 1\n var minIndent = Infinity\n var matrix = []\n var index\n var indentation\n var stops\n\n values.unshift(repeat(space, maximum) + exclamationMark)\n\n while (position--) {\n indentation = get...
[ "0.6819278", "0.6252711", "0.6243119", "0.6243119", "0.6243119", "0.62121075", "0.62121075", "0.62121075", "0.6201936", "0.6201936", "0.6201936", "0.6201936", "0.6201936", "0.6201936", "0.6201936", "0.6201936", "0.61912143", "0.6183628", "0.61608905", "0.61590254", "0.6156546...
0.6607347
5
collapse(' \t\nbar \nbaz\t'); // ' bar baz '
function collapse(value) { return String(value).replace(/\s+/g, ' ') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function collapse(value) {\n return String(value).replace(/\\s+/g, ' ');\n}", "function collapseWhitespace(s) {\n return s.replace(/([ \\t]|\\r\\n)+/g, ' ').replace(/^\\s*/, '').replace(/\\s*$/, '');\n }", "function collapseWhitespace(s) {\n return s.replace(/([ \\t]|\\r\\n)+/g, ' ').replace(...
[ "0.73472404", "0.7040277", "0.7040277", "0.7040277", "0.7040277", "0.650207", "0.6448741", "0.6361119", "0.63314426", "0.6300574", "0.6049739", "0.60479444", "0.60167855", "0.60167855", "0.60126156", "0.5958536", "0.5958536", "0.5958536", "0.5958536", "0.5958536", "0.5958536"...
0.738729
5
Check if `character` can be inside an enclosed URI.
function isEnclosedURLCharacter(character) { return character !== C_GT && character !== C_BRACKET_OPEN && character !== C_BRACKET_CLOSE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isEnclosedURLCharacter(character) {\n return (\n character !== greaterThan &&\n character !== leftSquareBracket &&\n character !== rightSquareBracket\n )\n}", "function isUnclosedURLCharacter(character) {\n return (\n character !== leftSquareBracket &&\n character !== rightSquareBracke...
[ "0.8148286", "0.75004035", "0.7145794", "0.7145794", "0.7145794", "0.7145794", "0.7145794", "0.7145794", "0.63356864", "0.62859356", "0.6084301", "0.6061681", "0.58914745", "0.58914745", "0.5885102", "0.58735883", "0.57816184", "0.57632244", "0.5762444", "0.57483834", "0.5741...
0.7969781
6
Check if `character` can be inside an unclosed URI.
function isUnclosedURLCharacter(character) { return character !== C_BRACKET_OPEN && character !== C_BRACKET_CLOSE && !whitespace(character); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isUnclosedURLCharacter(character) {\n return (\n character !== leftSquareBracket &&\n character !== rightSquareBracket &&\n !whitespace(character)\n )\n}", "function isEnclosedURLCharacter(character) {\n return (\n character !== greaterThan &&\n character !== leftSquareBracket &&\n ...
[ "0.83408904", "0.81213295", "0.8058062", "0.8058062", "0.8058062", "0.8058062", "0.8058062", "0.8058062", "0.6533353", "0.6472987", "0.6284194", "0.6104877", "0.6047299", "0.59952676", "0.58667606", "0.58416814", "0.58416814", "0.5814853", "0.5802503", "0.5802503", "0.5802503...
0.81635445
6
Check if the given character code, or the character code at the first character, is a word character.
function wordCharacter(character) { return re.test( typeof character === 'number' ? fromCode(character) : character.charAt(0) ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isWord(str){\n\n\tlet out = true;\n\tif (str.search(/[^\\w\\s]/) != -1){\n\n\t\tout = false;\n\t};\n\treturn out\n}", "function isWord(str) {\n var alphaNumericFound = false;\n for (var i = 0; i < str.length; i++) {\n var code = str.charCodeAt(i);\n if ((code > 47 && code < 58) || // num...
[ "0.72252107", "0.6977966", "0.69345456", "0.65612113", "0.6549606", "0.65157354", "0.6493537", "0.6350567", "0.62914944", "0.62824345", "0.6246255", "0.6213352", "0.62027997", "0.61801505", "0.61801505", "0.6117986", "0.61055684", "0.6033244", "0.6031746", "0.6029927", "0.601...
0.7577229
5
Visit a single node.
function one(node) { var result if (!type || node.type === type) { result = visitor(node, stack.concat()) } if (node.children && result !== false) { return all(node.children, node) } return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "visitNode(node) { }", "visit() {\n if(this.state) this.state = Node.VISITED;\n }", "function node(){}", "function one(node, index, parent) {\n var result;\n\n index = index || (parent ? 0 : null);\n\n if (!type || node.type === type) {\n result = visitor(node, index, parent || null);\...
[ "0.7660978", "0.64456815", "0.6444978", "0.6280553", "0.6108867", "0.60755324", "0.60506946", "0.60506946", "0.60448086", "0.59708697", "0.59514207", "0.5924221", "0.59024817", "0.59024817", "0.59024817", "0.59024817", "0.56386995", "0.5636397", "0.5624829", "0.5620238", "0.5...
0.5810606
20
Visit children in `parent`.
function all(children, parent) { var length = children.length var index = -1 var child stack.push(parent) while (++index < length) { child = children[index] if (child && one(child) === false) { return false } } stack.pop() return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visit(parent, visitFn, childrenFn) {\n if (!parent) return;\n\n visitFn(parent);\n\n var children = childrenFn(parent);\n if (children) {\n var count = children.length;\n for (var i = 0; i < count; i++) {\n visit(children[i], visitFn, childrenFn);\n ...
[ "0.79614055", "0.79312193", "0.7884905", "0.78685194", "0.78685194", "0.78685194", "0.77841", "0.72736555", "0.676731", "0.6584016", "0.6529354", "0.62057847", "0.6133546", "0.6133546", "0.6120903", "0.6087371", "0.6087371", "0.6032075", "0.60211647", "0.60132015", "0.6013201...
0.57666314
29
Core highlighting function. Accepts a language name, or an alias, and a string with the code to highlight. Returns an object with the following properties: relevance (int) value (an HTML string with highlighting markup)
function highlight(name, value, ignore_illegals, continuation) { function escapeRe(value) { return new RegExp(value.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'm'); } function subMode(lexeme, mode) { var i, length; for (i = 0, length = mode.contains.length; i < length; i++) { if (testRe(mode.contains[i].beginRe, lexeme)) { if (mode.contains[i].endSameAsBegin) { mode.contains[i].endRe = escapeRe( mode.contains[i].beginRe.exec(lexeme)[0] ); } return mode.contains[i]; } } } function endOfMode(mode, lexeme) { if (testRe(mode.endRe, lexeme)) { while (mode.endsParent && mode.parent) { mode = mode.parent; } return mode; } if (mode.endsWithParent) { return endOfMode(mode.parent, lexeme); } } function isIllegal(lexeme, mode) { return !ignore_illegals && testRe(mode.illegalRe, lexeme); } function keywordMatch(mode, match) { var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0]; return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str]; } function buildSpan(classname, insideSpan, leaveOpen, noPrefix) { var classPrefix = noPrefix ? '' : options.classPrefix, openSpan = '<span class="' + classPrefix, closeSpan = leaveOpen ? '' : spanEndTag openSpan += classname + '">'; return openSpan + insideSpan + closeSpan; } function processKeywords() { var keyword_match, last_index, match, result; if (!top.keywords) return escape(mode_buffer); result = ''; last_index = 0; top.lexemesRe.lastIndex = 0; match = top.lexemesRe.exec(mode_buffer); while (match) { result += escape(mode_buffer.substring(last_index, match.index)); keyword_match = keywordMatch(top, match); if (keyword_match) { relevance += keyword_match[1]; result += buildSpan(keyword_match[0], escape(match[0])); } else { result += escape(match[0]); } last_index = top.lexemesRe.lastIndex; match = top.lexemesRe.exec(mode_buffer); } return result + escape(mode_buffer.substr(last_index)); } function processSubLanguage() { var explicit = typeof top.subLanguage === 'string'; if (explicit && !languages[top.subLanguage]) { return escape(mode_buffer); } var result = explicit ? highlight(top.subLanguage, mode_buffer, true, continuations[top.subLanguage]) : highlightAuto(mode_buffer, top.subLanguage.length ? top.subLanguage : undefined); // Counting embedded language score towards the host language may be disabled // with zeroing the containing mode relevance. Usecase in point is Markdown that // allows XML everywhere and makes every XML snippet to have a much larger Markdown // score. if (top.relevance > 0) { relevance += result.relevance; } if (explicit) { continuations[top.subLanguage] = result.top; } return buildSpan(result.language, result.value, false, true); } function processBuffer() { result += (top.subLanguage != null ? processSubLanguage() : processKeywords()); mode_buffer = ''; } function startNewMode(mode) { result += mode.className? buildSpan(mode.className, '', true): ''; top = Object.create(mode, {parent: {value: top}}); } function processLexeme(buffer, lexeme) { mode_buffer += buffer; if (lexeme == null) { processBuffer(); return 0; } var new_mode = subMode(lexeme, top); if (new_mode) { if (new_mode.skip) { mode_buffer += lexeme; } else { if (new_mode.excludeBegin) { mode_buffer += lexeme; } processBuffer(); if (!new_mode.returnBegin && !new_mode.excludeBegin) { mode_buffer = lexeme; } } startNewMode(new_mode, lexeme); return new_mode.returnBegin ? 0 : lexeme.length; } var end_mode = endOfMode(top, lexeme); if (end_mode) { var origin = top; if (origin.skip) { mode_buffer += lexeme; } else { if (!(origin.returnEnd || origin.excludeEnd)) { mode_buffer += lexeme; } processBuffer(); if (origin.excludeEnd) { mode_buffer = lexeme; } } do { if (top.className) { result += spanEndTag; } if (!top.skip && !top.subLanguage) { relevance += top.relevance; } top = top.parent; } while (top !== end_mode.parent); if (end_mode.starts) { if (end_mode.endSameAsBegin) { end_mode.starts.endRe = end_mode.endRe; } startNewMode(end_mode.starts, ''); } return origin.returnEnd ? 0 : lexeme.length; } if (isIllegal(lexeme, top)) throw new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.className || '<unnamed>') + '"'); /* Parser should not reach this point as all types of lexemes should be caught earlier, but if it does due to some bug make sure it advances at least one character forward to prevent infinite looping. */ mode_buffer += lexeme; return lexeme.length || 1; } var language = getLanguage(name); if (!language) { throw new Error('Unknown language: "' + name + '"'); } compileLanguage(language); var top = continuation || language; var continuations = {}; // keep continuations for sub-languages var result = '', current; for(current = top; current !== language; current = current.parent) { if (current.className) { result = buildSpan(current.className, '', true) + result; } } var mode_buffer = ''; var relevance = 0; try { var match, count, index = 0; while (true) { top.terminators.lastIndex = index; match = top.terminators.exec(value); if (!match) break; count = processLexeme(value.substring(index, match.index), match[0]); index = match.index + count; } processLexeme(value.substr(index)); for(current = top; current.parent; current = current.parent) { // close dangling modes if (current.className) { result += spanEndTag; } } return { relevance: relevance, value: result, language: name, top: top }; } catch (e) { if (e.message && e.message.indexOf('Illegal') !== -1) { return { relevance: 0, value: escape(value) }; } else { throw e; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _highlight(languageName, code, ignore_illegals, continuation) {\n var codeToHighlight = code;\n\n function endOfMode(mode, lexeme) {\n if (startsWith(mode.endRe, lexeme)) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }...
[ "0.7377656", "0.72873604", "0.69761133", "0.6795165", "0.67158353", "0.6704457", "0.66818535", "0.66816354", "0.6653529", "0.6653529", "0.6653529", "0.6653529", "0.6653529", "0.6653529", "0.6653529", "0.6651905", "0.6651905", "0.66511744", "0.66511744", "0.66511744", "0.66511...
0.6249571
66
Highlighting with language detection. Accepts a string with the code to highlight. Returns an object with the following properties: language (detected language) relevance (int) value (an HTML string with highlighting markup) second_best (object with the same structure for secondbest heuristically detected language, may be absent)
function highlightAuto(text, languageSubset) { languageSubset = languageSubset || options.languages || objectKeys(languages); var result = { relevance: 0, value: escape(text) }; var second_best = result; languageSubset.filter(getLanguage).filter(autoDetection).forEach(function(name) { var current = highlight(name, text, false); current.language = name; if (current.relevance > second_best.relevance) { second_best = current; } if (current.relevance > result.relevance) { second_best = result; result = current; } }); if (second_best.language) { result.second_best = second_best; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function highlightAuto(text, languageSubset) {\n languageSubset = languageSubset || options.languages || Object.keys(languages);\n var result = {\n relevance: 0,\n value: escape(text)\n };\n var second_best = result;\n languageSubset.forEach(function(name) {\n if (!getLanguage(name)) ...
[ "0.70028955", "0.70028955", "0.70028955", "0.70028955", "0.70028955", "0.70028955", "0.70028955", "0.6996582", "0.6996582", "0.6996582", "0.6996582", "0.6996582", "0.6996582", "0.6996582", "0.6996582", "0.69835204", "0.6980433", "0.697656", "0.697656", "0.697656", "0.697656",...
0.6820056
29
Postprocessing of the highlighted markup: replace TABs with something more useful replace real linebreaks with '' for nonpre containers
function fixMarkup(value) { return !(options.tabReplace || options.useBR) ? value : value.replace(fixMarkupRe, function(match, p1) { if (options.useBR && match === '\n') { return '<br>'; } else if (options.tabReplace) { return p1.replace(/\t/g, options.tabReplace); } return ''; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fixMarkup(value) {\n\t if (options.tabReplace) {\n\t value = value.replace(/^((<[^>]+>|\\t)+)/gm, function(match, p1 /*..., offset, s*/) {\n\t return p1.replace(/\\t/g, options.tabReplace);\n\t });\n\t }\n\t if (options.useBR) {\n\t value = value.replace(/\\n/g, '<br>');\n\t...
[ "0.64509696", "0.64509696", "0.64509696", "0.64509696", "0.6434141", "0.63663816", "0.63663816", "0.63663816", "0.63601816", "0.6344901", "0.633459", "0.633459", "0.633459", "0.633459", "0.633459", "0.63028455", "0.6280744", "0.62220705", "0.62121034", "0.62121034", "0.621210...
0.6209475
30
Applies highlighting to a DOM node containing code. Accepts a DOM node and two optional parameters for fixMarkup.
function highlightBlock(block) { var node, originalStream, result, resultNode, text; var language = blockLanguage(block); if (isNotHighlighted(language)) return; if (options.useBR) { node = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); node.innerHTML = block.innerHTML.replace(/\n/g, '').replace(/<br[ \/]*>/g, '\n'); } else { node = block; } text = node.textContent; result = language ? highlight(language, text, true) : highlightAuto(text); originalStream = nodeStream(node); if (originalStream.length) { resultNode = document.createElementNS('http://www.w3.org/1999/xhtml', 'div'); resultNode.innerHTML = result.value; result.value = mergeStreams(originalStream, nodeStream(resultNode), text); } result.value = fixMarkup(result.value); block.innerHTML = result.value; block.className = buildClassName(block.className, language, result.language); block.result = { language: result.language, re: result.relevance }; if (result.second_best) { block.second_best = { language: result.second_best.language, re: result.second_best.relevance }; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function highlightNode(node, highlightCallback, excludePredicate) {\n\t// if ('TR' === node.parentNode.nodeName.toUpperCase()) return;\n\tif (excludePredicate(node)) return;\n\n\t// Create a highlight\n\tvar highlight = highlightCallback(node);\n\t// Wrap it around the text node\n\tnode.parentNode.replaceChild(hig...
[ "0.64693505", "0.6364802", "0.62301296", "0.5959391", "0.58455855", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5758425", "0.5751009", "0.5751009", ...
0.0
-1
Updates highlight.js global options with values passed in the form of an object.
function configure(user_options) { options = inherit(options, user_options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function UpdateConfiguration() {\n var config = vscode.workspace.getConfiguration('hl7tools');\n highlightFieldBackgroundColor = config['highlightBackgroundColor'];\n}", "static define(specs, options) {\n return new HighlightStyle(specs, options || {});\n }", "function populate_highlights() {\n...
[ "0.60890985", "0.5841288", "0.57530504", "0.54813933", "0.5392691", "0.5234868", "0.5229774", "0.5227607", "0.5198296", "0.51958704", "0.5170306", "0.5168324", "0.5164002", "0.51420987", "0.51420987", "0.5135855", "0.5134353", "0.5134353", "0.5116286", "0.51022196", "0.509760...
0.0
-1
Applies highlighting to all .. blocks on a page.
function initHighlighting() { if (initHighlighting.called) return; initHighlighting.called = true; var blocks = document.querySelectorAll('pre code'); ArrayProto.forEach.call(blocks, highlightBlock); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initHighlighting() {\n if (initHighlighting.called)\n return;\n initHighlighting.called = true;\n\n var blocks = document.querySelectorAll('pre code');\n Array.prototype.forEach.call(blocks, highlightBlock);\n }", "function initHighlighting() {\n if (initHighlighting.called)\n ...
[ "0.6965865", "0.6965865", "0.6965865", "0.6965865", "0.6965865", "0.6965865", "0.6965865", "0.6965865", "0.6949577", "0.69325364", "0.69270915", "0.69270915", "0.69270915", "0.69270915", "0.68909764", "0.6874987", "0.68587834", "0.66729665", "0.66303533", "0.6340288", "0.6177...
0.69217765
24
Attaches highlighting to the page load event.
function initHighlightingOnLoad() { addEventListener('DOMContentLoaded', initHighlighting, false); addEventListener('load', initHighlighting, false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initHighlightingOnLoad() {\n window.addEventListener('DOMContentLoaded', initHighlighting, false);\n window.addEventListener('load', initHighlighting, false);\n }", "function initHighlightingOnLoad() {\n addEventListener('DOMContentLoaded', initHighlighting, false);\n addEvent...
[ "0.80268514", "0.7993287", "0.7993287", "0.7922299", "0.7922299", "0.7922299", "0.7922299", "0.7922299", "0.778201", "0.7738398", "0.74058837", "0.73645383", "0.73645383", "0.73645383", "0.73645383", "0.70029616", "0.6562669", "0.65551406", "0.65435123", "0.65405047", "0.6540...
0.7933503
23
Initialize the UI components.
function initUI() { showDataIsLoaded(); showExplorePage(); bindSearchHandler(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init(){\n buildComponent();\n attachHandlers();\n addComponents();\n }", "function init() {\n // courses\n lastCheckedCourse = -1;\n isActive = false;\n\n // connect ui elements with event handlers\n bindUIActions();\n }", "function init() {\n\n i...
[ "0.7526719", "0.72185904", "0.7114103", "0.7096513", "0.70570654", "0.6973309", "0.690981", "0.68565226", "0.68510777", "0.68357563", "0.68226945", "0.67514586", "0.67251706", "0.6712862", "0.6698622", "0.6689241", "0.66522837", "0.6633256", "0.66311234", "0.6627765", "0.6617...
0.686599
7
Group salary years of the same people together.
function processSalaryData() { for (let [year, yearlyData] of Object.entries(salaryData)) { for (let entry of yearlyData) { // get the person's first and last name let name = getNormalizedName(entry[FIRST_NAME], entry[MIDDLE_INITIAL], entry[LAST_NAME]); // if the name has not been seen yet in other years if (!(name in people)) { people[name] = {}; } // save the person's yearly salary data people[name][year] = entry; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function employee_grouping_by_age() {\n var emp=\n [\n {\n name:\"Amarjeet malik\",\n age:22,\n salary:8000,\n DOB:\"04/08/1996\"\n },\n {\n name:\"Dolly\",\n age:21,\n ...
[ "0.61218965", "0.6102793", "0.6092263", "0.603932", "0.57204527", "0.5619973", "0.56011134", "0.559948", "0.5540842", "0.5533275", "0.5529206", "0.5501415", "0.55013776", "0.54887897", "0.54887897", "0.54887897", "0.54887897", "0.5476106", "0.54710215", "0.5446877", "0.538045...
0.6252792
0
Show the Salary Explore page.
function showExplorePage() { // show the pagination document.getElementById("page").style.display = ""; // show "Explore Salary Data" text let resultsDisplay = document.getElementById("results"); resultsDisplay.innerHTML = "<h4 class='mt-3'>Explore Salary Data (From High to Low)</h4>"; // sort salary data of people const data = Object.values(people).sort((a, b) => { let aLatest = Object.keys(a).reduce((a, b) => Math.max(a, b)); let bLatest = Object.keys(b).reduce((a, b) => Math.max(a, b)); return b[bLatest][YTD_GROSS_EARNINGS] - a[aLatest][YTD_GROSS_EARNINGS]; }); // show first page of results showResults(data.slice(0, PAGE_SIZE)); // setup pagination $("#page").pagination({ items: data.length, prevText: '<span aria-hidden="true">&laquo;</span>', nextText: '<span aria-hidden="true">&raquo;</span>', itemsOnPage: 10, onPageClick: function(page, event) { event.preventDefault(); clearResults(); showResults(data.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE)); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showSalary() {\n hourlyEntry.style.display = \"none\";\n salaryEntry.style.display = \"grid\";\n commissionEntry.style.display = \"none\";\n }", "function viewEmployees() {\n connection.query(\"SELECT * FROM employee\", function(error, results) {\n if (error) throw error;\n\n...
[ "0.6180199", "0.58031374", "0.5794141", "0.5714532", "0.56359076", "0.56145453", "0.55778146", "0.55285794", "0.5525259", "0.5517379", "0.54681194", "0.54566485", "0.5444847", "0.5389511", "0.5360305", "0.53571486", "0.53136885", "0.5298541", "0.5282933", "0.52591884", "0.524...
0.58868617
1
Clear the results view.
function clearResults() { document.getElementById("results").innerHTML = ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearResults() {\n\t\t// Re-display loading icons\n\t\tdocument.getElementById(\"loadingmeaning\").style.display = \"inline\";\n\t\tdocument.getElementById(\"loadinggraph\").style.display = \"inline\";\n\t\tdocument.getElementById(\"loadingcelebs\").style.display = \"inline\";\n\t\t\n\t\t// Clear old resu...
[ "0.7894176", "0.7826185", "0.78203005", "0.76986355", "0.75015706", "0.741445", "0.7378017", "0.736055", "0.7340736", "0.7305873", "0.7304077", "0.72747767", "0.7239815", "0.72241765", "0.71921504", "0.71819866", "0.7153377", "0.71248156", "0.711531", "0.70830256", "0.7065517...
0.73955107
6
Bind the search handler function to the search element.
function bindSearchHandler() { document.getElementById("search").addEventListener("input", searchHander); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchBinding(){\n var selector = thisInstance.constants.selector,\n $searchForm = $(selector.searchForm);\n $searchForm.on('submit', function(event){\n event.preventDefault();\n fetchAndLoadUserList({searchKey: $.trim($(selector.searchBox).val())});\n ...
[ "0.75486916", "0.7392349", "0.73411644", "0.7178711", "0.7177348", "0.71594834", "0.70945114", "0.7060106", "0.7003046", "0.6943377", "0.6926139", "0.6902265", "0.68957525", "0.6797893", "0.6794089", "0.6768801", "0.67645663", "0.6691853", "0.6634165", "0.6634165", "0.6626383...
0.8257948
0
Show data loaded text then hide it after one second.
function showDataIsLoaded() { let loadingIndicator = document.getElementById("loadingIndicator"); loadingIndicator.innerHTML = "Data loaded!"; setTimeout(() => loadingIndicator.style.display = "none", 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadAndDisplay() {\n $(\"#hideBox\").delay(800).fadeOut('fast', function() {\n $(\"#resultsByTime\").show();\n });\n }", "function showLoading() {\n loading.classList.add(\"show\");\n setTimeout(callData, 2000);\n }", "function infoFunc(txt) {\r\n info.style.display = \"blo...
[ "0.73404324", "0.69087374", "0.6868067", "0.67688966", "0.6656473", "0.6454247", "0.6433648", "0.6433648", "0.6414432", "0.64014715", "0.64014715", "0.6391693", "0.638427", "0.6366506", "0.6333692", "0.63213426", "0.63101715", "0.62784857", "0.62565607", "0.6250191", "0.62473...
0.7029414
1
Bouton pour continuer de jouer.
function continu() { let button = document.createElement("button"); button.addEventListener("click", function (){ playComputer(); }) button.innerHTML = "Continuer"; container.appendChild(button); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onFinish() {\n\t\tclbk();\n\t}", "function boucleJeu() {\n\n var nouvelInterval = Date.now();\n\n\n\n //SI au premier instant du jeu on initialise le debut de l'interval a quelque chose\n if (!debutInterval) {\n debutInterval = Date.now();\n }\n\n gestionnaireObjets.repositionne...
[ "0.6195545", "0.61410254", "0.60387194", "0.5949616", "0.59375685", "0.5786673", "0.5750555", "0.5680152", "0.5677919", "0.5675547", "0.5653098", "0.5584378", "0.55716354", "0.5549071", "0.5522714", "0.55151117", "0.55028224", "0.54751045", "0.54701453", "0.5444646", "0.54418...
0.5089386
83
Build a destructive iterator for the value list
function iteratorFor(items) { var iterator = { next: function() { var value = items.shift(); return {done: value === undefined, value: value} } }; if (support.iterable) { iterator[Symbol.iterator] = function() { return iterator }; } return iterator }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static createIteratorFromValue(value){\n return (function(){\n let used = false;\n\n return {\n next: function(){\n try {\n return used ? {done: true} : {value: value, done: false};\n ...
[ "0.6567051", "0.61971587", "0.6129268", "0.60959846", "0.6081213", "0.6081213", "0.60518825", "0.60518825", "0.60518825", "0.60518825", "0.60518825", "0.60395825", "0.6019784", "0.6000144", "0.593555", "0.59003186", "0.5864537", "0.58550805", "0.57782644", "0.57182074", "0.56...
0.0
-1
global document, window, fetch / eslintdisable nonew
function getTotalDistance (result) { var total = 0; var myroute = result.routes[0]; for (var i = 0; i < myroute.legs.length; i++) { total += myroute.legs[i].distance.value; } total /= 1000; return total; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function windowFetch() {\n window.fetch = whatwg_fetch__WEBPACK_IMPORTED_MODULE_0__[\"fetch\"];\n }", "function Co() {\n // `document` is not always available, e.g. in ReactNative and WebWorkers.\n // eslint-disable-next-line no-restricted-globals\n return \"undefined\" != typeof document ? document...
[ "0.70870996", "0.6996015", "0.6759757", "0.66159815", "0.645969", "0.6440826", "0.63982975", "0.62370384", "0.61967504", "0.61747456", "0.6103623", "0.59823287", "0.5959121", "0.5910301", "0.58842325", "0.58611834", "0.58611834", "0.5794507", "0.5778042", "0.5766924", "0.5766...
0.0
-1
Method to handle click events on the criteria buttons Should take users to the tab of the targeted criteriaz
handleClick(key, category, e) { e.preventDefault(); e.stopPropagation(); const interpretation = this.props.interpretation; const selectedTab = this.state.selectedTab; const selectedSubtab = queryKeyValue('subtab', window.location.href); const selectedCriteria = queryKeyValue('criteria', window.location.href); if (interpretation) { if (selectedTab) { window.history.replaceState(window.state, '', editQueryValue(window.location.href, 'tab', mappingTab[category])); } else { window.history.replaceState(window.state, '', addQueryKey(window.location.href, 'tab', mappingTab[category])); } if (selectedSubtab) { if (mappingSubtab[key]) { window.history.replaceState(window.state, '', editQueryValue(window.location.href, 'subtab', mappingSubtab[key])); } else { window.history.replaceState(window.state, '', editQueryValue(window.location.href, 'subtab', '')); } } else { if (mappingSubtab[key]) { window.history.replaceState(window.state, '', addQueryKey(window.location.href, 'subtab', mappingSubtab[key])); } } if (selectedCriteria) { window.history.replaceState(window.state, '', editQueryValue(window.location.href, 'criteria', key)); } else { window.history.replaceState(window.state, '', addQueryKey(window.location.href, 'criteria', key)); } } this.props.updateSelectedCriteria(mappingTab[category], mappingSubtab[key], key); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onClick( event ) {\n for( var i = 0; i < _buttons.length; i++ ) {\n var button = _buttons[i];\n \n if( button.contains( event.layerX, event.layerY ) ) {\n actionPerformed( button.getActionCommand() );\n return;\n...
[ "0.6142148", "0.60345095", "0.59485", "0.594289", "0.59227425", "0.58963495", "0.5866551", "0.5862355", "0.58620954", "0.58570975", "0.58541536", "0.5790099", "0.57886904", "0.5778321", "0.57543445", "0.575279", "0.5742212", "0.5741319", "0.5739748", "0.57186145", "0.5716675"...
0.5765704
14
Method to render individual criteria codes and their respective tooltip 'datastatus' attribute flags whether a criterion is met
renderCriteriaBar(key, evidence, interpretation) { let status = 'not-evaluated'; // Flag 'met' criteria via [data-status] let evalArray = interpretation.evaluations; if (evalArray) { if (evalArray.length) { evalArray.forEach(entry => { if (typeof entry.criteria !== 'undefined' && entry.criteria === key) { status = entry.criteriaStatus; } }); } } return ( <button className={'btn btn-default ' + evidence[key].class + ' ' + evidence[key].category + this.getCurrentTab(evidence[key].category)} type="button" key={key} data-status={status} data-toggle="tooltip" data-placement="top" data-tooltip={evidence[key].definition} onClick={this.handleClick.bind(this, key, evidence[key].category)}> <span>{key}</span> </button> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderTestResults() {\n\n var trLength = testResults.length;\n if (trLength > 0 ) {\n\n // Get the labels for each of the system statuses\n var passed_label = getStatusLabel(\"passed\");\n var blocked_label = getStatusLabel(\"blocked\");\n var untested_label = getStatusLabel(\"untested\");\n...
[ "0.60921293", "0.59985125", "0.5935145", "0.57989573", "0.5769663", "0.5739767", "0.5723356", "0.57116985", "0.5633558", "0.5599243", "0.55275136", "0.55244064", "0.55243766", "0.5476842", "0.5465518", "0.54373485", "0.5413009", "0.5360616", "0.5341046", "0.5307232", "0.53007...
0.6939561
0
Method to return current tab
getCurrentTab(category) { let currentTabName, className = ''; let currentTab = this.state.selectedTab; if (currentTab) { switch (currentTab) { case 'population': currentTabName = 'population'; break; case 'variant-type': currentTabName = 'computational'; break; case 'experimental': currentTabName = 'functional'; break; case 'segregation-case': currentTabName = 'segregation'; break; default: currentTabName = null; } } if (currentTabName && currentTabName === category) { className = ' onCurrentTab'; } return className; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCurrentTab() {\n return currentTab;\n}", "function getCurrentTab() {\n return currentTab;\n}", "function getCurrentTab() {\n return currentTab;\n}", "function getCurrentTab() {\n return $currentTab;\n}", "getCurrentTab() {\n return window.location.pathname.split('/')[2];\n }", ...
[ "0.86921525", "0.86921525", "0.86921525", "0.85274065", "0.8011118", "0.7959443", "0.792258", "0.7772033", "0.77215374", "0.7521333", "0.7488247", "0.74814713", "0.7398076", "0.73719704", "0.736675", "0.7289245", "0.7244673", "0.724271", "0.72346973", "0.72335786", "0.7228042...
0.6694273
35
Event listener for key press
function keyPressed() { if (keyCode === 32) { // Space key if (!isFalling) { itsRaining.play() } else {maspeek.play()} isFalling = !isFalling; // Toggle raindrop falling state } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function keyPressed() {\n}", "HandleKeyDown(event) {}", "function onKeyDown(event) {\n}", "keyDown(_keycode) {}", "function keyListener(e) {\n // check which element fired the function\n let number = null;\n if($(e.target).is('button')) {\n number = $(e.target).html();\n } else {\n nu...
[ "0.7668592", "0.76072514", "0.76043946", "0.75907576", "0.74914855", "0.7488165", "0.7484244", "0.73791456", "0.73749834", "0.736602", "0.7347649", "0.7338612", "0.73363376", "0.73200935", "0.73099583", "0.73098874", "0.7297156", "0.7297156", "0.72847664", "0.7267472", "0.724...
0.0
-1
========================================================================= sendMail ========================================================================= Main function for recieving and validating the user's inputs. When finished, information will be sent to the email transfer php function to be prepared and sent to our email.
function sendMail(){ error = false; // Reset error to assume there's no errors // Fetch user's information var name = document.getElementById('name').value; var email = document.getElementById('email').value; var subject = document.getElementById('subject').value; var message = document.getElementById('message').value; //-----------------------------// // Validate user's information // //-----------------------------// // Did user input their name? if (name == ''){ validateActions("nameVal", "nameGroup", "Name field is empty", true); } else{ validateActions("nameVal", "nameGroup", "", false); } // Did user input their email? if (email == ''){ validateActions("emailVal", "emailGroup", "Email field is empty", true); } else{ // Email Regex var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; // Is the email invalid? if (!re.test(email)){ validateActions("emailVal", "emailGroup", "Given email is invalid", true); } else{ validateActions("emailVal", "emailGroup", "", false); } } // Did user input an email subject? if (subject == ''){ validateActions("subjectVal", "subjectGroup", "Subject field is empty", true); } else{ // Is the email subject ridiculously long? if (subject.length > 100){ validateActions("subjectVal", "subjectGroup", "We appreciate the long subject title but please shorten it to 100 words or less.", true); } else{ validateActions("subjectVal", "subjectGroup", "", false); } } // Did user input their email message? if (message == ''){ validateActions("messageVal", "messageGroup", "Message field is empty", true); } else{ // Is the email message ridiculously long? if (message.length > 2000){ validateActions("messageVal", "messageGroup", "We appreciate the long message but please shorten it to 2000 words or less.", true); } else{ validateActions("messageVal", "messageGroup", "", false); } } // Did we have an error? if (error){ $("#errormessage").addClass("show"); $("#sendmessage").removeClass("show"); return false; // Prevent form from sending } else{ // Empty each field (to prevent submit button spam) document.getElementById('name').value = ""; document.getElementById('email').value = ""; document.getElementById('subject').value = ""; document.getElementById('message').value = ""; $("#errormessage").removeClass("show"); $("#sendmessage").addClass("show"); } //----------------------------------------// // Send user's information to create mail // //----------------------------------------// // Stores user's information var data = {}; data.name = name; data.email = email; data.subject = subject; data.message = message; //alert(data.name + " || " + data.email + " || " + data.subject + " || " + data.message); //var loc = window.location.pathname; //var dir = loc.substring(0, loc.lastIndexOf('/')); //alert(dir); //$.post(dir + "/contactform/emailtransfer.php", data, mailReturn); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendMail(){ \n\tlogincontroller.logincheck(name,password,(err,data)=>{\n \tif(err) throw err;\n \telse{\n \t\tconsole.log(\"\\n------------------------------Compose Mail---------------------------------\\n\\n\")\n \t\tconsole.log(\"--------------------------------------------------------------------------...
[ "0.70699155", "0.6474504", "0.633365", "0.63208544", "0.6298", "0.62426984", "0.6143947", "0.6096317", "0.60901135", "0.60720444", "0.60468954", "0.6040679", "0.60349", "0.6030001", "0.6027417", "0.60139537", "0.6006004", "0.59976214", "0.595445", "0.595014", "0.5929794", "...
0.76435506
0
========================================================================= mailReturn ========================================================================= Function does any finishing touches depending on if the email was able to sent or not.
function mailReturn(data, status){ var obj = jQuery.parseJSON(data); alert("test"); alert(obj); // There was no error if (obj.error == ""){ //alert("Success : " + obj.success); $("#sendmessage").addClass("show"); } // There was an error else { //alert("Error : " + obj.error); $("#errormessage").html("An unexpected error has occured. Please try again."); $("#errormessage").removeClass("show"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function emailSuccess() {}", "function tryEmail() {\n emailTimeSent = new Date();\n emailSentSuccess = true;\n try {\n emailMessage = sendResponseEmail(respEmail, validResults, dataFileName, emailDate, formUrl);\n } catch (error) {\n emailSentSuccess = false;\n }\n }", "function send(...
[ "0.65813243", "0.64366025", "0.62018806", "0.6144422", "0.6086133", "0.6010962", "0.5983848", "0.59792596", "0.5965081", "0.5815481", "0.58072644", "0.58011085", "0.5782231", "0.5781725", "0.57719654", "0.57717156", "0.5757699", "0.57420784", "0.5725638", "0.5713802", "0.5709...
0.5880084
9
holds and updates state
constructor() { super(); this.state = { cards: data, id: 0 }; this.increment = this.increment.bind(this); this.decrement = this.decrement.bind(this); this.delete = this.delete.bind(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateState() {\n\t\tthis.trigger(this.state);\n\t}", "stateUpdate() {\n this.handlestateVariable();\n this.handlestateVariable2();\n this.handleCChange();\n this.handleAChange();\n this.handleidCapture();\n this.handleimgCapture();\n this.handleConfigChange();\n this.idca...
[ "0.7255192", "0.70365983", "0.702881", "0.69399273", "0.6881865", "0.6847718", "0.68105674", "0.67217463", "0.67167586", "0.66709465", "0.6654572", "0.65905696", "0.6563447", "0.6560559", "0.655718", "0.655399", "0.655399", "0.655399", "0.64857495", "0.6468861", "0.6462766", ...
0.0
-1
communication with components using props
render() { const { cards, id } = this.state; return ( <div className="App"> <div className="ButtonContainer"> <nav className="NavBar">Home</nav> <div className="CardContainer"> <Cards id={cards[id].id} firstName={cards[id].name.first} lastName={cards[id].name.last} city={cards[id].city} country={cards[id].country} jobTitle={cards[id].employer} employer={cards[id].title} movies={cards[id].favoriteMovies} cardsLength={cards.length} /> </div> <div className="buttons"> <PrevButton previous={this.decrement} /> <Delete delete={this.delete} /> <NextBtn next={this.increment} /> </div> </div> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get props () { return this.target.props }", "render() {\n \n // of course, there is no props\n // need to have this.props\n return <PassedComponent {...this.props}/>\n }", "get props() { return this._props }", "render(){\n const testValue = `All the names ${this.state.input}`\n ...
[ "0.6620023", "0.6423086", "0.6407961", "0.63540137", "0.63030547", "0.628188", "0.6255439", "0.6255439", "0.6216379", "0.61872846", "0.61624825", "0.6069475", "0.60612625", "0.6051446", "0.6049362", "0.6049362", "0.6048623", "0.604398", "0.6015258", "0.60135376", "0.6006178",...
0.0
-1
Rescale maze dimensions on density change
densityChanged(e, oldWidth, oldHeight, mazeWidth, mazeHeight) { const density = parseInt(e.target.value); const maxWidth = Math.floor(mazeWidth / density); const maxHeight = Math.floor(mazeHeight / density); let relWidth = Math.round((oldWidth.val / oldWidth.max) * maxWidth); let relHeight = Math.round((oldHeight.val / oldHeight.max) * maxHeight); if (relWidth === 0) { relWidth = 1; } if (relHeight === 0) { relHeight = 1; } this.props.setDensity(density); this.props.setWidth(relWidth, maxWidth); this.props.setHeight(relHeight, maxHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resizeMaze() {\n var jq = $(\"#maze\");\n jq[0].width = jq[0].clientWidth;\n jq[0].height = jq[0].clientHeight;\n}", "function resize() {\n width = parseInt(d3.select('#viz').style('width'));\n width = width - margin.left - margin.right;\n height = width * mapRatio;\n\n // update pr...
[ "0.7010467", "0.63734335", "0.63519555", "0.63437974", "0.63088465", "0.62070334", "0.6169253", "0.6115766", "0.61015874", "0.6095648", "0.60470426", "0.60360193", "0.60012406", "0.5950517", "0.59253323", "0.59253323", "0.5924455", "0.592156", "0.5919924", "0.59141785", "0.59...
0.73660415
0
includes Navbar + dropdown.
function MyApp({ Component, pageProps }) { return ( <div className="bg"> <CartProvider> <Navbar /> <Component {...pageProps} /> </CartProvider> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addNavBar(){\n\t$(\"header\").html(\"<nav class=\\\"navbar navbar-inverse navbar-fixed-top\\\" style=\\\"margin-bottom: 0px; border-radius: 0px;\\\">\\n\" +\n\t\t\" <div class=\\\"container-fluid\\\">\\n\" +\n\t\t\" <div class=\\\"navbar-header\\\">\\n\" +\n\t\t\"\t\t\t\t\t\t\t\t...
[ "0.7267558", "0.71692914", "0.70294404", "0.701039", "0.6757659", "0.6650825", "0.66297", "0.662937", "0.650255", "0.6477782", "0.6405027", "0.6395082", "0.638674", "0.6382124", "0.6361062", "0.63587135", "0.6341309", "0.6320697", "0.63098747", "0.63021636", "0.62921125", "...
0.0
-1
set y get nunca se nombran igual, se trabajan como si fueran propiedades
get mostrarNombre(){ return this.nombre; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set nombre(nom){\n this._nombres = nom;\n }", "setNom(nom){\n this.nom = nom;\n }", "function criaProduto (nome, preco, estoque){\n return{\n get nome(){\n return nome;\n },\n set nome(valor){\n valor = valor.replace(' vermelho','');\n ...
[ "0.7297205", "0.6923301", "0.6745769", "0.6584452", "0.6514841", "0.6508665", "0.6490742", "0.64034516", "0.64034516", "0.64034516", "0.64034516", "0.64034516", "0.64034516", "0.64034516", "0.63227904", "0.62466484", "0.6207394", "0.6207394", "0.6207394", "0.6203547", "0.6191...
0.5924147
29
Throws a `Cancel` if cancellation has been requested.
function throwIfCancellationRequested(config) { if (config.cancelToken) { config.cancelToken.throwIfRequested(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async cancel() {\n throw new Error(this.cancelMessage);\n }", "cancel() {\n throw new Error(\"Not implemented.\")\n }", "isCanceled(cancelled) {\n if (cancelled) {\n throw new Error(\"Cancelled request\");\n }\n }", "function throwIfCancellationRequested(config) {\n ...
[ "0.79483205", "0.7736851", "0.7534211", "0.74465257", "0.742381", "0.7385535", "0.7385535", "0.7385535", "0.7385535", "0.7385535", "0.7205974", "0.71676105", "0.7164012", "0.71617556", "0.71423924", "0.7138887", "0.7138887", "0.7138887", "0.7138887", "0.7138887", "0.7138887",...
0.0
-1
Determine if we're running in a standard browser environment This allows axios to run in a web worker, and reactnative. Both environments support XMLHttpRequest, but not fully standard globals. web workers: typeof window > undefined typeof document > undefined reactnative: navigator.product > 'ReactNative'
function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { return false; } return ( typeof window !== 'undefined' && typeof document !== 'undefined' ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isStandardBrowserEnv() {\n if (\n typeof navigator !== 'undefined' &&\n (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')\n ) {\n return false;\n }\n return typeof win...
[ "0.81452763", "0.81342584", "0.8130257", "0.8129432", "0.8120384", "0.8120384", "0.81187594", "0.81022084", "0.81022084", "0.81022084", "0.81022084", "0.81022084", "0.81022084", "0.81022084", "0.81022084", "0.8098782", "0.8098782", "0.8098782", "0.8098782", "0.8098782", "0.80...
0.0
-1
For Node v0.10 support. Remove this eventually.
function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _node_p(){\n\tvar ret = false;\n\tif( anchor.environment() == 'Node.js' ){ ret = true; }\n\treturn ret;\n }", "function node_error(err) {\r\n node.error(err, err);\r\n }", "private public function m246() {}", "function NodeFsHandler() {}", "function NodeFsHandler() {}", "static reset(...
[ "0.5863474", "0.5705808", "0.568645", "0.55544066", "0.55544066", "0.5446477", "0.5434516", "0.5381192", "0.5356294", "0.53282356", "0.53189546", "0.52043676", "0.51996946", "0.5156968", "0.51501393", "0.51281303", "0.51281303", "0.51281303", "0.5112595", "0.5100047", "0.5090...
0.0
-1
v8 likes predictible objects
function Item(fun, array) { this.fun = fun; this.array = array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareLike(a,b){\n var al = a.idLikesProp.length;\n var bl = b.idLikesProp.length;\n if(al > bl) return -1;\n if(bl > al) return 1;\n return 0;\n}", "function lookAround() {\n var objectDescription = \"\"\n tj.see().then(function(objects) {\n objects.forEach(function(each) {\n ...
[ "0.527866", "0.52612406", "0.51951283", "0.518796", "0.51302594", "0.5044646", "0.48934332", "0.4857401", "0.484017", "0.48302925", "0.482028", "0.4812441", "0.4808473", "0.47852293", "0.47828078", "0.47574478", "0.47493434", "0.4739314", "0.47239366", "0.4703992", "0.4703992...
0.0
-1
funcion DataTablelibreria ///LENADO DE TABLA POR DEFECTO
function addRowDT(data) { //DESCRIPCION : Funcion que me crea el listado de rutas en el body del DataTable for (var i = 0; i < data.length; i++) { var aux; if (data[i].marcaBaja == 0) { aux = btnEditar + btnDesactivar } else { aux = btnEditar + btnActivar } tabla.fnAddData([ data[i].ntraTipoMovimiento, data[i].descripcion, data[i].codTipoRegistro, data[i].tipoRegistro, aux ]); } $("body").on('click', '.btnEditar', function () { lblTitle.text("Actualizar Tipo de Movimiento"); btnGuardar.css("display", "block"); btnRegistrar.css("display", "none"); Mmensaje.css('display', 'none'); var tr = $(this).parent().parent(); pCodTipoMovimiento.val(table.row(tr).data()[0]); pDescripcion.val(table.row(tr).data()[1]); tregistro.val(table.row(tr).data()[2]); }) $("body").on('click', '.btnBlocked', function () { //Obtengo los valores de mi tr seleccionado. var tr = $(this).parent().parent(); var codTipoMovimiento = table.row(tr).data()[0]; swal({ title: "Se desactivará el registro", text: "¿Esta seguro que desea desactivar el registro?", icon: "warning", buttons: true, dangerMode: true, }) //Promesa que me trae el valor true al confirmar OK. .then((willDelete) => { if (willDelete) { DesactivarTipoMov(codTipoMovimiento) swal("Se desactivó el Registro", { icon: "success", }); } else { swal("Se canceló la desactivación"); } }); }); $("body").on('click', '.btnCheck', function () { //Obtengo los valores de mi tr seleccionado. var tr = $(this).parent().parent(); var codTipoMovimiento = table.row(tr).data()[0]; swal({ title: "Se activará el registro", text: "¿Esta seguro que desea activar el registro?", icon: "success", buttons: true, dangerMode: false, }) //Promesa que me trae el valor true al confirmar OK. .then((result) => { if (result) { ActivarTipoMov(codTipoMovimiento) swal("Se activó el Registro", { icon: "success", }); } else { swal("Se canceló la activación"); } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listar() {\n\n\t\ttabla=$('#resolucion_data').dataTable({\n\t\t\t\"aProcessing\":true,//Activamos procesamiento de datatable\n\t\t\t\"aServerSide\":true,//Paginacion y filtrado realizados por el servidor\n\t\t\tdom:'Bfrtip',//Definimos los elementos del control de table\n\t\t\tbuttons:[\n\t\t\t\t'copyHtml...
[ "0.7689245", "0.7638684", "0.74350077", "0.74239796", "0.7374482", "0.73509043", "0.7339714", "0.7328672", "0.7315904", "0.73038", "0.725183", "0.724247", "0.72397435", "0.7211342", "0.72055614", "0.71819067", "0.7158415", "0.7117878", "0.7089697", "0.7088204", "0.7026082", ...
0.0
-1
Esta funcion se usa para ver la Memo en el proceso de Memos
function verMemo(nroMemo, nameArchivo) { var URL = getUrlApp() + "/DownloadServlet?tipo=VER_MEMO&nroMemo=" + nroMemo + "&nameArchivo=" + nameArchivo + TAB_ID_REQUEST; /* window.status = URL; var w = window.open(URL,"Memo","width=" + ancho + ",height=" + alto + ",top=" + posX + ",left=" + posY + ",scrollbars=YES,resizable=YES"); w.focus(); */ var anchorDownloader = new Element('a', { href: URL, download: 'true' }).setStyle('visibility', 'hidden').inject(document.body); anchorDownloader.click(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readMemCache(ref) {\n if (!memCache[ref]) return;\n var age = Date.now() - memCache[ref].timestamp;\n if (age < ttl) return memCache[ref].hash;\n return;\n }", "function isInMemory(newState){\n\t var flag= false;\n\t for(mem in memory){\n\t\t if(memory[mem].stateEquals(newState)){\n\t\t\t f...
[ "0.5699145", "0.5545837", "0.5447439", "0.5341812", "0.5335568", "0.5317372", "0.52469426", "0.52469426", "0.52372336", "0.5208976", "0.5191871", "0.51397777", "0.5087608", "0.50810736", "0.50424266", "0.4998561", "0.49763298", "0.49688148", "0.49621877", "0.4949243", "0.4936...
0.0
-1
Esta funcion se usa para ver la Memo en la consulta de memos
function verMemo2(nroMemo, nameArchivo) { var URL = getUrlApp() + "/DownloadServlet?tipo=VER_MEMO_2&nroMemo=" + nroMemo + "&nameArchivo=" + nameArchivo + TAB_ID_REQUEST; /* window.status = URL; var w = window.open(URL,"Memo","width=" + ancho + ",height=" + alto + ",top=" + posX + ",left=" + posY + ",scrollbars=YES,resizable=YES"); w.focus(); */ var anchorDownloader = new Element('a', { href: URL, download: 'true' }).setStyle('visibility', 'hidden').inject(document.body); anchorDownloader.click(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isInMemory(newState){\n\t var flag= false;\n\t for(mem in memory){\n\t\t if(memory[mem].stateEquals(newState)){\n\t\t\t flag = true;\n\t\t\t break;\n\t\t }\n\t }\n\t return flag;\n}", "mobLookup(mob) {\r\n if (this.mobsInfo.filter(mobInfo => mobInfo.name == mob).length > 0) {\r\n return true;\r\...
[ "0.54363006", "0.53921723", "0.5376621", "0.5367639", "0.5279848", "0.52349174", "0.51900053", "0.51821333", "0.51652825", "0.5148266", "0.51415527", "0.5074767", "0.5028829", "0.50194067", "0.50068545", "0.49502096", "0.49188247", "0.49022853", "0.4902154", "0.4887947", "0.4...
0.0
-1
Esta funcion se usa para ver la nota enviada en la tarea de firma
function verNotaEnviada(nroNotaEnv, nameArchivo) { var URL = getUrlApp() + "/DownloadServlet?tipo=VER_NE&nroNotaEnv=" + nroNotaEnv + "&nameArchivo=" + nameArchivo + TAB_ID_REQUEST; /* window.status = URL; var w = window.open(URL,"Memo","width=" + ancho + ",height=" + alto + ",top=" + posX + ",left=" + posY + ",scrollbars=YES,resizable=YES"); w.focus(); */ var anchorDownloader = new Element('a', { href: URL, download: 'true' }).setStyle('visibility', 'hidden').inject(document.body); anchorDownloader.click(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function verifForm2(f){\n\n var telOk = verifTel(f.tel) ; \n var mailOk = verifMail(f.mail) ; \n var siteOk = verifLink(f.site) ;\n \n \n\n if (telOk || mailOk || siteOk ) {\n alert(\"Votre annonce a bien été envoyée, elle sera confirmée par nos équipes\");\n ret...
[ "0.64145637", "0.5937855", "0.57912743", "0.5769235", "0.5725417", "0.56763625", "0.5661936", "0.5621425", "0.5603124", "0.5593208", "0.55901504", "0.5583866", "0.55482215", "0.55421346", "0.5531841", "0.55250686", "0.55144674", "0.54835355", "0.5480265", "0.5469893", "0.5467...
0.5188947
87
Esta funcion se usa para ver la nota enviada en la consulta de notas enviada
function verNotaEnviada2(nroNotaEnv, nameArchivo) { var URL = getUrlApp() + "/DownloadServlet?tipo=VER_NOTA_ENV&nroNotaEnv=" + nroNotaEnv + "&nameArchivo=" + nameArchivo + TAB_ID_REQUEST; /* window.status = URL; var w = window.open(URL,"Memo","width=" + ancho + ",height=" + alto + ",top=" + posX + ",left=" + posY + ",scrollbars=YES,resizable=YES"); w.focus(); */ var anchorDownloader = new Element('a', { href: URL, download: 'true' }).setStyle('visibility', 'hidden').inject(document.body); anchorDownloader.click(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chequearDatosEnvio(){\n // chequeo de calle, nropuerta, esquina\n let calle = document.getElementById(\"calle\").value;\n let nropuerta = document.getElementById(\"numeropuerta\").value;\n let esquina = document.getElementById(\"esquina\").value;\n let pais = document.getElementById(\"pais\...
[ "0.5746764", "0.57259446", "0.5611013", "0.5588444", "0.5563374", "0.54291016", "0.54149574", "0.53687453", "0.53646326", "0.5351106", "0.5350809", "0.53065395", "0.53056693", "0.5301784", "0.52873105", "0.5281144", "0.52522814", "0.5242141", "0.5235769", "0.52216303", "0.521...
0.0
-1
Esta funcion se usa para ver la nota recibida en la consulta de notas recibida
function verNotaRecibida(nroNotaRec, nameArchivo) { var URL = getUrlApp() + "/DownloadServlet?tipo=VER_NOTA_REC&nroNotaRec=" + nroNotaRec + "&nameArchivo=" + nameArchivo + TAB_ID_REQUEST; /* window.status = URL; var w = window.open(URL,"Memo","width=" + ancho + ",height=" + alto + ",top=" + posX + ",left=" + posY + ",scrollbars=YES,resizable=YES"); w.focus(); */ var anchorDownloader = new Element('a', { href: URL, download: 'true' }).setStyle('visibility', 'hidden').inject(document.body); anchorDownloader.click(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mostraNotas(){}", "function verificarDT(atrib, mens, id){\n var bandera = true;\n if(atrib.value.length > 0){\n if(mens=='mtelefono' && atrib.value.length<9){\n error(atrib, mens, '<br>El numero de telefono no tiene los digitos necesarios')\n bandera = false;\n ...
[ "0.6212676", "0.58354574", "0.5805491", "0.57471216", "0.5608144", "0.5606923", "0.54609597", "0.54362684", "0.54166603", "0.5403096", "0.53999573", "0.5393371", "0.5390136", "0.5383401", "0.53723955", "0.53562325", "0.53534365", "0.531439", "0.53131807", "0.52895516", "0.527...
0.0
-1
Initializes the tablecheckbox wrapper.
_init() { this.$element.find('thead tr').each(function(index, el) { $(el).prepend('<th class="check table-checkbox-cell"><input type="checkbox" /></th>'); }); this.$element.find('tbody tr').each(function(index, el) { $(el).prepend('<td class="check table-checkbox-cell"><input type="checkbox" /></td>'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function styleCheckbox(table) {\n\n }", "function styleCheckbox(table) {\r\n\r\n\t}", "build() {\n // this.element = this.ce('div', {\n // class: 'table-responsive'\n // });\n // this.createLabel(this.element);\n\n // var tableClass = 'table ';\n // ['striped', 'bordered', 'hover', '...
[ "0.6688414", "0.64977086", "0.6467641", "0.6416971", "0.6380863", "0.63686115", "0.63614565", "0.63245076", "0.6323659", "0.631772", "0.6316012", "0.6300938", "0.6299302", "0.6292558", "0.62875015", "0.6280745", "0.6267908", "0.6267908", "0.6239484", "0.6239484", "0.6155657",...
0.78201777
0
Adds event handlers to the tablecheckbox.
_events() { this.$element.find('.table-checkbox-cell input').off('change').on({ 'change': this._triggerEvents.bind(this) }); this.$element.find('td.table-checkbox-cell input').off('click').on({ 'click': this._handleClick.bind(this) }); this.$element.find('th.table-checkbox-cell input').off('.zf.trigger').on({ 'check.zf.trigger': this.checkAll.bind(this), 'uncheck.zf.trigger': this.uncheckAll.bind(this), 'toggle.zf.trigger': this.toggleAll.bind(this) }); this.$element.find('td.table-checkbox-cell input').off('.zf.trigger').on({ 'check.zf.trigger': this.check.bind(this), 'uncheck.zf.trigger': this.uncheck.bind(this), 'toggle.zf.trigger': this.toggle.bind(this) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loadCheckboxInputEventListeners(dataCtrl,uiCtrl){\n const className = uiCtrl.returnIds().classNames.checkboxesSelector\n for(const input of document.getElementsByClassName(className)){\n input.addEventListener('click',(e)=>{\n dataCtrl.updateRegChecked(e.target.id)\n ...
[ "0.68256617", "0.6514233", "0.6447254", "0.64088225", "0.62657773", "0.62545544", "0.62428105", "0.62331194", "0.6184075", "0.61073124", "0.6107219", "0.61038136", "0.6090065", "0.6061392", "0.605559", "0.60176665", "0.601445", "0.6007979", "0.5986835", "0.59832823", "0.59793...
0.60099036
17
Triggers custom events on checkbox toggle.
_triggerEvents(event) { var target = $(event.target); if (target.is(':checked')) { target.trigger('check.zf.trigger'); } else { target.trigger('uncheck.zf.trigger'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkBox(e){\n\t\t\t\t$(this).toggleClass(\"on\");\n\t\t\t\t$(this).trigger(\"change\");\n\t\t\t}", "function checkBox(e){\n\t\t\t\t$(this).toggleClass(\"on\");\n\t\t\t\t$(this).trigger(\"change\");\n\t\t\t}", "[toggleChecked](event) {\n\t\tconst self = this;\n\n\t\tif (event && self[IS_CLICKABLE]) {\...
[ "0.7453503", "0.7453503", "0.738352", "0.7069492", "0.69283473", "0.68284374", "0.6793226", "0.6791482", "0.6765733", "0.672069", "0.6654515", "0.66085434", "0.6432164", "0.64278", "0.64190793", "0.6413244", "0.63892907", "0.6269365", "0.6252796", "0.62228006", "0.6198602", ...
0.7231672
3
Handles click events on checkbox toggle.
_handleClick(event) { var row = $(event.target).parents('tr:first'); var rows = this.$element.find('tbody tr'); if (!this.lastChecked) { this.lastChecked = row; return; } if (event.shiftKey) { this.changeMultiple = true; var start = rows.index(row); var end = rows.index(this.lastChecked); var from = Math.min(start, end); var to = Math.max(start, end) + 1; var checked = this.lastChecked.find('input').is(':checked'); var checkboxes = rows.slice(from, to).find('input'); if (checked) { checkboxes.trigger('check.zf.trigger'); } else { checkboxes.trigger('uncheck.zf.trigger'); } this.changeMultiple = false; } this.lastChecked = row; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "[toggleChecked](event) {\n\t\tconst self = this;\n\n\t\tif (event && self[IS_CLICKABLE]) {\n\t\t\tevent.stopPropagation();\n\t\t}\n\n\t\tif (!self[IGNORE_EVENTS]) {\n\t\t\tself.isSelected(!self.isSelected());\n\t\t\tif (self.onSelect().length !== 0) {\n\t\t\t\tself.onSelect().trigger();\n\t\t\t}\n\t\t}\n\t}", "c...
[ "0.75247204", "0.73084927", "0.6968265", "0.68382", "0.68351954", "0.67595583", "0.67595583", "0.6717607", "0.6715247", "0.66525775", "0.66276556", "0.6585133", "0.6577546", "0.6456626", "0.644153", "0.6405237", "0.6397804", "0.6395283", "0.6376296", "0.63761735", "0.63729376...
0.0
-1
Updates active rows on changes.
_updateActiveRows() { if (!this.changeMultiple) { this.activeRows = this.$element.find('tbody tr.active'); this.$element.trigger('changed.zf.table.checkbox', [this.activeRows]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "commitChangedRows() {\n var d = new latte.DataSet();\n var old = new latte.DataSet();\n var indexes = [];\n this.endCellEdit();\n // Add dataset columns\n d.columns.addCollection(this.columns);\n old.columns.addCollection(this.columns);\n...
[ "0.6598424", "0.6539915", "0.6539915", "0.6319356", "0.6313995", "0.62199163", "0.6153227", "0.61383456", "0.6096986", "0.6073774", "0.60399884", "0.6036125", "0.6000784", "0.5969804", "0.5939618", "0.58777857", "0.58718956", "0.5846417", "0.58243895", "0.5819677", "0.5810749...
0.81905556
0
Destroys the tablecheckbox plugin.
_destroy() { this.$element.off('.zf.table.checkbox'); this.$element.find('th.table-checkbox-cell').remove(); this.$element.find('td.table-checkbox-cell').remove(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function destroy() {\n // clear up our FieldChecker controller instance\n // ... this will dynamically remove itself from our parent FormChecker\n fieldChecker.destroy();\n }", "function destroy() {\n Y.log('Destroying table element: ' + element.getDomId(), 'debug', NAME);\n }...
[ "0.6524498", "0.6375102", "0.637256", "0.62806654", "0.616944", "0.61632246", "0.6157277", "0.6090114", "0.6052867", "0.6041596", "0.600461", "0.59902555", "0.5966329", "0.5955884", "0.5934785", "0.59227866", "0.59213597", "0.59186935", "0.59028304", "0.58918095", "0.5875409"...
0.8110313
0
form functions resolves with all forms
function getAllForms() { return new Promise((resolve, reject) => { if(!form) reject(new Error("forms is not found")); return resolve(form); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n Object.entries(formsAndHandlers).forEach(([formID, handler]) => {\n const form = document.getElementById(formID);\n form.onsubmit = (e) => {\n e.preventDefault();\n const data = {};\n (new FormData(form)).forEach((value, key) => {\n data[key] = value;\n });\n ...
[ "0.63619393", "0.62982017", "0.62664354", "0.6104025", "0.6090277", "0.6049145", "0.5967334", "0.59529597", "0.59292257", "0.5902281", "0.588008", "0.5880065", "0.5869194", "0.58580196", "0.5857524", "0.5855695", "0.5853861", "0.5847028", "0.5828548", "0.58064574", "0.5805229...
0.6515821
0
resolves with one form and form inputs by id
function getFormById(id) { return new Promise((resolve, reject) => { if(!form) reject(new Error("forms is not found")); let formData = {}; for(let i in form) { if(form[i].formid == id) { formData.form = form[i]; break; } } let form_field_data = []; for(let j in form_field) { if(form_field[j].formid == id) form_field_data.push(form_field[j]); } formData.form_field = form_field_data; // should reject if none is found or something resolve(formData) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addInputForm (id) {\n const formId = id + 1;\n const plusButton = document.querySelector(`#addInputForm${id}`);\n const form = document.querySelector(`#inputForm${formId}`);\n plusButton.addEventListener(\"click\", () => {\n form.style.display = \"inline\";\n });\n}", "getById(id) {\r\n c...
[ "0.6067841", "0.6062424", "0.6018778", "0.59484327", "0.578025", "0.572888", "0.57229555", "0.57105595", "0.5681465", "0.567825", "0.5660196", "0.56314117", "0.5585856", "0.55528146", "0.5527853", "0.5516726", "0.55071235", "0.55000216", "0.54956573", "0.54686064", "0.5458628...
0.6262314
0
resolves to to form that was updated (or should probably resolve to boolean to send less data)
function updateForm(id) { return new Promise((resolve, reject) => { if(!form || id) reject(new Error("forms is not found")); resolve(true); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateForm(form) {\n if (!this.state.form) {\n this.state.form = form;\n }\n }", "formChanged() {}", "updateRentalForm() {\n this.set('updateRentalForm', true);\n }", "updateForm(context, payload) {\n context.commit(\"updateForm\", payload);\n }", "function doUpd...
[ "0.6650722", "0.6561767", "0.6399934", "0.6288627", "0.61664265", "0.61469835", "0.6077053", "0.6077053", "0.60443324", "0.6023432", "0.59711677", "0.5970002", "0.59667534", "0.59583205", "0.5948626", "0.59467125", "0.5937678", "0.59367144", "0.5928914", "0.59220713", "0.5918...
0.63624835
3
resolve to new form created (should probably resolve to form id to send less data)
function createForm(formdata) { return new Promise((resolve, reject) => { if(!form || !formdata) reject(new Error("forms is not found")); // should probably return form that was created resolve(true); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newProjectForm() {\n\t\t$.get(\"/projects/new\", function(projectForm) {\n\t\t\tdocument.getElementById('js-new-project-form').innerHTML = projectForm;\n\t\t}).done(function() {\n\t\t\tlistenerSaveProject();\n\t\t})\n}", "function createFormForUser(newForm, userid) {\n var deferred = q.defer();\n...
[ "0.67756826", "0.6715408", "0.6676951", "0.66667616", "0.6656567", "0.6643752", "0.65391237", "0.64958495", "0.63840175", "0.6380023", "0.63715625", "0.63399535", "0.6316941", "0.62762165", "0.62506026", "0.6249293", "0.62392634", "0.6238345", "0.6236167", "0.623004", "0.6226...
0.6764775
1
user queries resolves with all users
function getAllUsers() { return new Promise((resolve, reject) => { if(!applicant) reject(new Error('applicants cannot be found')); resolve(applicant); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "allUsers() { return queryAllUsers() }", "function getUsers(query) {\n if ($scope.data.ACL.users.length) {\n var args = {\n options: {\n classUid: 'built_io_application_user',\n query: query\n }\n }\n return builtDataService.Objects...
[ "0.80235803", "0.75398386", "0.7262968", "0.71300673", "0.71195406", "0.71186984", "0.71141726", "0.7102634", "0.7064423", "0.7061835", "0.7061835", "0.6985737", "0.69553053", "0.6952219", "0.694823", "0.6940824", "0.6914636", "0.69008607", "0.68826485", "0.6868374", "0.68574...
0.0
-1
resolves with all forms for one applicant by id of applicant
function getUserFormsById(id) { return new Promise((resolve, reject) => { if(!applicant) reject(new Error('applicants cannot be found')); let applicant_data = {}; for(let i in applicant) { console.log(id ,applicant[i]); if(applicant[i].applicantid == id) { applicant_data.applicant = applicant[i]; break; } } if(!applicant_data.applicant) resolve({}); let userForms = []; for(let j in applicant_form) { console.log('form', applicant_form[j]) if(applicant_form[j].applicantid == id) { userForms.push(applicant_form[j]); } } applicant_data.application_form = userForms; resolve(applicant_data); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUserFormResponces(userid, formid) {\n return new Promise((resolve, reject) => {\n if(!applicant || !userid || !formid) reject(new Error('applicants cannot be found'));\n resolve([]);\n });\n}", "function getFormById(id) {\n return new Promise((resolve, reject) => {\n if(!form) reject(new ...
[ "0.6088951", "0.6052487", "0.59781617", "0.5920414", "0.57667005", "0.57484394", "0.5678767", "0.5611019", "0.55790794", "0.5572576", "0.5459195", "0.5406526", "0.53712595", "0.5366074", "0.5340986", "0.532006", "0.5296096", "0.5277418", "0.52678955", "0.5238447", "0.52285886...
0.7286602
0
resolves to user's responces (should probably also return the form data (form and form_field))
function getUserFormResponces(userid, formid) { return new Promise((resolve, reject) => { if(!applicant || !userid || !formid) reject(new Error('applicants cannot be found')); resolve([]); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function responseFn() {\n if (req.readyState === 4) {\n try {\n // Success response\n if (req.status >= 200 && req.status < 400) {\n resolve({\n data: JSON.parse(req.responseText),\n status: req.status,\n config: Object.assign({}, opts...
[ "0.58821845", "0.5860963", "0.5850275", "0.584663", "0.58455175", "0.5825443", "0.577574", "0.577574", "0.5771209", "0.5771209", "0.5771209", "0.5771209", "0.5771209", "0.5755652", "0.57258236", "0.570497", "0.5658164", "0.55834943", "0.5578811", "0.554056", "0.55220217", "...
0.56757134
16
START OF FPI Code / Template processing code START Creates a dictionary that has all PI fields mentioned in this template with information such as which one of them can be null and which ones are mandatory. Returns a tree of created template nodes.
function traverse_template_create_tree(fd, curr_node, site_pi_fields) { var all_kids = $(fd).children('div'); var last_kid = null; curr_node.children = []; curr_node.xml_node = fd; curr_node.name = $(fd).attr('name'); if (all_kids.length == 0) { //This is a leaf node .. represents actual value to be downloaded from the site var name = $(fd).attr('name'); var can_be_a_null = $(fd).attr('can_be_a_null'); site_pi_fields[name] = {}; if (can_be_a_null != undefined) { site_pi_fields[name].can_be_a_null = (can_be_a_null == 'no') ? false : true; } else { site_pi_fields[name].can_be_a_null = true; } site_pi_fields[name].filled = false; site_pi_fields[name].processed = false; site_pi_fields[name].value = []; } else { for(var i = 0; i < all_kids.length; i++) { var new_node = {}; new_node.parent = curr_node; new_node.sibling_num = i; new_node.completely_processed = false; if (last_kid != null) { new_node.left_sibling = last_kid; last_kid.right_sibling = new_node; new_node.right_sibling = null; last_kid = new_node; } else { new_node.left_sibling = null; last_kid = new_node; } curr_node.children.push(new_node); if ($(all_kids[i]).attr('type')) { new_node.type = $(all_kids[i]).attr('type'); } traverse_template_create_tree(all_kids[i], new_node, site_pi_fields); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function TemplateInfo() {\n\tthis.code = '';\n\tthis.type = '';\n\tthis.parent = '';\n\tthis.description = '';\n}", "async process_fields() {\n\n const fields_template = this._blockkit_conifg.block_kit.fields;\n\n const result = {};\n result.type = \"section\";\n result.fields = [];\n\n for (const...
[ "0.58117586", "0.57724404", "0.5176685", "0.5152908", "0.51514655", "0.49836132", "0.49600205", "0.49585125", "0.4946984", "0.4917042", "0.4888747", "0.4888747", "0.48701122", "0.4855201", "0.48429745", "0.48386312", "0.4812062", "0.48064396", "0.48003817", "0.4792527", "0.47...
0.69365865
0
Instead of doing direct recursion, one has to do indirect one as JS has all the calls such as fetch URLs async.(to not annoy users waiting and blocking) and also because slavetab is a resource that multiple nodes will want to use to fetch their URLs. This async business is making me insane...because of soooo much indirection. Can't wait to have "yield" in ECMAScript 6.
function traverse_and_fill(curr_node, site_pi_fields, my_slave_tab, level) { if (curr_node.parent == null) { console.log("APPU DEBUG: Creating root process_div"); //This is the root node. So we should be good to process next kid. curr_node.process_next_kid = true; //Also create a <div> element and attach it to main body. //This will be used to indicate that the current child has been //processed upto its leaf node. //Current level(which will be 0) and since this node is root, child number = 0; var dummy_tab_id = sprintf('child-processing-complete-%s-%s-%s', my_slave_tab.tabid, level, "0"); var dummy_div_str = sprintf('<div id="%s"></div>', dummy_tab_id); var dummy_div = $(dummy_div_str); $('body').append(dummy_div); curr_node.child_processing_div = dummy_div; console.log("APPU DEBUG: TRAVERSE_AND_FILL(), curr_node: " + curr_node.name + ", PROCEEDING (ROOT)"); process_action(curr_node, $(curr_node.xml_node).children('action'), site_pi_fields, my_slave_tab, level); } else { //We are not root node. var dummy_tab_id = sprintf('child-processing-complete-%s-%s-%s', my_slave_tab.tabid, level, curr_node.sibling_num); var dummy_div_str = sprintf('<div id="%s"></div>', dummy_tab_id); var dummy_div = $(dummy_div_str); $($(curr_node.parent.child_processing_div)).append(dummy_div); curr_node.child_processing_div = dummy_div; if (curr_node.parent.process_next_kid == true) { curr_node.parent.process_next_kid = false; curr_node.process_next_kid = true; console.log("APPU DEBUG: TRAVERSE_AND_FILL(), curr_node: " + curr_node.name + ", PROCEEDING"); process_action(curr_node, $(curr_node.xml_node).children('action'), site_pi_fields, my_slave_tab, level); } else { curr_node.process_next_kid = false; console.log("APPU DEBUG: TRAVERSE_AND_FILL(), curr_node: " + curr_node.name + ", SLEEPING"); wait_on_sibling_processing_to_finish(curr_node, site_pi_fields, my_slave_tab, level); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function list() {\n const urls = itemize('https://nodebin.herokai.com/', { depth: 3, query: true })\n while (!urls.done()) {\n console.log(await urls.next())\n }\n}", "crawlNextUrl() {\n var _this4 = this;\n\n const urlsPoolSize = this.crawlStatesRepository.urlsPoolSize();\n const urlsSize =...
[ "0.6329586", "0.6091885", "0.6077464", "0.6040151", "0.5970379", "0.5848444", "0.5801038", "0.578965", "0.5783529", "0.5777084", "0.571731", "0.57038796", "0.5640876", "0.56333613", "0.5618298", "0.5590522", "0.55784726", "0.55001986", "0.5499873", "0.54934645", "0.5486687", ...
0.0
-1
Simulate a waiting queue. When someone calls to fetch url and if their slave tab is busy fetching another url, then put that node on waiting queue. Waiting on the slave tab occurs in a situation where parentnode's link has been fetched and all children now want to fetch their links.
function make_slavetab_do_work(action_type, curr_node, site_pi_fields, fetch_url, my_slave_tab, level) { if (!('gatekeeper_initialized' in my_slave_tab)) { my_slave_tab.gatekeeper_initialized = true; my_slave_tab.wait_queue = []; var event_name = "waiting_queue"; var wait_dummy_tab_id = sprintf('wait-queue-tab-%s', my_slave_tab.tabid); $('#' + wait_dummy_tab_id).on(event_name, function() { console.log("APPU DEBUG: woken up from SLAVE-TAB waiting queue"); if (my_slave_tab.in_use == true) { console.log("APPU DEBUG: Woken up from wait queue but tab is in use"); } else { if (my_slave_tab.wait_queue.length > 0) { var t = my_slave_tab.wait_queue.pop(); my_slave_tab.in_use = true; send_cmd_to_tab(t.action_type, t.curr_node, t.site_pi_fields, t.fetch_url, my_slave_tab, t.level); } } }); } if (my_slave_tab.in_use == true) { var t = { 'action_type' : action_type, 'curr_node' : curr_node, 'site_pi_fields' : site_pi_fields, 'fetch_url' : fetch_url, 'level' : level }; my_slave_tab.wait_queue.push(t); } else { my_slave_tab.in_use = true; send_cmd_to_tab(action_type, curr_node, site_pi_fields, fetch_url, my_slave_tab, level); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fill() {\n // Note:\n // - queue.running(): number of items that are currently running\n // - queue.length(): the number of items that are waiting to be run\n while (this.queue.running() + this.queue.length() < this.concurrency && this.path.peersToQuery.length > 0) {\n this.queue.push(this.path.pe...
[ "0.5778248", "0.56094426", "0.55767995", "0.550193", "0.54694515", "0.5414653", "0.53997904", "0.5398549", "0.53968996", "0.53924865", "0.53765005", "0.53718394", "0.5323947", "0.53234255", "0.5306173", "0.5286078", "0.5278313", "0.5249631", "0.5230891", "0.5230891", "0.52287...
0.5859284
0
Template processing code END
function start_pi_download_process(domain, data) { var process_template_tabid = undefined; //Just some link so that appu content script runs on it. var default_url = 'http://google.com'; //Create a new tab. Once its ready, send message to process the template. chrome.tabs.create({ url: default_url, active: false }, function(tab) { process_template_tabid = tab.id; var my_slave_tab = { tabid: process_template_tabid, 'in_use': true} template_processing_tabs[process_template_tabid] = default_url; //console.log("APPU DEBUG: XXX tabid: " + tab.id + ", value: " + // template_processing_tabs[tab.id]); //Dummy element to wait for HTML fetch var dummy_tab_id = sprintf('tab-%s', process_template_tabid); var dummy_div_str = sprintf('<div id="%s"></div>', dummy_tab_id); var dummy_div = $(dummy_div_str); $('body').append(dummy_div); //Dummy element to wait for SLAVE tab to become free. var wait_dummy_tab_id = sprintf('wait-queue-tab-%s', process_template_tabid); var wait_dummy_div_str = sprintf('<div id="%s"></div>', wait_dummy_tab_id); var wait_dummy_div = $(wait_dummy_div_str); $('body').append(wait_dummy_div); $('#' + dummy_tab_id).on("page-is-loaded", function() { my_slave_tab.in_use = false; $('#' + dummy_tab_id).off("page-is-loaded"); process_template(domain, data, my_slave_tab); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function templateEngine () { }", "\"VElement[name=template]:exit\"(node) {\n const result = builder.build();\n const json = JSON.stringify(result);\n context.report({ node: node, message: json });\n builder.reset();\n }", "function templatePage(req, res, template, block, next) {\n\n // ...
[ "0.6270733", "0.6256593", "0.6012496", "0.5819999", "0.58072686", "0.5780257", "0.5702037", "0.5698193", "0.56741583", "0.5664723", "0.5664723", "0.56235194", "0.5623119", "0.559801", "0.5552621", "0.5542879", "0.55408096", "0.554058", "0.551069", "0.5506277", "0.55061495", ...
0.0
-1
This is older code when FPI fetching occurred everytime form server. This code has been replaced now as FPIs are stored along with extension.
function fetch_fpi_template_from_server(domain) { wr = {}; wr.command = 'get_template'; wr.domain = domain; try { $.post("http://appu.gtnoise.net:5005/get_template", JSON.stringify(wr), function(data) { pii_vault.aggregate_data.per_site_pi[domain].attempted_download_time = new Date(); flush_selective_entries("aggregate_data", ["per_site_pi"]); if (data.toString() != 'No template present') { console.log("APPU DEBUG: Got the template for: " + domain); // We are here that means template is present. // Attempt to fetch the PI if user has already approved it. if ('user_approved' in pii_vault.aggregate_data.per_site_pi[domain]) { if (pii_vault.aggregate_data.per_site_pi[domain].user_approved == 'always') { //We are here, that means user has given PI download approval for this site start_pi_download_process(domain, data); return; } else if (pii_vault.aggregate_data.per_site_pi[domain].user_approved == 'never') { console.log("APPU DEBUG: User has already set NEVER for PI on this domain: " + domain); return; } } //We are here, that means that we have to seek permission from user to download PI for //this site. chrome.tabs.sendMessage(sender_tab_id, { 'type' : "get-permission-to-fetch-pi", 'site' : domain, }, function(response) { if (response.fetch_pi_permission == "always") { pii_vault.aggregate_data.per_site_pi[domain].user_approved = 'always'; flush_selective_entries("aggregate_data", ["per_site_pi"]); start_pi_download_process(domain, data); } else if (response.fetch_pi_permission == "just-this-time") { pii_vault.aggregate_data.per_site_pi[domain].user_approved = 'seek-permission'; flush_selective_entries("aggregate_data", ["per_site_pi"]); start_pi_download_process(domain, data); } else if (response.fetch_pi_permission == "never") { pii_vault.aggregate_data.per_site_pi[domain].user_approved = 'never'; flush_selective_entries("aggregate_data", ["per_site_pi"]); console.log("APPU DEBUG: User set NEVER for PI on this domain: " + domain); } }); } else { print_appu_error("Appu Error: FPI Template for domain(" + domain + ") is not present on the server"); } }) .error(function(domain) { return function(data, status) { print_appu_error("Appu Error: Service down, attempted to fetch template: " + domain + ", " + status.toString() + " @ " + (new Date())); console.log("APPU DEBUG: Service down, attempted to fetch:" + domain); } } (domain)); } catch (e) { console.log("Error: while fetching template(" + domain + ") from server"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fxifClass()\r\n{\r\n const SOI_MARKER = 0xFFD8; // start of image\r\n const SOS_MARKER = 0xFFDA; // start of stream\r\n const EOI_MARKER = 0xFFD9; // end of image\r\n const APP1_MARKER = 0xFFE1; // start of binary EXIF data\r\n const APP13_MARKER = 0xFFED; // start of IPTC-NAA data\r\n const COM_...
[ "0.60156757", "0.5778784", "0.56302863", "0.54533035", "0.5324817", "0.5307998", "0.5301271", "0.5290196", "0.51995033", "0.5189064", "0.51858383", "0.5173228", "0.50666016", "0.5066317", "0.50652534", "0.50480527", "0.50440097", "0.5043728", "0.5040398", "0.5029752", "0.5022...
0.51274467
12