query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
enter ranked and remove the ranked rules notification
function enterRanked(){ if (document.getElementById('mpRankedButton')) { document.getElementById('mpRankedButton').click(); setTimeout(()=>{swal.close();},10000); } }
[ "function resetRank() {\n if (getCookie('rank')) {\n rank = [];\n $('#rankboard').empty();\n deleteCookie('rank');\n refreshRankBoard();\n }\n}", "function ranking() {\n rank.sort(function(a, b) {\n return b[1] - a[1];\n });\n rank.splice(10, rank.length - 10);\n}", "function addToRank() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a Graphic Rendition object used elsewhere to a ANSI SGR sequence.
function getSGRFromGraphicRendition(graphicRendition, initialReset) { let sgrSeq = []; let styleCount = 0; ['intensity', 'underline', 'blink', 'negative', 'invisible'].forEach(s => { if (graphicRendition[s]) { sgrSeq.push(graphicRendition[s]); ++styleCount; } });...
[ "function recExport(rect) {\n return [rect.totext, rect.program, rect.height, 'Rectangle', rect.layer];\n}", "toImg(svgText, orgWidth, orgHeight, imgWidth, imgHeight) {\n\t\t// Create Canvas\n\t\tlet canvas = document.createElement('canvas');\n\t\tcanvas.width = imgWidth;\n\t\tcanvas.height = imgHeight;\n\t\tl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createTables(conn) Drop and recreate the database tables on a database connection. param: conn an open database connection param: useDB which database flavor we are using
function createTables(conn, useDB) { var schema = { indi: [ [ 'INDI' , 'varchar' , 10 , "NOT NULL" ], [ 'LNAME' , 'varchar' , 30 , "" ], [ 'FNAME' , 'varchar' , 60 , "" ], [ 'TITLE' , 'varchar' , 20 , "" ], [ 'LNAME_MP' ...
[ "function deleteTables(tables) {\n console.log('Dropping database tables');\n for(let t of tables)\n db.exec('DROP TABLE IF EXISTS ' + t);\n}", "function createSchema(callback) {\n console.log(\"Creating table \" + tableName + \"...\");\n var params = {\n AttributeDefinitions: [{\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends all stylingrelated expressions to the provided attrs array.
populateInitialStylingAttrs(attrs) { // [CLASS_MARKER, 'foo', 'bar', 'baz' ...] if (this._initialClassValues.length) { attrs.push(literal(1 /* Classes */)); for (let i = 0; i < this._initialClassValues.length; i++) { attrs.push(literal(this._initialClassValues[i])...
[ "function addAttributes(node, attrs) {\n for (var name in attrs) {\n var mode = attrModeTable[name];\n if (mode === IS_PROPERTY || mode === IS_EVENT) {\n node[name] = attrs[name];\n }\n else if (mode ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the total table based on items in the cart and discount
function updateTotalTable() { let price = 0; let discount = 0; for (let i = 0; i < this.itemsInCart.length; i++) { price += this.itemsInCart[i].price.display * this.itemsInCart[i].qty; discount += this.itemsInCart[i].discount; } const totalPriceAfterDiscount = ((discount / 100...
[ "function updateCartItems(){\n\tvar totalItems = 0;\n\tvar productTotal = 0;\n\t$('.numbers :input').each(function(){\n\t\tproductTotal += getPrice($(this).attr('id'),parseInt($(this).val(), 10));\n\t\ttotalItems += parseInt($(this).val(), 10);\n\t});\n\t$('#total').html('$' + productTotal.toFixed(2));\n\t$('#cart'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all the calendars for a given course
function getCalendarsForCourse(id, cb) { pg.connect(constr, (err, client, done) => { // (2) check for an error connecting: if (err) { cb('could not connect to the database: ' + err); return; } // (3) make the query if successful: client.query(CalendarQ...
[ "async getCalendars() {\n try {\n // Get the access token silently\n // If the cache contains a non-expired token, this function\n // will just return the cached token. Otherwise, it will\n // make a request to the Azure OAuth endpoint to get a token\n\n this.trashableAccessToken = makeT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialising room Connect socket, setup id and socket.
function initSocket() { socketRef.current = io("localhost:8000"); setId(socketRef.current.id); setSocket(socketRef.current); }
[ "function connect() {\n socket = new WebSocket('wss://' + get('server') + '/api/connect');\n socket.onopen = onopen;\n socket.onmessage = onmessage;\n socket.onerror = onerror;\n socket.onclose = onclose;\n }", "function socketOpen() {\n that.debugOut('Socket fully con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the displayed text in the box by menu selection
function changeDisplayedText(selected, unselected) { selected.style.display = "block"; unselected.style.display = "none"; }
[ "function menuTextClick() {\n Data.Edit.Mode = EditModes.Text;\n updateMenu();\n}", "function set_menu_item_text(item, value) {\n switch(item) {\n case menu_items.game_control: {\n $('#game-control-button').text(value);\n } break;\n case menu_items.music: {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Requests web object identity for the current web. That request is something similar to _contextinfo in REST. The response data looks like: _ObjectIdentity_=|:site::web: _ObjectType_=SP.Web ServerRelativeUrl=/sites/contoso
getCurrentWebIdentity(webUrl, formDigestValue) { const requestOptions = { url: `${webUrl}/_vti_bin/client.svc/ProcessQuery`, headers: { 'X-RequestDigest': formDigestValue }, body: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" ...
[ "async openWebById(webId) {\n const data = await spPost(Site(this, `openWebById('${webId}')`));\n return {\n data,\n web: Web([this, extractWebUrl(odataUrlFrom(data))]),\n };\n }", "function GetRequestDigest(){\n return jQuery.getJSON(relativeWebUrl+'/_api/contexti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve Track JSON from API and push into array, can handle page itteration
function track_api(page) { let fmaWsUrl = `https://freemusicarchive.org/api/get/tracks.json?api_key=${FMA_API}&album_id=${ release_attributes.albumid }&limit=20&page=${parseInt(page)}`; var promise_track_api = $.getJSON(fmaWsUrl, function () { LOGGER.debug(`promise_track_api_params [state] ...
[ "loadAlbumTracks() {\n this._ApiFactory.getAlbumsTracks(this.albumId).query({}, (response) => {\n\n const tracks = [];\n response.items.forEach((i) => {\n const track = {\n name: i.name,\n images: i.images,\n duration: this.convertToMinutesSeconds(i.duration_ms)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback function for json2csv: Import file (For OMP)
function j2cCallbackImport(err, csv) { if (err) throw err; // Generate csv for Import directory fs.writeFile(importPathName + importFileName + timestring + '_ZINUS.csv', csv, function(err) { if (err) throw err; console.log('File saved under: [' + __dirname + '\\Import\\]@[' + timestring + ']'); }); }
[ "function import_data_from_csv() {\n fetch(\"input.csv\")\n .then(v => v.text())\n .then(data => init_table_from_data(data))\n}", "function Csv () {}", "function loadCSVfile() {\n return axios.get(EXTERNAL_CSV_FILE)\n .then((res) => {\n // In my case, the columns are locate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
newitemid: 1 if new item, otherwise the id of the workitem to edit This is called when either a new work item is requested or when the user decides to edit an existing item
function DoEditSCWorkItem_clicked(newitemid) { ModalWorkItem = new C_WorkLog(null); ModalNewWorkItem = newitemid === -1; if (newitemid !== -1) { ModalWorkItem = BackendHelper.FindWorkItem(newitemid); } else { ModalWorkItem.UserId = OurUser.id; ModalWorkItem.Date = C_YMD.Now()...
[ "function updateItem(itemId, newItem) {\n ItemModel.findById(itemId, function (err, item) {\n if (err) {\n return err;\n }\n\n if (newItem.name) item.name = newItem.name;\n if (newItem.nickName) item.nickName = newItem.nickName;\n if (newItem.purpose) item.purpose = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a getMessage function that takes 3 inputs The three inputs will be winnerName, margin, stateName Example of result: "Bernie won by 200 delegates in Virginia" getMessage goes here Make a getResult function that takes 3 inputs First input is bernie delegates, second hillary delegates, third state name string Functio...
function getResult(bernieDelegates, hillaryDelegates, stateName) { var winner = getWinner(bernieDelegates, hillaryDelegates); var margin = winningMargin(bernieDelegates, hillaryDelegates); var message = getMessage(winner, margin, stateName) return message }
[ "function getWinner(bernieDelegates, hillaryDelegates) {\n if (bernieDelegates > hillaryDelegates) {\n return \"Berndawg\"\n } else {\n return \"Hillbill\"\n }\n}", "createMessage(){\n let message = ((this.formData.name !==\"\") ? (\"Mr/Ms \"+this.formData.name+ \" wants to make a reservat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resize JIMP image to the size needed for conversion to a pixelImage
function resizeToTargetSize(jimpImage, pixelImage) { const result = jimpImage.clone(); result.resize(pixelImage.mode.width, pixelImage.mode.height); return result; }
[ "function resize() {\n return new Promise(function (resolve, reject) {\n // print the attributes of the image \n im.identify(['-format', '%wx%h', './public/images/img' + path.extname(file_original_name)], function (err, output) {\n if (err) reject(err);\n console.log('dimensio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
disappear() Draw disappearing points on screen
disappear() { randomSeed(98) let disappearCurrentDuration = (millis() - this.createdAt) / 1000 - controller.createDuration - controller.displayDuration, percent = map( disappearCurrentDuration, 0, ...
[ "function endPosition(){\r\n painting = false; \r\n c.beginPath();\r\n}", "function disable_draw() {\n drawing_tools.setShape(null);\n}", "display() {\n push();\n fill(255,0,0);\n ellipse(this.x, this.y, this.size);\n pop();\n // if (x < 0 || x > width || y < 0 || y > height) {\n // v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Need a dealer's hand function
function dealersHand() { }
[ "function userHand() {\n\n}", "function dealerHit(hand){\n while (bestTotal(hand) < 17) {\n hand = hand.concat(randomDeal(1));\n }\n return hand;\n}", "function stopDealing() {\n // Dealer has 17 or better\n if (game.dealerHand.handTotal >= 17) {\n return true;\n // Soft 17 to soft 21\n } else if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
animate the months, from january thru december, one month per second...
function animateMonths() { before = currentMonth; currentMonth = "1"; monthAnimation = setInterval(function() { if ('13' == currentMonth) { currentMonth = before; showYears(); clearInterval(monthAnimation); } else { showYears(); currentMonth = ""+(parseInt(currentMonth) + 1); } }, 1000); }
[ "function nextMo() {\n showingMonth++;\n if (showingMonth > 11) {\n showingMonth = 0;\n showingYear++;\n }\n update();\n closeDropDown();\n //console.log(\"SHOWING MONTH: \" + showingMonth);\n}", "function changeMonth(months){\n Calendar.today = addMonth(Calendar.today, months);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function to calculate the interest of "data"
function interestCalculator(arr) { arr.forEach(element => { if (element.principal >= 2500 && element.time > 1 && element.time < 3) { element.rate = 3; } else if (element.principal >= 2500 && element.time >= 3) { element.rate = 4; } else if (element.principal < 2500 || element.time <= 1) { element.rate =...
[ "function calculateInterest(startSaving, years, interest) {\n let endSaving = startSaving;\n\n for (let ix = 1; ix <= years; ix++) {\n endSaving = endSaving * (1 + interest / 100);\n }\n return Math.round(endSaving * 10000) / 10000;\n}", "function compoundInterest(p, t, r, n) {\n\treturn Number...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A UI method to publish a document. If errors occur they are displayed to the user appropriately, not returned or thrown to the caller. If a page cannot be published because its ancestors are unpublished, the user is invited to publish its ancestors first, and the publish operation is then retried. A notification of suc...
async publish(doc) { const previouslyPublished = !!doc.lastPublishedAt; const action = window.apos.modules[doc.type].action; try { doc = await apos.http.post(`${action}/${doc._id}/publish`, { body: {}, busy: true }); apos.notify('apostrophe:changesPublished'...
[ "function saveDocument() {\n if (current.id) {\n console.log(\"saveDocument(old) started\");\n var isUpdateSupported = current.resources.self && $.inArray('PUT', current.resources.self.allowed) != -1;\n if (!isUpdateSupported) {\n alert(\"You are not allowed to update this document\");\n return;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
synchronize the ban list with the one in the database
syncBanList() { let banList = this.omegga.getBanList(); if (!banList) return; banList = banList.banList; // upsert all bans for (const banned in banList) { const entry = { type: 'banHistory', banned, bannerId: banList[banned].bannerId, created: parseBrickadiaTi...
[ "updateBlackoutList(){\r\n this.blackoutList = [];\r\n for(var i = 0; i < this.prosumers.length; i++) {\r\n if(this.prosumers[i].blackout == true) {\r\n this.blackoutList.push(this.prosumers[i].username);\r\n }\r\n }\r\n\r\n /*for(var i = 0; i < this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initialize gyro from gyro.js
function initGyro() { var listYAccelerations = [], noise = false, lastXA = false; // set frequency of measurements in milliseconds // some more comments gyro.frequency = 10; gyro.startTracking(function(o) { var a = o.x.toFixed(3), t = new Date(), timestep = t - lastT,...
[ "function GyroPositionSensorVRDevice() {\n // Subscribe to deviceorientation events.\n window.addEventListener('deviceorientation', this.onDeviceOrientationChange.bind(this));\n window.addEventListener('orientationchange', this.onScreenOrientationChange.bind(this));\n this.deviceOrientation = null;\n this.scre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::AppSync::Resolver.AppSyncRuntime` resource
function cfnResolverAppSyncRuntimePropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnResolver_AppSyncRuntimePropertyValidator(properties).assertSuccess(); return { Name: cdk.stringToCloudFormation(properties.name), RuntimeVersion: cd...
[ "function cfnFunctionConfigurationAppSyncRuntimePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnFunctionConfiguration_AppSyncRuntimePropertyValidator(properties).assertSuccess();\n return {\n Name: cdk.stringToCloudFormation(propert...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CODING CHALLENGE 91 Create a function that returns the product of all odd integers in an array.
function oddProduct(arr) { let a = 1; for (let i = 0; i < arr.length; i++) { if (arr[i] % 2 === 1) { a *= arr[i]; } } return a; }
[ "function productContents(array) {\r\n\tlet product = 1;\r\n\tfor (let i = 0; i < array.length; ++i)\r\n\t{\r\n\t\tproduct *= array[i];\r\n\t}\r\n\treturn product;\r\n}", "function product(arr) {\n var total = 1;\n for (i = 0 ; i = arr.length ; i++) {\n total *= arr[i];\n }\n return total;\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Collects the information for a wrap from the editor, passes it to the wrapping code, and then applies the result to the document.
function doWrap(editor, options) { const document = editor.document const selections = editor.selections const lines = Array.from(new Array(document.lineCount)) .map((_, i) => document.lineAt(i).text) return Promise.resolve( createEdit ...
[ "function docEdits_apply()\n{\n // DEBUG var DEBUG_FILE = dw.getSiteRoot() + \"dwscripts_DEBUG.txt\";\n // DEBUG DWfile.write(DEBUG_FILE,\"docEdits_apply()\\n-----------------\\n\");\n var maintainSelection = arguments[0] || false; //optional: if true we will attempt maintain the current selection\n var dontRe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
paintField :: Painter2d > IO ()
function paintField(painter) { return painter.background(Color.HSL(160, 70, 60).toHex()).bind(_ => painter.rect(48, 128, 192, 382).fill(Color.HSL(160, 20, 80).toHex())).bind(_ => painter.rect(560, 128, 192, 382).fill(Color.HSL(160, 20, 80).toHex())).bind(_ => painter.text("NEXT", 298, 128, { font: 'Spicy ...
[ "fields() {\n // sets \"this.current\" to fields\n this.current = \"fields\";\n // draws the grass\n background(104, 227, 64);\n \n // draws a path\n this.path(width/2, 0);\n \n // draws a pile of rocks or a well\n if (this.well) {\n this.makeWell();\n } else {\n this.rock...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fin clase Restaurante comentarios para 1 sola clase / let nuevoRestaurante = new Restaurante(); let nombre = prompt("Escribe el nombre del restaurante"); let domicilio = prompt("Escribe el domicilio del restaurante"); let telefono = prompt("Escribe el telefono del restaurante"); nuevoRestaurante.nombre = nombre; nuevoR...
function restaurante() { let cantidad_restaurantes = prompt("Escribe la cantidad de restaurantes: "); var arreglo = []; let i; for (i = 0; i < cantidad_restaurantes; i++) { arreglo.push(new Restaurante()); let nombre = prompt("Escribe el nombre del restaurante: " + (i + 1)); let ...
[ "function cargarPlantilla(){\n\tif(objeto()!= 0)\n\t\tconexionPHP('formulario.php','Plantilla',objeto())\t\t\n\telse\n\t\talert(\"Debe Seleccionar un tipo de Objeto\");\n}", "function Restaurant(name, type, stars) {\n this.name = name;\n\tthis.type = type;\n this.stars = stars;\n \n this.addStars = fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
______showcity________________________________________________________ We will reach this function as soon as we press a from the SELECT we come here and extract the data of that current selection.
function showcity() { let CS = document.getElementById("coutriesSelect"); let selectedCountry = CS.options[CS.selectedIndex].innerHTML; let selectedIdCountry = CS.value; //in case to prevent double-click: if (selectedIdCountry == last_click) { return; } ...
[ "function selectCity(event){\r\n\tvar optionParent = $('citySelect');\r\n\tvar optionElems = $x('./option',optionParent);\r\n\tvar liParent = optionParent.previousSibling.childNodes[1];\r\n\tvar liElems = liParent.getElementsByTagName('li');\r\n\tvar n_cities = optionElems.length;\r\n\t\r\n\tvar x = 0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all class on Processing status
async getAllClassOnProcessing(){ let dataOnProcessingClass = []; let onProcessingResult = await UserClass.findAll({ where:{ status:'onProcessing' } }) onProcessingResult.forEach((element)=>{ dataOnProcessingClass.push(element.get()); ...
[ "_collectClasses() {\n const result = []\n let current = Object.getPrototypeOf(this)\n while (current.constructor.name !== 'Object') {\n result.push(current)\n current = Object.getPrototypeOf(current)\n }\n return result\n }", "static get STATUS_RUNNING () {\n return 0;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Permite verificar si un select tiene algun valor seleccionado
function verificar_select_seleccionado(){ if($("#id_provincia option:selected").text()!= '-- Seleccione --'){ $('#id_canton').prop('disabled', false); $('#id_parroquia').prop('disabled', false); } }
[ "function verificar_select_seleccionado() {\n if ($(\"#id_provincia option:selected\").text() != '-- Seleccione --') {\n $('#id_canton').prop('disabled', false);\n $('#id_parroquia').prop('disabled', false);\n }\n}", "function checkSelect(select){\r\n\treturn (select.selectedIndex > 0);\r\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears table of cards from dealer and player
function clearTable(){ playerNode = document.getElementById("player-hand"); dealerNode = document.getElementById("dealer-hand"); if (playerNode.hasChildNodes()){ while (playerNode.firstChild){ playerNode.removeChild(playerNode.firstChild); }; w...
[ "function clearCards() {\n for (let [id, card] of cards.entries()) {\n card.removeEvents(id)\n }\n $(\"#deck-display\").empty()\n cards.clear()\n idCounter = 1\n }", "function clearHighScoreTable() {\n var highScoreTable = getHighScoreTable();\n for (var i = 0; i < highScoreTable.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
continue is called to schedule a timeout at the desired delay
continue(){ this.timeout = setTimeout( this.onTimeout.bind( this ), this.timer ) }
[ "onTimeout(){\n\t\tthis.callback.apply(null, this.args)\n\t\tthis.continue()\n\t}", "function runAfterDelay(delay,callback){\n console.log('(Exercise 7).Wait for '+delay+' secs....'); \n callback(delay);\n }", "onTimeOut() {\n if (this.exhausted) {\n this.stop();\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a lowpass filter node and stores it in this module, also passing it to the dispatcher via an event.
function createFilterNode() { filterNode = AUDIO.createBiquadFilter(); filterNode.type = 'lowpass'; // Low-pass filter filterNode.frequency.value = 440; // in HZ if (isActive) dispatcher.trigger('filterfx:nodeupdated', filterNode); }
[ "eth_newFilter(filter) {\n return this.request(\"eth_newFilter\", Array.from(arguments));\n }", "function customFilterFactory(){\n return function(input){\n //change input\n return 'customFilter applied';\n }\n }", "function setFilter (input) {\n STORE.filter = input;\n}", "start()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
?? vY yAxis 0 3 vMath.yAxis() FL_V
static yAxis() { return newVec(0.0,1.0,0.0); }
[ "function createYAxis() {\n $(element + \" .yAxis\").css({\n \"grid-area\": \"2/2/3/3\",\n display: \"grid\",\n \"grid-template-columns\": \"1fr\",\n \"grid-template-rows\": \"1fr 2fr 2fr 2fr 2fr 2fr 1fr\",\n });\n\n $(element + \" .yAxis\").append(function () {\n l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=============== Postprocess Functions (DOM / onunload) =============== / BACleanUpEventListeners Cleanup event listeners of the nodes.
function BACleanUpEventListeners() { if (BA_EVENTLISTENER_STORED_NODES) { BA_EVENTLISTENER_STORED_NODES.forEach(function(node) { for (var type in node.__addEventListenerBA_stored__) { if (type != 'unload') { node['on' + type] = null; } } node.__addEventListenerBA_stored__ = null; }); } }
[ "function cleanup() {\n\twriteNavCookie();\n\t\n\tif (blnNS) {\n\t\tdocument.releaseEvents(Event.MOUSEMOVE);\n\t}\n\treturn;\n}", "function destroy() {\n parent.removeEventListener(\"mousedown\", onDown);\n document.querySelector(\"body\").removeEventListener(\"mouseup\", onUp);\n parent.removeEventListe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Armar el campo nombre y apellido con los datos que se van completando
function armarNombreApellido() { var nombres = $("#paciente-pa_nombre").val(); var apellidos = $("#paciente-pa_apellido").val(); var nya = apellidos + ' ' + nombres; $("#paciente-pa_apenom").val(nya); }
[ "function limpiarCampos() {\n // info order\n $(\"#edit_origen\").attr(\"value\", \"\");\n $(\"#edit_depto_origen\").attr(\"value\", \"\");\n $(\"#edit_destino\").attr(\"value\", \"\");\n $(\"#edit_depto_destino\").attr(\"value\", \"\");\n $(\"#edit_tipo\").attr(\"value\", \"\");\n $(\"#edit_destinatario\")....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function called `rest(input)` that returns everything but the first character of a string.
function rest(input) { return input.substring(1); }
[ "function first(input) {\n return input.charAt(0);\n}", "function keepFirst(str) {\n return str.slice(0, 2);\n}", "function cutFirst(string){\n return string.substr(2);\n }", "static rest(arr) {\n return arr.slice(1);\n }", "function last(input) {\n var stringLength = input.length;\n return inpu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API to fetch personDetails
function getPersonDetails(cb, personId) { let url = `${API_URL}person/${personId}?api_key=${API_KEY}`; fetch(url, { method: 'GET' }).then(response => response.json()).then(data => { cb(data); }).catch(err => { console.log('error while fetching details', err); }) }
[ "function loadPersons() {\n return RestApi\n .getState(restApiUrl, Address.HCHAIN1_NAMESPACE)\n .then(function(body) {\n\n\n // the body of a state response will have the an array of addresses with their state entries\n // let's map the raw person data into a processed version using the\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
INPUT INTERFACES Input Interfaces are the different hardware controllers that can provide input signals : Mouse, keyboard, controllers... Each Input interface is declared in an individual module. The following collection of methods allow importing, enabling, disabling, and retrieving info from the input interfaces. imp...
async importInterface( iface ){ if( typeof iface !== 'string' || !iface.trim().length ) throw new Error('Interface identifier must be a valid string'); //if interface has already been imported, return if( !_instance_.Input.interfaceExist( iface ) ){ let ifaceRef = ( await import( './...
[ "enableInterface( iface ){\n if( typeof iface !== 'string' || !iface.trim().length ) throw new Error('Interface identifier must be a valid string');\n // block if interface does not exist\n if( !_instance_.Input.interfaceExist( iface ) ) throw new Error('Unknown interface provided : ' + iface);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
allocate: Allocates sales orders according to a supply product provided by purchase orders. Premise: FIFO approach. First sale orders that arrive are the ones that get allocated first. Product resources are reserved for the current sales order until it can be fullfilled and dispatched.
function allocate(salesOrders, purchaseOrders) { //Inject a functional Date property in both order arrays, for sorting purposes let result = [], salesOrdersToProcess = utils.injectDate(salesOrders, 'created'), purchaseOrdersToProcess = utils.injectDate(purchaseOrders, 'receiving...
[ "function createOrderAddress(productId, quantity){\n var inqPromise = inquirerCreateAddress();\n inqPromise.then(function(inqRes){\n var addressObj = {\n address : inqRes.addressLine,\n city : inqRes.myCity,\n state : inqRes.myState,\n zip : inqRes.myZip,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Column Editor object
get columnEditor() { return this.columnDef && this.columnDef.internalColumnEditor || {}; }
[ "function TextEditor(args) {\r\n\r\n\tvar $input;\r\n\tvar defaultValue;\r\n\tvar scope = this;\r\n\r\n\tthis.init = function () {\r\n\r\n\t\t$input = $(\"<INPUT type=text class='editor-text' maxlength='\" +\r\n\t\t\t\t\tString(MAX_FREETEXT_LEN) + \"'/>\");\r\n\r\n\t\t$input.appendTo(args.container);\r\n\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Printe array onto canvas
function printArrayCanvas(item, index) { saveableContext.fillText(item, 680, (70*(index+1))); }
[ "display() {\n this.draw(this.points.length);\n }", "function printsArrayInFrame(array) {\n var rectangleWidth = array[0].length;\n var borderRow = '';\n var nthRow = '';\n\n for (var i = 1; i < array.length; i++) {\n if(array[i].length > rectangleWidth) {\n rectangleWidth = array[i].length;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For any print deactivations, reset the entire print queue
stopPrinting(target) { target.activatedBreakpoints = this.deactivations; this.deactivations = []; this.formerActivations = null; this.queue.clear(); this.isPrinting = false; }
[ "resetWatch() {\n this.reset();\n this.print();\n }", "function clearConsole() {\n // reset drawing title\n abEamTcController.setDrawingPanelTitle(getMessage('noFlSelected'));\n // clear drawing content\n abEamTcController.clearDrawing();\n // clear asset details\n abEamTcController.clear...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class SystemPath Stores operatingsystemspecific location constants for use getSystemPath method.
function SystemPath() { }
[ "function getEnvPath() {\n var paths;\n var os = getOsType();\n if (!os) {\n throw new Error('cannot not read system type');\n }\n var p = getEnv('PATH');\n var isMsys = getEnv('OSTYPE') ? true : false;\n if (os.indexOf('WIN') !== -1 && !isMsys) {\n paths = p.split(';');\n } else {\n paths = p.spli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New Create Meal Plan function uses cached meals over API calls to gather meals.
function createMealPlan(email, dailyCalories, dailyBudget, connection, unirest, preferences, mealplan, callback) { const mealRatios = [0.2, 0.4, 0.4], budgetRatios = [0.3, 0.35, 0.35], chooseFunct = []; console.log(` --- Create Meal Parameters --- Daily Calories: ${dailyCalories...
[ "function Meal(data) {\n Base.call(this, data);\n this.type = 'meal';\n}", "static async create(customer, plan) {\n try {\n if (!customer || !plan) {\n throw new Error('Missing a required parameter: customer, plan');\n }\n // Fetch matching plans from our local database\n const [mo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
useCheckbox that provides all the state and focus management logic for a checkbox. It is consumed by the `Checkbox` component
function useCheckbox(props) { if (props === void 0) { props = {}; } var { defaultIsChecked, isChecked: checkedProp, isFocusable, isDisabled, isReadOnly, isRequired, onChange, isIndeterminate, isInvalid, name, value, id } = props, htmlProps = _objectWith...
[ "render() {\n return (\n <Checkbox\n className=\"bookmark bookmark-toggle\"\n onChange={this.onChange}\n inputRef={(ref) => { this.input = ref; }}\n />\n );\n }", "checkBox(x, y, label, value) {\n return this.appendChild(new CheckBox(x, y, label, value));\n }", "h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the url for the specified traill id
function getUrlForId(trailId) { return (getUrl() + trailId); }
[ "static RESTAURANT_URL_BY_ID(id) {\r\n return DBHelper.RESTAURANT_URL+\"/\"+id;\r\n }", "function generateURL(id) {\n return `https://picsum.photos/id/${id}/400`;\n }", "function getUserUrl(id)\r\n\t\t{\r\n\t\t\tvar maxTime=dbStates({userid:id,time:{lte:selectedTime}}).max(\"time\");\r\n\r\n\t\t\t//if t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import (Winner > REX) importObjectAs function converts objects from Winner to REX format Input data is expected to be in xml2js notation Output data is an XML string (that differ from exportOrder function and there is reason why: object root tag in Winner format varies depending on object type) Arguments: what string, ...
function importObjectAs(what, task, obj, dic) { var type = dic.lookup('rex_type', op(obj, "actual.0")) || dic.lookup('rex_type_optp', op(obj, "optp.0")), oid = op(obj, "id.0"), is_sell = type && zint(type.$.id) === 2, is_flats = what === 'flats', is_rent = what === 'rent' || (type && ...
[ "function exportOrder(task, order, dic) {\n\tvar oid = objpath.coalesce(order, [\"$.id\", \"meta.0.extid.0\", \"meta.0.extid.0._\"]),\n\t\tis_sell = [1,2].indexOf(zint(objpath.get(order, \"type.0.$.id\"))) >= 0,\n\t\tis_rent = [3,4].indexOf(zint(objpath.get(order, \"type.0.$.id\"))) >= 0,\n\t\tis_novo ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove single library entry
removeLib(name, config) { this.remove(name, list); }
[ "function removeModule() {\n\t\tcommon.naclModule.parentNode.removeChild(common.naclModule);\n\t\tcommon.naclModule = null;\n\t}", "function removeFromLibrary(bookTitle) {\n myLibrary = myLibrary.filter((book) => book.title !== bookTitle);\n}", "function removePlaylistEntry(entry) {\n var actionURL = entry....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert a fragment at the current selection. If the selection is currently expanded, it will be deleted first.
insertFragment(editor, fragment) { editor.insertFragment(fragment); }
[ "insertFragment(editor, fragment) {\n editor.insertFragment(fragment);\n }", "insertNewUnstyledBlock(editorState) {\n const selection = editorState.getSelection();\n let newContent = Modifier.splitBlock(\n editorState.getCurrentContent(),\n selection,\n );\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
title = 'DEFAULT'; imageUrl; description; price;
constructor(title, image, desc, price) { this.title = title; this.imageUrl = image; this.description = desc; this.price = price; }
[ "constructor(title, img, price, desc) {\n this.title = title;\n this.imgURL = img;\n this.price = price;\n this.Description = desc;\n }", "function formatItem(title, category, quantity, price, description, images, EIN, UPC, website, deliveryMethod, location, deliveryTime, shipMethod, condition) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function:sortByButtonOrder (pageObjs) Purpose:sorts the pageList array in seObject by button order.
function sortByButtonOrder (pageObjs) { var sortedList = new Array (); for (var n = 0; n < pageObjs.pageList.length; n++) { var pos = parseInt (pageObjs.pageObjArray[pageObjs.pageList[n]][gBUTTON_ORDER]); if (pos >= 0) sortedList [pos] = pageObjs.pageList[n]; } // get rid of [0] since 0 is not a valid posit...
[ "function sortPageObjArrayByButtonOrder (a, b)\n{\n\tvar agBOrder = a.pageObjArray[a.pageList[1]][gBUTTON_ORDER];\n\tvar bgBOrder = b.pageObjArray[b.pageList[1]][gBUTTON_ORDER];\n\tif (agBOrder == bgBOrder)\n\t\treturn 0;\n\telse if (bgBOrder < 0)\n\t\treturn -1;\n\telse if (agBOrder < 0)\n\t\treturn 1;\n\t\n\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This layer has its own wrapLongitude logic
get wrapLongitude() { return false; }
[ "latLng(){\r\n return L.latLng(this.latitude, this.longitude);\r\n }", "get longitude() {\n return this._long;\n }", "function computeLatLng(location) {\n\tlet l = location.levels.length;\n\tlet x = location.x;\n\tlet y = location.y;\n\t\n\tfor (let i=l-1; i>=0; i--) {\n\t\tlet level = +location.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Creates a connected registry for a container registry with the specified parameters.
async function connectedRegistryCreate() { const subscriptionId = "00000000-0000-0000-0000-000000000000"; const resourceGroupName = "myResourceGroup"; const registryName = "myRegistry"; const connectedRegistryName = "myConnectedRegistry"; const connectedRegistryCreateParameters = { clientTokenIds: [ ...
[ "register (credentials){\n return Api().post('register', credentials)\n }", "_register() {\n this._nodeHandle.registerSubscriber(this._topic, this._type)\n .then((resp) => {\n // if we were shutdown between the starting the registration and now, bail\n if (this.isShutdown()) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Static Lex Inline Method
static lexInline(src, options) { const lexer = new Lexer(options); return lexer.inlineTokens(src); }
[ "function pushlex(type, info) {\n var result = function(){\n lexical = new CSharpLexical(indented, column, type, null, lexical, info)\n };\n result.lex = true;\n return result;\n }", "function InlineParser() {\n this.preEmphasis = \" \\t\\\\('\\\"\";\n this.postEmphasis ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Asks for user input to get new event name & time. Adds new timer to the events array;
function addNewTimer() { var new_timer_name = prompt("Enter event's name: ", "Do thing"); if(new_timer_name != null) var new_timer_time = prompt("Enter time: ", "21:23"); if(new_timer_name != null && new_timer_time != null) { var new_timer = { "name": new_timer_name, ...
[ "function timerAdd() {\n // add the totalSeconds and workoutType to an object and add it to an array \n timerSchArray.push({\n totalSeconds: tATotalSeconds.value,\n workoutType: taWorkoutTypeGetValue() \n })\n resetSchedule()\n}", "function editEvent(){\n for(var i = 0; i < eventInput....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
in string search statement with brackets and change brackets in symbols 10 20 function(varr) +20 > 10 20 function%1%varr%2% +20 10 20 arr[function(varr)2] +20 > 10 20 arr[function%1%varr%2%2] +20
function findVariableOfFunction(string) { var typeOpers = { none: "", brackets: "br", array: "ar" } var result = "", isFind = false, tO = typeOpers.none, isoB = false, oB = 0, cB = 0; for(var i=0; i < string.length; i++) { // find first sign with letter ...
[ "calculateBrackets() {\n //this section is to handle multiplication bracket notation. Example \"5(10)\" should equal 50\n let sliceIndex = this.calculation.search(/[0-9]\\(/) //find instances of digit followed by open bracket\n if (sliceIndex > -1) {\n this.calculation = this.calcula...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: Calculate time remaining and submit when timeup Display clock count down and when time remain equal 0, go to result server
function countdown(timeRemain) { // Function to loop count down clock and display after every second, equal 1000 milisecond setInterval(function () { const timeShow = document.getElementById("time"); // one minute = 1000* 60(second) = 60.000 milisecond. const minutes = Math.floor((tim...
[ "function timerCounter() {\n\tvar currentDate = new Date();\n\tvar remainingNow = targetDate.valueOf() - currentDate.valueOf();\n\n\n if (! roundStarting) {\n\t\tif (remainingNow < 0) {\n\t\t\t$('#time').html(\"(Kierros päättynyt)\");\n\t\t\troundEnded();\n\t\t} else {\n\t\t\tvar seconds = Math.floor((remainingN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prompt user for category, use category to select random string of array and update variable then move to getNoun()
getAdjective() { // Prompt user input of a specific adjective category const adjective = prompt('Pick an adjective category: Any, Common, Vulgar, or Sexy? '); // Change all versions of input to lowercase for handling errors const adjectiveLower = adjective.toLowerCase(); // Use selected category t...
[ "function generateRandomWord(category, level) {\n if (category === \"dictionary\") {\n getWordApi(level);\n } else {\n getLocalWord(level, category);\n }\n }", "function catAndQuest() {\r\n\tdocument.getElementById('points').innerHTML= 'Points ' + (points);\r\n\tdocum...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creating header with nav
function createHeader(){ const header = document.createElement('header') const h1 = document.createElement('h1') h1.textContent = 'Mazzeratie Monica' header.appendChild(h1) header.appendChild(createNav()) return header }
[ "function makeHeader() {\n const header = document.createElement('header');\n const nav = document.createElement('nav');\n nav.classList.add('navbar');\n\n const divLogo = new Image();\n divLogo.src = logo;\n divLogo.classList.add('logo')\n nav.appendChild(divLogo);\n\n const routes = docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fixed height table frozen
function fixHeightTable(){ // Set height table body if ($("#resultTable").height() > calcDataTableHeight(6)){ // $("div.dataTables_scrollBody").css("height",calcDataTableHeight(6)); } // Set height table forzen (3 column first table body) // $("div.DTFC_LeftBodyWrapper").css("height",calcDataTableHeight(6)...
[ "setDatatableFixedHeight() {\n var holder = this.shadowRoot.querySelector('#datatable-holder');\n if (this.headerFixed && this.height && this._datatable) {\n if (!this._datatable.headerFixed) {\n var header = this.shadowRoot.querySelector('#topBlock');\n holder...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Brings the overlay as visually the frontmost one
bringToFront() { let zIndex = ''; const frontmost = OverlayElement.__attachedInstances.filter((o) => o !== this).pop(); if (frontmost) { const frontmostZIndex = frontmost.__zIndex; zIndex = frontmostZIndex + 1; } this.style.zIndex = zIndex; this.__zIndex = zIndex || parseFloat(getCom...
[ "_onVaadinOverlayOpen() {\n this.__alignOverlayPosition();\n this.$.overlay.style.opacity = '';\n this.__forwardFocus();\n }", "showOverlay_() {\n this.overlay_.setAttribute('i-amphtml-lbg-fade', 'in');\n this.controlsMode_ = LightboxControlsModes.CONTROLS_DISPLAYED;\n }", "function arrangeOver...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads an ASN.1 BER bitfield out of the Buffer produced by doing `BerReaderreadString(asn1.Ber.BitString)`. That function gives us the raw contents of the BitString tag, which is a count of unused bits followed by the bits as a rightpadded byte string. `bits` is the Buffer, `bitIndex` should contain an array of string n...
function readBitField(bits, bitIndex) { var bitLen = 8 * (bits.length - 1) - bits[0]; var setBits = {}; for (var i = 0; i < bitLen; ++i) { var byteN = 1 + Math.floor(i / 8); var bit = 7 - (i % 8); var mask = 1 << bit; var bitVal = ((bits[byteN] & mask) !== 0); var name = bitIndex[i]; if (bitVal && typeof...
[ "function parseBinary(str) {\n\t// SPEED IMPROVEMENT: Although it is cleaner to parse \n\t// the encoding this way, it might've been faster to\n\t// implement a parser like this:\n\t//\n\t// return parseInt(str.replace(/[BR]/g, \"1\").replace(/[LF]/g, \"0\"), 2)\n\tlet x = 0;\n\tfor (var i=0; i<str.length; i+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Post the new markov headline to twitter
function postToTwitter(markovHeadline) { T.post('statuses/update', { status: markovHeadline }, function(err, data, response) { console.log(data); }) }
[ "function createTweet(input) {\n\tif (!input.quoteAuthor.length) { //czyli jeśli autor cytatu jest pusty, to wejdziemy do treści warunku\n\t\tinput.quoteAuthor = \"Unknown author\";\n\t}\n\tvar tweetText = \"Quote of the day - \" + input.quoteText + \" Author: \" + input.quoteAuthor;\n\tif (tweetText.length > 140)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DataField and DataPack system : default DataField (customisable), many of which constitute a DataPack
function DefaultDataField(){ return { questionname:"???", //Display name of the field question qfield:"question", //Field name must be unique qvalue:"", //Field value, by default qid:GenerateId(), //id of the field question qchoices:"", //answer options list executeChoice:Identity, ...
[ "function fieldFromDerivedFieldConfig(derivedFieldConfigs) {\n var dataLinks = derivedFieldConfigs.reduce(function (acc, derivedFieldConfig) {\n // Having field.datasourceUid means it is an internal link.\n if (derivedFieldConfig.datasourceUid) {\n acc.push({\n // Will be filled out later\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy the current model state into the list at list[listState.index+1] and updates listState. Removes any (nowinvalid) states in the list that come after the newly pushed state.
function push() { var lastState = newState(), i; copyModelState(lastState); list[listState.index + 1] = lastState; // Drop the oldest state if we went over the max list size if (list.length > listState.maxSize) { list.splice(0, 1); listState.startCounter++; } else { listSt...
[ "moveItem(start, end) {\n let list = this.state.currentList;\n\n // WE NEED TO UPDATE THE STATE FOR THE APP\n start -= 1;\n end -= 1;\n if (start < end) {\n let temp = list.items[start];\n for (let i = start; i < end; i++) {\n list.items[i] = l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
7.8 Find the largest personal account owner
function top_personal_balance() { var largest_balance = 0; for (var i in accounts) { if (accounts[i].type === "personal") { if (accounts[i].amount > largest_balance) { largest_balance = accounts[i].amount; richest = accounts[i].name; } } } console.log("Holder of biggest perso...
[ "get mostActiveUser() {\n let userNames = issues.map(obj => obj.user.login);\n let counters = {};\n userNames.forEach(id => {\n if (!counters.hasOwnProperty(id)) {\n counters[id] = 0;\n };\n counters[id]++;\n });\n let activeUserNames = Object.keys(counters);\n return activeU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the user's manager's id.
function getUserManagerId(user_id) { var manager_relationship = getUserManagerRelationshipView(user_id); var manager_id = manager_relationship && manager_relationship._ref ? manager_relationship._ref : null; return manager_id; }
[ "function getUserManagerRelationshipView(user_id) {\n var user = getUser(user_id, ['manager']);\n return user.manager;\n}", "getManagrId() {\n return inquirer.prompt([\n {\n type: 'list',\n name: 'manager_id',\n message: \"What's the id of the emplo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move the visible range such that the current time is located in the center of the timeline.
function moveToCurrentTime() { timeline.setVisibleChartRangeNow(); }
[ "function adjustVisibleTimeRangeToAccommodateAllEvents() {\r\n timeline.setVisibleChartRangeAuto();\r\n}", "function updateDisplayTimeRange() {\n if (model.properties.actualDuration === null || model.properties.actualDuration === Infinity) {\n return;\n }\n updatePropertyRange('displayTime', 0, m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
is the value promiselike (meaning it is thenable)
function isPromiseLike(value) { return !!value && typeof value.then === 'function'; }
[ "function _wrapInPromise(value) {\n\t\t\treturn $q.when(value);\n\t\t}", "isValue() {\n return false;\n }", "get takesValue() {\n return this._memoize('takesValue', () => {\n return this.takesValueFormattedTag !== null\n })\n }", "function thennable(ref, cb, ec, cn) {\n\t // Promises ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PillarPillarConnectionThroughMetalDishesAtTheEndOfThePier checkbox event handler
function OnPillarPillarConnectionThroughMetalDishesAtTheEndOfThePier_Change( e ) { try { var newMeasuresOfEmergencyValue = Alloy.Globals.replaceCharAt( current_structural_elements_id * 13 + 6 , Alloy.Globals.ShedModeDamages["MEASURES_OF_EMERGENCY"] , $.widgetAppCheckBoxShedModeFormsDamagesMeasuresOf...
[ "function OnPillarPillarConnectionThroughMetalProfilesOnAxisAtThePier_Change( e )\r\n{\r\n try\r\n {\r\n var newMeasuresOfEmergencyValue = Alloy.Globals.replaceCharAt( current_structural_elements_id * 13 + 5 , Alloy.Globals.ShedModeDamages[\"MEASURES_OF_EMERGENCY\"] , $.widgetAppCheckBoxShedModeFormsDa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the seek slider relative to the current time of the track
function seekUpdate() { let seekPosition = 0; if (!isNaN(curr_track.duration)) { seekPosition = curr_track.currentTime * (100 / curr_track.duration); seek_slider.value = seekPosition; let currentMinutes = Math.floor(curr_track.currentTime / 60); let currentSeconds = Math.flo...
[ "function ChangeTheTime() {\n audio.currentTime = seekbar.value;\n \n \n }", "seek(delta) {\n const newTime = this.audioTarget.currentTime + delta\n const startTime = this.audioTarget.seekable.start(0)\n const endTime = this.audioTarget.seekable.end(0)\n\n if (newTime < startTime) {\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Submits the value inputted by the user to the server.
function submit() { if(!is_valid_value()) { // should return some error code $('#error_msg').html('invalid input, try again') setTimeout(function() { $('#error_msg').html('') }, 1000) $('#valueInput').val('').focus() return } // Otherwise, let's roll store_block_data("value submitted"...
[ "function setInputAndSubmit(aForm, aField, aValue)\n{\n setInput(aForm, aField, aValue);\n aForm.submit();\n}", "function handleSubmit(event) {\n event.preventDefault(); // When event happens page refreshed, this function prevents the default reaction\n const currentValue = input.value;\n paintGreeting(c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a function that multiplys four numbers and returns the product
function multiFourAndReturn(n1,n2,n3,n4){ return n1*n2*n3*n4 }
[ "function product (a, b){\n return a*b;\n}", "function multiplicationNum (num1, num2, num3) {\n totalMultipication = num1 * num2 * num3;\n return totalMultipication;\n}", "function multiplicacion(a, b) {\n //tu codigo debajo\n let resultado = a * b;\n return resultado;​\n}", "function product(a, b) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
let formatdate = (timestamp) => new Date(timestamp 1000).toLocaleDateString()
function formatdate(timestamp) { let thisdate = new Date(timestamp * 1000) return `${weekdays[thisdate.getDay()]} ${months[thisdate.getMonth()]} ${thisdate.getDate()}, ${thisdate.getFullYear()}` }
[ "dateformat(date) { return \"\"; }", "function formatDate(created_at) {\n let date = new Date(created_at);\n let month = date.getMonth() + 1;\n return date.getFullYear() + \"/\" + month + \"/\" + date.getDate();\n}", "function formatDateDay(timestamp) {\n let Update = new Date(timestamp);\n let dayz = Upda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funtion that toggle the footer element to apear or vanish
function togle_footer(){ if(footer_hidden){ showFooter(); footer_hidden = false; }else{ hideFooter(); footer_hidden = true; } }
[ "function footerToggle() {\r\n var slider = document.getElementById('slider');\r\n var fade = document.getElementById('fade-wrapper');\r\n var footerToggle = document.getElementById('footer-toggle');\r\n if (footerToggle.innerHTML === 'Read More (+)') {\r\n footerToggle.innerHTML = 'Read Les...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Schedule an update for all data for a specific date
function scheduleDataUpdate(date) { scheduleUpdate(dataTimeout, date, function() { onDataUpdate(); }); }
[ "function scheduleGamesUpdate(date) {\n scheduleUpdate(matchesTimeout, date, function() {\n onMatchesUpdate();\n });\n}", "function updateKeyByDate(keyObj,date){\n Keyword.findOne({term:keyObj.term},function(err,foundKeyword){\n var givenDate = date.toDateString();\n if (err){\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by Java9ParserclassOrInterfaceType.
enterClassOrInterfaceType(ctx) { }
[ "enterClassType_lf_classOrInterfaceType(ctx) {\n\t}", "function ProgramParser() {\n \t\t\n \t\t this.parse = function(kind) {\n \t\t \tswitch (kind) { \t\n \t\t \t\tcase \"declaration\": return Declaration();\n \t\t \t\tbreak;\n\t \t\t\tdefault: return Program();\n\t \t\t}\n\t \t}\n \t\t\n \t\t// Import Methods f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to remove all day note headers
function _removeDayNoteHeaders() { var $dayNumberOfHeaderNotes = $(".day-number-of-header-note"); $dayNumberOfHeaderNotes.each(function( i ) { var dayNumber = $(this).text(); var html = "<span class='fc-day-number'>" + dayNumber + "</span>" var $dayHeader = $(this).parent(); $dayHe...
[ "function removeAllJouralEntries() {\n $('#table_journal > tbody > tr').remove();\n}", "function cleanCells(){\n removeCurrentDayId();\n var tableCells = document.getElementsByTagName(\"td\");\n for(let i = 0; i < tableCells.length; i++){\n removeClass(tableCells[i], \"color\");\n remove...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rehydrate the insertion cache with ids sent from renderStatic / renderStaticOptimized
function rehydrate(ids) { // load up ids (0, _objectAssign2.default)(inserted, ids.reduce(function (o, i) { return o[i] = true, o; }, {})); // assume css loaded separately }
[ "hydrateOnUpdate() {\n return true;\n }", "static instances(){\n return Object.keys(__cache).map(path => __cache[path])\n }", "function loadTagCaches() {\n //flags, gametypes and restrictions\n return Promise.all([\n gw2DB('ref_itemflags').then((flags) => {\n createIndexerFromArrayOfPairs(flag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ADEBadgeInstallerInstanceWithDefs() Create an instance of the ade_web_library.swf using defaults for most settings Set the defaults with SetADEBadgeInstallerDefaults
function ADEBadgeInstallerInstanceWithDefs(HTMLdivID, HTMLobjectID) { return ADEBadgeInstallerInstance(HTMLdivID, HTMLobjectID, G_bAutoInstall, G_bAutoLaunch, G_strBadFlashRedirectURL, G_bSendSWFVersion, G_bSendButtonPush); }
[ "function ADEBadgeLauncherInstanceWithDefs(HTMLdivID, HTMLobjectID, contentURL, doFulfillmentLink)\r\n{\r\n\treturn ADEBadgeLauncherInstance(HTMLdivID, HTMLobjectID, contentURL, doFulfillmentLink, G_bAutoInstall, G_bAutoLaunch, G_strBadFlashRedirectURL, G_bSendADEInstalled, G_bSendSWFVersion, G_bSendButtonPush);\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This funcion calculates the discounted cost
function calcAmount(cost, discount) { return cost - discount; }
[ "calcDiscount() {\n if (this.discount != 0 || this.discount != null) {\n this.discPrice = (1 - this.discount / 100) * this.totalPrice;\n }\n }", "calDiscount(){\n this._discount = this._totalCharged * (10/100) ;\n }", "function updateTotalTable() {\r\n let price = 0;\r\n let discount...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if subnode has higher precedence than node. If subnode is the right subnode of a binary expression, right is true.
static subnodeHasPrecedence(node, subnode, right) { const nodeType = node.type, nodePrecedence = expressionTypePrecedence[nodeType] || -1, subnodePrecedence = expressionTypePrecedence[subnode.type] || -1; if (subnodePrecedence > nodePrecedence) return...
[ "function nodePrecedence(node, subNode, right) {\n var nodeType = node.type,\n nodePrecedence = expressionTypePrecedence[nodeType] || -1,\n subNodePrecedence = expressionTypePrecedence[subNode.type] || -1,\n nodeOperatorPrecedence,\n subNodeOperatorPrecedence;\n return nodePreceden...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getShipmentMethod to get current shipment method until we handle multiple methods, we just use the first
function getShipmentMethod(currentCart) { let cart = currentCart || Cart.findOne(); if (cart) { if (cart.shipping) { if (cart.shipping[0].shipmentMethod) { return cart.shipping[0].shipmentMethod; } } } return undefined; }
[ "function setDefaultShippingMethod(){\n nlapiSetFieldValue(\"shipmethod\", \"4774\") // set default shipping method to Freight Other\n}", "static getMethodInfoByName(method_name){\n\t\treturn null;\n\t}", "getMethodName()\n {\n return this._methodName\n }", "function checkShippingMethod() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change result panel color
function change_result_panel_color(correct_answer, user_choice, result_panel) { if (correct_answer === user_choice) { result_panel.find('span').css('background-color', '#5cb85c'); result_panel.find('span').css('color', '#fff'); result_panel.find('span').css('border-color', '#4cae4c'); } ...
[ "function showred() {\r\n var o_panel_info = document.getElementById(\"outputpanel\").classList\r\n if(o_panel_info.length > 1){\r\n o_panel_info.remove(\"greenbg\", \"darkbg\", \"lightbg\");\r\n }\r\n o_panel_info.add(\"redbg\");\r\n}", "function showgreen() {\r\n var o_panel_info = document.getElementBy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the center of a face
get center() { // Check if the face is bound to a mesh and if not throw an error if (!this.mesh) throw new Error(`Cannot compute the face center - the face is not bound to a Mesh`); // Calculate the center of the face return new Point(divide(add(this.a, this.b, this.c), 3)); }
[ "center() {\n return this.normal.mulX(this.d);\n }", "function compute_centroid(facet, vertices) { \n var va = vertices[facet.a];\n var vb = vertices[facet.b];\n var vc = vertices[facet.c];\n\n return new THREE.Vector3(\n (va.x + vb.x + vc.x)/3,\n (va.y + vb.y + vc.y)/3,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subtracts point2's coordinates from point1's coordinates, returning a delta
function diffPoints(point1, point2) { return { left: point1.left - point2.left, top: point1.top - point2.top, }; }
[ "function getVector(pt1, pt2) {\n\n return {\n x: pt2.x - pt1.x,\n y: pt2.y - pt1.y\n }\n}", "sub(other, out) {\n out.x = this.x - other.x;\n out.y = this.y - other.y;\n }", "function getDirectionVector(pointA,pointB)\n{\n\treturn new Point(pointB.x-pointA.x, pointB.y - pointA.y);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compiles a string of LESS data to a minified string of CSS data.
function compile_less_to_css(less_data) { log('Compiling LESS to CSS'); var defer = q.defer(); less.render(less_data, { paths: [INPUT_DIRECTORY], compress: true }, function(error, css_tree) { if (error) { defer.reject(error); } else { try { var css_data = css_tree.css...
[ "function processScieloArticleStandaloneLess(){\n return src(target_src['less']['scielo-article-standalone'])\n .pipe(sourceMaps.init({loadMaps: true}))\n .pipe(concat(output['css']['scielo-article-standalone']))\n .pipe(less(output['css']['scielo-article-standalone']))\n .pipe(minifyCSS())\n .pip...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function adds HTML elements and content to the specified container (UL).
function createListHTML(list, container) { container.innerHTML = ""; //first, clean up any existing LI elements for (var i = 0; i < 6; i++) { container.innerHTML = container.innerHTML + "<li data-index='" + list[i]["index"] + "'>" + "<span>" + list[i]["text"] + "</span>" + "</li>"; //OR shorter vers...
[ "function addListItem(contentToAdd, itemName = \"li\") {\n var listToUse = document.getElementById(\"example-list\");\n var cookieStandItem = document.createElement(itemName);\n cookieStandItem.innerText = contentToAdd;\n listToUse.appendChild(cookieStandItem);\n}", "function insertElementLiInUL() {\n ul.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the source of the value of the attribute.
getValueSource() { return this._source; }
[ "get resourceRecordValue() {\n return this.getStringAttribute('resource_record_value');\n }", "getRawValue() {\n return this.value;\n }", "function getAttributeValue(template, attribute){\n\t// var pattern = new RegExp(attribute + '\\=\"(.*?)\"');\n\tvar pattern = new RegExp('([\\\\s|\\\\S]*...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter table using slider on closing prices
function filter(low, high){ var rows = document.getElementById('stocks').rows; for (var row = 0; row < rows.length; row++){ var price = rows[row].cells[4].innerHTML; if (price < low || price > high) rows[row].className = "HiddenClass"; else rows[row].className = ""; } filterCurrentPrices(low, high); }
[ "function onFilterChange () {\n self.prodSelected = false;\n if (self.filterVal === \"All\") {\n self.filteredProducts = [];\n self.filteredProducts = self.products;\n } else if (self.filterVal === \"Less Than $500\") {\n self.filteredPro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Navigate to the path + query of the given Location object.
navigateToLocation(location) { const params = this.navigationQueryParams(); const url = this.getLocation(params, location); if (url.toString() === window.location.toString()) { return; } const path = this.urlToPath(location); if (path !== this.path) { this.path = path; } url...
[ "buildLocation() {\n const search = this.#params.toString();\n return { ...this.#location, search: search ? '?' + search : '' };\n }", "function locationQuery(params) {\n return (\n \"?\" +\n Object.keys(params)\n .map(function(key) {\n return encodeURIComponent(key) + \"=\" + encodeURIC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decide which html content to load based on loader type
loaderHtml(){ //debugger switch (this.props.type.toLowerCase()){ case 'hourglass': return ( <div className="lds-hourglass"></div> ) case 'roller': return ( <div className="lds-roller"> <div></div><div></div><div></div><div></div><div></div><div...
[ "function load_core_htmls(){\n switch(user['type'])\n {\n case 0:\n get_client(1);\n break;\n case 1:\n get_clients(1);\n break;\n case 2:\n get_agg(1);\n break;\n default:\n break;\n }\n}", "function renderByType() {\n\t\t\t\tswitch(templateEngineRequire.renderType()) {\n\t\t\t\t\tcas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`mergeAndPrefix` is used to merge styles and autoprefix them. It has has been deprecated and should no longer be used.
function mergeAndPrefix() { process.env.NODE_ENV !== "production" ? (0, _warning2.default)(false, 'Use of mergeAndPrefix() has been deprecated. ' + 'Please use mergeStyles() for merging styles, and then prepareStyles() for prefixing and ensuring direction.') : undefined; return _autoPrefix2.default.all(mergeStyles....
[ "function prefix_css(css_data) {\n log('Prefixing the CSS');\n return q.resolve(processor.process(css_data).css);\n}", "function mergeStorybook(_a) {\n var mode = _a.mode, config = _a.config, userConfig = _a.userConfig;\n var _b, _c, _d;\n var newConfig = webpack_merge_1.default(config, {\n plug...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get data about the borders of the constellations, from the CSV
function getBorderData() { Papa.parse(BORDER_FILE_NAME, { header:true, download: true, skipEmptyLines: true, dynamicTyping: true, delimiter: ',', complete: function(results) { //log any errors in the console for(err in results.errors) { console.log(results.errors[err]); } for(var i = 0; i ...
[ "getNeighbors(col, row){\n var res = [];\n //left border\n if(col > 0){\n this.agentController.ocean.lattice[col-1][row].forEach( (agent) =>{\n res.push(agent);\n });\n }\n //right border\n if(col < (100/ocean.latticeSize)-1){\n this.agentController.ocean.lattice[col+1][row]....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: currentCFChasMethod DESCRIPTION: ARGUMENTS: RETURNS:
function currentCFChasMethod(methodName) { var CFCComponentRec = getCurrentCFCComponentRec(); if (CFCComponentRec != null) { var aCFC = getParsedCFCinfo(CFCComponentRec); if (aCFC.methods.length > 0) { for (var m=0; m<aCFC.methods.length; m++) { var possibleMethod = aCFC.methods[m]; if (caseInsen...
[ "function insertCFCEnabled()\n{\n\tvar componentRec = dw.serverComponentsPalette.getSelectedNode();\n\tif ((componentRec != null) && (componentRec.objectType == METHOD_OBJECT_TYPE))\n\t{\n\t\treturn true;\n\t}\n\n\treturn false;\n}", "function getCFINodeString(isHrmode) {\n\tvar currentrange;\n\tcurrentrange = do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The game is over if the user runs out of guesses or if they are declared a winner
isGameOver() { return this.winner || this.numGuessesRemaining === 0 }
[ "function game_over() {\n // you must try all 8 possibilities to determine if the game is won by someone:\n // 3 rows, 3 columns, and 2 diagonals!\n // Also, if all cells are occupied, and no one won, then it is a tie!\n \n // if no one won, and it is not a tie, then it is on going.\n return \"+\";\n}", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
4. Implement a button image toggle feature. Include at least four elements that employ background image for the buttons. Use an HTML element event to call a function you wrote named buttonImageToggle() that uses jQuery to change the background image of all buttons on the page. When the event is fired again the image re...
function buttonImageToggle() { $(document).ready(function() { $(':button').click(function() { if ($("div#test4 button").eq(0).hasClass("button1")){ $("div#test4 button").eq(0).removeClass("button1"); $("div#test4 button").eq(0).addClass("button5"); ...
[ "function imageSwitch() {\n tmp = $(this).attr('src');\n $(this).attr('src', $(this).attr('alt_src'));\n $(this).attr('alt_src', tmp);\n }", "function disabledButtonDisplayToggle(target)\n{\n if(!target.firstChild)\n {\n let image = document.createElement(\"img\");\n image.setAttri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Uses $modal service to open the specified template to gather options then passes those options along to the sorter with the players template should expose a $scope.options model with the expected values
function dialogWrapper(sortFn, templateUrl) { var fn = function (players) { return $q(function(resolve, reject) { var modalInstance = $modal.open({ templateUrl: templateUrl, controller: function($scope, $modalInstance) { ...
[ "function initializeUserOptionsView() {\n $ionicPopover.fromTemplateUrl('app/weather/options-dialog.html', {\n scope: $scope\n }).then(function (popover) {\n popoverView = popover;\n });\n }", "open(options = {}) {\r\n if (!options.modal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A result and final position returned by the `.parse...` functions.
function ParseResult(result, newPosition, peek) { this.result = result; this.position = newPosition; }
[ "lesx_parseElement() {\n var startPos = this.start,\n startLoc = this.startLoc;\n\n this.next();\n\n return this.lesx_parseElementAt(startPos, startLoc);\n }", "parse_start(text,context){\n\t\tfor(const parser of this.start_parsers){\n\t\t\tconst res=parser.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Because webpackCompiler.watch() isn't being used manually remove the changed file path from the cache
function webpackCache(e) { var keys = Object.keys(webpackConfig.cache); var key, matchedKey; for (var keyIndex = 0; keyIndex < keys.length; keyIndex++) { key = keys[keyIndex]; if (key.indexOf(e.path) !== -1) { matchedKey = key; break; } } if (matchedKey) { delete webpackConfig.cache[matche...
[ "static deleteCache (path) {\n delete require.cache[require.resolve(path)]\n }", "apply(compiler) {\n compiler.hooks.afterEmit.tap('MoveResourcesPlugin', (compilation)=>{\n let movePath = isProduction\n ? `${projectRootPath}/templates/_auto_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }