query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
updates the display value & makes sure it won't overrun display | function updateDisplay(value) {
string = value.toString();
if (string.length > 11) {
displayValue = value.toPrecision(11);
}
document.getElementById("output").innerHTML = displayValue;
return;
} | [
"function updateDisplay() {\n\n var memLength = document.getElementById(\"memory-stack-display\").childElementCount;\n\n document.getElementById(\"display\").innerHTML = display;\n document.getElementById(\"calculations\").innerHTML = calculations.toString().replace(/,/g, \" \");\n\n document.getElement... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======================================================= Init answer ======================================================= | function initAnswer()
{
if (!layout.ansInput)
return;
drawList.setParam('answerInput', 'type', layout.qType);
if (layout.qType === 'multi')
drawList.setParam('answerInput', 'text', problem.get('a'));
else if (layout.qType === 'radio' || layout.qType === 'check')
drawList.setParam('answerInput', 'cho... | [
"function _init() {\n var self = this;\n\n console.log('Hello from Solve Quiz Controller');\n console.log(quiz);\n\n self.questionTemplate = '/Content/templates/solve-question-template.html';\n self.quiz = quiz;\n self.questionsCount = quiz.Questions.length;\n self.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recieve event from DOM and pass it to match handler | function sendEvent(event) {
const element = event.target;
// If event was generated from any of the event buttons
if (element.hasAttribute("data-event")) {
match.handleEvent(element.getAttribute("data-event")); // send event to match handler
}
} | [
"handleEvent(event) {\n const info = privates.get(this);\n\n // clear any waiting timer\n if (info.timer) {\n clearTimeout(info.timer);\n info.timer = 0;\n }\n\n // then analyze the action\n switch (event.type) {\n case 'press':\n this.onButtonPress(event);\n break;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subscribe/unsubscribe to global Pugs observer | function doSubscribeToGlobalPugs( isUnsubscribe ) {
if ( isUnsubscribe && pugsSubscriber ) {
pugsSubscriber.dispose();
}
else if ( !isUnsubscribe ) {
pugsSubscriber = Global.pugs.subscribe( doUpdatePugs, self );
}
} | [
"dispose() {\n const iterator = this.observers;\n while (iterator.length) {\n iterator.shift().unsubscribe();\n }\n }",
"function subscribeTo(p) {\n publisher = p;\n p.addGlube(that);\n }",
"clearSubscriptions() {\n this.events.clear();\n }",
"_destroyObservers() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns/instantiates a styling context from/to a `tNode` instance. | function getContext(tNode, isClassBased) {
var context = isClassBased ? tNode.classes : tNode.styles;
if (!isStylingContext(context)) {
context = allocTStylingContext(context);
if (ngDevMode) {
attachStylingDebugObject(context);
}
if (isClassBased) {
tNode... | [
"adapt_style(elem){\n var elem_type = 'node';\n if(elem.isEdge()){\n elem_type = 'edge';\n }\n var elem_style = this.STYLE[elem_type][elem._private.data.type];\n elem.style(elem_style);\n return elem_style;\n }",
"function getCytoscapeStyle() {\r\n var styleObj = [\r\n {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an inverted number | function invertNum(num)
{
return num *= -1;
} | [
"function invers(numar) {\n let inv = 0;\n let nr = numar;\n let rest = 0;\n while (nr != 0) {\n rest = nr % 10;\n inv = inv * 10 + rest;\n nr = (nr - rest) / 10;\n }\n return inv;\n}",
"function reverseNumber(n) {\n let num = parseFloat(n.toString().split('').reverse().join(''))\n //multiply the r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Order life cycle Received > open/matched/change > done | function updateOrderLifeCycle(orderId, data) {
logToFile('Going to update order life cycle');
logToFile(data);
// Check the order is relavent to us or not
STATE.CURRENT[orderId].histories.push(data);
logToFile('update order life cycle STATE.CURRENT');
logToFile(STATE.CURRENT);
switch (data.type) {
ca... | [
"triggerOrder(order) {\n if (!(order instanceof ExchangeOrder)) {\n throw 'Invalid order given'\n }\n\n // dont overwrite state closed order\n if (order.id in this.orders && ['done', 'canceled'].includes(this.orders[order.id].status)) {\n return\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
key configuration n stuff | function KeyConfig(config_name, left, right, down, fall, spin_right, spin_left, flip)
{
this.config_name = config_name;
this.left = left;
this.right = right;
this.down = down;
this.fall = fall;
this.spin_right = spin_right;
this.spin_left = spin_left;
this.flip = flip;
} | [
"function on_change_key_config()\n{\n\tkey_config = key_config_presets[key_config_menu.selectedIndex];\n}",
"set surround_key(string){ \n this.key_prefix = string\n this.key_suffix = string\n }",
"function renderKeyPair(div, piece, index, config, onDone) {\n\t\t\tif (isCancelled) return;\n\t\t\t\n\t\t\tv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends trip sections to subscribers; avoid handling message event which is sent by the component itself | sendUpdateTripSectionsEvent(event, self) {
if (event != null && event.data != null && event.data.sections != null) {
self.log.info(JSON.stringify(event.data, null, 4));
let msg = self.broker.createMessage();
self.log.info("Message was created.");
... | [
"onAddTetheredClient(tetheredClient) {\n super.onAddTetheredClient(tetheredClient);\n\n const client = tetheredClient.client;\n const myClient = tetheredClient.myClient;\n const incomingData = tetheredClient.incomingData;\n console.log(\"SharedRoom\", \"onAddMyClient\");\n }",
"function subscrib... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accelerate `body` towards `point`, stopping at the point if `point` is within `body` and `body` is going sufficiently slowly. | function setForceTowards(body, point, mag) {
const rawForceVec = {
x: point.x - body.position.x,
y: point.y - body.position.y,
};
let unitForceVec = Vector.normalise(rawForceVec);
if (Bounds.contains(body.bounds, point)) {
if (body.speed > AVATAR_STOP_SPEED) {
unitF... | [
"function biasedPoint(point, normal, bias) {\n return vec3.add(vec3.create(), point, vec3.scale(vec3.create(), normal, bias));\n}",
"bounce(other){\n\t\t// still has weird bumping behavior when particles are cooled a lot\n\n\t\tlet a_i_speed = new Vector2D(this.x_speed, this.y_speed); // first particle\n\t\tlet ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs the notifiedSpan ID for the item number. | function getNotifiedSpanID(itemNumber) {
return 'notifiedSpan-' + itemNumber;
} | [
"function getWatchedSpanID(itemNumber) {\n\treturn 'watchedSpan-' + itemNumber;\n}",
"function getWatchedSpanElement(itemNumer) {\n\treturn document.getElementById(getWatchedSpanID(itemNumer));\n}",
"function createNotifiedCol(item) {\n\treturn '<td align=\"center\"><span id=\"' + getNotifiedSpanID(item.itemNum... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
void AliasComponent (string, string, string, string, string) | AliasComponent(string, string, string, string, string) {
} | [
"ImportComponent(string, string) {\n\n }",
"InstallComponent(string, string, string, string) {\n\n }",
"function Alias(props) {\n return __assign({ Type: 'AWS::GameLift::Alias' }, props);\n }",
"function alias(newName, oldPlugin) {\n const { name } = oldPlugin, plugin = __rest(oldPl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that checks whether a given tNode matches tagbased selector and has a valid type. Matching can be perfomed in 2 modes: projection mode (when we project nodes) and regular directive matching mode. In "projection" mode, we do not need to check types, so if tag name matches selector, we declare a match. In "direc... | function hasTagAndTypeMatch(tNode, currentSelector, isProjectionMode) {
return currentSelector === tNode.tagName &&
(isProjectionMode ||
(tNode.type === 3 /* Element */ || tNode.type === 4 /* ElementContainer */) ||
(tNode.type === 0 /* Container */ && currentSelector === NG_TEMPLATE... | [
"matches (selector) {\r\n const el = this.node;\r\n return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector)\r\n }",
"function isValidMatch(cmd, node){\n const { classType, classNames, identifier } = cm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function takes data with 422 error and builds | function build422(data) {
var name = data.message.replace("Channel '", "").replace("' is unavailable", "").capitalize();
var icon = "<div class='status-icon text-right'><i class='fa fa-times-circle fa-lg'> Error</i></div>";
var message = "<p>Account Closed</p>";
var mainLi = "<li class='error text-left ... | [
"function buildError(code,message){\n return {\n \"status\" : \"error\",\n \"error\" : {\n \"code\" : code,\n \"message\" : message\n }\n };\n }",
"constructor() { \n \n InlineResponse422.initialize(this);\n }",
"handleErrors(templateFunction, dataCb){\r\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
string to the array 25 times. Add a specific statement when i=1 and another on all other iterations | function forLoop(array) {
for (let i = 0; i < 25; i++) {
if (i === 1) {
array.push("I am " + i + " strange loop.");
}
else {
array.push("I am ${i} strange loops.");
}
}
return array;
} | [
"function addLetters(n) {\n for (i = 0; i <= 5; i++) {\n newArray.push(n);\n }\n}",
"function index5() {\n var arr = [],\n i,\n n = 20;\n for (i = 0; i < n; i += 1) {\n arr[i] = i * 5;\n }\n document.getElementById('result').innerHTML = ' ' + arr;\n}",
"function repeat(phra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns a dialog that is used to display tutorials about specific parts of the system. | function generalTutorialDialog(name, title, message, width, height) {
var dialogOptions,
dialog;
// check if the dialog has already been created
if (dialog = checkDialogManager(name)) {
return dialog;
}
dialogOptions = new GeoJQueryUiWrappers.DialogOptio... | [
"function displayHelp() {\n\tlet helpText = require('../html/help.html.js');\n\tcreateDialog('show-dialog', 'Help', helpText['helpDialog'], undefined, true);\n}",
"function Dialog() {}",
"function elsaDialog() {\n scenarioDialog(3, \"Maybe I should give them a break…\", elsaChoice);\n}",
"_getYesNoDialog(yes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In flat view with pagination, traverses the DOM to determine which of the Correct or Helpful answers are on this page. For replies on this page, the inline answer link will be displayed as "ID" to prevent page reloading. For replies not on this page, the inline answer link will be displayed as full message URL. | function processMessageLinksForFlatView(question) {
if (question.correctAnswer && !messageOnPage(question.correctAnswer.ID)) {
question.correctAnswer.useFullURL = true;
}
question.helpfulAnswers && question.helpfulAnswers.some(
function(answer) {
... | [
"function user_related_question_view(ref_id){\n var reply_type = \"json\";\n var vars = {};\n if (ref_id == '' || ref_id == undefined){\n vars.url = myhost+'/view/user_question_all/';\n vars.content = \"question\";\n } else {\n vars.url = myhost+'/view/user_question_replys/';\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This class defines a complete listener for a parse tree produced by ParseStoryParser. | function ParseStoryListener() {
antlr4.tree.ParseTreeListener.call(this);
return this;
} | [
"function YalcilListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}",
"function VoyagerListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}",
"function JavaScriptBaseParserListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
4.0 Generate potfiles for WordPress localization | function translation() {
return gulp
.src(theme.php.src)
.pipe(wpPot({
domain: 'wpg_theme',
package: 'Powiat Bartoszycki',
bugReport: 'http:/powiatbartoszyce.pl'
}))
.pipe(gulp.dest(theme.lang.dist + 'powiat-bartoszycki.pot'))
} | [
"function convert(data) {\n var pot = '';\n function append(s) { pot += s + '\\n'; }\n \n //Metadata\n append('msgid \"\"');\n append('msgstr \"\"');\n append('\"Language: en\\\\n\"');\n append('\"Content-Type: text/plain; charset=UTF-8\\\\n\"');\n append('\"Content-Transfer-Encoding: 8bit\\\\n\"');\n app... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new Gist | function _createGist(fromSelection) {
if (currentRepo && currentRepo.user) {
var currentDoc = DocumentManager.getCurrentDocument(),
currentEditor = EditorManager.getActiveEditor(),
selection = currentEditor ? currentEditor.getSelectedText() : '',
... | [
"function GistCreateGist() {\n // Retrieve Parameters and close overlay\n var name = $(\"div#overlay-body input.gist-name\").val().trim();\n var public = $(\"div#overlay-body input.gist-public\").prop('checked');\n CloseOverlay();\n if (name.length == 0) {\n Logger.error(\"Please enter a valid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
command: docit open test (uses alias) | function open(alias) {
// if opened after init, it should just set the config object directly
internals.assertNoCurrentWorkingAlias();
const folderpath = path.join(internals.DOCIT_PATH, alias);
if (!fse.pathExistsSync(folderpath)) {
// printUtils.error(
// `Docit: no project with the alias ${alias} e... | [
"function buildDoc(cb) {\n spawn.sync(\"jsdoc\", [\"-r\", \"-c\", \"./.jsdoc.json\", \"-d\", \"./docs\", \"./src\"]);\n cb();\n}",
"function printCommandReference() {\n var spathToDocumentation = process.argv[1].split(PATH.sep),\n scommands = '',\n i;\n\n spathToDocumentation... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`remove` removes a stream of quads from the store | remove(stream) {
stream.on('data', quad => { this.removeQuad(quad); });
return stream;
} | [
"removeEntry(t) {\n const e = this.docs.get(t);\n e && (this.docs = this.docs.remove(t), this.size -= e.size);\n }",
"remove(element) {\n this.set.splice(this.set.indexOf(element), 1);\n console.log(\"element removed successfully\");\n }",
"async function remove() {\n const x = await ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine if a transfer (e.g. draganddrop) is a file transfer | function isFileTransfer(transfer) {
return transfer.files.length > 0;
} | [
"dataTransferCheck () {\n try {\n new DataTransfer() // eslint-disable-line\n this.supportsDataTransfers = true\n } catch (err) {\n this.supportsDataTransfers = false\n }\n }",
"function get_file_type($file_chooser) { // param must be jQuery object\n\t\t\t\tfunction search_file_type(type)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log(addLettersToSetHelper('a', 3, new Set([''])).toArray()); console.log(addLettersToSetHelper('b', 2, new Set(['a', 'aa', 'aaa'])).toArray()); returns a new set with letters added doesNot modify inputSet | function addLettersToSet(letters, set) {
var setToRet = new Set();
set.forEach(function(key) {
setToRet.add(key + letters);
});
return setToRet;
} | [
"function addLettersToSetHelper(letter, frequency, currSet) {\n\tvar letToAppend = '';\n\t\n\tvar retSet = new Set();\n\t\n\tfor (var j = 0; j < frequency; j++) {\n\t\tvar tempSet = currSet.clone();\n\t\tletToAppend += letter;\n\t\tvar setToAdd = addLettersToSet(letToAppend, tempSet);\n\t\tretSet.addEach(setToAdd);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUBLIC METHODS For adding callbacks to left mouse button | onLeftDown (callback) {
this._addDownEvent(this._buttonNames.left, callback)
} | [
"isLeftClicking() {\r\n return this.activeClick === LEFT_CLICK_ID;\r\n }",
"implementMouseInteractions() {\t\t\n\t\t// mouse click interactions\n\t\tthis.ctx.canvas.addEventListener(\"click\", this.towerStoreClick, false);\n\t\t\n\t\t// mouse move interactions\n\t\tthis.ctx.canvas.addEventListener(\"mousemove... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets JSON spec from a given host and path (url) | function getSpec(host, path) {
console.log('Calling ', `${host}${path}`);
const options = {
host: host.match(/[http|https]:\/\/(.+)/)[1],
path: path,
};
return new Promise((resolve, reject) => {
const request = http.get(options, response => {
let body = '';
response.on('data', chunk => ... | [
"function JsonResourceProvider(path, host) {\n this.path = path;\n this.host = host;\n}",
"function getSwagger() {\n\n // if specs is embedded in the document, use them\n if (angular.isObject(window.swaggerDocsSpecs)) {\n assignSwaggerSpecs(window.swaggerDocsSpecs);\n return;\n }\n\n // ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs the actual pitch scaling | function scalePitch(out, x, nx, period, scale, shift, w) {
var no = out.length
for(var i=0; i<no; ++i) {
var t = i * scale + shift
var ti = Math.floor(t)|0
var tf = t - ti
var x1 = x[ti%nx]
var x2 = x[(ti+1)%nx]
var v = (1.0 - tf) * x1 + tf * x2
out[i] = w[i] * v
}
} | [
"function scalePlayer(unit, scale, direction, tempo) {\n\n\n// overwrite players interval variables with toneIndex values for scale type\n\n// if statement for reversing intervalic direction\n\n if (direction === \"up\"){\n\n first = unit[0];\n second = unit[1];\n third = unit[2];\n f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add 0 to val in dependance of Len | function str0l(val, len) {
let strVal = val.toString();
while (strVal.length < len)
strVal = '0' + strVal;
return strVal;
} | [
"function zeroPad(val, width) {\n width = width || 2;\n while (String(val).length < 2) {\n val = '0' + String(val);\n }\n return val;\n }",
"function addZerosRight(number) {\n return number.padEnd(8, \"0\");\n}",
"function addPrefixZero(num){\n if(num<10){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
filter, sort, page this is the main function for client side selection /////////////////// pager function | function FilterSortPage(tableName, filters, sorts, pageNum, pageSize) {
/// This function must be called after each change on the _Index page.
/// Changes : filter selection, sort selection, page click, edit, insert, delete.
SpinnerShow();
var sURL = "/" + tableName + "/List";
if (pageNum === n... | [
"function pagerFilter(data){\n if (typeof data.length == 'number' && typeof data.splice == 'function'){\t// is array\n data = {\n total: data.length,\n rows: data\n }\n }\n var dg = $(this);\n var opts = dg.datagrid('options');\n var pager = dg.datagrid('getPager')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to fetch survey details and question types on initial load | function getSurveyList(){
sfactory.serviceCall({}, surveyServices.surveyList,surveyServices.type).then(function(response) {
if(angular.isDefined(response)){
$scope.surveyData = response.data;
$scope.questionType =_.pluck(response.data.questionstypes, "type"... | [
"function fetchQuestions() {\n server.get('dailyQuestions')\n .then((response) => {\n setQuestions(response.data.questions);\n });\n }",
"function getSurveyList(){\n var categorySectionIndex = 0;\n sfactory.serviceCall(dataRequest,tasks.getSurveyList,'listDetails').then(function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to suggest a project, if succcessful, the student will be redirected to the student profile | function suggestProject(name,dateStart,dateEnd,description,additional){
if (additional !=="" ){
var array = additional.split(',');
}
var send = {ProjectName: name, Technologies: Tecnologias, EndDate:dateEnd, StartDate:dateStart, Description: description,
... | [
"function commitProject(id) {\n var systemCode = window.prompt(\"中連協受付番号を入力\", \"\");\n if(systemCode) {\n location.href = \"/update_status?id=\" + id + \"&status=committed&system_code=\" + systemCode;\n }\n}",
"function displayProject(index) {\r\n localStorage.setItem(\"aProjectIndex\", index);\r\n w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search for matching armor records of the currently selected type. Then fill the results box with recods. | async search() {
if (this.#selected !== "") {
this.#name.value = this.#name.value.trim();
const query = {
type: this.#selected,
};
if (this.#rarity.value !== "") {
query.rarity = this.#rarity.value;
}
let result = await DataBase.search("armor", query, {
... | [
"function updateResultsTable(object, type) {\r\n\t\r\n\t/* First delete the old results table contents */\r\n\t\r\n\tif (document.getElementById(\"results\").rows.length > 1) {\r\n\t\t//Delete the table rows in reverse order to avoid missing rows\r\n\t\tfor (i = (document.getElementById(\"results\").rows.length) - ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display diagnostic message in document frame | function rtwDisplayMessage() {
var docObj = top.rtwreport_document_frame.document;
var msg = docObj.getElementById(RTW_TraceArgs.instance.fMessage);
if (!msg) {
msg = docObj.getElementById("rtwMsg_notTraceable");
}
if (msg && msg.style) {
msg.style.display = "block"; // make message visible
var ms... | [
"function displayHelpMsg(msg) {\n\tExt.getCmp('helpIframe').el.update(msg);\n}",
"function showImpactAssessmentWarningDialogue() {\n showDialog({\n title: 'WARNING: Inconsistent data',\n text: 'Elements on this page need correcting: \\nRows of risk weights should NOT EXCEED 100 for each area\\nPr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ USB / returnJSON structure contains a usbJSON structure | function getUSBInfo(serialNumber,callback){
jQuery.getJSON( 'APIS/returnUsbJSON.txt',
function(returnData, status){
if(returnData.RETURN.success){
callback(returnData.RETURN.success,returnData.USB);
}else{
callback(returnData.RETURN.success,returnData.RETURN.errorDescription);
}
}
... | [
"function listVendorTemplate(bundle) {\n const sender_password = bundle.authData.sender_password;\n const sender_id = bundle.authData.sender_id;\n const temp_session_ID = bundle.authData.temp_session_ID;\n const timestamp = Date.now();\n\n var jsonObj = {\n request: {\n control: {\n senderid: se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The AWS::SNS::Topic type creates an Amazon Simple Notification Service (Amazon SNS) topic. Documentation: | function Topic(props) {
return __assign({ Type: 'AWS::SNS::Topic' }, props);
} | [
"function TopicPolicy(props) {\n return __assign({ Type: 'AWS::SNS::TopicPolicy' }, props);\n }",
"function TopicRule(props) {\n return __assign({ Type: 'AWS::IoT::TopicRule' }, props);\n }",
"set topic(aValue) {\n this._logService.debug(\"gsDiggEvent.topic[set]\");\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initiate the variable name that hold the value of the current field | initiateVariableName() {
this.variableName = this.variableName || `val_${this.compiler.referenceVariableCounter++}`;
} | [
"function createVariable() {\n\t var id = nextVariableId++;\n\t var name = '$V';\n\t\n\t do {\n\t name += variableTokens[id % variableTokensLength];\n\t id = ~~(id / variableTokensLength);\n\t } while (id !== 0);\n\t\n\t return name;\n\t}",
"function createVar(varName,value) {\n va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return a node offset point | function getNodeOffset(node) {
var offset = new Point();
node = getNode(node);
if (node && node.nodeType === 1) {
offset.x = node.offsetLeft;
offset.y = node.offsetTop;
}
return offset;
} | [
"get tileOffset() {}",
"blockOffset(node, offset) {\n if (node.nodeType === Node.ELEMENT_NODE && offset === 0) { return offset; }\n\n const nodes = this.textNodes();\n\n let total = 0;\n for (let i = 0, j = nodes.length; i < j; i++) {\n if (nodes[i] === node) {\n total += offset;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The onTriggerEnter function activates the turnOff function if the player collides with the item while it is on, and also adds ammo to the player's inventory equal to the amount variable | function OnTriggerEnter (collided : Collider) {
if (collided.gameObject.name == 'player' && on == true) {
sound.Play();
collided.gameObject.GetComponentInChildren(GunBehavior).ammo += amount;
turnOff();
}
} | [
"function onPlayerInteract(e) {\n var player = e.getPlayer();\n var item = player.getItemInHand();\n if (e.getAction() == Action.LEFT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_AIR) {\n if (item.getType() == Material.BLAZE_ROD) {\n log.info(\"Player left clicked with blaze rod.\");... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply the disapproval information to a pull request row | function doDisapproval (row) {
// Add a disapproval cell first
// We make it invisible because we don't actually know yet if we are enabled
if (row.find("td.disapproval").size() === 0) {
row.find("td.reviewers").before($("<td class=\"disapproval\"></td>").attr("style","display:none;"))
} else {
... | [
"applyDisapproval () {\n this.update({\n 'data.class.disapproval': this.data.data.class.disapproval + 1\n })\n }",
"function sendApprovalResults(row, approval) {\n \n var approvedOrRejected = (approval.approveExpenseReport == \"Yes\") ? \"approved\" : \"rejected\";\n \n var mailsubject = \"mailto:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
because of the way the network is created, nodes are created first, and links second, so the lines were on top of the nodes, this just reorders the DOM to put the svg:g on top | function keepNodesOnTop() {
$(".nodeStrokeClass").each(function( index ) {
var gnode = this.parentNode;
gnode.parentNode.appendChild(gnode);
});
} | [
"function keepNodesOnTop() {\n $(\".nodeStrokeClass\").each(function( index ) {\n var gnode = this.parentNode;\n gnode.parentNode.appendChild(gnode);\n });\n }",
"function updateNetwork() {\n if (d3.event) {\n d3.event.stopPropagation();\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accessor/Mutator for tool controller | get tools() { return this.m_tools; } | [
"get toolVersion() {\n return '0.2.0'\n }",
"function getActiveTool() {\n\t\t\treturn getToolByName($toolbox.find('.active').data('tool'));\n\t\t}",
"function switchTool(event){\n var toolToEquip = event.target.getAttribute(\"data-tooltype\");\n workspace.activeTool = toolToEquip;\n}",
"get controller()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a pair [startIndex, lastIndex] such that the range of indices [startIndex, lastIndex) in this HighlightedBlock contains all differences between this block and the blockToCompare. Returns null if there are no differences. | changedRange(blockToCompare) {
let startIndex = 0;
let differencesFound = false;
while (startIndex < this.tokens.length &&
startIndex < blockToCompare.tokens.length) {
if (!this.tokens[startIndex].contentEquals(
blockToCompare.tokens[startIndex])) {
differencesFound = tru... | [
"function calcDiff(oldText,newText) {\n let i=0;j=0;\n while(newText[i] == oldText[i] && i < newText.length) i++\n const common = oldText.slice(0,i)\n oldText = oldText.slice(i); newText = newText.slice(i);\n while(newText[newText.length-j] == oldText[oldText.length-j] && j < newText.length) j++\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pad a string to be even | function padToEven(a){return a.length%2?"0"+a:a;} | [
"function padEnd(str,num, pad){\n if (num < str.length) return str;\n if (str.length < num){\n if (arguments.length === 3){\n let diff = Math.ceil((num-str.length)/pad.length);\n for (let i = 0; i < diff; i++){\n str += pad;\n }\n }\n else if ( arguments.length === 2) {\n let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Track the position of mouse cursor | function trackPosition(e) {
mouse.x = e.pageX;
mouse.y = e.pageY;
} | [
"startTrackingMouse() {\n if (!this._pointerWatch) {\n let interval = 1000 / Clutter.get_default_frame_rate();\n this._pointerWatch = PointerWatcher.getPointerWatcher().addWatch(interval, this.scrollToMousePos.bind(this));\n }\n }",
"function save_mouse_position() {\n mou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that calculates how many candles are translated from d3.event.transform object Positive value means left shift Negative value means right shift | calcNoCandlesTranslated(transform) {
var noTransCandles = Math.floor((this.noCandles/this.w) * transform.x);
this.dataPointer -= noTransCandles - this.noPrevTransCandles;
this.noPrevTransCandles = noTransCandles;
} | [
"function count_moveend_event(mIDX, e) {\r\n\tvar moveendEvents = app[mIDX].map._events[\"moveend\"];\r\n\tif (e) moveendEvents = e.target._events[\"moveend\"];\r\n\tif (!moveendEvents) return 0;\r\n\tvar count = 0;\r\n\t$.each(moveendEvents, function(idx, row) {\r\n\t\tvar ctx = row['ctx'];\r\n\t\t//console.log(ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a Google Maps event listener for the given InfoWindow as an Observable | createEventObservable(eventName, infoWindow) {
return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"](observer => {
this._infoWindows.get(infoWindow).then(i => {
i.addListener(eventName, e => this._zone.run(() => observer.next(e)));
});
});
} | [
"createEventObservable(eventName, layer) {\n return new rxjs__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"](observer => {\n this._layers.get(layer).then(m => {\n m.addListener(eventName, e => this._zone.run(() => observer.next(e)));\n });\n });\n }",
"createEventObser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the food object closest to this bug object. Return 0 if there is no food. | function getClosestFood(){
if (foodList.length == 0){
return 0;
} else {
var curClosest = -1;
var curDistance = -1;
for (var i = 0; i < foodList.length; i++){
var curFood = foodList[i];
var distance = Math.sqrt(Math.pow(curFood.xLoc - this.xLoc, 2) + Math.... | [
"getClosestPuck()\n {\n if (pucks.length < 1)\n return null;\n var closestPuck = pucks[0];\n for (var i = 0; i < pucks.length; i++)\n if (closestPuck.pos.x < pucks[i].pos.x)\n closestPuck = pucks[i];\n \n return closestPuck;\n }",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles a single hand | function HandleHand(hand, numHand, InteractionBox) {
//Grabs fingers
var fingers = hand.fingers;
//Draws all five finger bones(1-4) at a time
//Distal phalanges are bones.type = 3
var l = 3;
//We know there are 4 bones in each finger
for (var j=0; j<4; j++){
//All five bones of a type at a time
for(var k=0... | [
"function userHand() {\n\n}",
"function HandleFrame(frame) {\t\n\tvar InteractionBox = frame.interactionBox;\n\t//No hand - variables undefine\n\tif(frame.hands.length == 1 || frame.hands.length == 2){\n\t\t//Grabs 1st hand per frame\n\t\tvar hand = frame.hands[0];\n\t\tHandleHand(hand,1,InteractionBox);\n\t\tif(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write `className` to `RElement`. This function does direct write without any reconciliation. Used for writing initial values, so that static styling values do not pull in the style parser. | function writeDirectClass(renderer, element, newValue) {
ngDevMode && assertString(newValue, '\'newValue\' should be a string');
if (isProceduralRenderer(renderer)) {
if (newValue === '') {
// There are tests in `google3` which expect `element.getAttribute('class')` to be `null`.
... | [
"function addClass(elem, className)\n {\n if (elem.getAttribute(\"class\") == null)\n {\n elem.setAttribute(\"class\", \"\");\n }\n \n // Add only if not already in class attribute\n if (elem.getAttribute(\"class\").search(className) == -1)\n {\n // If not empty, then append a space to separat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display the status of the current word to guess | function displayCurrentWord(){
/** Change the html to the current word status */
document.querySelector("#correctorGuess").innerHTML = currentWordArray.join(" ");
} | [
"function printHint() {\n $('#hint').text(current_word.hint);\n}",
"function showHint() {\n clueToGuess = clue[Math.floor(Math.random() * clue.length)];\n for (var i = 0; i < clue; i++) {\n if (correctGuess === wordToGuess) {\n clue++;\n }\n clueToGuess.push(\" \");\n }\n document.getElementById... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the user removes Restrict labels, ask them if they are sure. | function TKR_checkUnrestrict(prevent_restriction_removal) {
var removedRestrictions = [];
for (var i = 0; i < TKR_allOrigLabels.length; ++i) {
var origLabel = TKR_allOrigLabels[i];
if (origLabel.indexOf('Restrict-') == 0) {
var found = false;
var j = 0;
while ($('label' + j)) {
va... | [
"function TKR_updateConfirmBeforeSubmit() {\n var severity = TKR_restrict_to_known ? 'Error' : 'Note';\n var novelWord = TKR_restrict_to_known ? 'undefined' : 'uncommon';\n var msg = '';\n var labels = TKR_novelLabels.map(function(item) {\n return item.value;\n });\n if (TKR_novelStatuses.length > 0 && TKR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test intersection between two primitives | function intersect_primitive_primitive (buffer1, buffer2) {
for (var i = 0; i < buffer1.length; i += 3)
{
for (var j = 0; j < buffer2.length; j += 3)
{
if ( intersect_triangle_triangle(buffer1[i], buffer1[i+1], buffer1[i+2], buffer2[j], buffer2[j+1], buffer2[j+2]) )
return true;
}
}
return false;
} | [
"function intersection(pos1, vec1, pos2, vec2){\n //This function is based on this math:\n //https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect\n // pos1 == p\n // vec1 == r\n // pos2 == q\n // vec2 == s\n\n let denom = crossProduct(vec1, vec2); //(r × s)\n let nu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a codepoint, return the name of the script or script family it is from, or null if it is not part of a known block | function scriptFromCodepoint(codepoint) {
for (var i = 0; i < scriptData.length; i++) {
var script = scriptData[i];
for (var _i = 0; _i < script.blocks.length; _i++) {
var block = script.blocks[_i];
if (codepoint >= block[0] && codepoint <= block[1]) {
return script.name;
}
}
... | [
"function lookupThisFileCaller() {\n return callerLookup(__filename);\n}",
"function NLGetCurrentScriptFileHostName()\n{\n var scripts = document.getElementsByTagName('script');\n if (!scripts || scripts.length == 0)\n return null;\n\n var currentScriptFileUrl = scripts[scripts.length - 1].src;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whatever is returned from this function (in the first argument of bindActionCreators) will show up as props on the Board container | function mapDispatchToProps(dispatch) {
// whenever the action is called, bindActionCreators will pass the result to all of our reducers
return bindActionCreators({
generateBoard,
placeBombs,
setRemainingTiles,
markTile,
revealBombs,
}, dispatch);
} | [
"function mapActionCreatorsToProps(dispatch) {\n return bindActionCreators({}, dispatch)\n}",
"function mapDispatchToProps(dispatch){\n//action creator binds it with action Fetch Weather! \n return bindActionCreators({ fetchWeather} , dispatch)\n}",
"function mapActionCreatorsToProps(dispatch) {\n return b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add user to the OU it's in by DFS | function addUserToOUByPath(node, path, user){
if(node.data['path'] === path){
node.data['users'].push(user);
return;
}
else{
if(node['children'] === undefined)
return;
var children = node['children'];
for(var ou of children){
if(path.includes(o... | [
"async function addOrgUnitsToData(ous){\n for(var eachOU of ous){\n var childElement = {\"name\": eachOU[\"name\"], \"path\": eachOU[\"orgUnitPath\"], \"parentPath\": eachOU[\"parentOrgUnitPath\"], \"users\": []};\n flatdata.push(childElement);\n }\n // add root OrgUnit to data\n for(var o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts a string representation of an integer to a boolean. Any integer value other than 0 will be true ex. "1", "99", "5.67" = true Zero or any nonnumeric characters will be false ex. "0", "asd" = false | static stringIntToBool(str) {
return !!+str;
} | [
"static toBoolean(value) {\n if (typeof value === \"boolean\")\n return value;\n if (typeof value === \"string\")\n return value === \"true\" || value === \"1\";\n if (typeof value === \"number\")\n return value > 0;\n return false;\n }",
"function i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adding favorites function first check gistID list then if enough storage locally will add to string or add just ID | function addToFavList(gistID)
{
if (!isInFavList(gistID))
{
//checking local storage of favorites
if (localStorage.getItem("favGists"))
{
var myFavorites = localStorage.getItem("favGists");
myFavorites = myFavorites+","+gistID;
if(!isInFavList(gistID))
{
localStorage.setItem("favGists", myFavori... | [
"function addToFavorites(event) {\n event.preventDefault()\n let favorites = JSON.parse(localStorage.getItem(\"favorites\"))\n let id = getId(this)\n if (favorites.indexOf(id) < 0) {\n favorites.push(id)\n }\n localStorage.setItem(\"favorites\", JSON.stringify(favorites))\n changeTextIfFavorite(this)\n a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the drill down token based on the portletId | function getDrillDownTokenParam(portletId)
{
if (ddt[portletId])
{
var type = ddt[portletId].type;
var value = ddt[portletId].value;
if (type == TOKEN_ACTIONAL_ID)
{
return '&ddt.li=' + value;
}
else if (type == TOKEN_NAME)
{
return '&ddt.name=' + value;
}
}
ret... | [
"function drilldown(portletId, tokenType, value)\r\n\t{\r\n\t\tddt[portletId] = {type: tokenType, value: value};\r\n\r\n\t\t\r\n\t\tif (window['onNewGather' + portletId])\r\n\t\t{\r\n\t\t\twindow['onNewGather' + portletId](true);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tvar param;\r\n\t\t\tif (tokenType == TOKEN_ACTI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given the existing set of registered players and the matches they have played, generates and returns a list of pairings according to the Swiss system. Each pairing is a tuple (id1, name1, id2, name2), giving the ID and name of the paired players. For instance, if there are eight registered players, this function should... | function getNextPair(playerStandings, tournament) {
var first = playerStandings.splice(0,1)[0];
for (var i=0; i<playerStandings.length; i++) {
if (!tournament.hasPlayed(first.id, playerStandings[i].id)) {
var second = playerStandings.splice(i,1)[0];
return [first, second];
}
}
//throw 'Swiss pairing algor... | [
"function playerIdsInMatches(matches) {\n const playerIdSet = new Set();\n let players = [];\n matches.forEach((match) => {\n match.teams.forEach((team) => {\n team.forEach((player) => {\n if (!playerIdSet.has(player.id)) {\n players.push(player.id);\n // players.push({ id: playe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ handler_ajax_update_user() / populate fields from xml data. / schema: / / alim / alim / karim | function handler_ajax_update_user(){
if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
create_xml_doc(xmlHttp.responseText);
var uname = document.getElementById('uname');
var fname = document.getElementById('fname');
var lname = document.getElementById('lname');
var email = document.getElementById('email... | [
"function ajax_update_user(){\n\tvar user_list = document.getElementById('user_list');\n\tvar uname = user_list.options[user_list.selectedIndex].innerHTML;\n\tvar uid = user_list.options[user_list.selectedIndex].id;\n\t// cleanup fields before repopulating\n\t// with new data\n\tcleanup();\n\tdocument.getElementByI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CHALLENGE Write a function named threeOdds that takes 2 numbers and returns true if there are 3 odd numbers _between_ those two numbers Example: If you pass 0,2 it should return false because the only number between 0 and 2 is 1 If you pass 0,6 it should return true because between 0 and six (the numbers 1,2,3,4,5) the... | function threeOdds(number1, number2) {
var count = 0;
for (i = number1 + 1; i < number2; i++) {
if (i % 2 !== 0) {
count++
}
}
if (count > 2) {
return true;
} else {
return false
}
} | [
"function isOdd(n) {if(!isNaN(n)){return n % 2 !== 0}}",
"function areBothOdd(num1, num2) {\n // your code here\n return ((num1 % 2) && (num2 % 2) !== 0) ? true : false;\n}",
"function evensAndOdds(arr) {\n var evens = 0;\n var odds = 0;\n\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function adds a Footer to the report | function addFooter(report, param) {
var date = new Date();
var d = Banana.Converter.toLocaleDateFormat(date);
report.getFooter().addClass("footer");
report.getFooter().addText(d + " - " + param.pageCounterText + " ");
report.getFooter().addFieldPageNr();
} | [
"function addFooter(report) {\n report.getFooter().addClass(\"footer\");\n var versionLine = report.getFooter().addText(param.bananaVersion + \", \" + param.scriptVersion + \", \", \"description\");\n //versionLine.excludeFromTest();\n report.getFooter().addText(\"Pagina \", \"description\");\n report.get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a given token to the token stack. In particular, this get be used to put back a token returned from one of the other methods. | pushToken(token: Token) {
this.stack.push(token);
} | [
"pushToken(token) {\n this.stack.push(token);\n }",
"addToken(token) {\n this.output.push(token);\n }",
"pushTokens(tokens) {\n this.stack.push(...tokens);\n }",
"future() {\n if (this.stack.length === 0) {\n this.pushToken(this.lexer.lex());\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: extGroup.addPartToGroups DESCRIPTION: This function adds the given part to all matching partGroups. It skips group which already contain a part of the same type, unless the participant is of part type "multiple". ARGUMENTS: groupName ext data group filename partGroupList list of lists of participants. element... | function extGroup_addPartToGroups(groupName, partGroupList, part, partList)
{
var retVal = false;
//see if we can add this part to any of the existing groups
for (var i=0; i < partGroupList.length; i++) {
var partGroup = partGroupList[i];
var groupHasPart = false;
if (extPart.getPartType(groupName,... | [
"function extGroup_canAddPartToGroup(groupName, partGroup, part, partList)\n{\n var result = null;\n\n //check if the user has defined a matching function\n if (result == null && window.canAddPartToGroup != null) {\n result = window.canAddPartToGroup(partGroup, part, partList);\n }\n\n //check if the parame... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a path, get the path to the previous sibling node. | previous(path) {
if (path.length === 0) {
throw new Error("Cannot get the previous path of a root path [".concat(path, "], because it has no previous index."));
}
var last = path[path.length - 1];
if (last <= 0) {
throw new Error("Cannot get the previous path of a first child p... | [
"prevSibling() {\n return this.sibling(-1)\n }",
"function previousElement(element)\r\n{\r\n\twhile (element = element.previousSibling)\r\n\t{\r\n\t\tif (element.nodeType == 1) return element;\r\n\t}\r\n\treturn null;\r\n}",
"previous() {\n let tmp = this.currentNode.previous();\n if (!tmp.don... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class UIColor Stores color information, including the type, antialias level, and specific color values in a color object of an appropriate type. | function UIColor(type, antialiasLevel, color)
{
this.type = type;
this.antialiasLevel = antialiasLevel;
this.color = color;
} | [
"function ColorType()\n{\t\t\t\t\n}",
"function serializeColor(col){\r\n if(col.typename == \"NoColor\"){\r\n return [\"N\", 0, 0, 0, 0];\r\n } else if(col.typename == \"GrayColor\"){\r\n return [\"G\", _f2s(col.gray / 100), 0, 0, 0];\r\n } else if(col.typename == \"RGBColor\"){\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
first clears the screen of any possible scenes, then loads accordingly and then begins the display at the first entry in the array | function main(){
stage.removeAllChildren();
scenes.push(page1Create());
scenes.push(page2Create());
scenes.push(page3Create());
scenes.push(page4Create());
sindex = 0;
stage.addChild(scenes[sindex]);
} | [
"function sceneCreator(sindex){\n stage.removeAllChildren();\n scenes.push(page1Create());\n scenes.push(page2Create());\n scenes.push(page3Create());\n scenes.push(page4Create());\n stage.addChild(scenes[sindex]);\n //init();\n //preload();\n}",
"function onScreenLoad(){\n\tstate = parent... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
void GetMultipleComponentsInfo (string, SAFEARRAY(Variant), SAFEARR... | GetMultipleComponentsInfo() {
} | [
"CopyComponents(string, Variant, string) {\n\n }",
"ImportUnconfiguredComponents(string, Variant, Variant) {\n\n }",
"MoveComponents(string, Variant, string) {\n\n }",
"getAllArgsToInterpolateSubmobject() {\n let mobjectHierarchies = [];\n for (let mobjectCopy of this.getCopiesForInterpolation(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================================================== Insert emoticon after cursor in editor ============================================================================== | function insertEmoticon(target, emoticon) {
const selectionStart = target.selectionStart;
const selectionEnd = target.selectionEnd;
const content = target.value;
target.value = content.slice(0, selectionStart) + emoticon + content.slice(selectionEnd);
delayed(function() {
setCaretPosition(selectionStart + emot... | [
"function insert(emoji) {\n let editor = N.MDEdit.__textarea__;\n\n // Find nearest ':' symbol before cursor on the current line\n editor.selectionStart = Math.max(\n editor.value.lastIndexOf('\\n', editor.selectionStart - 1) + 1,\n editor.value.lastIndexOf(':', editor.selectionStart)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a playlist object from a playlist lesson link. | function getPlaylist (link) {
var parent = $(link).parent()
var res = {}
res.name = $('.name', parent).text()
res.lessons = getLessons(parent)
return res
} | [
"function createSong(playlist, artist, title, link, youtubeUrl) {\n let song = {\n artist: artist,\n title: title,\n link: link,\n youtubeUrl: youtubeUrl\n }\n playlist.songs.push(song);\n\n saveSong(playlist);\n}",
"function PlaylistEntry(title) {\n\t// alert(\"create new ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remueve la columna de Eliminar de la tabla de invitados | function remuevecolumnaEliminar(){
var tablaLength = obtenTablaLength("invitado_table");
for(var i = 1; i <= tablaLength; i++){
$("#tr_"+i+" td", $("#invitado_table")).eq(5).hide();
}
} | [
"removeColumnConstraints() {\n $('.ghx-busted-max, .ghx-busted-min').removeClass('ghx-busted-min ghx-busted-max'); // Red/yellow background remove\n $('.ghx-constraint').remove(); // Column header remove\n }",
"deleteColumn() {\n let tableBand = this.getParent();\n let table = this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return from our groups the ones that start in [ other.offset, other.end() [ | groupsStartingIn (other) {
let list = new GroupList()
for (let group of this.groups) {
if (group.offset.compare(other.offset) >= 0 && group.offset.compare(other.end()) < 0) list.groups.push(group)
}
return list
} | [
"static spans(sets, from, to, iterator) {\n var _a;\n let cursor = new SpanCursor(sets, null, (_a = iterator.minPointSize) !== null && _a !== void 0 ? _a : -1).goto(from), pos = from;\n let open = cursor.openStart;\n for (;;) {\n let curTo = Math.min(cursor.to, to);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A resource on the API, this class will build up a method for each action that can be performed on the resource. The `options` argument should have the following properties: resourceDefinition the definition of the resource and its actions from the schema definition. consumerkey the oauth consumerkey consumersecret the ... | function Resource(options) {
this.format = options.format;
this.logger = options.logger;
this.resourceName = options.resourceDefinition.resource;
this.host = options.schema.host;
this.port = options.schema.port;
this.api = options.api;
this.version = options.schema.version;
this.consumerkey = options.consumerke... | [
"function _createResource({domain, path, contentType, token, args}) {\n //Remove the path if we are running in function mode, so paths in original action work\n return post.func(args)({\n domain,\n token,\n path: '/resources',\n headers: {\n 'Content-Type': contentType\n },\n data: {}\n })... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates searchTerm based on form submission | function updateSearchTerm(searchTerm) {
setSearchTerm(searchTerm);
setIsLoading(true);
} | [
"function handleSearchTerm(event) {\n setSearchTerm(event.target.value);\n }",
"function updateJobs(searchTerm) {\n setSearchTerm(searchTerm);\n }",
"function watchForm() {\n // console.log('watchForm() ready');\n $('#js-searchForm').submit(e => {\n e.preventDefault();\n $('#js... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getting information is different for a file than it is for a directory, so here we make sure we are calling the right function. | function getinfo(pp, callback) {
if (pp.isDirectory) {
directoryInfo(pp, function (result) {
callback(result);
});
} else {
fileInfo(pp, function (result) {
callback(result);
});
}//if
}//getinfo | [
"function FileInfo() {\n}",
"function FileInfo(init) {\n init = init || {};\n\n if (init.dir) {\n console.log(\"Creating new file info for \" + init.dir);\n }\n\n /**\n * Private Data\n */\n\n /**\n * The current directory\n */\n var dir = init.dir || '';\n\n /**\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns whether this schedule violates the "peak period" property; e.g. 60% or more of all classes in schedule are during peak periods; we want to warn users if this is the case | function scheduleViolatesPeakPeriodProperty(schedule) {
var peakPeriodClasses = 0;
for (var x = 0; x < schedule.classes.length; x++) {
var aClass = schedule.classes[x];
for (var y = 0; y < aClass.meetingTimes.length; y++) {
var aMeetingTime = a... | [
"function hasLowPhysicalActivity(user, endDate) {\n \n var startDate = JSON.stringify(getDate(7)); // we need to transform the date into a \"yyyy-mm-dd\" string\n startDate = startDate.substring(1, startDate.indexOf(\"T\"));\n var lEndDate = JSON.stringify(endDate); // we need to transform the date into a \"yy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks the height of a conversation makes history scrollable if conversation is taller than window | function checkConversationHeight( chatHeight )
{
var testHeight = (chatHeight !== undefined) ? chatHeight : $chatHistory.outerHeight();
// if conversation is taller than window make scrollable
if ( testHeight > $body.height() )
{
$chatHistory.css... | [
"getSnapshotBeforeUpdate(prevProps, prevState) {\n const messageListNode = this.messageListRef.current;\n // scrollTop height of scrolled part from top\n // clientHeight height of appeared part\n // scrollHeight height of <MessageList />\n // scroll to bottom when we are near it\n this.shouldScrol... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scroll to selected thumb | function scrollToSelectedThumb(){
var selectedItem = g_gallery.getSelectedItem();
if(selectedItem == null)
return(true);
var objThumb = selectedItem.objThumbWrapper;
if(objThumb)
scrollToThumb(objThumb);
} | [
"function scrollToThumbMin(objThumb){\n\t\t\n\t\tvar objThumbPos = getThumbPos(objThumb);\t\t\n\t\t\n\t\tvar scrollPos = objThumbPos.min * -1;\n\t\tscrollPos = t.fixInnerStripLimits(scrollPos);\n\t\t\n\t\tt.positionInnerStrip(scrollPos, true);\n\t}",
"function scrollDown(amount) {\n moveTo(current ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
allow_headers computed: true, optional: false, required: false | get allowHeaders() {
return this.getListAttribute('allow_headers');
} | [
"defaultHeaders(otherHeaders = {}) {\n\n let acceptHeaders = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n }\n\n return Object.assign({}, acceptHeaders, otherHeaders)\n }",
"procesarHeaders(){\n var headers = {\n \"Accept\": \"*/*\",\n \"User-Agent... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts any value into a [[Color]]. | function toColor(value) {
if (_Type__WEBPACK_IMPORTED_MODULE_2__["hasValue"](value) && !isColor(value)) {
return castColor(value);
}
return value;
} | [
"function value_to_color(value) {\n var blink = \" \"\n var led_color_table= [\n \"black\", \"red\", \"green\", \"yellow; color:black\",\n \"black\", \"red\", \"green\", \"yellow; color:black\"]\n\n if (value >= 4) {\n blink = \"B\"\n }\n return [led_color_table[value], blink]\n}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updateTeddyDialogueMessage(message) : This function updates the dialogue box of the teddy with the message passed to the function. Parameters: message: The message to be displayed in the teddy dialogue box Example: updateTeddyDialogueMessage('Congratulations!You won!'); This will update the message 'Congratulations!You... | function updateTeddyDialogueMessage(message) {
//Fetch the teddy dialogue box element using its class name
var element = document.getElementsByClassName('tdialogue-box-text')[0];
//Clear the teddy dialogue content
element.innerHTML = '';
//Add the message passed to the teddy dialogue box
var text = docume... | [
"function setMessageDeleted (message_id){\n\tconst delete_msg = `<p>---CHAT DELETED---</p>`\n\tdocument.getElementById(message_id).innerHTML = delete_msg;\n\n}",
"function OnMessageTimeOut(id) {\n\n\tif (id == DVDMSGTIMER) {\n\t\tMessage.Text = \"\";\n\t\tMessageFull.Text = \"\";\n if (g_LTRReading)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
writeTransaction creates a new writeable transaction object. See WriteTransaction for details. | writeTransaction(threadID, collectionName) {
const client = grpc_web_1.grpc.client(threads_pb_service_1.API.WriteTransaction, {
host: this.serviceHost,
transport: this.rpcOptions.transport,
debug: this.rpcOptions.debug,
});
return new models_1.WriteTransaction... | [
"commit(transaction) {\n return this._transmit(\"COMMIT\", {\n transaction: transaction\n });\n }",
"function writeTransactionToFile(filepath, filename, transaction, errorCallback) {\n // check if file exists\n if (!fs.existsSync(filepath)) {\n fs.mkdirSync(filepath);\n }\n\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the products by subCategoryID | function loadProducts(subCategoryID)
{
var xmlhttp = getXMLHTTP();
/* What to do when we get the asynchormous response from the server */
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
document.getElementById("sectionProduct").innerHTML = xmlhttp.... | [
"function loadSubCategory() {\n\tvar categorySelect = document.getElementById('categorySelect');\n\tselectedCategory = categorySelect.options[categorySelect.selectedIndex].value;\n\tselectedCategoryText = categorySelect.options[categorySelect.selectedIndex].text;\n\tif (selectedCategory != 0) {\n\t\tdocument.getEle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the rate charts (both). | function updateRateCharts( rateset ) {
single_row = (rateset.subgpu.substr(1,3) > 200) ? true : false;
// Specific rates
$('.rate_calc_search_results #country .country_name').html(rateset.country);
if (single_row) {
$('.rate_calc_search_results #specific_label div').html('Number Entered');
} else {
$('.rate_... | [
"function updateBidChart() {\r\n\t\t\t\t\tupdateBidChart2();\r\n\t\t\t\t}",
"function trend_periodically_update_graph () {\n\t$.ajax({\n\t\ttype: 'GET',\n\t\turl: '/dashboard/trend_data',\n\t\tdataType: 'json',\n\t\tsuccess: trend_generate_graph\n\t});\n}",
"function updateChartValue(){\r\n myChart.data.data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(OLD) send all the current positions to the server to save | function sendPositions() {
var data = {};
var tmp = which;
// associate the points with an id or set of conditions
//data.id = condition+...+structure(etc)
which = 1;
data.pos1 = getPositions();
which = 2;
data.pos2 = getPositions();
which = tmp;
POST(data, function(r) {
console.log(r.status)... | [
"function writePosition(x,y){\n //refers to the place and set the value\n database.ref('ball/position').set({\n 'x':position.x+x,\n 'y':position.y+y\n })\n\n}",
"savedDestination () {\r\n this.setNewDestination = false;\r\n this.currentX = this.nextVertex.x + this.radius;\r\n this.currentY = thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `ClientPolicyProperty` | function CfnVirtualNode_ClientPolicyPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but recei... | [
"function CfnVirtualGateway_VirtualGatewayClientPolicyPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('E... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load a special image that will be used as the mouse cursor | function loadCursor(url, x,y) {
var img = loadImage(url);
img.hotSpotX = x;
img.hotSpotY = y;
} | [
"function setCursor(image) {\n\tif(!image)\n\t\tdelete theCanvas.style.cursor;\n\telse\n\t\ttheCanvas.style.cursor = \"url(\"+image.src+\") \"+\n\t\t\timage.hotSpotX+\" \"+\n\t\t\timage.hotSpotY+\n\t\t\t\", auto\";\n}",
"function setCursor(canvas, image, defaultCursor) {\n canvas.style.cursor = (isIE() ? 'url... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Round a value to the closest 'to'. | function closest ( value, to ) {
return Math.round(value / to) * to;
} | [
"function roundTowardsZero(x) {\r\n var a;\r\n if (x < 0) {\r\n a = Math.ceil(x);\r\n } else {\r\n a = Math.floor(x);\r\n }\r\n return a;\r\n}",
"function roundDistance(distance) {\n return Math.round(distance * 100) / 100\n}",
"function truncate(_value)\n{\n if (_value < 0) r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate an ID for a giving type of element type: tool | data | edge returns an ID with t | d | e followed by a 4digit. e.g: t0012 | gen_id(type){
var str_prefix = "";
var num_id = null;
var arr_elems = null;
switch (type) {
case 'tool': str_prefix = "t-"; arr_elems= this.get_nodes('tool'); break;
case 'data': str_prefix = "d-"; arr_elems= this.get_nodes('data'); break;
case 'edge': str_pr... | [
"function makeid() {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n for (var i = 0; i < 1000; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n return text;\n }\n }",
"function makeId (){\n function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function exp that evaluates a simple array expression: | function exp (arr){
if (Array.isArray(arr)){
return arr[0](arr[1], arr[2]);
}
return arr;
} | [
"function evaluate_array_literal(stmt,env) {\n var array = [];\n var elements = stmt.elements;\n var len = length(elements);\n for (var i = 0; i < len; i = i + 1) {\n array[i] = evaluate(head(elements), env);\n elements = tail(elements);\n }\n return array;\n}",
"function ArrayIn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set app loaded to true | @action appIsLoaded() {
this.appLoaded = true;
} | [
"_onAddApplication() {\n this._showLoader();\n this.$.appscoApplicationAddSettings.addApplication();\n }",
"loadAppConfig() {\n // Load tools\n this.tools = Tools.map((t) => new t());\n EventBus.$emit(\"ui-set-tools\", this.tools);\n\n // Load menu\n this.menu = Menu;\n EventBus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================== END ===================== ================ INVITES HANDLING ============ Sends request to topic authority to create an invite | requestInvite(){
let ic = new iCrypto()
ic.createNonce("n")
.bytesToHex("n", "nhex");
let request = new Message(self.version);
let myNickNameEncrypted = ChatUtility.encryptStandardMessage(this.session.settings.nickname,
this.session.metadata.topicAuthority.publicK... | [
"invite(userId, invitedId) {\n // use date for sorted set ordering\n return new Promise((resolve, reject) => {\n this.client.zadd(\n `${this.namespace}:user:${invitedId}:${STATE_KEY.invited}`,\n Date.now(),\n userId,\n (err, res) => {\n if (err) { reject(err); }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that loads the default resources and layers assigned to the system through the MapBox API. | function loadDefaultElementsOnMap (){
map.on('load', function(){
try {
// source and layer UPZ polygons
addSourceMap(ID_UPZ_SOURCE, UPZ_POL_LOCAL_PATH, 'geojson');
addLayerPolygonOnMap(ID_LAYER_UPZ, ID_UPZ_SOURCE, 'none', '#3CB8FB', '#FFFFFF');
// source a... | [
"function addBaseLayers(specs)\n{\n\tvar controls = {};\n\tfor(var i in specs)\n\t\tcontrols[capitalize(specs[i])] =\n\t\t\tmakeLayerMapBox(specs[i], \"mapbox.\" + specs[i]);\n\tcontrols[capitalize(specs[0])].addTo(map);\n\tL.control.scale({maxWidth: 150, metric: true, imperial: false})\n\t\t\t\t\t\t\t\t.setPositio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function adapted from subskybox ( utilizes bitwise mapping to find poker category in specfic order above input: cs, array of 5 numbers representing card rank with 14 representing Ace ss, array of 5 numbers representing card suit output: index corresponding to static category array above. Warning: Do not change order of... | getCategoryIndex(cs, ss) {
let v, i, o, s = 1 << cs[0] | 1 << cs[1] | 1 << cs[2] | 1 << cs[3] | 1 << cs[4];
for (i = -1, v = o = 0; i < 5; i++, o = Math.pow(2, cs[i] * 4)) {
v += o * ((v / o & 15) + 1);
}
v = v % 15 - ((s / (s & -s) == 31) || (s == 0x403c) ? 3 : 1);
v... | [
"function rankPokerHand(cards) {\r\nvar cs = [];\r\nvar ss = [];\r\ncards.forEach(function(elem){\r\n cs.push(elem.num==nums[0]?14:nums.indexOf(elem.num)+1);\r\n ss.push(Math.pow(2,suits.indexOf(elem.suit)));\r\n});\r\n var v, i, o, s = 1<<cs[0]|1<<cs[1]|1<<cs[2]|1<<cs[3]|1<<cs[4];\r\n for (i=-1, v=o=0; i<5... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A Polling function to check if arrows coordinates has changed | pollForArrowsChanges () {
let brokenReference = false
foreach(arrow => {
if (arrow.hasChanged()) {
arrow.positionate()
}
if (arrow.onceVisible && !isVisible(arrow.target.$el)) {
brokenReference = true
}
}, this.arrows)
if (brokenReference) {
this.recreateDO... | [
"function piercingArrowUpdate() {\n for (var i = 0; i < gameScreen.robots.length; i++) {\n var target = gameScreen.robots[i];\n if ((target.type & this.group) && target.pos.distanceSq(this.pos) < 90000) {\n var rel = this.vel.clone().multiply(5, 5).addv(target.pos).subtractv(this.pos);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
trim the string to the defined max length, and add ellipses if the message is cut off. | function trimStringToMaxLength(string) {
return string.length > config.maxlength ?
string.substring(0, config.maxlength - 3) + "..." :
string;
} | [
"function trim()\n{\n if (maxMessages !== null)\n {\n while(messages.length > maxMessages)\n {\n messages.shift();\n }\n }\n}",
"function limitWidth(string, len) {\n var lines = string.split('\\n');\n len = (typeof len === 'number') ? len : 80;\n var chars;\n for (var i = 0; i < l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
COMPANY Size parsing in company page | function employeesFromCompanyPage(html) {
if (isSalesNavigator()) {
html = $(html).find("code").last().html();
json = html.replace("<!--", "").replace("-->", "");
return JSON.parse(json)["account"]["fmtSize"];
} else if(isRecruiter()) {
// TO DO
return "";
}
else {
if (typeof $(html).fin... | [
"function get_item_size() {\n var sz = 220;\n return sz;\n}",
"parseSizeGroup(optional) {\n let res;\n let isBlank = false;\n\n if (!optional && this.nextToken.text !== \"{\") {\n res = this.parseRegexGroup(/^[-+]? *(?:$|\\d+|\\d+\\.\\d*|\\.\\d*) *[a-z]{0,2} *$/, \"size\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new visitor instance which delegates to many visitors to run in parallel. Each visitor will be visited for each node before moving on. If a prior visitor edits a node, no following visitors will see that node. | function visitInParallel(visitors) {
var skipping = new Array(visitors.length);
return {
enter: function enter(node) {
for (var i = 0; i < visitors.length; i++) {
if (!skipping[i]) {
var fn = getVisitFn(visitors[i], node.kind, /* isLeaving */false);
if (fn) {
var r... | [
"function walkSceneGraph(node, visitor, visitorExtraArgs, parentTransform)\n{\n // Provide a default value for the parentTransform if none is specified.\n if (!parentTransform)\n parentTransform = mat4.identity();\n\n // Calculate the local transform for this node.\n var localTransform;\n if (node.transform... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Identifies the parent form in which an element is contained | function getParentFormName(elt) {
while (elt && elt.nodeName && elt.nodeName.toUpperCase() !== 'HTML' && elt.nodeName.toUpperCase() !== 'FORM') {
elt = elt.parentNode;
}
if (elt && elt.nodeName && elt.nodeName.toUpperCase() === 'FORM') {
return getFormElementName(elt);
}
} | [
"get parent() {\n return tag.configure(ContentType(this, \"parent\"), \"ct.parent\");\n }",
"function getFormElem() {\r\n\t\treturn _self.form.getFormElem();\r\n\t}",
"static getParentId(el){\n return $(el).parents('div[class^=\"shiny\"]').prop(\"id\");\n }",
"parent() {\n var selection =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks whether the given player + casted spells and boss stats allows the player to win | function isPlayerWin(player, casted, boss, state) {
var playerHp = state.playerHp || player.hp;
var playerMana = state.playerMana || player.mana;
var playerArmor = state.playerArmor || 0;
var bossHp = state.bossHp || boss.hp;
var bossDamage = state.bossDamage || boss.damage;
var shieldCountDown ... | [
"function winnerIs(player) {\n\tconsole.log(player == \"player1\" ? \"Player 1 wins\" : \"Player 2 wins\");\n\tshowMessege(player == \"player1\" ? \"#\" + player1.short + \"-hits\" : \"#\" + player2.short + \"-hits\");\n\tif(player == \"player1\") {\n\t\tsetStamina(player1, \"player-1-stamina\", \"add\");\n\t\tsetS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |