query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
return "Hello " + Person } var user="Hi Sufiyan" document.body.innerHTML=greeter(user); /now i convert string into Array its can not change and notify me you are wrong | function greeters(Person) {
return "Hello" + Person;
} | [
"function greeter (name) {\n return \"hoi \" + name + \"!\";\n}",
"function shoutGreetings(array) {\nreturn array.map(elem => \n elem.toUpperCase() + `!`\n)\n}",
"function greetPeople(names) {\n\tconst a = [];\n\tfor (let i = 0; i < names.length; i++) {\n\t\ta.push(\"Hello \" + names[i]);\n\t}\n\treturn a.joi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for postV3ProjectsIdBuildsBuildIdErase | postV3ProjectsIdBuildsBuildIdErase(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 = ... | [
"postV3ProjectsIdBuildsBuildIdArtifactsKeep(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_toke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given acpath = /a/b/c and parentpath = /a/ will return /a/b | function limitToChild(acpath, parentpath) {
if (acpath.indexOf(parentpath) != 0)
return null;
var sub = acpath.substr(parentpath.length);
if (sub[0] == '/')
sub = sub.substr(1);
if (sub.indexOf('/') != -1) {
sub = sub.substr(0, sub.indexOf('/'));
... | [
"function get_path(parent_node) {\n if (parent_node === current_room) {\n //return path\n } else {\n var parent = bfs_parents[parent_node.getName()];\n path.push(parent);\n return get_path(parent);\n }\n }",
"function parentDir (path) {\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the width, height, left and top values of the centered image based on the size of the viewport | function getPositions() {
// Calculate the width, height, top and left values for the image
// Available width and height takes into account space for navigation buttons if in a group
var windowHeight = window.innerHeight || document.documentElement.clientHeight,
windowWidth = window.innerWidth || ... | [
"centreOn() {\r\n let mx, my;\r\n if (typeof arguments[0] === \"number\" && typeof arguments[1] === \"number\") {\r\n mx = constrain(arguments[0], 0, this.SIZE - 1);\r\n my = constrain(arguments[1], 0, this.SIZE - 1);;\r\n } else if (typeof arguments[0] === \"string\") {\r\n if ((arguments[0... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update options from an array of json elements | function updateOptions(option_elems, option_json_arr) {
if (!option_elems || option_elems.length == 0) {
console.warn("No option elements passed!");
return;
}
if (!option_json_arr || option_json_arr.length == 0) {
console.warn("No option objects passed!");
... | [
"function setWidgetOptions($obj, data) { \r\n var exclude = [];\r\n if ($obj.hasClass('dependent-select-last')) {\r\n $obj.next().find('option').each(function(i, option) {\r\n exclude[exclude.length] = parseInt($(option).val());\r\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
private Checks if contract name is valid. Throws exception if not. | function checkContractName(contractName) {
if (!contractName || (typeof contractName !== 'string') || contractName.trim() === '') {
throw new Error('Contract: Contract name: "' + contractName + '" is invalid.');
}
} | [
"checkContract() {\n if (!isDef(this.contract)) {\n throw new Error('Contract not defined. It was probably never deployed');\n }\n }",
"function name_check() {\r\n name_warn();\r\n final_validate();\r\n}",
"function validName(input) {\n return input.length > 0\n }",
"function nameValidat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Backup the default gulp file in case something was changed | _backupSPFXConfig() {
// backup default gulp file;
// Fallback to NodeJS FS Object because otherwise in Yeoman context not possible
fs.renameSync(
this.destinationPath('gulpfile.js'),
this.destinationPath('gulpfile.spfx.js')
);
} | [
"_applyCustomConfig() {\n\n this._backupSPFXConfig();\n\n // Copy custom gulp file to\n this.fs.copy(\n this.templatePath('gulpfile.js'),\n this.destinationPath('gulpfile.js')\n );\n\n // Add configuration for static assets.\n this.fs.copy(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : linkSanXML AUTHOR : James Turingan DATE : January 7, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : PARAMETERS : | function linkSanXML(uptable,lowtable){
var linkStat='';
var linkSanityStat='';
var devFlag = false;
if(globalInfoType == "XML"){
for(var i = 0; i < uptable.length; i++){
linkStat+="<tr>";
linkStat+="<td>"+uptable[i].getAttribute('HostName')+"</td>";
linkStat+="<td>"+uptable[i].getAttribute('ManagementIp'... | [
"function connSanXML(uptable,lowtable){\n\tvar connStat='';\n\tvar connSanityStat='';\n\tvar devFlag = false;\n\tif(globalInfoType == \"XML\"){\n\t\tfor(var i = 0; i < uptable.length; i++){\n\t\t\tconnStat+=\"<tr>\";\n\t\t\tconnStat+=\"<td>\"+uptable[i].getAttribute('HostName')+\"</td>\";\n\t\t\tconnStat+=\"<td>\"+... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetches the value associated with the given key from the hash table Fetch the bucket associated with the given key using the getIndexBelowMax function Find the key, value pair inside the bucket and return the value | retrieve(key) {
// const strKey = typeof key === 'number' ? key.toString() : key;
const index = getIndexBelowMax(key, this.limit);
const bucket = this.storage;
let value;
if (bucket.get(index) !== undefined) { // Verify there's a bucket at index
bucket.get(index).forEach((kvPair) => {... | [
"findMax() { \n if(this.isEmpty()) return Number.MIN_VALUE;\n return this.heap[0];\n }",
"function max(array, key) {\n let best = null;\n let bestValue = null;\n for (let elt of array) {\n let eltValue = key(elt);\n if (bestValue == null || eltValue > bestValue) {\n bestValue = eltV... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given options specified for the calendar's constructor, massages any legacy options into a nonlegacy form. Converts ViewOptionHashes into the ViewSpecificOptions format. | function massageOverrides(input) {
var overrides = { views: input.views || {} }; // the output. ensure a `views` hash
var subObj;
// iterate through all option override properties (except `views`)
$.each(input, function(name, val) {
if (name != 'views') {
// could the value be a legacy View-Option-Hash?
i... | [
"function normaliseCreateOptions(options) {\n var _a, _b;\n // Validate `fileVersion`.\n let fileVersion = (_a = options === null || options === void 0 ? void 0 : options.fileVersion) !== null && _a !== void 0 ? _a : 0x03;\n if (!file_version_1.isValidFileVersion(fileVersion))\n throw new Error(`... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Spawn all child processes that do not depend on another. Processes that need to wait until another has exited will run at that point in time. | function spawnProcesses() {
return Q.all(
childProcesses.map(function ( cp, i ) {
if (!cp.waitOn) {
// We attempt to color the output from each process uniquely to make it
// easier to read the Entry output
var color = CHILD_COLORS[ i % CHILD_COLORS.length ];
return spawn... | [
"kill() {\n children.forEach( (child) => {\n child.stdin.pause();\n child.kill();\n });\n }",
"function countSpawnedProcesses(cb) {\n var pgrep = spawn(\"pgrep\", [spawnedProcessPattern, \"-c\"]);\n pgrep.stdout.on(\"data\", cb);\n }",
"mountChilds(){\n for(let child of this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UPDATING ADMIN SUCCESS RESPONSE FUNCTION | function update_success_response_function(response)
{
show_notification("msg_holder", "success", "Success:", "Admin updated successfully");
fade_out_loader_and_fade_in_form("loader", "updateform");
} | [
"function add_admin_success_response_function(response)\n {\n show_notification(\"msg_holder\", \"success\", \"Success:\", \"Admin added successfully\");\n fade_out_loader_and_fade_in_form(\"loader\", \"form\"); \n $('#form')[0].reset();\n }",
"function postEdittedProfileHandler(rows, r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ProductAllReviewsController for manage product image list | function ProductAllReviewsController($scope, __DataStore, appServices,
$stateParams, __Utils) {
var scope = this;
scope.productID = __globals.getAppJSItem('productID');
// product reviews pagination data start
this.showPaginationData = function(page) {
... | [
"function loadAllProductInShop() {\n Product.getProductLive({ SearchText: '' })\n .then(function (res) {\n $scope.products = res.data;\n });\n }",
"function showReviews() {\n var xmlSource = $(this).parent().find(\"img\").attr('src').replace(\"images\", \"reviews\").r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function for saving a single favorites Parameters: title : string movie title year : string movie year imdbID : string valid imdbID of the movie success : function called if the request succeeds error : function called if the request fails | function saveFavorite(title, year, imdbID, success, error){
let baseUrl = "/favorites";
let params = {"Title":title, "Year":year, imdbID};
baseXHRPost(baseUrl, params, success, error);
} | [
"function AddTitleToList(title_id, list_id){\r\n var bRet = true;\r\n var url = \"\";\r\n var method = \"\";\r\n var data = \"\";\r\n var headers = {};\r\n \r\n var resp_json = {};\r\n \r\n if(list_id != \"\" && title_id != \"\"){\r\n /*Add the title id to the opened list*/\r\n url = \"http://www.imd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks settings for rune's upgrade status | function isUpgradeable(rune) {
if (rune != 'zod' && upgrades[getRuneId(rune) - 1]) {
return true;
}
return false;
} | [
"function upgradeRunes(runeList) {\n let countedRunes = getCounts(runeList, SORT.ASCENDING);\n let logSpans = [];\n $('#hr-upgrade-log').text('');\n Object.keys(countedRunes).forEach((rune) => {\n let nextRune = rune != 'zod' ? getRuneName(getRuneId(rune) + 1) : -1;\n let count = countedRunes[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Responsible for repopulating the searchJSON array with search results | queryJSON(search) {
for (let i = 0; i < this.state.wasteJSON.length; i++) {
if(this.state.wasteJSON[i]['keywords'].includes(search)) {
this.state.searchJSON.push(this.state.wasteJSON[i]);
}
}
} | [
"function createSearchResultsFromJsonArray(jsonObj) {\n var instance, i;\n var searchResults = []; \n for (i = 0; i < jsonObj.data.length; i += 1) {\n instance = new SearchResult(jsonObj.data[i]);\n searchResults.push(instance);\n }\n return searchResults;\n }",
"function search(searchTe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a dummy Call Info Entry | function createCallInfoEntry(){
db.transaction(
function(transaction) {
transaction.executeSql(
'INSERT INTO call_info (patient, assessed, attendant1, attendant1_other, attendant2, attendant2_other, driver, driver_other, ' +
' unit_nb, run_nb, respond, milage_start, milage_end, ' + //13
' code_e... | [
"function createDummyMarkers(user) {\n const userIcon = user.gender == 'M'? 'white' : 'black';\n\n var contentString = `\n <div class=\"\">\n <h5>User datails</h5>\n <ul>\n <li>Name: ${user.name}</li>\n <li>Phone: ${user.phoneNumber}</li> ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Link different states of automata using transition matrix given as parameter T | setTransition(T){
for(var i=0;i<this.nStates;i++){
for(var j=0;j<this.nInputs;j++){
this.stateHolder[i].transitions[this.inputs[j]] = new Array();
for(var k=0;k<T[i][j].length;k++){
if(T[i][j][k] == -1){
this.stateHolder[i].transitions[this.inputs[j]].push(null);
}
else{
... | [
"function createStimuliAndTaskSets(nTrials, blockLetter){\n let targetsArr, congruenciesArr, taskArr, stimArr;\n\n // create arrays for target and task based on congruencies\n congruenciesArr = createCongruencyArray(nTrials, blockLetter);\n taskArr = createTaskArray(nTrials, blockLetter);\n targetsArr = create... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The WriteOutput function is called each time the user enters input. This function eliminates the need for multiple document.write statements. | function WriteOutput(outputStatement) {
document.write("<p>" + outputStatement + "</p>");
} | [
"function displayOutput(out) {\n\t\tdocument.getElementById('output').innerHTML=out;\n\t}",
"function writeln() {\n write.apply(this, arguments);\n output.println();\n}",
"function output(message) {\n const para = document.createElement('p');\n para.innerHTML = message;\n outputDiv.appendChild(pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds a node in the given nodes that has the given nodename and a att with the specified value. Note: this function works from the last child backwards and it will return the first node it finds with the given criteria. | function findNodeWithAtt(nodes, nodeName, att, attValue, checkSameLengthValue){
for(var i = (nodes.length - 1); i >= 0; i--){
var currentNode = nodes[i];
if(currentNode.nodeName == nodeName && currentNode.attributes.getNamedItem(att) != null){
var nodeAttValue = currentNode.attributes.getNamedItem(att).v... | [
"function findNode(label, nodes){\n\tfor (var i = 0; i < nodes.length; i++){\n\t\t//console.log(nodes[i].label,label, nodes[i].label == label);\n\t\tif (nodes[i].label == label) {\n\t\t\treturn nodes[i];\n\t\t}\n\t} \n}",
"function selectItemByAttr(attrName, attrValue, targetList)\n{\n for(var i = 0; i< targetLi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove from Bin: if it is posted by user, only change the binned to false, if it is removed from the unsplash, remove the img object from the set. As per Redis 4.0.0, HMSET is considered deprecated, use hset for multi times. | async function updateImage(id, url, poster_name, description, user_posted, binned){
if(!id) throw `Lack id`;
if(user_posted == undefined) user_posted = true;
if(binned == undefined) binned = false;
if(typeof user_posted == `string`) user_posted = (user_posted == 'true');
if(typeof binned == `string`... | [
"remove(element) {\n this.set.splice(this.set.indexOf(element), 1);\n console.log(\"element removed successfully\");\n }",
"remove(key) {\n let index = Hash.hash(key, this.sizeLimit);\n\n if (\n this.hashTable[index].length === 1 &&\n this.hashTable[index][0][0] === key\n ) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Get Period Game Odds by Date / / The date of the game(s). Examples: 20181120, 20181123. | getPeriodGameOddsByDatePromise(date){
var parameters = {};
parameters['date']=date;
return this.GetPromise('/v3/nhl/odds/{format}/AlternateMarketGameOddsByDate/{date}', parameters);
} | [
"getPreGameOddsByDatePromise(date){\n var parameters = {};\n parameters['date']=date;\n return this.GetPromise('/v3/nhl/odds/{format}/GameOddsByDate/{date}', parameters);\n }",
"getInGameOddsByDatePromise(date){\n var parameters = {};\n parameters['date']=date;\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Displays the webcam. If there are currently objects detected it outlines them and labels them with the name and confidence value. | function running() {
background(0);
if (slider.value() < 1) {
introText();
} else if (slider.value() > 1 && slider.value() < 6) {
background(255);
}
if (videoReady) {
// Display the webcam
let flippedVideo = ml5.flipImage(video);
image(flippedVideo, 50, 50, w - 100, h);
if (slider.v... | [
"show() {\n stroke(0);\n push();\n translate(this.pos.x, this.pos.y);\n rotate(this.heading);\n if (this.best == true) {\n image(bestcarImg, -this.w, -this.h / 4);\n } else image(carImg, -this.w, -this.h / 4);\n pop();\n\n if (showSensorsCheckBox.ch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
EXERCISE 5 Write a function "strivify" which accepts a string. It should add the word "Strive" in front of the given string, but if the given string already begins with "Strive", then it should just return the original string. / WRITE YOUR CODE HERE | function stirvify(string) {
// let newString = string.slice(0,7) === "Strive"? string: "Strive "+ string
return string.startsWith("Strive") ? string : "Strive" + string;
} | [
"function amazingEdabit(str) {\n\treturn !str.includes('edabit') ? str.replace('amazing', 'not amazing') : str;\n}",
"function replaceString(oldS,newS,fullS) \r\n{ \r\n for (var i=0; i<fullS.length; i++) \r\n\r\n { \r\n\tif (fullS.substring(i,i+oldS.length) == oldS) \r\n\t\t{ fullS = fullS.substring... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds default export of ViewPropTypes (the propTypes object expression). | function viewPropTypesResolver(ast, recast) {
let definition;
recast.visit(ast, {
visitAssignmentExpression: function(astPath) {
if (!definition && docgen.utils.isExportsOrModuleAssignment(astPath)) {
definition = docgen.utils.resolveToValue(astPath.get('right'));
}
retur... | [
"function getViewPropTypes() {\n // Finds default export of ViewPropTypes (the propTypes object expression).\n function viewPropTypesResolver(ast, recast) {\n let definition;\n recast.visit(ast, {\n visitAssignmentExpression: function(astPath) {\n if (!definition && docgen.utils.isExportsOrModul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Logout from the server and close if popup window | function logout() {
dialogOff();
if (popup) {
$.get("/Rhythmyx/logout", function(data) {
window.close();
});
} else {
top.document.location.href = '/Rhythmyx/logout';
}
} | [
"function game_logout() {\r\n\t\t\r\n\t\t$.ajax({\r\n\t\t\turl: 'logout.php',\r\n\t\t\tsuccess: function( data ) {\r\n\t\t\t\tif ( data=='0' )\r\n\t\t\t\t\twindow.location = REDIRECT_TO;\r\n\t\t\t\telse\r\n\t\t\t\t\t$( '#hv_alert_wrapper' ).hv_alert( 'show_alert', {\r\n\t\t\t\t\t\t'message': c['error_gm_exit']+' '+... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add section tab disabling Disables the add section tab on any page you like, mainly useful for your userpage (depending on how you have your userpage setup) In order to use it, simply include any HTML element with an ID of disableAddSection such as By [[User:Olipro|Olipro]] | function disableAddSection() {
if( !( addsect = document.getElementById( 'ca-addsection' ) ) || !document.getElementById( 'disableAddSection' ) ) {
return;
}
addsect.parentNode.removeChild( addsect );
} | [
"function _disableSection() {\n\n for (var a in __disableSection) {\n if (__disableSection[a]) {\n var id = '#' + a;\n $(id).remove();\n $('.menu-icon').find('a[href=\"'+id+'\"]').parent().remove();\n }\n }\n\n }",
"function disableAdd() {\n\t$(\"#addButton\").attr(\"disabled... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Is the requested button a link? | function isLink(props) {
// If tag prop is set to `a`, we use a b-link to get proper disabled handling
return Boolean(props.href || props.to || props.tag && String(props.tag).toLowerCase() === 'a');
} // Is the button to be a toggle button? | [
"hasLink() {\n return !!this.link;\n }",
"function nodeInLink(textNode) {\n var curNode = textNode;\n while (curNode) {\n if (curNode.tagName == 'A')\n\t return true;\n else\n\t curNode = curNode.parentNode;\n\t}\n return false;\n}",
"function hasResourceLink(req) {\n\t\tvar link = req.get('L... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
restoreBlock() restores the previous current block; no child elements may be toggled for this operation to succeed | function restoreBlock() {
if (blockStack.length > 0 && !currentBlock.isChildToggled()) {
currentBlock.setIcon(true);
currentBlock = blockStack.pop();
currentBlock.setIcon(false);
resizeCanvas(); // this redraws the screen
return true;
}
... | [
"function saveBlock(block) {\n if (typeof block.setIcon == 'undefined')\n // 'block' is not a block visual\n return;\n if (currentBlock.isChildToggled())\n // block has toggled child\n return;\n currentBlock.setIcon(true);\n blockStack.push(cur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reverses the visibility for all children within the textfield of the bubble | reverseVisibility(){
for(let i = 0; i < this.children[2].children.length; i++){
this.children[2].children[i].visible = !this.children[2].children[i].visible;
}
} | [
"invisible()\n {\n for (let container of this.containers)\n {\n container.children.forEach(object => object[this.visible] = false)\n }\n }",
"function toggleChildrenVisibility() {\n toggleVisibility($(this));\n const children = $(this).children();\n child... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
REMOVEUSERFROMLIST Removes the user from the specified list | function removeUserFromList(listName, userName) {
var curList = getValue(listName,'');
// We add a leading and trailing ;, so that when searching for ;username; to replace will find even the ones at the beginning or end of the string
curList = ';' + curList
// escape the userName and then search for it; th... | [
"function modifyUsers(userlist, add) {\n let newList;\n let oldList;\n\n if (add) {\n oldList = document.getElementById('offline');\n newList = document.getElementById('online');\n } else {\n oldList = document.getElementById('online');\n newList = document.getElementById('of... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ayth2b) verify token... if the token and the request's userid the same. | function checkToken(_token, currentUserId) {
try {
//ayth6) server decodes token and compares the user's userid with the token's decoded userid
//ayth6a) if good then can continue with action
//ayth6b) else ??? return u failed
const token = _token;
// next will keep any fields created
const de... | [
"async function verify( token ) {\n const ticket = await client.verifyIdToken({\n idToken: token,\n audience: CLIENT_ID, \n });\n //En el payload vamos a tener toda la informacion del usuario\n const payload = ticket.getPayload();\n // const userid = payload['sub'];\n // If reques... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Make Scroll loader responsible for skip take / scrollElement insertIntoElement => element to add new content to apiCall => string of the api to call for data scrollTop => bool: true if we should load content based on top scrolled callback => optional function to execute after load | function scrollLoader(scrollElement, insertIntoElement, apiURL, skipStart, take, scrollTop, callback) {
let skip = skipStart;
scrollElement.addEventListener('scroll', (event) => {
let ele = event.target;
let addData = false;
if (scrollTop) {
if (ele.scrollTop === 0) {
... | [
"function handleScroll() {\n const bottomDiff = document.documentElement.offsetHeight - (window.innerHeight + document.documentElement.scrollTop);\n if (bottomDiff > 300) {\n needToHitApi = true;\n return;\n }\n if (needToHitApi) setPage(page => page+1);\n needToHitApi = false;\n }",
"function in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetches video poster (thumbnail) information from Vimeo API | async getThumbnailURL() {
const result = await fetch(this.getVideoInfoURL());
if (result.status < 200 || result.status >= 300) {
throw new Error(`VimeoPreviewImage: Status returned by Vimeo API is ${result.status}, should be 200`);
}
const json = await res... | [
"function imageVideoOfTheDayAjax() {\n\n // used to test img \n // https://apodapi.herokuapp.com/api/?date=2020-06-01\n\n $.ajax({\n url: `https://apodapi.herokuapp.com/api/`,\n method: 'GET'\n }).then((response) => {\n\n // console.log(response.url);\n\n // console.log(respo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
True if on first column | isFirstColumn(): boolean {
return this.getColumnIndex() === 0;
} | [
"isFirstCell(): boolean {\n return this.isFirstRow() && this.isFirstColumn();\n }",
"isFirstRow(): boolean {\n return this.getRowIndex() === 0;\n }",
"function firstColumnMatch(){\n\tif(isEmptyRow(\"square0\", \"square3\",\"square6\")){\n\t\tisEqual(\"#square0\", \"#square3\", \"#square6\");... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
title: Hailstone sequence / type: rosettacode / categories: / difficulty: 2 / description: / The Hailstone sequence of numbers can be generated from a starting positive integer, n by: / If n is 1 then the sequence ends. / If n is even then the next n of the sequence = n/2 / If n is odd then the next n of the sequence =... | function hailstoneSequence () {
const res = [];
// Good luck!
return res;
} | [
"hormonic(n) {\n var value = 0;\n\n while (n > 0) {\n value = value + (1 / n);\n n--\n }\n console.log(' this is the final hormonic value ' + value)\n }",
"function faktorial(n)\r\n{\r\n\tif (n == 0) return 1\r\n\treturn n * faktorial( n - 1 ) // 5 * ( 4 * ( 3 ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a Solid Particle object. Don't create particles manually, use instead the Solid Particle System internal tools like _addParticle() `particleIndex` (integer) is the particle index in the Solid Particle System pool. It's also the particle identifier. `positionIndex` (integer) is the starting index of the particle... | function SolidParticle(particleIndex, positionIndex, model, shapeId, idxInShape, sps, modelBoundingInfo) {
this.idx = 0; // particle global index
this.color = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0); // color
this.position = BABYLON.Vector3.Zero(); // position
this.rotatio... | [
"function ModelShape(id, shape, shapeUV, posFunction, vtxFunction) {\n this.shapeID = id;\n this._shape = shape;\n this._shapeUV = shapeUV;\n this._positionFunction = posFunction;\n this._vertexFunction = vtxFunction;\n }",
"function Particle(initialPo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hides details page and returns to series menu | function sg_hide_details(){
$('#startup-nav-spa').hide('slide', {direction: 'right'}, 250).removeClass('active').find('.active').removeClass('active'); // slide out menu
$('#sg-spa-container').fadeOut(250).removeClass('active').find('.active').removeClass('active'); // fade out spa details pages
} | [
"function sg_hide_series(){\n\t\t$('#startup-nav-series').hide('slide', {direction: 'left'}, 250).find('.active').removeClass('active'); // slide out of view then remove all active from nav bar\n\t\t$('#sg-series-container').fadeOut(250).removeClass('active').find('.active').removeClass('active'); // and fade out s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print all integer multiples of 5, from 512 to 4096. Aterward, also log how many there were. | function PrintandCount() {
var count = 0;
for (var i = 512; i < 4096; i++) {
if(i % 5 == 0){
console.log(i)
count = count + 1
}
}
console.log("number of integers multiple of 5:", count)
} | [
"function multipleOfFive(num){\n return num%5 === 0 \n}",
"function fiveMultiples(arr,start)\r\n{\r\n \r\n if((start*5)<=100) // creating multiples of 5 till '100'\r\n {\r\n \r\n arr.push(start*5);\r\n \r\n return fiveMultiples(arr,start+1); //recursive loop to keep creating multiples of 5 \r\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the global applpication locale | function getLocale () {
return locale
} | [
"function getLocale() {\n try {\n if (Services.prefs.getBoolPref(PREF_MATCH_OS_LOCALE))\n return Services.locale.getLocaleComponentForUserAgent();\n }\n catch (e) { }\n\n try {\n let locale = Services.prefs.getComplexValue(PREF_SELECTED_LOCALE,\n Ci.nsIP... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check the existance of work folder | function dzn_checkFolderExists() {
var output = true;
if (!(DriveApp.getFoldersByName("ARMA FSD Tools").hasNext())) {
SpreadsheetApp.getUi().alert('⊗ WARNING!\n\nThere is no "ARMA FSD Tools" folder on your Drive.\n\nPlease, create it via "FSD Tools" menu');
output = false;
}
return output
} | [
"function checkPath() {\n $scope.alreadyOpen_ws = null;\n var loc = $location.path();\n var index = loc.indexOf('workspace/');\n if (index > -1) {\n var workspaceSubstr = loc.substring(index + 10);\n var lastindex = workspaceSubstr.indexOf('/');\n if (lastindex > -1) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a `comm_info_request` message. Notes Fulfills with the `comm_info_reply` content when the shell reply is received and validated. | requestCommInfo(content) {
let options = {
msgType: 'comm_info_request',
channel: 'shell',
username: this._username,
session: this._clientId
};
let msg = messages_1.KernelMessage.createShellMessage(options, content);
return Private.handleSh... | [
"function handleCustomerNameDialogRequest(request, response) {\n\tconsole.log('entering handleCustomerNameDialogRequest function');\n\n // Determine customer\n var customerInfo = getGdunFromIntent(request);\n\n if (customerInfo.error) {\n // invalid customer. Move to the dialog by prompting to fire ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function that returns a promise that resolves any cities' names after 3 second. After you get names send parallel requests for information about cities. Display the country of the cities. | function getAnyNamesCity() {
return __awaiter(this, void 0, void 0, function* () {
const cities = ['Minsk', 'Moscow', 'Kiev', 'Grodno', 'Brest', 'Orsha'];
return new Promise((resolve) => {
setTimeout(() => resolve(cities), 3000);
});
... | [
"async getCities(country) {\n // get yesterday's date\n const offset = new Date().getTimezoneOffset() * 60000;\n const yesterday = new Date(Date.now() - 86400000 - offset)\n .toISOString()\n .slice(0, -5);\n\n // complete request\n const query = `?country=${country}¶meter=pm25&date_from... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate list of suggested candidates for a given category | function suggest(category, categories) {
// fecth candidate suggestions from dictionary
var candidates = categories[category.toLowerCase()];
// format candidate suggestions according to category template
if (isUpperCase(category)) {
candidates = candidates.map(fun... | [
"function getCategoryList(category) {\n var catList = [];\n self.features.forEach(function(feat, index, array) {\n if (! mrlUtil.arrayContains(catList, feat.category)) {\n catList.push(feat.category);\n }\n });\n return catList;\n }",
"function suggestions(word, wordpool) {\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that gets id for job given title | async function getId(title) {
const result = await
db.query("SELECT id FROM jobs WHERE title = $1", [title]);
return result.rows[0].id;
} | [
"morawareJobID() {\n let reg = /(?<=mw-job-id: )\\d*/\n let jobID = this.msg.match(reg)[0]\n return jobID\n }",
"function getBasemapIdTitle(title) {\r\n var bmArray = basemapGallery.basemaps;\r\n for (var i = 0; i < bmArray.length; i++) {\r\n if (bmArray[i].title === title) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display notification messages to the user in the user notifications area. | function displayUserNotification(type, messages) {
var html = '<div class="alert alert-'+ type + ' alert-dismissable">' +
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true">' +
'×' +
'</button>';
for(var i=0; i<messages.length; i++) {
html += "<div>"+messages[i]+... | [
"function show_notification() {\n Log.info('show_notification');\n chrome.storage.sync.get('notifications', function(data) {\n if (data.notifications && data.notifications === 'on') {\n const opt = {\n type: 'basic',\n title: 'Bunpro',\n message: 'You have new reviews on Bunpro!',\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the value of the node identified by the key taken as argument or null if there is no such node. Input parameters: k : key of the node whose value wants to be retrieved compFunc : function used to compare two keys in the tree tree : binary tree to be searched | function getValue(k, compFunc, tree) {
if (tree == null) {
return null;
}
var curTree = tree;
while(true) {
var compRes = compFunc(k, curTree.key);
if (compRes == 0) { //Match found
return curTree.value;
} else if (compRes == -1) {
if (curTree.left != null) {
curTree = curTree.left;
... | [
"function append(k, val, compFunc, tree) {\n\t\tvar newNode = {\n\t\t\tkey : k,\n\t\t\tvalue : val,\n\t\t\tright : null,\n\t\t\tleft : null\n\t\t}\n\t\t\n\t\tif (tree == null) {\n\t\t\treturn newNode;\n\t\t}\n\t\t\n\t\tvar curTree = tree;\n\t\t\n\t\twhile (true) {\n\t\t\tvar compRes = compFunc(k, curTree.key);\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads game state by unserialising cards | function loadState(state) {
// Clear everything first
reservePile.hiddenStack.splice(0, reservePile.hiddenLength());
reservePile.stack.splice(0, reservePile.getLength());
stacks.forEach(stack => stack.stack.splice(0, stack.getLength()));
piles.forEach(pile => pile.stack.splice(0, pile.getLength()));
const ... | [
"function loadGame() {\r\n\r\n // temp gameStateObject\r\n var gameStateObject = null;\r\n\r\n var tempString = \"\";\r\n // get state object from local storage\r\n tempString = localStorage.getItem(\"GoblinKingGameData\");\r\n\r\n console.log(\"Loaded gamedata: \" + tempString);\r\n\r\n gameSt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transform a path by an operation. | transform(path, operation) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return fn$4(path, p => {
var {
affinity = 'forward'
} = options; // PERF: Exit early if the operation is guaranteed not to have an effect.
if (path.length ===... | [
"transform(ref, op) {\n var {\n current,\n affinity\n } = ref;\n\n if (current == null) {\n return;\n }\n\n var path = Path.transform(current, op, {\n affinity\n });\n ref.current = path;\n\n if (path == null) {\n ref.unref();\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets last main menu item | get lastItem() {
return !this.buttons
? undefined
: this.mainItems[this.mainItems.length - 1];
} | [
"function DDLightbarMenu_GetTopItemIdxOfLastPage()\n{\n\tvar numItemsPerPage = this.size.height;\n\tif (this.borderEnabled)\n\t\tnumItemsPerPage -= 2;\n\tvar topItemIndex = this.NumItems() - numItemsPerPage;\n\tif (topItemIndex < 0)\n\t\ttopItemIndex = 0;\n\treturn topItemIndex;\n}",
"function last() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send temperature measurement command(0xF3) The exe0 command says to return the temp measured when the humidity was read. p21 | function sendTempCmd() {
// console.log("Sending read temperature command...");
sensor.writeBytes(0xe0, [1], function(err) {
if(err) {
console.log("writeBytes: 0xe0: " + err);
}
readTemp(); // No need to wait since it was computed with humidity
});
} | [
"function readTemp() {\r\n\tvar temperature;\r\n\tsensor.read(2, function(err, res) {\r\n\t\tif(err) {\r\n\t\t\tconsole.log(\"readTemp: err: \" + err);\r\n\t\t}\r\n\t\t// console.log(\"readTemp: \" + res);\r\n\t\ttemperature = ((((res[0]<<8) + res[1]) * 175.72) / 65536) - 46.85;\r\n\t\tconsole.log(\"temperature: \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calcula a inversa da matriz | function Inversa(panelId,matrix)
{
matrix= savematriz(panelId,matrix);
var sizes= math.size(matrix)._data;
if(sizes[0]!=sizes[1])
{
alert("A matriz deve ser quadrada para calcular a sua Inversa");
return;
}
matrix= math.inv(matrix);
escreveMatriz(math.size(matrix)._data,panelId,matrix,false);
} | [
"function inv()\n {\n\n let i = undefined ;\n let j = undefined ;\n let k = undefined ;\n let akk = undefined ;\n let akj = undefined ;\n let aik = undefined ;\n\n let r = new Matrix( this.nr , this.nc ) ;\n\n console.log( 'r=' , r ) ;\n\n for( i = 0; i < this.nr; ++i )\n\n for( j = 0; j < this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API void TextDisabled(const char fmt, ...) IM_FMTARGS(1); // shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor(); IMGUI_API void TextDisabledV(const char fmt, va_list args) IM_FMTLIST(1); | function TextDisabled(fmt /*, ...args: any[]*/) { bind.TextDisabled(fmt /*, ...args*/); } | [
"function TextColored(col, fmt /*, ...args: any[]*/) {\r\n bind.TextColored((col instanceof ImColor) ? col.Value : col, fmt /*, ...args*/);\r\n }",
"static set boldLabel(value) {}",
"static set whiteBoldLabel(value) {}",
"function _setTextColors() {\n if (!styles.shepherdThemeTextPrimary) {\n st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private function: Instantiates the fs.watch interface or binds listeners to an existing one covering the same file system entry path string, path to be watched fullPath string, absolute path options object, options to be passed to fs.watch handlers object, container for event listener functions Returns close function | function setFsWatchListener(path, fullPath, options, handlers) {
var listener = handlers.listener;
var errHandler = handlers.errHandler;
var rawEmitter = handlers.rawEmitter;
var container = FsWatchInstances[fullPath];
var watcher;
if (!options.persistent) {
watcher = createFsWatchInstance(
path, ... | [
"function start(watchPath) {\n\n /**\n * Load a file from disk and pipe it down.\n */\n function onServeFile(request, response, pathname) {\n var localFile = path.join(watchPath, pathname);\n\n if (!path.existsSync(localFile)) {\n response.writeHead(404);\n response.end();\n return;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enter a parse tree produced by Java9ParserconditionalOrExpression. | enterConditionalOrExpression(ctx) {
} | [
"addOrExpression() {\n const andExpression = OrExpression.new({\n leftExpression: this.assertionExpression,\n rightExpression: null,\n })\n\n this.assertionExpression = andExpression \n }",
"function ExpressionParser() {\n \t\tthis.parse = function() {\n\t \t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will add the component to the outputText if it is not empty. Parameters: accessibleComponentText: text that will appear on the screen as the output componentType: component type that will be the class and title attribute doMatchingTest: if true, it will run a matching test before attempting to insert the ... | function andiFound(accessibleComponentText,componentType,doMatchingTest){
if(accessibleComponentText!="" && accessibleComponentText !== undefined && accessibleComponentText!=AndiCheck.emptyString){
if(componentType=='legend'){
//prepend
outputText = "<span class='ANDI508-display-"+componentType+"'>"+access... | [
"function matchingTestResult(accessibleComponentText,matchingAgainstObject){\n\t\t\tvar matchFound = false;\n\t\t\taccessibleComponentText = stripHTML(accessibleComponentText); //ignores andiLaser markup\n\t\t\tif(accessibleComponentText == stripHTML(matchingAgainstObject.ariaLabelledby) //ignores andiLaser markup\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes the 2D gameboard array. numCols (number): indicates how many columns the 2D array will have. Takes a number as input and initializes a 2dimensional array to act as the game board to track piece locations. This creates an empty array and pushes into it a number of inner arrays equal to the number passed in. | initialize2dArray(numCols){
let arr = [];
for(let i = 0; i < numCols; i++){
arr.push(new Array(8));
}
return arr;
} | [
"function initBoardArray()\n{\n for(var x = 0; x < boardArraySize; x++){\n boardTiles[x] = [];\n boardTileUsed[x] = [];\n }\n\n boardWidth = -1;\n boardHeight = -1;\n}",
"buildEmptyBoard(dimension) {\n for (let i = 0; i < dimension; i++) {\n this.boardArray.push(new Array(dimens... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parses input text for markdown headers and creates sections based on these | function parseText(header, section) {
let textArray = [];
let indexArray = [];
//get indexes of text breaks into sections based on header
for (let i = 0; i < section.text.length; i++) {
if (section.text.substr(i, header.length) == header && section.text.charAt(i + header.length) != "#" && section.text.... | [
"parse_header(text){\n\t\tconst head=/^(={1,6})(.+?)(={1,6})$/gm,pos=this.pos;\n\t\thead.lastIndex=pos;\n\t\tconst m=head.exec(text);\n\t\t\n\t\tif(m && m.index==pos){\n\t\t\tthis.pos=m.lastIndex;\n\t\t\t\n\t\t\tconst left=m[1],right=m[3];\n\t\t\tlet section,level,content=m[2];\n\t\t\t\n\t\t\tif(content){\n\t\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns a function that calls the passed getSources function for each target in the config and combines the results into a single array of sources for gulp.watch. If any of the sources change, it executes the tasks specified by the tasks argument. Is called at init time when a task to create the watcher is defined, so ... | function forAllTargetsWatch(getSources, tasks) {
return function() {
var src = [];
for (var target in config) {
src = src.concat(getSources(config[target]));
}
watcher = gulp.watch(src, tasks);
watcher.on('change', function(event) {
console.log('file '... | [
"async function listSources( config, files ) {\n let buildable = isHTMLFile,\n copyable = isNotHiddenFile;\n // If a list of files to build is specified then expand\n // the list to include dependencies.\n if( files ) {\n // The ste of copyables is any file on the f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add `hostBindings` to the `TView.expandoInstructions`. | function addHostBindingsToExpandoInstructions(tView, def) {
ngDevMode && assertFirstCreatePass(tView);
const expando = tView.expandoInstructions;
// TODO(misko): PERF we are adding `hostBindings` even if there is nothing to add! This is
// suboptimal for performance. `def.hostBindings` may be null,
... | [
"function bindDynamicKeys(baseObj, values) {\n for (var i = 0; i < values.length; i += 2) {\n var key = values[i];\n if (typeof key === 'string' && key) {\n baseObj[values[i]] = values[i + 1];\n }\n else if (key !== '' && key !== null) {\n // null i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called to show a toast to the user to tell a feature is not yet available. | function featureNotAvailable() {
showNotification('Feature not available yet', {
toast: true,
native: false,
vibrate: true
});
} | [
"function showToastMessage() {\n const toast = localStorage.getItem('showToast');\n if (localStorage.length <= 0) return;\n if (data.shouldShowToast === false) return;\n\n switch (toast) {\n case 'profile-info':\n new Toast('Updated profile info');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
indcpaPackPublicKey serializes the public key as a concatenation of the serialized vector of polynomials of the public key, and the public seed used to generate the matrix `A`. | function indcpaPackPublicKey(publicKey, seed, paramsK) {
var array = polyvecToBytes(publicKey, paramsK);
for (var i = 0; i < seed.length; i++) {
array.push(seed[i]);
}
return array;
} | [
"function encodePublicKey(publicKey) {\n const x = publicKey.getX().toArrayLike(Buffer, \"be\", 32)\n const y = publicKey.getY().toArrayLike(Buffer, \"be\", 32)\n\n return Buffer.concat([x, y]).toString(\"hex\")\n}",
"function indcpaUnpackPublicKey(packedPublicKey, paramsK) {\r\n var publicKeyPolyvec = poly... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the page based on the browser history This function gets invokes in the following scenarios.... On default page load, page reload, on hash change before page navigation | function loadPageFromHistory() {
//Load default page
renderPage(getCurrentPageIdBasedOnHistory());
} | [
"function onHashChange() {\n debug('onHashChange, location=', window.location);\n\n startNavigationFromCurrentLocation().then(\n () => executeNavigationStep('beforeLeave')\n ).then(\n () => executeNavigationStep('beforeEnter').catch(catchStepError)\n ).then(\n setFutureState\n ).then(\n switchPanel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Event handler: display ready. | function onDisplayReady() {
exports.startFromIndex(sozi.location.getFrameIndex());
// Hack to fix the blank screen bug in Chrome/Chromium
// See https://github.com/senshu/Sozi/issues/109
window.setTimeout(display.update, 1);
} | [
"function fireWhenReady(callback) {\n if (!displayOnEvent || slideIsReady) {\n callback();\n } else {\n slideReadyCallbacks.push(callback);\n }\n }",
"function displayLoadingScreenForInitialPageLoad() {\n\t\tdocument.getElementById(\"loading_screen\").style.display = \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filter out the conditional / operator rules in transformation lexicon, only keep the rules which target option code must be set when we do mkt => mfg exploding. | function normalizeLexiconForManufacturingToMarketing(sourceLexicon) {
if (sourceLexicon === TYPES.EXCEPTION_HTTP_REQUEST || sourceLexicon.normalizedForManufacturingToMarketing) {
return sourceLexicon;
}
let lexicon = normalizeLexicon(sourceLexicon);
let optionsInLexicon = lexicon.options;
if... | [
"visitLogical_expression(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function RemoveConditionalsMutation() {\n BaseMutation.call(this, 'RemoveConditionals', ['DoWhileStatement', 'IfStatement', 'ForStatement', 'WhileStatement']);\n}",
"visitUnary_logical_expression(ctx) {\n\t return this.visitChildren(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search for scripts using |query|, expecting no members of allScripts except those given in |expected| in the result. If |expected| is omitted, expect no members of allScripts at all. | function queryExpectOnly(query, expected) {
print();
print("queryExpectOnly(" + uneval(query) + ")");
var scripts = dbg.findScripts(query);
var present = allScripts.filter(function (s) { return scripts.indexOf(s) != -1; });
if (expected) {
expected = expected.map(script);
expected.fo... | [
"function evaluateScripts(selector) {\n if (selector) {\n //run dataScript first always\n jQuery(selector).find(\"input[data-role='dataScript']\").each(function () {\n evalHiddenScript(jQuery(this));\n });\n\n jQuery(selector).find(\"input[name='script']\").each(function ()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function clears the routes added on the mao | function clearRoute(){
routingGroup.removeAll();
} | [
"removeRoutes() {\n this.setRoutes([]);\n }",
"function routesEmpty() {\n fs.copySync(path.join(__dirname, 'assets', 'emptyModule.js'), routesFilePath);\n fs.copySync(path.join(__dirname, 'assets', 'ftlRoutes.js'), path.join(__dirname, 'tmp', 'ftlRoutes.js'));\n fs.rem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that edits user certification | function editCertification(userCertification) {
return new Promise((resolve, reject) => {
dashboardModel.editCertification(userCertification).then((data) => {
resolve({ code: code.OK, message: '', data: data })
}).catch((err) => {
if (err.message === message.INTERNAL_SERVER_ERROR)
re... | [
"async function patchCertificate() {\n const subscriptionId =\n process.env[\"APPSERVICE_SUBSCRIPTION_ID\"] || \"34adfa4f-cedf-4dc0-ba29-b6d1a69ab345\";\n const resourceGroupName = process.env[\"APPSERVICE_RESOURCE_GROUP\"] || \"testrg123\";\n const name = \"testc6282\";\n const certificateEnvelope = {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CONSTRUCTOR :: STRING, > ERROR NOTE :: "data" argument is always cast as STRING: | constructor(msg, data) {
super(msg);
this.data = `${data}`;
} | [
"function objj_string(string) {\n\treturn new _CPString2.default(string);\n}",
"function checkType(str) {\n var obj = {\n datatype: typeof str,\n length: str.length,\n }\n return obj;\n}",
"static string(v) { return new Typed(_gaurd, \"string\", v); }",
"constructor() {\n super(expressionType_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3 UZDUOTIS sukurti funkcija "printMetinisPajamuDydis()" , kuri atspausdina i konsole suma 12 atlyginimu (vienas atlyginimas yra lygus "uzduotis 1" kintamajam "atlyginimas") | function printMetinisPajamuDydis() {
console.log("Metinis atlyginiams " + atlyginimas * 12);
} | [
"function printVardasPavardeAmzius () {\n console.log(\"Vardas:\", vardas, \"Pavardė:\", pavarde, \"Amžius:\", amzius, \"Atlyginimas:\", atlyginimas);\n}",
"function boltPersoane(n) {\n var directie = \"dreapta\";\n var persoana = 1;\n var str = \"\";\n for (var i = 1; i < n; i++) {\n if (i % ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checkEating() Check if the player overlaps the prey and updates health of both | function checkEating() {
// Get distance of player to prey
var d = dist(playerX,playerY,preyX,preyY);
// Check if it's an overlap
if (d < playerRadius + preyRadius) {
// Increase the player health
playerHealth = constrain(playerHealth + eatHealth,0,playerMaxHealth);
// Reduce the prey health
pre... | [
"function checkEating() {\n // Get distance of player to prey\n var d = dist(playerX, playerY, preyX, preyY);\n // Check if it's an overlap\n if (d < playerRadius + preyRadius) {\n // Increase the player health\n playerHealth = constrain(playerHealth + eatHealth / 2, 0, playerMaxHealth);\n // Reduce th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
urlcompletiontoggle is a temporary workaround for the problem that url_completion_use_bookmarks and url_completion_use_history are mutually exclusive. | function url_completion_toggle (I) {
if (url_completion_use_bookmarks) {
url_completion_use_bookmarks = false;
url_completion_use_history = true;
} else {
url_completion_use_bookmarks = true;
url_completion_use_history = false;
}
} | [
"function handleTogglingIcon(url) {\n chrome.storage.sync.get(['auth'], function (result) {\n if (result && result.auth) {\n fetch(config[env].baseUrl + '/api/bookmarks/exists?url=' + encodeURIComponent(url), {\n method: 'GET',\n headers: {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enforces a constraint on a repository based on a relationship contract between models. For example, if a Customer model is related to an Address model via a HasOne relation, then, the relational repository returned by the factory function would be constrained by a Customer model instance's id(s). | function createHasOneRepositoryFactory(relationMetadata, targetRepositoryGetter) {
const meta = resolveHasOneMetadata(relationMetadata);
debug('Resolved HasOne relation metadata: %o', meta);
return function (fkValue) {
// tslint:disable-next-line:no-any
const constraint = { [meta.keyTo]: fkV... | [
"function resolveHasOneMetadata(relationMeta) {\n if (!type_resolver_1.isTypeResolver(relationMeta.target)) {\n const reason = 'target must be a type resolver';\n throw new errors_1.InvalidRelationError(reason, relationMeta);\n }\n if (relationMeta.keyTo) {\n // The explict cast is nee... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add points for build3 | function build3points() {
points += (10 * b3multi);
totalpoints += (10 * b3multi);
} | [
"function build2points() {\n points += (4 * b2multi);\n totalpoints += (4 * b2multi);\n }",
"function build1points() {\n points += (1 * b1multi);\n totalpoints += (1 * b1multi);\n }",
"addPoint() {\r\n var point;\r\n if(this.points.length < this.numpoints) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
intialize message log table | function initializeMessageLogTable()
{
clearTimeout(timeOutMessageLog);
clearMessageLogTable();
maxLogTime=0;
setLog();
} | [
"function dynamoInit() {\n\tlet params = {\n\t\tTableName: logName,\n\t\tKeySchema: [\n\t\t\t{ AttributeName: \"opcode\",\t\tKeyType: \"HASH\" },\n\t\t\t{ AttributeName: \"fulltime\",\tKeyType: \"RANGE\" }\n\t\t],\n\n\t\tAttributeDefinitions: [\n\t\t\t{ AttributeName: \"opcode\", AttributeType: \"S\" },\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In the 'AwaitingConfirm' state, there's one operation the client has sent to the server and is still waiting for an acknowledgement. | function AwaitingConfirm (outstanding) {
// Save the pending operation
this.outstanding = outstanding;
} | [
"function anotherRequestPending() {\n if (requestPending) {\n $scope.lastActionOutcome = $scope.lastActionOutcome + 'Please wait. ';\n return true;\n }\n requestPending = true;\n return false;\n }",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Produces an OpenRTB Banner object for the slot given. | function banner(slot) {
var size = adSize(slot);
return slot.nativeParams || slot.params.video ? null : {
w: size[0],
h: size[1],
battr: slot.params.battr
};
} | [
"newAdSlot(placementName, channel, targeting, adUnitPath, slotSize, sizeMappings) {\n return new Promise(((resolve) => {\n let adSlot;\n window.freestar.queue.push(async () => {\n if (!adUnitPath) {\n const mappedName = await this.getMappedPlacementName(placementName, targeting);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve an short link object by id. | static get(id){
let kparams = {};
kparams.id = id;
return new kaltura.RequestBuilder('shortlink_shortlink', 'get', kparams);
} | [
"static update(id, shortLink){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\tkparams.shortLink = shortLink;\n\t\treturn new kaltura.RequestBuilder('shortlink_shortlink', 'update', kparams);\n\t}",
"static deleteAction(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('sh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Charge function that is called for each node. Charge is proportional to the diameter of the circle (which is stored in the radius attribute of the circle's associated data. This is done to allow for accurate collision detection with nodes of different sizes. Charge is negative because we want nodes to repel. Dividing b... | function charge(d) {
return -Math.pow(d.radius, 2.0) / 8;
} | [
"Charge()\n {\n // Showing relevant UI elements\n this.theReticle.active = false;\n this.thePowerMeter.active = true;\n\n // Charging\n this.currentChargeTime += deltaTime;\n if (this.currentChargeTime >= this.maxChargeTime)\n {\n this.currentChargeTime... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves the Wound Boxes derived stat from the Digimon, necessary as the 'Maximum Wound Boxes' | getWoundBoxesStat () {
return this.derivedStats['Wound Boxes'];
} | [
"buildDerivedStats () {\n\t\tthis.derivedStats['Wound Boxes'] = this.stats.Health + DigimonStages[this.stage].woundBoxes;\n\n\t\tif (Number.isInteger(this.burstIndex)) {\n\t\t\tthis.derivedStats['Wound Boxes'] += this.burstIndex * BurstModifier.woundBoxes;\n\t\t}\n\n\t\tthis.derivedStats['Agility'] = Math.floor((th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: cycle Returns an array of repetitions of the elements in pattern. Parameters: pattern An array. length Length of returned array. Returns: An array of repetitions of the elements in pattern. | static cycle(pattern, length) {
let l = length || 0xffff,
p_l = pattern.length,
arr = [],
c = 0;
while (c < l) {
arr.push(pattern[c % p_l]);
c = c + 1;
}
return arr;
} | [
"function cyclicArray(arr){\n let i=0, \n count =0;\n //create checks to see if arr[0] or i itself are out of bounds of the array, if so exit the loop\n while((i >=0 && arr[i]>=0) || (i <arr.length && arr[i] <arr.length)) {\n //if the count is greater than arr.length-1 that means one element is v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
runFailFountain() this displays the Fountain | function runFailFountain(vector){
push();
failFountain.newCoordinates(vector);
failFountain.Draw();
failFountain.Create();
failFountain.Step();
pop();
} | [
"function createFailFountain() {\n failParticle = {\n size: [cardSize/10,cardSize/8],\n sizePercent: [0.99],\n angle: [80,100],\n speed: [1],\n lifetime: [85],\n color: [\"#7e7ebf\",\"#b9baff\",\"#a8a8ff\", \"#b5c9db\", \"#99d5c7\"],\n rate: [300,150],\n limit: [40],\n dxy: [cardSize/win... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Detail of the Company | function getDetail(){
console.log('Now for each page');
companiesArr = companyListObj.companiesArr;
companyList = companyListObj.companyListBuf;
this.eachThen(companyList, function(res){
console.log('Company: '+res.data.company);
getCompanyDetail.call(this, res.data.businessId);
}).then(function(){
... | [
"show(req, res) {\n Model.Company.findById(req.params.id, {\n })\n .then(function (company) {\n res.status(200).json(company);\n })\n .catch(function (error){\n res.status(500).json(error);\n });\n }",
"async getCompany (team) {\n\t\treturn await this.data.companies.getById(team.get('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a string, analyze its UTF8 bytes. Return the APPROXIMATE number of characters that must be removed to make the length (in bytes) maxByteLen or fewer. (Return 0 if string is already <= maxByteLen.) | function analyzeUTF8(str, maxByteLen)
{
var lengthInBytes = lengthInUTF8Bytes(str);
var excessBytes = lengthInBytes - maxByteLen;
if(excessBytes > 0) {
var coef = lengthInBytes / str.length; // Number of bytes per one character.
return Math.round(excessBytes / coef);
}
return 0;
} | [
"function utf8size(str) {\n return unescape(encodeURIComponent(str)).length;\n}",
"function lengthBytesUTF8(str) {\n var len = 0;\n for (var i = 0; i < str.length; ++i) {\n // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! So decode ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
build an object from key/value pairs: var obj = h$buildObject(key1, val1, key2, val2, ...); note: magic name: invocations of this function are replaced by object literals wherever possible | function h$buildObject() {
var r = {}, l = arguments.length;
for(var i = 0; i < l; i += 2) {
var k = arguments[i], v = arguments[i+1];
r[k] = v;
}
return r;
} | [
"function createMyObject() {\n return{\n foo:'bar',\n answerToUniverse: 42,\n \"olly olly\": 'oxen free',\n sayHello: function(){\n \treturn 'hello';\n }\n };\n}",
"object(...keyValues) {\n const code = ['{']\n for (const [key, value] of keyValues) {\n if (code.len... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get food object from server, depending on the entered value in searchText textfield | function getFood() {
var name=$("#txtSearch").val();
$.get("/search-food/", {name: name, day: man_day}, function(data){
setFood(man_day, data);
});
} | [
"function search() {\n\t\tvar searchVal = searchText.getValue();\n\n\t\tsources.genFood.searchBar({\n\t\t\targuments: [searchVal],\n\t\t\tonSuccess: function(event) {\n\t\t\t\tsources.genFood.setEntityCollection(event.result);\n\t\t\t},\n\t\t\tonError: WAKL.err.handler\n\t\t});\n\t}",
"searchMeal() {\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for converting when symbol is first and the decimal places are rounded to two | function normConv(rate, symbol) {
curPrice = parseFloat(basePrice * rate).toFixed(2);
curDaily = parseFloat(baseChange * rate).toFixed(2);
$price.text(symbol + curPrice);
$daily.text(symbol + curDaily);
} | [
"function SysFmtRoundDecimal() {}",
"function getMoneyFormatted(val){\n return val.toFixed(2);\n }",
"static get ROUNDING_DIGITS() {return 2;}",
"function formatDecimalOdds(odds) {\n\tlet updatedOdds = odds/1000;\n\treturn Number.parseFloat(updatedOdds).toFixed(2);\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts into Entity Table Accepts the following api string format api/create_entity?genBorn=(int)&genDied=(int) Returns Ant_ID | function create_entity(err, client, done, req, res) {
if(err) {
return console.error('error fetching client from pool', err);
}
var reqArr = [req.query.genBorn, req.query.genDied];
client
.query('INSERT INTO "ACSchema"."Entity"( "Gen_Born", "Gen_Died") VALUES ($1, $2) RETURNING "Ant_ID"'... | [
"function do_create() {\n let id;\n // Check if we already have an id or if\n // we need to generate a new one.\n if (null != ent.id$) {\n // Take a copy of the existing id and\n // delete it from the ent object. Do\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
should a language bypass the default patterns? if you call Rainbow.extend() and pass true as the third argument it will bypass the defaults | function _bypassDefaultPatterns(language)
{
return bypass_defaults[language];
} | [
"setDefaultWordlist(language) {\n bip39.setDefaultWordlist(language);\n }",
"function menutoshowlang(){\n}",
"_loadDefaultTextAndVars() {\n\n /**\n * @type {Array}\n */\n let cat;\n\n //go though all categories\n for (let category in this._texts) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load LCP block and/or wait for LCP in default content. | async function waitForLCP() {
// eslint-disable-next-line no-use-before-define
const lcpBlocks = LCP_BLOCKS;
const block = document.querySelector('.block');
const hasLCPBlock = (block && lcpBlocks.includes(block.getAttribute('data-block-name')));
if (hasLCPBlock) await loadBlock(block, true);
document.quer... | [
"function load() {\n Media.log('PluginComponent::load ' + id());\n assert(state() == PluginComponent.State.Unloaded, 'invalid component state');\n assert(pluginMgr.state() == Media.PluginManager.State.Initialized);\n assert(!task || task.pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clear all the node outputs and then set them | function clearAndSetNodeOutputs(activity, node) {
node.clearOutputs();
setNodeOutputs(activity, node);
} | [
"reset(){\n this._input = null;\n this._output = null;\n }",
"function clearOutputs(notebook) {\n if (!notebook.model || !notebook.activeCell) {\n return;\n }\n const state = Private.getState(notebook);\n each(notebook.model.cells, (cell, index) => {\n cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
12. You've finally gotten around to counting the change in your piggy bank. Write a function that accepts four parameters from a user (quarters, dimes, nickels, and pennies). The function should take each number of coins and multiply it times each coin's value. Finally, it should return the total amount of change you h... | function change(quarters, dimes, nickels, pennies) {
var total = quarters + dimes + nickels + pennies;
return total.toFixed(2);
} | [
"function generateCoinChange(amount){\n let quarters = Math.round(amount / 25)\n amount = amount % 25\n let dimes = Math.round(amount / 10)\n amount = amount % 10\n let nickels = Math.round(amount / 5)\n amount = amount % 5\n pennies = amount\n\n console.log(\n `quarters: ${quart... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION NAME : checkPortOfDeviceList2 AUTHOR : Juvindle C. Tina DATE : December 13, 2013 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : check available port PARAMETERS : devPath,devPath2 | function checkPortOfDeviceList2(devPath,devPath2){
getPort(devPath,"source","1000","L1");
getPort(devPath2,"destination","1000","L1");
if(!portflag || !portflag){
getPort(devPath,"source","10000","L1");
getPort(devPath2,"destination","10000","L1");
if(!portflag || !portflag){
getPort(devPath,"source","40000... | [
"function checkPortOfDeviceList(devPath,action){\n\tif(lineName != \"\" && lineName != null && lineName != undefined && (lineName.toLowerCase() == \"ethernet\" || lineType == \"Any\")){\n\t\tgetPort(devPath,action,\"1000\",\"L1\");\n\t\tif(!portflag && action == \"source\"){\n\t\t\tgetPort(devPath,action,\"10-100\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For all the issues in this.props.chart.issues, create the 2 dimentional array of jsons that represents the rows for those issues in the exported excel document. | _generateIssueCells() {
var issueCells = [];
var lanes = {};
for (let i = 0; i < this.props.chart.issues.length; i++){
let issue = this.props.chart.issues[i];
let issueLane = issue.lane;
let issueLaneKey = issueLane.toString();
if (! _.has(lanes, i... | [
"async function createRepositoryIssues({ issues }) {\n const issuesHTML = HtmlBuilder.div()\n .addClass('repository-detail__issues mb-3 border p-3')\n let issueDetailHTML = createIssueDetail({ issue: undefined })\n\n if (!issues || issues.length <= 0) {\n return issuesHTML.append(HtmlBuilder.div(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function adds a new attachment section to the form. It is called when the user clicks the "Attach a file" button... | function addUpload(maxUploads, fileFieldName, descFieldName)
{
nameFile = fileFieldName;
if (typeof descFiledName!="undefined")
nameDesc = descFieldName;
currentUploads++;
if (currentUploads>maxUploads) return;
if (currentUploads==maxUploads)
document.getElementById('addupload').style.visib... | [
"function setAttachButtonHandler() {\n const attachmentButton = document.getElementById('attachmentButton');\n const attachmentInput = document.getElementById('attachmentInput');\n const attachmentSaveA = document.getElementById('attachmentSaveA');\n const deleteImg = document.getElementById('deleteImg'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
color a given string according to a given gradient | function gradientColorText(text, gradient, isBg = false) {
text = text.replace(exports.resetToken, "");
let colorableCount = getColorableCount(text);
let result = "";
let t = 0;
// we walk through the message, skipping any already existing color modifiers
for (let i = 0; i < text.length; i++) {
... | [
"function manyGradientColorText(text, isBg = false, startingColor, ...segments) {\n text = text.replace(exports.resetToken, \"\");\n // determine the length of the entire expression & create the gradients for each segment\n let totalLength = 0;\n let gradients = [];\n let lengths = [];\n for (let ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds rank tally data to private _runoffResultsData at rank_num argument | addTallyDataAtRankNum(data) {
// destructures these values from incoming data
const { tally, is_resovled, least_votes_candidates, most_votes_candidates, rank_num } = data;
// sets rank-specific data (useful for election analytics and results verification)
_runoffResultsData[`rank_${rank_num}_results`] = {
... | [
"function addToRank() {\n rank.push([name, scores]);\n}",
"function ranking() {\n rank.sort(function(a, b) {\n return b[1] - a[1];\n });\n rank.splice(10, rank.length - 10);\n}",
"setRank(rank)\n\t{\n\t\tswitch (rank)\n\t\t{\n\t\tcase'2':\n\t\tcase'3':\n\t\tcase'4':\n\t\tcase'5':\n\t\tcase'6':\n\t\tcase'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render the Line Item elements for each Invoice | renderLineItems(invoiceLineItems) {
if (invoiceLineItems && invoiceLineItems.length) {
return invoiceLineItems.map(({ _id, description, amount }) => {
return (
<li key={_id}>
Item Description: {description} <br />
Item Amount: ${amount}
</li>
);
... | [
"renderInvoices() {\n return (\n <div>\n {this.invoices.map(invoice => (\n <StyledCard key={invoice.id}>\n <CardContent>\n <Typography color=\"textPrimary\">\n Invoice#{invoice.id}\n </Typography>\n <Typography color=\"textSeco... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
stream : ($("home_stream") || $("pagelet_intentional_stream") || $("contentArea")), | get stream() { return ($("home_stream") || $("pagelet_intentional_stream") || $("app_stories") || $("pagelet_wall") || $(main.streamID)); } | [
"function setupStreams() {\n // setup communication to page and plugin\n var pageStream = new LocalMessageDuplexStream({\n name: 'nifty-contentscript',\n target: 'nifty-inpage'\n });\n var pluginPort = extension.runtime.connect({ name: 'contentscript' });\n var pluginStream = new PortStream(pluginPort);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
readonly attribute AUTF8String routingType; | get routingType()
{
return this._routingType;
} | [
"static string(v) { return new Typed(_gaurd, \"string\", v); }",
"function resolveType(aResource,RDF,BMDS)\n{\n\tvar type = getProperty(aResource,\"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\",RDF,BMDS);\n\tif (type != \"\")\n\t\ttype = type.split(\"#\")[1];\n\n\tif (type==\"\")\n\t\ttype=\"Immutable\";\n\tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |