query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
set job total price; | setJobTotal(){
let sum;
if(!$.isNumeric(this.calcJobTotal())) sum = 0;
else sum = this.calcJobTotal();
$('#total').val(`£${sum.toFixed(2)}`);
} | [
"@api\n addTotalPrice(price) {\n this.totalPrice += price;\n }",
"set price(value) {\n this._price = 80;\n }",
"deductBudget() {\n let price = parseInt(costClothing.value, 10);\n runningBudget -= price;\n updateBudget();\n }",
"function updateQuantity () {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addFieldsets() END / FUNCTION eMatch( selectors , toClass ) Make sure the class "match", "nomatch" are present appropriate styling of email input fields 2 parameters: selectors > object array of all selectors toClass > CSS class name to "switch" to | function eMatch(selectors, toClass) {
var fromClass = (toClass == "js-match") ? "js-no-match" : "js-match";
selectors.find("input").each( function() {
var thisInput = $(this);
fromToClass(thisInput, fromClass, toClass);
if (!thisInput.hasClass(toClass))
{
thisInput.addClass(toClass);
}
});
... | [
"function setCssClasses() {\n var personCriterion = {\n fieldName: 'type',\n operator:'equals',\n value:'person'\n }; \n \n // utils.createCSSClass('.eventColorMultiple',\n // 'background-color:' + 'aliceBlue' +\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For picking a default voice, looks for the first voice name. | function firstVoiceName() {
if (result.V) {
return result.V.split(/\s+/)[0];
} else {
return '';
}
} | [
"function voice_options(voice)\r\n{\r\n\tdocument.getElementById(\"moreoptions\").style.display = 'none';\r\n\tdocument.getElementById(\"ispeech\").style.display = 'none';\r\n\r\n\tswitch(voice)\r\n\t{\r\n\t\tcase 'SpeakIt!':\r\n\t\t\telement.testtext.value = chrome.i18n.getMessage('lang_testtext');\r\n \t\tbreak;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw main menu background over both canvases. | function mainMenuDraw() {
if (showCredits) {
drawFullScreenImage(creditsScreen);
seeMainMenuButtons(false);
} else {
drawFullScreenImage(mainMenu);
}
} | [
"function arrangeOverlayCanvas() {\n var canvas = $('#app-overlay')[0],\n ctx = null;\n\n $('#app-overlay').css('display', 'none');\n if (canvas.getContext) {\n // Background\n ctx = canvas.getContext('2d');\n ctx.fillStyle = 'rgba(255, 255, 255, 0.8)';\n ctx.fillRect(0, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A success string will appear and you'll be able to get to the next level after a set amount of seconds. | success() {
if (this.lvlWon) {
push()
this.playWinSFX();
background(this.fill.r, this.fill.g, this.fill.b)
textSize(25);
fill(this.bgFill.r, this.bgFill.g, this.bgFill.b);
textAlign(CENTER, CENTER);
text(this.successString, this.successStringX, this.successStringY)
p... | [
"function flashGood( success ){\n indicator.innerHTML += '<br>' + success + '!';\n indicator.classList.add('indicator-green');\n window.setTimeout( function(){ indicator.classList.remove('indicator-green'); } , 250);\n window.setTimeout( function(){ indicator.classList.add('indicator-green'); } , 500);\n windo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shows an alert asking the user to confirm that they want to delete an event | function confirmDeleteEvent(eventId) {
var label = document.getElementById("confirmActionLabel");
label.innerHTML = "Delete Event?";
var indexOfJSON = getEventJSONIndex(eventId);
var events = flashTeamsJSON["events"];
var eventToDelete = events[indexOfJSON];
var alertText = document.getElemen... | [
"function deleteAlert() {\n swal({\n title: 'Are you sure?',\n text: 'Once deleted, you will not be able to recover this Task!',\n icon: 'warning',\n buttons: true,\n dangerMode: true,\n }).then((willDelete) => {\n if (willDelete) {\n const taskId = $(this).data('id');\n deleteTask(tas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
tslint:disable:exportname Create a root service scope and initialize with SPFx services: PageContext DynamicDataManager HttpClient SPHttpClient GraphHttpClientContext DigestCache | function createRootScope(pageContext) {
var root = _microsoft_sp_core_library__WEBPACK_IMPORTED_MODULE_1__["ServiceScope"].startNewRoot();
root.provide(_microsoft_sp_diagnostics__WEBPACK_IMPORTED_MODULE_2__["_logSourceServiceKey"], _microsoft_sp_diagnostics__WEBPACK_IMPORTED_MODULE_2__["_LogSource"].create('Roo... | [
"initServices () {\n this.services.db = new DBService({\n app: this,\n db: this.options.dbBackend\n })\n this.services.rpcServer = new RPCServerService({\n app: this,\n port: this.options.rpcPort\n })\n this.services.jsonrpc = new JSONRPCService({\n app: this\n })\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove timestamps older than one second from API call timestamp array | #removeExpiredTimestamps(key) {
const timestampsArray = this.#apiCallTimeStamps[key]
const now = Date.now()
const oneMinuteAgo = now - 1000
let index = 0
while (index < timestampsArray.length && timestampsArray[index] <= oneMinuteAgo) {
index += 1
}
timestampsArray.splice(0, index)
... | [
"limitArray(arr, limitTimeframeInSeconds){\n if(typeof limitTimeframeInSeconds && !limitTimeframeInSeconds){\n return arr;\n }\n limitTimeframeInSeconds = limitTimeframeInSeconds || 120;\n let timeInMS = limitTimeframeInSeconds * 1000;\n try{\n if(arr && arr.hasOwnProperty('earliestTime')){... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set map type id | function setMapTypeId(type) {
// set default is 'roadmap + customlayer' if 'type' is empty
if(type.length == 0 || typeof(type) === 'undefined') {
type = ['roadmap'];
}
mapinitialize(centerCurrentMap(), currentZoomMap());
clickMapEvent();
// reset map
map.setMapTypeId(null);
// lo... | [
"constructor() {\n this.stringToIdMap = new Map();\n }",
"set type(aValue) {\n this._logger.debug(\"type[set]\");\n this._type = aValue;\n }",
"function setId(entity){\n entity['id'] = entity[datastore.KEY].id;\n return entity;\n}",
"static registerType(type) { ShareDB.types.register(type);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add Knockout.Validation rules from the entities metadata | function addValidationRules(entity) {
var entityType = entity.entityType,
i,
property,
propertyName,
propertyObject,
validators,
u,
validator,
nValidator;
if (entityTy... | [
"setDefaultDataValidationRules() {\n if(this.getOption('required') == true){\n this.dataValidators.isRequired = true;\n\n this.addDataValidationRule('NotBlank', {});\n }\n\n let rules = this.getOption('rules');\n for (var ruleKey in rules){\n this.addData... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find person, who has RFID, that equals resourse's person_rfid | function searchRfid (rfid, peopleArr) {
/*jslint plusplus: true */
for (var i = 0; i < peopleArr.length; i++) {
if (peopleArr[i].rfid === rfid) {
return peopleArr[i];
}
}
} | [
"function findPerson(id) {\n var foundPerson = null;\n for (var i = 0; i < persons.length; i++) {\n var person = persons[i];\n if (person.id == id) {\n foundPerson = person;\n break;\n }\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Turns all the roles on or off with the 'everyone' switch | allRolesOn(on=true) {
if (on) {
this.allRoleSwitchesOn();
this.selectedRoles = this.roles.map(x => String(x.code));
} else {
this.allRoleSwitchesOn(false);
this.selectedRoles = [];
}
} | [
"function setRoles(lobby, roles) {\n getGame(lobby).roles = roles;\n}",
"isAll(...roles) {\n\t\treturn Roles.coerceRoleArray(roles).every(role => this.is(role));\n\t}",
"function manageRoles(cmd){\n try{\n\t//console.log(cmd.message.channel instanceof Discord.DMChannel);\n\t//if (cmd.message.channel instanceo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepares the content of the Dropdown for the Items (by Name) | prepareSelectItems() {
let that = this;
let items_buffer = getReferencesOfType('AGItem');
let select_item_buffer = '';
if (items_buffer.length > 0) {
items_buffer.forEach(function (element) {
select_item_buffer = select_item_buffer + '<option value = "' + getR... | [
"function inputProducts(data){\n data = sortAsc(data, \"name\")\n var htm = selectInput(data, \"_id\", \"name\")\n $('select[role=\"product-list\"]').each(function() {\n $(this).html(htm);\n });\n var template = $('#heroTemplate').html().replace('<option value=\"0\" disabled=\"\">Select One...</option>', ht... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use case 3: on _x_ day 1 daysOfWeek[x] in .open[n].day ? | function openAtDay(db, day) {
if (day === "" || day === "All") {
return db;
}
var dayInAbbreviation = day[0].toUpperCase().concat(day.slice(1, 3).toLowerCase());
var openThisDay = db.filter(function (e) {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3... | [
"function fillWeekDays(week) {\r\n\tangular.forEach(ref, function(refDay) {\r\n\t\taddIfNotExists(week, refDay);\r\n\t});\r\n}",
"function getTodaysIndex(today, hours){\n\tvar day = -1;\n\tfor(i = 0; i < hours.length; i++)\n\t{\n\t\tif(today == hours[i].open.day)\n\t\t{\n\t\t\tday = i;\n\t\t\treturn day;\n\t\t}\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renew Life Code hassu Send a Structured Message (Renew Life Type) using the Send API. | function sendRenewLifeWelcomeMsg(recipientId) {
var messageData = {
recipient: {
id: recipientId
},
message: {
attachment: {
type: "template",
payload: {
template_type: "button",
text: "Welcome to... | [
"resend() {\n this.streamStatus = 'initialize';\n this.requester.addToSendList(this.data);\n }",
"function sendStateToArtikCloud(parking_slot){\n try{\n ts = ', \"ts\": '+getTimeMillis();\n var data = {\n \"parking_slot\": parking_slot\n //setting the parking value fr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the element's position data based on event (only works if the event comes from the document's DOM) !!ONLY GRID SPOTS HAVE POSITION DATA!! (added during creation) | function getElementPos(event)
{
//Get the event target element
event = event || window.event;
var target = event.target || event.srcElement;
var x;
var y;
//Check if the element has position data
if(target.posX !== undefined && target.posY !== undefined)
//Return the data
return {"x": target.pos... | [
"function getPosition(event) {\n var toParse = event.target.className;\n var row = toParse.substring((toParse.indexOf('row_'))+4,(toParse.indexOf('col')));\n var col = toParse.substring((toParse.indexOf('col'))+4,(toParse.length));\n return [parseInt(row), parseInt(col)];\n }",
"handlePositionChangeE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
action to do insert font/color/size/list | function do_insertTag(tag, value, $caleer){
_TEXT.init();
if(value)
_TEXT.wrapValue(tag, value);
else
_TEXT.wrapValue(tag);
if( ($.inArray(tag, ["FONT","COLOR","SIZE"]) != -1) && $caleer && $caleer.length ){
$caleer.closest('ul').hide();
}
} | [
"function aceInitialized(hook, context){\n var editorInfo = context.editorInfo;\n editorInfo.ace_doInsertTextFormat = _(doInsertTextFormat).bind(context);\n}",
"function changeFont(){\n\tvar new_font = $('#font').val();\n\teditor.setFontSize(parseInt(new_font));\n}",
"_updateContentStyle() {\r\n\t\tconst styl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
member function checkBlocks() checks collision with all the blocks in the world | checkBlocks(){
var overlaps = [];
for (var i = 0; i < blocks.length; i += 1){
if(box.testOverlap(this.getCol(), blocks[i].col))
overlaps.push(box.intersection(this.getCol(), blocks[i].col));
}
this.collideOverlaps(overlaps);
} | [
"function clearBlocks(lineArray) {\n\n long.position = JSON.parse(JSON.stringify(longPos))\n tee.position = JSON.parse(JSON.stringify(teePos))\n zig.position = JSON.parse(JSON.stringify(zigPos))\n zag.position = JSON.parse(JSON.stringify(zagPos))\n square.position = JSON.parse(JSON.stringify(squarePo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates and displays a dynamic progress bar based on an input time. | function progressBar(time) {
//Generating the progress bar HTML and displaying it.
var barDiv = '<div class="barProgress" id="barProgress' + numOfBars + '"><div class="bar" id="bar' + numOfBars + '"></div></div><br>';
document.getElementById("short").insertAdjacentHTML('beforebegin', barDiv);
var element = d... | [
"function LoadingBar(timeMs, speed) {\n\t\tconst _$e = $(`\n\t\t\t<div class='LoadingBar' style='font-size: 0px; height: 5px;'>\n\t\t\t\t<div class='loaded' style='height: 100%; position: relative; left: 0px; width: 0%'> </div>\n\t\t\t</div>\n\t\t`);\n\t\tconst _$loaded = _$e.find(\".loaded\");\n\t\tconst _sta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start w/ main nav. list from the menu icon who all inherit from .navigation_list | function populateNavigation(clicky, parent, list, counter, parent_id) {
// Each nav list is givin a unique id
// Each Child has the class of their parnets id
var nav_id = 'nav_menu_' + counter++;
// Add nav list to parent
$(parent).prepend("<nav ... | [
"function createNavigation() {\n \n // If a mobile device is detected, remove initial navigation list\n if (!isMobileDevice) {\n navigation.children(TAG_UL).html(CHAR_EMPTY);\n }\n \n // Iterate all available commands\n $.each(commands, function(key, v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the apps document to include the link of the icon image. Does the redirectToSuccess() function as well. | function uploadIconPic() {
storageRef.getDownloadURL()
// Get URL of the uploaded file
.then(function (url) {
console.log(url);
// Save the URL into apps document
db.collection("apps").doc(docAppID).update({
"IconPic... | [
"function getApp() {\n document.getElementById(\"submit\").addEventListener('click', function () {\n firebase.auth().onAuthStateChanged(function (user) {\n // User choice in the adding form (application or idea).\n var application = document.getElementById(\"app\").ch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new Genome that is an exact copy of this one | clone() {
const clonedGenome = new Genome();
this.genes.forEach(function (gene) {
clonedGenome.genes.push(gene.clone());
});
clonedGenome.mutationRates = this.getMutationRates();
return clonedGenome;
} | [
"copy() {\n const copy = new Grid(this.size);\n copy.grid = copyBoard(this.grid);\n return copy;\n }",
"clone() {\n var clone = new Player();\n clone.brain = this.brain.clone();\n clone.fitness = this.fitness;\n clone.brain.generateNetwork();\n clone.gen = this.gen;\n clone.bestScore =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Does the actual change to the cells position currently using CSS | commit() {
if (this.isDirty && this.elt) {
let top = ((this.cellSize * this.y) + this.padding) + "px";
let left = ((this.cellSize * this.x) + this.padding) + "px";
this.elt.css({
top: top,
left: left
});
}
this.reset... | [
"function swapSelectedCells(p) {\n\n p.cell0.text(p.cell1Text)\n .attr(\"rowspan\", p.cell1RowSpan)\n .attr(\"colspan\", p.cell1ColSpan)\n .attr(\"class\", p.cell1Class)\n .attr(\"style\", p.cell1Styles);\n\n\n p.cell1.text(p.cell0Text)\n .attr(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
input local and API food data to create DOM element | function foodFactory(localFood, apiFood) {
return `
<div class="Item">
<h2>${localFood.name}</h2>
<h3>${localFood.ethnicity}</h3>
<p>${localFood.category}</p>
<p>Country: ${apiFood.product.countries}</p>
<p>Calories: ${apiFood.product.nutriments.energy_serving}</p>
... | [
"function findFoods() {\n\n// userRequest will taken in the client information and ask them to type in what they are serching for \n let userRequest = document.getElementById('userRequest').value\n if(userRequest === '') {\n return alert('Please enter an ingrediant for query')\n }\n\n // Here we ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Take the AJAX request and return a new deferred object that is able to normalize the response from the server so that all of the done/fail handlers can treat the incoming data in a standardized, uniform manner. | function normalizeAJAXResponse(jqxhr) {
// Create an object to hold normalized deferred.
// Since AJAX errors don't get parsed, need to
// create a proxy that will handle that for us.
var deferred = $.Deferred();
// Bind the done/fail aspects of the original AJAX
// request. We can use these hooks to resolve ou... | [
"function ajax() {\n\tvar deferred = $.ajax.apply($, arguments);\n\treturn new Promise(deferred.then);\n}",
"function validateRequest(request) {\n var deferred = $.Deferred();\n var validated_request = {};\n var response;\n\n // Transfer request.text to validated_request.text if necessary\n if (request.hasOw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to configure emitter. This is, every times that a mqtt message is received, emitMessage() function, which is defined in index.js, will be called to distribute new content in real time across the users which are requesting information about. | function configureEmitter(emitter){
emitMessage = emitter;
} | [
"async function OnDeviceConfiguration() {\r\n try {\r\n client.on(\"connect\", () => {\r\n client.subscribe(topicConfiguration, function (err) {\r\n if (err) {\r\n console.log(err);\r\n return;\r\n }\r\n });\r\n });\r\n } catch (err) {\r\n throw err;\r\n }\r\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the bar is very low in height, move the number above the bar | function fixLowBarNumbers() {
$(".bar").each(function() {
if ($(this).height() <= 30) {
$(this).children(".value").each(function() {
$(this).css("top", -30);
});
}
});
} | [
"function barBottom(data)\r\n\t{\r\n\t\treturn graphHeight;\r\n\t}",
"function textPosition (d) {\n\t\tif (y(d.value) + 16 > settings.hm) {\n\t\t\treturn y(d.value) - 2;\n\t\t}\n\t\treturn y(d.value) + 12;\n\t}",
"function setNumber(value, element)\n {\n var percentage = (value - 1) * 11.2;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::LookoutMetrics::AnomalyDetector.AnomalyDetectorConfig` resource | function cfnAnomalyDetectorAnomalyDetectorConfigPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnAnomalyDetector_AnomalyDetectorConfigPropertyValidator(properties).assertSuccess();
return {
AnomalyDetectorFrequency: cdk.stringToCloudFormat... | [
"function cfnAnomalyDetectorCloudwatchConfigPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAnomalyDetector_CloudwatchConfigPropertyValidator(properties).assertSuccess();\n return {\n RoleArn: cdk.stringToCloudFormation(properties.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Restart token detection polling period and call detectNewTokens in case of address change or user session initialization. | restartTokenDetection() {
if (!this.selectedAddress) {
return
}
// this.detectedTokensStore.putState({ tokens: [] })
this.detectNewTokens()
this.interval = DEFAULT_INTERVAL
} | [
"initTokens() {\n\n\t\t\twhile (this.tokens.length > 0 && Date.now() > this.tokens[0].expires) this.tokens.shift();\n\n\t\t\tif (this.tokens.length > 0) {\n\n\t\t\t\tTimers.token.start(this.tokens[0].expires);\n\n\t\t\t} else {\n\n\t\t\t\tTimers.token.stop();\n\n\t\t\t}\n\n\t\t\t//Sort by expriation.\n\t\t\tthis.to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
placeBadMarkers() Switches on the place marker functionality by setting a click event on the map | function placeBadMarkers() {
BAD_listener = google.maps.event.addListener(map, 'click', function(event) {
placeBadMarker(event.latLng);
});
} | [
"function placeGoodMarkers() {\n\tGOOD_listener = google.maps.event.addListener(map, 'click', function(event) {\n\t\tplaceGoodMarker(event.latLng);\n\t});\n}",
"function onMapClick(e) {\n // Popup example\n popup\n .setLatLng(e.latlng)\n .setContent(\"You clicked the map at \" + e.latlng.toStr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fce isPattern vraci index pri shode koncovky (napr. isPattern("lo","kolo"), isPattern("kolo","motovidlo")) nebo pri rovnosti slov (napr. isPattern("molo","molo"). Jinak je navratova hodnota 1. | function isPattern(pattern, text, placeholders) {
text = text.toLowerCase()
pattern = pattern.toLowerCase()
var patternIndex = pattern.length
var wordIndex = text.length
if (patternIndex == 0 || wordIndex == 0) {
return -1;
}
patternIndex--;
wordIndex--;
while (patternIndex >= 0 && wordIndex >= 0) {
if (... | [
"function match_pattern(state, pattern, player) {\n for (var mpidx1 = 0; mpidx1 < state.length; mpidx1++) {\n for (var mpidx2 = 0; mpidx2 < state[mpidx1].length; mpidx2++) {\n var matches = match_pattern_at(state, pattern, player, mpidx1, mpidx2);\n if (matches) {\n return true;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Task for file includes | function fileincludeTask(cb) {
return src(['./src/*.html'])
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(gulp.dest('./public'))
.pipe(browserSync.stream());
cb();
} | [
"collectIncludedFiles(dependencies) {\n dependencies.forEach(dependency => this.includedFiles.add(dependency.to));\n }",
"async function getIncludedSources(options) {\n\n options = { ...defaultOptions, ...options };\n const { docsDir, include, sourceDir, pathPrefix } = options;\n const cleanedSourceD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================= X to JSON ================== / PlaceRequest > Place Converts a PlaceRequest into the equivalent Place message. | function placeRequestToJson(placeRequest) {
return [placeRequest[1], placeRequest[2]];
} | [
"function getAllPlaces(place) {\n var myPlace = {};\n myPlace.name = place.name;\n myPlace.place_id = place.place_id;\n\n allPlaces.push(myPlace);\n }",
"function updatePlaceResultObject(tobeupdated,update){\n\ttobeupdated.geometry= update.geometry;\n\ttobeupdated.icon=update.icon;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attach this portal to a host. | attach(host) {
if (typeof ngDevMode === 'undefined' || ngDevMode) {
if (host == null) {
throwNullPortalOutletError();
}
if (host.hasAttached()) {
throwPortalAlreadyAttachedError();
}
}
this._attachedHost = host;
... | [
"function defineHostOwnership(elementNode, hostNode, id) {\n if ( hostNode && hostNode !== elementNode ) {\n if ( !hostNode.id ) {\n hostNode.id = 'host_' + id\n }\n _.aria(elementNode, 'owns', hostNode.id)\n }\n}",
"function attachTether() {\n new Tether(extend({\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uninstall a widget when the 'Uninstall' button is clicked | function onUninstallClick(e) {
e.preventDefault();
var id = $(this).parent().data("widget-id");
console.log("uninstalling widget with ID of", id);
alert("Widget uninstalling isn't implemented yet.");
} | [
"function uninstall(pluginBundle) {\n java.awt.Toolkit.getDefaultToolkit().beep();\n java.lang.System.out.println('uninstall called for ' + pluginBundle.file.name);\n}",
"function onUninstall(extId) {\n\t// Display the uninstall page\n\tif (show_welcome) {\n\t\tvar url = SHMAddonNamespace.getRequestURL('uni... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the current 'hasText' status of all PageElements managed by PageElementMap as a result map. A PageElement's 'hasText' status is set to true if its actual text equals the expected text. | getHasText(texts) {
return this._node.eachCompare(this._node.$, (element, expected) => element.currently.hasText(expected), texts);
} | [
"getHasText(texts) {\n return this.eachCompare(this.$, (element, expected) => element.currently.hasText(expected), texts);\n }",
"getContainsText(texts) {\n return this._node.eachCompare(this._node.$, (element, expected) => element.currently.containsText(expected), texts);\n }",
"getContains... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check that the first few elements of the attribute are reasonable / eslintdisable nofallthrough | _checkAttributeArray() {
const {
value
} = this;
const limit = Math.min(4, this.size);
if (value && value.length >= limit) {
let valid = true;
switch (limit) {
case 4:
valid = valid && Number.isFinite(value[3]);
case 3:
valid = valid && Number.isF... | [
"function attrsShouldThrowOnInvalidElement() {\n expect(() => {\n element.attrs(\"invalid\")\n }).toThrow(\n new TypeError(\"Invalid element: 'invalid'\"))\n}",
"function isPropValid()\n{\n\n}",
"function isUniform(stuff){\n var first = stuff[0]\n for(var i = 1; i < stuff.length; i++){\n if(stuff[i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
based on the filter request, create the filter object to be passed to the mongo db via mongoose. | function filterData(filterReq){
if(filterReq){
var filter = JSON.parse(filterReq);
if(filter.heroName){
filterObj.heroName = { "$regex": filter.heroName, "$options": "i" } ;
}
if(filter.age){
filterObj.age = filter.age;
}
if(filter.relation){
filterObj.re... | [
"createFilterQuery() {\n const filterType = this.state.filterType;\n const acceptedFilters = ['dropped', 'stale', 'live'];\n\n if (acceptedFilters.includes(filterType)) {\n const liveIDs = this.state.liveIDs;\n if (filterType === 'dropped') return {'events.id': {$nin: liveIDs}};\n if (filter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Zip strings (`for in` can be used on string characters) | function zip(a, b) {
var arr = [];
for (var ch in a) arr.push([a[ch], b[ch]]);
return arr;
} | [
"function zipMutate(inputs, other, zipper) {\n const iter = other[Symbol.iterator]();\n for (let index = 0; index < inputs.length; index++) {\n const { value, done } = iter.next();\n if (done) {\n inputs.length = index;\n break;\n }\n inputs[index] = zipper(in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
%DebugPrint(floatMapObj); build addrOf primitive by changing the obj array map to float array map obj | function buildAddrOfArray(obj)
{
let arr = [obj, obj];
let tmp = {escapeVal: arr.length};
arr[tmp.escapeVal] = floatMapObj;
return arr;
} | [
"static FromFloatArrayToRef(array, offset, result) {\n Vector4.FromArrayToRef(array, offset, result);\n }",
"static FromFloatArrayToRef(array, offset, result) {\n return Vector3.FromArrayToRef(array, offset, result);\n }",
"get f32() { return new Float32Array(module.memory.buffer, th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open a popup using as content the element returned by the given func. Note that the `trigger` option is ignored by this function and that the default of the `attach` option is `body` instead of `null`. It allows you to bind the creation of the popup to a menu item as follow: menuItem(elem => popupOpen(elem, (ctl) => bu... | function popupOpen(reference, domCreator, options) {
function openFunc(openCtl) {
const content = domCreator(openCtl);
function dispose() { grainjs_1.domDispose(content); ctl.dispose(); }
return { content, dispose };
}
const ctl = PopupControl.create(null);
ctl.attachElem(referen... | [
"function open(popup, caller, params) {\n var popupComponent = null;\n var rootObject = null;\n if (popup.createObject) {\n // popup is a component and can create an object\n popupComponent = popup;\n rootObject = QuickUtils.rootItem(popup);\n } else if (typeof popup === \"string\")... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hide nodes and arrows from postcodes | function toggle_postcodes_visibility() {
// Toggle node
for (let i = 0; i < nodes.length; i++) {
if (this.value == nodes[i].location.split(" ")[0]) {
if (map.hasLayer(nodes[i].layer)) {
nodes[i].layer.removeFrom(map);
nodes[i].label.removeFrom(map);
} else {
nodes[i].... | [
"function hideTipShowText() {\n tipElement.style.opacity = '0'\n nodeElement.style.opacity = '1'\n nodeTitleElement.textContent = title\n }",
"function hideHelper(graph) {\n\t\tgraph.find('.svg-helper').attr({'x1': -10, 'x2': -10});\n\t\tgraph.find('.svg-point-highlight').attr({'cx': -10, 'cy': -10});\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CLEARCHART: removes everything from chartDiv so that chart can be redrawn based on users' selections | function clearChart() {
d3.select('#chartDiv').selectAll('svg').remove();
} | [
"function clearHtml() {\n $(\"#searchChart\").remove();\n}",
"clearDoughnutChart() {\n while (this.chartCategory.firstChild) {\n this.chartCategory.removeChild(this.chartCategory.firstChild);\n }\n\n let canvas = document.createElement(\"canvas\");\n canvas.id = \"chart-categories\";\n can... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function reveals a letter when guessed | function revealLetter() {
userGuessIndex = word.indexOf(userGuess);
for (i=0; i < word.length; i++) {
if (word[i] === userGuess) {
hide = hide.split("");
hide[i] = userGuess;
hide = hide.join("");
targetA.innerHTML = hide;
}
}
} | [
"function Guess(letter) {\n if (RemainingGuesses > 0) {\n // Make sure we didn't use this letter yet\n if (GuessedLetters.indexOf(letter) === -1) {\n GuessedLetters.push(letter);\n CheckGuess(letter);\n }\n }\n \n}",
"guess(guessedLetter) {\n this.letters... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Alert that dragging is done. | function dragEnd() {
console.log('drag end');
} | [
"async function trigger_drop() {\n resumeGame();\n if (demoIsRunning){\n demoIsRunning = false;\n $(\"#demoLink\").text(\"DEMO\");\n location.reload();\n return;\n }\n \n demoIsRunning= true;\n $(\"#demoLink\").text(\"RESET\");\n \n droppable_items_count *=2;\n\n $draggable_items = $('#draggabl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Each time the window gets resized, 1. get the new width and height of the container 2. remove inner HTML of sentiment over time chart 3. draw a new sentiment over time chart | function _resizeSentimentOverTime(){
let w = document.getElementById('sentimentOverTimeContainerDiv'+subzoneChoice).offsetWidth;
let h = document.getElementById('sentimentOverTimeContainerDiv'+subzoneChoice).offsetHeight;
if($(window).width() != width || $(window).height() != height){
... | [
"function resizeHandler() {\n chart.draw(chartdata);\n }",
"function resizeGraph() {\r\n if ($(window).width() < 700) {\r\n $(\"#AdviceCanvas\").css({\"width\": $(window).width() - 50});\r\n $(\"#GraphCanvas\").css({\"width\": $(window).width() - 50});\r\n }\r\n}",
"function resizedw()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
format long desc selection | function formatLongDescSel(_text) {
return "<span style=\"padding-left:16px\">" + _text + "</span>";
} | [
"formatDescription(desc) {\n let tag = \"What does this PR do?\";\n let start = desc.indexOf(tag);\n if (start >= 0) {\n let end = desc.indexOf(\"\\r\\n\", start + tag.length + 2);\n return desc.substring(start + tag.length + 1, end);\n } else {\n let end = desc.indexOf(\"\\r\\n\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The path name of the asset for this importer. (Read Only) | get assetPath() {} | [
"getSkierAsset() {\n var skierAssetName;\n switch (vars.skierDirection) {\n case 0:\n skierAssetName = 'skierCrash'\n break;\n case 1:\n skierAssetName = 'skierLeft';\n break;\n case 2:\n skierA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TreeDeselectAllItems This function uncheckes all checked nodes. | function TreeDeselectAllItems()
{
var tree = this;
for (var i = 0; i < tree.checkedItems.length; i++)
{
var branch = tree.checkedItems[i];
branch.checkbox.checked = false;
branch.imageCheck.style.display = "none";
... | [
"function uncheckAll(name) {\r\n\tsetCheckboxState(name, false);\r\n}",
"function do_deselect_all() {\n var baseurl = document.getElementById('baseurl');\n // Make asynchronous call to end point to deselect all for current page\n YUI().use(\"io-base\", function(Y) {\n var uri = baseurl.value + \"&... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removing overlay div's property values to remove lightbox effect. | function removeOverlay() {
let overlay = document.getElementById('overlay');
overlay.style.position = '';
overlay.style.top = '';
overlay.style.left = '';
overlay.style.width = '';
overlay.style.height = '';
overlay.style.background = '';
overlay.style.opacity = '';
overlay.style.filter = '';
overla... | [
"function removeImageOverlay() {\n\t$('.overlay').remove();\n}",
"function removeOverlay() {\n imgOverlay.setMap(null);\n}",
"hideControls_() {\n this.overlay_.setAttribute('i-amphtml-lbg-fade', 'out');\n this.controlsMode_ = LightboxControlsModes.CONTROLS_HIDDEN;\n }",
"showOverlay_() {\n this.ove... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function will hide Login and Signup buttons and deliver login fields | function showLoginInfo (){
var LoginBtn = $("#firstLoginBtn");
LoginBtn.hide();
// var SignUp = $("#Sign-upBtn");
// SignUp.hide();
loginField.show();
} | [
"function HideAuth(){\n\t\n\tif ($j(\"#mykmx_login\"))\n\t\t$j(\"#mykmx_login\").toggleClass(\"hide\");\n\t\n\tif ($j(\"#myCarMax_login\"))\n\t\t$j(\"#myCarMax_login\").css(\"display\", \"block\");\n\t\n\tif ($j(\"#myCarMax_close\"))\n\t\t$j(\"#myCarMax_close\").css(\"display\", \"none\");\n\t\n\tif ($j(\"#myCarMax... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For nodes which are projected inside an embedded view, this function sets the renderParent of their dynamic LContainerNode. | function setRenderParentInProjectedNodes(renderParent, viewNode) {
if (renderParent != null) {
var node = viewNode.child;
while (node) {
if (node.type === 1 /* Projection */) {
var nodeToProject = node.data.head;
var lastNodeToProject = node.data.tail;
... | [
"function findRenderContainer(node, rootNode, container) {\n var currentNode = node.parentNode;\n if (!currentNode ||\n node === rootNode ||\n currentNode === rootNode ||\n currentNode === document.body ||\n currentNode === document.documentElement ||\n !(currentNode instanceof Element)) {\n return contai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
User input mouse pressed When the mouse is pressed the movement of the cubes should STOP make speed = 0 | function mousePressed(){
for (var i = 0; i < numCubes; i++){
speedX [i] = 0.0;
speedY [i] = 0.0;
}
} | [
"function mouseReleased (){\n for (var i = 0; i < numCubes; i++){\n speedX[i] = random (-4,4);\n speedY[i] = random (-4,4);\n }\n }",
"update () {\n /**\n * First, let's check of the player is near enough to make an attack. The distance between the mouse and the player is calculated\n * using Phas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks for basic equality between two sets of parameters for a helper view. Checked fields include: _helperName All args Hash Data Function and Invert (id based if possible) This method allows us to determine if the inputs to a given view are the same. If they are then we make the assumption that the rendering will be ... | function compareHelperOptions(a, b) {
function compareValues(a, b) {
return _.every(a, function(value, key) {
return b[key] === value;
});
}
if (a._helperName !== b._helperName) {
return false;
}
a = a._helperOptions;
b = b._helperOptions;
// Implements a first level depth comparison
... | [
"static areIdentical(){\n let temp\n\n for(let i = 0; i < arguments.length; i++){\n let argument = arguments[i]\n\n // handle NaN\n if(isNaN(argument.h)) argument.h = argument.h.toString()\n if(isNaN(argument.m)) argument.m = argument.m.toString()\n\n // handle string input\n if(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the authenticated view middleware | initializeMiddleware() {
if (this.hasInitialized) throw new Error('authenticated view middleware already initialized');
this.hasInitialized = true;
const {
htmlDirectory,
htmlFilename,
} = this.configuration;
const trshcmpctrClientRouter = express.Router();
trshcmpctrClientRouter.... | [
"function initMiddleware() {\n app.use(express.compress());\n app.use(express.static(__dirname + '/public'));\n app.use(express.logger());\n app.use(express.bodyParser());\n\n /**\n * Rendr routes are attached with `app.get()`, which adds them to the\n * `app.router` middleware.\n */\n app.use(app.route... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attribute directive: wfcontentitemupdateaction Listens to when an ngmodel changes on the same control, then emits the action as an event to be captured in a controller elsewhere. | function wfContentItemUpdateActionDirective() {
return {
restrict: 'A',
require: 'ngModel',
link: ($scope, $element, $attrs, ngModel) => {
var oldModelValue;
var $setter = ngModel.$setViewValue;
ngModel.$setViewValue = function() {
oldMod... | [
"modelChanged() {\n }",
"on_change(ev){\r\n\t\tthis.val = this.get_value();\r\n\t\t// hack to get around change events not bubbling through the shadow dom\r\n\t\tthis.dispatchEvent(new CustomEvent('pion_change', { \r\n\t\t\tbubbles: true,\r\n\t\t\tcomposed: true\r\n\t\t}));\r\n\t\t\r\n\t\tif(!this.hasAttribut... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select bluetooth (bt) as input source | selectInputSourceBluetooth() {
this._selectInputSource("i_bt");
} | [
"function BlueTooth() {\n\n var self = this,\n btSerial = null;\n \n function init() {\n \n //console.log('initSerial');\n \n btSerial = new (require('bluetooth-serial-port')).BluetoothSerialPort();\n \n btSerial.on('failure', btSerialFailureEvent);\n \n b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to set size of axes SVG and plot area canvases. | function setSize() {
var svg = document.getElementById('axis-svg')
// use style here, because width seems only a getter for svg
svg.style.width = (canvasPlot.plotGeometry.width + canvasPlot.plotGeometry.marginLeft + canvasPlot.plotGeometry.marginRight) + 'px';
svg.style.height = (canvasPlot.plotGeometry.height + c... | [
"resizeAxisCanvas() {\n const desiredWidth = this.visualizer.canvas.width;\n const desiredHeight = this.visualizer.canvas.height;\n\n if (this.canvas.width !== desiredWidth || this.canvas.height !== desiredHeight) {\n this.canvas.width = desiredWidth;\n this.canvas.height ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds (and possibly interpolates) the value for the specified iteration. | function interpolateValues(values, getter, i, iteration) {
if (i > 0) {
var ta = iterations[i], tb = iterations[i - 1],
t = (iteration - ta) / (tb - ta);
return getter(values[i]) * (1 - t) + getter(values[i - 1]) * t;
}
return gette... | [
"function interpolateValue(oldValue, newValue, i, steps) {\n return (((steps - i) / steps) * oldValue) + ((i / steps) * newValue);\n }",
"get takesValueFormattedTag() {\n return this._memoize('takesValueFormattedTag', () => {\n const takesValueType = 'takesValue'\n for (const ancestor of Pars... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Listen for 'ResourceUpdate' component events to determine when resources are added/removed | function onPluginComponentEvent(event) {
if (event.type == 'ResourceUpdated') {
var action = event.args.splice(7, 1)[0], type = event.args[0], item, resource = {
type: event.args[0],
id: event.args[1],
... | [
"_addResources(resources, forceUpdate = false) {\n for (const id in resources) {\n this.layerManager.resourceManager.add({\n resourceId: id,\n data: resources[id],\n forceUpdate\n });\n }\n }",
"function startResourceUpdate(resource) {\n return { type: START_RESOURCE_UPDATE,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that gives the value of the cookie for the num of the all races when u add to the cart shopping | function cookieRacesValues() {
let cart = document.getElementById("spanCart");
let result = getCookieValue('carreras');
//console.log("Result Cookie Carreras", result);
// If the result is not undefined we can work, else do nothing.
if (result !== undefined) {
if (result ==... | [
"function eatCookie() {\n cookiesEaten++;\n cookieInventory--;\n}",
"function updateCartOnLoad(){\n\tconsole.log(\"updateCartOnLoad()\");\n\tvar cookieString = getCookie('ListingID');\n\tif(cookieString == \"\") {\n\t\treturn;\n\t}\n\tvar ids = cookieString.split('|');\n\tvar i;\n\tfor(i = 0; i < ids.length; i+... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a tag whether from user input or from search results (typeahead) | tagFromInput(ignoreSearchResults = false) {
if (this.composing) return;
// If we're choosing a tag from the search results
if (this.searchResults.length && this.searchSelection >= 0 && !ignoreSearchResults) {
this.tagFromSearch(this.searchResults[this.searchSelection... | [
"function TagSuggest() {}",
"function addTag(input) {\n if (!input) {\n return;\n }\n var tag = createTag(input);\n tagOutput.appendChild(tag);\n}",
"function typeAhead(response) {\n\t\t// save the response in the parent scope\n\t\tarr = response;\n\t\t// Reset result list index to -1 (nothin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is used by passport.js for the authentication of the users This method is used for authentication of AD users by distinguishedName and password | function signInLdap(distinguishedName, password, callback) {
var result = ""; // To send back to the client
var client = ldap.createClient({
url: ldapOptions.serverUrl,
});
client.bind(distinguishedName, password, function (err) {
if (err) {
result += "Reader bind failed " + err;
logger.in... | [
"function signin (req, res, next) {\n\n passport.authenticate('local', function(err, user, info) {\n if (err || !user) {\n res.status(400).send(info);\n } else {\n // Remove sensitive data before login\n user.scrub();\n L.debug(\"\"+JSON.stringify(user));... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sorts transactions according to number of visits and formats each transaction as a MaterialUI List Item | formatPurchases(currentChildren, currentAddress, mapDate, transactions) {
let purchases = []
for (var key in currentChildren) {
purchases.push([key, currentChildren[key]])
}
purchases.sort((a, b) => {
return b[1].visits - a[1].visits
})
let listItems = purchases.map((purchase, inde... | [
"function categorize(transaction) {\n\t// get sign\n\tconst sign = transaction.amount < 0 ? '-' : '+';\n\n\t// create li\n\tconst item = document.createElement('li');\n\n\t// add innerHTML\n\titem.innerHTML = `${transaction.desc} \n <span>${sign}$${Math.abs(transaction.amount)}\n\t</span> `;\n\n\tlet categories ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse the given config to create a JSX navigation. TODOs: needs error handling put an empty message into the Dropdown, if empty | function navigationParser (navArray, level=0) {
if (navArray.length === 0) {
return <Nav.Item className="px-3">no sites found</Nav.Item>
}
return navArray.map(el => {
if (el.navigation) {
return (
<NavDropdown id={el.label} title={el.label} key={el.label}>
... | [
"function createNavigation() {\n \n // If a mobile device is detected, remove initial navigation list\n if (!isMobileDevice) {\n navigation.children(TAG_UL).html(CHAR_EMPTY);\n }\n \n // Iterate all available commands\n $.each(commands, function(key, v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get more results from spotify and append them to the current track search results Should only be called after searchSpotify() has been called once | function searchSpotifyAgain() {
let query = advancedSearch ? null : $('#simpleTrackSearchText').val();
$.ajax({
type: 'GET',
url: 'https://api.spotify.com/v1/search',
headers: {'Authorization': 'Bearer ' + spotifyAccessToken},
data: {
'q': query,
'type': a... | [
"function getSongs(Query) {\n var spotify = new Spotify(LiriTwitterBOT.spotify);\n if (!Query) {\n Query = \"what's+my+age+again\";\n };\n spotify.search({ type: 'track', query: Query }, function(err, data) {\n if ( err ) {\n console.log('Error occurred: ' + err);\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle clicking on deposit button. Either return success page or errors with form. | function deposit_click_handler(e) {
e.preventDefault();
$('#deposit').addClass('disabled');
$.post("addmeta/" + $('#sub_id').val(), $("#metaform_form").serialize(),
function(data) {
if (data.valid) {
//Load new page with success message
... | [
"function deposit() {\n\treset();\n\n\tvar amount = $('#amount').val();\n\tvar currency = $('#currency').val();\n\t$.ajax({\n\t\tcontentType: 'application/json; charset=UTF-8',\n\t\tdata: {\n\t\t\t'amount': amount,\n\t\t\t'currency': currency\n\t\t},\n\t\tdataType: 'json',\n\t\terror: function (jqXHR, textStatus, e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to collect details and push into localstorage | function collectDetail(){
employeeList.push({
"firstname":firstName.value,
"phone":phoneNo.value,
"email":emailId.value,
"location":employeeLocation.value
});
setLocalStorage("employeeList", JSON.stringify(employeeList));
} | [
"function addNew() {\r\n const retrievedMaster = localStorage.getItem(`master`);\r\n const retrievedMasterParsed = JSON.parse(retrievedMaster);\r\n retrievedMasterParsed.push([\r\n active.fields[0].e.value,\r\n active.fields[1].e.value,\r\n active.fields[2].e.va... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set onCLickListener utility in order to close dropdown onClick out of the component | dropdownClickListener() {
if (this.clickout) {
const dropdown = this.dropdown;
const rotate = this.rotateIcon.bind(this);
const button = this.slotted.assignedNodes()[0];
document.addEventListener('click', function(e) {
if ((e.target.tagName !== 'BUTTON' || e.target.id !== button.id)... | [
"close() {\n this.removeAttribute('expanded');\n this.firstElementChild.setAttribute('aria-expanded', false);\n // Remove the event listener\n this.dispatchCustomEvent('tk.dropdown.hide');\n }",
"function closeFilterDropdown() {\n document.getElementById('dropdownFilter').classList.remov... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check the given handler should mock the given request | function getMockForRequest( handler, requestSettings ) {
// If the mock was registered with a function, let the function decide if we
// want to mock this request
if ( $.isFunction(handler) ) {
return handler( requestSettings );
}
// Inspect the URL of the request and check if the mock handler's url
// ... | [
"function mock({ request = {}, response = {} }) {\n return nock(/\\.authy\\.com/)\n .get('/protected/json/app/stats')\n .query(request.query ? request.query : true)\n .reply(response.code, response.body);\n}",
"function testHandler(handler, logger, config, environment, host, port, tubePrefix, job, jobTy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
window opener function adapted for Edgesuite Flash movie | function openFlashWin(winFile,winName,myWidth,myHeight) {
myPopup = window.open(winFile,winName,'status=no,toolbar=no,scrollbars=no,width=' + myWidth + ',height=' + myHeight);
} | [
"openTrailer(trailer){\n window.open(trailer);\n }",
"function OpenWindow ( name, wTop, wLeft, wWidth, wHeight, url ) \n { \t \n var w = null;\n \n \tfeatures = \"resizable=1,scrollbars=1,height=\" + wHeight + \",width=\" + wWidth;\n \n \tif ( NS4 || NS6 )\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Declare a function that subtracts one creatures weapon damage from another creatures health | function dealDamage (attacker, defender){
// Subtract the weapon damage of the attacker from the health of the defender
defender.health-=attacker.weapon.damage;
// Return the defender object
return defender;
} | [
"receiveDamage(damage) { \n this.health = this.health - damage ;\n }",
"damage(damagePoints){\n this.hp -= damagePoints\n return damagePoints\n }",
"attack(enemy){\n enemy.hull -= this.firepower;\n}",
"applyDamage(victim, attackEntity) {\n // pre-extraction\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle the grid static state, which permanently removes/add Drag&Drop support, unlike disable()/enable() that just turns it off/on. Also toggle the gridstackstatic class. | setStatic(val) {
if (this.opts.staticGrid === val) {
return this;
}
this.opts.staticGrid = val;
this.engine.nodes.forEach(n => this._prepareDragDropByNode(n)); // either delete Drag&drop or initialize it
this._setStaticClass();
return this;
} | [
"showGrid(){\n this.Grid = true;\n this.Line = false\n \n }",
"function hideTiles() {\n const grid = document.getElementById('grid-tiles');\n\n grid.classList.add('hideGrid');\n grid.classList.remove('showGrid');\n }",
"function _toggleVisibility() {\n\n\t\tvisible = !visible;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Component: FlightSearchPage props: none Description: React function component that contains the input form and controls when the table of flights is displayed. This component is responsible for storing all input from the user and calling the appropriate custom hooks with that input. Children components include and . | function FlightSearchPage() {
// Query information needed to make a call to the Skyscanner API
const [origin, setOrigin] = useState(""); // flight origin
const [destination, setDestination] = useState(""); // flight destination
const [outboundDate, setOutboundDate] = useState(""); // outbound date
... | [
"function SearchOptions({ skills }) {\n // Using hooks we're creating local state for a search Term and a search Result\n const [searchTerm, setSearchTerm] = useState('');\n const [searchResults, setSearchResults] = useState([]);\n const handleChange = (event) => {\n setSearchTerm(event.target.value);\n };\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Temporary workaround to support strictNullCheck enabled consumers of ngc emit. In SNC mode, [] have the type never[], so we cast here to any[]. TODO: narrow the cast to a more explicit type, or use a pattern that does not start with [].concat. see | visitLiteralArrayExpr(ast, ctx) {
if (ast.entries.length === 0) {
ctx.print(ast, '(');
}
const result = super.visitLiteralArrayExpr(ast, ctx);
if (ast.entries.length === 0) {
ctx.print(ast, ' as any[])');
}
return result;
} | [
"array () {\r\n var track = this.track();\r\n\r\n return track ? track.array() : null\r\n }",
"getArrayFromPassedElem(elem) {\n // If it's already an array, simply return it.\n if (Array.isArray(elem)) {\n return elem;\n }\n\n // If it is an individual (and valid) value, return that as an ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find vote by candidatekey | async FindVoteByCandidateKey(ctx, candidatekey) {
let queryString = {};
queryString.selector = {};
queryString.selector.docType = 'vote';
queryString.selector.key = candidatekey;
return await this.GetQueryResultForQueryString(ctx, JSON.stringify(queryString)); //shim.success(quer... | [
"async FindCandidateByCandidateKey(ctx, candidatekey) {\n let queryString = {};\n queryString.selector = {};\n queryString.selector.docType = 'candidate';\n queryString.selector.key = candidatekey;\n return await this.GetQueryResultForQueryString(ctx, JSON.stringify(queryString));... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a generator of all the ancestor nodes above a specific path. By default the order is bottomup, from lowest to highest ancestor in the tree, but you can pass the `reverse: true` option to go topdown. | *ancestors(root, path) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
for (var p of Path.ancestors(path, options)) {
var n = Node.ancestor(root, p);
var entry = [n, p];
yield entry;
}
} | [
"*ancestors(root, path) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n for (var p of Path.ancestors(path, options)) {\n var n = Node$1.ancestor(root, p);\n var entry = [n, p];\n yield entry;\n }\n }",
"ancestors(path) {\n v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reconstruct a URI from its parts as a string. | function uriToString( uri ){
var s = "";
// XXX: need to figure out proper rules/exceptions for adding //
s += uri.protocol ? uri.protocol + "://" : "";
s += uri.authority || "";
s += uri.path || "";
s += uri.query ? "?" + uri.query : "";
s += uri.anchor ? "#" + uri.anchor : "";
return... | [
"uriParse(value) {\n return vscode.Uri.parse(value);\n }",
"function concatURI(a, b) {\n let started = b[0] === \"/\";\n let ended = a[a.length - 1] === \"/\";\n if (started && ended) {\n return `${a}${b.substr(1)}`;\n }\n if (started || ended) {\n return `${a}${b}`;\n }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cubic helper formula at percent distance | function CubicN(percent, a, b, c, d) {
const t2 = percent * percent;
const t3 = t2 * percent;
return a + (-a * 3 + percent * (3 * a - a * percent)) * percent +
(3 * b + percent * (-6 * b + b * 3 * percent)) * percent +
(c * 3 - c * 3 * percent) * t2 + d * t3;
} | [
"function slider_equation(val)\n{\n return (4.5 * Math.pow(val,2) - (0.75 * val) + 0.25);\n}",
"function charge(d) {\n return -Math.pow(d.radius, 2.0) / 8;\n }",
"function cubic_interp_1d(p0, p1, p2, p3, x) {\n\t// Horner-scheme like separation of coefficients to save multiplication... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
in: ICastEntity fromEntity, CastEffect effect, CastTarget targetList, double startTime | addEffectInstant( fromEntity, effect, targetList, startTime ) {
if( targetList.getType() == CastTargetType.ENTITIES ) {
var path = new CastEffectPath();
path.from = fromEntity;
path.radius = 0.0;
path.speed = 0.0;
path.startTime = startTime;
var targets = targetList.getEntityList();
for( var... | [
"addEffectInTransit( fromEntity, effect, targetList, startTime ) {\n\t\tvar speed = effect.getTravelSpeed();\n\t\tif( speed == 0.0 ) {\n\t\t\tthis.addEffectInstant(fromEntity, effect, targetList, startTime);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif( targetList.getType() == CastTargetType.ENTITIES ) {\n\t\t\tvar path = n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
6b To the previous sum function, add a validation to control if any of the parameters is not a number, show an alert clarifying that one of the parameters has an error and return the NaN value as a result | function totalPrice (a, b) {
if (typeof a === 'number' && typeof b === 'number'){
return a + b;
} else {
alert('One of the paramethers has an error')
if(typeof a !== 'number') {
return a;
} else {
return b;
}
}
} | [
"function totalPrice (a, b) {\n if (validateInteger(a) && typeof a === 'number' && validateInteger(b) && typeof b === 'number'){\n return a + b;\n } else {\n if(!validateInteger(a)) {\n alert(a + ': this value is not an integer');\n return Math.round(a);\n } else {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Old IE versions can't retain contents within noscript elements so this logic will store the contents as a attribute and the insert that value as it's raw text when the DOM is serialized. | function keepNoScriptContents() {
if (getDocumentMode() < 9) {
parser.addNodeFilter('noscript', function(nodes) {
var i = nodes.length, node, textNode;
while (i--) {
node = nodes[i];
textNode = node.firstChild;
if (textNode) {
node.attr('data-mce-innertext', textNode.value);
... | [
"function _content(node, content) {\n\t\t//\n\t\tvar contentType = node.nodeType == 1 ? 'innerHTML' : 'data';\n\t\t//\n\t\tif (content) node[contentType] = content;\n\t\t//\n\t\treturn node[contentType];\n\t}",
"function sanitizeTagContent(tagInnerContent, allowedAttributeList, allowJavascriptPrefix, allowQueryst... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This hook allows components to reliably use the 'mediaStreamTrack' property of an AudioTrack or a VideoTrack. Whenever 'localTrack.restart(...)' is called, it will replace the mediaStreamTrack property of the localTrack, but the localTrack object will stay the same. Therefore this hook is needed in order for components... | function useMediaStreamTrack(track) {
const [mediaStreamTrack, setMediaStreamTrack] = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(track === null || track === void 0 ? void 0 : track.mediaStreamTrack);
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
setMediaStreamTrack(track ==... | [
"updateAudioTrack(state, track) {\n\t\tVue.set(state.self.tracks, 'audio', track)\n\t}",
"function resumeTrack() {\n if (current_track_id !== null) {\n audioTracks[current_track_id].play();\n }\n}",
"updateVideoTrack(state, track) {\n\t\tVue.set(state.self.tracks, 'audio', track)\n\t}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adding big character to character page make a function where I generate an image element and attach it to characterAvatar then call the function each time | function generateImage(targetImage) {
if (generateImage){
var img = document.createElement('img');
img.setAttribute('src', targetImage);
var characterAvatar = document.getElementById('bigCharacter');
characterAvatar.appendChild(img);
}
} | [
"function add_character(char_icon, char_name, char_rarity, char_level) {\n if (char_level == 1) {\n row_1_data['char_icon'].setAttribute(\"src\", char_icon);\n row_1_data['char_name'].innerHTML = char_name;\n row_1_data['char_rarity'].setAttribute(\"src\", char_rarity);\n } else if (char_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Init South Africa Map | static initMapSouthAfrica() {
// Set Active Map
mapOptions['map'] = 'za_mill_en';
// Init Map
jQuery('.js-vector-map-south-africa').vectorMap(mapOptions);
} | [
"function initMap() {\n $('#widgetRealTimeMapliveMap .loadingPiwik, .RealTimeMap .loadingPiwik').hide();\n map.addLayer(currentMap.length == 3 ? 'context' : 'countries', {\n styles: {\n fill: colorTheme[currentTheme].fill,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Current inventory from db then display output in console | function displayInventory() {
queryString = "SELECT * FROM products";
// db query
db.query(queryString, function(err, data) {
if (err) throw err;
console.log(chalk.bgGreen.white("Current Inventory:"));
console.log(".................\n");
var stringOutPut = "";
for (var i = 0; i < data.length... | [
"function showInventory() {\n console.log('You are carrying, ' + inventory.toString())\n}",
"showInventory() {\n var response = \"\";\n if (this.inventory.length > 0) {\n response = \"INVENTORY\\n\";\n for(var i = 0; i < this.inventory.length; i++) {\n // if the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle dates. "nocount" means secondary dates if true. | function toggleDate(timestamp, noCount)
{
try {
if(noCount)
{
var noCountDateArray = getSubDates();
//Secondary dates. Store many hooray
var sidx = noCountDateArray.indexOf(timestamp);
if(sidx != -1)
{
noCountDateArray.splice(sidx, 1); //Remove if found
}
else
{
//...add if n... | [
"function toggleSingleDate(setCheckedTo){\n\tdocument.getElementById('singleDate').checked=setCheckedTo;\n}",
"function hideDates() {\n\t\t\t\tlet dates = $('.dates');\n\t\t\t\tdates.fadeOut('slow', ()=>{dates.remove();});\n\t\t\t\titems.unbind('click', hideDates);\n\t\t\t}",
"function CalendarToggle() {\n\tif ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================ FUNCTION SETTING PAGE ============================ | function settingPage(autoSave = autoSaveGET,useLibraryJS = useLibraryJSGET,language = languageGET) {
//___CREATED obj SETTING___
var objSetting = {
'autoSave': autoSave,
'useLibraryJS': useLibraryJSGET,
'language': languageGET
}
//___SET STORAGE SETTING___
storageSET('settingPage',objSetting);
} | [
"function setContactPage(){\r\n setPage('contact-page');\r\n }",
"function setHomeDefaults() {\n sessionStorage[\"datacen\"] = \"All\";\n sessionStorage[\"network\"] = -1;\n sessionStorage[\"farm\"] = -1;\n}",
"function loadSettingsPage() {\n refreshRunesButton = true; // Reset togg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
encode method ABI object with values in an array, output bytecode | function encodeMethod(method, values) {
var signature = method.name + '(' + utils.getKeys(method.inputs, 'type').join(',') + ')';
var signatureEncoded = '0x' + new Buffer(utils.keccak256(signature), 'hex').slice(0, 4).toString('hex');
var paramsEncoded = encodeParams(utils.getKeys(method.inputs, 'type'), value... | [
"function getBytecode() {\n console.log(web3.eth.getCode(crowdsale.address));\n//\"0x\"\n//data: '0x' + bytecode\n}",
"static encode(domain, types, value) {\n return (0, index_js_4.concat)([\n \"0x1901\",\n TypedDataEncoder.hashDomain(domain),\n TypedDataEncoder.from(typ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
01. Sum First Last | function sumFirstLast(arr) {
console.log(Number(arr[0]) + Number(arr[arr.length - 1]));
} | [
"function intermediateSums(arr) {\n var lastSet = arr.length % 10;\n var sum = 0;\n for (var i = arr.length - 1; i > arr.length - (1 + lastSet); i--) {\n sum += arr[i];\n }\n arr[arr.length] = sum;\n // for loop incremented by 11 (10 plus the total one)\n for (var i = 0; i < arr.length; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
determines if a planItem needs a runner and if so, will go and find one. | async _findIfNeedsRunner(planItem, position) {
if (planItem.size === '2.5x7') {
const findNextRunner = this._findNextRunnerInPlan(planItem.id);
// try to find the runner in our current plan
if (findNextRunner) {
const runnerIndex = this._plan.plan.filter((x) =... | [
"async _runnerFiller(planItem, currentIndex) {\n const totalRunners = this._plan.plan.filter((_pi) => _pi.size === '2.5x7');\n const findRunnerIndex = totalRunners.findIndex((r) => r.id === planItem.id);\n const findFirstOrderDate = totalRunners.sort((a, b) => {\n return moment(a.ord... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hiding the canvassection In case no language or no phone is selected | function showCanvas() {
destroyCanvas();
if (languageValue === "" || phoneValue === "") {
console.log("naaaaah, les filtres sont pas remplis!")
} else {
console.log("way to go, bro! On crée les canvas!")
createCanvas();
}
} | [
"function showingHiddingCanvas(mode){\r\n\t\r\n\t let x = document.getElementById(\"display-mode\");\r\n\t x.style.display = mode;\r\n\r\n}",
"function hideLanding() {\r\n let videoBox = document.getElementById('video-box');\r\n let textBar = document.getElementById('text-bar');\r\n let exp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
use this to get info on the first tier2 class a unit reclassed to add ['class'] or ['level'] to the returned object to get the corresponding value | function getFirstTier2() {
var firstTier2Object;
var firstTier2Level = 100;
if (parallelSealsUsed > 0) {
for (var i=0; i<parallelSeals.length; i++) {
if (parallelSeals[i]) {
var templevel = parallelSeals[i]['level'];
if (templevel > 20 && templevel < firstTier2Level) {
firstTier2Level = tem... | [
"function getLatestTier1() {\n\t\tvar latestTier1Object;\n\t\tvar latestTier1Level = 0;\n\t\tif (parallelSealsUsed > 0) {\n\t\t\tfor (var i=0; i<parallelSeals.length; i++) {\n\t\t\t\tif (parallelSeals[i]) {\n\t\t\t\t\tvar templevel = parallelSeals[i]['level'];\n\t\t\t\t\tif (templevel < 21 && templevel > latestTier... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name: Draw Response Author: Peter Chen Purpose: Response infographic elements, both phone and email Arguments: DrawResponse(canvas_name, x_position, y_position, Response_by_Mail_data, Response_by_Phone_data); Data format: value Example: DrawResponse("myCanvas", 0, 0, 1000, 1200); | function DrawResponse(c, x, y, kpiMail, kpiPhone) {
var canvas = document.getElementById(c);
var context = canvas.getContext("2d");
context.save();
img = new Image();
context.fillStyle = "#8ED6FF";
//find out the percentage between Mail and Phone
var kpiTotal = kpiMail + kpiPhone;
var MailP = kpiMail/kpiTotal;... | [
"function getRespondeeResponseForm(attributes, response) {\n\n var div = document.getElementById('divRespondeeResponse');\n\n response = getRespondeeResponseContent(div, response);\n}",
"function DrawAvgRespTime (c, x, y, d) {\n\tvar canvas = document.getElementById(c);\n\tvar context = canvas.getContext(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NOTE: Clears the whole tile directory first and then runs gdal_retile | function gdalRetile(infilepath, layerName, targetDir, levels='2', srid='EPSG:4326', tileDim='1024') {
return new Promise((resolve, reject) => {
rimraf(path.join(targetDir, '*'), (err, data) => {
sh('gdal_retile.py -r bilinear -co "TFW=YES" -ps ' + tileDim + ' ' + tileDim + ' -s_srs ' + srid + ' -of GTiff... | [
"function resetTiles() {\n\t\tvar positions = createPositionArray(xCount, yCount, diameter);\n\t\t\n\t\tfor(var i = 0; i < tiles.length; i++){\n\t\t\ttiles[i].setPosition(positions.pop());\n\t\t}\n\t\trotateTiles();\n\t\tgroupTiles();\n\t}",
"finalize() {\n for (const tile of this._cache.values()) {\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Collect input from loginPanel.form and dispatch SessionEvent.LOGIN | function loginClickHandler() {
var values = this.getLoginForm().getValues();
var e = new ExtJSCodeSample.event.SessionEvent(values.username, values.password, this.getRememberMeCheckBox().getValue());
this.application.fireEvent(ExtJSCodeSample.event.SessionEvent.LOGIN, e);
} | [
"function handleLogInSubmit() {\n $('body').on(\"submit\", \"#form-log-in\", (event) => {\n event.preventDefault();\n const credentials = {\n username: $('#username-txt').val(),\n password: $('#password-txt').val()\n }\n doUserLogIn({\n credentials,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: handleJsonImport Params: event | function handleJsonImport(evt) {
// Loop through the FileList and render image files as thumbnails.
//project = new Project();
var files = evt.target.files; // FileList object
for (var i = 0, f; f = files[i]; i++) {
var reader = new FileReader();
reader.onload = (function(theFile) {
return func... | [
"function uploadJSON() {\r\n\r\n}",
"function LoadJson(){}",
"function init() {\n loadJSON(function(response) {\n let actual_JSON = JSON.parse(response);\n triggered(actual_JSON);\n });\n}",
"function readSingleFile(evt) { \n var f = evt.target.files[0]; //The tar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================================================= Auth factory to login to get information inject $http for communicating with API inject $q to return promise objects inject AuthToken (function created below) to manage tokens | function Auth($http,$q,AuthToken){
//auth factory object
var authFactory = {}
//handle login
authFactory.login = function(username, password){
return $http.post('/api/v1/authenticate', {
username: username,
password: password
})
.success(function(data){
Aut... | [
"function auth($http, $q, AuthToken) {\n // create auth factory object\n const authFactory = {\n login,\n logout,\n isLoggedIn,\n getUser,\n createSampleUser,\n };\n\n // return auth factory object\n return authFactory;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set up the Dreamliner flight path | function dreamFlightPath(x, y, zx, zy, colour) {
var ax = 200 + x;
var ay = 700 + (y - 150);
var bx = 255 + (zx - 100);
var by = 500 + (zy - 400);
controls = map.set(
map.circle(x, y, 15).attr('fill', '#fff'), map.circle(zx, zy, 15).attr('fill', '#FFFFFF'));
... | [
"dijkstraHandler(indoorDestination, indoorDestinationFloor) {\n const updatedDirectionPath = {};\n const [waypoints, graphs, floors] = this.indoorDirectionHandler(\n indoorDestination, indoorDestinationFloor\n );\n\n if (waypoints.length > 0) {\n const paths = dijkstraPathfinder.dijkstraPathfi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calles when points of the own team are updated. | function teamPointsUpdate(event, points){
self.points = points;
} | [
"updatePoints() {\n \n if (this.props.format === 'stroke') {\n // *** no points to be calculated ***\n return\n }\n \n if (this.props.format === 'match') {\n /**************************************************************\n * Assigns point to player with lowest score\n * ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |