query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Transforms an RDF term to the internal representation of a term, assuming it is not a variable, which would be an expression (internally).
function transformRDFTermUnsafe(term) { return transformTerm({ term, type: 'expression', expressionType: 'term', }); }
[ "transformRDFTermUnsafe(term) {\n return this.transformTerm({\n term,\n type: sparqlalgebrajs_1.Algebra.types.EXPRESSION,\n expressionType: sparqlalgebrajs_1.Algebra.expressionTypes.TERM,\n });\n }", "function RDFMakeTerm(formula,val, canonicalize) {\n if (type...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
splits the phrase in words
function toSplit(phrase){ var cut = phrase.split(" "); return cut; }
[ "split(phrase) {\n return phrase.toLowerCase().split(/\\s+/g);\n }", "function _splitWords(text) {\n\t\t\treturn text.split(/\\s+/);\n\t\t}", "function _splitWords(text) {\n\t\treturn text.split(/\\s+/);\n\t}", "function splitText(t) {\n return t.split(\"|\")\n .map(function (el) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This helper function takes an individual quote object and turns it into an li. Called on the initial render and whenever we post a quote.
function renderQuote(quote){ return `<li class='quote-card'> <blockquote class="blockquote"> <p class="mb-0">${quote.quote}</p> <footer class="blockquote-footer">${quote.author}</footer> <br> <button data-like-id=${quote.id} class='btn-success'>Likes: <span>${quot...
[ "function formatQuoteList(quote) {\n return `\n <blockquote class=\"blockquote\">\n <p class=\"mb-0\">${quote.quote}</p>\n <footer class=\"blockquote-footer\">${quote.author}</footer>\n <br>\n <button class='btn-success' success_id=${quote.id}>Likes: <span>${quote.likes}</span></bu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets validation messages from a validation response object.
function getMessages(result) { let messages = []; if (result.messages) { messages = [...messages, ...result.messages]; } if (result.schemaValidationMessages) { messages = [ ...messages, ...result.schemaValidationMessages.map((m) => `${m.level}: ${m.message}`), ]; } return messages; }
[ "function validateGetSmsResponse(response) {\n\tnotEqual(response[\"InboundSmsMessageList\"], undefined, \"InboundSmsMessageList\");\n\tisml = response[\"InboundSmsMessageList\"];\n\tif (isml != null) {\n\t\tnotEqual(isml[\"TotalNumberOfPendingMessages\"], undefined, \"TotalNumberOfPendingMessages\");\n\t\tnotEqual...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a custom button control to add to Google Maps
function customGoogleMapsButton(text, action) { var controlDiv = document.createElement('div'); var controlUI = document.createElement('div'); controlUI.style.backgroundColor = 'white'; controlUI.style.backgroundClip = 'padding-box'; controlUI.style.cursor = 'pointer'; controlUI.style.textAlign = 'center'; con...
[ "function addGeoLocationButton() {\r\n\t\t\tif (_geoBtn)\r\n\t\t\t// already added\r\n\t\t\t\treturn;\r\n\r\n\t\t\tvar onClickEvent = function (evt) {\r\n\t\t\t\t_plugIn.setMapCentreByGeo();\r\n\t\t\t};\r\n\r\n\t\t\t_geoBtn = createControlButton(\r\n\t\t\t\tBUTTONS.Geo,\r\n\t\t\t\tgm.ControlPosition.TOP_LEFT,\r\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolve a relation proxy out of the cache here. Relation proxies must be cached to allow them to maintain state without being created unnessesarily.
resolveRelationProxy(RelationProxyClass, destinationReference, options) { // TODO: Support parallel relation proxies. // XXX: Bad import. const { Model } = require('./model'); // Unpack the foreign key from the provided options set. const {fk: foreignKeyAttribute, ...remainin...
[ "createLazyRelationsWrapper() {\n return new LazyRelationsWrapper(this);\n }", "cacheRelatedRecord(record, id, name, uncacheId = null) {\n const me = this,\n cache = me.relationCache[name] || (me.relationCache[name] = {});\n\n if (uncacheId !== null) {\n me.uncacheRelatedRecord(recor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show or hide all blocks with a class name
function setBlockVisibility(class_name, show) { var blocks = document.getElementsByClassName(class_name); for(var i = 0; i < blocks.length; i++) { if(show) { blocks[i].style.display = ''; } else { blocks[i].style.display = 'none'; window.clearAllErrors(blocks[i]); ...
[ "function setBlockVisibility(class_name, show) {\n var blocks = document.getElementsByClassName(class_name);\n for (var i = 0; i < blocks.length; i++) {\n if (show) {\n blocks[i].style.display = \"\";\n } else {\n blocks[i].style.display = \"none\";\n window.clearA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function updates the "Link" element on the page, appending the lat and lng
function updateLink() { if(document.getElementById("link_span").childElementCount > 0) { var url = parseURL(document.getElementById("link_span").firstChild.href); url.params["lat"] = unsafeWindow._c09.getCenter().lat(); url.params["lng"] = unsafeWindow._c09.getCenter().lng(); url.params["zoom"] = unsafeWindow....
[ "function updateLinkHereText() {\n \n let loc = window.location;\n let center = map.getCenter();\n let link = \tloc.protocol + \"//\" + loc.hostname + loc.pathname + \"?r=\" +\n\tshowrouteParams.roots[0];\n if (showrouteParams.connected) {\n\tlink += \"&cr\";\n }\n link += \"&lat=\" + center.la...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: handleTopic description: Handle message received
handleTopic(topic, msg) { this.logger.debug("[" + this.name + "] wheel position sensor handleTopic: topic = " + topic + ", msg = " + msg) if (topic === this.subTopic) { var wheel_position = parseInt(msg) var valid = true if (this.simulator) valid = this.simulator.valid(wheel_position) if (isNaN(wheel_po...
[ "function do_topic_handler(error, subscription, topic, message) {\r\n if (!error) {\r\n try {\r\n let parsed_message_object = JSON.parse(message.toString());\r\n parse_do_topic(topic, parsed_message_object);\r\n } catch (error) {\r\n log.error(topic, error);\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a collection and the restoreJSON structure, looks up the definitions and invokes define() on them.
function restoreCollection(collection, restoreJSON) { const definitions = getDefinitions(restoreJSON, collection._collectionName); console.log(`Defining ${definitions.length} ${collection._collectionName} documents.`); _.each(definitions, definition => collection.define(definition)); }
[ "function getDefinitions(restoreJSON, collection) { //\n return _.find(restoreJSON.collections, function (obj) { // 16\n return obj.name === collection; //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the two sprites overlap
spriteOverlap(a, b) { let ab = a.getBounds(); let bb = b.getBounds(); return ab.x + ab.width > bb.x && ab.x < bb.x + bb.width && ab.y + ab.height > bb.y && ab.y < bb.y + bb.height; }
[ "function checkOverlap(spriteA, spriteB){\n var boundsA = spriteA.getBounds();\n var boundsB = spriteB.getBounds();\n return Phaser.Rectangle.intersects(boundsA,boundsB);\n}", "function overlap(obj1, obj2) {\n var right1 = obj1.x + obj1.width;\n var right2 = obj2.x + obj2.width;\n var left1 = obj1.x;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`_readForwardPath` reads a '!' path
_readForwardPath(token) { var subject, predicate, object = this._blank(); // The next token is the predicate if ((predicate = this._readEntity(token)) === undefined) return; // If we were reading a subject, replace the subject by the path's object if (this._predicate === null) subject = t...
[ "_readForwardPath(token) {\n let subject, predicate;\n const object = this._blankNode();\n // The next token is the predicate\n if ((predicate = this._readEntity(token)) === undefined)\n return;\n // If we were reading a subject, replace the subject by the path's object\n if (this._predicate ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is where the two read stream tasks are built, individually asynTasks will be the two functions that will be invoked added one at a time, each time this function is invoked msg holds the parameters k is the key value for the files in msg. listParams is where the files will go so that they can be sent to the service...
function addTask(asyncTasks, msg, k, listParams, node) { asyncTasks.push(function(callback) { var buffer = msg.params[k]; temp.open({ suffix: '.' + fileType(buffer).ext }, function(err, info) { if (err) { node.status({ fill: 'red', shape: 'ring', ...
[ "readFiles(files, callback) {\n return new Promise((resolve) => {\n async_1.map(files, fs_1.readFile, (error, buffer) => {\n if (error) {\n throw error;\n }\n if (buffer) {\n buffer.forEach((bf, index) => __awaiter(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use reduce to group an array of objects on a specified key
function groupByKey(array, key = "key") { return array.reduce((actual, current) => { if (actual[current.key] === undefined) { actual[current.key] = []; } actual[current.key].push(current); return actual; }, {}); }
[ "function groupBy(array, key) {\n return array.reduce((result, currentValue) => {\n (result[currentValue[key]] = result[currentValue[key]] || []).push(\n currentValue\n );\n return result;\n }, {}); \n}", "groupBy( arrayOfObjects, key ) {\n\n return _.groupBy(arrayOfObjects,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provide default properties to dimensions that have a single role bound to it, by using the role's properties. The order of application is not relevant. TODO: this is being repeated for !prebound! dimensions
function applySingleRoleDefaults() { def.eachOwn(singleRoleByDimName, function(r, n) { complexTypeProj.setDimDefaults(n, r.dimensionDefaults); }, this); }
[ "getDefaultRole( role ) {\n return store.getters.getDefaultRole( role );\n }", "applyDefault () {\n this.targetMorph[this.accessor] = PROP_CONFIG[this.selectedProp].defaultValue; // eslint-disable-line no-use-before-define\n }", "setDefaultDimensions(dimensions) {\n Logger_1.LOG(`Received default...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Example quadtree: 1011 0111 1010 0111 Binary String: 1011011110100111 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1001 1111 1001 1011 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0 0 1 1 0 0 1 1 0 1 ...
function quadtree(img, sRow, sCol, path, lvl, numOfCols, parent) { var isSame = true; var startColor = img[sRow][sCol]; var binStr = ""; var rows = sRow + numOfCols; var cols = sCol + numOfCols; for (var i = sRow; i < rows; i++) { for (var j = sCol; j < cols; j++) { var cel...
[ "function decodeTreeString(treeString, Theta, phi, headAngle, start, r) {\n let i = 0;\n let current = start;\n let vertices = []; // array of vertices to be returned\n while( i != treeString.length ) {\n // base cases -> F, +, -, &, *\n if( treeString[i] == \"F\" ) {\n vertices...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RedSandHashHandler Returns an associative array of anchors present in the document.
getDocumentAnchors() { let anchors = []; for (let i = 0; i < document.anchors.length; i++) { anchors[this.hashSeparator + document.anchors[i].name] = true; } return anchors; }
[ "function getAnchors() {\n\t\t// get all anchors in document\n\t\tvar anchorTags = document.getElementsByTagName(\"a\");\n\n\t\t// array will store all anchors with href attribute \"section\"\n\t\tvar anchorsWithHrefSection = [];\n\n\t\tfor(var i = 0; i < anchorTags.length; i++) {\n\t\t\tif(anchorTags[i].getAttribu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
renders a table of items starting with the specified index in the item list
function renderItemsStartingAt(elem$, data, index) { if (data && data.items && index < data.items.length) { // render items elem$.empty(); var opt = elem$.data('gw2items_options') || {}; for (var i = index; i < data.items.length && (i - index) < opt.pageSize; i++) { fetchItem(data.items[i], function(i...
[ "renderItemByIndex(index) {\n if (this.itemsList.length <= 0) {\n var blankItem = {\n Name: \"--\",\n CurrentPrice: \"N/A\",\n LowestPrice: \"N/A\",\n HighestPrice: \"N/A\",\n Date: \"--\",\n Status: \"N/A\",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a Registration tag and/or a Newsletter tag customerID: required for Registration. ID of Customer to register. customerEmail: required for Newsletters. Optional for Registration. customerCity: optional. City of Customer that placed this order customerState: optional. State of Customer that placed this order cust...
function cmCreateRegistrationTag(customerID, customerEmail, customerCity, customerState, customerZIP, customerNum, customerType, zone, newsletterName, subscribe) { var cm = new _cm("tid", "2", "vn2", "e3.1"); cm.cd = customerID; cm.em = customerEmail; cm.sa = customerState; cm.ct = customerCity; cm.zp = ...
[ "function cmCreateRegistrationTag(customerID, customerEmail, customerCity, customerState, customerZIP, newsletterName, subscribe, customerCountry, attributes) {\n\tcmMakeTag([\"tid\",\"2\",\"cd\",customerID,\"em\",customerEmail,\"ct\",customerCity,\"sa\",customerState,\"zp\",customerZIP,\"nl\",newsletterName,\"sd\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets or sets the direction in which selection occurred.
get selectionDirection() { return this.getInput().selectionDirection; }
[ "getDirection() {\n // Try to move the selection forward or backward, check whether it got bigger or smaller (then\n // restore it).\n for (let direction of [forward, backward]) {\n var change;\n if (change = this.extendByOneCharacter(direction)) {\n this.extendByOneCharacter(this.opposite...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call the HTTP Cloud Function to create a pdf. Either AUTH the page with REST or SDK
function getPdf(auth) { if (!auth) { auth = "sdk"; } //custom api to make PDF var pdfURL = 'https://us-central1-hello-firebase-ea30c.cloudfunctions.net/api/pdf?auth=' + auth; //If we are running on local host, then hit the local host API if (location.host == "localhost:5000") { pdfURL = 'http://l...
[ "function createPDFPost(req, res) {\n\n let filePath = req.file.path;\n let fileName = req.file.filename;\n\n try {\n // Initial setup, create credentials instance.\n const credentials = PDFToolsSdk.Credentials\n .serviceAccountCredentialsBuilder()\n .fromFile(\"pdftools...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that helps us to get the value of all the orders a user has made
function ordersValue(user){ let orders = user.orders; let value = 0; for (order in orders){ let orderOBJ = user.orders[order]; value += orderOBJ.value; } return value; }
[ "function getCurrentOrders (){\n currentUser = JSON.parse(localStorage.getItem('users'));\n let currentOrders = []\n\n let currentUserId \n //compare and obtain the user that is logged in \n for(let i = 0; i < currentUser.length; i++){\n if(currentUser[i].logged == 1 ){\n currentUse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================================ Backend updating ================================== /Ajax call for family name update
function updateFamilyName() { var newFamilyName = document.getElementById('familyName').value; var propId = document.getElementById('propId').value; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById('FamilyNam...
[ "function FamilyListOnChange() {\n var familyName = $('#famenum_box option:selected').text();\n var data = { \"FamilyName\": familyName };\n\n $('#relmem_droptext').prop('disabled', false);\n $('#memenum_box').prop('disabled', false);\n $('#relfam_droptext').val('');\n\n DynamicMemberAjaxRequest(d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the given object is an instance of DefaultNetworkAcl. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === DefaultNetworkAcl.__pulumiType; }
[ "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === NetworkAcl.__pulumiType;\n }", "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the table, according to the current language To call when the language change
function loadTable() { STATIONS.getStations(function(stations){ var lang; if(TEXT.getLang() === 'fr') { lang = "French"; } else { lang = "English" } $('#table').dataTable({ 'destroy': true, 'aaData': stations, 'aoColumns' : [ { 'mDataProp': 'id' }, ...
[ "function change_lang(){\n lang = !lang;\n load_table_schema(info_table);\n load_table_gpif_schema(gpif_table);\n load_table(table_data);\n}", "function change_lang() {\n lang = !lang;\n load_table_schema(info_table);\n load_table_gpif_schema(gpif_table);\n load_table(table_data);\n}", "loadStri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prototype for grade metrics Grade metrics are a special case of metrics, as they return their estimate in the form of a number indicating a grade in the US system.
function GradeMetricPrototype(){ /*jshint maxcomplexity: 20*/ //source: //http://en.wikipedia.org/wiki/Education_in_the_United_States this.getGrade = function(text){ var grade = this.getValue(text); if(grade < -1){ return 'Preschool'; } else if(grade <= 0){ return 'Pre-Kindergarten'; } else ...
[ "calculatedGrade () {\n\t\t\tlet p = this.participation;\n\t\t\treturn 0.15 * p.studio + 0.05 * p.feedback + 0.05 * p.other + .75 * this.homeworkAverage;\n\t\t}", "rawGradeFactor() {\n return this.time / this.bestTime()\n }", "function StudentReport() {\r\n var grade1 = 4;\r\n var grade2 = 2;\r\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
png2rgb_arr("",rotate(times of 90 degree right),callback function)
async png2rgb_arr(path, rotate = 1, callback) { // path = "asset/LED/LED_CHEST/chest1.png" getPixels(path, function (err, pixels) { if (err) { console.log("Bad image path") return } let pixels_raw = Array.from(pixels.data) ...
[ "async png2rgb_arr(path, rotate = 1, callback) {\n // path = \"asset/LED/LED_CHEST/chest1.png\"\n getPixels(path, function (err, pixels) {\n if (err) {\n console.log(\"Bad image path\");\n return;\n }\n let pixels_raw = Array.from(pixels.data);\n\n let img_arr = [];\n le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
search object with the same store id and then item id and push it to bowl array
function searchProduct(itemstore, itemid){ for(var i = 0; i < jsonArr.length; i++){ if(jsonArr[i]._id === itemstore){ for(var j = 0; j < jsonArr[i].items.length; j++){ if(jsonArr[i].items[j]._id === itemid){ jsonArr[i].items[j].number = 0; ...
[ "checkIfSearchResultExistInMyReads(searchResult) {\n this.state.bookListMyReads.map((myBook) => {\n searchResult.map((searchBook) => {\n if (myBook.id === searchBook.id) {\n searchBook.shelf = myBook.shelf;\n }\n })\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions fill trialLeft box with hearts
function addHearts(){ $("#trialsLeft").empty(); for(i = 0; i < trialsLeft; i++){ $("#trialsLeft").append('<img src="images/heart.png" class="life">'); } }
[ "function addHearts() {\r\n\t\t$(\"#trialsLeft\").empty();\r\n\t\tfor (i = 0; i < trialsLeft; i++) {\r\n\t\t\t$(\"#trialsLeft\").append('<img src=\"Images/Srce.png\" class=\"life\">');\r\n\t\t}\r\n\t}", "function addHearts(){\n $(\"#trailsLeft\").empty(); //Make trialsLeft div empty before adding any heart...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set input values functionality
function setInputValues() { var stateFilter = settings['state-date'] || settings['state-record']; if (stateFilter) { if ('date' === stateFilter['type']) { if (stateFilter['operands'].hasOwnProperty('value')) { if ('>' === stateFilter['operator'] || '=' === stateFilter['operator...
[ "fillInValues() {\r\n this.findViewElements();\r\n this.nameInput.value = this.catName;\r\n let n = (this.optionValues.length < this.optionInputs.length)\r\n ? this.optionValues.length : this.optionInputs.length;\r\n for (let i = 0; i < n; ++i) {\r\n this.option...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function which writes all completed tasks
static _writeAllCompletedTasks() { this._tasks.forEach((task, taskName) => { if (task && task.state === TaskWriterState.ClosedUnwritten) { this._writeTask(taskName, task); } }); }
[ "function tasksComplete() {}", "function doneTasks() {\n\n\t\tif (doneTasksBuffer.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet title = (doneTasksBuffer.length === 1) ?\n\t\t\t'Task finished' :\n\t\t\tdoneTasksBuffer.length + ' tasks finished'\n\n\t\tnotify('done', title, doneTasksBuffer.join(', '));\n\n\t\tdo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function sorts cities or other objects my name alphabetically INNER FUNCTION CALLS: none
function sortByName(object, className) { object.sort(function (a, b) { if (className == 'warehouse' || className == 'projecteq') return a.city.name > b.city.name; else return a.name > b.name; }); return object; }
[ "function sortBasedonCity(address){\n address.sort(function (x, y) {\n let a = x.City.toUpperCase(),\n b = y.City.toUpperCase();\n return a == b ? 0 : a > b ? 1 : -1;\n });\n Display(address);\n}", "function SortByName(a, b){\n\n var aName = a.country.toLowerCase();\n var bName =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
middleware for checking image_url
function bodyHasImageUrl (req, res, next) { const { data : {image_url} = {}} = req.body; if(image_url && image_url != ""){ return next(); } next({ status: 400, message: "Dish must include an image_url", }); }
[ "function validateImageURL(image_url){\n \n }", "function imageUrlPropertyExists(req, res, next) {\n const { data: { image_url } = {} } = req.body;\n if (image_url) {\n return next();\n }\n next({\n status: 400,\n message: `Dish must include a image_url.`,\n });\n}", "function imageUrlPr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function to get the div inside the EgCard tag.
getComponent() { return this.querySelector("div"); }
[ "function demoCardSubDivs(){\n\n}", "function getCardElement(cardType) {\n\treturn $('.open .fa-' + cardType).parent();\n}", "function div(content){ return elem(\"div\", content); }", "function cardSpanFromCard(card) {\n return document.getElementsByClassName(`${card.suit} ${card.rank}`)[0]\n}", "get hor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the total quantity of items. Arguments: items the items in the Bag
function getTotalQuantity(items) { return _.reduce(items, function(memo, item) { return memo + item.quantity; }, 0); }
[ "function getTotalItemCount(){\n var total_item_count = 0;\n for(var i =0; i < cart_items.length; i++){\n total_item_count += cart_items[i][1];\n }\n return total_item_count;\n}", "itemTotal(items) {\n let total = 0;\n for (let i = 0; i < items.length; i++) {\n total +=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns players with more turnovers than assists
function turnovers(arr){ var players = []; arr.forEach(function turn(element){ if(element.turnovers > element.assists){ players.push(element.name); } }); return players; }
[ "function moreTurnoversThanAssists() {\n console.log(\"* Players with more turnovers than assists:\");\n allPlayers.forEach(function(player) {\n if (player.turnovers > player.assists) {\n console.log(player.name);\n }\n });\n}", "function playerWithMoreTurnoverThanAssists(players) {\n\tvar theBadPla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns Cloak service data path.
getDataPath() { const validApp = process.type === 'renderer' ? remote.app : app let configFolder = path.join(validApp.getPath('appData'), configFolderName) if (getOS() === 'linux') { configFolder = path.join(validApp.getPath('home'), '.CloakCoin') } return configFolder }
[ "dataPath() {\n return this.config(\"paths.data\");\n }", "getDataPath(filename) {\n return path.resolve(`${os.homedir()}/.json_config/robinhood/${filename}.json`);\n }", "function datafilePath() {\n return path.resolve(__dirname, DOWNLOAD_STATS_FILENAME);\n}", "function ___R$$priv$project$ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes a date. Selects the last instance of the subform class and removes it.
function removeDate() { let $removedForm = $(".subform").last(); let removedIndex = parseInt($removedForm.attr("data-index")); $removedForm.remove(); }
[ "removeDate(){\n\t\tthis.date = null;\n\t}", "function remDate(obj){\n console.log(\"remove date\");\n $(obj).parent().parent().remove(); \n $(obj).parent().parent().find(\"input[name*='cr_date_submit_']\").val('false');\n}", "function removeDateInput(date) {\n inputs = document.querySelectorAll('inpu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks to see if the player is still alive
function CheckAlive() { if(this.currentHealth <= 0) { Die(); } }
[ "function isPlayerAlive(){\n if(app.player.health < 1){\n app.playerAlive = false;\n } else{\n app.playerAlive = true;\n }\n}", "function isAlive(activePlayer) {\n if (activePlayer.health > 0) {\n return true;\n }\n return false ;\n}", "isPlayerDead() {\n \n return !this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populates a space with a grid of objects from 0,0 to 1,1. Width, height indicate the number of cells in the appropriate dimension
function populateGrid(space, width, height) { var distX = 1.0 / width; var distY = 1.0 / height; var xpos, ypos; var x,y; ypos = 0; for (y=0; y<height; ++y) { xpos = 0; for (x=0; x<width; ++x) { space.addObject({ x: xpos, y: ypos }, makeSpaceLocation({ x: xp...
[ "function Grid(width, height){\n this.space = new Array(width*height);\n this.width = width;\n this.height = height;\n}", "function Grid(width, height) {\n this.space = new Array(width * height);\n this.width = width;\n this.height = height;\n}", "function fillGrid()\n{\n for(let i=0;i<VCells;i++...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats the dice text for the display bar.
function getDiceText() { var dicetext = ""; var dicearray = new Array(); for(var i = 0; i < CurrentDiceGroup.dicegroup.length; i++) { var s = CurrentDiceGroup.dicegroup[i].sides; if(dicearray[s] == 'undefined' || dicearray[s] == null) { dicearray[s] = 0; } dicearray[s] += 1; } for(var sides = ...
[ "function diceRollLogRender(table) {\n //calculate totals for checking: totals, relative, expected, deviation\n var diceTotals = new Array(0, 0, 0, 0);\n var diceSides = 0;\n //count the number of dice sides\n for (var i = 0; i < diceRollLog.length; i++) {\n //check all items in array that hav...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the current read index.
getReadIndex() { return this._readIndex; }
[ "getReadIndex() {\r\n return this._readIndex;\r\n }", "function getIndex() {\n return internal.index;\n }", "async getCurentIndex() {\n\n this.check()\n return await this.storage.loadIndex()\n }", "getIndex() {\n return this.indexBuffer;\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes BS inputs for class "bsNum[dpm]", where dpm: 0 0 DP; 1 1 DP; 2m 2DP, nmin 999 999 999 999 999.99.
function bsIniInpNum(pUsedDpm, pParent) { $.each(pUsedDpm.split(","), function (idx, dpm) { var dp = parseInt(dpm.charAt(0)); var ndef = {decPl: dp, frmOnIni: true}; if (dpm.length > 1) { nmins = "-999999999999999"; if (dp > 0) { nmins = nmins + ".9"; for (i = 1; i < dp; i++) {...
[ "function initializeNumber(){\n pNmbrArr.push(phoneNmbr.slice(0,1) + \"32\");\n pNmbrArr.push(phoneNmbr.slice(1,4));\n pNmbrArr.push(phoneNmbr.slice(4,6));\n pNmbrArr.push(phoneNmbr.slice(6,8));\n pNmbrArr.push(phoneNmbr.slice(8,10));\n }", "function init() {\n\tmainDigits.pu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns an array of combined MedEntries and MedOrders not every MedEntry will have a MedOrder associated with it (e.g. for each object in the resulting array, 'homeMed' will be defined but 'ehrMed' may be undefined)
function mapMedEntries(medEntries, medOrders) { var medOrderIdMap = {}; for (var i = 0; i < medOrders.length; i++) { var value = medOrders[i]; medOrderIdMap[value.id] = value; } var temp = []; for (var j = 0; j < medEntries.length; j++) { var medEntry = medEntries[j]; ...
[ "function getMediansArray(medians) {\n return Object.keys(medians).map((key) => {\n return {name: key, value: medians[key]};\n });\n}", "function getMediasForId () {\r\n let mediasForId = [];\r\n for (let media of medias) {\r\n if (media.photographerId == id) {\r\n mediasForId.push(me...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update current user online status
function updateUserOnlineStatus() { var userParam = JSON.parse(Auth.isLoggedIn()); if(userParam) { var data = { currentUser: userParam[0].id }; var config = { headers: { 'Content-Type'...
[ "function updateOnline(username, online) {\n return User.update({ username: username }, { online: online });\n}", "function updateUsersActivity() {\n SBF.updateUsersActivity(agent_online ? SB_ACTIVE_AGENT['id'] : -1, activeUser() != false ? activeUser().id : -1, function (response) {\n if (re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Preprocess the specified template, parsing embedded "properties", "scripts", "code" as well as "conditions" and "where" elements. Return a "root" template that is ready to process.
function preProcessTemplate(template) { // Generate the ID base var baseid = (new Date()).getTime(); // Establish the template "lookup" template.properties = new Object(); template.scripts = new Object(); template.code = new Object(); template.conditions = new O...
[ "function processTemplate(template, model) {\n\n // Establish the current \"view\" model\n template.view = bindView(template.root.scripts, model, template.dom);\n\n var replace = [];\n\n // Loop over the template constructs\n for (var i = 0; i < template.dom.children.length; i++) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
arrange pieces and display them
function arrange() { for(var i = 0; i < 15; ++i) { pieces[i].element.style.left = pieces[i].col*100 + "px"; pieces[i].element.style.top = pieces[i].row*100 + "px"; } }
[ "function displaynextPiece(){\n\n nextBoard.innerHTML = \"\";\n \n nextPiece.shape.forEach((element, index) =>{\n element.forEach((piece, idx)=>{\n if(piece!==0){\n const block = document.createElement('div');\n block.classList.add('block');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the given date as a String formatted as hh:MM:ss
function getTimeString(date) { var hh = ('0' + date.getHours()).slice(-2); var mm = ('0' + date.getMinutes()).slice(-2); var ss = ('0' + date.getSeconds()).slice(-2); return hh + ':' + mm + ':' + ss; }
[ "function dateToString(date) {\n return ((60 * date.getHours()) + date.getMinutes()) + \":\" + date.getSeconds();\n}", "function getTimeString(date) {\n\treturn ('0' + date.getHours()).slice(-2) + \":\" + ('0' + date.getMinutes()).slice(-2) + \":\" + ('0' + date.getSeconds()).slice(-2);\n}", "function date_to_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executes macros against the active keys. Each macro's key combo is checked and if found to be satisfied, the macro's key names are injected into active keys.
function executeMacros() { var mI, combo, kI; for(mI = 0; mI < macros.length; mI += 1) { combo = parseKeyCombo(macros[mI][0]); if(activeMacros.indexOf(macros[mI]) === -1 && isSatisfiedCombo(combo)) { activeMacros.push(macros[mI]); for(kI = 0; kI < macros[mI][1].length; kI += 1) { addActiveKey(mac...
[ "function prepareMacros(dict_macros, opts) {\n var macros = {};\n\n // expand a `{NAME}` macro which exists inside a `[...]` set:\n function expandMacroInSet(i) {\n var k, a, m;\n if (!macros[i]) {\n m = dict_macros[i];\n\n if (m.indexOf('{') >= 0) {\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
7.3 Operations on Objects 7.3.1 Get (O, P) just use o.p or o[p] 7.3.2 GetV (V, P)
function GetV(v, p) { var o = ToObject(v); return o[p]; }
[ "function GetV(v, p) { // eslint-disable-line no-unused-vars\n\t\t// 1. Assert: IsPropertyKey(P) is true.\n\t\t// 2. Let O be ? ToObject(V).\n\t\tvar o = ToObject(v);\n\t\t// 3. Return ? O.[[Get]](P, V).\n\t\treturn o[p];\n\t}", "function GetV(v, p) { // eslint-disable-line no-unused-vars\n\t// 1. Assert: IsPrope...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the key should be vertical or horizontal
function getKeyOrientation() { var keyOrientation; if (width > Configuration.SMALL_BREAKPOINT && options.keyType == "scalar") { keyOrientation = "vertical"; } else { keyOrientation = "horizontal"; } return keyOrientation; }
[ "get isHorizontal() {\n return true;\n }", "get isHorizontal() {\n return true;\n }", "function isHorizontal(dir){return dir==='left-to-right'||dir==='right-to-left';}", "determineOrientation(event) {\n var key = event.keyCode;\n var vertical = this.tablist.getAttribute('aria-orientation')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
enters current date to html inputs
function enterCurrentDateToHTML() { currentDate = Date.now(); dateIn.value = date; }
[ "function currentDate() {\n\n var today = new Date();\n\n var dd = today.getDate();\n\n var mm = today.getMonth() + 1;\n var yyyy = today.getFullYear();\n if (dd < 10) {\n dd = '0' + dd;\n }\n\n if (mm < 10) {\n mm = '0' + mm;\n }\n\n today = yyyy + '-' + mm + '-' + dd;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Predefined classes ////////////////////////////////////////////////////////////////////////////// Monad
function base$GHC$Base$Monad(return_,bind_){ this.return_ = return_, this.bind_ = bind_; }
[ "function Monad(){}", "static of(val) {\n return new Monad(val)\n }", "function Motors(numsOrObjects) {\n\t if (!(this instanceof Motors)) {\n\t return new Motors(numsOrObjects);\n\t }\n\n\t Object.defineProperty(this, \"type\", {\n\t value: Motor\n\t });\n\n\t Collection.call(this, numsOrObjects...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
viewPoint is an x,y array [x,y] returns an x,y array of the corresponding world point
GetWorldPoint(viewPoint) { let worldx = this.wo.dx + viewPoint[0]/this.zoom.now; let worldy = this.wo.dy + viewPoint[1]/this.zoom.now; return [worldx,worldy]; }
[ "GetViewPoint(worldPoint)\n {\n let viewx = (worldPoint[0]-this.wo.dx)*this.zoom.now;\n let viewy = (worldPoint[1]-this.wo.dy)*this.zoom.now;\n return [viewx,viewy];\n }", "function getViewPoint(x, y) {\n const view = document.getElementById('viewbox');\n const svg = document.getElementById('map');\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
kill appropriate menu's, if we are getting here via the hideMenu() funciton then kill all the menu's this is known from the passed value 'apocolypse'
function killMenu(apocolypse) { if(apocolypse=="all")menuKillHolder=menuDisplayHolder; var menuKillArray = menuKillHolder.split(","); //loop and kill //we start at 1 because the zero'th element should be the root for(iloop=1;iloop<menuKillArray.length;iloop++) { if(menuKillArray[iloop]!="null") { ...
[ "function hideMenu()\n{\n\t\t\n\t\t//set a timeout and then kill all the menu's\n\t\t//we will check in menuHandler() to see if some stay lit.\n\t\tmenuTimeout= setTimeout(\"killMenu('all');\",800);\n\t\t\n\t\tflagMenuSwitch=\"off\";\n\t\t\n}//end hideMenu() function", "function closeAllMenus(){\n closeMenu(\"d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
I attach click handlers to eventsummary items to show their details
function attachEventSummaryClickHandler(){ $( '.event-summary' ).off(); $( '.event-summary' ).click(function(event) { var event_uid = $( this ).attr( 'data-event_uid' ); showEventDetails( event_uid ); }); }
[ "function attachClickEventItemDetails(){\n\t// click function for item details\t\n\t$(\".termnode-item-number-moredetails\").click(function() {\n\n\t\tvar detailContainer = $(this).prev(\".termnode-item-moredetails-container\");\n\t\t\n\t\tif(detailContainer.css(\"display\") == \"none\") { \n\t\t\tdetailContainer....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`_setBase` sets the base IRI to resolve relative IRIs
_setBase(baseIRI) { if (!baseIRI) { this._base = ''; this._basePath = ''; } else { // Remove fragment if present var fragmentPos = baseIRI.indexOf('#'); if (fragmentPos >= 0) baseIRI = baseIRI.substr(0, fragmentPos); // Set base IRI and its components this._base = baseIRI; ...
[ "_setBase (baseIRI) {\n if (!baseIRI)\n baseIRI = null;\n\n // baseIRI '#' check disabled to allow -x 'data:text/shex,...#'\n // else if (baseIRI.indexOf('#') >= 0)\n // throw new Error('Invalid base IRI ' + baseIRI);\n\n // Set base IRI and its components\n if (this.base = baseIRI) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function that counts the number of syllables a word has. Each syllable is separated with a dash .
function numberSyllables(word) { word = word.split('-') console.log(word.length); }
[ "syllableCounter(input) {\n let sylCount = 0;\n const inputArr = input.split(' ');\n inputArr.forEach((word) => {\n // stop spaces from adding to count\n const trimmed = word.replace('&nbsp;', '');\n if (trimmed !== '') {\n sylCount += Syllable(trimmed);\n }\n });\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate user's token and set a new password for the user as specified
function resetUserPassword(req, res, next){ /* * NOTE: parseValidateToken Must be called before this function in the * router in order to confirm that the token is valid. */ User.findOne({ _id: req.token.userID, email: req.token.userEmail }, function(err, user){ // If ...
[ "changeUserPassword (callback) {\n\t\tconst passwordData = {\n\t\t\texistingPassword: this.data.password,\n\t\t\tnewPassword: RandomString.generate(12)\n\t\t};\n\t\tthis.data.password = passwordData.newPassword; // use this for the login request\n\t\tthis.doApiRequest(\n\t\t\t{\n\t\t\t\tmethod: 'put',\n\t\t\t\tpat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ecma International makes this code available under the terms and conditions set forth on (the "Use Terms"). Any redistribution of this code must retain the above copyright and this notice and otherwise comply with the Use Terms. / es5id: 15.10.6.29e1 description: > RegExp.prototype.exec the removed step 9.e won't affec...
function testcase() { var str = "Hello World!"; var regObj = new RegExp("World"); var result = false; result = regObj.exec(str).toString() === "World"; return result; }
[ "function testRegExp() {}", "function FUNC_NAME(rx, S, lengthS, replaceValue\n#ifdef SUBSTITUTION\n , firstDollarIndex\n#endif\n )\n{\n // 21.2.5.2.2 RegExpBuiltinExec, step 4.\n var lastIndex = ToLength(rx.lastIndex);\n\n // 21.2.5.2.2 RegExpBuiltinExec, step 5.\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function named `countOdds` that accepts an array of numbers and returns the number of odd numbers in the array. countOdds([1, 2, 3]) // 2 countOdds([4, 6, 8, 10]) // 0 countOdds([1, 2, 1, 1]) // 3
function countOdds(arr) { var numberOfOdds = 0; arr.forEach(function (element) { if (element % 2 !== 0) { numberOfOdds++; } }); return numberOfOdds; }
[ "function countOdds(arr) {\n var count = 0;\n for(var i=0;i<arr.length;i++) {\n if(arr[i] % 2 !== 0) {\n count++;\n }\n }\n return count;\n}", "function countsOdds(array){\n var total = 0;\n for (var i = 0; i < array.length; i++){\n if (array[i] % 2 != 0) {\n total ++;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
lowercase all letters of a string if force=true, capitalize first letter
function ucfirst(str,force){ str=force ? str.toLowerCase() : str; return str.replace(/(\b)([a-zA-Z])/, function(firstLetter){ return firstLetter.toUpperCase(); }); }
[ "function capitalizeLetters(str) {}", "function autoEd_first2lower(str) {\n if (str != \"\") {\n var letter = str.substr(0, 1);\n return letter.toLowerCase() + str.substr(1, str.length);\n } else {\n return \"\";\n }\n}", "function InitializeFirstLetter(value){\n return value.substring(0,1).toUpperCase()+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
After 1.5 was released, the search box was moved into an optional toolbar item, with a different ID. This function keeps us compatible with both.
function findMailSearchBox() { var tb15Box = document.getElementById("searchBox"); if (tb15Box) { return tb15Box; } var tb2Box = document.getElementById("searchInput"); if (tb2Box) { return tb2Box; } // In later versions, it's possible that a user removed the search box fro...
[ "function main_queryBarOnInput(element)\n{\n\tsearch_showAutocomplete(element.value);\n\tmain_loadBrowser();\n}", "function SearchBarClicked(id, defaultText, style) {\n var selectedElement = document.getElementById(id);\n if (selectedElement.value == defaultText) {\n selectedElement.value = \"\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get logfile by logfile name. Return log data in an array
function getLogfile(logfileName){ var logFile = []; $.ajax({ type: "GET", url: 'backend/index.php', data: {key: '4me302A3', method:'logfile', value1:logfileName}, async: false, dataType: "json" }) .done(function(data){ l...
[ "async function getLogs() {\n\tconst filenames = await fsp.readdir(path.resolve(__dirname, '../../logs'));\n\tconst logs = [];\n\tfor (const filename of filenames) {\n\t\tif (!filename.includes('.log')) continue;\n\t\tlogs.push({\n\t\t\tname: filename,\n\t\t\tdate: filename.substr(11, 10)\n\t\t});\n\t}\n\treturn lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates URL instance as a protocol. This will be convenience when we need HTTP server as Story trigger. ( Object | String : from draft. ) > URL
generate_protocol(draft){ /* * { * story: "", * page: "", * premise: { * } * } */ let id = ""; let pf = "scene"; let rg = new RegExp("^" + pf + ":"); switch(true){ case typeof draft == "string": if(draft.match(rg)){ id = draft; ...
[ "function makeUrl(protocol, host, resource, id) {\n return protocol + \"://\" + host + resource + id;\n}", "function url() {\n return from(String).format(JsonFormatTypes.URL);\n}", "function getUrl() {\n return url.format(this.urlObj);\n}", "function buildUrl (obj) {\n\t\treturn (obj.protocol || 'http') ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Activate backdrop based on sidenav state
function setBackdrop() { if (menuOpen) { backdrop.classList.remove('z-0'); backdrop.classList.remove('opacity-0'); backdrop.classList.add('opacity-50'); backdrop.classList.add('z-20'); } else { backdrop.classList.remove('z-20'); backdrop.classList.remove('opacity-50'); backdrop.classList...
[ "function sidenavOpen () {\n sidenavBar.style.transform = 'translateX(0%)'\n sidenavStatus = true\n}", "function w3_open() {\n if (mySidenav.style.display === 'block') {\n mySidenav.style.display = 'none';\n overlayBg.style.display = \"none\";\n } else {\n mySidenav.styl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Triggers the processing of the next request in dx_queue
function dxProcessRequestQueue() { if (dx_processing_queue) {return;} if (!navigator.onLine) { setItemInLocalStorage("dx_queue",JSON.stringify(dx_queue),2); showAlert(presentOfflineRequestQueuedMessage(),"info","OK",false); return; } if (dx_queue.length > 0) { let next_post = dx_queue.shift(); dxRequestIn...
[ "function next()\n {\n var params = queue[0];\n\n // Replace or add the handler\n if(params.hasOwnProperty(\"success\")) callback = params.success;\n else callback = null;\n\n params.success = success;\n\n // Manage request timeout\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a list of imports for the given array of nodes.
function packageImports(nodes) { var map = {}, imports = []; // Compute a map from name to node. nodes.forEach(function (d) { map[d.name] = d; }); // For each import, construct a link from the source to target node. nodes.forEach(function (d) { if (d.imports) d.imports....
[ "function packageImports(nodes) {\n var map = {},\n imports = [];\n\n // Compute a map from name to node.\n nodes.forEach(function (d) {\n map[d.name] = d;\n });\n\n // For each import, construct a link from the source to target node.\n nodes.forEach(function (d) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions for invoicedetails2.jsp For Listing Cart Items
function list_cart_items() { var location_id = document.getElementById("txt_location_id").value; var status = document.getElementById("txt_status").value; var cart_session_id = document.getElementById("txt_session_id").value; var vouchertype_id = document.getElementById("txt_vouchertype_id").value; var vouche...
[ "function list_cart_items() { \r\n\tvar location_id = CheckNumeric(document.getElementById(\"txt_location_id\").value); \r\n\tvar status = document.getElementById(\"txt_status\").value;\r\n\tvar cart_session_id = CheckNumeric(document.getElementById(\"txt_session_id\").value); \r\n\t// From po,git,grn To gi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add two quaternions, returning the result in a new Quaternion
add(RHO) { return new Quaternion(this._w + RHO._w, this._x + RHO._x, this._y + RHO._y, this._z + RHO._z); }
[ "function multiplyQuaternions(quatDest, a, b) {\n // a.w*b + b.w*a + (a x b)\n quatDest.x = a.w*b.x + a.x*b.w + a.y*b.z - a.z*b.y;\n quatDest.y = a.w*b.y + a.y*b.w + a.z*b.x - a.x*b.z;\n quatDest.z = a.w*b.z + a.z*b.w + a.x*b.y - a.y*b.x;\n \n // a.w*b.w - a.b\n quatDest.w = a.w*b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
launches Google Map page of Okeanos Explorer into its own window instead of as a tab in the current window
function launchOEGoogleMap(okeanos) { var Win1 = open(okeanos,"OEGoogleMapWindow","height=800,width=1000,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes"); Win1.focus(); }
[ "function launchGoogleMap(gm) {\n var Win1 = open(gm,\"GoogleMapWindow\",\"height=800,width=950,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes\");\n Win1.focus();\n }", "function openPatrolMap() {\n window.open('http://map.sosarp.net/', '_blank');\n}", "police_maps_link() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
obtener profesores correspodientes al inspector de curso, obtenemos los cursos asignados al inspector de curso, posteriormente obtenemos los profesores y materias que se dictan en dicho curso
static async getProfesoresForIc(idIc, idanio_lectivo) { //cursos para inspector de curso //let cursos = await db.query('SELECT idcurso FROM curso WHERE user_iduser = ? AND cur_estado = 1', [idIc]); let cursos = await Curso.getCursosForIc(idIc, idanio_lectivo); //Consulta para obtener la...
[ "function asociarSedeProfesor() {\n let codigoCursoActii = guardarSedeAsociar();\n\n let cursoActii = buscarCursoActiiPorCod(codigoCursoActii);\n\n let profesoresSeleccionados = guardarProfesoresAsociar();\n\n console.log(profesoresSeleccionados);\n\n\n let listaCursoActii = [];\n\n let sCodigo = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add application to auto launch program
function start_auto_launch() { var quarkclientAutoLauncher = new AutoLaunch({ name: 'QuarkClient', // path: '/Applications/QuarkClient.app', // path: '"C:\\Users\\C9G\\AppData\\Roaming\\uTorrent Web\\utweb.exe" /MINIMIZED', path: basepath + '\\quarkclient.exe', }); quarkclientAutoLauncher.enab...
[ "function addtoStart() {\n\n const exeName = path.basename(process.execPath);\n app.setLoginItemSettings({\n openAtLogin: true,\n path: process.execPath,\n args: [\n '--processStart', \"${exeName}\",\n '--process-start-args', \"--hidden\"\n ]\n });\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validates an incoming bulk transfer prepare request and makes a callback to the originator with the result
async prepareBulkTransfer(bulkPrepareRequest, sourceFspId) { try { // retrieve bulk quote data const bulkQuote = await this._cache.get(`bulkQuotes_${bulkPrepareRequest.bulkQuoteId}`); if (!bulkQuote) { // Check whether to allow transfers without a previous qu...
[ "setupSendCallback() {\n // the message was sent successfully, execute the callback\n const onDrain = () => {\n if (this.sentCallbackFn.length > 0) {\n const seqFn = this.sentCallbackFn.splice(0, 1)[0];\n if (\"function\" === typeof seqFn) {\n debug(\"executing send callback\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function formats the Predicate input. Comments are inline
function formatPredicate() { var str = gAppState.checkValue("predicateID", "predicateID2"); if (regexp.test(str) && !isBlankNode(str)) { return '<' + str + '>'; // Case: input is a uri. Solution: quote it } else if (str.charAt(0) == "#") { return '<' + str + '>'; // Case: input is an unquoted relative uri...
[ "function EBX_PredicateEditor() {\n}", "_encodePredicate(predicate) {\n return predicate.value === rdf.type ? 'a' : this._encodeIriOrBlank(predicate);\n }", "_encodePredicate(predicate) {\n return predicate.value === rdf.type ? 'a' : this._encodeIriOrBlank(predicate);\n }", "_encodePredicate(predi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds the implied classes (Object, IO, Integer, etc.) to our program node's class list
function addBuiltinObjects(programNode) { // Object class var objectClass = new CoolToJS.ClassNode('Object'); var abortMethodNode = new CoolToJS.MethodNode(); abortMethodNode.methodName = 'abort'; abortMethodNode.returnTypeName = 'Object'; abortMet...
[ "static register(cls) {\n this.NodeTypes.push(cls);\n }", "function add_classes(line, obj) {\n\t\tvar temp;\n\t\tvar classes = [];\n\t\t\n\t\tif ((temp = obj.object)) {\n\t\t if ((temp = temp.entstat)) {\n\t\t\tif (temp.vlan_tag_i_ds && Array.isArray(temp.vlan_tag_i_ds))\n\t\t\t classes = temp.vlan_tag_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide the options list
hideOptions () { this.optionsWrapper.hide(); this.optionsWrapper.style.left = ""; }
[ "function hideOptionsList() {\n $options.removeClass('show');\n }", "function hideOptionList() {\n optionList.hide();\n select.removeClass('option-list-open');\n }", "function hideOptions() {\n $('.meeting-options, .local-user-name, .remote-user-name, .meeting-info, .kick').hide();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a file input to the upload form.
function addFile() { var name = "file-" + maxID++; var input = $('<input type="file">') .attr('name', name) .attr('id', name); var close = $('<a>') .addClass('close') .attr('href', 'javascript: removeFile("' + name + '")') .html('&times;'); var status = $('<span>') .addClass('file-s...
[ "function uploadFile() {\r\n $(this).fileupload('add', {\r\n fileInput: $(this)\r\n });\r\n }", "function addFileInput($me) {\n var $files = $(\"input[type='file']\", \"#files_upload\");\n if ($files.length == 10) { return; }\n if(window.FormData !== undefined)\n {\n \t$...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds item to list after return key is pressed
function addListAfterKeypress(event) { if (event.keyCode === 13) { createListElement(); } }
[ "function addListAfterKeypress(event) {\r\n\tif(inputLength() > 0 && event.which === 13) {\r\n\t\tcreateListElement();\r\n\t}\r\n}", "function addListAfterKeypress(event) {\n\tif (inputLength() > 0 && event.keyCode === 13) {\n\t\tcreateListElement();\n\t}\n}", "function addListAfterKeypress(event) {\r\n if(i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called last in the success callback of the saveEntity() function, giving room for functionality that should be executed immediately after save
onAfterSaveEntity(data_obj) { //TODO: Override this as needed; }
[ "function onBeginSave() {\n console.log(\"onBeginSave\");\n postJsonData();\n}", "function doSave() {\n pendingSave = null\n if (dirty && !pendingPost) doPostContent()\n }", "function onSaveSuccess(data, response, xhr)\n\t{\n\t\t// update id's and scope in case they change\n\t\t// this ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
filtering function for the search by keywords feild, can be modifed for the "words get big for being popular shit."
function filterGallery(keywords) { var filteredGallery; //CR : if(keyWords.length === 0 ) return buildGallery(gImgs) if (keywords.length === 0) { buildGallery(gImgs); return; } var keywordsArr = keywords.split(" "); keywordsArr = keywordsArr.map(function (keyword) { retu...
[ "function keywordFilter(keyword) {\n keywords = [keyword]\n var filtered = data.filter(function(pub) {\n return pub.keywords.some(function(tag) {\n return keywords.includes(tag);\n });\n });\n data2 = filtered;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getters are great getters are a function that doesn't take an argument and which should return something. In this case, we will use this to do the sorting of all the letter tuples in our memState and then return the result.
get results() { // Remember the comparator function? This is the same one, we're going to use it in the same way. let comparatorFunc = (arr1, arr2) => { if (arr1[1] === arr2[1]) { if (arr1[0] < arr2[0]) return -1; return 1; } return arr2[1] - arr1[1]; }; // Let's perform the same ope...
[ "get sort() {\n return this.states.sort;\n }", "listOfPeopleInAlphabeticalOrderByName() {\n //this one is harder than i thought, haha.\n }", "function getAlphabetical() {\n try {\n test.integrationStore.getList(self.list, {}, { name: 1 }, function (list, error) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert a ratio to cents
function ratio_to_cents(input) { return decimal_to_cents(ratio_to_decimal(input)); }
[ "function ratio_to_cents(input) {\n return decimal_to_cents(ratio_to_decimal(input))\n}", "function toCents(priceEuro) {\n return Math.round(priceEuro * 100);\n}", "function covertCents(amount){\n return parseInt(amount*100);\n }", "function makesCents(amount) {\n return Math.round(parseInt(amount ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility for coercing a given item into an array.
function arrayify(item) { return [].concat(item); }
[ "function arrayFromValue(item) {\n return \n [item];\n}", "function makeIntoArray(item) {\n if ((typeof item == \"object\") && (item.constructor == Array)) { \n\treturn item;\n } else {\n\treturn [item];\n }\n}", "function toArray(item) {\n\n if (typeof item === 'object') {\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stop function stop and clear watch
function stop() { clearInterval(watch); }
[ "stopWatch() {\n\t\tthis.watch.toggle(false);\n\t}", "stop() {\n // Przypisz flage running aby zatrzymac stoper\n this.running = false\n // Wyczysc interwal odwolujac sie do parametru watch\n clearInterval( this.watch )\n }", "function stopWatching() {\n\t\tif(watchID) geo.clearWa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updating the number of peers and getting stream from the peer on connecting to other peers Should be updated such that the current peer doesn't have his/her user media appended as a video element in the current page
function addPeer(){ var peerMediaElements = document.getElementById("peer-media-banner"); // peerNumUpdated = parseInt(peerNum)+1; var peerMediaDiv = document.createElement("div"); var peerMediaVideo = document.createElement("video"); peerMediaVideo.setAttribute("class", "z-depth-5"); var peerMediaSource = docume...
[ "function addPeer(){\n\tvar peerMediaElements = document.getElementById(\"peer-media-banner\");\n\t// peerNumUpdated = parseInt(peerNum)+1;\n\tvar peerMediaDiv = document.createElement(\"div\");\n\tvar peerMediaVideo = document.createElement(\"video\");\n\tpeerMediaVideo.setAttribute(\"class\", \"z-depth-5\");\n\tv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
backup file fail function
function failFileBackup(error) { var backupfailed = $.t('backupfailed'); console.error("PhoneGap Plugin: FileSystem: Message: Backup - file does not exists, isn't writeable or isn't readable. Error code: " + error.code); buttonStateBackRest("enable"); toast(backupfailed, 'short'); }
[ "function gameBackupPerform(){\r\n\t//Check if the backup exists\r\n\tfs.stat(gameLocation + gameBackupName, function(err, stat){\r\n\t\tif(err != null){\r\n\t\t\t//Perform the backup if the file does not exist\r\n\t\t\tfs.createReadStream(gameLocation + gameOriginalName).pipe(\r\n\t\t\t\tfs.createWriteStream(gameL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function returns a subclass of specified Set class and overrides the add() method of that class to apply the specified filter.
function filteredSetSubclass(superclass, filter) { var constructor = function() { // The subclass constructor superclass.apply(this, arguments); // Chains to the superclass }; var proto = constructor.prototype = inherit(superclass.prototype); proto.constructor = constructor; proto....
[ "function filterSetSubclass(superclass, filter) {\r\n\tvar constructor = function() {\r\n\t\tsuperclass.apply(this, arguments);\r\n\t};\r\n\tvar proto = constructor.prototype = inherit(superclass.prototype);\r\n\tproto.constructor = constructor;\r\n\tproto.add = function() {\r\n\t\t// Apply the filter to all argume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads xlsx file and gets values from each cell
read(file) { var workbook = XLSX.readFile(file); var sheet_name_list = workbook.SheetNames; var data = {}; var letters = []; var moduleShortNameArray = []; sheet_name_list.forEach(function(y) { var worksheet = workbook.Sheets[y]; var headers = []; var c...
[ "getData(filepath, { sheetId = 0, startRow = 1 }) {\r\n let res = []\r\n let rowIndex = startRow + 1\r\n try {\r\n let workbook = xlsxReader.readFile(filepath)\r\n let worksheet = workbook.Sheets[workbook.SheetNames[sheetId]]\r\n // let ref = worksheet[\"!ref\"].split(':')\r\n // let le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Append a check box for each variable in data
function addVariableCheckBoxes(data) { var variableList = $(".variable-selection"); for(var variable in data) { if(isFinite(data[variable][0].value) && $.inArray(variable, calculatedValues) == -1 && $.inArray(variable, interventionVariables) == -1) addCheckBox(variableList, variable); } }
[ "function displayCheckboxes() {\n $('#checkbox').text('');\n\n for (let i = 0; i < ingredientsArray.length; i++) {\n let pContainer = $(\"<p class=label>\");\n let labelContainer = $(\"<label class=option>\");\n let inputContainer = $(\"<input type=checkbox>\");\n let spanContainer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when we know that cell r,c has value v, this affects the possible values of other cells in the same row, column, or box.
function Controller_PropagateCellChoice (r, c, v) { // no other cell can have the same value. // this function, applied to a cell, removes v as a possible value // of that cell (if the cell is not the one at r,c). // We're making good use of Javascript's ability to define functions // at run-time, and the us...
[ "function noOtherCellCanHaveValue(cell) {\n if (! cell.atPos(r,c)) {\n cell.excludeValue(v);\n }\n }", "function cellsWithPossibleValue (cells, v) {\n return cells.removeIfNot(function (x) {return x.hasPossibleValue(v);});\n}", "validValue() {\n\n /*\n Test for checking if the value ex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Matches this object against the operand tree, possibly updating the environment.
function lisp_match(obj, otree, env) { return lisp_class_of(obj).lisp_match(obj, otree, env); }
[ "objectMatches(object) {\n\t\treturn this.rootOperation.resolve([object]).length > 0;\n\t}", "visitEqualityExpression(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function branchTestMatch(expr, value)\n{\n if (type.isSameType(Array, true, expr))\n {\n return algorithm.every(expr, function(su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getNewLastName() This function returns the user's new last name. To do so, concatenate the first 2 letters of their mom's maiden name and the first 3 letters of the city where they were born.
function getNewLastName() { return momMaidenName.substring(0,1) + cityBorn.substring(0,2).toLowerCase(); }
[ "function getNewLastName(momMaidenName, cityBorn) {\n return momMaidenName.substr(0, 2) + cityBorn.substr(0, 3);\n}", "function getNewLastName(momMaidenName, cityBorn) {\r\n let newLastName = momMaidenName.substring(0,2) + cityBorn.substring(0,3).toLowerCase()\r\n return newLastName\r\n}", "function getNewLa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
called by the silence and unsilence buttons.
function silenceAlarm(bool){ if ( bool ) { silence=true; $('#controlSilence').html('true'); alarmSound.stop(); alarmSound.isPlaying = false; //console.log(alarmSound.isPlaying); } else { silence=false; $('#controlSilence').html('false'); //console.log(alarmSound.isPlaying); if ( !alarmSou...
[ "function silenceEvents() {\n _silenceEvents = true;\n}", "function soundState(){\r\n\tsound_array.forEach(function(element){\r\n\t\tif(element.volume()!=0){ /*!element.mute()*/\r\n\t\t\tPizzicato.volume = 0; //element.mute(true);\r\n\t\t\telement.volume(0); //$('#muter').css(\"text-decoration\",\"line-through...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Someone you follow creates a new location
function notifyFollowerNewLocation(message, next) { let seneca = this; Joi.validate(message.data, validation.notifyNewLocation, (err, data) => { if (err) { log.error(err, 'Validation failed of new locations notify service'); return next(err); } log.info('compo...
[ "function addLocation() {\n var newLocation = {\n \"name\":vm.locationName,\n \"userId\":user._id,\n \"lat\":vm.lat,\n \"lon\":vm.lon,\n \"webcamURL\":vm.webcamURL,\n \"status\":\"Open\",\n \"comments...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
define sankey diagram class
function sankey(options) { //remove legend if (options.legend) { options.legend.enabled = false; } else { options.legend = { enabled: false }; } //declare needed variables let diagram = eve.initVis(options), ...
[ "function addClassDiagram() {\r\n\r\n\tclearModes();\r\n\tgraph.addCell( new uml.Class( {\r\n\t\tposition: { x: 100+createOffset , y: 100+createOffset },\r\n\t\tsize: { width: 180 , height: 50},\r\n\t\tname: propertyBox.get( 'klassenName' ),\r\n\t\tattributes: propertyBox.get( 'attribute' ),\r\n\t\tmethods: propert...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a message from the database DELETE FROM messages WHERE msgid = ?;
async delete_message(msgid) { }
[ "function deleteMessage(){\r\n deleteMessageDB(id);\r\n}", "function delete_message(ID){\n\t db.transaction(function(tx) {\n\t \ttx.executeSql(\n\t \t\t\"DELETE FROM messages WHERE ID = ?)\", [ID], \n\t \t\tsuccess_message_delete, \n\t \t\terror_message_delete\n\t \t);\n\t });\t\n}", "function deleteMessage(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Site hierarchy. Comma separated path. Exceptions: / will be set as "homepage". Any error page is set to "error".
function getHierarchy() { if (httpStatus == 404 || httpStatus == 500) { return "error"; } else if (directories[0] === "") { return "homepage"; } else { return directories.join(','); } }
[ "function set_hier1() {\r\n h1 = new String(document.location.host + document.location.pathname);\r\n if (h1.charAt(h1.length - 1) == \"/\") {\r\n var temp = new String();\r\n for (var i = 0; i < h1.length - 1; i++) {\r\n temp += h1.charAt(i);\r\n }\r\n h1 = temp;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets new size of SVG after divs are resized
function updateSvgSize() { let g = document.getElementById('graph'); width = g.clientWidth; height = g.clientHeight; }
[ "function svgResized(w, h) {\n // not used now, but may be required later...\n }", "updateSize() {\n this.size = this.preferredSize();\n\n this[_svgRect].attr(\"width\", this.size[0]);\n this[_svgRect].attr(\"height\", this.size[1]);\n\n this[_svgName].attr(\"x\", this.size[0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filters & Effects Functions
function filter(e){ if(e.target.classList.contains('filter-btn')){ switch(e.target.id){ // Blur Filter case 'blur-add': Caman('#canvas', image, function(){ this.stackBlur(2).render(); }); break; ca...
[ "function SVGEffects(elem){var i;var len=elem.data.ef?elem.data.ef.length:0;var filId=createElementID();var fil=filtersFactory.createFilter(filId,true);var count=0;this.filters=[];var filterManager;for(i=0;i<len;i+=1){filterManager=null;if(elem.data.ef[i].ty===20){count+=1;filterManager=new SVGTintFilter(fil,elem.e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }