query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
custom header nad footer
function _getHeaderFooter(group, options){ var header = webix.html.create("div", { "class":"webix_view webix_print_"+group.toLowerCase(), "style":"height:0px;visibility:hidden;" }, options["doc"+group]); if(group ==="Header") webix.html.insertBefore(header, document.body.firstChild); else documen...
[ "function injectHeaderFooter () {\n\theaderStr = createHeader();\n\taddStrToBody(headerStr);\n\tfooterStr = createFooter();\n\taddStrToBody(footerStr);\n\tpageName = getActivePage();\n\tsetActiveComponents(pageName);\n}", "function setHeaderFooter() {\r\n var $header = $('#main-header');\r\n var $footer = $('#f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wrap a JS ArrayBuffer into a ByteArray. Truncates the array length to the closest multiple of 8 bytes.
function wrapByteArr(buffer) { var diff = buffer.byteLength % 8; if(diff != 0) { var buffer = buffer.slice(0, buffer.byteLength-diff); } return new ByteArray(buffer); }
[ "function prepare$ArrayBuffer (o) {\n let naive, naiveJSONLen;\n let ab8, ab8JSONLen;\n let ab16, ab16JSONLen;\n \n if (exports.tune === \"speed\" || exports.tune === \"size\" || (o.byteLength < exports.typedArrayPackThreshold)) {\n naive = { ctr: ctors.indexOf(o.constructor), arg: Array.prototype.slice.cal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
BatchWriter used to write mutations into accumulo. options are defaulted, the only thing that is necessary to pass in is an instance of Accumulo (see below) for connection, etc.
function BatchWriter(options, callback) { options = merge({ maxMemory: 10*1024, latency: 30*1000, timeout: 5*1000, threads: 10, }, options || {}); this.connection = options.connection; writerOptions = new accumuloTypes.WriterOptions(); writerOptions.maxMemory = options.maxMemory; writerOptio...
[ "addBatchTask(options) {\r\n let index = 0;\r\n // Unacceptable values: NaN, <=0, type not number/function\r\n if (!options.batchSize || typeof options.batchSize !== \"function\"\r\n && (typeof options.batchSize !== \"number\" || options.batchSize <= 0)) {\r\n throw new Er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an instance of `PayloadTransport`
function PayloadTransport(endpoint, encodedQueryParams) { this.endpoint = endpoint; this.encodedQueryParams = encodedQueryParams; this.messageHandlers = new Set(); this.init(); }
[ "function PayloadTransport(endpoint, parameters) {\n this.endpoint = endpoint;\n this.parameters = parameters;\n this.messageHandlers = new Set();\n this.init();\n }", "function Transport() {}", "createTransport(socket) {\n return new sock.Transport(socket);\n }", "construct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the background of the detected element on detection of an error
function setbackonError(theElement, thecolour) { //switch to detect the source element //and the colour to set the background //of the selected element switch (theElement) { case "email": $("#email").css("background", thecolour); break; case "phone": $("#mo...
[ "function MarkElementError(element) {\n element.style.backgroundColor = mxConstantsEx.InPutErrorColor;\n}", "function handleBgError() {\n qs(\"body\").style.backgroundColor = \"rgb(71, 50, 127)\";\n }", "function error(color){\n document.querySelector('.box').style.backgroundColor = color\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Depend on all deps collected by this watcher.
depend () { let i = this.deps.length while (i--) { this.deps[i].depend() } }
[ "depend () {\n let i = this.deps.length;\n while (i--) {\n this.deps[i].depend();\n }\n }", "depend() {\n let i = this.deps.length;\n while (i--) {\n this.deps[i].depend();\n }\n }", "depend() {\n let i = this.deps.length;\n\n while...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serialize the table row
serializeRow(writer, row) { let owner = this.row; this.row = row; writer.writeStartElement(undefined, 'tr', this.wNamespace); this.serializeRowFormat(writer, row); this.serializeCells(writer, row.cells); writer.writeEndElement(); //end od table row 'tr' this.row =...
[ "serializeTableRows(writer, rows) {\n if (rows.length > 0) {\n for (let i = 0; i < rows.length; i++) {\n let row = rows[i];\n if (row.cells.length > 0) {\n this.serializeRow(writer, row);\n }\n }\n }\n }", "snTa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called to when a new block to upload may be available
function trigger_upload() { if (uploads_active >= AWS_REQUESTS) return; // still too busy uploading if (dataqueue.length === 0) { if (doneCalled && uploads_active === 0) finishUpload(); return; // nothing to do } if (!doneC...
[ "function addBlock() {\n newBlockRequested = true;\n }", "blockNotify() {\n\n const _ = this;\n\n _._getBlockTemplate((err, blockTemplate) => {\n if (err) {\n console.error(`Failed to get block template for new block: ${JSON.stringify(err)}`);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function sets up the horizontal scroll. This applies data attributes to the section for later use.
function setUpHorizontalScroll($el) { var sectionClass = $el.attr('class'); // Set content wrapper variables & data attributes. var $contentWrapper = $el.find('.' + sectionClass + '__content-wrapper'); var contentWrapperDom = $contentWrapper.get(0); $el.data('contentWrapper', $conte...
[ "function setUpHorizontalScroll($el) {\n\n var sectionClass = $el.attr('class');\n\n // Set content wrapper variables & data attributes.\n var $contentWrapper = $el.find('.' + sectionClass + '__content-wrapper');\n var contentWrapperDom = $contentWrapper.get(0);\n $el.data('conten...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
menuHandler() function, here is the main function, called from the mouseover event. we check for which elements are lit and work our two array's appropriately first kill the killMenu function call. it receives three parameters parentLIO, currentMenu, and childMenu.
function menuHandler(parentLIO,currentMenu,childMenu) { var matchFlag; matchFlag=false; //kill menu killing function, we will check list and kill again soon. if(flagMenuSwitch=="off") { clearTimeout(menuTimeout); } //if flagMenuSwitch is "new" then assign base level stuff if(flagMenuSwitch...
[ "function killMenu(apocolypse)\n{\n\tif(apocolypse==\"all\")menuKillHolder=menuDisplayHolder;\n\t\n\t\n\tvar menuKillArray = menuKillHolder.split(\",\");\n\n\t//loop and kill\n\t//we start at 1 because the zero'th element should be the root\n\tfor(iloop=1;iloop<menuKillArray.length;iloop++)\n\t{\n\t\t\t\tif(menuKil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Create a security assessment on your resource. An assessment metadata that describes this assessment must be predefined with the same name before inserting the assessment result
async function createSecurityRecommendationTaskOnAResource() { const subscriptionId = process.env["SECURITY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; const resourceId = "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleS...
[ "async function createSecurityAssessmentMetadataForSubscription() {\n const subscriptionId =\n process.env[\"SECURITY_SUBSCRIPTION_ID\"] || \"0980887d-03d6-408c-9566-532f3456804e\";\n const assessmentMetadataName = \"ca039e75-a276-4175-aebc-bcd41e4b14b7\";\n const assessmentMetadata = {\n description:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configured lambda insights on the function if specified. This is acheived by adding an imported layer which is added to the list of lambda layers on synthesis.
configureLambdaInsights(props) { if (props.insightsVersion === undefined) { return; } if (props.runtime !== runtime_1.Runtime.FROM_IMAGE) { // Layers cannot be added to Lambda container images. The image should have the insights agent installed. // See https:/...
[ "addLayers(...layers) {\n for (const layer of layers) {\n if (this.layers.length === 5) {\n throw new Error('Unable to add layer: this lambda function already uses 5 layers.');\n }\n if (layer.compatibleRuntimes && !layer.compatibleRuntimes.find(runtime => runt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads a PIN enrollment availability.
canEnroll() { return super._canEnroll(core.Credential.PIN); }
[ "async checkAvailableDataWait() {\n const value = (await this.readWait(this.commands.addresses.CCS811_STATUS, 1))[0];\n return Boolean(value & (1 << 3));\n }", "function IsPINRequired() {\n // TODO: Deal with the situation: result.pin_status is blank\n //Vendor code must retrieve setting an...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: render Description: renders a list of the existing categories, containing a anchor with a url path to the particular category. When clicking on any one of them we also want our menu to close, so that the user can see the result.
render(){ const { categories } = this.props return ( <div className="col-12-medium"> <div className="row"> <div className="col-12-medium"> <Link className="mobile-menu-link" to="/" onClick={this.props.toggleMenu}>all</Link> </div> </div> { categories.map((category)=> { co...
[ "render(){\n\t\tconst { categories } = this.props\n\t\treturn(\n\t\t\t<ul className=\"category-list\">\n\t\t\t\t<li><Link to=\"/\" className=\"categorylink\">all</Link></li>\n\t\t\t\t{ categories.map((category) => {\n\t\t\t\t\treturn <CategoryLine key={category.name} category={category}/>\n\t\t\t\t})}\n\n\t\t\t</ul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shows mouse coordinates and change "perc"
function showCoords(event) { var x = event.clientX; var y = event.clientY; var sheight=screen.height; var swidth=screen.width; perc=x/swidth*100; }
[ "function mouseMoved(){\n \n if (mouseY > height) return;\n if (mouseY < 0) return;\n \n let p = map(mouseY, 0, height, \n 0, 100-who.sum());\n \n percentages[inputs.length] = p;\n \n}", "function add_mouse_pos(_x,_y,factor) {\n $('#mouse_pos').html(\"Mouse pos (loc):\" + _x + \" , \" + _...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the Gadget.Interop dll to the registry so it can be used by COM and created in javascript as an ActiveX object
function RegisterGadgetInterop() { try { // Full path to the Gadget.Interop.dll assembly var fullPath = System.Gadget.path + assemblyStore; var asmPath = fullPath + assemblyName; // Register the interop assembly under the Current U...
[ "function UnregisterGadgetInterop()\r\n {\r\n try\r\n {\r\n var fullPath = System.Gadget.path + assemblyStore;\r\n var asmPath = fullPath + assemblyName;\r\n \r\n RegAsmUninstall(\"HKLM\", progID, \"Gadget.Interop.GadgetAdapter\", guid,\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function name: User Service Delete Profile Picture Author(s): Flamiano, Glenn Date Modified: 2018/03/08 Update Date: 2018/03/08 Description: Deletes the user profile picture url in the database and profile picture file in the server Parameter(s): none Return: none
function deleteProfilePic(req, res){ var deferred = Q.defer(); //update db db.users.findOne({ email: req.body.email }, function (err, user) { if (err) deferred.reject(err); if (user) { db.users.update({email: req.body.email}, {$set: { profilePicUrl: ''}}, function(err){ ...
[ "function deleteProfilePic(req, res) {\n userService.deleteProfilePic(req, res)\n .then(function () {\n res.sendStatus(200);\n })\n .catch(function (err) {\n res.status(400).send(err);\n });\n}", "function deleteUserProfileImage(req, res) {\n const userID = r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update read_at for message.
static async markRead(id) { const result = await db.query( `UPDATE messages SET read_at = current_timestamp WHERE id = $1 RETURNING id, read_at`, [id] ); const message = result.rows[0]; if (!message) throw new NotFoundError(`No such message: ${id}`); ...
[ "markRead() {\n const lastMessage = this.lastMessage;\n if (!lastMessage)\n return this;\n const updMessage = lastMessage.set('isRead',true);\n return this.addMessage(updMessage);\n }", "markMessagesAsRead(messages) {\n const currentDate = new Date();\n messages.forEach((msg) => {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a boolean indicating that all local calendars are readonly
get all_local_calendars_readonly() { // We might want to speed this part up by keeping track of this in the // calendar manager. let calendars = cal.getCalendarManager().getCalendars(); let count = calendars.length; for (let calendar of calendars) { if (!cal.acl.isCalendarWritable(calendar)) {...
[ "get all_readonly() {\n let calMgr = cal.getCalendarManager();\n return calMgr.readOnlyCalendarCount == calMgr.calendarCount;\n }", "isCalendarWritable(aCalendar) {\n return (\n !aCalendar.getProperty(\"disabled\") &&\n !aCalendar.readOnly &&\n (!Services.io.offline ||\n aCalendar....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build annyang command for selecting/filtering certain countries
function buildSelectFilterCountryCmd() { var columnIndex = 0; var data; // define options for data pull var options = { maxRows: 0, ignoreAliases: false, ignoreSelection: true }; // get underlying Dat...
[ "function getCountries() {\n var countryChoices = [\n {\n \"abbr\":\"\",\n \"name\":\"(not applicable)\"\n },\n {\n \"abbr\":\"AF\",\n \"name\":\"Afghanistan\"\n },\n {\n \"abbr\":\"AX\",\n \"name\":\"Akrotiri\"\n },\n {\n \"abbr\":\"AL\",\n \"name\":\"A...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show offline by survey name
function showOfflineScreenBySurveyName(pSurveyName){ checkOfflineBySurveyName(pSurveyName); }
[ "function showSurvey(request, response) {\n showSingleSurvey(request, request.url.split('/')[2], response);\n }", "function showSurveyIndex(request, response) {\n client.query('SELECT id, title FROM surveys', function (error, rows) {\n if (error)\n throw error;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hasNext() Returns true if item has another item after it
hasNext() { return this.index <= this.items.length; }
[ "hasNext() {\n return this.index < this.items.length;\n }", "hasNext() {\n if (this.first) return true;\n return (!this.curr || this.curr.next == null) ? false : true;\n }", "hasNext()\n\t{\n\t\treturn this.node.next != null;\n\t}", "hasNext() {\n return this.index < this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the subtitle record for the current time. This requires us to keep no state about the video progress, which is good because that would not be easy to do. We simply filter to a small number of records that could fit the time and concatenate them.
function getSubtitlesForTime(records, time) { // Does a binary search to find the index of where this time stamp starts having records // that end before this time. There may be many records here that aren't supposed to // start yet, but certainly nothing at this index should be done yet. function binarySearch(t) {...
[ "function getSubtitleRecords(srtContents) {\n\tlet subtitleRecords = [];\n\tlet srtLines = srtContents.split(/\\r?\\n/);\n\tlet fragmentIndex = 1;\n\tlet lineNumber = 0;\n\twhile(lineNumber < srtLines.length) {\n\t\t// Parse fragment by fragment\n\t\t// We don't need the index, but let's check it as a form of error...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all CalendarEvents that are concurrent to a given CalendarEvent 'e' Concurrent is defined as any CalendarEvent that overlaps in time with 'e' OR... any event that overlaps in time with an event that overlaps in time with 'e' NOTE: This method returns the events (including the given event) in the order they are ...
function getConcurrentEvents(e, allEvents) { var concurrent = [], notConcurrent = [], adjacentConcurrent, j; //get the concurrent events to e allEvents.forEach(function(thisE) { if (eventsOverlap(e, thisE)) { concurrent.push(thisE); } else { notConcurrent.push(thisE); } }); //now chec...
[ "function getOverlappingEvents(crn) {\n\n var overlappingEvents = [];\n if (crn === undefined || parseInt(crn) == NaN) {\n var allEvents = $('#calendar').fullCalendar('clientEvents');\n } else {\n var allEvents = $('#calendar').fullCalendar('clientEvents', function (event) {\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================================================================ FUNCTION: isJCB() INPUT: cc a string representing a credit card number RETURNS: true, if the credit card number is a valid JCB card number. false, otherwise ================================================================
function isJCB(cc) { first4digs = cc.substring(0,4); if ((cc.length == 16) && ((first4digs == "3088") || (first4digs == "3096") || (first4digs == "3112") || (first4digs == "3158") || (first4digs == "3337") || (first4digs == "3528"))) return isCreditCard(cc); ...
[ "function cardnumber(ccnum)\n{\n var cardno = /^(?:(?:2131|1800|35\\d{3})\\d{11})$/;\n if(ccnum.value.match(cardno))\n {\n return true;\n }\n else\n {\n alert(\"Not a valid JCB card number!\");\n return false;\n }\n}", "function isCreditCard(st) {\r\n // Enco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an array and chunk size, divide the array into many subarrays where each subarray is of length size Examples chunk([1, 2, 3, 4], 2) > [[ 1, 2], [3, 4]] chunk([1, 2, 3, 4, 5], 2) > [[ 1, 2], [3, 4], [5]] chunk([1, 2, 3, 4, 5, 6, 7, 8], 3) > [[ 1, 2, 3], [4, 5, 6], [7, 8]] chunk([1, 2, 3, 4, 5], 4) > [[ 1, 2, 3, 4]...
function chunk(array, size) { const chunked_arr = []; let copied = [...array]; // ES6 destructuring, splice mijenja original const numOfChild = Math.ceil(copied.length / size); // vraca 4, ako je 3.5 on zaokruzi na 4 for (let i = 0; i < numOfChild; i++) { debugger; chunked_arr.push(copied.splice(0, size...
[ "function chunk(array, size) {\n let answer = []\n\n // I want to loop by how many subarrays I want to create\n for (let i = 0; i < array.length / size; i++) {\n // where I want to start slicing from in the array, which starts at 0 and then every multiple of \"size\"\n let sliceStart = i * size\n\n // S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
deletes files found in the subdirectories of ./backups
function removeUnzippedBackupFiles() { let backupSubDirectories = getDirectories('./backups/'); for (let i = 0; i < backupSubDirectories.length; i++) { let subdir = './backups/' + backupSubDirectories[i]; let files = fs.readdirSync(subdir); for (let j = 0; j < files.length; j++) { removeFileIfExists(subdi...
[ "async cleanBackups() {\n const limit = this.manager.config.manager.backupRetention;\n const backups = await this.getBackups();\n if (backups.length > limit) {\n const sorted = backups.sort((a, b) => a.age > b.age ? 1 : -1);\n for (let i = 0; i < (backups.length - limit); ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function that returns the date 33 days from now.
function futureDate(){ var d = new Date(); d.setDate(d.getDate() + 33); console.log(d); }
[ "function question10() {\n var now = new Date()\n \n var today = now.getDate()\n today += 33\n now.setDate(today)\n today = now.getDate()\n return today\n}", "function date() {\n const futureDate = new Date();\n futureDate.setDate(futureDate.getDate() + 33);\n return futureDate;\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
logic for homeReminder setting
'click .homeReminder'(){ if (homeReminderBool == null){ homeReminderBool = true; } else { homeReminderBool = !homeReminderBool; } }
[ "onAddReminder() {\n this.populateRemindersData();\n }", "onOk(reminders) {\n customItem.reminders = reminders;\n }", "updateReminder() {\n this._TaskNotifications.updateTaskAndResolveNotification(this.task, 'reminder').then(\n (updatedTask) => this.displayingreminderdatetime...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Emits the event on the given EventEmitter
function emit(self, eventName) { self.emit(eventName); }
[ "_emit() {\n this._room.event(Array.prototype.slice.call(arguments));\n }", "emit( ...params ) {\n if ( !this.canEmit(params[0]) )\n throw new Error('You cannot emit unregistered event')\n // emit the event, setting `eventName` and `emitterName`\n // as the last two params passed\n else...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Math.random is of low quality on older browsers but Xorshift128+ on newer from Standard Normal variate using BoxMuller transform
function randnBoxMuller() { let u = 0; let v = 0; while (u === 0) u = Math.random(); // Converting [0,1) to (0,1) while (v === 0) v = Math.random(); return Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v); }
[ "function BoxMullerTrans(){\n var a = 0,\n b = 0;\n while(a===0) a = Math.random(); //Excludes zero\n while(b===0) b = Math.random();\n return Math.sqrt(-2.*Math.log(a)) * Math.cos(2*Math.PI*b)\n }", "function normalRandom() {\n var val, u, v, s, mul;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by AgtypeParserArrayValue.
exitArrayValue(ctx) { }
[ "exitArrayval(ctx) {\n\t}", "endParsing() {\n\n\t\t// Skip ending whitespace\n\t\tthis.skipWhitespace();\n\n\t\t// Check for container to select it as the value\n\t\tif (this.container) {\n\t\t\tthis.value = this.container;\n\t\t}\n\n\t\t// Validate parser state\n\t\tif (this.chunk[this.index] || this.stack.lengt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Feedback page alert message
function feedback() { alert("Your feedback is submitted."); }
[ "function ksfGraphTools_showFeedback(type, title, message)\n{\n\t$(\".alert\").remove();\n\tvar alert = \"<div class=\\\"alert \"+type+\" alert-dismissable\\\"> \" +\n\t\"<button type=\\\"button\\\" class=\\\"close\\\" data-dismiss=\\\"alert\\\" aria-hidden=\\\"true\\\">&times;</button> \"+ \n\t\"<strong>\"+title+\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find difference between next element & current cursor placement
findDelta(e) { let tList = this.props.tabElementList; const selectionStart = e.target.selectionStart; let diff = 0; for (let i = 0; i < tList.length; i++) { if (selectionStart < tList[i]) { diff = tList[i] - selectionStart; break; } } return diff; }
[ "function next_elem_top(pos) {\n closer = false;\n $($(el).get().reverse()).each(function (k, v) {\n element_position_top = Math.floor($(v).position().top);\n if (pos - 2 > element_position_top && closer == false) {\n closer = v;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: updateLocal update local data at path.
function updateLocal(path, local, remote) { logger.info('UPDATE', path, 'REMOTE -> LOCAL'); return store.setNodeData(path, remote.data, false, remote.timestamp, remote.mimeType); }
[ "function updateLocal(path, local, remote) {\n logger.info('UPDATE', path, 'REMOTE -> LOCAL');\n store.setNodeData(path, remote.data, false, remote.timestamp, remote.mimeType);\n }", "updateLocal() { }", "updateLocalFromStore(localData) {\n this._dataWalk(localData, this.data);\n }", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This algorithm take a rectangles of sides a and b, rotates it 45 degrees, and then finds the number of integer coordinates inside it.
function rectangleRotation(a, b) { let count = 0; let midright = a / 2 / Math.sqrt(2); let midleft = -1 * midright; let x = b / 2 / Math.sqrt(2); let p1 = [midleft - x, midleft + x]; let p2 = [midleft + x, midleft - x]; let p3 = [midright - x, midright + x]; let p4 = [midright + x, midright - x]; let ...
[ "function rectangleRotation(a, b) {\n\tlet pt = 0;\n\tlet radius = Math.pow(a /2 , 2) + Math.pow(b / 2, 2);\n\tradius = Math.ceil(Math.pow(radius, 0.5));\n\n\tlet degree = 45;\n\tlet radians = degree * Math.PI / 180;\n\n\tfor (let i = -radius; i <= radius + 1; i++) {\n\n\t\tfor (let j = -radius; j <= radius + 1; j+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Creates or updates an private link service in the specified resource group.
async function createPrivateLinkService() { const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subId"; const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1"; const serviceName = "testPls"; const parameters = { autoApproval: { subscriptions: ["subscription1", "subscription2"...
[ "async function putLinkWithServiceEndpoint() {\n const resourceUri =\n \"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app\";\n const linkerName = \"linkName\";\n const parameters = {\n authInfo: {\n name: \"name\",\n authType: \"secr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whenever a seat is clicked, if that seat isn't already booked, toggle its "held" status.
function handleSeatClicked() { const seatDiv = this; const seat = seatDiv.seat; if (!seat.isBooked) { SeatUI.toggleHeld(seat); displayTotals(); } }
[ "function selectSeat (event) {\n // Check if a free seat was clicked\n if (event.target.classList.contains('seat') &&\n !event.target.classList.contains('occupied')) {\n \n // Remove if exists a class or add it if it doesnt exists\n event.target.classList.toggle('selected');\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public function `inRange`. Returns true if `data` is a number in the range `x..y`, false otherwise.
function inRange (data, x, y) { if (x < y) { return greaterOrEqual(data, x) && data <= y; } return lessOrEqual(data, x) && data >= y; }
[ "function inRange(data, x, y) {\n if (x < y) {\n return greaterOrEqual(data, x) && data <= y;\n }\n\n return lessOrEqual(data, x) && data >= y;\n }", "function inRange(data, x, y) {\n if (x < y) {\n return greaterOrEqual(data, x) && data <= y;\n }\n\n return lessOrEqual(data, x) && data >= y;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set subheader to page name
function setSubheader(subheader){ document.getElementById('subheader').innerText = "Blog > Submit new blog" }
[ "function setTitle(page,text) {\n if (fhirVersion == 2) {\n page.name = text\n } else {\n page.title = text;\n }\n }", "function loadSubHeader(divin)\n{\n}", "set subheaderTemplate(directive) {\n this.subheaderT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write holiday names to the calendar days.
function writeHolidays(holidays) { // Holidays may be undefined if it's a major holiday. if (holidays != undefined) { // 1. Loop thru holidays. holidays.map(holiday => { // 2. Loop thru days. // We need to find a day that matches our holiday. ...
[ "writeDays(data) { \r\n const { days, dayDate, dateformat } = config;\r\n _.forEach(days, day => {\r\n let text = data.fromDate.day(day).format('dddd');\r\n if (dayDate) {\r\n const dateString = data.fromDate.day(day).format(dateformat);\r\n text = `${text} - ${dateString}`;\r\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
define an async method for initializing IPFS and OrbitDb
async initialize() { if (this.isInitialized) { return true; } try { // create the ipfs instance if (this.config.ipfsOptions.apiUri) { this._ipfs = IpfsApi(this.config.ipfsOptions.apiUri); } else { this._ipfs = await IPFS.create(this.config.ipfsOptions); } ...
[ "async initialize() {\n await this.validateConfig();\n // Get the provider and contracts\n await this.getProvider();\n await this.delay(5000);\n const title = await this.oracle.getTitle();\n console.log(\"Provider's title: \", title);\n if (title.length == 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind createURL to this specific attribute
function _createURL() { return createURL(state.toggleRefinement(attributeName, isRefined)); }
[ "function _createURL() {\n return createURL(state.toggleRefinement(attributeName, isRefined));\n }", "set url(val) {\n this._setAttributes(val,'url')\n }", "function newUrl() {\n\trecordUrl();\n\n\tconstructUrlMarkup(2);\n}", "function _createURL() {\n return createURL(sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove existing status file if any.
_removeExistingStatus () { const statusPath = path.join(__dirname, 'data', 'status.json'); return fs.unlinkAsync(statusPath) .catch(err => { // ENOENT, file not existed ignore. if (err.code === 'ENOENT') return; throw err; }); }
[ "function cleanUp(fileToDelete){\n console.log(fileToDelete);\n // And delete the corresponding file\n fs.unlink(recDir + fileToDelete, function(){\n console.log(\"Deleted oldest file: \"+ fileToDelete);\n })\n}", "function removeStatus(id) {\n $('#' + id + 'Status').remove();\n }", "async wipe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check for mappings on various level, along the parameter order
function checkForMapping(paramValues,file) { if (isMappedFile(file)) { for (var i = 0; i < params.types.length; i++) { var paramConfig = image.config.config[params.types[i]]; var key = paramValues[i]; if (paramConfig[key]) { var fpConfig = paramConfig[key]["fish-pepper"]; ...
[ "function checkIfMappingApplies(mapper, unmappedGeneLabels, g, geneLeaves, speciesLeaves){\n\t\n\n\t\n\t// Ensure that each gene leaf maps to exactly one species list\n\tfor (var j = 0; j < geneLeaves.length; j ++) {\n\t\tvar gene_leaf = geneLeaves[j];\n\n\n\t\t// How many species is this mapped to?\n\t\tvar numMap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apply width on dxpimage of carousel container
applyWidthOnDxpImg() { for (const i of Object.keys(this.dxpCarouselSlide)) { this.dxpCarouselSlide[i].style.display = 'block'; this.dxpCarouselSlide[i].style.width = `${this.carouselContainer.offsetWidth}px`; } }
[ "function carouselContainerDim(){\n carouselContainerWid = $carousel.width();\n carouselContainerHt = carouselHt;\n }", "function carouselItemsWrapDimensions(){\n carouselItemsWrapWid = setWid * setCount;\n $carouselItemsWrap.width(carouselIte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This JUnit test is for testing the redoing of transactions.
testRedo() { let testResults = document.getElementById("allTestResults"); let messageElement = document.createElement("div"); messageElement.setAttribute("id", "testRedo"); messageElement.setAttribute("class", "testCase"); messageElement.innerHTML = "Unit Tests For Redo"; testResults.appendCh...
[ "redo() {\n this.transactionManager.redoTransaction();\n }", "testRedo() {\n // WE'LL JUST USE A SIMPLE NUM FOR TESTING\n let tps = new jsTPS();\n let num = new Num();\n var assert = require('assert');\n assert.equal(num.getNum(), 0);\n \n // ADD 3 TRANSACTIONS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A ClockSyncMarker is an internal entity that represents a marker in a trace log indicating that a clock sync happened at a specified time. If no end timestamp argument is specified in the constructor, it's assumed that the end timestamp is the same as the start (i.e. the clock sync was instantaneous).
function ClockSyncMarker(domainId, startTs, opt_endTs) { this.domainId = domainId; this.startTs = startTs; this.endTs = opt_endTs === undefined ? startTs : opt_endTs; }
[ "recordClockSyncMarker(params) {\n return this._client.send(\"Tracing.recordClockSyncMarker\", params);\n }", "function ClockSync() {\n\tvar _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n\tvar sendRequest = _ref.sendRequest;\n\tvar _ref$syncCallback = _ref.syncCallba...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates page Header DOM Elements
function setPageHeader() { // Container setup if (!document.getElementById('pageHeaderContainer')) { var pageHeaderContainer = document.createElement('div'); pageHeaderContainer.id = 'pageHeaderContainer'; // Page icon setup var pageIcon = document.createElement('img'); ...
[ "function createHeader() {\n // logo section\n const iconContainer = $(\"<div>\").addClass(\"icon-container\");\n const aTag = $(\"<a>\").attr('href', \"./index.html\");\n const img = $(\"<img>\").attr('src', './img/logo.png').addClass(\"logo-icon\");\n const logoContent = $(\"<div>\").addClass(\"log...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add modulation to delayed signal akin to ElectroHarmonix MemoryMan Guitar Pedal. Simple combination of effects with great output hear on lots of records. FX Chain ASCII PIC: v FEEDBACK | INPUT > DELAY > CHORUS > OUTPUT
function createModDelay() { // Create input node for incoming audio var inputNode = audioContext.createGain(); // SET UP DELAY NODE var delayNode = audioContext.createDelay(); delayNode.delayTime.value = parseFloat( document.getElementById("mdtime").value ); mdtime = delayNode; var feedbac...
[ "function createModDelay() {\n // Create input node for incoming audio\n var inputNode = context.createGain();\n\n // SET UP DELAY NODE\n var delayNode = context.createDelay();\n delayNode.delayTime.value = parseFloat(document.getElementById(\"mdtime\").value);\n mdtime = delayNode;\n\n var fee...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
go back to bookshelf from bookstore page
function goBacktoBookshelf(token) { var action = 'goBacktoBookshelf'; var jsonStr = '{}'; cmread.callBackClient(action, jsonStr, token); }
[ "function back() {\n $state.go(\"database.details\");\n }", "function goBack() {\n\t\tprops.history.push('/recipes');\n\t}", "function goBack() {\n\t\ttogglePage();\n\t\tdisposeThrownShurikens();\n\t\tupdateThrownShurikenCount();\n\t\tcleanBelt();\n\t}", "function goBack() {\n console.log(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets relevant object from associated array
function getbyId (index, arr) { var i = 0; index = index.toString(); while (i < arr.length) { if (arr[i].id === index) { return arr[i]; } i += 1; } }
[ "get_instance(name){\n for (instance in this.arr){\n if (instance[1] == name) {\n return instance[0];\n }\n }\n }", "function getObject(position,array){\n for (var i of array){\n if (i.pos == position){\n return i;\n }\n }\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Listar todos los datos de la pregunta
function listarTodosPregunta(){ listarTodosPreguntaGenerico("listarTodos"); }
[ "function listPostulant(){\n\t\t/***\n\t\t\tRequète AJAX permettant de lister les postulants\n\t\t\tParamètres:\n\t\t\tSortie: \"auth\" => Variable permettant d'indiquer qu'une requète a été effectué\n\t\t***/\n\t\t$http({\n\t\t\turl: '/postulant',\n\t\t\tmethod: 'GET',\n\t\t\tdatatype: 'json',\n\t\t\tcontentType: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the dates where there were sales recorded
function getSalesDays() { return new Promise ((resolve, reject)=> { db.findMany(Sales, {}, 'date', function(result) { var uniqueDates = []; var unique = 1; for (var i=0; i<result.length; i++) { var date = new Date (result[i].date); var unique = 1; date.setHours(0,0,0,0); ...
[ "function getDates (){\n\t\t\t\t\tvar dates = [];\n\t\t\t\t\tscope.data.coauthors.forEach(function(author){\n\t\t\t\t\t\tauthor.dates.forEach(function(date){\n\t\t\t\t\t\t\tif(dates.length === 0){\n\t\t\t\t\t\t\t\tdates.push({ label: date, \n\t\t\t\t\t\t\t\t\tvalue: date, \n\t\t\t\t\t\t\t\t\tfilterLabel: 'Date CoAu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mixes the data for the "byPoem" view
renderByPoem() { var data = GetData(); var information = []; var pushedPoems = {}; for(var i = 0; i < data.length; i++) { for(var j = 0; j < data[i]["details"].length; j++){ // If there's not an instance of the poem in the pushed poems then it needs to be pus...
[ "getAllPokeDtls(){\n return this.state.allPokeData.map((result)=>{\n return (\n <div key={result.data.name} className=\"srch-poke-card\">\n <PokeCard {...result.data} />\n </div>\n );\n });\n }", "function makeOtherPoets(respo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to retrieve the public path of the vendor used for chunking and component specific assets
function getVendorPublicPath() { return `http://localhost:9000/vendor/`; }
[ "get assetPath() {}", "getAssetRoots() {\n return [__dirname];\n }", "function getPublicPath () {\n const homepagePath = appPackageJson.productionHomepage\n let publicPath = homepagePath ? new url.URL(homepagePath, 'foo:///').pathname : '/'\n if (!publicPath.endsWith('/')) {\n // If we don't do this, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the number of characters remaining based on an input string and a max length.
function charactersRemaining(inputString, maxLength) { /** * TT - https://tt.amazon.com/0045455011 * Browsers send \r\n for new-lines and this does not happen until the form is submitted, * which causes the string length to be determined differently before and after the form submission which is the ...
[ "function find_remaining(t_obj, max_char){\r\r\n\t\treturn max_char - ($(t_obj).val()).length;\r\r\n\t}", "function getRemainingChars() {\r\n var length = TEXTBOX.value.length;\r\n /*\r\n If the text box is empty, then there are no characters in the text box, which means the character lim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`push` for a relationship allows the store to push a JSON API Relationship Object onto the relationship. The relationship will then extract and set the meta, data and links of that relationship. `push` use `updateMeta`, `updateData` and `updateLink` to update the state of the relationship.
push(payload, initial) { var hasData = false; var hasLink = false; if (payload.meta) { this.updateMeta(payload.meta); } if (payload.data !== undefined) { hasData = true; this.updateData(payload.data, initial); } if (payload.links && payload.links.related) { var re...
[ "push(payload) {\n heimdall.increment(push);\n\n let hasData = false;\n let hasLink = false;\n\n if (payload.meta) {\n this.updateMeta(payload.meta);\n }\n\n if (payload.data !== undefined) {\n hasData = true;\n this.updateData(payload.data);\n }\n\n if (payload.links && paylo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions Populate Review Cards
function populateReviewCards(){ var reviewCards = ''; $.getJSON('reviews/reviewlist',function(data){ $.each(data,function(){ reviewCards += '<article class="card">'; reviewCards += '<header><h3>' + this.title + "</h3></header>"; reviewCards += '<img sr...
[ "function createReviewCard(review) {\n // grab review section\n let reviewSection = document.getElementById(\"review-row\");\n\n //create review card div/area\n let reviewDiv = document.createElement(\"div\");\n reviewDiv.setAttribute(\"data-id\", `${review.id}`);\n\n //create review card\n let reviewCard = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines if an object is both defined and not null
function objectDefinedNotNull(obj) { return typeof obj !== "undefined" && obj !== null; }
[ "function defined(o) { return typeof o !== \"undefined\" && o !== null; }", "function isPresent(obj) {\n return obj !== undefined && obj !== null;\n }", "function isPresent(obj) {\n return obj !== undefined && obj !== null;\n}", "function $defined(obj){\r\n return (obj != undefined);\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Import Export Functions do_ajax
function do_ajax_import_export(which){ before_ajax_import_export(which); var group = jQuery("#option_group_name").val(); var seq_selector = "#apc_" + which + "_nonce"; var action_selctor = "apc_" + which + "_" + group; jQuery.ajaxSetup({ cache: false }); if (which == 'export') export_ajax_call(action_se...
[ "function import_ajax_call(action,group,seq_selector,which){\n jQuery.post(ajaxurl,\n {\n group: group,\n rnd: microtime(false), //hack to avoid request cache\n action: action,\n seq: jQuery(seq_selector).val(),\n imp: jQuery(\"#import_code\").val(),\n },\n function(data) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isDate2OnOrAfterDate1 (STRING date1Value, STRING date2Value) Returns "Y" if strings date1Value and date2Value are both dates (mm/dd/yyyy) and date2Value is on or after date1Value. Returns "N" if strings date1Value and date2Value are both dates (mm/dd/yyyy) and date2Value is before date1Value. Returns "U" if either stri...
function isDate2OnOrAfterDate1(date1Value, date2Value) { if (date1Value == null || date1Value == '') { return 'U'; } if (date2Value == null || date2Value == '') { return 'U'; } // Make sure the date is in mm/dd/yyyy format. var reTestDate = /[0-9]{2,2}\/[0-9]{2,2}\/[0-9]{4,4}/; if (!reTes...
[ "function isSameOrAfter(date1,date2){\n\tvar d1 = getDateEnglish(date1);\n\tvar d2 = getDateEnglish(date2);\n\treturn moment(d1).isSameOrAfter(d2); \n}", "function CompareDates(value1, value2) {\r\n var dateSeparator = '/';\r\n var date1, date2;\r\n var month1, month2;\r\n var year1, year2;\r\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Block panel to disable any manipulations with categories while request in process.
blockPanel() { this.isLoading = true; }
[ "function disable() {\n severities.disable();\n $('.gallery-filter').prop(\"disabled\", true);\n }", "function categoriaProd(){\n setControladorCategoria(false);\n }", "function allowDisabling() {\r\n forceEnableRendering = false;\r\n }", "function enableCategories() {\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion para agregar momento
function insertar_momento(req,res){ let fechamoment = moment().format("YYYY-MM-DD"); let horamoment = moment().format("h:mm:ss a"); //let momentoid = req.params.id_momento; let momentoss = new Momentos( req.body.id_contacto, req.body.id_tipo_respuesta, req.body.id_medio_contacto, req.body.id_status_proceso,...
[ "function addMoment(name, format, hasDate, hasTime) {\r\n\t\t\tvar formatString = lang(format);\r\n\t\t\tcalculator.addType(name, function(t) {\r\n\t\t\t\tvar m = moment(t, formatString, true/*strict*/);\r\n\t\t\t\tif (m.isValid()) {\r\n\t\t\t\t\tvar r = {};\r\n\t\t\t\t\tif (hasDate) {\r\n\t\t\t\t\t\tr.year = m.yea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an object with all images which filename ends on _sm, _md or _lg. sm, md and lg are the properties of the object.
header_images(category) { if (category.images) { let images = {}; let re = /^.*_(sm|md|lg)$/; Object.keys(category.images).forEach((imageName) => { let matches = imageName.match(re); if (matches) { images[matches[1]] = category.images[imageName...
[ "static imageRepresentationsPaths(filename) {\r\n const [folderName, suffix] = ['./img/', 'jpg'] //,'webp'];\r\n const small = folderName.concat(filename, '_w_400', '.', suffix);\r\n const large = folderName.concat(filename, '_w_800', '.', suffix);\r\n const regular = folderName.concat(filename, '.', su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funzione che stabilisce se un numero e pari o dispari
function pariDispari(num) { if (num % 2 === 0) { esito = "pari" } else { esito = "dispari" } return esito; }
[ "function verificaPariDispari(num) {\r\n if (num % 2 == 0) {\r\n return \"pari\";\r\n } else {\r\n return \"dispari\";\r\n }\r\n }", "function verificaPariDispari (num) {\n if(num % 2 ===0){\n return \"pari\"\n }\n return \"dispari\"\n}", "function puntuarNum(iden, en...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add new CSS style element From
function addNewStyle(newStyle) { var styleElement = document.getElementById('styles_js'); if (!styleElement) { styleElement = document.createElement('style'); styleElement.type = 'text/css'; styleElement.id = 'styles_js'; document.getElementsByTagName('head')[0].appendChild...
[ "function addStyles() {\n document.body.previousElementSibling.appendChild(\n DOM('style', undefined, [document.createTextNode(css)])\n );\n }", "addStyle() {\n //write own css parser\n const style = document.createElement('style');\n const userStyles = this.styles();\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse individual node in FBXTree.Objects.Texture
function parseTexture( textureNode, loader, images, connections ) { var texture = loadTexture( textureNode, loader, images, connections ); texture.ID = textureNode.id; texture.name = textureNode.attrName; var wrapModeU = textureNode.WrapModeU; ...
[ "function parseTexture(textureNode, loader, imageMap, connections) {\n\n var FBX_ID = textureNode.id;\n\n var name = textureNode.attrName;\n\n var fileName;\n\n var filePath = textureNode.properties.FileName;\n var relativeFilePath = textureNode.properties.RelativeFilename;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lists the words language and their amount of times correct
listWords() { let language = this.state.language.name; return this.state.words.map((item, idx) => { return ( <li key={idx}> <p>{language}</p> <h4>{item.original}</h4> <p>{`correct answer count: ${item.correct_count}`}</p> <p>{`incorrect answer count: ${item....
[ "getResultText() {\n var cantCorrectas = 0 ;\n\n this.questions.forEach(q => {\n if(q.correctAnswer == q.selectedAnswer)\n {\n cantCorrectas = cantCorrectas + 1;\n }\n });\n return cantCorrectas + ' de ' + this.questions.length;\n }", "function numOfLetters() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function converstionTime akan mengubah value waktu dalam kumpulan array menjadi waktu format menit Ouput array 2D: [ [ 8, 'Avatar Eng', 90, 2015 ], [ 10, 'Anna & Eli', 150, 2013 ], ... ]
function converstionTime(list) { // your code here.. var total=[] let simpan=[], temp='' let change = function(a){ for(var i=0;i<a.length;i++){ if(a[i]==':'){ simpan.push(Number(temp)) temp='' } else{ temp+=a[i]...
[ "function getTimeAxisData(axisArray, timeType){\n\tvar timeData = [];\n\t\n\tswitch(timeType){\n\tcase \"Years\":\t\t\n\t\tfor(var i=0; i<axisArray.length; i++){\n\t\t\ttimeData[i] = new Date(axisArray[i].time).getFullYear().toString();\t\t//getting year from the date\n\t\t}\n\t\tbreak;\n\tcase \"Seasons\":\n\t\tfo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert a string into the corresponding DType.
function stringToDType(dtype) { switch (dtype) { case 'float32': return 'float32'; default: throw new errors_1.ValueError("Invalid dtype: " + dtype); } }
[ "ConvertDataToType(inputString, type) {}", "function stringToDType(dtype) {\n switch (dtype) {\n case 'float32':\n return 'float32';\n default:\n throw new _errors__WEBPACK_IMPORTED_MODULE_1__.ValueError(`Invalid dtype: ${dtype}`);\n }\n}", "function toType(str) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compiles name, sign, and message into one sentance
function finalMessage (name, printSign, message){ return ("Hello " + name + "! Your sign is " + printSign + " and your horoscope message is: " + message); }
[ "function compileStringToSign () {\n var s = \n verb + '\\n'\n (md5 || '') + '\\n'\n (contenttype || '') + '\\n'\n date.toUTCString() + '\\n'\n canonicalizeAmzHeaders(amzheaders) + \n canonicalizeResource()\n return s\n }", "function findMessage(sign){\n if(sign === signs[1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deactivating will cause the Accessibility layer to be hidden. This is called when a user moves the mouse.
deactivate() { if (!this.isActive || this.isMobileAccessibility) { return; } this.isActive = false; window.document.removeEventListener('mousemove', this._onMouseMove, true); window.addEventListener('keydown', this._onKeyDown, false); this.renderer.off('postre...
[ "deactivate() {\n var _a2;\n !this._isActive || this._isMobileAccessibility || (this._isActive = !1, globalThis.document.removeEventListener(\"mousemove\", this._onMouseMove, !0), globalThis.addEventListener(\"keydown\", this._onKeyDown, !1), this.renderer.off(\"postrender\", this.update), (_a2 = this.div.par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs all registered _unrecognized activity type_ handlers and then continues the event emission process.
onUnrecognizedActivity(context) { return __awaiter(this, void 0, void 0, function* () { yield this.handle(context, 'UnrecognizedActivityType', this.defaultNextEvent(context)); }); }
[ "onUnrecognizedActivityType(handler) {\n return this.on('UnrecognizedActivityType', handler);\n }", "function processEvents(types, handler)\n {\n types = types.split(\" \");\n var type;\n var index = 0;\n var isHa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when bluetooth connects
function bt_OnConnect(ok) { if (!ok) { console.log("BT ERROR!"); bt.Connect("HC-05"); // Try to reconnect again } else if (ok) console.log("BT Successful"); }
[ "function connect(){\n $(\"#message\").append(\"<p>\\n\\nBluetooth is on</p>\");\n console.log(\"bluetooth is on at mac \"+app.mac_add); /* for development */\n /* connect to the hard coded MAC address of the PI */\n bluetoothSerial.connect(app.mac_add, connectedIsTrue, app.con_failure);\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reveal the current slide.
revealSlide () { this.slides[this.current].reveal() }
[ "function reveal() {\n //TODO\n //Teaser Preview (continued)\n //6. Restore the article contents to the original HTML\n //7. Animate the restored article to give a visual cue to the user\n}", "toggleReveal () {\n get(this, '_toggleReveal').perform()\n }", "onReveal () {\n this.revealAll()\n th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when remote removes a stream, remove it from the local video element
function onRemoteStreamRemoved(event) { console.log("Remove remote stream"); remotevid.src = ""; }
[ "function onRemoteStreamRemoved(event) {\n console.log(\"Remove remote stream\");\n remoteVideo.src = \"\";\n }", "function onRemoteStreamRemoved(event) {\r\n console.log(\"Remove remote stream\");\r\n detachVideo(this.id);\r\n //remoteVideo.pause();\r\n //remoteVideo.src = \"\";\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the context of the primary wrapper when the `wrappingComponent` rerenders.
function updatePrimaryRootContext(wrappingComponent) { var adapter = (0, _getAdapter2['default'])(wrappingComponent[OPTIONS]); var primaryWrapper = wrappingComponent[PRIMARY_WRAPPER]; var primaryRenderer = primaryWrapper[RENDERER]; var primaryNode = primaryRenderer.getNode(); var _getContextFromWrappi2 = get...
[ "getWrappingComponent() {\n if (this[ROOT] !== this) {\n throw new Error('ReactWrapper::getWrappingComponent() can only be called on the root');\n }\n if (!this[OPTIONS].wrappingComponent) {\n throw new Error('ReactWrapper::getWrappingComponent() can only be called on a wrapper that was originall...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get current state of the toggle data attr.
function getState() { return toggle.data("toggle"); }
[ "function getState() {\n return toggle.data(\"toggle\");\n }", "get toggled() {\n return this.getToggled();\n }", "function toggleState(data){\n\n // Get elem's state\n const state = $(data.elem).attr('data-state');\n\n // Change state to oposite\n if(state == 'active'){\n $(data.elem).attr('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to initialize a session following authentication from a socialAuth provider
async function initSession(req, res, next) { var provider = getProvider(req.path); try { if (!req.user) { throw new Error("oauth failed"); } const mySession = await user.createSession(req.user._id, provider, req); const results = { error: null, session: mySession,...
[ "batchInitialize() {\n this.initSession();\n this.initPassportWithJwtStrategy();\n this.usePassport({ useSession: false });\n // this.initPassportWithLocalStrategy();\n // this.usePassport({ useSession: true });\n this.initUser();\n }", "_initSession () {\n const session = this.get('session'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes in a JSON result,, certifications, and returns a formatted string of the completed certification results
function formatCompletedCertifications(certifications) { var largeOutput = ''; for (var i = 0; i < certifications.length; i++) { // console.log('certification ' + i.toString() + ' name: ' + certifications[i].name); // var certification = certifications[i]; largeOutput += formatCompletedCertification(cer...
[ "function formatCertifications(certifications) { \n\n\tvar largeOutput = ''; \n\n\tfor (var i = 0; i <= certifications.length; i++) { \n\t\tlargeOutput += formatCertification(certifications[i]); \n\t}\n\n\treturn largeOutput; \n\n\n}", "function formatCompletedCertification(certification) { \n\n\tvar name = certi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If use is true, password will contain uppercase letters
useUppercase(use) { this.options.uppercase = use ? true : false; }
[ "function uppercaseModifier() {\n var includeUpper = prompt(\"Do you want the password to include uppercase letters? (y/n)\")\n if (includeUpper === \"y\") {\n uppercase = true;\n }\n}", "function checkCase(password) {\n if (new RegExp('[a-z]+').test(password) && new RegExp('[A-Z]+').test(password)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for removing names that are checked on the list
function removeNames() { for (let i = names.length - 1; i > -1; i--) { const cbox = document.getElementById("cbox" + i); if (cbox.checked) { names.splice(i, 1); } } updateNameList(); }
[ "function uncheckAll(name, checkboxes)\r\n{\r\n\tfor (i = 0; i < checkboxes; i++)\r\n\t{\r\n\t\tname[i].checked = \"\";\r\n\t}\r\n}", "function removeCheckbox() {\n $('label[For='+this.id+']').remove();\n $('br[id='+this.id+'Br]').remove();\n // Re-add ingredient to autocomplete menu\n ingredNames.push(this.v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Vars From URL
function getVars(){ var loc = document.location.href; var getString = loc.split('?'); if(getString[1]){ var GET = getString[1].split('&'); var get = {};//This object will be filled with the key-value pairs and returned. for(var i = 0, l = GET.length; i < l; i++){ var tmp...
[ "function get_url_vars(){\r\n\t\r\n\tvar data = [];\r\n\tvar nvp = [];\r\n\t\r\n\tvar urlSplit = window.location.href.split('?')[1].split('&');\r\n\t\r\n\tfor(i = 0; i < urlSplit.length; i++) {\r\n\t\r\n\t\tnvp = urlSplit[i].split('='); // split into key value pair\r\n\t\r\n\t\tdata.push(nvp[0]); // push key onto b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the current 3x3 rotation matrix.
getRotationMatrix3() { mat3.set(rotationMatrix3, this._m0.gain.value, this._m1.gain.value, this._m2.gain.value, this._m3.gain.value, this._m4.gain.value, this._m5.gain.value, this._m6.gain.value, this._m7.gain.value, this._m8.gain.value); return rotationMatrix3; }
[ "getRotationMatrix3() {\n set(rotationMatrix3$1, this._gainNodeMatrix[0][0].gain.value, this._gainNodeMatrix[0][1].gain.value, this._gainNodeMatrix[0][2].gain.value, this._gainNodeMatrix[0][3].gain.value, this._gainNodeMatrix[0][4].gain.value, this._gainNodeMatrix[0][5].gain.value, this._gainNodeMatrix[0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to fill up the card component with the "FROM" bus stop information
function busstopcardinfo( bscode, description, roadname, querydata = "", cardtitle ) { $(".card-header").html( ` <p class="card-text overflow-auto" id ="buscardheader"> <h4>${cardtitle}</h4><hr> <div class="row justify-content-around"> <div class="col-sm-12"...
[ "function destcardinfo(bscode, description, roadname, querydata = \"\") {\n $(\"#destcard\").remove();\n\n $(\"#carddiv\").append(\n `\n <div class=\"card text-dark bg-light mb-3\" style=\"max-width: 100rem;\" id=\"destcard\">\n <div class=\"botcolor card-header\">\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a rectangle expressed in SVG element coordinates to coordinates within specific [[Sprite]].
function svgRectToSprite(rect, sprite) { var p1 = svgPointToSprite(rect, sprite); var p2 = svgPointToSprite({ x: rect.x + rect.width, y: rect.y + rect.height }, sprite); return { x: p1.x, y: p1.y, width: p2.x - p1.x, height: p2.y - p1.y }; }
[ "function svgRectToSprite(rect, sprite) {\n var p1 = svgPointToSprite(rect, sprite);\n var p2 = svgPointToSprite({\n x: rect.x + rect.width,\n y: rect.y + rect.height\n }, sprite);\n return {\n x: p1.x,\n y: p1.y,\n width: p2.x - p1.x,\n height: p2.y - p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code Example 5.2 Get the active cell and print its containing sheet name and address to the log. Try rerunning after adding a new sheet and selecting a cell at random.
function activeCellFromSheet () { var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet(), activeCell = activeSpreadsheet.getActiveCell(), activeCellSheetName = activeCell.getSheet().getSheetName(), activeCellAddress = activeCell.getA1Notation(); Logger.log('The activ...
[ "function activeCellFromSheet() {\n var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet(),\n activeCell = activeSpreadsheet.getActiveCell(),\n activeCellSheetName = activeCell.getSheet().getSheetName(),\n activeCellAddress = activeCell.getA1Notation();\n Logger.log('The active cel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes lists of mentors and mentees and a mentees.length by mentors.length multidimensional array, and fills the array with similarity coefficients
function assigncoeffarr(mentors, mentees, coeffarr) { // Outer loop - mentees for(var i = 0; i < mentees.length; i++) { // Inner loop - mentors for(var j = 0; j < mentors.length; j++) { // Similarity coefficient var simcoeff = 0; // Pre-Professional track match -> +10 pts // I count Graduate Scho...
[ "_calculateDistanceMatrix() {\n const identifiers = this._corpus.getDocumentIdentifiers();\n const vectors = identifiers.map(d => this._corpus.getDocumentVector(d));\n const matrix = new Array(vectors.length).fill(null).map(() => new Array(vectors.length));\n for (let i = 0; i < vectors.length; i++) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A number between 0 and 1 determining the scale of the horizontal zoom. This property is effectively a shortcut to the Width of the ActualWindowRect property.
get actualWindowScaleHorizontal() { return this.i.n7; }
[ "zoomToWidth(screenWidth) {\n const curWidth = this.globalLayout.pageWidth * this.globalLayout.svgScale;\n this.globalLayout.zoomScale = ((screenWidth - 350) / curWidth) * this.globalLayout.svgScale; // magic 350 for left controls....TODO standardize this\n }", "getActualWindowScaleHorizontal() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function used to changed list of players displayed, takes in an array and an index for that array
function getDisplayList(playerArray, index){ for(var i=0; i<10; i++, index++){ if(index >= playerArray.length-1){ vm.startList=false; } if(index<= 0){ vm.endList=false; } vm.displayList[i]=playerArray[index]; } }
[ "function changeOrder(index)\n{\n\tif (index > 0) \n\t{\n\t\tnewIndex = index - 1;\n\t} \n\telse \n\t{\n\t\tnewIndex = 0;\n\t}\n\tif (index < players.players.length) \n\t{\n\t\tnewIndex = index + 1;\n\t} \n\telse \n\t{\n\t\tnewIndex = players.players.length - 1;\n\t}\n\tarraymove(players.players, index, newIndex );...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update attribute transitions. This is called in drawLayer, no model updates required.
_updateAttributeTransition() { const attributeManager = this.getAttributeManager(); if (attributeManager) { attributeManager.updateTransition(); } }
[ "_updateAttribute(attributeName, attribute, settings) {\n const transition = this.transitions[attributeName];\n // an attribute can change transition type when it updates\n // let's remove the transition when that happens so we can create the new transition type\n // TODO: when switching transition type...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Async function to place the buttons, waits for buttons to be made first All relevant functions are functionally the same as the make Buttons function Main difference is that it deletes the dom elements first before redrawing It also takes position so that we know where to start looping through the directory
async function replaceButtons(dir, pos) { if(dir === 1) { return 1; } nextBool = dir.length - pos - 12 oldNodes = document.getElementById("buttons") while(oldNodes.firstChild) { oldNodes.removeChild(oldNodes.firstChild); } fileInfo = document.createElement("P") ...
[ "function SpawnOldButtons() {\n for (bttn of Path) {\n x = game.add.image(bttn.x,bttn.y, 'RndButton', 'Down');\n x.anchor.set(0.5);\n }\n\n windoww.bringToTop();\n narrative.bringToTop();\n button1.bringToTop();\n button2.bringToTop();\n\n b1t.bringToTop();\n\tb2t.bringToTop();\n caravanStart.bringToT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
16 Team, Best Of 3, Single Elimination, Top 4 Place
function Bracket16TeamBo3SingleElimWith3rdPlace (teams) { Bracket.call(this); this.description = "16 Team, Best of 3, Single Elimination with 3rd place match"; for (var i = 0; i < teams.length; i++){ this.teams.push(teams[i]); } for (var i = 0; i < 16; i++){ this.matches.push(new Match(3)); } this.matches[...
[ "function fourfourtwo(def, mid, forw, tableid){\n\n var position = 0;\n var team_value = 1000;\n var goalkeeper = 0;\n var defenders = 0;\n var midfielders = 0;\n var forwards = 0;\n var bestteam = [];\n\n playerData.sort(function (value1, value2){\n if (value1.total_points > value2.to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get stream metadata for a specific playlist
function getStreamData(playlist, isFirst) { fetch(groovebox["pathToApi"] +"/?metadata&playlist="+ playlist).then(function (r) { // expect a json response return r.json(); }).then(function (data) { setStreamData(data); }); }
[ "function getPlaylistMetaData ( opts, callback )\n{\n debug( 'fn: getPlaylistMetaData' )\n\n let listId\n\n if ( typeof opts === 'string' ) {\n listId = opts\n }\n\n if ( typeof opts === 'object' ) {\n listId = opts.listId || opts.playlistId\n }\n\n const { hl = 'en', gl = 'US' } = opts\n const uri = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
searches for a drink by a method determined by which radio button is selected
function searchDrink(value) { if(!nameSearchSelector.checked && !ingredientSearchSelector.checked) { alert('Please select a search method!') } else if(ingredientSearchSelector.checked) { searchByIngredient(value) } else if(nameSearchSelector.checked) { searchByName(value) ...
[ "function getSearchCriteria()\n{\n var searchValue;\n if (document.getElementById('artist-radio').checked)\n {\n console.log(\"artist\");\n searchValue = \"artist\";\n return searchValue;\n }\n if (document.getElementById('song-radio').checked)\n {\n console.log(\"song\");\n searchValue = \"son...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a DOM node, return the closest HostComponent or HostText fiber ancestor. If the target node is part of a hydrated or not yet rendered subtree, then this may also return a SuspenseComponent or HostRoot to indicate that. Conceptually the HostRoot fiber is a child of the Container node. So if you pass the Container ...
function getClosestInstanceFromNode(targetNode) { var targetInst = targetNode[internalInstanceKey]; if (targetInst) { // Don't return HostRoot or SuspenseComponent here. return targetInst; } // If the direct event target isn't a React owned DOM node, we need to look // to s...
[ "function getClosestInstanceFromNode(targetNode) {\n var targetInst = targetNode[internalInstanceKey];\n\n if (targetInst) {\n // Don't return HostRoot or SuspenseComponent here.\n return targetInst;\n } // If the direct event target isn't a React owned DOM node, we need to look\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an integer from a given section of bits out of a hex string. hex is the target hex string to slice. start represents the index of the first bit to cut from the hex string (binary) in LSB order. end represents the index of the last bit to cut from the hex string.
function getIntFromBits(hex, start, end = undefined) { const bin = encUtils.hexToBinary(hex); const bits = bin.slice(start, end); const int = encUtils.binaryToNumber(bits); return int; }
[ "function slice(n, start, end) {\n var hex = exports.hexUtils.toHex(n).substr(2);\n var sliceStart = start >= 0 ? start * 2 : Math.max(0, hex.length + start * 2);\n var sliceEnd = hex.length;\n if (end !== undefined) {\n sliceEnd = end >= 0 ? end * 2 : Math.max(0, hex.length + end * 2);\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Keep 'vm.selectedCustomerId' in a 'customerState' ngValue object where it survives creation and destruction of this controller
function select(customer){ if (vm.selectedCustomer === customer ) {return;} // no change vm.selectedCustomer = customer; var id = customer && customer.id; if (id && id !== customerState.selectedCustomerId){ // customer changed, get its orderHeaders and up...
[ "function getSelectedCustomer() {\n if($stateParams.customerId) {\n estimateFactory\n .getCustomerById($stateParams.customerId)\n .then(function(response) {\n vm.customer = response;\n }, function(error) {\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The constructor for tab panes el : HTMLElement The html element used to represent the tab pane bUseCookie : Boolean Optional. Default is true. Used to determine whether to us persistance using cookies or not
function WebFXTabPane( el, bUseCookie ) { if ( !hasSupport() || el == null ) return; this.element = el; this.element.tabPane = this; this.pages = []; this.selectedIndex = null; this.useCookie = bUseCookie != null ? bUseCookie : true; // add class name tag to class name this.element.class...
[ "constructor() {\n super();\n\n /**\n * List of tab names\n * @protected\n * @type {Array<string>}\n */\n this.tabNames = [];\n\n /**\n * List of tab layers\n * @protected\n * @type {Array<Layer>}\n */\n this.tabLayer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }