query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
method to create a localized Toast message /Label arrays structure ["message"][,], ] | function createLocalizedShowToastMessage(labelArray, userId) {
var labelIdList = new Array();
labelIdList = labelArray[0];
//Fetching localized text for all the titles,message and button names
var db = Titanium.Database.open('Miscue');
var paramList = [userId];
paramList = paramList.concat(labelIdList);
var loca... | [
"function createLocalizedAlertDialog(labelArray, userId) {\n\tvar labelIdList = new Array();\n\tvar buttonLabelArray = new Array();\n\tlabelIdList[0] = labelArray[\"title\"][0];\n\tlabelIdList[1] = labelArray['message'][0];\n\tvar inPlaceholder = '( ?,?';\n\tvar j = 1;\n\t//building the array of label ids to pass t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
za izabrani datum pronalazi preostale datume iz iste nedelje | function pronalazenjeDatuma(d) {
let mesec = d.getMonth() + 1;
if (mesec.toString().length == 1) {
mesec = "0" + mesec.toString();
}
let dan = d.getDate();
if (dan.toString().length == 1) {
dan = "0" + dan.toString();
}
let danas = getDatum(dan + " " + mesec + " " + d.getFul... | [
"function isEmpty() {\n\tif (this.status == 2) return false; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// preskocimo dan, za katerega ne obstaja idmm \n\tif (str2date(this.datum) >= this.parent.getFirstEditDate()) { \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// preverjamo samo podatke, ki jih lahko... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get live channel by ID. | static get(id){
let kparams = {};
kparams.id = id;
return new kaltura.RequestBuilder('livechannel', 'get', kparams);
} | [
"function get_channel(id){\n return guild.channels.cache.get(id);\n}",
"function GetChannelByName(name) { \r\n var channel = client.channels.find(val => val.name === name); \r\n return channel; \r\n }",
"function idToChannel() {\n updateConfig()\n setTimeout(() => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets new data for the gallery (but only if we have any data). | setData(data) {
if (!data) {
console.log('oops.. no data');
return;
}
// console.log('got data...', data);
this.data = data;
if (this.script) {
document.body.removeChild(this.script);
this.script = undefined;
}
thi... | [
"function addToGallery() {\n library.forEach(book => displayBooks(book));\n updateStats();\n library.splice(0, library.length);\n form.reset();\n}",
"SetEditorData() {}",
"function setFigure(){\n\n\t\t\t\tvar sizes = new Object();\n\n\t\t\t\tvar mediaObj = element.data();\n\n\t\t\t\t$.each(mediaObj, functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parses a nthcheck formula, returns an array of two numbers | function parse(formula){formula=formula.trim().toLowerCase();if(formula==="even"){return[2,0];}else if(formula==="odd"){return[2,1];}else{var parsed=formula.match(re_nthElement);if(!parsed){throw new SyntaxError("n-th rule couldn't be parsed ('"+formula+"')");}var a;if(parsed[1]){a=parseInt(parsed[1],10);if(isNaN(a)){i... | [
"function checkYuGiOh(n) {\n const myArr = [];\n if (isNaN(n)) {\n return `invalid parameter: ${n}`;\n }\n for (let i = 1; i <= n; i++) {\n if (i % 2 == 0 && i % 3 == 0 && i % 5 == 0) {\n myArr.push(\"yu-gi-oh\");\n } else if (i % 2 == 0 && i % 3 == 0) {\n myArr.push(\"yu-gi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw a line on the given context from point `x1,y1` to point `x2,y2`. | function line(ctx, x1, y1, x2, y2) {
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.stroke();
} | [
"drawLine(start_x, start_y, end_x, end_y) {\n this.ctx.moveTo(start_x, start_y);\n this.ctx.lineTo(end_x, end_y);\n }",
"function renderLine(ctx, start, end) {\n ctx.save();\n\n ctx.beginPath();\n ctx.moveTo(start.x, start.y);\n ctx.lineTo(end.x, end.y);\n\n ctx.stroke();\n ctx.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function updtBidResult is the success callback function for the ajax updtBid.php call made by the processBid() function. It checks for a failure or a collision and then it checks if all bids are done and if not it sets up the response screen for this bid. Output from updateBid is an echo return status of "success", "co... | function updateBidResult(result) {
if (result === 'fail') {
var errmsg = 'bid18xxSubmit: updtBid.php failed.\n';
errmsg += 'Please contact the BID18xx webmaster.\n';
errmsg += BID18.adminName + '\n';
errmsg += BID18.adminEmail;
alert(errmsg);
return;
}
if (result === 'collision') { // Back... | [
"function getBidResult(result1) {\n BID18.bid = JSON.parse(result1);\n BID18.updtCount = BID18.bid.updtCount;\n var result = BID18.bid.return;\n if (result === 'fail') {\n var errmsg = 'bid18xxSubmit: getRec.php failed.\\n';\n errmsg += 'Please contact the DRAFT1846 webmaster.\\n';\n errmsg += BID18.ad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function definitions reads all the necessary files and updates the TimeBasedRecommendor accordingly | function readFiles() {
//alert("recommendor reading files");
//this.readFile(inheritancesFilename);
this.createFiles();
this.readFile(ratingsFilename);
this.updateLinks();
this.updatePredictions();
message("recommendor done reading files\r\n");
alert("recommendor done reading fil... | [
"function TimeBasedRecommendor() {\n\n\t/* Private Member Variables */\n\n // setup some maps so that we can store all the data in memory and then update properly\n // Basically the concern is that can't add a rating to a candidate that doesn't exist yet\n // So we store everything, then create the candida... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
! provide a wrapper for any data that is going to be pushed into the history stack. All data is wrapped in a "_davis" namespace. | function wrapStateData(data) {
return {"_davis": data}
} | [
"function History(){}",
"function DataStore() {\n\t this.name = \"DataStore\";\n\t exports.extend(this, EventSystem);\n\t this.setDriver(\"json\"); //default data source is an\n\n\t this.pull = {}; //hash of IDs\n\n\t this.order = toArray(); //order of IDs\n\n\t this._marks = {};\n\t}",
"getHistory(){\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert base64 to Img object | function base64ToImg(base64){
var i = document.createElement("img");
i.src = "data:image/png;base64," + base64;
return i;
} | [
"base64Image(imagePath) {\n\t\tconst base64Content = readFileSync(imagePath).toString('base64')\n\t\treturn `data:image/jpeg;base64,${base64Content}`\n\t}",
"function base64(data) {\n\tif (typeof data === 'object') data = JSON.stringify(data);\n\treturn Buffer.from(data).toString('base64');\n}",
"static byteArr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if this search has a missing mapping | hasMissingMapping() {
let isMissing = false;
try {
this._getAPIDiseases();
} catch (err) {
isMissing = true;
}
try {
this._getAPIInterventions();
} catch (err) {
isMissing = true;
}
//Phase
try {
this._getAPIPhases();
} catch (err) {
isMissi... | [
"hasMapping(logicalId, props) {\n const matchError = (0, mappings_1.hasMapping)(this.template, logicalId, props);\n if (matchError) {\n throw new Error(matchError);\n }\n }",
"function checkForMap(state, maps) {\n // store the mapping if all atoms are mapped\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds the number at the end of string one to the number at the start of string two and merges the result returning a new expression string | function add(str1, str2) {
var end = endNumber(str1);
var start = startNumber(str2);
//if missing a value, setting to 0 ensures that addition will not be affected
if(!start.value) {
start.value = 0;
}
if(!end.value) {
end.value = 0;
}
var sum = end.value + start.value;
re... | [
"function multiply(str1, str2) {\n var end = endNumber(str1);\n var start = startNumber(str2);\n //if missing a value evaluation is impossible\n if(start.value === undefined || end.value === undefined) {\n throw new Error(\"malformed expression\");\n }\n\n var product = end.value * start.valu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a text string, return a ordered list of all completions of the last normalized word in text. Returns [] if the last char in text is not alphabetic. | async complete(text) {
//TODO
await this._makeCompletions();
if (!text.match(/[a-zA-Z]$/)) return [];
let ans = [];
try{
const word = text.split(/\s+/).map(w=> normalize(w)).slice(-1)[0];
ans = this.completions.get(word[0]).filter((w) => w.startsWith(word));
}catch(err){
//cons... | [
"async complete(text) {\n if (!this.isComplete) this._makeCompletions();\n if (!text.match(/[a-zA-Z]$/)) return [];\n const word = text.split(/\\s+/).map(w=>normalize(w)).slice(-1)[0];\n return (this.completions.get(word[0]))?this.completions.get(word[0]).filter((w) => w.startsWith(word)):'';\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define a [highlighter](highlight.Highlighter) from an array of tag/class pairs. Classes associated with more specific tags will take precedence. | function tagHighlighter(tags, options) {
let map = Object.create(null)
for (let style of tags) {
if (!Array.isArray(style.tag)) map[style.tag.id] = style.class
else for (let tag of style.tag) map[tag.id] = style.class
}
let { scope, all = null } = options || {}
return {
... | [
"function highlight(text, words, tag) {\n // Default tag if no tag is provided\n tag = tag || 'span';\n var i,\n len = words.length,\n re;\n for (i = 0; i < len; i++) {\n // Global regex to highlight all matches\n re = new RegExp(words[i], 'g');\n if (re.test(text)) {\n text = text.replace(r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Main Forfeiting Functions Updates the timers of all currently forfeiting players, and fires the event if needed. | function updateForfeits()
{
console.log("[updateForfeits] Updating timers...");
// update timers
for (var i = 0; i < forfeitPlayers.length; i++) {
if (!forfeitPlayers[i].hasForfeit) {
// this is their first time this match
forfeitPlayers[i].firstTimer.current -= 1;
... | [
"function nextFlareon() { //* need to fix this function so that it doesn't decrease life when reaching end points and respawning!!!!!!!\n flareonPosition = startingPosition //* takes player back to starting position\n if (!playerWinFlag) {\n playerLives-- //* so player lives will decrease when... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert the IOTA Area Code to Open Location Code. | function toOpenLocationCode(iotaAreaCode) {
if (!validation_1.isValid(iotaAreaCode)) {
throw new Error("The iotaAreaCode is not valid");
}
return internal_1.iacToOlcInternal(iotaAreaCode);
} | [
"function decode(iotaAreaCode) {\r\n const olc = open_location_code_typescript_1.default.decode(toOpenLocationCode(padPartial(iotaAreaCode)));\r\n return {\r\n latitude: olc.latitudeCenter,\r\n longitude: olc.longitudeCenter,\r\n codePrecision: olc.codeLength,\r\n latitudeLow: olc.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set function optionChange when the subject ID change, the below funsctions are called. | function optionChanged(subjectid) {
barPlot(subjectid);
bubblePlot(subjectid);
updateinfo(subjectid);
gaugeplot(subjectid);
} | [
"function ifchanged()\r\n\t {\r\n\t var obj = document.getElementById(\"sem\");\r\n var abc=obj.options[obj.selectedIndex].text;\r\n\t changing_subjects(abc[1]);\r\n\t //the integer value of the semester is passes\r\n\t }",
"add_change(func) {\n this.add_event(\"change\", func);\n }",
"onOptionsCh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========= HandleTblRowClicked ================ PR20200803 | function HandleTblRowClicked(tr_clicked) {
//console.log("=== HandleTblRowClicked");
//console.log( "tr_clicked: ", tr_clicked, typeof tr_clicked);
// --- get selected.student_dict
selected.student_pk = get_attr_from_el_int(tr_clicked, "data-pk");
selected.student_dict = b_get_datadict... | [
"function MDUO_handleTblrowClicked(tblName, tr_clicked) {\n //console.log( \"===== MDUO_handleTblrowClicked ========= \");\n //console.log( \" tblName\", tblName); // \"subject\", \"ntermentable\", \"linked\"\n\n const tblBody_clicked = (tblName === \"subject\") ? el_MDUO_tblBody_subjects :... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a Sass variable object, it parses and retrieves the value. | function processVariable(variableContent) {
switch (variableContent.type) {
case "SassString":
if (variableContent.value.includes("var(")) {
val = variableContent.value;
} else {
val = `"${variableContent.value}"`
}
break;
case "SassNumber":
val = variableContent.value + variableContent.un... | [
"function lookup_variable_value(variable,env) {\n function env_loop(env) {\n if (is_empty_environment(env)) {\n error(\"Unbound variable: \" + variable);\n } else if (has_binding_in_frame(variable,first_frame(env))) {\n return first_frame(env)[variable];\n } else {\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update one or all notes in the current IndexedDB notepad object store | function idbNoteUpdate(whichTar) {
if (!idbSupport) return;
var os = notepadIdLocal;
if (whichTar == "all") {
var thisTarget;
var items = [];
for (let n in notepads[os]) {
thisTarget = { "idLocal": Number(n) };
items.push($.extend({}, thisTarget, notepads[os][n]));
}
} else {
var thisTarget = { "idL... | [
"function editNote(){\n\t\n\tvar moment = require('alloy/moment');\n\t\n\tvar note= myNotes.get(idNote);\n\tnote.set({\n\t\t\"noteTitle\": $.noteTitle.value,\n\t\t\"noteDescription\": $.noteDescription.value,\n\t\t\"date\": moment().format()\n\t}).save();\n\t\n\tvar toast = Ti.UI.createNotification({\n\t\t \t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
give the X coordinate of the object relative to the window. A more accurate version when the containing scrollable divs are offset parents (css posiiton = relative/absolute) | function findAbsolutePosX(obj)
{
var curleft = 0;
if (document.getElementById || document.all)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft;
if (obj.offsetParent != document.body)
curleft -= obj.offsetParent.scrollLeft;
obj = obj.... | [
"function findGlobalPosX(obj, container)\n{\n var curtop = 0;\n if (document.getElementById || document.all)\n {\n while (obj.offsetParent)\n {\n curtop += obj.offsetLeft;\n obj = obj.offsetParent;\n }\n\n if (obj.document!=null && obj.document.parentWindow... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Consumes tokens from a Tokenizer to produce a Rulelist node. | parseRulelist(tokenizer) {
const rules = [];
const start = tokenizer.currentToken.start;
let endToken;
// Take the opening { boundary:
tokenizer.advance();
while (tokenizer.currentToken) {
if (tokenizer.currentToken.is(token_1.Token.type.closeBrace)) {
... | [
"parseRules(tokenizer) {\n const rules = [];\n while (tokenizer.currentToken) {\n const rule = this.parseRule(tokenizer);\n if (rule) {\n rules.push(rule);\n }\n }\n return rules;\n }",
"parseRule(tokenizer) {\n // Trim leading ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove `position`s from `tree`. | function removePosition(node, force) {
visit(node, force ? hard : soft)
return node
} | [
"prune(callback) {\n if (_.isArray(this.contents)) {\n const length = this.contents.length;\n\n if ((this.type === \"REPEAT\" && length > 0) || (this.type === \"REPEAT1\" && length > 1)) {\n // Any subtree may be removed\n for (let i = 0; i < length; i++) {\n const tree = _.clone... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rebuild layout with the given new basePath | rebuild(basePath) {
this.build(basePath);
setTimeout(() => {
this.renderPartials();
}, 10);
} | [
"build(basePath = this.defaultBasePath) {\r\n if (typeof this.container != 'undefined') {\r\n this.container.remove();\r\n }\r\n\r\n if (Is.callable(basePath)) {\r\n basePath = basePath();\r\n }\r\n\r\n this.container = $(basePath ? render(basePath) : this.vi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set the mode based on which key is typed | function keyTyped() {
mode = key;
} | [
"function changeMode(){\n\tvar new_mode = $('#mode').val();\n\tedit_session.setMode(\"ace/mode/\"+new_mode);\n}",
"function setTypingMode(_mode) {\n const mode = _mode.toLowerCase();\n\n switch (mode) {\n case \"words (fixed amount)\":\n // Update ui\n document.querySelector(\"#coding-are... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cgAddChild adds an element for document.CALLGRAPH node cgn to the parent element ul. tree is the tree's root element. | function cgAddChild(tree, ul, cgn) {
var li = document.createElement("li");
ul.appendChild(li);
li.className = "closed";
var code = document.createElement("code");
if (cgn.Callees != null) {
$(li).addClass("expandable");
// Event handlers and innerHTML updates don't play nicely together,
... | [
"addChild(value) {\n const newTreeNode = new Tree(value);\n this.children.push(newTreeNode);\n }",
"function addChildToGraphProfileSummary(parentUl, childCcn, isRootComp) {\n var childLi = $(\"<li/>\");\n if (isRootComp) childLi.addClass(CIR_FCS_SUM_ITEM_ROOT_COMP_CLASS);\n else childLi.addClass(C... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transform dct block back into pixel block | function getPixelBlock(coefficientBlock) {
var pixelBlock = new Array(64);
// loop over pixelBlock
for (var n = 0; n < 8; n++) {
for (var m = 0; m < 8; m++) {
pixelBlock[n * 8 + m] = 0;
// loop over coefficient block, calculate pixel value
for (var l = 0; l < 8; l++) {
for (var k = 0; k < 8; k++)... | [
"function getDctCoefficientBlock(pixelBlock, sizeLimit) {\n\tvar coefficientBlock = new Array(64);\n\t\n\t// loop over coefficient block\n\tfor (var l = 0; l < 8; l++) {\n\t\tfor (var k = 0; k < 8; k++) {\n\t\t\t\n\t\t\tcoefficientBlock[l * 8 + k] = 0;\n\t\t\t\n\t\t\t// calculate coefficient, loop over pixelBlock\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Split a field name into the next level and all following levels | function splitFieldName(aFieldName) {
var nesting = aFieldName.split('.'),
result = [nesting[0]];
if (nesting.length > 1) {
result.push(nesting.slice(1).join('.'));
}
return result;
} | [
"function extractField(depth, prefix, fields) {\n const width = 50;\n for (const f in fields) {\n\n // deal with arrays\n if (Array.isArray(fields[f])) {\n view_sql += ` -- enumerating array ${f} ...\\n`;\n view_sql += ` , val... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=====| fAnimateSlider Function |===== Animates element's top and left positions | function fAnimateSlider (elem, eTop, eLeft) {
//var posLeft = position.left();
//tMx.to (elem, animTym, {css: {y: eTop, offsetLeft: eLeft}, ease: easePower});
tMx.to (elem, animTym, {y: eTop, x: eLeft, ease: easePower});
//tMx.to (elem, animTym, {backgroundSize: "+=25% +=25%", ease: easePower}); //Testi... | [
"function sliderMove()\r\n{\r\n var offset = 0\r\n for (var t = 0; t < sliders.length; t++)\r\n {\r\n var slid = map(sin(angle+offset), -1, 1, 0, 255)\r\n sliders[t].value(slid)\r\n offset += vTest;\r\n } \r\n}",
"function setFramePosition(pos){\n \n //calculate position\n var px = im... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the largest of two doubles | function max_1(x, y) /* (x : double, y : double) -> double */ {
return ((x >= y)) ? x : y;
} | [
"function getBiggest(x, y) {\n if ( x > y) {\n return x;\n } else if ( x < y ) {\n return y;\n } else if ( x === y ) {\n return x;\n } else {\n return NaN;\n }\n}",
"function max(num1,num2){\n return Math.max(num1,num2)\n}",
"function maxOfTwoNumbers(a, b) {\n if (a > b) return a;\n else r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
append a contact item to a dom node | function appendContactToList(contact, to) {
var node = document.createElement("div");
// display a contact's information
function showContactInfo() {
x$("#contact_name")
.html(contact.name.formatted || contact.displayName || "Unknown Contact");
... | [
"add(info) {\n this.contacts.push(new Contact(info[0], info[1], info[2], info[3]));\n }",
"function insertItemToDOM(item, itemHtml, animate) {\n sub_id = subOfList[item.list_id];\n var curitems = valuesSortedByPosition(state.subscriptions[sub_id].list.items);\n if (objectKeys(curitems).length == 0 || item.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will update the text in the tips div the the text and the css | function updateTips(tips, text) {
tips
.text(text)
.removeClass("alert-light")
.addClass("alert-danger");
} | [
"function updateTips(tips, text) {\r\n tips\r\n .text(text)\r\n .removeClass(\"alert-light\")\r\n .addClass(\"alert-danger\");\r\n }",
"function SetText(tooltipText : String, position : Vector2)\n{\n if (text != null && !String.IsNullOrEmpty(tooltipText))\n {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sanitize the pkg.name for both sources, lowercasing all, replacing blank spaces by | function sanitize(name) {
if(!name) return;
return name.toLowerCase().replace(/\.js$/, '').replace(/\s/g, '-');
} | [
"prepare(str) {\n\t\treturn str.trim().toLowerCase();\n\t}",
"function cleanTagName( name ) {\n\t\treturn name.split( ':', 1 )[ 0 ].replace( /[^a-zA-Z]/g, '' ).toLowerCase();\n\t}",
"function cleanStationName(name) {\n name = name.replace(\"asema\", \"\")\n name = name.replace(\"_(Finljandski)\", \"\")\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function for Show/Hide Gif | function showGif(value){
if(value === 'show'){
document.querySelector('.wait-icon').classList.add('show');
}
else if(value === 'hide'){
document.querySelector('.wait-icon').classList.remove('show');
}
} | [
"function gifControl() {\n var state = $(this).attr('data-state');\n var still = $(this).attr('data-still');\n var animate = $(this).attr('data-animated');\n\n if (state == 'still') {\n $(this).attr('src', animate);\n $(this).attr('data-state', 'animate')\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ALift : async_f > oni_fexp | function ALift(async_f) {
var f = function() {
if (arguments[0] == ONI_FEXP_TO_OEN_TOKEN) {
return new OAN_ALift(async_f);
}
else {
var exps = slice_args(arguments, 0);
exps.unshift(new OAN_ALift(async_f));
return Apply.apply(this, exps);
}
};
f._type = ONI_FEXP_TOKEN;
re... | [
"function OXN_ALift_Apply(async_f, xc, env, args) {\n this.xc = xc;\n this.xc.current = this;\n \n var pars = [bind(this.cont, this)];\n pars = pars.concat(args);\n this.abort_f = async_f.apply(env, pars);\n}",
"function awaitingCiteL34ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`_nextHeading` gets the heading that comes after the currently selected one, wrapping around when reaching the last heading. | _nextHeading() {
const headings = this._allHeadings();
let newIdx =
headings.findIndex(heading =>
heading === document.activeElement) + 1;
return headings[newIdx % headings.length];
} | [
"_prevHeading() {\n const headings = this._allHeadings();\n // Use `findIndex` to find the index of the currently\n // selected element and subtracts one to get the index of the previous\n // element.\n let newIdx =\n headings.findIndex(headings =>\n headings === document.ac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handles three scenarios: Soft newlines. Hard newlines in the "defer breaking out of the block" case. Other hard newlines. See | handleNewLine(editorState, event) {
// https://github.com/jpuri/draftjs-utils/blob/e81c0ae19c3b0fdef7e0c1b70d924398956be126/js/keyPress.js#L64
if (isSoftNewlineEvent(event)) {
return this.addLineBreak(editorState);
}
const content = editorState.getCurrentContent();
c... | [
"convertLineBreaksToNonBreaking() {\n for (const breakEl of document.querySelectorAll('.coding-line br')) {\n const parentNode = breakEl.parentNode;\n if (parentNode.childNodes.length === 1) {\n parentNode.innerHTML = ' ';\n } else {\n breakEl.remove();\n }\n }\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An endpoint of a window that is sliding from left to right over |points| starting from time |start|. It is intended to be used only by the |mutatorUtilization| function. | function WindowEndpoint(start, points) {
this.points = points;
// The index of the last passed point.
this.lastIndex = -1;
// The position of the end-point in the time line.
this.position = start;
// The distance until the next point.
this.distanceUntilNextPoint = points[0].position - start;... | [
"next() {\n let from = this.to;\n this.point = null;\n let trackOpen = this.openStart < 0 ? [] : null, trackExtra = 0;\n for (;;) {\n let a = this.minActive;\n if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
what to show when user is loggedin | function userLoggedIn() {
let username = sessionStorage.getItem('username');
$('#spanMenuLoggedInUser').text(`Welcome, ` + username + '!');
$('#viewUserHomeHeading').text(`Welcome, ` + username + '!');
$('.anonymous').hide();
$('.useronly').show();
showView('UserHome')
... | [
"function loggedInCheck() {\n // ajax call to check that user has a valid, i.e. non-expired, login cookie\n // if cookie is valid, show logged in user controls\n var loggedIn = true;\n if ( loggedIn ) {\n showUserControls();\n }\n else {\n hideUserControls();\n }\n}",
"function doWhenLoggedIn() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load main application configuration load tools and menu settings from the Tools and Menu /config files | loadAppConfig() {
// Load tools
this.tools = Tools.map((t) => new t());
EventBus.$emit("ui-set-tools", this.tools);
// Load menu
this.menu = Menu;
EventBus.$emit("ui-set-menu", this.menu);
} | [
"function getConfiguration() {\n var request = new XMLHttpRequest();\n\n request.onreadystatechange = function() {\n if (request.readyState === 4) {\n\n /*---------- getting app configuration ----------*/\n var appConfiguration = JSON.parse(request.response);\n /*---------- assig... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert a new number Y at index X in an array | function insertXY(arr, num, idx){
var temp;
arr.push(num);
for (var i = arr.length-1; i > idx; i--){
temp = arr[i];
arr[i] = arr[i-1];
arr[i-1] = temp;
}
console.log(arr);
} | [
"function insert(array, start, end, v) {\n while (start + 1 < end && array[start + 1] < v) {\n var tmp = array[start];\n array[start] = array[start + 1];\n array[start + 1] = tmp;\n start++;\n }\n array[start] = v;\n }",
"insert(value){\n this.data.push(value);\n this.siftUp(th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /customer route to retrieve all the customers. | function getcustomers(req, res) {
//Query the DB and if no errors, send all the customers
let query = customer.find({});
query.exec((err, customers) => {
if(err) res.send(err);
res.json(customers);
});
} | [
"function getCustomer(id) {\n return $http.get(baseUrl+\"customer/\"+id,{headers:setHeaders()});\n }",
"function getCustomer(axios$$1, customerToken) {\n return restAuthGet(axios$$1, 'customers/' + customerToken);\n }",
"async findAllWithCustomer(req, res, next) {\n let pets;\n try {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add test to Modernizr based on a condition | function addConditionalTest(feature, test) {
if (!!feature && !!Modernizr) {
if (options.addAllFeaturesAsClass) {
Modernizr.addTest(feature, test);
} else {
test = typeof test === "function" ? test() : test;
if (test) {
Modernizr.addTest(feature, true);
} else {... | [
"function testRunner() {\n var featureNames;\n var feature;\n var aliasIdx;\n var result;\n var nameIdx;\n var featureName;\n var featureNameSplit;\n for (var featureIdx in tests) {\n if (tests.hasOwnProperty(featureIdx)) {\n featureN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the proxy's text content when the default slot changes. | contentChanged(prev, next) {
if (this.proxy instanceof HTMLOptionElement) {
this.proxy.textContent = this.textContent;
}
this.$emit("contentchange", null, { bubbles: true });
} | [
"function onSetDefault(idx) {\n Y.log('Setting default item: ' + idx, 'info', NAME);\n dcList.selected = idx;\n renderItems();\n callWhenChanged(Y.dcforms.listToString(dcList));\n }",
"swapPlaceholder(newText) {\n\n\t}",
"setTextContent(text... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This code is governed by the BSD license found in the LICENSE file. / info: > Using "try" with "catch" or "finally" statement within/without a "switch" statement es5id: 12.14_A15 description: Insert try/catch/finally to switch statement CHECK1 | function SwitchTest1(value){
var result = 0;
try{
switch(value) {
case 1:
result += 4;
throw result;
break;
default:
result += 32;
break;
case 4:
result += 64;
throw "ex";
}
return result;
}
catch(e){
if ((value===1)&&(... | [
"visitTryStatement(node){\r\n var key = this.addToCFG(node);\r\n this.node_stack[this.current_class][this.current_function].push(key);\r\n this.visit(node.block);\r\n this.catch_clauses[this.current_class][this.current_function][key] = this.nodeStr(node.handler);\r\n this.visit(no... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test_password_decrypt No inputs No return value Tests the password_decrypt function using test inputs and expected outputs found in passworddecrypttests.txt, raising an assertion failure if a test fails, or outputting a success message to the console otherwise. | function test_password_decrypt(){
var tests, test_case_num, test_case, input_str, input_shift, output_str;
jQuery.get('password-decrypt-tests.txt', function(data) {
tests = data.split("\n");
for (test_case_num = 0; test_case_num < tests.length; test_case_num++){
test_case = tests[test_case_num].split(... | [
"function test_password_encrypt(){\n var tests, test_case_num, test_case, input_str, input_shift, output_str;\n jQuery.get('password-encrypt-tests.txt', function(data) {\n tests = data.split(\"\\n\");\n for (test_case_num = 0; test_case_num < tests.length; test_case_num++){\n test_case = tests[test_cas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate tile by tiled file | function generateByTiledFile(newTile, leftSeedTile, rightSeedTile, fileName) {
// console.log('generateByTiledFile' + [newTile, leftSeedTile, rightSeedTile, fileName].join(', '));
var goRight;
if (leftSeedTile) {
goRight = true;
newTile.leftEdge = leftSeedTile.rightEdge;
newTile.leftHe... | [
"function createTiles(){\n // figure out what tile specific information you need to add\n \n // can add all of the tiles here dynamically (which is useful if you are going to make the number of rows and columns adjustable, however you can also just specify them fixed in the HTML)\n}",
"parseTiles(tds, layer, t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move to the specified slide | moveToSlide( slide) {
console.debug( "dia-show › moveToSlide()", slide);
this.slide = slide != undefined ? slide : null;
} | [
"moveTo( slide, display) {\n console.debug( \"dia-show › moveTo()\", slide, display);\n this.moveToSlide( slide);\n this.moveToDisplay( display);\n }",
"function moveTo(sectionAnchor,slideAnchor){var destiny=getSectionByAnchor(sectionAnchor);if(typeof slideAnchor!=='undefined'){scrollPageAndSlide(sectio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to fit a box | function fitBox(box){var minBoxSize=helpers.findNextWhere(minBoxSizes,function(minBoxSize){return minBoxSize.box===box;});if(minBoxSize){if(box.isHorizontal()){var scaleMargin={left:totalLeftBoxesWidth,right:totalRightBoxesWidth,top:0,bottom:0}; // Don't use min size here because of label rotation. When the labels are ... | [
"function fit(bounds, width, height)\n{\n var topLeft = bounds[0];\n var bottomRight = bounds[1];\n\n var w = bottomRight[0] - topLeft[0];\n var h = bottomRight[1] - topLeft[1];\n\n var hscale = width / w;\n var vscale = height / h;\n\n // pick the smallest scaling factor\n var scale = (hscale < vscale) ? h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
write a tag to disk | saveTag(tag, weaver) {
if (!weaver.indexDir)
throw new Error("Cannot save tag. indexDir is not set on weaver");
// derive the path for the new index file
let tagPath = weaver.indexDir + '/tags/' + tag.key + '.json';
// ensure we haven't already indexed the page
if (fs.existsSync(tagPath)) {
fs.unlink... | [
"function saveTags(id, tags) {\n tags = tags.trim().split(\",\") //turn comma separated list into array\n tags.forEach(tag => {\n insert_tag.run(tag.trim()) //create tag if it doesn't exist\n insert_docTag.run(id, tag) //add tag to document\n });\n}",
"function storeMetaData(metaData, file)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transfer any issues and their comments that exist in GitLab that do not exist in GitHub. | async function transferIssues() {
inform('Transferring Issues');
// Because each
let milestoneData = await githubHelper.getAllGithubMilestones();
// get a list of all GitLab issues associated with this project
// TODO return all issues via pagination
let issues = await gitlabApi.Issues.all({
projectId... | [
"async function transferIssues(owner, repo, projectId) {\n inform(\"Transferring Issues\");\n\n // Because each\n let milestoneData = await getAllGHMilestones(owner, repo);\n\n // get a list of all GitLab issues associated with this project\n // TODO return all issues via pagination\n let issues = await gitla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove the control at the given `index` in the array. | removeAt(index) {
if (this.controls[index])
this.controls[index]._registerOnCollectionChange(() => { });
this.controls.splice(index, 1);
this.updateValueAndValidity();
} | [
"function removeArray(array, index)\n{\n array.splice(index,1)\n}",
"remove(index) {\n if (index < 0 || index >= this.length) {\n return undefined;\n }\n const value = this.get(index);\n this._vec.remove(index);\n this._changed.emit({\n type: 'remove',\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wallet Filtering Helpers (filter wallets based on enterprise) Sets |$rootScope.wallets.all| based if the current enterprise selected is personal | function getPersonalEnterpriseWallets(allWallets) {
return _.pick(allWallets, function(wallet, key) {
return !wallet.data.enterprise;
});
} | [
"function filterItems() {\n //console.log(inspections)\n return inspections.filter(function(inspection) {\n return inspection.address.toLowerCase().indexOf(search.toLowerCase()) !== -1 || inspection.permit_id.toLowerCase().indexOf(search.toLowerCase()) !== -1\n })\n }",
"function appl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removing the current book settings from local storage. | removeSavedSettings() {
if (!this.isSaved())
return false;
localStorage.removeItem(this.settings.bookKey);
return true;
} | [
"function clearStorage() {\n Object.keys(localStorage).filter(function (key) {\n return key.startsWith(options.name);\n }).forEach(function (key) {\n return localStorage.removeItem(key);\n });\n}",
"vaciarLocalStorage() {\n localStorage.clear();\n }",
"function vaciarCarritoLS(){\r\n localStorag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endPoints = contains the starting and destination locations enabledModes = list of names of enabled modes as strings optimizationParameter = "time", "cost", "energy", "style points" optimizationDirection = "up","down" | function findBestMode(endPoints,
enabledModes,
optimizationParameter,
optimizationDirection,
callback)
{
apis.getWalkingDirections(endPoints, function(walkingObject){
console.log("Got walking directions...");
apis.getDrivingDirections(endPoints, functi... | [
"function journeyPlanner(locations, transportMode) {\n // Implement the function body\n}",
"function createWaypoints(result) {\n\n // turn overview path of route into polyline\n var pathPolyline = new google.maps.Polyline({\n path: result.routes[0].overview_path\n });\n\n // get points at inte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the display.view data structure for a given change to the document. From and to are in prechange coordinates. Lendiff is the amount of lines added or subtracted by the change. This is used for changes that span multiple lines, or change the way lines are divided into visual lines. regLineChange (below) register... | function regChange(cm, from, to, lendiff) {
if (from == null) { from = cm.doc.first; }
if (to == null) { to = cm.doc.first + cm.doc.size; }
if (!lendiff) { lendiff = 0; }
var display = cm.display;
if (lendiff && to < display.viewTo &&
(display.updateLineNumbers == nu... | [
"function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================================================ this function returns function for multiple count | function _multiCount(){
//n is integer, no less than 0
var mC=function(n){
//n is integer, no less than 0
if(+n<0){throw new Error('n<0');}
mC.c[n]=(mC.c[n]!==undefined)?mC.c[n]+1:1;
return mC.c;
};
mC.c=[];
mC.reset=function(n){
//n is integer, no less than 0... | [
"function SalesCount(){\n\tvar count = 2;\n\tthis.getCount =function(){\n\t\treturn count;\n\t}\n\treturn function addCount(){\n\t\tcount++;\n\t\tconsole.log(count);\n\t}\n}",
"getCount(callback) {\n let count = {\n active: 0,\n completed: 0,\n total: 0\n }\n\n this.items.forEach(item => {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
scramble the word, being sure to always keep the first and last letters intact. this is important so the text can still be read. | function scrambleWord(word) {
var scrambledWord = '';
// if it's a small word or ~randomness~, don't scramble it
if (word.length < 3 || Math.random() > 1 / 10) {
return word;
}
var a = getRandomInt(1, word.length - 1);
var b = getRandomInt(a, word.length - 1);
scrambledWord += word.... | [
"function swap(text) {\n let words = [];\n text.split(\" \").forEach(word => words.push(switchLetters(word)));\n console.log(words.join(\" \"));\n}",
"function initWord() {\n var ind = randIndex(wordDB.length);\n var randWord = wordDB[ind];\n currentWord = randWord.split('');\n}",
"function genScram... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a linked list from an array | static fromArray(arr) {
if (!Array.isArray(arr)) {
return undefined;
}
let list = new LinkedList();
// build list backwards because that's more efficient
for (let i = arr.length - 1; i >= 0; --i) {
list.pushHead(arr[i]);
}
return list;
} | [
"initializeArray() {\n for (let i = 0; i < this.array.length; i++) {\n this.array[i] = new LinkedList();\n }\n }",
"constructor(element) {\n this.element = element;\n this.next = null;\n }",
"function DoubleLL() {\n this.head = null;\n this.tail = null; \n}",
"function Arra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tracker: 18734 LL DETAILS FLOW SECTION RENDERING IS INCONSISTENT Overriding lockAdjust from comfunc to apply changes to fix this issue only for Line List & Visual Customer Order to minimize the impact of this change. | function lockAdjust()
{
if (dd2obj)
{
// reduce the size of data div 1 if there is horizontal scrolling
/*
* Tracker#: 18734 - LL DETAILS FLOW SECTION RENDERING IS INCONSISTENT
* Can still have scrollbar even though scrollWidth < offsetWidth.
... | [
"function dxGridDebOrderLines_OnEditingStart(e) {\r\n editingIndex = e.component.getRowIndexByKey(e.key);\r\n var grid = $(\"#dxGridDebtorOrderLine\").dxDataGrid('instance');\r\n manageDebCellVisibility(grid);\r\n}",
"function dxGridDebOfferLines_OnEditingStart(e) {\r\n editingIndex = e.component.getR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds the section and displays the template browser | function addSection(id)
{
current_template_index=0;
var sectionID = "section-"+current_section_index;
showSidebarBrowser();
$(".browser-menu-item").each(function(){
$(this).prop("disabled", false);
});
$(".sidebar-browser").attr("id", sectionID);
$(".sidebar-browser").data("template-index", current_... | [
"function addPage(page) {\r\n document.querySelector(\"#pages\").innerHTML += `\r\n <section id=\"${page.slug}\" class=\"page\">\r\n <header class=\"topbar\">\r\n <h2>${page.title.rendered}</h2>\r\n </header>\r\n ${page.content.rendered}\r\n </section>\r\n `;\r\n}",
"showSection() {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
====================================================================== FUNCTION:formatCurrency INPUT: num a number to be formatted as dollars. addDollarSign boolean is true if dollar sign to be added. RETURN: A string containing a formatted currency value in dollars; Returns back the same input if a isNaN is passed. DE... | function formatCurrency(num, addDollarSign) {
var resultStr = "";
var Str = "";
// Return immediately if a null value was passed in
if (num == null) return "0"
// Return immediately if a NaN value was passed in
if (isNaN(num)) return num; // return unchanged
if (num < 0) resultStr = "-"
if (addDollarSign ==... | [
"function formatTableCurrency(num) {\n var resultStr = \"\";\n var Str = \"\";\n var paddedZero = ' 0 '\n\n // Return immediately if a null value was passed in\n if (num == null) return paddedZero;\n\n // Return immediately if a NaN value was passed in\n if (isNaN(num)) return num; // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This translates the arguments from the middleware into graphQL options It provides typings for the integration specific behavior, ideally this would be propagated with a generic to the super class | async createGraphQLServerOptions(req, res) {
return super.graphQLServerOptions({ req, res });
} | [
"function WrapperHandler (){\n\t//settings parameters \n\tthis.database = \"http://tdk3.csf.technion.ac.il:8890/sparql\";\n\tthis.graph_uri = \"http://dbpedia.org\";\n\t//create api\n\tthis.api = new ApiHandler(this);\n\t//setup wrapper\n\tthis.setup();\n}",
"options(params) {\n if(!params) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a ray directon, normal, and the object's index of refraction, compute and return reflectance following the Schlick's approximation | function schlick(rayDirection, normal, ior) {
// TODO: repetitive
let cosi = vec3.dot(rayDirection, normal);
let etaOut = 1;
let etaIn = ior;
if (cosi < 0) {
cosi = -cosi;
} else { // ray hits from inside the object
[etaOut, etaIn] = [etaIn, etaOut]; // swap etaOut and etaIn
}
const eta = etaOut... | [
"function refract(rayDirection, normal, ior) {\n let cosi = vec3.dot(rayDirection, normal);\n let etaOut = 1;\n let etaIn = ior;\n if (cosi < 0) {\n cosi = -cosi;\n } else { // ray hits from inside the object\n [etaOut, etaIn] = [etaIn, etaOut]; // swap etaOut and etaIn\n vec3.negate(normal, normal);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Untracks events from currently tracked window. | untrackWindow() {
if (!this.window) {
return;
}
this.window.removeListener('move', this._movedHandler);
this.window.removeListener('resize', this._resizedHandler);
this.window = undefined;
} | [
"unbindEvents() {\n const document = this.frame.contentWindow.document;\n if (this.arrayOfEvents !== undefined && Array.isArray(this.arrayOfEvents)) {\n this.arrayOfEvents.forEach((event) => {\n document.removeEventListener(event[0], event[1]);\n });\n }\n }",
"removeMouseInteractions()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds an event listener to the stripe elements, to realtime error validation messages. | function error(elementInstance) {
elementInstance.addEventListener('change', function (event) {
let err = document.getElementById('stripe-error');
if (event.error) err.innerHTML = event.error.message;
else err.innerHTML = '';
})
} | [
"function onStripeValidationFailure(error) {\n\n var msg = error.message;\n if (error.type === 'card_error') {\n if (error.code && isFieldAttributableStripeError(error)) {\n msg = 'PLEASE_CORRECT_ERRORS';\n attributeStrip... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
funcion para obtener el pais que selecciona el usuario | function getPais() {
let paisSeleccionado = this.options[slcPais.selectedIndex].value;
choosenPais = paisSeleccionado;
} | [
"function cambioPropuesta(){\n if(controlEdificioYPropuesta())\n return;\n\n reiniciarSelect(\"actividad\");\n actualizarTodo(URLS.actividadesDePropuesta,\"actividad\", \"propuesta\", true);\n}",
"function obtenerValoresProteccion(cod_usuario,cod_inspeccion){\n db.transaction(function (tx) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
export all the cells currently on screen to a save friendly format | function export_cells(){
var copied_cells = [];
for(var i = 0; i<all_cells.length; i++){
var cell_to_copy = all_cells[i];
var new_cell = {};
for(var key in cell_to_copy){
if(key != 'pos' && key != 'image' && key != 'special_func'){ //these things don't export well so skip em
new_cell[key] = cell_to_copy[... | [
"function myexport() {\n \n cursorY=firstLine;\n\n var html=\"\";\n\n while (cursorY+1<height) \n {\n var lineWidth=getDisplayWidth()-1;\n \n lineAsciiCode=screenCharacterArray[cursorY][lineWidth][0];\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
input_keyboard_options_with_one_state function adds the event listener to reset the keyboard option keys to their initial state and switch the virtual keyboard to the given keyboard option. key_array_index parameter: given index for key_array as a number event_type parameter: passed from input function given_virtual_ke... | function input_keyboard_options_with_one_state(key_array_index, event_type, given_virtual_keyboard_option) {
key_array[key_array_index].addEventListener(event_type, function(event) {
if (event_type == "keydown" && document.getElementById("mirrored_textarea") != document.activeElement) {
if (event.key === " " ... | [
"function input_keyboard_options_with_two_states(key_array_index, event_type, given_virtual_keyboard_option, first_state_index, second_state_index) {\r\n\tkey_array[key_array_index].addEventListener(event_type, function(event) {\r\n\t\tif (event_type == \"keydown\" && document.getElementById(\"mirrored_textarea\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validate() THIS CODE IS VERY FRAGILE. Don't edit it without reading the comment below. This function validates that submitted AI code meets the submission requirements. In order to safely run untrusted code, we jump through some hoops. Validate() is run in a sandbox by toString()ing it and passing the string to the san... | function validate() {
try {
/*replaceMe*/
if (!create || typeof create !== 'function') {
return "Submitted AI missing create() method";
}
var submittedClass = "replaceWithClassName";
if (!submittedClass.hasOwnProperty('create') || typeof submittedClass.create !== 'function') {
return "Server Err... | [
"function validateFunction(name,email,website,image,gender,skills){\n var flag=0;\n var str=\"\";\n //validating name\n if(validateName(name)==false)\n {\n flag=1;\n str=str+\"Name is Required \\n\";\n }\n var isEmailEntered=1;\n //validating email \n if(validateEmail(email)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts the last call to an async method return setup | convertLastCallToReturnAsync(...valuesToReturn) {
this.methodReturnSetups.push({
arguments: this.lastCallArgs,
returnValues: valuesToReturn,
isAsync: true,
nextIndex: 0
});
this.calls.pop();
if (this.calls.length > 0) {
this.las... | [
"getReturnForCall() {\n const args = this.lastCallArgs;\n for (const setup of this.methodReturnSetups) {\n const isMatch = this.argumentsMatch(setup.arguments, args);\n if (isMatch === true) {\n const returnValue = setup.returnValues[setup.nextIndex];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called each frame Checks if Pause or End level menu should be prompted | function Update(){
if(inPosition&&Input.GetKeyDown ("e")&&!paused){
if (lootBag.loot>=minLoot){
PromptEndLevelMenu();
} else {
PromptHint2();
}
}
if(Input.GetKeyDown(KeyCode.Escape)&&!paused){
Pause();
}
} | [
"function Resume(){\n\tTime.timeScale=1.0;\n\tpaused=false;\n\tpauseMenu.SetActive(false);\n\tgameManager.SendMessage(\"notInMenu\");\n}",
"function PromptEndLevelMenu(){\n\taudioSrc.Pause();\n\tgameManager.SendMessage(\"inMenu\");\n\tpaused=true;\n\tendLevelMenu.SetActive(true);\n\tvar thisScore = managerScript.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given code text, scan for image urls so they can be preloaded. This is a hack, but it mostly works. This is called before we run the student code, avoiding async imageload problems. maybe: could skip commentedout code maybe: could be smart about loading something just once, but it's pretty harmless as is. | function preloadImages(code) {
var re = /SimpleImage\(\s*("|')(.*?)("|')\s*\)/g;
while (ar = re.exec(code)) {
// Used to screen out data: urls here, but that messed up the .loaded attr, strangely
var url = ar[2];
loadImage(url);
}
} | [
"_decodeOnLoadImage(element){return __awaiter$1(this,void 0,void 0,function*(){const isImageLoaded=BrowserCodeReader$1.isImageLoaded(element);if(!isImageLoaded){yield BrowserCodeReader$1._waitImageLoad(element);}return this.decode(element);});}",
"function imageRenderer(imageCode){\n let calledImageURL = \"\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for putV3ProjectsIdSnippetsSnippetId | putV3ProjectsIdSnippetsSnippetId(incomingOptions, cb) {
const Gitlab = require('./dist');
let defaultClient = Gitlab.ApiClient.instance;
// Configure API key authorization: private_token_header
let private_token_header = defaultClient.authentications['private_token_header'];
private_token_header.apiKey = 'Y... | [
"putV3SnippetsId(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\nprivate_token_header.apiKey = 'YOUR API... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new X500Name. X500 Distinguished Name. | constructor() {
X500Name.initialize(this);
} | [
"static X509DistingishedNameToString(distingishedName) {\n const nameFields = [\n 'commonName',\n 'givenName',\n 'surname',\n 'initials',\n 'localityName',\n 'stateOrProvinceName',\n 'countryName',\n 'organizationName',\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
EVENT ASSOCIATIONS onmouseout="hEvent_HotArea_MouseOut( this );" onmouseover="hEvent_HotArea_MouseOver( this );" onmousedown="hEvent_HotArea_MouseDown( this );" onblur="this.tabIndex=1;" oncontextmenu="hEvent_HotArea2_ContextMenu( this );" | function HotArea1::OnMouseOver(){ hEvent_HotArea_MouseOver( HotArea1 ); } | [
"function onMouseDownEventHandler(e) {\r\n\thandleGraphicsObjAndEventObj(g, e);\r\n\tswitch (drawMode) {\r\n\tcase \"FreeStyle\":\r\n\t\toldX = e.offsetX;\r\n\t\toldY = e.offsetY;\r\n\t\tbreak;\r\n\tcase \"LineStyle\":\r\n\t\tswitch (lineMode.getClickCount()){\r\n\t\tcase lineMode.ZERO_CLICK():\r\n\t\t\tlineMode.se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function kills application by its id | function _killAppInfoById(app) {
if (app.rowData && app.rowData.app_id) {
try {
appInfo = Ti.Tizen.Application.getAppInfo(app.rowData.app_id);
} catch (error) {
_args.showErrorDialog(error, 'Could not call tizen.application.getAppInfo function');
return;
}
Ti.API.info('appInfo.id: ' + appInfo... | [
"function krnKillProcess(pid)\n{ \n _Scheduler.removeFromSchedule(_CPU, parseInt(pid,10));\n}",
"function deactivateApp(timeInSeconds){\n UIATarget.localTarget().deactivateAppForDuration(timeInSeconds);\n}",
"destroy(launchId) {\n const session = this.sessions.get(launchId);\n session === nu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function replaces all "???" wildcards in strToReplace with the corrosponding "num" value translated into a stringword (between zero and twenty) | function replaceWildcard(strToReplace, num) {
// var numArray = ['nul','en','to','tre','fire','fem','seks','syv','otte','ni','ti','elleve','tolv','tretten','fjorten','femten','seksten','sytten','atten','nitten','tyve'];
var numArray = ['nul', 'første', 'andet', 'tredje', 'fjerde', 'femte', 'sjette', 'syvende', ... | [
"function numToText(str){\n var targetNum = Array.from(arguments)[1] || 0;\n\n var numTextObj = {\n 0: 'zero',\n 1: 'one',\n 2: 'two',\n 3: 'three',\n 4: 'four',\n 5: 'five',\n 6: 'six',\n 7: 'seven',\n 8: 'eight',\n 9: 'nine'\n };\n\nif (targ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
evoked when player determines word in chain is invalid | function invalidWord() {
// *** crosses off word
GameDatabase.players[GameDatabase.currentPlayer].removeScore(); // *** update changes score
} | [
"isValidWord() {\n if (this.words.includes(this.wordInput)) {\n this.validWord = true;\n this.wordValidate = 'La palabra se encuentra dentro de la gramatica ingresada'\n } else {\n this.validWord = true;\n this.wordValidate = 'La pala... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialization of events for page name edit button and page delete button. This function is running each time the user move to a new page | function btnActionPageEventHandler () {
var currentBtnPageName = document.getElementById('btnPageName');
var currentBtnDelPage = document.getElementById('btnDelPage');
currentBtnPageName.addEventListener('click', function () {
setValue(currentBtnPageName.dataset.element, currentBtnPageName.dataset.property, cu... | [
"function generateEventForPages() {\n var classname = document.getElementsByClassName(\"pageButton\");\n\n for (var i = 0; i < classname.length; i++) {\n classname[i].addEventListener(\n \"click\",\n function(e) {\n current_page = e.toElement.innerHTML;\n textarea.value = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We parse stack trace from `formattedException`, source map it and return a new string | mapFormattedException(formattedException, transformers) {
return __awaiter(this, void 0, void 0, function* () {
const exceptionLines = formattedException.split(/\r?\n/);
for (let i = 0, len = exceptionLines.length; i < len; ++i) {
const line = exceptionLines[i];
... | [
"function getStackTrace() {\n let stack;\n try {\n throw new Error();\n } catch (e) {\n e.task = task;\n Zone.longStackTraceZoneSpec.onHandleError(\n delegate,\n current,\n target,\n e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get daily usage and production | function updateDailyUsage(){
if (dailyUsageData.consumption.devices){
for (let usageDevice of dailyUsageData.consumption.devices){
updateDeviceDailyUsage({id: usageDevice.id, dailyUsage: (usageDevice.pct/100) * dailyUsageData.consumption.total});
}
}
if (dailyUsageData.production... | [
"function dailySummary() {\n let markup = \"\";\n const day = state.env.curDay;\n\n // update inventory and sales tables\n //state.stock.stock.forEach(el => (markup += inventoryView.renderSale(el)));\n\n if (day > 0) {\n if (markup) inventoryView.renderSales(markup);\n inventoryView.renderDailySummaryHea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when user clicks on dislike button. | function itemDislike(e) {
e.preventDefault();
var itemId = $(e.target).attr("id");
if($.cookie("dislike_" + itemId) == "1") {
undislike(itemId);
} else if($.cookie("like_" + itemId) == "1") {
unlike(itemId);
dislike(itemId);
hide(itemId);
} else {
dislike(itemId);
hide(itemId);
}
} | [
"onUnlikeClick(id){\r\n\t\tthis.props.unlike(id)\r\n\t}",
"unlike() {\n return spPost(Comment(this, \"Unlike\"));\n }",
"function deleteFavori(id, type, element) {\r\r\n jQuery(element).prev().hide();\r\r\n jQuery(element).hide();\r\r\n jQuery.post(\r\r\n swapchic_ajax.ajax_url,\r\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getAppearedLabels Return exist label in current window | function getAppearedLabels(){
var arr = []
for (var i = 0; i<labels.length; i++) {
arr.push(labels[i].name.label);
}
var appearedLabelsUnsort = arr.filter( onlyUnique );
// manually add "treeSphere" and "treeCube" as their names are saved as "vegetation"
appearedLabelsUnsort.push('treeSphere');
appearedLabels... | [
"get hasLabels() {\n return this._hasLabels;\n }",
"labeled() {\n return getLabels(this.grid);\n }",
"function findUnconnectedPreds(label) {\n\t\n\tfor (var j = 0; j < selection.summarization.unconnectedPreds.length; j++) {\n\t\t\t\n\t\tif (selection.summarization.unconnectedPreds[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a repository link is clicked, prevent default click action and alert the repository's information. | function alertRepo(e) {
e.preventDefault();
// Get repo information of the repository link that was clicked.
var $el = $(e.target);
var repo = $el.data("repo");
// Alert the repository's information
alert(
"Owner: " + repo.owner + "\r\n" +
"Name: " + repo.name + "\r\n" +
... | [
"function interceptClickEvent(e) {\n var href;\n var target = e.target || e.srcElement;\n if (target.tagName === 'A') {\n href = target.getAttribute('href');\n\n dd(href, 'href');\n \n exp = href.split('/');\n\n // check if internal domain\n is_internal = false;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
applies a new state and resets the squares values except its positons | resetSquare(square, newState) {
square.directionalCost = "";
square.direction = "";
square.state = newState;
square.parent = "";
square.startDistance = 0;
square.goalDistance = 0;
square.total = 0;
} | [
"resetGrid() {\n this.createGridArray();\n\n // reinitializing the saved start and goal squares\n startSquareIndex = 0;\n goalSquareIndex = this.gridArray.length - 1;\n this.startSquare = this.getSquareByIndex(startSquareIndex);\n this.startSquare.state = start;\n th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endregion This does not need a className on Widgets. Each Class which doesn't need 'b' + constructor.name.toLowerCase() automatically adding to the Widget it's mixed in to should implement thus. | get widgetClass() {} | [
"function Widget() {\n this._m_flags = 0;\n this._m_extra = createExtra();\n this._m_parent = null;\n this._m_layout = null;\n this._m_children = [];\n this._m_disposed = new Signal();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This program is a 'remote' 2Dcollision detector for two balls on linear trajectories and returns, if applicable, the location of the collision for both balls as well as the new velocity vectors (assuming a partially elastic collision as defined by the restitution coefficient). The equations on which the code is based h... | function collision2D(mode, alpha, R, m1, m2, r1, r2, x1, y1, x2, y2, vx1, vy1, vx2, vy2, error) {
let r12,m21,d,gammav,gammaxy,dgamma,dr,dc,sqs,t,dvx2,a,x21,y21,vx21,vy21,pi2,vx_cm,vy_cm;
// ***initialize some variables ****
pi2=2*acos(-1.0);
error=0;
r12=r1+r2;
m21=m2/m1;
x21=x2-x1;
... | [
"function lPaddleCollision() {\n if(ball.xPos - ball.radius/2 < lPaddle.xPos + lPaddle.width && ball.yPos + ball.radius/2 > lPaddle.yPos && ball.yPos + ball.radius/2 < lPaddle.yPos + lPaddle.height && ball.xPos > 0 && ball.xPos < width && ball.yPos > 0 && ball.yPos < height) {\n ball.vx = ball.vx * -1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GeneratePolygonElement will create a polygon element with a limited set of attributes that needs appending points is the list of points that form the vertices of the polygon; fill & opacity are apparent Returns: a fully formed polygon element | function GeneratePolygonElement(points, fill, opacity) {
var apoly=document.createElementNS(svgNS, "polygon");
apoly.setAttributeNS(null, "points", points);
apoly.setAttributeNS(null, 'fill', fill);
apoly.setAttributeNS(null, 'opacity', opacity);
return apoly;
} | [
"function drawSVG_Polygon()\n {\n var polygon = scene.create( { t: \"path\", d:\"polygon points:30,0 60,60 0,60\",\n strokeColor: 0x000000ff, strokeWidth: 2, fillColor: 0xFFFF00ff, parent: bg, x: 50, y: 50} );\n\n return polygon;\n }",
"function createPolygon(pointsArray){\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test whether all the ratings on alert have been submitted or not | function testSubmitted()
{
var total = $('#rateGame-alert-container').find('.rating-submit').length;
var count = 0;
$('#rateGame-alert-container').find('.rating-submit').each(function()
{
if ($(this).text().toLowerCase() == 'submitted') {
count++;
}
})
if (count == total) {
return true;
... | [
"function isAnswersCountValidOnSubmit() {\n var countValues = 0;\n for( var i=0; i < $scope.form.masterAnswers.length; i++ ) {\n if ($scope.form.masterAnswers[i].checked == true) {\n countValues++;\n }\n }\n if (countValues < 2) {\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
helper function, recursively removes the highlights in elements and their childs | function uiWebview_RemoveAllHighlightsForElement(element) {
if (element) {
if (element.nodeType == 1) {
if (element.getAttribute("class") == "uiWebviewHighlight") {
var text = element.removeChild(element.firstChild);
element.parentNode.insertBefore(text,element);
element.... | [
"clearHighlight () {\n this._vizceral.setHighlightedNode(undefined);\n }",
"function clearHighlightsOnPage()\n{\n\tunhighlight(document.getElementsByTagName('body')[0]);\n\tcssstr = \"\";\n\tupdateStyleNode(cssstr);\n\tlastText = \"\";\n}",
"function removeOldHighlights() {\r\n var i, div;\r\n\r\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change contrast of the image | function changeContrast(value) {
Caman("#photo", imgUrl, function (test) {
if (value == 0) {
this.revert();
}
console.log(value - previousValue);
this.contrast(value - previousValue);
previousValue = value;
this.render();
});
} | [
"function contrastFilter ( sourceImageData){\n //calculate contrast factor\n var contrastFactor = (259 * (contrastValue + 255))/(255 * (259 - contrastValue));\n\n //update pixel value\n for(var i=0; i< sourceImageData.data.length; i+=4){\n for(var x=0; x<3; x++){\n sourceImageData.data[i+x] = setNewColo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sort Entries by date | function sortArrayByDate(entries){
for (var i = 0; i < entries.length;i++){
entries[i]['data'].sort(function(a,b){
return new Date(a['date']) - new Date(b['date'] );
});
}
} | [
"sortDates() {\n this.datedRatings = this.datedRatings.sort(compareValues('id', 'desc'))\n }",
"function sortActivitiesByDate() {\n for(let i = 0; i < activities.length; i++) {\n let lowest = i;\n for(let j = i; j < activities.length; j++) {\n if(compareDates(activities[lowes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Orders mentions chronologically: by speech and position within speech. | function orderMentions(a, b) {
return a.section.speech.id - b.section.speech.id || a.i - b.i;
} | [
"order(words){cov_25grm4ggn6.f[7]++;cov_25grm4ggn6.s[40]++;if(!words){cov_25grm4ggn6.b[15][0]++;cov_25grm4ggn6.s[41]++;return[];}else{cov_25grm4ggn6.b[15][1]++;}//ensure we have a list of individual words, not phrases, no punctuation, etc.\nlet list=(cov_25grm4ggn6.s[42]++,words.toString().match(/\\w+/g));cov_25grm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
const enteredValue = prompt("Maximum life for you and the monster?"); let chosenMaxLife = parseInt(enteredValue); | function getMaxLifeValues() {
const enteredValue = prompt("Maximum life for you and the monster?", "100");
const parsedValue = parseInt(enteredValue);
if (isNaN(parsedValue) || parsedValue <= 0) {
throw {
message: "Invalid user input, not a number."
};
}
return parsedValu... | [
"function AskMax()\n{\n let maxlet = prompt(\"what the highest number you want to guess between? (must be higher than 10)\");\n max = ValidateIntegerMax(maxlet);\n\n return max;\n}",
"function getUserInput() {\n var levels = prompt(\"Please select number of levels to display\", \"4\");\n\n levelsTo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The LookupSupportedLocales abstract operation returns the subset of the provided BCP 47 language priority list requestedLocales for which availableLocales has a matching locale when using the BCP 47 Lookup algorithm. Locales appear in the same order in the returned list as in requestedLocales. The following steps are t... | function /* 9.2.6 */LookupSupportedLocales(availableLocales, requestedLocales) {
// 1. Let len be the number of elements in requestedLocales.
var len = requestedLocales.length;
// 2. Let subset be a new empty List.
var subset = new List();
// 3. Let k be 0.
var k = 0;
// 4. Repeat while k <... | [
"async buildLikelyLocaleTable() {\n let localeList = [];\n\n if (process.platform === 'linux') {\n let locales = await spawn('locale', ['-a'])\n .reduce((acc,x) => { acc.push(...x.split('\\n')); return acc; }, [])\n .toPromise()\n .catch(() => []);\n\n d(`Raw Locale list: ${JSON... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Properties: name (string) worn (array of MANouns) | constructor() {
this.name = "yourself"
this.worn = []
} | [
"function man(name) {\n this.name = name;\n this.isMortal = true; //All men are mortal\n}",
"function returnName(people){\n\tvar arrayOfNames = [];\n\tfor (var i = 0; i < people.length; i++){\n\t\tarrayOfNames.push(people[i].name.first + ' ' + people[i].name.last);\n\t}\n\treturn arrayOfNames;\n}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to create textbox and search image for tab container | function CreateSearchPanel(txtBoxId, searchImgId) {
var divAddressPodPlaceHolder = dojo.create("div");
var txtDiv = dojo.create("div");
txtDiv.width = "30px";
//txtDiv.className = "searchBar";
var selectDiv = dojo.create("div");
selectDiv.id="selectDiv";
selectDiv.className = "selectBar";
... | [
"function TabSystem() {\r\n this.input = function(title, type, unit) {\r\n var el = document.createElement(\"div\");\r\n el.style = `\r\n width: fit-content;\r\n height: fit-content;\r\n float: left;\r\n display: block;\r\n margin-bottom: 0.5re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Makes the hold piece table transparent | function clearHoldColor() {
$('#holdTable td').css('background', 'transparent');
} | [
"transparentMarker(){\n\t\tthis.moveableSprites.forEach(moveableFocus =>{\n\t\t\tmoveableFocus.alpha -= 0.7;\n\t\t})\n\t\tthis.hitmarker.forEach(hit =>{\n\t\t\thit.alpha -= 0.2;\n\t\t})\n\t}",
"function clearScreenDithered() {\r\n //\r\n // set all the attribute values\r\n const attr = makeAttribute(my.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=========================================================================== =========================================================================== Get The Last SupplierID From The Database | function getLastRecordData() {
var conn = new mssql.ConnectionPool(dbconfig);
var result = [];
var requst = new mssql.Request(conn);
conn.connect(function (err) {
if (err) {
console.log(err);
return;
}
requst.query("SELECT TOP 1 * FROM Suppliers ORDER BY ... | [
"function getLastGardenId(req, res, next) {\n db.one('SELECT max(id) FROM gardens;')\n .then((data) => {\n let maxid = Number.parseInt(data.max);\n res.gardenid = maxid;\n let user = 1;\n let produce = 1;\n // console.log('id garden is', maxid);\n db.none(`\n INSERT INTO quadrants (gard... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |