query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
invoke selectvalue function, for popup grid, generate custom restriction if exist regreq_type two case: if it is 'Permit and License' View. call method 'selectRequirementCommon' with a parameter 'extraRes' of sql condition regreq_type in ('License', 'Permit'); verse call original common method 'selectRequirementCommon'... | function customSelectRequirementCommon(){
var extraRes = " and regrequirement.regreq_type in ('License', 'Permit') ";
if(abCompSelectRequirementController.isPermitsAndLicenses){
selectRequirementCommon('abCompSelectRequirementConsole', 'regrequirement','multiple',extraRes);
}else{
selectRequirementCommon('abComp... | [
"function customSelectRequirementCommon(){\n\t\n\tvar extraRes = \" and regrequirement.regreq_type in ('License', 'Permit') \";\n\t\n\tif(typeof(permitController)!='undefined'&&permitController.isPermit){\n\t\tselectRequirementCommon('abCompDrilldownConsole', 'regrequirement','multiple',extraRes);\n\t\t\n\t}else{\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Interprets using the `lli` executable the VSL code. Resolves when execution is finished | async interpret() {
const byteCode = await this.emitRawStream();
await new Promise((resolve, reject) => {
let lli = spawn('lli', [], {
stdio: ['pipe', 'inherit', 'inherit']
});
byteCode.pipe(lli.stdin);
lli.on('error', reject);
... | [
"function executeVLT(i) {\n const vs = cop2VS(i);\n const vt = cop2VT(i);\n\n const vco = rsp.VCO;\n let vccLo = 0;\n let vccHi = 0;\n for (let el = 0, select = rsp.vecSelectU32[cop2E(i)]; el < 8; el++, select >>= 4) {\n const s = rsp.getVecS16(vs, el);\n const t = rsp.getVecS16(vt, select & 0x7);\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Partitions the section of the given array between the given left and right indices to be properly partitioned. An initial pivot value is chosen based on the pivotFunction passed in. | function partition(pivotFunction, array, left, right) {
let originalLeft = left;
// get pivot based on the user's pivot-selection choice
let pivot = pivotFunction(array, originalLeft, right);
// get the value at the pivot from the array
let pivotValue = array[pivot];
// swap the elements at pivot and original le... | [
"function partition(arr, pivot, left, right){\n var pivotValue = arr[pivot],\n partitionIndex = left;\n \n for(var i = left; i < right; i++){\n if(arr[i] < pivotValue){\n swap(arr, i, partitionIndex);\n partitionIndex++;\n }\n }\n swap(arr, right, partitionIndex);\n return par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to setup all public and private events for bot. | setupEvents() {
this.eventEmitter
.on('close', () => {
this.botInterface.emit('close');
})
.on('connect', () => {
this.loadSavedEvents();
})
.on('reconnect', () => {
this.reconnect();
})
.on('shutdown', () => {
this.botInterface.emit('shutdow... | [
"function initEvents(client, bot) {\n\tclient.on(\"message\", (message) => {\n\t\tif (!message.guild) return;\n\t\ttry {\n\t\t\tclient.events.get(\"message\").func(bot, message);\n\t\t} catch (err) {\n\t\t\tconsole.error(err);\n\t\t}\n });\n client.on(\"ready\", ()=>{\n try {\n\t\t\tclient.events.get(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Appends arguments passed in to the base document url and returns the same. | function AppendArgumentsToBaseUrl() {
var url = GetBaseUrlPath();
for (arg_index = 0; arg_index < arguments.length; arg_index++) {
url += arguments[arg_index];
}
return url;
} | [
"function addUrlArgs (url, args){\r\n if (!args)\r\n return url;\r\n if (url.indexOf('?') < 0)\r\n url += '?';\r\n else if (url.substr(url.length-1) != '&')\r\n url += '&'; \r\n if (matTypeof(args == 'object'))\r\n return url + implodeUrlArgs (args); \r\n return url + args;\r\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
takes number and rounding level start value n>=s | function roundTo(n, r, s){
return (Math.floor((n-s)/r)*r)+s
} | [
"function roundTo(n, increment = 1) {\n return Math.round(n / increment) * increment;\n }",
"function maximizeNumberRoundness(n) {\n\n}",
"function round(a){return Math.floor(a);}",
"function roundN(num,n){\n return parseFloat(Math.round(num * Math.pow(10, n)) /Math.pow(10,n)).toFixed(n);\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle super page functionality popup products | function _handleSuperPage() {
// Attach XHR handler to send product data
easy.events.on(easy.EVENT_JQUERY_READY, function ($) {
$(document).ajaxSuccess(function (event, jqxhr, settings) {
easy.addExceptionHandling(function () {
if (settings.url.match(/^\/V... | [
"function _handleProductPage() {\n var productId = scopeWindow.location.pathname.split('/').pop();\n _parseProduct(productId, document.querySelector('article.product'));\n }",
"function notAProductPage () {\n alert(\"Sorry, WishThis only works on product pages.\");\n }",
"function openProdu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
code TODO: ptdhCtrl | controller_by_user controller by user | function controller_by_user(){
try {
} catch(e){
console.log("%cerror: %cPage: `ptdh` and field: `Custom Controller`","color:blue;font-size:18px","color:red;font-size:18px");
console.dir(e);
}
} | [
"function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page index => custom controller\");\n\t\t\tconsole.log(e);\n\t\t}\n\t}",
"function controller_by_user(){\n\t\ttry {\n\t\t\t\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"error: page storie_singles => custom con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggles the container. / / The identifier. / The sender identifier. / The show text. / The hide text. | function toggleContainer(id,senderId,showText,hideText){var el=jQuery('#' + id);var sender=jQuery('#' + senderId);el.toggle(function(){sender.attr("title",hideText);sender.html(hideText);sender.addClass('hide');},function(){sender.attr("title",showText);sender.html(showText);sender.addClass('show');});} | [
"function showHide(elementId, containerId) {\r\n $(elementId).on('click', function(e) {\r\n e.preventDefault();\r\n $(containerId).toggleClass('is-hidden');\r\n });\r\n}",
"function toggleVisibility(idButton, idTarget, toggleContentName) {\n\tvar targetEle = document.getElementById(idTarget);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Insert articles into Article collection | function addArticles(articles) {
console.log(`Adding ${articles.length} articles`);
articles.forEach(item => {
db.Article.findOneAndUpdate({
link: item.link
},
item, {
upsert: true,
returnNewDocument: true
})
.then(d... | [
"function addArticles(articles) {\n console.log(`Adding ${articles.length} articles`);\n \n articles.forEach(item => {\n // const article = new db.Article(item);\n \n // \"unique\" constraint doesn't seem to work sometimes(?)\n // somehow allowing to insert duplicates\n // article\n // .save(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates new Room instance from arguments DB: register new room register room.users in roomUsers add roomId to each list of user rooms in userRooms return room | create(userIdList, props, callback) {
(props = props || {}).uid = firebase.auth().currentUser.uid;
let room = new Room(this._chatPath, props);
room.createdAt = room.updatedAt = new Date();
room.creatorId = firebase.auth().currentUser.uid;
room.users = uniqueKeys((userIdList || [... | [
"createRoom() {\n check(arguments, Match.OneOf({}, undefined, null));\n\n this.unblock();\n\n let id = Rooms.insert({\n owner: this.userId,\n connected: [],\n });\n\n Roles.addUsersToRoles(this.userId, id, Roles.GLOBAL_GROUP);\n\n return id;\n }",
"function createRooms(room) {\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Navigate to the tickets page of a current training room | function navigateToTickets(roomId){
window.location.href = "tickets.html?roomId=" + roomId;
} | [
"function navigate(num) {\n console.log(\"Navigating to \" + num);\n if (typeof num !== \"undefined\" && num != \"home\") {\n window.location.href = \"https://ithelp.uoregon.edu/Ticket/Display.html?id=\" + num;\n } else {\n window.location.href = \"https://ithelp.uoregon.edu\";\n }\n}",
"function workou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function update the .cdmarker position on hover | function updateHoverNav() {
var hoverItem = $('.cd-hover'),
hoverItemPosition = hoverItem.index() + 1,
leftPosition = hoverItem.offset().left,
backgroundColor = hoverItem.data('color'),
marker = $('.cd-marker');
marker.removeClassPrefix('color').addClass('color-'+ hoverItemPosition).css({
'le... | [
"function handleHover(centered, d){\n mediumlightBar(mapObj[d.properties.ID].realname);\n}",
"function markerHover() {\n\n\t\tthis.setIcon(highlightedIcon);\n }",
"getMarkersHoverOn(marker) {\n marker.on('mouseover', function(e) {\n marker.openPopup();\n });\n }",
"function m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Concatenates a list of `tf.Tensor3D`s along an axis. See `concat` for details. For example, if: A: shape(2, 1, 3) = | r1, g1, b1 | | r2, g2, b2 | B: shape(2, 1, 3) = | r3, g3, b3 | | r4, g4, b4 | C = tf.concat3d([A, B], axis) if axis = 0: C: shape(4, 1, 3) = | r1, g1, b1 | | r2, g2, b2 | | r3, g3, b3 | | r4, g4, b4 | i... | function concat3d_(tensors, axis) {
return exports.concat(tensors, axis);
} | [
"function concat3d_(tensors, axis) {\n return _concat.concat(tensors, axis);\n}",
"function concat3d_(tensors, axis) {\n return concat(tensors, axis);\n}",
"function concat3d_(tensors, axis) {\n return concat(tensors, axis);\n}",
"function concat3d_(tensors, axis) {\n return (0, _concat.concat)(tensors,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change textField's value to upperCase | function changeToUpperCase(field) {
var valueStr = new String(field.value);
field.value = valueStr.toUpperCase();
} | [
"function textToUpperCase(field)\n{\n field.value = field.value.toUpperCase();\n return true;\n}",
"function _Field_toUpperCase(){\n\tthis.setValue(this.getValue().toUpperCase(), null, false);\n\treturn true;\n}",
"function setFieldsToUpperCase(){\r\n\tfor(var i=0;i<arguments.length;i++) {\r\n\t\targument... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change values determined by product family (when choosing product) | function changeProductValues() {
showHideProductValues();
enableDisableCreditFields();
} | [
"function changeMprod() {\n spec.miningProd = getMprod()\n itemUpdate()\n}",
"function setClassification() {\n var classification = document.getElementById('classification');\n var product = document.getElementById('product');\n var selected_product = product.value; \n var select_classification ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mediator es una clase generica que puede ser utilizada para interactuar con servicios de datos de manera asincrona | function Mediator()
{
// Super
psd.framework.EventDispatcher.call(this);
// Id de la peticion actual
var _id = "0";
// Url de la peticion actual
var _url = "";
// Parser de la peticion actual
var _parser = null;
//Indica ... | [
"function Mediator() {\n\n \tthis._events = {};\n\n }",
"function Mediator() {\n this.events = {};\n}",
"function serviceActuators(method, query, data, resp) {\n\twriteHeaders(resp);\n\t\n\t// Parse the json DATA request\n\trequest = JSON.parse(data);\n\tif(!request) {\n\t\terror(0, resp);\n\t\treturn;\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert array to Map using number indexes as keys | function arrayToMap (arr) {
const result = new Map()
arr.forEach((value, index) => result.set(index, value))
return result
} | [
"function arrayToIndexMap (arr) {\n const result = new Map()\n arr.forEach((value, index) => result.set(value, index))\n return result\n}",
"function indexMap (arr){\n var newArray = arr.map(function(val, idx){\n return val * idx\n })\n return newArray\n}",
"mapArray(array = [], key) {\n const map =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Efetua a alteracao do gerente da unidade | function alterarGerenteUnidade(){
var tecnico = DWRUtil.getValue("comboTecnicoHelpDesk");
var unidade = DWRUtil.getValue("comboUnidade");
if((tecnico==null ||tecnico=='')){
alert("Selecione um tecnico do HelpDesk para alterar o gerente.");
}else{
if (confirm("Você tem certeza que deseja alterar o gerente da un... | [
"function alterarTipoGerencia(){\n\tvar unidade = DWRUtil.getValue(\"comboUnidade\"); \n\tvar tipoGerencia = DWRUtil.getValue(\"comboGerencia\"); \n\tFacadeAjax.alterarGerencia(unidade,tipoGerencia);\n}",
"function mostrarGerenteUnidade(){\n\tvar unidade = DWRUtil.getValue(\"comboUnidade\"); \n\tFacadeAjax.getGe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RETURN CURRENT CENTER COORDINATES amSetCenterCoords(map_id, long, lat, zoom) This function is called by the chart when you request this information by calling getCenterCoords() function | function amSetCenterCoords(map_id, long, lat, zoom) {
Ammap.publish('amsetcentercoords', map_id, long, lat, zoom);
} | [
"mapCenter(lat, lng){\n this.map.setCenter({lat: lat, lng: lng});\n }",
"function getMapCenter() {\n \n var mapCenterCoords = [30, 0];\n\n return mapCenterCoords;\n \n}",
"function calculateCenter() {\n center = map.getCenter();\n }",
"function calculateCenter(){\n c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fires when a pokemon is clicked, grabs info about it and populates info box with info about the pokemon by calling the relevant function | function onPokeClick(pokemon){
let pokeInfo = $.get("http://pokeapi.co/api/v1/pokemon/" + pokemon.attr("id"), function(data){
console.log(data);
populatePokemanInfo(data);
}, "json");
} | [
"function addEventListener(button, pokemon) {\n button.addEventListener('click', function() {\n showDetails(pokemon);\n });\n }",
"function addListener(button, pokemon) {\n button.click(function() {\n showDetails(pokemon);\n });\n }",
"function playerSelect() {\n $(\".pokemon .poke-cont... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fills in missing fields in certificate extensions. | function _fillMissingExtensionFields(e, options) {
options = options || {};
// populate missing name
if(typeof e.name === 'undefined') {
if(e.id && e.id in pki.oids) {
e.name = pki.oids[e.id];
}
}
// populate missing id
if(typeof e.id === 'undefined') {
if(e.name && e.name in pki.oids) {... | [
"function _fillMissingExtensionFields(e,options){options=options||{};// populate missing name\nif(typeof e.name==='undefined'){if(e.id&&e.id in pki.oids){e.name=pki.oids[e.id];}}// populate missing id\nif(typeof e.id==='undefined'){if(e.name&&e.name in pki.oids){e.id=pki.oids[e.name];}else{var error=new Error('Exte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts new chat into the HTML | function insertNewChat(val) {
// Create the div element to contain the chat message
var div = document.createElement("div");
div.setAttribute("class", "chat-item");
// Create the p element to hold the text
var para = document.createElement("p");
para.setAttribute("class", "chat-text");
var ... | [
"function insertChatMessage(msg) {\n var formattedDate = moment(msg.timeStamp).format(\"LT\");\n var fromPlayer = playersById[msg.userId];\n insert(\"chat\", \"<div style='border-left-color: \" + fromPlayer.color\n + \"'><article><b>\" + msg.sender + \":</b><p class='msg-content'>\" \n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handler for click on reserve buttons | handleClickReserve(event)
{
let text = event.toElement.id.replace("reserve", "");
let ISBN = text === "" ? null : text;
this.sendReservation(ISBN);
} | [
"loadReserve() {\n this._qs(\".reserve\").addEventListener(\"click\", () => this.reserve());\n }",
"function reserveSquareClicked(event) {\n reservePieceIsSelected = true;\n activePiece = event.target;\n }",
"function seatsRegisterClick() {\n\t//To each clickable assign the action\n\t$('.cl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cs142MakeMultiFilter / Returns an arrayFilterer that can be used to repeatedly filter / elements out of the originalArray. | function cs142MakeMultiFilter(originalArray) {
let currentArray = originalArray.slice();
return function arrayFilterer(filterCriteria, callback) {
if (typeof(filterCriteria) !== "function") {
return currentArray;
}
for (let i = currentArray.length - 1; i >= 0; i--) {
... | [
"function arrayFilterer (filterCriteria, callback) {\n if (filterCriteria !== undefined ) {\n currentArray=currentArray.filter(filterCriteria);\n if (typeof callback === 'function') {\n callback.call(originalArray, currentArray);\n }\n return arrayFilterer;\n }\n else {\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function hides the previous word, displays the current word, and records click times | function doTimer(words, clickTimes, divWords, prevTime, divInstr) {
// set the timer
var currTime = new Date().getTime();
var elapseTime = currTime - prevTime;
prevTime = currTime;
if(counter > 0) {
var prevWordIndex = counter-1;
var prevWord = document.getElementById("word"+prevWordIndex);
prevWord.... | [
"function showNewWords(data, vis, spiral, new_thread) {\n vis.update(data, spiral)\n setTimeout(function() { \n \tif (new_thread || total_thread < 2) {\n \t\tshowNewWords(data, vis, spiral, false);\n \t} else {\n \t\ttotal_thread -= 1;\n \t}\n }, 3000)\n}",
"function displayOne() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search for duplicate MD5 digest | function duplicate_md5(md5)
{
print("Searching for duplicate file (via MD5 digest)");
var md5_file=new File(attachment_dir + "md5.lst");
if(!md5_file.open("r"))
return(null);
var duplicate=false;
var str;
while(!md5_file.eof && !duplicate) {
str=md5_file.readln();
if(str==null)
break;
if(str.substr(0,... | [
"function md5(text) {\n\treturn text && text.match(/[0-9a-f]{32}/i);\n}",
"digest() {\n return crypto\n .createHash(\"md5\")\n .update(JSON.stringify(this, (key, val) =>\n val instanceof Set ? [...val].sort() : val))\n .digest(\"hex\");\n }",
"md5(input)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PROTECTED Sets a new map's dotted selection and writes it inside the map with all the dotted network elements it involves. Initially the dotted selection is not visible. It will only turn to visible while dragged. | function setMapDottedSelection() {
this.dottedSelection = new DottedSelection();
this.dottedSelection.write();
for (var i = 0; i < this.selectedNetworkElements.getLength(); i++) {
this.dottedSelection.addDottedNe(this.selectedNetworkElements.get(i));
}
} | [
"function setMapSelection() {\n\t\tthis.selectedNetworkElements = new List();\n\t\tvar oX = this.selection.getOriginX();\n\t\tvar oY = this.selection.getOriginY();\n\t\tvar fX = oX + this.selection.getFinalX();\n\t\tvar fY = oY + this.selection.getFinalY();\n\t\tfor (var i = 0; i < this.networkElements.getLength();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets current key to the clicked photo and renders the image on main display | onClickPhoto(imgKey) {
this.setState({current: Number(imgKey)})
} | [
"imageClicked(imgIndex){\n\t\tvar newImageSrc = this.getNewCurrentImage(this.state.isCharacterizedViewEnabled, imgIndex);\t\t//Retrieve the new current image to be displayed on screen\n\t\tthis.setState({ currentImageIdx: imgIndex, currentImageSrc: newImageSrc });\t\t\t\t\t\t//Set new component state and re-render ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Grade the i'est question, then call the (i+1)'est or send the score | function gradeQuestion(i) {
if (i >= questionsToGrade.length) {
$('#question-iframe-container').removeClass('gradingQuestions');
hideQuestionIframe();
sendScores();
return;
}
$('#question-iframe-container').addClass('gradingQuestions');
var curQuestion = questionsToGrade[... | [
"function getQuestionJudge(i){\n progress += 1;\n scorenumber = 0;\n if(Option[i - 1] === Answer) {\n checkAnswer.innerHTML = \"Correct!\";\n rightScore += 25;\n console.log(rightScore);\n }else{\n checkAnswer.innerHTML = \"Wrong!\";\n timeremain -= penalty;\n }\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Leave Intent handler. Handle leave less than one day. Will save all line message regardless of valid status | function leaveHandler(next) {
return async agent => {
console.log('leaveHandler');
const { body } = agent.request_;
const {
specialIndicator,
action,
timePeriod,
time,
timeType
} = body.queryResult.parameters;
const { data } = body.originalDetectIntentRequest.payload;... | [
"function buttonLeaveHandler() {\n log('Leaving room...');\n activeRoom.disconnect();\n }",
"onLeave(e = {}) {\n if (this.isChanged()) {\n return e.returnValue = 'You haven\\'t posted your message. If you leave this page, your message will not be saved. Are you sur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the total number of words sent by a participant | function sentWords(conversation, participant) {
// Extract data
messages = conversation.messages
// Filter data
sentMessages = messages.filter(sentBy(participant))
// Analyze data
totalWords = 0;
sentMessages.forEach(message => totalWords += wordsInMessage(message))
// Return value
... | [
"function receivedWords(conversation, participant) {\n // Extract data\n messages = conversation.messages;\n\n // Filter data\n receivedMessages = messages.filter(notSentBy(participant))\n\n // Analyze data\n totalWords = 0;\n receivedMessages.forEach(message => totalWords += wordsInMessage(mes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
prints the chain of block | showChain() {
getAllLevelDBData()
.then(data => {
console.log('*'.repeat(100))
console.log(data)
console.log('*'.repeat(100), '\n')
})
.catch(err => {
console.log("Error occurred while calling getAllLevelDBData - showBlockChain")
})
} | [
"printCurrentChain() {\n console.log(JSON.parse(JSON.stringify(blockChain)));\n }",
"function print() {\n console.log(blocks);\n }",
"function printChain(o){\n console.log(\"=== printChain (begin) ===\");\n var level = 1;\n\n function print(level, value){\n\tconsole.log(\" ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
crea el grupo de radios asociados a un nombre y lo inserta en el elemento que se le dice. no devuelve nada xD | function createRadioGroup(options, name, parent) {
for (let i = 0; i < options.length; i++) {
let radioTemp = document.createElement("input");
radioTemp.type = "radio";
radioTemp.value = options[i];
radioTemp.id = options[i];
radioTemp.name = name;
let label = crear... | [
"function AddRadioButtonGroup(row, caption, name) {\n // ajout de caption dans la cellule (row, 0)\n CellSetText(row, 0, caption);\n\n // parcourt des arguments qui suivent row, caption et name\n // exemple: si on fait l'appel suivant\n // AddRadioButtonGroup(row, caption, name, \"masculin\", \"fémin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gives the index of the current segment we are in given time elapsed. Will return the last segment still if race has ended | _getSegIndex (timeElapsed) {
let i = this._cachedIndex
// Invariant a[0..i].startTime < timeElapsed
while (i+1 < this._dna.length && this._dna[i+1].startTime < timeElapsed) i++
this._cachedIndex = i
return i
} | [
"function currentTimeSegment(timeFrame) {\n\t\tvar step = $scope.timeSegmentsList[0].segmentRange;\n\t\tvar indexInTimeSegments = Math.floor(timeFrame / step);\n\t\tif (indexInTimeSegments == $scope.timeSegmentsList.length) indexInTimeSegments--;\n\t\treturn indexInTimeSegments;\n\t}",
"getSegment(deltaTime) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pipes the response from downloading an individual file to the appropriate destination stream while decoding gzip content if necessary | pipeResponseToFile(response, destinationStream, isGzip) {
return __awaiter(this, void 0, void 0, function* () {
yield new Promise((resolve, reject) => {
if (isGzip) {
const gunzip = zlib.createGunzip();
response.message
... | [
"pipeResponseToFile(response, destinationStream, isGzip) {\n return __awaiter(this, void 0, void 0, function* () {\n yield new Promise((resolve, reject) => {\n if (isGzip) {\n const gunzip = zlib.createGunzip();\n response.message\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the route manager. Don't call this until the app is ready to consume the route parameters. | initialize() {
this.rootScope_.$on('$routeUpdate', this.onRouteUpdate.bind(this));
this.initialized_ = true;
this.onRouteUpdate();
} | [
"async init() {\n let routesJsonData = await app.LocalLoad.jsonFile(\n app.PathHelper.getPath(app.Config.ROUTE_INFO_FILE));\n\n app.Log(\"Call router to resolve\");\n routesJsonData.routes.forEach(item => {\n item.path = item.path.to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reflectSprite loads a sprite from disk, reflects it about the center of the given dimension, and outputs the result to disk Arguments: dimension: reflect over either 'x' or 'y' dimensions inputFile: filename of JSON sprite to load outputFile: filename to save JSON sprite | function reflectSprite (dimension, inputFile, outputFile) {
var sprite = JSON.parse(fs.readFileSync(inputFile, { encoding: 'utf8' }));
sprite.pixels = reflect(dimension, sprite.pixels);
fs.writeFileSync(outputFile, JSON.stringify(sprite));
} | [
"function displaySprite(sprite, x, y, width, height) {\r\n\t\tif (x === void 0) { x = sprite.x + sprite.velocity.x; }\r\n\t\tif (y === void 0) { y = sprite.y + sprite.velocity.y; }\t\r\n\t\t\r\n\t\tif (width !== void 0) { sprite.scale.width = width;}\r\n\t\tif (height !== void 0) { sprite.scale.height = height; }\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deep map values (not array) | function deepMapValues(collection, mapper = _.identity) {
return _.mapValues(collection, (i, k) => {
return _.isObject(i) && !_.isArray(i)
? deepMapValues(i, mapper)
: mapper(i, k);
});
} | [
"function deepMap(obj, fn) {\n // If the transform function transforms the value, regardless of type, return\n // the transformed value.\n const mapped = fn(obj)\n if (mapped !== obj) {\n return mapped\n }\n\n // Recursively deep map arrays and plain objects, otherwise return the value.\n if (Array.isArra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3. determine which AI to use// determins which AI to use & if it is the AI's turn | function aiFunc(){
if (playerTurn ==1){
return
}
if (playerTurn == 0){
if (ai ==1){
pickSquare ()
}
if (ai==2){
mediumAI ()
}
}
} | [
"AI(){\n // determine AI Stance\n if ( (this.first ==='ai' && this.turn===0) || (this.first==='ai'&&this.turn===1) ){\n this.aiStance='setup'\n }\n else if(this.playerboard.length >3){\n // AI tries to kill your monsters\n this.aiStance= 'clearBoard';\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Goal: Build a molecular structure from a URL pdbfile | function ReadPDBurl(URL,callback)
{
var name = PDButil.stripName(URL);
var request = new XMLHttpRequest();
request.open('GET', URL, true);
request.onload = function() {
var text = request.responseText;
loadStructureHandler(text);
};
request.send();
//When file is read, this function is cal... | [
"function LM_getUrlStructure(anode,pdbname){\r\n pdbname = pdbname.toLowerCase();\r\n if (pdbname.length === 4) {\r\n if (anode.data.surface)\r\n {\r\n if (anode.data.opm === 1){\r\n //replace purl\r\n return opm_url+ pdbname +\".pdb\";//cellpack_repo+\"opm/\" + pdbname + \".mmtf\";\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the current highlighted tabs. updates active tab index and sets previous active to false | function updateCurrentActiveIndex() {
chrome.tabs.query({
highlighted: true
}, function (tabs) {
for (var index = 0; index < tabs.length; index++) {
var tab = tabs[index];
var allTabs = user.tabsSortedByWindow[tab.windowId];
var previousActiveIndex = user.activeTabIndex[tab.windowId];
var timeStamp = ... | [
"function highlightTabs() {\n for (let el of document.getElementsByClassName('tab'))\n\t\tel.classList.remove('activeTab')\n\n for (let pane of Tracker.panes)\n pane.activeTab.element.classList.add('activeTab')\n}",
"updateTabHighlight() {\n let currentPath = window.location.pathname;\n // Tab ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open the cache and store static files | function updateStaticCache() {
return caches.open(cacheName)
.then( cache => { return cache.addAll(cacheFiles);});
} | [
"function cacheStatic(response, cache, absPath){\n\tif (cache[absPath]) {\t\t\t\t\t\t\t\t\t\t\t//Checks if file is cached in memory\n\t\tsendFile(response, absPath, cache[absPath]);\t\t\t\t//If it is, it sends it to the browser\n\t}else {\n\t\tfs.exists(absPath, function(exists) {\t\t\t\t\t\t//Check if file exists\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the next set of results, or resolves to null if no results are available | getNext() {
if (this.hasNext) {
const items = new Items(this.nextUrl, null).configureFrom(this.parent);
return items.getPaged(this.innerParser);
}
return new Promise(r => r(null));
} | [
"get next() {\n if (this.last !== null) {\n try {\n let { data } = this.last;\n let { offset, limit, total, count } = data;\n if (offset + count < total) {\n this.params.offset = offset + limit;\n return this;\n }\n } catch (e) {\n return null;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if consonant ends in "qu" | function quCheck(string, i){
if (string.substr(i - 1, 2) === "qu") {
return true;
} else {
return false;
}
} | [
"function containsQu(solutions, ending) {\n\n let regEx = /(qu{1})|(Qu{1})/;\n\n solutions.forEach(word => {\n word = word.toLowerCase();\n\n let test = regEx.test(word);\n if (test == true) {\n return ending = true;\n }\n });\n return ending;\n\n\n}",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if the /complete/trends/apple route in the API has a response length of more than 5 | test_complete_trends_apple() {
axios.get("https://protected-ravine-04165.herokuapp.com/complete/trends/apple")
.then((response) => {
if(response.data.length > 5) {
console.log("TEST: API /complete/trends/apple returns data - PASSED");
} else {
cons... | [
"test_trends_apple() {\n axios.get(\"https://protected-ravine-04165.herokuapp.com/trends/apple\")\n .then((response) => {\n if(response.data.length > 5) {\n console.log(\"TEST: API /trends/apple returns data - PASSED\");\n } else {\n console.log(\"TE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dispatching 'remove Sound' in order to remove the selected sound from the array receiving the object of the selected sound to be remove | removeSound({commit}, data){
commit('removeActiveSound', data)
} | [
"removeSound() {\n this._soundAssetUUID = null;\n }",
"function del_sound(id) {\n console.log(\"Deleting sound by index:\" + id);\n var arr = geo_audio_samples.splice(id, 1);\n update_geo();\n return arr[0];\n}",
"function removeOne(event) {\n\tvar instance = getCurrentSound();\n\tif (instance =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DescriptionParametrically drive a user parameter /! Copyright (C) 2015 Hans Kellner: MIT License: See / This is a script for Autodesk Fusion 360 that parametrically drives a user parameter. Installation: Copy this scripts folder into your Fusion 360 "My Scripts" folder. You may find this folder using the following step... | function run(context) {
"use strict";
if (adsk.debug === true) {
/*jslint debug: true*/
debugger;
/*jslint debug: false*/
}
var PARAM_OPERATION = {
LOOP_ONLY: 0,
//CLONE_SELECTION: 1,
EXPORT_FUSION: 1,
EXPORT_IGES: 2,
EXPORT_SAT: 3,
... | [
"function run(context) {\n\n \"use strict\";\n\n if (adsk.debug === true) {\n /*jslint debug: true*/\n debugger;\n /*jslint debug: false*/\n }\n\n var PARAM_OPERATION = {\n LOOP_ONLY: 0,\n EXPORT_FUSION: 1,\n EXPORT_IGES: 2,\n EXPORT_SAT: 3,\n EXPO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a csv row from an array | function csv(array){
// this is not a world class csv generator
return array.map(function(item){
return typeof(item) === 'string' ?
item.replace(/[\",]/g,'') :
item;
}).join(',')
} | [
"function csv(array){\n\n // this is not a world class csv generator\n return array.map(function(item){\n return typeof(item) === 'string' ?\n item.replace(/[\\\",]/g,'') :\n item;\n }).join(',');\n}",
"function CSV(array) {\n // Use first element to choose the keys and the order\n var keys... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The await keyword can be used to block asynchronous functionality Normally, JavaScript is nonblocking and executes the rest of the code as asynchronous code like promises are handled in the background. But the await keyword allows you to wait for the promise to resolve or reject before executing the following code | async function test() { // to use await, it must be in a function marked by the async keyword
try { // try/catch is used to handle resolved/rejected promises
const boomerangStatus = await boomerang; // this blocks the following console.log
console.log('boomerangStatus', boomerangStatus);
} catch(error) {
... | [
"async function awaitTest() {\n try {\n // call async function with await, this pause the async function execution until primose resolved\n const result = await asyncOperation()\n console.log(result)\n } catch (e) {\n console.error(e)\n }\n}",
"async function awaitAsyncCall() {\n\t//\n\tlet result ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Will retrieve our speakers list for displaying | getAllSpeakers() {
return speakers;
} | [
"async getAvailableSpeakers() {\n const headers = this.key\n ? { Authorization: `Bearer ${this.key}` }\n : undefined;\n\n try {\n const response = await axios({\n url: `${VOICERY_URL}/speakers`,\n method: \"get\",\n headers\n });\n return response.data;\n } cat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add new subject ID to JSON file (main file to be converted to excel) | function addSubjectIDToJSON(subjectID) {
if ($("#form-add-a-subject").length > 0) {
addTheRestSubjectEntriesToJSON();
}
} | [
"function modJson(id, newEntry) {\n json.id = newEntry\n}",
"function storeSubjectName(){\n\n\tsubjectHeader = splitURI(dbJson).split('.')[0];\n}",
"function addSentenceToJson(singleSentence, givenJson){\n var myId = givenJson.data.documents.length + 1;\n myId = myId.toString(10);\n givenJson.data.documents... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to get all core courses from programme courses | function getCoreCourses(courses) {
var core = [];
for (var i=0; i<courses.length; i++) {
if (courses[i].type === "Core") {
core.push(courses[i]);
}
}
return core;
} | [
"function returnCourses(){\n\treturn allCourses\n}",
"function courses () {\n const api = require('./api')\n\n return api.courses.getCourseNames().map(course => {\n return {\n type: TYPES.COURSE,\n path: `/course/${course}/`,\n sitemap: { priority: 1, changefreq: 'monthly', lastmod }\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update central logo position and size | function updateLogoTransforms() {
var docW = window.innerWidth;
var docH = window.innerHeight
var logoSizeRatio = 0.5;
logoWidth = Math.min(maxWidth, docW * logoSizeRatio);
var height = logoWidth / ratio;
if (height > docH * logoSizeRatio) {
height = docH * l... | [
"function updateLogoTransforms() {\n var docW = window.innerWidth;\n var docH = window.innerHeight\n var logoSizeRatio = 0.75;\n\n logoWidth = Math.min(maxWidth, docW * logoSizeRatio);\n var height = logoWidth / ratio;\n if (height > docH * logoSizeRatio) {\n height = docH * logoSizeRatio;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets indexes 0 through 3 of masterCode.code to randomly generated numbers ranging from 0 to 9. It then converts each index into a Number class using number.js | constructor(){
this.code = [];
this.cheat = [];
for (var i = 0; i < 4; i++){
this.code[i] = getRandomIntInclusive(0, 9);
this.cheat[i] = this.code[i];
this.code[i] = new Number(this.code[i]);
}
} | [
"function newNumbers() {\n\t\tmagicNumber = Math.floor(Math.random() * 120) + 19;\n\t\tcrystal1Num = Math.ceil(Math.random() * 12);\n\t\tcrystal2Num = Math.ceil(Math.random() * 12);\n\t\tcrystal3Num = Math.ceil(Math.random() * 12);\n\t\tcrystal4Num = Math.ceil(Math.random() * 12);\n\t}",
"function loadCodes() \n{... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array with the words from specified text | function getWords(text)
{
let startWord = -1;
let ar = [];
for(let i = 0; i <= text.length; i++)
{
let c = i < text.length ? text[i] : " ";
if (!isSeparator(c) && startWord < 0)
{
startWord = i;
}
if (isSeparator(c) && startWord >= 0)
... | [
"function getWordsFromText(text) {\n\t //var pattern = /[\\wА-Яа-я]+/g;\n //return text.match(pattern);\n return text.split(\" \");\n }",
"function getWords(text) {\n if (text.length > 0){\n return text.split(' ');\n } else return []\n}",
"async words(contentText) {\n //TODO\n let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a new game and questions | function newGame(){
var create1 = new genQuestion(question1);
var create2 = new genQuestion(question2);
var create3 = new genQuestion(question3);
var create4 = new genQuestion(question4);
var create5 = new genQuestion(question5);
} | [
"function createGame() {\r\n createBoard();\r\n createCoins();\r\n createRules();\r\n}",
"function createGame(choices){\n\tmessageDisplay.textContent = \"\";\n\tcreateOptions(choices);\n\tanswerSet = generateRandomSet(choices);\n\tanswer = options[answerSet][2];\n\tquestion1.textContent = options[answerSet][0]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Each letter of a word scores points according to its position in the alphabet: a = 1, b = 2, c = 3 etc. You need to return the highest scoring word as a string. If two words score the same, return the word that appears earliest in the original string. All letters will be lowercase and all inputs will be valid. | function high(x){
let result = '';
let bestScore = 0;
let arrayWord = x.split(' ');
for (let p = 0 ; p < arrayWord.length ; p++ ){
let wordScore = 0;
for (let k = 0; k < arrayWord[p].length; k++){
let code = arrayWord[p].toUpperCase().charCodeAt(k)
if (code > 64 && code < 91 ) wordScore ... | [
"function highestScoringWord(string) {\n const alphabet = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"];\n const scoreMapper = string\n .split(\" \")\n .reduce((result... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
convert an LatLngBounds (Leaflet) to extent (ArcGIS) | function boundsToExtent (bounds) {
bounds = leaflet.latLngBounds(bounds);
return {
'xmin': bounds.getSouthWest().lng,
'ymin': bounds.getSouthWest().lat,
'xmax': bounds.getNorthEast().lng,
'ymax': bounds.getNorthEast().lat,
'spatialReference': {
'wkid': 4326
}
};
} | [
"function boundsToExtent (bounds) {\n\t bounds = leaflet.latLngBounds(bounds);\n\t return {\n\t 'xmin': bounds.getSouthWest().lng,\n\t 'ymin': bounds.getSouthWest().lat,\n\t 'xmax': bounds.getNorthEast().lng,\n\t 'ymax': bounds.getNorthEast().lat,\n\t 'spatialReference': {\n\t 'wkid': 4326\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Open wine section when url have wine | function hrefWine() {
const href = window.location.href;
if (href.slice(-4) == "wine") {
setTimeout(() => {
document.querySelector(".tab-title").click();
setTimeout(() => {
let headerHeight = document.querySelector('header').clientHeight;
const re... | [
"function openSpecificRestaurantWindo() {\n\t\t\t\twindow.open(\"resturantPage.html\");\n\t\t\t}",
"function openHTMLInOxygen() {\r\n helper.open(window.location.href)\r\n}",
"function goToLink(e, obj){\n var link = obj.part.data.link;\n if(link != '#'){\n window.open(link, '_blank');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the fragment shader according to type (fShader is global) | function setFragmentShader( type ) {
if ( type == CONSTANTS.STRIPE )
fShader = $('#shader-fs-stripes');
else if ( type == CONSTANTS.BRICK )
fShader = $('#shader-fs-bricks');
else
fShader = $('#shader-fs-checkers');
} | [
"setFragmentShader(shader) {\n\n // Bind the fragment shader\n this.fragmentShader = shader;\n\n // Generate the program again\n this.generate();\n }",
"set fragmentShaderSource(newValue) {\n this._fragmentShaderSource = newValue;\n this.initializeWebGL(); // redo initialization with new render... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shows or hides Paymentfilter edits | function switchPaymentFilter(flag) {
var trId = "trPaymentFilter";
Element[flag ? 'show' : 'hide'](trId);
} | [
"function showEditButtons () {\n $element.parent().find('.edit-button').css('visibility', 'visible');\n }",
"function _controlFilterVisibility(){\n\t\t\tlet visibility = _properties.hasFilter ? \"block\" : \"none\";\n\t\t\t_$filter.css(\"display\", visibility);\n\t\t\t_$filter.attr(\"pla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
writeCellCode(rowID, dateCode, thisDay, thisMonth) | function writeCellCode(rowID, dateCode, thisDay, thisMonth, thisYear) {
/** Using the details provided append the correct row with the cell
code. **/
var l1 = '<td><ul id="'+dateCode+'">';
var l2 = '<li class="liBold">'+thisDay+' <span class="month">';
var l3 = monthName[thisMonth]+' '+thisYear+'</span>... | [
"function writeNextMonth(){\n\t//create an array of month names to reference. note: january starts at array element position 0, not 1.\n\tvar monthName = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\n\t\n\t//updat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tracks a request promise, starting and then ending the request (triggering new slots). | trackRequestPromise(handle, promise) {
this.startRequest(handle);
promise.then(() => this.endRequest(handle)).catch(() => this.endRequest(handle));
} | [
"finishRequest(aRequest) {\n let requestIndex = this._requestQueue.indexOf(aRequest);\n if (requestIndex >= 0)\n this._requestQueue.splice(requestIndex, 1);\n // signal the queue to fire any pending requests\n this.queueRequest(null);\n }",
"_makeNextRequest() {\n this._waiting = true;\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Permutes the dependencies into topological order | function topoSort (deps) {
// Build reversed adjacency list
var adj = {}
var inDegree = {}
var index = {}
deps.forEach(function (dep) {
var v = dep.id
var nbhd = Object.keys(dep.deps)
index[dep.id] = dep
inDegree[v] = nbhd.length
nbhd.forEach(function (filename) {
var u = dep.deps[fi... | [
"function topoSort (deps) {\r\n // Build reversed adjacency list\r\n var adj = {}\r\n var inDegree = {}\r\n var index = {}\r\n deps.forEach(function (dep) {\r\n var v = dep.id\r\n var nbhd = Object.keys(dep.deps)\r\n index[dep.id] = dep\r\n inDegree[v] = nbhd.length\r\n nbhd.forEach(function (fi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create group of Stars | createStars() {
const stars = this.physics.add.group({
key: STAR_KEY,
// Create a star and add/clone 11 more + (create 1 + clone 11 = 12 stars)
repeat: 11,
// Place them on the X horizontal axis 14 pixels from the left
// Place them on the Y vertical axis 0 pixels from the top
// Distance between th... | [
"createStars(space){\n for(var x = 100; x < space.starFieldWidth; x+= 150 )\n for(var y = 100; y < space.starFieldHeight; y += 150)\n space.stars.push(new Star(x, y));\n }",
"function generateStars() {\n let nostars = [];\n for (let i = 0; i < props.numberOfStars; i++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds expected state of contract using custom variables specified in test. | async function expectedState(token, stateChanges, accounts, name) {
let state = {}
switch (name) {
case 'BearBucks':
state = {
'totalSupply': 0,
'balanceOf': {
'a0': 0, 'a1': 0, 'a2': 0, 'a3': 0, 'a4': 0, 'a5': 0, 'a6': 0, 'a7': 0
},
'allowance': {
'a0': {
'... | [
"function buildExpectedPartialState(\n emptyState,\n customState,\n ignoreExtraCustomVars\n) {\n // for each item in customVars, set the item in expectedState\n const expectedState = clone(emptyState);\n\n for (const variableName in customState) {\n // do I ignore extra values\n if (Object.prototype.has... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Goal: Build a molecular structure from a local pdbfile | function ReadPDBfile(file,callback)
{
var self = this;
var name= PDButil.stripName(file.name);
//Assigning Properties by reading the file
var pdbfileReader = new FileReader();
//Reads the file
pdbfileReader.readAsText(file);
//When file is read, this function is called
pdbfileReader.onload = l... | [
"function readPDBfile(lines) {\n // Declare local variables\n var i, j;\n var x, y, z;\n var bond1, bond2;\n var A, symbol, line;\n var Qtitle = new Array();\n var molecule = Mol();\n var atomnum_limit = 2000;\n\n // Write file information to information window\n var molname = lines[0].split(/\\s+/)[1];\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Agregar diagnostico en el caso que no se aya registrado anterioemente | function agregarDiagnostico(diag, cie, idc, callback){
token=$('#token').val()
$.ajax({
url: '../AgregarDiagnostico',
type: 'POST',
headers: {'X-CSRF-TOKEN': token},
data: {
diag: diag,
cie: cie,
idc: idc,
},
success: function (respuesta){
callback(respuesta)
},
error: function (){
ale... | [
"function Registra(){\n if(attivo == 0)\n {\n attivo = 1; //disalbilito il pulsante se la registrazione è già partita\n registrazione.record(suono); //fa partire la registrazione\n }\n}",
"function Agregar_movimiento(){\r\n\t\tvar msg = \"Desea Agregar un NUEVO REGISTRO?.. \";\r\n\t\tif(confir... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
inputType : val description pressed : mouse button pressed (0 = left, 1 = right, 2 = middle, ..) doublepressed : mouse button pressed wheeled : scroll wheel used (1 = scroll up, 1 = scroll down) note: using the scroll wheel will trigger both pressed and wheeled inputTypes. For me scroll wheel is key 5 and 6 Click Behav... | function mouseInputFilter(inputType, val)
{
var pos = GameUI.GetScreenWorldPosition();
var behavior = GameUI.GetClickBehaviors();
//add custom targeting here e.g. vector targeting
//scroll functionality
if( inputType === "wheeled" ||
(inputType === "pressed" && (val == 5 || val == 6))){
if(ENABLE_SCR... | [
"function Input(e)\n {\n\n\t\t\t if(!DataIntf.Enabled) \n\t\t\t { \n\t\t\t Mouse.getXYPosition(e);\n\t\t\t ccl.Mouse.getXYPosition(e);\n\t\t\t //ROOMS\n \t\t\t switch(Room.Index)\n\t\t\t {\n\t\t\t case 0://menu principal\n\t\t\t\t Intf.Input();\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Service implementation If not specified, maxItems assumed unlimited | function ShoppingListService(maxItems) {
var service = this;
// List of shopping items
var items = [];
// Servie method for adding item
service.addItem = function (itemName, quantity) {
console.log('inside additem');
if ((maxItems === undefined) || (maxItems !== undefined... | [
"setMaxItems(value) {\n if (value === 0) value = null; //reset to unlimited items.\n\n this.settings.maxItems = value;\n this.refreshState();\n }",
"setMaxItems(value) {\n\t if (value === 0) value = null; //reset to unlimited items.\n\n\t this.settings.maxItems = value;\n\t this.refreshState();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calcIslamic Update from Islamic calendar | function calcIslamic()
{
setJulian(islamic_to_jd((new Number(document.islamic.year.value)),
document.islamic.month.selectedIndex + 1,
(new Number(document.islamic.day.value))));
} | [
"function calcIslamic()\n{\n setJulian(islamic_to_jd((new Number(document.islamic.year.value)),\n document.islamic.month.selectedIndex + 1,\n (new Number(document.islamic.day.value))));\n}",
"function calcGregorian()\n{\n updateFromGregorian();\n}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A utility function to display the nth image or video in the specified frame Used in showFile(), nextFile() and previousFile(). | function setupFrameContent(n, frame) {
// Make sure n is in range
if (n < 0 || n >= files.length) {
frame.clear();
return;
}
var fileinfo = files[n];
if (fileinfo.metadata.video) {
videodb.getFile(fileinfo.name, function(file) {
frame.displayVideo(file,
fileinfo.me... | [
"function setupFrameContent(n, frame) {\n // Make sure n is in range\n if (n < 0 || n >= files.length) {\n frame.clear();\n delete frame.filename;\n return;\n }\n\n var fileinfo = files[n];\n\n // If we're already displaying this file in this frame, then do nothing\n if (fileinfo.name === frame.filen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns string with list of files in VCFiles of VCFilters collection files source VCFiles or VCFilters collection delim delimiter | function combFiles(files, delim)
{
var ret = "";
for (var i = 1; i <= files.Count; ++i)
{
if (ret != "")
ret += delim;
ret += files.Item(i).RelativePath;
}
return ret;
} | [
"function filterCreateVCFilter(parent)\r\n{\r\n var VCFilter;\r\n if (null == this.Name)\r\n VCFilter = parent;\r\n else\r\n {\r\n VCFilter = parent.AddFilter(this.Name);\r\n if (null != this.Id)\r\n VCFilter.UniqueIdentifier = this.Id;\r\n if (null != this.Filter)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Size of the queue, filtered by the given options. For example, this can be used to find the number of items remaining in the queue with a specific priority level. | sizeBy(options) {
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
return this._queue.filter(options).length;
} | [
"sizeBy(options) {\n return this._queue.filter(options).length;\n }",
"sizeBy(options) {\n return this._queue.filter(options).length;\n }",
"get queue_size() {\n // NOTE: _queue is the internal reference to pending commands\n // eslint-disable-next-line @typescript-eslint/ban... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Booking View Full details | function bookingViewFullDetails(bookid){
//alert('Mani'); return false;
//myPopupWindowOpen('#bookingViewFullDetailsPop','#maska');
//Form
$('#bookingFullDetailsList').html('<div class="addtocartloading" ><span class="image"><img src="'+jssitebaseUrl +'/theme/default/images/loader.gif" border="0" alt="Loading... | [
"function showBooking(d) {\n\t\t\n\t\t//calculate total price and add the room info to main data\n\t\tdata.total_price = d.price * parseInt(d.quantity);\n\t\tdata.room_types = [{\n\t\t\tid: d.room_id,\n\t\t\trate_plan_id: d.rate_id,\n\t\t\tquantity: d.quantity,\n\t\t\ttotal_price: data.total_price,\n\t\t\tcurrency:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert from a bitArray to an array of bytes. | fromBits(arr) {
const bl = bitArray.bitLength(arr);
const byteLength = bl / 8;
const out = new Uint8Array(byteLength);
let tmp2;
for (let i = 0; i < byteLength; i++) {
if ((i & 3) === 0) {
tmp2 = arr[i / 4];
}
out[i] = tmp2 >>> 24;
tmp2 <<= 8;
... | [
"function bitsArrayToBytesArray(array) {\n\n for (x = 0; x < 4; x++) { // Boucle 4 fois pour les 4 bytes de 8 bits\n\n var pre_array = [];\n for (y = 0; y < 8; y++) { // Boucle 8 fois pour les 8 bits\n pre_array.push(array[0]); // On ajoute la première valeur\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new break point object and add it to the list of break points. | function MakeBreakPoint(source_position, opt_script_break_point) {
var break_point = new BreakPoint(source_position, opt_script_break_point);
break_points.push(break_point);
return break_point;
} | [
"addBreak(label)\n {\n this.elements.push({\n type: \"break\",\n label: label\n });\n }",
"addPoint(point){\n\t\tthis.pointsList.push(point)\n\t}",
"function setBreakPoint(newBP) {\n\tthisBreakPoint = newBP;\n}",
"function Breakpoints() {\n this._onEditorBreakpointAdd = this._onEditorBreakp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create list of events at the point of a time with count of entered and left cars | function createEventList (eventsTimeline) {
return eventsTimeline.reduce(function(allEvents, event) {
// If time does not exist in array add this time with initial value 0
if (!allEvents[event.time]) {
allEvents[event.time] = 0;
}
... | [
"numberOfEvents(){\n let upComing = 0;\n let expired = 0;\n for (const [key, value] of Object.entries(this._schedule)){\n if (value[0] > new Date().getTime()){\n upComing++;\n }else {\n expired++;\n }\n }\n return [upC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To select Originator for the launched form. Arguments: None Sample Call: SP_SelectOriginatorLaunched(); Note: To use this function following keywords fields are necessary: SELECT field with name "mastercontrol.task.originator" and INPUT field with name "mastercontrol.form.currentuser" | function SP_SelectOriginatorLaunched()
{
var oListOriginator = document.getElementById("mastercontrol.task.originator");
var sCurrentUser = document.getElementById("mastercontrol.form.currentuser").value.toLowerCase();
var i;
var sItemValue = "";
for (i=0; i<oListOriginator.length;i++)
{
sItemValue = oListOri... | [
"function SP_SetTaskCreator()\n{\n\tvar creatorName = document.getElementById(\"mastercontrol.form.creatorname\").value;\n\tvar creatorId = document.getElementById(\"mastercontrol.form.creator\").value;\n\tvar creator = document.getElementById(arguments[0]);\n\tcreator.value = creatorName+\" (\"+creatorId+\")\";\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Catalog contains zero or more multilayer datasets One layer is always "active", corresponding to the currently selected layer in the GUI or the current target in the CLI | function Catalog() {
var datasets = [],
defaultTargets = [];// saved default command targets [{layers:[], dataset}, ...]
this.forEachLayer = function(cb) {
var i = 0;
datasets.forEach(function(dataset) {
dataset.layers.forEach(function(lyr) {
cb(lyr, dataset, i++);
... | [
"setActiveLayer(layer) {\r\n this.activeLayer = layer;\r\n }",
"function getCurrentLayers() {\nvar comp = getCurrentComp();\nif (!comp) return null;\nvar layers = comp.selectedLayers;\nif (!layers.length)\n{\nalert(tr(\"No selected layer.\\nPlease select a layer/property.\"));\nreturn null;\n}\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If a resolver is defined, it must be a function. | function isValidResolver(resolver) {
return resolver == null || typeof resolver === 'function';
} | [
"function isValidResolver(resolver) {\n return resolver == null || typeof resolver === 'function';\n }",
"function isVariantResolver(variant) {\n return typeof variant === \"function\";\n}",
"function Resolver() {}",
"function ResolvedFunctionType() {\n}",
"function toResolver(resolve) {\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
implPath :: Array String > Nullable Function | function implPath(path) {
return _funcPath (false, path, implementations);
} | [
"function implPath(path) {\n return _funcPath(false, path, implementations);\n }",
"isPath(value) {\n return Array.isArray(value) && (value.length === 0 || typeof value[0] === \"number\");\n }",
"function arrayifyPath(path) {\n return path.replace(/\\.(\\d)\\./g, '._arr[$1].');\n}",
"isPath(value) ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make this function return the least expensive item. | function leastExpensive(items) {
var current2 = groceries[0].cost;
for(var i = 0; i < groceries.length; i++){
if(groceries[i].cost < current2) {
current2 = groceries[i].cost;
}
}
return current2;
} | [
"function leastExpensive(items) {\n var leastExpensiveItem = items[0];\n for (var i = 0; i < items.length; i++) {\n if (items[i].cost < leastExpensiveItem.cost) {\n leastExpensiveItem = items[i];\n }\n }\n return leastExpensiveItem;\n}",
"function MinimumItem()\r\n{\r\n var minitem, min = 10000000... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Represents a Wix Activity Type, representing both the schema definition and the Wix Activity name | function ActivityType(name, schema) {
/**
* The name of the Activity Schema
* @member
* @readonly
*/
this.name = name;
/**
* The path to the Activity JSON Schema
* @member
* @readonly
*/
this.schema = schema;
} | [
"function WixActivity() {\n\n /**\n * Updates to the existing contact that performed this activity. The structure of this object should match the schema for Contact, with the relevant fields updated.\n * @member\n * @type {Object}\n */\n this.contactUpdate = schemaFactory(this.TYPES.CONTACT_CR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test whether an input object is 1D. Assumes we already know the object is an array. Looks only at the first element, if the dimensionality is not consistent we won't figure that out here. | function isArray1D(a) {
return !isArrayOrTypedArray(a[0]);
} | [
"__is_1D_array(arr) {\n if ((typeof (arr[0]) == \"number\") || (typeof (arr[0]) == \"string\") || (typeof (arr[0]) == \"boolean\")) {\n return true\n } else {\n return false\n }\n }",
"function isArray1D(a) {\n return !isArrayOrTypedArray(a[0]);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the number of titles that were launched in 2015. field: title_year | function titlesFrom2015() {
let movies15 = [];
data.map((movie)=>{
if (movie.title_year === 2015){
movies15++
}
return null;
});
return movies15;
} | [
"function titlesFrom2015() {\n let count = 0;\n data.forEach(obj => {\n if(obj.title_year === 2015) {\n count += 1\n }\n })\n return count;\n}",
"function titlesFrom2015() {\n let movies2015 = 0;\n data.map((movie) => {\n if (movie.title_year === 2015) movies2015 += 1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the resize direction | function getDirection(e) {
var opts = $(e.data.target).resizable('options');
var tt = $(e.data.target);
var dir = '';
var offset = tt.offset();
var width = tt.outerWidth();
var height = tt.outerHeight();
var edge = opts.edge;
if (e.pageY > offset.top && e.... | [
"function getDirection(e) {\r\n\t\tvar opts = $(e.data.target).resizable('options');\r\n\t\tvar tt = $(e.data.target);\r\n\t\tvar dir = '';\r\n\t\tvar offset = tt.offset();\r\n\t\tvar width = tt.outerWidth();\r\n\t\tvar height = tt.outerHeight();\r\n\t\tvar edge = opts.edge;\r\n\t\tif (e.pageY > offset.top && e.pag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cria os elementos html dos eventos (cards) de acordo com seu estado | function createAndAddEvents(deck, eventsObj, headerType) {
let parent = document.createElement('div')
parent.innerHTML =
`<div class="card border-secondary" data-id="${eventsObj.id}" data-toggle="modal" data-target="#formModal">
<div class="card-header p-0 d-flex text-center ${headerType}">
... | [
"function buildDOM(){\n var area = document.getElementsByClassName(\"cardArea\")[0];\n for(var i = 0; i < gameCards.totalCards; i++){\n var div = document.createElement('div');\n div.className = \"card\";\n area.appendChild(div);\n div.setAttribute(\"id\", i);\n var domDispObj = {\n obj: div,\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
whoWon should return 0 if the game is not yet finished, 1 or 2 depending on which player won, else 3 if the game is a draw. | function whoWon () {
if (!quiz.isGameOver) return 0
if (quiz.player1Points > quiz.player2Points) return 1
if (quiz.player1Points < quiz.player2Points) return 2
return 3
} | [
"function whoWon() {\n if (!quiz.isGameOver) {\n return 0\n }\n else if (quiz.isGameOver) {\n if (quiz.player1score > quiz.player2score) {\n return 1\n }\n else if (quiz.player2score > quiz.player1score) {\n return 2\n }\n }\n else {\n return 3\n }\n}",
"function whoWon() {\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get btn val concatenate with queryURL scroll to gif section | function clickMeme(){
var btnValue = $(this).text();
console.log(btnValue);
var apiKEY = "&api_key=dc6zaTOxFJmzC";
var queryURL = "https://api.giphy.com/v1/gifs/search?q=" + btnValue + "&limit=10" + apiKEY;
// make call to api
getGifyData(queryURL);
$('html, body').animate({
scrollTop: $("#g... | [
"function displayGif(){\n\tquery($(this).attr('data-name'));\n}",
"function btnSearch(){\n\n var btnName = $(this).attr(\"data-name\");\n\n getGiphy(btnName);\n }",
"function populateContinueHref() {\n $(\".btn-continue\").attr(\"href\", getQueryParam(\"url\"));\n }",
"function giph... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set a new binding root index so that host template functions can execute. Bindings inside the host template are 0 index. But because we don't know ahead of time how many host bindings we have we can't precompute them. For this reason they are all 0 index and we just shift the root so that they match next available loca... | function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {
var lFrame = instructionState.lFrame;
lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;
setCurrentDirectiveIndex(currentDirectiveIndex);
} | [
"function setBindingRootForHostBindings(value) {\n var lframe = instructionState.lFrame;\n lframe.bindingIndex = lframe.bindingRootIndex = value;\n}",
"function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {\n var lFrame = instructionState.lFrame;\n lFrame.bindingIndex = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::Kendra::DataSource.SalesforceKnowledgeArticleConfiguration` resource | function cfnDataSourceSalesforceKnowledgeArticleConfigurationPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDataSource_SalesforceKnowledgeArticleConfigurationPropertyValidator(properties).assertSuccess();
return {
CustomKnowledgeArticleT... | [
"function cfnDataSourceSalesforceCustomKnowledgeArticleTypeConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnDataSource_SalesforceCustomKnowledgeArticleTypeConfigurationPropertyValidator(properties).assertSuccess();\n return {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Move finger to the center of the element | async moveToCenter(): Promise<void> {
const center = await this._parent.getAbsoluteCenter();
await this.driver.activeWindow.touch.move(center.x, center.y);
} | [
"function moveFinger() {\n finger.x = mouseX;\n finger.y = mouseY;\n}",
"async upAtCenter(): Promise<void> {\n const center = await this._parent.getAbsoluteCenter();\n await this.driver.activeWindow.touch.down(center.x, center.y);\n }",
"center() {\n this.translationX = this.canvas.width * 0.5\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets log level for all Firebase SDKs. All of the log types above the current log level are captured (i.e. if you set the log level to `info`, errors are logged, but `debug` and `verbose` logs are not). | function setLogLevel(logLevel) {
(0,_firebase_logger__WEBPACK_IMPORTED_MODULE_1__.setLogLevel)(logLevel);
} | [
"function setLogLevel(logLevel) {\n Object(_firebase_logger__WEBPACK_IMPORTED_MODULE_1__[\"setLogLevel\"])(logLevel);\n}",
"function setLevel(level) {\n switch (level.toUpperCase()) {\n case 'TRACE':\n level = TRACE;\n break;\n case 'DEBUG':\n level = DEBUG;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Displaying profiles from local storage | static displayProfiles() {
const profiles = Store.getProfilesFromLocalStorage();
profiles.forEach(profile => {
const ui = new UI();
ui.addProfileToList(profile)
})
} | [
"function displayProfiles() {\r\n let store = browser.storage.local.get({\r\n profiles: []\r\n });\r\n store.then(function(results) {\r\n var profiles = results.profiles;\r\n\r\n for (var i = 0; i < profiles.length; i++) {\r\n addProfileToAList(profiles[i]);\r\n }\r\n });\r\n}",
"static displ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this method creates the `Controllers` folder | createControllerFolder() {
// check if folder `Controllers` already exists
if (!fs.existsSync(`${this.controller}`)) {
// create `Controllers` folder
fs.mkdirSync(`${this.controller}`);
return;
}
console.error(`${this.controller} folder already exists`);
} | [
"function createControllersFolder() {\n createFolder(`${dir}controllers`);\n let template = require('./generators/controllers_gen')();\n fs.writeFile(`${dir}controllers/example_controller.js`, template, (err) => {\n if (err) console.log(`... an error occured while creating controllers ...`);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove all trajectories from the grid. | _clearTrajectories() {
this.elem.selectAll('.intention').remove();
for (let i = 0; i < this.gridSize; i++) {
for (let j = 0; j < this.gridSize; j++) {
if (!this._isCornerCell(i, j)) {
this.grid[i][j].hexagon.attr('fill', 'none');
}
}
}
} | [
"function clearGrid() {\n clearPipes();\n clearObstacles();\n}",
"function clearGrid() {\n while (grid.firstChild) {\n grid.removeChild(grid.firstChild);\n }\n }",
"function clearGrids() {\n\t\t var removeGridId;\n\t\t var removeGridElement;\n\t\t var parentElement = document.getElementById(\"c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Is Valid AMOUNT value | function isValidAMOUNTValue(amount) {
return amount != '' && /^\d*$/.test(amount)
} | [
"function validProductAmount(amount)\n {\n if(!isNaN(amount)) //if is not a number\n {\n var flval=parseFloat(amount); //get float value of the amount\n if(Number.isInteger(flval)) //check if amount is integer number\n { \n if(flval>0)\n return true;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates exchange rates for all tokens | async updateExchangeRates () {
if (!this.isActive) {
return
}
const contractExchangeRates = {}
const nativeCurrency = this.currency ? this.currency.state.nativeCurrency.toLowerCase() : 'eth'
const pairs = this._tokens.map(token => token.address).join(',')
const query = `contract_addresses=... | [
"async updateExchangeRates () {\n if (!this.isActive) { return }\n const contractExchangeRates = {}\n for (const i in this._tokens) {\n const address = this._tokens[i].address\n contractExchangeRates[address] = await this.fetchExchangeRate(address)\n }\n this.store.putState({ contractExchan... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |