query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
load parameters for the script [TODO] replace with descriptions i.e name 1.0.7 27 July 2012 amended parameterise hard coded values discount item and credit memo | function loadParameters()
{
try
{
journalDeptID = nlapiGetContext().getSetting('SCRIPT', 'custscript_department_intid');
journalSubsidiary = nlapiGetContext().getSetting('SCRIPT', 'custscript_subsidiary_intid');
journalClass = nlapiGetContext().getSetting('SCRIPT', 'custscript_class_intid');
discountIt... | [
"function loadParameters()\r\n{\r\n\ttry\r\n\t{\r\n\t\t\r\n\t\tCOSAccrualID = nlapiGetContext().getSetting('SCRIPT', 'custscript_cos_accrual_intid');\r\n\t\tmedicalSuppliesID = nlapiGetContext().getSetting('SCRIPT', 'custscript_medical_accrual_intid');\r\n\t\t\r\n\t\tsurgeonAccrualID = nlapiGetContext().getSetting(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ensures that the finalized message prefix is at least n bytes long | enforceMinimumPrefixSize(n) {
assert(n >= 0);
assert(!this._minimumPrefixSize); // for simplicity sake
if (n > 0)
console.log("will enforce minimum prefix size of", n, "bytes");
this._minimumPrefixSize = n;
} | [
"function hasMinimalNeededLength(rawMessage) {\n\treturn rawMessage.length > '$IDMSG'.length;\n}",
"function prefixLength (entry) {\n const length = int.encode(entry.byteLength)\n let prefix = new Uint8Array(1)\n\n switch (true) {\n case (int.encode.bytes === 1 && length > 0xfb) : {\n prefix[0] = 0x4c\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a schematic image of all the answers so a user can see illegal patterns in the answers. The image is in the form of an ASCIIart character string. | function makeAnswerImage (answers) {
const height = 15;
const image = Array(height).fill("");
let nextAnswerIndex = 0;
for (;;) {
for (let i = 0; i < height; i++) {
const index = getAnswerIndex(answers[nextAnswerIndex++]);
image[i] += " " + ((index < 0) ? "....." : (".".repeat(index) + "X" + ".".repeat(4... | [
"function display_ascii(image, width, height)\n{\n\tvar characterMap = reverse_string(\" .:-=+*#%@\");\n\t//var characterMap = reverse_string(\"$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\\|()1{}[]?-_+~<>i!lI;:,^`'. \");\n\tvar canv = document.createElement(\"canvas\");\n\tcanv.width = width;\n\tcanv.height = height;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
postNewItems() query to update the stock quantity of an existing product | function postNewItems(itemNum, newQty) {
let query = "UPDATE bamazon.products SET stock_quantity=? WHERE item_id=? ";
bamazon.query(query, [newQty, itemNum], function (err, res) {
if (err) throw (err);
console.log("\n Success! New item(s) added to the inventory\n");
displayAllInv... | [
"function update() {\n var upSyn = `UPDATE products SET stock_quantity = ? WHERE item_id = ?`;\n connection.query(upSyn, [remaining, id], function (err) {\n if (err) throw err;\n\n });\n\n }",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dropzone class mapRequired (bool) determines if the dropzone will implement a map for pinning comments | function dropzoneClass(area, mapRequired, mapArea, addImageButton, titleField, hidePopupsButton) {
//Additional variable to be used in functions
var self = this;
//Assigning the appropriate area
this.area = area;
//Title field, update when file is added
this.screenTitleField = titleField;
... | [
"_enableMapDragging() {\n this.map.dragging.enable();\n }",
"function setMapElement() {\n\n mapElement = $(options.map).get(0);\n\n if (!mapElement) {\n if (options.mapContainerId) {\n mapElement = $(\"#\" + options.mapContainerId + \" .placepicker-map\").get(0);\n }\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given the name of an XML element, returns an array of the values of all elements with that name. E.g., for onetwothree getXmlValues(doc, "a") would return ["one", "three"]. | function getXmlValues(xmlDocument, xmlElementName) {
var elementArray =
xmlDocument.getElementsByTagName(xmlElementName);
var valueArray = new Array();
for(var i=0; i<elementArray.length; i++) {
valueArray[i] =
elementArray[i].childNodes[0].nodeValue;
}
return(valueArray);
} | [
"function getXmlElementsValue(xml, name, itemElementName) {\n const values = [];\n getXmlElements(xml, name).forEach((xmlElement) => {\n const elementValue = getXmlElementValue(xmlElement, itemElementName);\n if (elementValue !== undefined) {\n values.push(elementValue);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function saves the user search data criteria to userSearchObject which is then saved to localStorage. | function saveUserInput(
userSearchValue,
dropDownOption,
bookCheck,
movieCheck,
gameCheck
) {
//Grab the current userSearchObject array and push the new user input into it
userSearchObject.push({
searchText: userSearchValue,
DropDownChoice: dropDownOption,
books: bookChec... | [
"function saveSearch() {\n\n var filters = [];\n self.filters.forEach(function(v, i) {\n var filter = {key: v.key, value: v.value};\n filters.push(filter);\n });\n\n var widgets = [];\n self.widgets.forEach(function(v, i) {\n var widget = { id: v.i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to send a message to the client that the request was invalid. The method will list the incorrect headers in the response header sent back to the client. | function sendBadRequestHeader (badHeaders, socket)
{
// Local Variable Declaration
let resHeader = "";
let headers = [];
// Parse headers
headers = badHeaders.split("\r\n");
// Create the response header
resHeader = "HTTP/1.1 400 Bad Request\r\n";
// Loop through all the... | [
"function _malformedRequest() {\n return res.status(400).send('Data Received is Malformed');\n }",
"function badRequest() {\n\tthis.writeHead(400);\n\tthis.end();\n}",
"function invalidRequest(res, message){\n logger.error(`Inavlid request: ${message}`);\n return res\n .status(400)\n .se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the tool tips on default page | function initializeTooltips() {
// Download document link
$('.download-document').tooltip({
'show': true,
'placement': 'top',
'title': "Download the document"
});
// Delete document link
$('.delete-document').tooltip({
'show': true,
'placement': 'top',
... | [
"function toolTipInit() {\n\t\n\t\t$('.social-icons li a').tooltip({\n\t\t\tplacement: 'top'\n\t\t});\n\t}",
"function attachTooltips() {\n tippy('#wm-home-button', {\n content: 'Go back...'\n });\n \n tippy('#wm-donate-button', {\n content: 'Donate'\n });\n \n tippy('#wm-privac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loading location json to mongoDb | function loadLocationDataToMongo(inputResultToStore) {
OverBillabilityBasedOnLocation.remove({}, function (err) {
if (err) {
console.error("Error in removing data " + err);
} else {
for (var i = 0; i < inputResultToStore.length; i++) {
var overBillabilityBased... | [
"insertFromFile(jsonfile, callback) {\r\n\r\n // gets the db object\r\n let db = database.getDB();\r\n\r\n for(let room of jsonfile){\r\n room.location={\r\n \"type\": \"Point\",\r\n \"coordinates\": [room.long, room.lat]\r\n }\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PROBLEM 2 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ / 2. Add a BorderedCell constructor that makes cells with a border. The top of the cell has dashes across it, as well as the bottom. For the sides, use a "|". Test it by drawing a table with at least 2 rows and 2 columns. | function BorderedCell(text) {
this.text = text.split("\n");
} | [
"function prepareCellBorders(body){for(var rowIndex=0;rowIndex<body.length;rowIndex++){var row=body[rowIndex];for(var colIndex=0;colIndex<row.length;colIndex++){var cell=row[colIndex];if(cell.border){var rowSpan=cell.rowSpan||1;var colSpan=cell.colSpan||1;for(var rowOffset=0;rowOffset<rowSpan;rowOffset++){// set le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test_cluster_graph_by_vm_tag[vsphere65] Polarion: assignee: gtalreja casecomponent: CandU caseimportance: medium initialEstimate: 1/12h pass | function test_cluster_graph_by_vm_tag_vsphere65() {} | [
"function test_tagvis_cluster_and_vm_combination() {}",
"function test_tagvis_tag_cluster_vm_combination() {}",
"function test_cluster_graph_by_host_tag_vsphere65() {}",
"function test_candu_graphs_vm_compare_cluster_vsphere65() {}",
"function test_tagvis_cluster_change() {}",
"function test_tagvis_tag_an... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Will use session storage to get user input | function retrieveInput () {
foodInput = $("#food").val();
let food = sessionStorage;
food.setFood = foodInput;
} | [
"function retrieveInput () {\n foodInput = $(\"#food\").val();\n let food = sessionStorage;\n food.setFood = foodInput;\n}",
"function sStorage() {\r\n let nKey2 = document.getElementById(\"uname\").value;\r\n let eKey2 = document.getElementById(\"email\").value;\r\n let pKey2 = document.getElementByI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Callback function to display the channels of each users | function displayChannels(data) {
$(`#${userName}`).append("<div class='layout col-lg-3 col-md-3 col-sm-12'><div class='user-name'>" + `${data.display_name}` + "</div></div>");
$(`#${userName} div div`).append(`<a target="_blank" href="${data.url}"><img src="${data.logo}"></img></a>`);
$.getJSON(urlStreams, dis... | [
"function getchannels (user){\n\tvar dataChannel={};\n\t$.ajax({\n\t\turl:'https://wind-bow.gomix.me/twitch-api/channels/'+user+'?callback=?',\n\t\tdata:dataChannel,\n\t\tdataType:'jsonp',\n\t\tsuccess: function(dataChannel){\n\t\t \tif (dataChannel['status']===null) {\n\t\t \t\tdataChannel['status']=user\n\n\t\t \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Object: ColorCode, Add syntax In: String path path to the JSON file | function addSyntax(path){
var jsonObject = _load(path);
let jsonKey = Object.keys(jsonObject);
var bold = ""
,color = ""
,type = "";
syntax[jsonKey] = new _Syntax(jsonKey[0]);
for(var i = 0; i < jsonObject[jsonKey].length; i++){
Object.keys(js... | [
"constructor(){\n\t\tthis.colorLookups = JSON.parse(fs.readFileSync('./colors.json', 'utf8'));\n\t\tthis.colorKeys = Object.keys(this.colorLookups);\n\t}",
"function _load(path) {\n var actual_JSON = {};\n _loadJSON(path||'', function(response) {\n try{\n actual_JSON = JSON... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts degrees to radians | function toRadians(degrees){
return degrees * Math.PI / 180;
} | [
"function degreesToRadians(deg){return deg*(Math.PI/180);}",
"function deg2rad(deg){return deg * (Math.PI / 180);}",
"function rad2deg(radians) {\n return radians * 180 / Math.PI;\n}",
"function degToRad(degrees) {\r\n return degrees * Math.PI / 180;\r\n}",
"function degrees_to_radians(degrees)\n{... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
do first select action, if no tab is setted the first tab will be selected. | function doFirstSelect(container, state) {
if (!state) state = $.data(container, 'tabs');
var tabs = state.tabs;
for (var i = 0, len = tabs.length; i < len; i++) {
if (tabs[i].panel('options').selected) {
selectTab(container, i, state);
return;
... | [
"selectFirst() {\n const tabs = this._allTabs();\n const idx = this._getAvailableIndex(0, 1);\n this._selectTab(tabs[idx % tabs.length]);\n }",
"function doFirstSelect(container){\r\n\t\tvar state = $.data(container, 'tabs')\r\n\t\tvar tabs = state.tabs;\r\n\t\tfor(var i=0; i<tabs.length; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new Split. | constructor() {
Split.initialize(this);
} | [
"constructor() {\n super(expressionType_1.ExpressionType.Split, Split.evaluator(), returnType_1.ReturnType.Array, Split.validator);\n }",
"createSplits() {\n if (this.opSplit !== null) {\n this.opSplit.destroy();\n }\n if (this.ioSplit !== null) {\n this.ioSpli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rollback the drag data changes. | function rollbackDragChanges() {
placeElement.replaceWith(scope.itemScope.element);
placeHolder.remove();
dragElement.remove();
dragElement = null;
dragHandled = false;
containment.css('cursor', '');
} | [
"rollback() {\n this.index = this.previous;\n }",
"rollback() {\n if (this.transactional) {\n if (this.cachedData !== null && this.cachedIndex !== null) {\n this.data = this.cachedData;\n this.idIndex = this.cachedIndex;\n this.binaryIndices... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MASTER COPY CONFUSION WARNING: This function lives at conservaround.glitch.me Round x to the nearest r ... that's >= x if e is +1 ... that's <= x if e is 1 MASTER COPY CONFUSION WARNING: This function lives at conservaround.glitch.me | function conservaround(x, r=1, e=0) {
let y = tidyround(x, r)
if (e===0) return y
if (e < 0 && y > x) y -= r
if (e > 0 && y < x) y += r
return tidyround(y, r) // already rounded but the +r can fu-loatingpoint it up
} | [
"function roundBall (x) {\n return (x % 35) >= 17.5 ? parseInt(x / 35) * 35 + 35 : parseInt(x / 35) * 35;\n}",
"function relX(x) {\n\treturn ((x - xo) / gameSize * 100);\n}",
"function roundToNearest(argument) {\n}",
"function roundTrip(rover) {\n//Lets start with X axle\nvar roundTripX = rover.position[0]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========= MUA_SelectSchool ================ PR20200925 | function MUA_SelectSchool(tblRow) {
//console.log( "===== MUA_SelectSchool ========= ");
//console.log( tblRow);
// --- get clicked tablerow
if(tblRow) {
// --- deselect all highlighted rows
DeselectHighlightedRows(tblRow, cls_selected)
// --- highlight clicked row
tbl... | [
"function handleSchoolSelect() {\n API.getTeachersBySchool(schoolRef.current.value)\n .then(res => {\n setTeachersSelect(res.data);\n })\n }",
"function getSchool() {\r\n return $(\"#school-select\").val();\r\n}",
"function setSchool(schl)\n{\n\tthis.school = sc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
extractFrames function extracts each frame from image and store them in frames array at the end emits extractcomplete | function extractFrames(player) {
var canvas = player.canvas;
var ctx = canvas.getContext('2d');
var w = config.width / 5;
var h = config.height / 5;
for(var k = 0; k < images.length; k++){
for(var i = 0; i < 5; i++){
for(var j = 0; j < 5; j++){
... | [
"async _decodeOneFrame()\n {\n let ahead = 0;\n for(ahead = 0; ahead < 2; ++ahead)\n {\n let frame = this.frame + ahead;\n\n // Stop if we don't have data for this frame. If we don't have this frame, we won't\n // have any after either.\n let blob... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3.Write a function shortestWord that works like longestWord, but returns the shortest word instead. | function shortestWord(string){
var array= string.split(' ');
var str1;
var str= array[0];
for (var i= 0; i < array.length; i++){
if(array[i].length < str.length){
str1 = array[i];
}
}
return str1;
} | [
"function shortestWord() {\n // TODO: your code here\n}",
"function shortestWord (str){\n\n \t var arrayStr = string.split(\" \") ; \n \t var shortest = arrayStr[0] ; \n\n \t for (var i=0; i<arrayStr.length; i++){ \n \t \t if(shortest.length > arrayStr[i].length){ \n\n \t \t \t shortest = arrayStr[i] ; \n \t \t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add one or more beta testers to a specific beta group. | function addBetaTesterToBetaGroups(api, id, body) {
return api_1.POST(api, `/betaTesters/${id}/relationships/betaGroups`, {
body,
})
} | [
"function addBetaTestersToBetaGroup(api, id, body) {\n return api_1.POST(api, `/betaGroups/${id}/relationships/betaTesters`, {\n body,\n })\n}",
"function addBetaTesters(skillId, testers, callback) {\n const url = `skills/${skillId}/betaTest/testers/add`;\n const payload = {\n testers,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
LOGIN SLIDE PANEL DIV | function slideLoginForm() {
$("#signupdiv").hide();
$("#logindiv").show();
} | [
"function loginHandler() {\n setDisplayMenu(false);\n setDisplayLogin(true);\n setDisplaySignup(false);\n setDimOverlay(\"dim\");\n }",
"function ui_vkLogin() {\n $messagePanel.hide();\n $songListPanel.hide();\n $loginToVkPanel.show();\n $actionsPanel.hide();\n}",
"function displayLogIn(sho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::CloudFront::Distribution.Origin` resource | function cfnDistributionOriginPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDistribution_OriginPropertyValidator(properties).assertSuccess();
return {
CustomOriginConfig: cfnDistributionCustomOriginConfigPropertyToCloudFormation(propert... | [
"function cfnDistributionS3OriginConfigPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnDistribution_S3OriginConfigPropertyValidator(properties).assertSuccess();\n return {\n OriginAccessIdentity: cdk.stringToCloudFormation(propertie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function updateMenuOverlay: calculates height of navi overlay (desktop only) | function updateMenuOverlay(obj) {
// height to first level underline
var headerHeight = 89;
// get height of open dropdown list
var overlayHeight = obj.closest(".nav-item").find(".dropdown-menu").outerHeight();
// adjust the menulink text if available and return its new height
var addHeight = adjustMenuLink... | [
"function updatePrimaryNavHeight() {\n const {top} = $.one('.mh-frame__inner').getBoundingClientRect()\n if (top > 0) {\n $.one('.mh-nav').style.maxHeight = `calc(100% - ${top}px)`\n } else {\n $.one('.mh-nav').style.maxHeight = '100%'\n }\n}",
"function int_nav_menu_height() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the expense for negative transaction | function updateExpense(amount) {
currentExpense = currentExpense - amount;
expense.innerHTML = `-$ ${currentExpense}`;
} | [
"static updateExpenses(expense) {\n budget.expenseTotalAdd(expense);\n let total_expense = budget.getExpenseTotal();\n let budgetTotal = budget.getBudget();\n\n if(budgetTotal === 0){\n selectors.budget_value.textContent = budgetTotal;\n }\n else if(budgetTotal > 0){\n selectors.budget_v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
National parks FUNCTIONS =============================== Set Timeout | function parkSearchTimeout() {
console.log(parkResults)
$('#image-card').hide();
if (parkResults) {
$('.helper-text').attr('data-success', '');
$('#image-card').show();
} else {
$('#parks').addClass('invalid')
$('.helper-text').attr('data-... | [
"function Timeouts() {}",
"function continueInterventionTimeout(){\n timewaited = timewaited+tmoutwait;\n servletGet(\"InterventionTimeout\", {probElapsedTime: globals.probElapsedTime, destination: globals.destinationInterventionSelector, timeWaiting: timewaited+tmoutwait}, processInterventionTimeoutResult)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
retrieves sound preference data from Local Storage | function getSoundFromLocalStorage() {
// if localStorage exists
if (localStorage.length > 0) {
// retrieve, parse, assign to array of objects
soundChoice = JSON.parse(localStorage.getItem('soundPref'));
} else {
}
return soundChoice;
} | [
"function saveAudioSettings(){\n\tlocalStorage.setItem(\"musicBool\", document.getElementById(\"music\").checked);\n\tlocalStorage.setItem(\"soundBool\", document.getElementById(\"sound\").checked);\n}",
"static getMusic() {\n let musics;\n\n if(localStorage.getItem('musics') === null) {\n mu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
arityGte :: NonNegativeInteger > Type > Boolean | function arityGte(n) {
return function(t) {
return t.arity >= n;
};
} | [
"function isGt(order0) /* (order : order) -> bool */ {\n return (order0 === 3);\n}",
"function css__EXS_ques_(cssPrimitiveType) /* (cssPrimitiveType : cssPrimitiveType) -> bool */ {\n return (cssPrimitiveType === 5);\n}",
"gt(other) { return this.cmp(other) > 0; }",
"function css__GRAD_ques_(cssPrimitive... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Loop through the books array and output the following information about each book: the book number (use the index of the book in the array) the book title author's full name (first name + last name) Example Console Output: Book 1 Title: The Salmon of Doubt Author: Douglas Adams Book 2 Title: Walkaway Author: Cory... | function showAllBooks() {
var bookList = "";
for(var i = 0; i < books.length; i++) {
bookList += "Book # " + (i+1) + "\n" + showBookInfo(books[i]);
} return bookList;
} | [
"function displayBookInfo(books,i){\n console.log(`Book # ${i+1}`);\n console.log(`Title: ${books.title}`);\n console.log(`Author: ${books.author.firstName} ${books.author.lastName}`);\n console.log(\"---\")\n }",
"function displayBooks(arrayofBooks){\n\tvar result = \"\";\n\tvar i ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
use render users with image, name (h3), and phone/email as links, then a horizontal rule | function renderUsers(users) {
users.forEach(function(user) {
var container = document.createElement('div') // creates an empty div for each user
// inserts an image for each user - img found in json file
var img = document.createElement('img')
img.style = "float: left; margin-right: 12px;"
img.src... | [
"function renderUsers(users) {\n users.forEach(function(user) {\n $container.append('<li class=\"list-group-item\"><p>' + user.login + \n '</p><span class=\"badge details\">Details</span><div><img src=' + user.avatar_url +\n '</div><a href=\"'+user.html_url+'\"class=\"btn btn-primary\">Go to Github pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a sortable block is added to another sortable row | onAdd ( e ) {
// Get the row the block was added to
let rowId = e.to.getAttribute ( 'data-id' );
const destRow = this.rows.find ( x => x._id === rowId );
// Get the block
rowId = e.from.getAttribute ( 'data-id' );
const sourceRow = this.rows.find... | [
"function connectSortable() { \n\n\t//\n\t// Drag GROUP handler\n\t//\n\t$('#rowContainer .sortable-column').sortable({\n\t\tconnectWith: [ \"#rowContainer .sortable-column\" //Changement wdgt de colomns\n\t\t , \".widgetContainer .sortable-list\" //Ajout wdgt dans un group\n//\t\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test if a type could potentially allow a value of null or undefined. | function isTypePossiblyNullOrUndefined(type) {
// If this is a union type, then recursively test if any types in the union are
// possibly null/undefined.
if (type.isUnion()) {
return type.types.some(function (aType) { return isTypePossiblyNullOrUndefined(aType); });
}
// NOTE: For the purpo... | [
"function isValueNullOrUndefined(value) {\n return value === void 0 || value === null;\n }",
"function isConstrainedValue(value) {\n\t\treturn value !== undefined && value !== null && value !== 'none';\n\t}",
"function isDefinedAndNotNull(input)\r\n{\r\n if (isDefined(input))\r\n return ((input != null) &... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the marks in the right column | function load_marks() {
try {
ilm_display('');
// Getting user marks column label, trimmed
let input_marks_col_label = document.getElementById('marks_col_label');
console.assert(null !== input_marks_col_label && 'INPUT'===input_marks_col_label.tagName, `INPUT of marks col label not found.`);
ILM_OPT.ma... | [
"loadMarks() {\n this.marksDb = {};\n var markList, toCols;\n if ( this.props.marks === undefined || this.props.marks.trim() === \"\") {\n markList = solentMarks;\n toCols= (x) => { return x};\n } else {\n markList = this.props.marks.trim().split(\"\\n\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fortify unit (or build fortress if engineer) | function fortify()
{
unit.action = UnitAction.Fortify;
unit.movePoints = 0;
unit.update();
} | [
"function fullBuild(e, project) {\n unitTestsJob = unitTests()\n unitTestsJob.run()\n}",
"function unitInit(unit) {\n\tif (u1Info == undefined ||\n\t\t u2aInfo == undefined ||\n\t\t u2bInfo == undefined ||\n\t\t u3aInfo == undefined ||\n\t\t u3bInfo == undefined ||\n\t\t u4Info == undefined) \n\t\t{\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store user details in session storage. Session storage was used to store the user details so as to simulate a typical user login scenario. The user details would be cleared once the browser window is closed. | function saveToSessionStorage() {
const passwordValue = password.value; // Get the password input value
const usernameValue = username.value; // Get the username input value
// The user object holds the username and password
let user = {
username: usernameValue,
password: passwordValue,
};
// Stor... | [
"function saveUserToSessionStorage(user)\n{\n //convert the user to json object\n var userObj = { username: user.getUsername(), name: user.getName(), email: user.getEmail(), password: user.getPassword() };\n \n var userObjString = JSON.stringify(userObj); //converts json object to string\n \n //sa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Will setup FilePond instance when mounted | mounted() {
// exit here if not supported
if (!isSupported) return;
// get pond element
this._element = this.$el.querySelector("input");
// Map FilePond callback methods to Vue $emitters
const options = events.reduce((obj, value) => {
obj[value] = (...args) => {
t... | [
"componentDidMount() {\n // clone the input so we can restore it in unmount\n this._input = this._element.querySelector('input[type=\"file\"]');\n this._inputClone = this._input.cloneNode();\n\n // exit here if not supported\n if (!isSupported) return;\n\n const options = Object.assign({}, this.pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Any logged user can like any totem which will like also the page on facebook | function likeFb(totem_name){
loggr("posting like fb "+totem_name+ " " , "created likefb");
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
FB.api(
"/me/og.likes",
"POST",
{
... | [
"function fbShareAsLike() {\n\t// nebo s obrazkem\n\tFB.ui({\n\t\tmethod: 'share_open_graph',\n\t\taction_type: 'og.likes',\n\t\taction_properties: JSON.stringify({\n//\t\tobject:'http://x51.cz',\n\t\tobject: url_share,\n\t})\n\t}, function(response){\n\t\tconsole.log(response);\n\t});\n}",
"function like_page(){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add all Odd numbers to the queue Remove all numbers that | function runQueue() {
let newQueue = new Queue
oddNumbers.forEach(num => newQueue.enqueue(num))
newQueue.dequeue()
newQueue.peek()
newQueue.length()
newQueue.dequeue()
console.log(newQueue)
} | [
"function collectNumbers (queues, nums) {\n var i = 0;\n for (var digit = 0; digit < 10; digit++) {\n while (!queues[digit].empty ()) {\n nums[i++] = queues[digit].dequeue ();\n }\n }\n}",
"function collect(queues, nums) {\n var i = 0;\n for (var digit = 0; digit < 10; ++digit){\n while... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST to /reply to get a RiveScript reply. | function getReply(req, res) {
// Get data from the JSON post.
var username = req.body.username;
var message = req.body.message;
var vars = req.body.vars;
// Make sure username and message are included.
if (typeof(username) === "undefined" || typeof(message) === "undefined") {
return error(res, "username... | [
"function getReply(req, res) {\n\t// Get data from the JSON post.\n\tvar username = req.body.username;\n\tvar message = req.body.message;\n\tvar vars = req.body.vars;\n\n\t// Make sure username and message are included.\n\tif (typeof(username) === \"undefined\" || typeof(message) === \"undefined\") {\n\t\tretu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inlined / shortened version of `kindOf` from | function miniKindOf(val) {
if (val === void 0) return 'undefined';
if (val === null) return 'null';
var type = typeof val;
switch (type) {
case 'boolean':
case 'string':
case 'number':
case 'symbol':
case 'function':
{
return type;
... | [
"function myTypeof (entity) {\n\n}",
"function miniKindOf(val) {\n if (val === void 0) return 'undefined';\n if (val === null) return 'null';\n var type = typeof val;\n\n switch (type) {\n case 'boolean':\n case 'string':\n case 'number':\n case 'symbol':\n case 'function':\n {\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Yields all buffers of all networks | *buffers() {
for (let network of this.values()) {
for (let buffer of network.buffers.values()) {
yield buffer;
}
}
} | [
"get buffers() {\n return this.request(`${this.prefix}list_bufs`);\n }",
"getBuffers(resources) {\n return Promise.all(\n resources.map((resource) => {\n if (!('url' in resource)) {\n throw new Error(\n 'PenumbraDecryptionWorker.getBuffers(): RemoteResource missing URL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function is for receiving data jobs | function receiveDataJobs(json){
const dataJobs = json;
return {
type: RECEIVE_DATAJOBS,
dataJobs
}
} | [
"function receiveDataJob(json){\n\tconst dataJobDetail = json;\n\treturn {\n\t\ttype: RECEIVE_DATAJOB,\n\t\tdataJobDetail\n\t}\n}",
"function retrieveQueue() {\n\n d3.json(\"/all_live_data\", function (error, allLiveData) {\n\n if (error) throw error;\n\n allLiveData.forEach(function (msg) {\n msg[\"m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mutates object a at most maxAmount times | function mutate(a, maxAmount) {
let amt = randomExt.integer(maxAmount, 0);
let all_props = Object.keys(a);
let tmp = {};
for (let p in a) {
if (a.hasOwnProperty(p))
tmp[p] = a[p];
}
for (let i = 0; i < amt; i++) {
let position = randomExt.integer(0, a.length);
... | [
"updateToNextLimit() {\n const limit = this.nextLimit()\n this.setLimit(limit)\n }",
"regenerateMana(amountToRegenerate){\n\n //Determine maximum\n let maxToRegen = this.props.stats_current.mana - this.props.mana_points;\n\n //If trying to regenerate more than maximum, only... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to get random elements from menu array | function getRandomMenuItems() {
let result = {};
const randomNum = faker.random.number({'min': 0,'max': 3});
for (let i = 0; i < randomNum; i++) {
result[faker.random.number({'min': 1,'max': menu.length})] = '';
}
return Object.keys(result);
} | [
"getRandomMenuItem() {\n const { menu } = this;\n const menuItemNumber = getRandomNumber(menu.length);\n const subMenuItemNumber = getRandomNumber(menu[menuItemNumber].children.length);\n const menuItem = menu[menuItemNumber].children[subMenuItemNumber];\n return {\n title: menuItem.title,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function `minMaxProduct(array)` that returns the product between the largest value and the smallest value in the array. Assume `array` is an array of numbers. Assume an array of at least two numbers. Example minMaxProduct([0,1,2,3,4,5]) => 0 minMaxProduct([5,4,3,2,1]) => 5 minMaxProduct([4,2,5,1,5]) => 25 | function minMaxProduct(array){
var min = array[0];
var max = array[0];
for (var i = 0; i < array.length; i++) {
if (min > array[i]) {
min = array[i];
}
else if (max < array[i]) {
max = array[i];
}
}
return min * max;
} | [
"function minMaxProduct(array) {\n var min = array[0];\n var max = array[0];\n for (var i = 1; i < array.length; i++) {\n if (min > array[i]) {\n min = array[i];\n }\n if (max < array[i]) {\n max = array[i];\n }\n }\n\n return min * max;\n}",
"function minMaxProduct(array){\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Advanced Explosion effect Each particle has a different size, move speed and scale speed. Parameters: x, y explosion center color particles' color | function createExplosion(x, y, color)
{
var minSize = 10;
var maxSize = 30;
var count = 10;
var minSpeed = 60.0;
var maxSpeed = 200.0;
var minScaleSpeed = 1.0;
var maxScaleSpeed = 4.0;
for (var angle=0; angle<360; angle += Math.round(360/count))
{
var particle = new Particle();
partic... | [
"function createExplosion(x, y, color)\r\n {\r\n const minSize = 8;\r\n const maxSize = 30;\r\n const count = 15;\r\n const minSpeed = 80.0;\r\n const maxSpeed = 220.0;\r\n const minScaleSpeed = 1.0;\r\n const maxScaleSpeed = 2.0;\r\n \r\n \r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the base geometry changes, convert it from a buffer geometry if necessary, clean it up, and initialize the subdivision modifier. | set baseGeometry( geometry ) {
// Create this.baseGeometry as cleaned-up copy of input geometry.
if ( geometry.isBufferGeometry ) {
this._baseGeometry = new THREE.Geometry().fromBufferGeometry( geometry );
} else {
this._baseGeometry = geometry;
}
this._baseGeometry.mergeVertices();
this.calcul... | [
"reset() {\n\n\t\tif ( this.WARNINGS ) console.info( 'Reset: initialize subdivision.' );\n\n\t\tthis.activeSubdivisions = 0;\n\n\t\tthis._subdivStructure = this._baseStructure;\n\n\t\tthis.geometry.copy( this._baseGeometry );\n\n\t\t// Initialize vertex weights, for quick updating. Initially, each vertex is solely ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
repeats the procedure above to select the first defender | function selectDefender() {
if (hpAttacker>0){return;}
let fighterID = $(this).attr("id");
$(".defender").append('<div class="title">Defender</div>');
$.each(dads, function(cartoon, dad) {
if (fighterID != dad.id) {
return;
}
$(".defender").append(`<div class="charact... | [
"function selectDefender() {\n if(((playerName!= \"\" && defenderName === \"\" )\t|| gamePausedForAnotherDefender === true) && isGameOver == false && characterClicked!=playerName) {\n\t\t\tdefenderName = characterClicked;\n switch(defenderName){\n \tcase \"luke\":\n \tchar1Arra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove or delete paranthesis from from the first of stack. | pop(){
if(this.top==-1)
{
return -1;
}
else
{
return this.items[this.top--]; //delete the one paranthesis from stack
}
} | [
"function removeParenthese(tokens){\n if(tokens.length > 1 && tokens[0].text === \"(\" && tokens[tokens.length-1].text === \")\"){\n tokens.shift();\n tokens.pop();\n return tokens;\n }\n return tokens;\n}",
"function removeBrackets(token) {\n return token.slice(1, token.length - 1)\n }",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set up all the intervals and the game | function setupIntervals() {
// Periodically check for collisions (instead of checking every position-update)
let ch_co_id = setInterval( function() {
checkCollisions(); // Remove elements if there are collisions
}, 100);
// Update Snowball reload
let rl_sb_id = setInterval (function() {
SNOWBALL_TIM... | [
"function setGameIntervals(){\n intervals.pacmanUpdate = setInterval(updatePositionPacman, 251);\n intervals.ghostUpdate = setInterval(updatePositionGhosts, 333);\n intervals.appleUpdate = setInterval(updatePositionApple, 333);\n intervals.collisionDetection = setInterval(collisionDetection, 40);\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove entity from the database. | remove(entity) {
if (this.contains(entity)) {
const id = this.id(entity);
internal(this).entityToID.delete(entity);
internal(this).idToEntity.delete(id);
}
} | [
"removeEntity(entity) {\n var removedState = entity.getCurrentState();\n entity.addState(removedState);\n }",
"function removeEntity() {\n\t\t\t// console.log(this);\n\t\t\tthis.entity.destroy();\n\t\t\tp.off('pause', this.onPauseHandle);\n\t\t\tp.off('resume', this.onResumeHandle);\n\t\t\tselect... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return game data for a new board, neccessary? | function get_new_gamedata() {
return {
'turn' : 0,
'board' : [-1, -1, -1, -1, -1, -1, -1, -1, -1],
'ended' : false
};
} | [
"getGameData() {\n return {\n d: this._data,\n m: this._moved,\n t: this._taken,\n w: this.winner,\n };\n }",
"function newGameData() {\n var data = {\n 'area': 'shore',\n 'inventory': {\n 'items' : {},\n 'weapons' : {},\n 'armors' : {},... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to filter out sensitive/internal fields from an array of documents. | function filterInternalMatchFields(rawDocs) {
var filteredResults = [];
rawDocs.forEach(function(rawDoc) {
// Skip invalid matches that do not have associated users/offerings
if ((rawDoc.owner && rawDoc.owner._id) && (rawDoc.requester && rawDoc.requester._id) && (rawDoc.offering && rawDoc.offering._id)) {
... | [
"function filterInternalMailFields(rawDocs) {\n var filteredResults = [];\n rawDocs.forEach(function(rawDoc) {\n // Skip invalid mails that do not have a recipient\n if (rawDoc.recipient && rawDoc.recipient._id) {\n filteredResults.push(rawDoc.getPublicObject());\n }\n });\n return filteredResults... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For regions that have multiple IDD prefixes a preferred IDD prefix is returned. | function getIDDPrefix(country, metadata) {
var countryMetadata = new _metadata__WEBPACK_IMPORTED_MODULE_0__["default"](metadata);
countryMetadata.country(country);
if (SINGLE_IDD_PREFIX.test(countryMetadata.IDDPrefix())) {
return countryMetadata.IDDPrefix();
}
return countryMetadata.defaultIDDPrefix();
} | [
"function getIDDPrefix(country, callingCode, metadata) {\n\t var countryMetadata = new Metadata(metadata);\n\t countryMetadata.selectNumberingPlan(country, callingCode);\n\n\t if (SINGLE_IDD_PREFIX.test(countryMetadata.IDDPrefix())) {\n\t return countryMetadata.IDDPrefix();\n\t }\n\n\t return countryMetadat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get day of week | function getDayOfWeek() {
var now = new Date();
var day = now.getDay(); //일요일=0,월요일=1,...,토요일=6
var week = new Array('일','월','화','수','목','금','토');
return week[day];
} | [
"function getDayWeek (day) {\n switch (day) {\n case 0:\n return 'Sun'\n case 1:\n return 'Mon'\n case 2:\n return 'Tue'\n case 3:\n return 'Wed'\n case 4:\n return 'Thu'\n case 5:\n return 'Fri'\n case 6:\n return 'Sat'\n d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draw a square: style can be blank, grid or sliced | function drawSquare(context, size, x, y, colour, style = 'blank') {
context.save();
context.fillStyle = colour;
// outline
context.beginPath();
// context.rect(x, y, size, size);
context.moveTo(x, y);
context.lineTo(x+(size/2), y+(size/2));
context.lineTo(x, y+size);
context.lineTo(x-(size/2), y+(si... | [
"function drawSquare(){\n ctx.fillRect(25, 25, 100, 100);\n ctx.clearRect(45, 45, 60, 60);\n ctx.strokeRect(50, 50, 50, 50);\n }",
"function drawSquare(x, y, size1, size2){\n \n rect(x, y, size1, size2);\n }",
"function square(x, y, size) {\n rect(x, y, size, size)\n }",
"draw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
setStyleSubAttribute([SVGElement] elem, [String] subAttribName, [String] subAttribValue) Adds or replaces subattribute value in the delimited list of styles in the style attribute of an SVG element | function setStyleSubAttribute(elem, subAttribName, subAttribValue)
{
var currentStyle = elem.getAttribute("style");
var nvPairs = currentStyle.split(";");
var styleFound = false;
for(var i = 0; i < nvPairs.length; i++)
{
var nv = nvPairs[i].split(":");
if(nv[0]... | [
"function removeStyleSubAttribute(elem, subAttribName)\n{\n var currentStyle = elem.getAttribute(\"style\");\n \n var nvPairsO = currentStyle.split(\";\");\n var nvPairsN = \"\";\n \n for(var i = 0; i < nvPairsO.length; i++)\n {\n var nv = nvPairsO[i].split(\":\");\n \n if(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check and move every bug in a smooth manner towards fruits. If overlapping, move the slower bug slightly to the right or left as necessary. | function moveBugs() {
for (var i = 0; i < bugs.length; i++) {
var xTranslation;
var yTranslation;
if (fruits.length > 0) {
var fruitNumber = shortestDistance(i);
//Initialize the four approximate corners of the Bug
var bL = bugs[i][3];
var bT = bugs[i][4];
var bR = bugs[i][5];
var bB = bugs[i... | [
"function bugMove() {\n //changes bug location to slightly to the left\n bugLocation -= speed;\n //updates location on screen\n bug.style.left = bugLocation + \"px\";\n //updates bug colliders\n bugCollide = {\n left: bug.getBoundingClientRect().left,\n right: bug.getBoundingClientRe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the Formatter which is used to format the time value. Format is eitehr defined by databinding or the value property, or by users lacale format. The format patterns is defined in LDML Date Format notation. For the output, the use of a style ("short, "medium", "long" or "full") instead of a pattern is preferred, ... | function _getFormatter(oThis) {
var sPattern = "";
var bRelative = false;
var oBinding = oThis.getBinding("value");
var oLocale;
//First check if value is given by binding and if binding type is a instance of sap.ui.model.type.Time
//If yes, we us... | [
"function customFormat(value, formatType, format) {\n if (value === undefined || value === null) return;\n if (!formatType) return;\n\n switch (formatType) {\n case \"time\":\n return format ? dl.format.time(format)(value) : dl.format.auto.time()(value);\n case \"number\":\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Task Write a function named student that has firstname, lastname and email parameters and returns an object containing the passed parameters as properties only. | function student(firstname, lastname, email) {
var newStudent = {}
newStudent.firstname = firstname;
newStudent.lastname = lastname;
newStudent.email = email;
//consider whether you want to use literal or object notation
return newStudent;
//return student
} | [
"function createStudent(stringOne, stringTwo) {\n var functionObj = {\n firstName: stringOne,\n secondName: stringTwo\n };\n return functionObj;\n}",
"function createStudent (fname, lname) {\n return {\n firstName: fName,\n lastName: lName\n };\n}",
"function createStudent (str1, str2) {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assigns hover events to menu buttons | function assignHoverEvents(){
var btns = document.getElementsByClassName('menuBtnNormal');
for (i = 0; i < btns.length; i++){
/*
* mouseover
*/
Event.observe(btns[i], 'mouseover', function(event) {
var elem = Event.element(event);
if (elem.id != MenuDialog.activeMenuId){
elem.className = ... | [
"_setupMouseHoverEvents() {\n this.addEvent({\n type: 'mouse-enter',\n onUpdate: this.processMouseHover.bind(this)\n });\n\n this.addEvent({\n type: 'mouse-move',\n onUpdate: this.processMouseHover.bind(this)\n });\n }",
"function setupMen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate AABB with positions | function generateAABBFromVertices(positions) {
var aabb = new AABB();
var min = fromValues$3(positions[0], positions[1], positions[2]);
var max = fromValues$3(positions[0], positions[1], positions[2]);
for (var i = 3; i < positions.length;) {
var x = positions[i++];
var y = positions[i++];
var z = ... | [
"function generateAABBFromVertices(positions) {\n var aabb = new _shape_AABB__WEBPACK_IMPORTED_MODULE_1__[/* AABB */ \"a\"]();\n var min = gl_matrix__WEBPACK_IMPORTED_MODULE_0__[/* vec3 */ \"e\"].fromValues(positions[0], positions[1], positions[2]);\n var max = gl_matrix__WEBPACK_IMPORTED_MODULE_0__[/* vec3 */ \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
updates verity DID and VerKey by getting it from the verityUrl previously set | async updateVerityInfo () {
try {
const url = new URL(this.verityUrl)
url.pathname = '/agency'
const response = await utils.httpGet(url.href)
this.verityPublicDID = response.DID
this.verityPublicVerKey = response.verKey
} catch (e) {
console.error(e)
throw new Error(`Un... | [
"function updateCodeVersion(response, request){\n\tvar parsedUrl = url.parse(request.url, true);\n\tvar queryObj = parsedUrl.query;\n\tvar version = queryObj.version;\n\tvar newurl = queryObj.url;\n\t\n\tdb.codeVersions.update(\n\t\t\t{\n\t\t\t\tversion : version\n\t\t\t},\n\t\t\t{version:version, url:newurl},\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
changes the appearance of a justified line | function justifyLine (number, derived, answer) {
//the line is now justified, set the justified field to true
currentProblem.steps[number - currentProblem.givens.length - 1].justified = true;
//change the background of the line to show that it's justified
$('#problemLine' + number).removeClass('unjustified').addCl... | [
"function JUSTIFY$static_(){TextAlign.JUSTIFY=( new TextAlign(\"justify\"));}",
"function justifyCenter (row) {\n row = row.trim()\n while (row.length < 39) {\n row = ' ' + row + ' '\n }\n if (row.length !== 40) {\n if (Math.random() < 0.5) {\n row = ' ' + row\n } else {\n row += ' '\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fits the map to the bounds of the passed objects path | function fitMapToBounds(paths) {
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < paths.length; i++) {
for (var j = 0; j < paths[i].length; j++) {
bounds.extend(new google.maps.LatLng(paths[i].getAt(j).lat(), paths[i].getAt(j).lng()));
}
}
mapDiv.fitBounds(bou... | [
"function fitOnPath() {\n if (map !== null) {\n if (pathBounds === null) {\n Excursion.excursionChangeObs.subscribe(function(value) {\n pathBounds = L.geoJson(value.path).getBounds();\n });\n }\n map.fitBounds(pathBounds);\n }\n }",
"fitMap() {\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resovles a variant if it's a variant resolver | function resolveVariant(visualElement, definition, custom) {
if (typeof definition === "string") {
definition = visualElement.getVariant(definition);
}
return typeof definition === "function"
? definition(custom !== null && custom !== void 0 ? custom : visualElement.getVariantPayload(), getC... | [
"function isVariantResolver(variant) {\n return typeof variant === \"function\";\n}",
"function resolveVariant(visualElement, variant, custom) {\n var resolved = {};\n if (!variant) {\n return resolved;\n }\n else if (isVariantResolver(variant)) {\n resolved = variant(custom !== null ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transform XML to HTML using XSLT | function transformDocument(xml, xsl, target) {
var fragment = document.createDocumentFragment();
target.innerHTML = "";
if (window.XSLTProcessor) {
var xslproc = new XSLTProcessor();
xslproc.importStylesheet(xsl);
target.appendChild(xslproc.transformToFr... | [
"function di_xml_xsl_transformation(xmlFile, xsltFile)\n{\n var html = '';\n \n try\n { \n html = di_jq.transform({async:false, xml: xmlFile, xsl: xsltFile});\n }\n catch(err){}\n \n return html;\n}",
"transform(xml, style, meta) {\n \n if (typeof xml === \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Framework to register OAuth providers with passport | function registerProvider(provider, configFunction) {
provider = provider.toLowerCase();
var configRef = "providers." + provider;
if (config.getItem(configRef + ".credentials")) {
var credentials = config.getItem(configRef + ".credentials");
credentials.passReqToCallback = true;
var option... | [
"function addOAuth(protocol, provider){\n var route = ['/oauth', protocol, provider].join('/');\n\n app.get(route, passport.authenticate(provider));\n\n app.get(route+'/error', function(req, res){\n res.status(500).send('An error has occurred'); \n });\n\n /*\n * This gets call... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sort an array of tuples by first value. | function sortTuples(value) {
return value.sort((a, b) => (a[0] > b[0] ? 1 : -1));
} | [
"function sortTuples(value) {\n\t return value.sort(function (a, b) { return a[0] > b[0] ? 1 : -1; });\n\t}",
"function sortTuples(value) {\n\t return value.sort(function (a, b) {\n\t return a[0] > b[0] ? 1 : -1;\n\t });\n\t}",
"function sortByFirstVal(a, b) {\n if (a[0] < b[0]) return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the 'No Image' icon to the image placeholder | function setInitialImage() {
placeImage("img/no-image.jpg");
} | [
"function hideDefaultIcon() {\r\n const icon = document.createElement('img');\r\n const path = '../externals/default_icon.jpg';\r\n icon.setAttribute('src', path);\r\n const canvas = document.getElementById('defaultIcon');\r\n const context = canvas.getContext('2d');\r\n if (icon.compconste) {\r\n context.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Starts reading data from peripheral after BLE has connected to it. | _onConnect () {
this._ble.read(BLEUUID.service, BLEUUID.rxChar, true, this._onMessage);
this._timeoutID = window.setTimeout(
() => this._ble.handleDisconnectError(BLEDataStoppedError),
BLETimeout
);
} | [
"async connect() {\n if (this.state === 'connected') {\n throw new Error('Already connected');\n }\n\n this.fixPowerDropout = createDropoutFilter();\n\n // scan\n this.peripheral = await scan(this.noble, [UART_SERVICE_UUID], this.filter);\n\n // connect\n this.peripheral.on('disconnect', t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to handle add PayPal | function addPayPal() {
$( "#load" ).show();
var dataString = {
paypal_email : $("#paypal_email").val(),
};
$.ajax({
type: "POST",
url: baseurl+"payment/add_paypal",
data: dataString,
dataType: "json",
success: function(data){
$( "#load" ).hide();
if(data.success == true){
... | [
"function createPaypalCart(shopping_cart)\n{\n \n //Remove all the cart items in the PayPal form.\n $(\"#PayPalID[name^='item_name_']\").remove();\n $(\"#PayPalID[name^='amount_']\").remove();\n \n //Loop through the shopping cart items.\n for (var index = 0; index < shopping_cart.length; index++)\n { \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Something about the morph status changed. Update the parameters of all the voices to reflect the change. | function updateMorph() {
var i, N;
if (morphEnabled && morphNeedsUpdate && data.presets.length > 1) {
// Compute morph distances for each preset.
var morphWeights = [], dx, dy, ps;
for (i = 0, N = data.presets.length; i < N; ++i) {
... | [
"onVariantChanged_() {\n // Delay the 'variantchanged' event so StreamingEngine has time to absorb\n // the changes before the user tries to query it.\n const event = this.makeEvent_(conf.EventName.VariantChanged)\n this.delayDispatchEvent_(event)\n }",
"onMorphChange (morph, change) {\n // if (th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a chunk of webpack config containing compatibility tweaks for libraries which are known to cause issues, to be merged into the generated config. Returns null if there's nothing to merge based on user config. | function getCompatConfig(userCompatConfig = {}) {
let configs = [];
Object.keys(userCompatConfig).map(lib => {
if (!userCompatConfig[lib]) return;
let compatConfig = COMPAT_CONFIGS[lib];
if ((0, _utils.typeOf)(compatConfig) === 'function') {
compatConfig = compatConfig(userCompatConfig[lib]);
... | [
"mergeCustomConfig() {\n if (Config.webpackConfig) {\n this.webpackConfig = require('webpack-merge').smart(\n this.webpackConfig, Config.webpackConfig\n );\n }\n }",
"function getCompatConfig() {\n var userCompatConfig = arguments.length <= 0 || arguments[0] ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get dataset from clientside database | function clientDB() {
/**
* local cached dataset
* @type {ccm.dataset}
*/
var dataset = checkLocal();
// is dataset local cached? => return local cached dataset
if ( dataset ) return dataset;
/**
* object store from IndexedDB
* @typ... | [
"function clientDB() {\n\n /**\n * Lokaler Datensatz\n * @type {ccm.Dataset}\n */\n var dataset = checkLocal();\n\n // Lokaler Datensatz? => Zurückgeben\n if ( dataset ) return dataset;\n\n /**\n * Objektspeicher\n * @type {object}\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save single quiz by id. | SAVE_QUIZ_BY_ID (state, quiz) {
state.quizById = quiz;
} | [
"function saveAnswer(id, data) {\n\n\t\tif(data.id && id != data.id)\n\t\t\treturn Q.reject(new ValidationError('The answer\\'s ID cannot be changed.', {id: {constant: true}}));\n\n\t\t// set the ID\n\t\tdata.id = id;\n\n\t\t// validate against schema\n\t\tvar err = validator.validate(schema.id, data, {useDefault: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function used to show manage popup tag Author: Sunny Patial Date: 5,Aug 2013 version: 1.0 | function showManagePopup(){
$("#tags-menu-popUp").hide();
$("#groups-menu-popUp").hide();
$(".quickview-outer").css("display","none");
// $(".quickview").html("");
$(".manage-pop").css("display","block");
$(".manage-pop-outer").fadeToggle();
$(".quickview-outer-second quickview-outer").hide();
$("#tag-manage-o... | [
"function helpModLvl(hrefTarget) { \n //Set local Variables\n var name, width, height;\n name = \"helpModLvl\"; \n width = \"463\";\n height = \"500\";\n // Pop up the window\n popWindow(hrefTarget, name, width, height, resizable = \"yes\");\n}",
"function showTerminatedPopup() {\n if (is... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The ORIGINAL "1.0" version of renderDataStructures, which renders variables and values INLINE within each stack frame without any explicit representation of data structure aliasing. This version was originally created in January 2010 | function renderDataStructuresVersion1(curEntry, vizDiv) {
// render data structures:
$(vizDiv).empty(); // jQuery empty() is better than .html('')
// render locals on stack:
if (curEntry.stack_locals != undefined) {
$.each(curEntry.stack_locals, function (i, frame) {
var funcName = htmlspecialchars(... | [
"function renderDataStructuresVersion2(curEntry, vizDiv) {\n\n // before we wipe out the old state of the visualization, CLEAR all\n // the click listeners first\n $(\".stackFrameHeader\").unbind();\n\n // VERY VERY IMPORTANT --- and reset ALL jsPlumb state to prevent\n // weird mis-behavior!!!\n jsPlumb.rese... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exit the current room through a door Door can be "U", "D", "L", "R" | function exit(door) {
let verticalOffset = 1;
if (door === "U" || door === "D") verticalOffset = lj.realm.getSize();
currentRoom = currentRoom + roomModifier[door] * verticalOffset;
lj.realm.enterRoom(currentRoom);
// Fade scene
// When exiting hero is also entering the next room (or realm)... | [
"exitRoom () {\n var myDoor = this.currentRoom.doors[this.door];\n this.previousRoom = this.roomsJSON[this.currentRoom.name];\n \n this.enableInput(false);\n\n // use exit animation if present\n if (myDoor.animation.exit) {\n\n this.exitRoomAnimation();\n\n } else if (myDoor.offPoint) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make the id of nodes and completely sequential to avoid issues when inserting them into the database | function correctID() {
if (nodes.length) {
for (var i = 0, n = nodes.length; i < n; i++)
if (nodes[i].id > (i + 1))
nodes[i].id = i + 1;
lastNodeId = nodes[nodes.length - 1].id;
} else
lastNodeId = 0;
} | [
"function reIdNodes() {\n\tfor(var i = 0; i < nodes.length; ++i)\n\t\tnodes[i].id = i;\n}",
"generateId(node){\n return 1 << this.nodes.size;\n }",
"generateUniqueNodeId(node, index) {\n if (index === -1) { //if root element, set id to 0\n node.attr(\"data-alljsid\", '0');\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an object containing all materials that are currently in the array. | static getMaterials() {
return this.Materials;
} | [
"get materials() {}",
"getFullscreenMaterials() {\n\t return this.quad === null\n\t ? []\n\t : Array.isArray(this.quad.material)\n\t ? this.quad.material\n\t : [this.quad.material];\n\t }",
"getAllMaterials() {\n return this.materialRepository.get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ads DBHandler Fetch ads data from db depending on osType | function getAdsData(osType,cb){
adsSchema.findOne({ad_networks_for_OS : osType}, function(err, queryOutput){
if (err) {
cb(err,null);
}
else {
cb(null,queryOutput);
}
});
} | [
"getAllAds(req, res, next) {\n queryHandler\n .getAds()\n .then(results => {\n return res.json({ ads: results });\n })\n .catch(e => {\n return res.status(500).json({ err: e });\n });\n }",
"getAds() {\n return models.Ad.findAll({ where: { accept... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parse data coming from the OpenWeatherMap api into the data model | parseWeather(data) {
console.log(data);
this.temp = data.main.temp;
this.feels_like = data.main.feels_like;
this.humidity = data.main.humidity;
this.pressure = data.main.pressure;
this.currentWeather = data.weather[0].main;
this.weatherDescription = data.weather[0].description;
this.weat... | [
"function parseWeather(data) {\n \t\tvar parsedArray = [];\n \t\tvar auxObj = {};\n \t\tangular.forEach(data, function iterateValues(value, key) {\n \t\t\tauxObj = value;\n \t\t\tauxObj.weather = angular.isArray(value.weather) && value.weather.length > 0 ? value.weather[0] : {};\n \t\t\tauxObj.day = $filter('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
19. single project carousel | function singleProjectCarousel() {
if ($('.single-project-carousel').length) {
$('.single-project-carousel').owlCarousel({
loop: true,
margin: 0,
nav: true,
navText: [
'<i class="fa fa-angle-left"></i>',
'<i class="fa fa-angle-r... | [
"function carouselGo() {\n let indexCounter = 0;\n let maxIndex = $('#projects-container').children().length - 1;\n $('#next').on('click', () => {\n $('#projects-container').children().eq(indexCounter).css('display','none');\n if (indexCounter < maxIndex) {\n indexCounter++;\n } else { \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a function by its pointer. | function getFunction(ptr) {
return wrapFunction(table.get(ptr), setargc);
} | [
"function get_function(id) {\n var proto;\n var func = function_map[id];\n if (func === undefined) {\n proto = proto_map[id];\n if (proto === undefined)\n throw new Error('dispatch: unknown Glk function: ' + id);\n func = build_function(proto);\n function_map[id] = fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Appends the given data list to HTML UL (unordered list) in the navigation area | function appendList(id, listObject) {
// ajax call to retrieve next navigation level
$.ajax({
type : "POST", // action type
url : 'loadNavigationData', // controller method name
data : {
branchId : id
// branch
},
dataType : 'json', // data type
success : function(data)... | [
"function addNavigation() {\n\n var list = $('<ul>').appendTo($('<footer>').appendTo($('body')));\n $.each(links, function(i, link) {\n list.append($('<li>').append($('<a>').attr('href', link.url).text(link.text).css('color', colors[i])));\n });\n\n }",
"function veridoc_render_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle's the "checked" property for individual Tasks (in the database) | 'click .toggle-checked'() {
Tasks.update(this.task._id, {
$set: { checked: ! this.task.checked }, //Toggle If not checked: "check", else: "uncheck"
});
} | [
"function toggleCheck(task)\n {\n task.checked = !task.checked;\n }",
"toggleChecked() {\n\t\t\tlet allCompleted = this.allCompleted;\n\t\t\tthis.todos.forEach(todo => todo.completed = !allCompleted);\n\t\t}",
"function toggleAll() {\n\n // Get the value of the toggle Checkbox\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to change allergy to correct format | function convertAllergy(allergy) {
if (allergy == "Dairy") {
allergyInput = "DAIRY_FREE";
} else if (allergy == "Eggs") {
allergyInput = "EGG_FREE";
} else if (allergy == "Peanuts") {
allergyInput = "PEANUT_FREE";
} else if (allergy == "Soy") {
allergyInput = "SOY_FREE";
... | [
"function reformatUSPhone (USPhone)\r\n{ return (reformat (USPhone, \"(\", 3, \") \", 3, \"-\", 4))\r\n}",
"function reformatUSPhone (USPhone)\n{ return (reformat (USPhone, \"(\", 3, \") \", 3, \"-\", 4))\n}",
"function\n oddlyFormatted() {}",
"convert() {\n let a = this.date.split(/[-]|[/]/);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints a duration in HH:MM from a timestamp in seconds | function print_duration(timestamp) {
var result = '',
hours,
minutes;
// Change to minutes
timestamp = Math.floor(timestamp / 60);
hours = Math.floor(timestamp / 60);
if (hours < 10) {
result += '0';
}
result += hours + ':';
minutes = timestamp - hours * 60;
... | [
"function formatTime() {\n seconds++;\n const mins = Math.floor(seconds / 60).toString().padStart(2, '0');\n const secs = (seconds % 60).toString().padStart(2, '0');\n timerEl.innerText = `${mins}:${secs}`;\n}",
"printTime() {\n let min = this.twoDigitsNumber(this.getMinutes());\n let sec = this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Declare that the guest represented by the data is no longer assigned to a seat at a table. If the guest had been at a table, the guest is removed from the table's list of guests. | function unassignSeat(guest) {
if (guest instanceof go.GraphObject) {
throw Error("A guest object must not be a GraphObject: " + guest.toString());
}
var model = diagram.model;
// remove from any table that the guest is assigned to
if (guest.table) {
var table = model.findNodeDataForKey(gu... | [
"function clearOrphanSeats(){\n\t\t\tupdateColors();\n\t\t\t$(\"g[name='table']\").each(function(){ \n\t\t\t\tvar t = $(this); \n\t\t\t\tt.find(\"circle[name*='seat']\").each(function(){ \n\t\t\t\t\tvar n = $(this).attr('name');\n\t\t\t\t\tvar s = t.find('g[name*=' + n + ']');\n\t\t\t\t\tif(s.length > 0){\n\t\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
mask word takes the arrayed word and converts it into a series of blanks equal in length to the arrayed word, now called answer. | function maskWord(word) {
var maskWord = [];
var blanks = $("#mystery-word");
for (j = 0; j < word.length; j++) {
maskWord.push("__");
}
blanks.text(maskWord.join(" "));
return maskWord;
} | [
"function maskify(word){\n return (word.length > 5\n ? '#'.repeat(word.length - 4) + word.slice(-4) \n : word);\n}",
"generateMaskedWord() {\n var s = '';\n for (var i = 0; i < this.mask.length; i++) {\n if (this.mask[i]) {\n s = s + this.word.charAt(i);\n } else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all itins and businesses given email | function getBusFromItinByEmail(req, res) {
var query = `
SELECT i.itinerary_id, i.name as itinerary_name, b.name as business_name
FROM itinerary i
LEFT OUTER JOIN itinerarybusiness ib
ON i.email = :email AND i.itinerary_id = ib.itinerary_id
JOIN business b
ON ib.business_id = b... | [
"function getEmails() {\n var emailsFound = knwlInstance.get('emails');\n\n emailsFound.forEach(function (email) {\n if (emails.includes(email['address']) == false)\n emails.push(email['address']);\n })\n}",
"async function getAllRoutinesByEmail(email) {\n\n try{\n\n const [{ ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds the current folder path based on the current file and the path from the current line. | getFolderPath(fileName, currentLine, currentPosition) {
var userPath = this.getUserPath(currentLine, currentPosition);
var mappingResult = this.applyMapping(userPath);
var insertedPath = mappingResult.insertedPath;
var currentDir = mappingResult.currentDir || this.getCurrentDirectory... | [
"function getPath() {\n return currentDir.CurrentDir.FullPath;\n}",
"function get_current_code_path(){\n\tvar id = $(\"#file_name_nav\").find(\"span.selected\").attr(\"id\");\n\tid = id.replace(\"t_\", \"\");\n\treturn full_path($(\"#\"+id));\n}",
"expand_path(path) {\n var curr_dir = this.current_dir... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CSNumber.arctan2 uses the following formula for complex arguments | function arctan2(a, b) {
var z = CSNumber.add(a, CSNumber.mult(CSNumber.complex(0, 1), b));
var r = CSNumber.sqrt(CSNumber.add(CSNumber.mult(a, a), CSNumber.mult(b, b)));
erg = CSNumber.mult(CSNumber.complex(0, -1), CSNumber.log(CSNumber.div(z, r)));
return erg;
} | [
"function arctan2(a, b) {\n var z = CSNumber.add(a, CSNumber.mult(CSNumber.complex(0, 1), b));\n var r = CSNumber.sqrt(CSNumber.add(CSNumber.mult(a, a), CSNumber.mult(b, b)));\n erg = CSNumber.mult(CSNumber.complex(0, -1), CSNumber.log(CSNumber.div(z, r)));\n return erg;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a settings and delete buttons on a connection | createButtons() {
this.settingsButton = this._createConnectionButton(TEXTURE_NAME_SETTINGS);
this.deleteButton = this._createConnectionButton(TEXTURE_NAME_DELETE);
} | [
"function addManageStorageConnectionsButton () {\n getPluginApi().addMenuPlaceActionButton(entityTypes.storage, msg.storageConnectionsManageButton(), {\n onClick: function ([selectedDomain]) {\n showStorageConnectionsModal(selectedDomain)\n },\n\n isEnabled: function (selectedDomains) {\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the path and query string created by filling the route pattern's wildcard parameter with the matching param. | getWildcardPath() {
let wildcardName = this.getWildCardName();
let path = this.params[wildcardName] || '';
let queryString = this.queryString;
if (queryString) {
path += '?' + queryString;
}
return path;
} | [
"getWildcardPath() {\n const wildcardName = this.getWildCardName();\n let path = this.params[wildcardName] || \"\";\n if (this.queryString) {\n path += `?${this.queryString}`;\n }\n return path;\n }",
"static generatePattern(route) {\n let regex = new RegExp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the distance offset, taking into account the default offset due to the transform: translate() rule (10px) in CSS | function getOffsetDistanceInPx(distance) {
return -(distance - 10) + 'px';
} | [
"function getOffsetDistanceInPx(distance) {\n return -(distance - 10) + 'px';\n}",
"offset(el) {\n const style = window.getComputedStyle(el),\n props = el.getBoundingClientRect();\n\n if (style.transform === 'none') return [3, 7];\n return [props.width * 0.15 < 10 ? props.width * 0.1 : props.width ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |