query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Delete everything in the model.
reset() { this.entities().forEach(e => e.delete()); }
[ "clear() {\n var models = this._models;\n this._models = [];\n\n for (var i = 0; i < models.length; i++) {\n var model = models[i];\n model.unloadRecord();\n }\n\n this._metadata = null;\n }", "clear() {\n var models = this._models;\n this._models = [];\n\n for (var i = 0;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Have the countingBills(input) take in an array containing counts of denominations of dollars and return the total amount of money represented. (e.g. [0, 2, 0, 1, 3, 0] would return 180) The array represents 0 ones, 2 fives, 0 tens, 1 twenty, 3 fifties, and 0 one hundreds
countingBills(input) { // enter dollar values in array form let dollars = [1, 5, 10, 20, 50, 100]; // create a placeholder to hold the sum of the denominations let sum = 0; // Iterate in array indices and get the value of each index position // go up to 6 value...
[ "countingBills(input) {\n // create an array that represent demoninations [One, Five, Ten, Twenty, Fifty, Hundred]\n let bills = [1, 5, 10, 20, 50, 100];\n // create a money variable that starts with $0\n let money = 0;\n //iterate through array until all input number have reached...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper to load a specific path on the active tree as soon as its ready
function loadPath(path, forceReload, activate) { if (scope.activeTree) { syncTree(scope.activeTree, path, forceReload, activate); } else { scope.eventhandler.one("activeTreeLoaded", function (e, args) { ...
[ "load() {\n this.recursiveLoad(this.options.path);\n }", "load() {\r\n for( let p in this.initialPaths ) {\r\n let value = paths.getPath( p, this.state )\r\n let setState = ( val ) => {\r\n paths.putPath( p, this.state, val )\r\n this.notify( p, val )...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! Remove _id from `subdoc` if user specified "lean" query option
function maybeRemoveId(subdoc, assignmentOpts) { if (assignmentOpts.excludeId) { if (typeof subdoc.$__setValue === 'function') { delete subdoc._doc._id; } else { delete subdoc._id; } } }
[ "function maybeRemoveId(subdoc, assignmentOpts) {\n\t if (assignmentOpts.excludeId) {\n\t if (typeof subdoc.setValue === 'function') {\n\t delete subdoc._doc._id;\n\t } else {\n\t delete subdoc._id;\n\t }\n\t }\n\t}", "function maybeRemoveId(subdoc, assignmentOpts) {\n if (subdoc != null && ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a function which generates unique class names based on counters. When new generator function is created, rule counter is reset. We need to reset the rule counter for SSR for each request. It's inspired by
function createGenerateClassName() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var _options$dangerouslyU = options.dangerouslyUseGlobalCSS, dangerouslyUseGlobalCSS = _options$dangerouslyU === undefined ? false : _options$dangerouslyU; var escapeRegex = /([[\].#*$...
[ "function createGenerateClassName() {\n\t var ruleCounter = 0;\n\n\t if (process.env.NODE_ENV === 'production' && typeof window !== 'undefined') {\n\t generatorCounter += 1;\n\n\t if (generatorCounter > 2) {\n\t // eslint-disable-next-line no-console\n\t console.error(['Material-UI: we have detect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set checkbox valid or invalid for project type selection
function setCheckBoxForTypeSelection() { document.getElementById("selectTypeCheckbox").style.display = "inline"; if (projectTypeSelected()) { setCheckboxValid(document.getElementById("selectTypeCheckbox")); } else { setCheckboxInvalid(document.getElementById("selectTypeCheckbox")); } }
[ "function setProjectValidateFlag() {\n if ($scope.projectDetailsObj.currentPage === 4 && $scope.projectDetailsObj.creationType === 'demoLab') {\n if ($scope.projectDetailsObj.selectedProject !== null && $scope.projectDetailsObj.selectedProject !== undefined) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
baby and mom collsion
function momBabyCollison() { if (data.fruitNum > 0 && !data.gameOver) { var l = calLength2(mom.x, mom.y, baby.x, baby.y); if (l < 900) { baby.babyBodyCount = 0; mom.momBodyCount = 0; data.addScore(); halo.born(baby.x,baby.y) } } }
[ "function momBabyCollision() {\r\n\t if(date.fruitNum>0&&!date.gameOver){\r\n\t\t\tvar l=calLength2(mom.x, mom.y,baby.x, baby.y);\r\n\t\t\tif(l<900){\r\n\t\t\t\tbaby.babyBodyCount=0;\r\n\t\t\t\tmom.momBodyCount=0;\r\n\t\t\t\t//update score\r\n\t\t\t\tdate.addScore();\r\n\t\t\t\thalo.born(baby.x,baby.y);\r\n\t\t\t}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create container, MenuBar, Panel, and ToastArea
_ConstructElements() { // Create the container that all the other elements will be contained within this.container = document.createElement('div'); this.container.classList.add(styles['guify-container']); let containerCSS = {}; // Position the container relative to the root bas...
[ "function ac_createPanels() {\n\n\t// Create ActiveChat Container\n\t$(\"body\").append('<div id=\"activechat\"></div>');\n\t\n\t// Create Panel Containers\n\t$(\"#activechat\").append('<div id=\"ac_tool_box\"></div>');\n\t$(\"#activechat\").append('<div id=\"ac_info_box\"></div>');\n\n\tac_createTabs();\n\tac_crea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3. gallery fancybox activator
function GalleryFancyboxActivator() { var galleryFcb = $('.fancybox'); if (galleryFcb.length) { galleryFcb.fancybox({ openEffect: 'elastic', closeEffect: 'elastic', helpers: { media: {} } }); } }
[ "function GalleryFancyboxActivator () {\n var galleryFcb = $('.fancybox');\n if(galleryFcb.length){\n galleryFcb.fancybox({\n openEffect : 'elastic',\n closeEffect : 'elastic',\n helpers : {\n media : {}\n }\n });\n }\n}", "Lightbox() {\n $('.fancybox').fancybox({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
samplemetadata: title: Download Folder With Transfer Manager description: Downloads a folder in parallel utilizing transfer manager. usage: node downloadFolderWithTransferManager.js
function main(bucketName = 'my-bucket', folderName = 'my-folder') { // [START storage_download_folder_transfer_manager] /** * TODO(developer): Uncomment the following lines before running the sample. */ // The ID of your GCS bucket // const bucketName = 'your-unique-bucket-name'; // The ID of the GCS f...
[ "function downloadFolder(iFolder , iCourse){\n //create the array of files to download\n var aIds = new Array();\n aIds[0] = iFolder;\n \n \n \n //download the files\n ksDownloadFiles([] , aIds , iCourse);\n \n \n}", "async downloadFiles () {\n const downloadTasks = []\n\n // a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
KAJAX Kayako Ajax JS Lib Source Copyright 20012004 Kayako Web Solutions Unauthorized reproduction is not allowed License Number: $%LICENSE%$ $Author: vshoor $ ($Date: 2006/11/14 20:58:58 $) $RCSfile: kajax.js,v $ : $Revision: 1.5 $ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ======================================= ===============...
function KAJAX() { // ======= OBJECT DELCARATIONS ======= this._browserDetect = new KAJAX_browserDetect(); }
[ "function ajaxObject(b,a){var c=this;this.updating=false;this.abort=function(){if(c.updating){c.updating=false;c.AJAX.abort();c.AJAX=null}};this.update=function(e){if(c.updating){return false}c.AJAX=null;if(window.XMLHttpRequest){c.AJAX=new XMLHttpRequest()}else{c.AJAX=new ActiveXObject(\"Microsoft.XMLHTTP\")}if(c....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
subdivide_triangle(): Recurse through each level of detail by splitting triangle (a,b,c) into four smaller ones.
subdivide_triangle( a, b, c, count ) { // Base case of recursion - we've hit the finest level of detail we want. if( count <= 0) { this.indices.push( a,b,c ); return; } // So we're not at the base case. So, build 3 new vertices at midpoints, // and e...
[ "function divideTriangle( a, b, c, divs, points ) {\n var result;\n if (divs > 0) { // subdivide the triangle into four\n // find the unit distance points midway between the vertices a, b, and c\n var v1 = vec4(0.0, 0.0, 0.0, 1.0);\n var v2 = vec4(0.0, 0.0, 0.0, 1.0);\n var v3 = vec4(0.0, 0.0, 0.0, 1....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
toggleButtons(user) // /////////////////////// Function for toggling menus with the footer buttons
function toggleButtons(user) { // Toggle the overview menu $("#button-overview").click(function() { $("*").scrollTop(0); $("#overview").toggle(); if ($("#overview").css("display").toLowerCase() == "none" && $("#toolbar").css("display").toLowerCase() == "none") { $(".question-answer").css("left", ...
[ "function showFooterButtons(user) {\r\n\tswitch(user.currentQuestion) {\r\n\t\tcase 6:\r\n\t\tcase 7:\r\n\t\t\t$(\"#button-overview\").css(\"left\", \"20%\");\r\n\t\t\t$(\"#button-cartoon\").css(\"left\", \"40%\");\r\n\t\t\t$(\"#button-toolbar\").css(\"display\", \"block\");\r\n\t\t\t$(\"#button-toolbar\").css(\"le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display the read menu
function readMenu() { inquirer.prompt({ type: "list", name: "action", message: "What would you like to view?", choices: [ { name: "View all departments", value: viewAllDepartments }, { name: "View all roles", value: viewAllRoles }, { name: "View ro...
[ "function showMenu() {\n console.info(\n `\\nYou can choose for these commands:\\n\\n` +\n `exit, quit: Exits the program\\n`+\n `menu, help: Shows this menu\\n` +\n `larare: Show table Teachers and their info\\n`+\n `kompetens: Shows how the teachers competence changed during ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============ show register form ==============
function showRegisterForm() { $("#form-login").hide() $("#form-register").show() $("#form-edit-todo").hide() $("#todo-table").hide() $("#form-add-todo").hide() $("#logout").hide() $("#name").hide() $("#register").hide() $("#google-button").hide() ...
[ "function showRegister() {\n clearErrorMsg();\n showLinks(['loginLink']);\n showView('registerForm');\n}", "function showRegisterForm() {\n\t\tvar loginForm = document.querySelector('#login-form');\n\t\tvar registerForm = document.querySelector('#register-form');\n\t\tvar itemNav = document.querySelector...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Click On Mark As Completed After Claiming The Ticket
clickOnMarkAsCompleted(){ console.log(" **** Marking Ticket As Complete ****"); browser.click(eval(ticketDetailPageObject.topNav.btn_markAsComplete)); browser.waitForPageToLoadAndCheckPartialHeaderText(eval(ticketDetailPageObject.documentVerificationPopUp.verifyDocumentHeader),ticketsJson.verifyDocumentHead...
[ "function handleMarkComplete(event) {\n event.preventDefault();\n let requestItemData = $(this).parent(\"td\").parent(\"tr\").data(\"walk\");\n let walkID = requestItemData.id;\n $.ajax({\n method: \"PUT\",\n url: \"/api/walks/\" + walkID,\n data: {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The BMP Parameters that should be sent to the OCM model Format is as show below: fs_cost; gw_cost; cw_cost; br_cost; cc_cost,cc_type; dm_cost; sb_cost; nm_cost1,nm_cost2,nm_cost3,nm_cost4,nm_rate,nm_ratio1,nm_ratio2; pc_cost,pc_type
function getBmpParams(){ var output = ""; output = bmp_param_fs_cost + ";" + bmp_param_gw_cost + ";" + bmp_param_cw_cost + ";" + bmp_param_br_cost + ";" + bmp_param_cc_cost + "," + bmp_param_cc_type + ";" + bmp_param_dm_cost + ";" + bmp_param_sb_cost + ";" + bmp_param_nm_cost1 + "," + b...
[ "function validateBMPInputs(options) {\n var flag = false;\n options = angular.extend({}, defaultBMPProps, options);\n flag = (typeof (options.footprintAreaSqFt) === 'number' && options.bmpType > -1 && options.bmpType < 8); //check for valid BMP type\n\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set Functions set the board object
function setBoard(b){ board = b; }
[ "set board(value) {\n this._board = value;\n }", "function setUpBoard () {\n makeCrystalScores();\n makeCrystalButtons();\n }", "initBoard() {\n this.model = {'none': 0, 'white': 1, 'black': 2};\n\n this.boardCells = new Array(13).fill(0).map(() => new Array(13).fill(this.mode...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs an observable that, when subscribed, causes the configured `HEAD` request to execute on the server. The `HEAD` method returns meta information about the resource without transferring the resource itself. See the individual overloads for details on the return type.
head(url, options = {}) { return this.request('HEAD', url, options); }
[ "head(url, options = {}) {\n return this.request('HEAD', url, options);\n }", "head(url, opt = {}) {\n opt.method = 'HEAD';\n return this.sendRequest(url, opt);\n }", "function headResponse (response, request) {\n if (response && request.method === 'HEAD') {\n return response.setBody(''...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test Math.round() on constants
function testConstant() { for (let testCaseInput of validInputTestCases) { eval(` function opaqueRoundOnConstant() { return Math.round(${testCaseInput[0]}); } noInline(opaqueRoundOnConstant); noOSRExitFuzzing(opaqueRoundOnConstant); ...
[ "function roundme(val) {\n return val;\n }", "function shouldRound(should, value){\n return ((should) ? Math.round(value) : value)\n}", "function test_constant() {\n assertEquals(Math.floor(Math.PI * 1000), 3141, 'const pi');\n assertEquals(Math.floor(Math.E * 1000), 2718, 'const e');\n assertEqua...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provides an interface to manage related items
get relatedItems() { return RelatedItemManagerImpl.FromUrl(this.toUrl()); }
[ "function manageItem(){\n\t\n\tdata = {\n\t\tinteract:'wishlist',\n\t\taction:'manageItem',\n\t\targs:{}\n\t}\n\t\n\tcurrentItemId = jQuery(\"#manageItemForm #itemId\").val();\n\t\n\t//Ternary operation to determine whether we're editing or adding an item.\n\tdata.args.itemAction = (currentItemId == \"\") ? \"add\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
const apiDomain = ' let thirdPartyLoginTask
function thirdPartyLogin(param, callback) { // if (thirdPartyLoginTask && thirdPartyLoginTask.abort) { // thirdPartyLoginTask.abort() // thirdPartyLoginTask = null // } console.log("request thirdPartyLogin ->", param); wx.request({ url: apiDomain + "/api/thirdPartyLogin.htm", ...
[ "function ExampleApiAuth() {}", "function getUrlLogin(){\n\treturn \"http://\"+location.host+\"/dinox\";\n}", "function OpGetDomainToken(evnt) {\n let username = document.getElementById('v-username').value.trim();\n let passwd = document.getElementById('v-password').value.trim();\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse time string into Javascript Date object
function parseTime(timeStr) { var time = timeStr.match(/(\d+)(?::(\d\d))?\s*(p?)/i); if (!time) { return NaN; } var hours = parseInt(time[1], 10); if (hours == 12 && !time[3]) { hours = 0; } else { hours += (hours < 12 && time[3]) ? 12 : 0; } var dt = new ...
[ "function parseTime(timeString) {\n\tif (timeString == null) {\n\t\treturn null;\n\t}\n\n\tvar invalidDate = new Date(NaN);\n\t\n\t// Preserve whitespace and periods used as separators.\n\ttimeString = timeString.replace(/(\\d)[\\s\\.]+(\\d)/g, '$1:$2');\n\t\n\t// Remove other whitespace and periods that may appear...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the frame size of next frame is ready.
hasFrameSize() { return this.frameSize != VideoData.FRAME_SIZE_NOT_READY; }
[ "isReadFrameReady() {\n return this.hasFrameSize() && this.videoDataBuffer.length >= this.frameSize;\n }", "function have__ENOUGH__DATA_ques_(mediaReadyState) /* (mediaReadyState : mediaReadyState) -> bool */ {\n return (mediaReadyState === 5);\n}", "isFrameComplete(){\n if (this.round1 === 10 || t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add_img_cell Add an IMG cell to the table row.
function add_img_cell(row, src, alt, height, width, cls) { var node = null; if (src) { node = document.createElement("img"); node.setAttribute("src", src) if (alt) { node.setAttribute("alt", alt) } if (height > 0) { node.setAttribute("height", height) } if (width > 0) { node.setAttribute("width"...
[ "function add_image_to_cell(params) {\n // get params\n var cell = params.cell;\n var id = params.id; if (!id) {_cell_id_++; id = 'Cell_'+_cell_id_;};\n var clss = params.clss || '';\n var priority = params.priority;\n var image = params.image || console.log('error: please provide image');\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
smoothPath generates a smooth curve through a list of points. The points (objects with x and y attributes) should be sorted in ascending xaxis order. This returns an array of points in ascending xaxis order.
function smoothPath(points, outputPointSpace) { // FYI: this uses a monotone cubic spline to generate a smooth curve. points = removeOverlappingPoints(points); var len = points.length; if (len === 0) { return []; } else if (len === 1) { return [points[0]]; } var dxList = []; var dyList = []; ...
[ "function pathToPoints(path, pointCount) {\n var paper = Object(__WEBPACK_IMPORTED_MODULE_2__rendering_Paper__[\"b\" /* getGhostPaper */])();\n var svgPath = paper.add(\"path\").node;\n svgPath.setAttribute(\"d\", path);\n if (svgPath.getPointAtLength && svgPath.getTotalLength) {\n var length_1 =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createAllTables(db) Creates all tables from `db.js` file into db arg.
function createAllTables(db) { db.transaction((tx) => { init_queries.forEach((query) => { tx.executeSql( query, [], (_, { rows: { _array } }) => { console.debug("Table created successfully"); }, (_, err) => { console.debug("Error while creating tab...
[ "function createAllDBTables() {\n createDBTableFILE();\n createDBTableEVENT();\n createDBTableALARM();\n}", "function createTables(db) {\n db.run('CREATE TABLE IF NOT EXISTS movies(link varchar(30), id varchar(30), metascore integer, rating float, synopsis varchar(30), title varchar(30), votes float, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dynamically builds out the option html for the select shape element.
function buildDynamicSelectShapeHtml() { var html = ''; for (key in DiagramService.SHAPES) { let shape = DiagramService.SHAPES[key]; html += '<option value="' + key + '">' + shape.name + '</option>'; } _$selectShape.html(html); return this; }
[ "build() {\n this.div.innerHTML = \"\";\n const opts = this.options;\n for (let i = 0; i < opts.length; i++) {\n const opt = opts[i];\n if (typeof opt.value == \"undefined\") {\n console.error(\"Could not create option at index \"+i+\" as it is missing a value.\", opt);\n continue;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Processes a JSON received from .NET process. If it's a Babel AST it will be compiled.
function processJson(json, opts, continuation) {; try { var babelAst; try { babelAst = JSON.parse(json); } catch (_err) { return; // If stdout is not in JSON format, just ignore } if (babelAst.type == "LOG") { if (babelAst.message.i...
[ "static parse(json) {\n\n }", "function ToJsonProgramType(JSON){\n var to_return = [];\n var len = JSON.body.length-1;\n for(var i = 0; i <= len; i++) {\n // the body of the program\n var body = JSON.body[i];\n to_return = to_return.concat(MatchTypeToFunction(body));\n }\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get authorization header for API request
static getApiAuthHeader() { return {'authorization': `bearer ${Auth.getToken()}`}; }
[ "getAuthorizationHeader() {\n const accessToken = this.getState(\"tokenResponse.access_token\");\n\n if (accessToken) {\n return \"Bearer \" + accessToken;\n }\n\n const {\n username,\n password\n } = this.state;\n\n if (username && password) {\n return \"Basic \" + this.enviro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to call pair function and get total pair
function checkPair() { let pair = 0 for (const key in cleanPileObj) { pair += pairs(cleanPileObj[key]) } return pair }
[ "calcSumPair(pair) {\n return Sheet.calcSum(Sheet.expandSumReference(\n pair[0].label,\n pair[1].label\n ));\n }", "function sumOfPairs (array) {\n\n}", "function pairWise(arr, arg) {\n var pairs = [];\n var pairedBefore = false;\n for (var i = 0; i <= arr.length;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves an authorization token to the stash
function saveToken(token, type) { var tokenKey = type + 'UserToken' responseStash[tokenKey] = token }
[ "save(token) {\n\t\twindow.localStorage.setItem('authToken', token);\n\t}", "storeToken(token) {\n this.store.commit('auth/STORE_TOKEN', token);\n }", "save(token) {\n //token is assigned to _AppConstants.jwtkey and is saved in $window.localStorage\n this._$window.localStorage[this._AppConstants...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the picker is canceled, stop the picker, and make sure the toolbox gets the focus.
function onPickerNodeCanceled() { stopPicker(); toolbox.frame.focus(); }
[ "_cancelClick() {\n\t\tthis.closePicker();\n\t}", "function cancel() {\n\t\t\tfocusedControl.fire('cancel');\n\t\t}", "function cancel() {\n focusedControl.fire('cancel');\n }", "async _cancelClick() {\n\t\tthis.value = this.previousValue;\n\t\tthis.closePicker();\n\t}", "function cancel(){focus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
write a function that accepts array of small alphabets and try to return the capitalized words.
function capitalizedWords(arr) { let newArr = []; if (arr.length === 1) return arr[0].toUpperCase(); newArr.push(arr[0].toUpperCase()); newArr = newArr.concat(capitalizedWords(arr.slice(1))); return newArr; }
[ "function capitalizedWords(arr) {\n let solution = [];\n\n if (arr.length === 0) return solution;\n\n solution.push(arr[0].toUpperCase());\n\n solution = solution.concat(capitalizedWords(arr.slice(1)));\n\n return solution;\n}", "function allCaps(arr){\n\treturn myMap(arr, (elem) => {return elem.to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class to load a postbit via AJAX
function vB_AJAX_PostLoader(postid) { this.postid = postid; this.container = fetch_object('edit' + this.postid); }
[ "function loadPostIt() {\n //appel de la fonction get de l'objet, necessitant une fonction de traitement de la reponse en argument d'entree de l'appel de fonction \n postItCrud.get('/postits', function (responseJSON) {\n //je transforme la chaine json recu en veritable objet javascript\n var pos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolve a relative link given the origin as source. For example, if a HTTP request to returns a Location header with the value /upload/abc, the resolved URL will be:
function resolveUrl(origin, link) { return new URL(link, origin).toString(); }
[ "function resolveUrl(origin, link) {\n\t return new urlParse(link, origin).toString();\n\t}", "function resolveUrl(origin, link) {\n return new url_parse_default.a(link, origin).toString();\n}", "function resolveUrl(origin, link) {\n return new _urlParse.default(link, origin).toString();\n}", "function res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A framed protocol with headers. THeaderProtocol frames other Thrift protocols and adds support for optional outofband headers. The currently supported subprotocols are TBinaryProtocol and TCompactProtocol. It can currently only be used with transports that inherit THeaderTransport. THeaderProtocol does not currently su...
function THeaderProtocol(trans) { if (!(trans instanceof THeaderTransport)) { throw new THeaderProtocolError( 'Only transports that inherit THeaderTransport can be' + ' used with THeaderProtocol' ); } this.trans = trans; this.setProtocol(); }
[ "function THeaderTransport() {\n this.maxFrameSize = MAX_FRAME_SIZE;\n this.protocolId = THeaderTransport.SubprotocolId.BINARY;\n this.rheaders = {};\n this.wheaders = {};\n this.inBuf = Buffer.alloc(0);\n this.outCount = 0;\n this.flags = null;\n this.seqid = 0;\n this.shouldWriteHeaders = true;\n}", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Get html for one attack item in the Air Defense tab list
function getAttackItemHtml(attack) { var atkHtml = "<div class=\"attackitem\" id=\"zone" + attack.Zone + "\">" + "<a class=\"gobattle flatbutton graybtn\" id=\"btn-" + attack.Zone + "\">Zone " + attack.Zone + "</a>" + "<img class=\"attackimage\" src=\"" + searchDir + side + "def.png\" />", s...
[ "get horseCard_Career_Good() {return browser.element(\"//android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup[6]/android.widget.TextView[1]\");}", "function getAttack(attack) {\n let currentAttack = attack.innerText\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches innerText within the element(s) matching a given XPath selector selector.
fetchText(selector) { let text = '', elements = this.getElementsByXPath(selector); if (elements && elements.length) { Array.prototype.forEach.call(elements, function _forEach(element) { text += element.textContent || element.in...
[ "async getTextContent(selector) {\n const element = await this.page.$(selector);\n const textContent = await this.page.evaluate(el => el.textContent, element);\n return textContent\n .replace(/(\\r\\n|\\n|\\r)/gm, '')\n .replace(/\\s\\s+/g, ' ')\n .trim();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add function asking for an index number remove that index from the fruits array console array
function removeFruit(){ var remove = prompt('enter an index number'); fruits.splice(remove,1); fruits.sort(); // console.log(fruits); outputFruits(fruits); }
[ "function removeIndex(num){\n movies.splice(num,1);\n return movies\n}", "function removeIndex(number){\r\n let result =[]\r\n for(let i = 0; i < movies.length; i++){\r\n if (number === i)\r\n continue \r\n result.push(movies[i])\r\n }return result\r\n}", "function arrayItemRem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given the supplied gutter, deliver negative left/right margin rules for FlexRow This is to ensure outer columns (with gutters) are flush with the container
function toRowGuttersCss(gutter) { return 'margin-left: -' + gutter / 2 + 'px; margin-right: -' + gutter / 2 + 'px;'; }
[ "function toRowGuttersCss(gutter) {\n return `margin-left: -${gutter / 2}px; margin-right: -${gutter / 2}px;`;\n}", "function paddingFix(i, row) {\n if (i === 0) {\n return {\n // LEFT\n marginRight: spacing,\n };\n } else if (i === row) {\n // RIGHT\n return {\n ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility function that put the table into the "Processing" state
function fnStartProcessingMode() { if (oTable.fnSettings().oFeatures.bProcessing) { $(".dataTables_processing").css('visibility', 'visible'); } }
[ "function fnStartProcessingMode() {\r\n\t\t\tif (oTable.fnSettings().oFeatures.bProcessing) {\r\n\t\t\t\t$(\".dataTables_processing\").css('visibility', 'visible');\r\n\t\t\t}\r\n\t\t}", "function _fnStartProcessingMode() {\n if (oTable.fnSettings().oFeatures.bProcessing) {\n $(\".dataTables_pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method used to delete a corporation
function deleteCorporation(corp_id) { CorporationService.deleteCorporation(corp_id).then(function(response) { vm.message = 'Corporation deleted successfully'; activate(); }, function(error) { vm.message = 'There was a problem deleting the corporati...
[ "function deleteCompany() {\n console.log(\"Delete company\");\n // return firestore.remove(`companies/${id}`);\n }", "async delete(ctx){\n try{\n ctx.body = await ctx.db.Company.destroy({\n where:{\n id: ctx.params.id\n }\n })\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enriches the incoming async asyncRunnable with the error and next handling (aka: asyncRunnable is done > next error > clear queue
enrichRunnable(asyncRunnable) { /** * we can use the Promise pattern asyncrunnable uses * to trigger queue control callbacks of next element * and clear the queue (theoretically this * would work with any promise) */ return asyncRunnable .then(() ...
[ "function errorHandler(er) {\n if (inErrorTick)\n return false;\n\n var handled = false;\n var i, queueItem, threw;\n\n inErrorTick = true;\n\n // First process error callbacks from the current context.\n if (currentContext && (currentContext._asyncFlags & HAS_ERROR_AL) > 0) {\n var queue = currentConte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw a single square
function drawSquare(x, y, size1, size2){ rect(x, y, size1, size2); }
[ "function drawSquare(){\n ctx.fillRect(25, 25, 100, 100);\n ctx.clearRect(45, 45, 60, 60);\n ctx.strokeRect(50, 50, 50, 50);\n }", "function drawSquare(x, y) {\n ctx.strokeRect(x, y, 50,50);\n}", "function drawSquare (x,y,color){\n context.fillStyle = color;\n context.fillRect(x...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build a wilson component request url given a name and connectionFilters hash.
function buildComponentUrl(name, connectionFilters) { return angular.wilson.utils.path.join(_appHostUrl, _appMountPath, _appVersion, 'component', name, (connectionFilters || '')); }
[ "#buildUrl() {\n let { url } = this.#request;\n let { prefix, suffix } = this.#configs;\n\n url = trim(url, '/');\n prefix = trim(prefix, '/');\n suffix = trim(suffix, '/');\n\n this.#request.url =\n (prefix && !startsWith(url, prefix, 0) ? `${prefix}/` : '') +\n url +\n (suffix && ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the store from all selcts and text areas
function updateStore() { //type let type_init = document.getElementById("type_select"); store.set("type", type_init.options[type_init.selectedIndex].value); //color let color_init = document.getElementById("color_select"); store.set("color", color_init.options[color_init.selectedIndex].value); //welcome...
[ "function updateAllSelections() {\n\tupdateSelections(\"cmsc\");\n\tupdateSelections(\"math\");\n\tupdateSelections(\"sci\");\n}", "updateUI() {\n\t\tthis._store.set(this)\n\t}", "function save() {\n $editors.find('.text').each(function () {\n $(this).closest('.fields').find('textarea').val(th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete comments that are marked as spam
spamAction() { this.spams.forEach((group) => { if(group.length >= this.config.spamCountLimit) { let toDelete = []; group.forEach((id) => { let comment = this.comments.get(id); if(!comment.deleted) { thi...
[ "clearComments()\n {\n let diff = this.comments.size - this.config.commentsHistoryLimit;\n\n for (let [id, comment] of this.comments) {\n\n if(diff <= 0) {\n break;\n }\n\n // Is the comment marked as spam\n let n = 0;\n let spam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `ConnectionConfigurationProperty`
function CfnDataSource_ConnectionConfigurationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object,...
[ "function CfnDataSource_SqlConfigurationPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an obj...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ensure the dialog container fillstretches to the viewport
function stretchDialogContainerToViewport(container, options) { var isFixed = $window.getComputedStyle($document[0].body).position == 'fixed'; var backdrop = options.backdrop ? $window.getComputedStyle(options.backdrop[0]) : null; var height = backdrop ? Math.min($document[0].body.clientHeight, Math.c...
[ "function stretchDialogContainerToViewport(container,options){var isFixed=$window.getComputedStyle($document[0].body).position=='fixed';var backdrop=options.backdrop?$window.getComputedStyle(options.backdrop[0]):null;var height=backdrop?Math.min($document[0].body.clientHeight,Math.ceil(Math.abs(parseInt(backdrop.he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all answer ids for specified user
async function getUserAnswers(username) { const answers = (await client.search({ index: INDEX_ANSWERS, size: 1000, body: { query: { match: { "user": username } } } }))['hits']['hits']; if(answers.length == 0) { return []; } else { let aids = []; // lmao ...
[ "function findAllUserReminderIndices(userId) {\n\tvar reminderIdc = [];\n\n\tfor (var i = 0; i < reminders.length; i++) {\n\t\tif (reminders[i].userId == userId)\n\t\t\treminderIdc.push(i);\n\t}\n\n\treturn reminderIdc;\n}", "async function getUserQuestions(username) {\n const questions = (await client.search(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var moveButtons=" " + " " + " " + " " + " " + " "; Move only the selected elements from one select to another. Returns a jQuery object containing the moved elements. Private.
function moveSelectElem( oFrom, oTo ){ var myclass=$(oFrom+ " "+'option:selected').hasClass("grey02"); if(myclass){ jQueryAlert('Cannot remove approved or completed items', false); }else{ return $( ":selected", $( oFrom )).detach().appendTo( $( oTo ));...
[ "function dvrMoveAll( select1, select2)\n{\n\nvar optsel;\nvar newOpt;\nvar nbopt;\nvar i;\n// on recupere l'index de l'option selectionnee\nnbopt=select1.length;\n\nfor(i=0; i < nbopt;i++)\n\t{\n\t// on recupere l'option en cours\n\toptsel=select1.options[i];\n\n\t// on creer une nouvelle option\n\tnewOpt = new Op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the glyph dictionary
getGlyphDictionary() { return this.glyphDictionary; }
[ "get Glyphs() {\n const glyphs = new ImVector();\n this.native.IterateGlyphs((glyph) => {\n glyphs.push(new ImFontGlyph(glyph)); // TODO: wrap native\n });\n return glyphs;\n }", "function mapGlyphs(g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finaliza compra do Cliente status='realizada'
async finalizaCompra(req, res) { /* #swagger.tags = [ "Clientes" ] #swagger.description = 'Endpoint que conclui a compra do cliente, modificando o status da compra para realizada' #swagger.security = [{ "apiKeyAuth": [] }] #swagger.responses[200] = { descrip...
[ "function finalizar() {\n temporizador(\"off\");\n crearMensaje(\"finalizar\");\n}", "function finalizarCompra(){\n rl.question(\"Deseja finalizar a compra?\\n 1- Sim\\n 2- Não\\n\", (opcao) => {\n if(opcao === \"1\"){\n console.log(chalk.yellow(`Yeeew! Sua compra foi finalizada! Obriga...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update SubUser by id
updateSubUserByID({ commit }, subUser) { return SubUserService.updateSubUserByID(subUser).then( res => { if (res.status === 200) { commit('updateSubUserList', subUser); commit('updateSubUserByIDSuccess'); } else { if (res.response == undefi...
[ "update(id, user) {}", "async updateUserByID(user) {}", "updateUser(id, data) {\n return Api().patch(\"/users/\" + id, data);\n }", "function updateUser(info, id) {\n return db('users')\n .where({id})\n .update(info);\n}", "updateSubription (json: jsonUpdateSub, callback: mixed) {\n\t\tlet val = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funckija za racunanje uspjesnosti zadataka ukoliko je ispod 50% prikazuje se crvenom bojom, ukoliko je iznad zelenom ukoliko nemamo zadataka, ne prikazuje se na stranici takodje se mijenja na osnovu pretrage i prilagodjava trenutnim rezultatim
function uspjesnost() { let brojRijesenih = 0; let procenat = 0; zadaci.forEach(zadatak => { if (zadatak.zavrsen === true) { brojRijesenih++; } }) procenat = ((brojRijesenih / zadaci.length) * 100).toFixed(2); if (procenat < 50) { document.getElementById("us...
[ "function sugeneruokSkaiciuNuo10iki100() {\n var atsitiktinisSkaicius = Math.random();\n atsitiktinisSkaicius = atsitiktinisSkaicius * 90 + 10;\n // atsitiktinisSkaicius *= 100;\n atsitiktinisSkaicius = Math.round( atsitiktinisSkaicius );\n return atsitiktinisSkaicius; // sita reiksme atsiras ten, k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
objectify turns an array of numbers into an array of objects, the first property of which (value) is the number, and the second property of which (quant) is the number of times the value appears in a row. It also refreshes an array of objects
objectify(array) { // if it is the array of numbers if (typeof array[0] === 'number') { const target = []; let counter = 0; for (let i = 0, len = array.length; i < len; i++) { counter += 1; if (array[i] !== array[i + 1]) { target.push({ value: array[i], quant: counter ...
[ "function incrementValues(object) {\n let outputObj = new Object();\n each(object, function(element, index) {\n if(typeof element === \"number\") {\n outputObj[index] = element + 1;\n }else {\n outputObj[index] = element;\n }\n\n });\n return outputObj;\n}", "function incrementN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allocate new models array removing models not present in the index.
function _reallocate( collection, removed ){ var prev = collection.models, models = collection.models = Array( prev.length - removed ), _byId = collection._byId; for( var i = 0, j = 0; i < prev.length; i++ ){ var model = prev[ i ]; if( _byId[ model.cid ] ){ ...
[ "@action spliceModels(ids = []) {\n ids.forEach((id) => {\n const model = this.getModel(id);\n if (!model) return;\n\n this.models.splice(this.models.indexOf(model), 1);\n })\n }", "@action\n spliceModels(ids = []) {\n ids.forEach(id => {\n const model = this.get(id);\n if (!mo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Interfaces: utf8 = utf16to8(utf16); utf16 = utf16to8(utf8);
function utf16to8(str) { var out, i, len, c; out = ""; len = str.length; for(i = 0; i < len; i++) { c = str.charCodeAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { out += str.charAt(i); } else if (c > 0x07FF) { out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); out += String.fromChar...
[ "function utf16to8(str){var out,i,len,c;out=\"\";len=str.length;for(i=0;i<len;i++){c=str.charCodeAt(i);if(c>=1&&c<=127)out+=str.charAt(i);else if(c>2047){out+=String.fromCharCode(224|c>>12&15);out+=String.fromCharCode(128|c>>6&63);out+=String.fromCharCode(128|c>>0&63)}else{out+=String.fromCharCode(192|c>>6&31);out+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
between the two points in 3D by given coordinates.
function distanceBetween3DPoints(coordinates) { let x1 = coordinates[0]; let y1 = coordinates[1]; let z1 = coordinates[2]; let x2 = coordinates[3]; let y2 = coordinates[4]; let z2 = coordinates[5]; let distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2 + (z1 - z2) ** 2); console.log(...
[ "function getVectorBetweenTwoPoints(x0,y0,z0, x1,y1,z1)\n{\n var vector = new Array(x1-x0, y1-y0, z1-z0);\n return vector;\n}", "function between(x1, y1, x2, y2){\n\t\t// Local variables for calculation\n\t\tvar vector, x, y;\n\n\t\tx = x2 - x1;\n\t\ty = y2 - y1;\n\t\tvector = newVector(x, y);\n\n\t\treturn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
request Asteroid data until endDate from NeoAsteroids
function getAsteroids() { return rp({ url: `https://api.nasa.gov/neo/rest/v1/feed?end_date${endDate}&api_key=${process.env.NASA_API_KEY}`, json: true }) .then(response => { // all data asteroids = response; // this gives us the dates and sorts them datesQueried = Object.keys(aste...
[ "async function getApiAsteroid() {\n let d = new Date();\n let month = (d.getMonth()) + 1;\n let day = d.getDate();\n let year = d.getFullYear();\n var date = `${year}-${month}-${day}`;\n let apiKey = \"f5oRMiVGZ9rWbjcjmxWkOFanJ0bTORX63pEubMrJ\";\n let response = await fetch(`https://api.nasa.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if it does not. Passwords must abide by the following requirements: More than 3 characters but less than 20. Must contain only alphanumeric characters. Must contain letters and numbers.
function validPass(password) { return password.length > 3 && password.length < 20 && /^(?=\D*\d)(?=[^a-z]*[a-z])[a-z\d]+$/i.test(password) ? "VALID" : "INVALID"; }
[ "function validPass(password){\n if (password.length <= 3 || password.length >= 20) return \"INVALID\";\n if(!(password.match(/[0-9]/)) || !(password.match(/[a-zA-z]/))) return \"INVALID\";\n return /^[A-Za-z0-9]*$/.test(password) ? \"VALID\" : \"INVALID\";\n}", "function validPassword(d) {return (d.includes(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if JupyterLab extensions listed in package.json are properly included into the bundle in "extensions/index.ts"
function checkExtensionImports() { console.log('Checking for missing extension imports...'); const pkgjsonFileData = fs.existsSync(pkgjsonFilePath) ? fs.readJSONSync(pkgjsonFilePath) : undefined; if (!pkgjsonFileData) { console.error("package.json not found!"); process.exit(...
[ "function isLabExtension(pkg){\n try {\n // for now, just try to load the key... could check whether file exists?\n pkg['jupyter']['lab']['main']\n return true;\n } catch(err) {\n return false;\n }\n}", "function validate_extension(pkg){\n try {\n // for now, just try to load the key... could c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add a click callback to every icon in server generated list of saved icons
function register_iconlist_callback() { var icons = document.querySelectorAll(".icon-list-item img"); for (var i=0; i<icons.length; i++) { icons[i].addEventListener("click", load_icon); } }
[ "function iconSetting() {\n\tvar icon = document.getElementsByClassName(\"icon\")[0];\n\tEventUtil.addHandler(icon, \"click\", oneByOne(0));\n}", "function init(){\r\n\tclickIcons();\r\n}", "function recordIconClick(event) {\n iconClicked = event.target.getAttribute(\"src\");\n event.target.classList.add(\"on...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This class contains information about any Media errors.
function MediaError() { this.code = null, this.message = ""; }
[ "function MediaError() {\n this.code = null,\n this.message = \"\";\n}", "function MediaError() {\n\tthis.code = null;\n\tthis.message = \"\";\n}", "function getMediaError(error) {\n console.log(\"An error occured! \" + error);\n }", "function onMediaError(e) {\n console.log(\"media e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Axios options used when calling axios.post() to talk with a full node.
getAxiosOptions () { return { method: 'post', baseURL: process.env.RPC_BASEURL, timeout: 15000, auth: { username: process.env.RPC_USERNAME, password: process.env.RPC_PASSWORD }, data: { jsonrpc: '1.0' } } }
[ "get axiosOptions() {\n return this.requestInfo().axiosOptions;\n }", "async post(options) {\n return await this.axiosClient.request({\n method: 'post',\n url: options.url,\n data: options.params,\n headers: options.headers\n }).then((response) =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructor of CanvasExercise class.
function CanvasExercise(canvasElementId) { var canvasWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var imageSrc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; var lineWidth = arguments.length > 3 && arguments[3] !== undefined ? argumen...
[ "constructor(canvas, tileSize, tileSizeX = tileSize) {\n if (typeof canvas === \"object\") {\n this.canvas = canvas;\n } else if (typeof canvas === \"string\") {\n let element = document.querySelector(canvas);\n if (!element) throw new Error(`Coudln't find canvas element '${canvas}'!`);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make sure filename is an array
function getFiles(names) { return (names && names.constructor == Array) ? names : [names]; }
[ "function getFiles(names) {\n return (names && names.constructor == Array) ? names : [names];\n }", "function getFiles(names) {\n\treturn (names && names.constructor == Array) ? names : [names];\n}", "function validateFiletype(filetypeArray, filetype) \r\n{\r\n\tvar filetypeLowerCase = filetyp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clones the given LexicalEnvironment
function cloneLexicalEnvironment(environment) { return { parentEnv: environment, env: {} }; }
[ "function cloneEnvironment (env) {\n var clonedEnv = {}\n\n for (var key in env) {\n if (env.hasOwnProperty(key)) {\n clonedEnv[key] = env[key]\n }\n }\n\n return clonedEnv\n}", "function environment(parent) {\n this.symbols = new Array();\n this.parent = parent;\n}", "function lisp_make_env(pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add New Shape to Shape Layer
function addTheShape (shapeLayer, grpName, shapeSet, fillColor, shapesPosition, shapeScale) { // ADD SHAPE GROUP var shapeGroup = shapeLayer.property("ADBE Root Vectors Group") .addProperty("ADBE Vector Group"); // NAME SHAPE GROUP shapeGroup.name = grpName; // ADD PATH var shapePath = shapeGroup.pr...
[ "addShape(shape) {\n this.shapes.push(shape);\n }", "addShape(shape) {\n this.shapes.push(shape);\n this.draw();\n }", "function addTheShape (shapeLayer, grpName, shapeSet, fillColor, shapesPosition, shapeScale) {\n\n\t\t// ADD SHAPE GROUP\n\tvar shapeGroup = shapeLayer.property(\"ADB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: check is this still in use? Method to set the number of available scenarios
function setScenarioCounts(scenCounts) { scenarioCounts = scenCounts; }
[ "function setNumberOfCards() {\n switch (levelSelected) {\n case 'easy':\n numberOfCards = 6;\n break;\n case 'medium':\n numberOfCards = 12;\n break;\n case 'hard':\n numberOfCards = 20;\n break;\n default:\n numberOfCards = 6;\n levelS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the color of the pad
color (pad, color) { return this.set(0x10, pad, colors[color.toUpperCase()]) }
[ "function setPadColor(pad, color) {\n\tlet padHex = (112 + pad)//.toString(16);\n\treturn new Uint8Array( [ 0xF0, 0x00, 0x20, 0x6B, 0x7F, 0x42, 0x02, 0x00, 0x10, padHex, color, 0xF7 ] );\n}", "set mainColor(value) {}", "setBlack() { this.setColor(0, 0, 0); }", "function setBackgroundColor(color) {\n \n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Game ticker, update fps and update stage
function onTick(e) { // TESTING FPS document.getElementById('fps').innerHTML = createjs.Ticker.getMeasuredFPS(); // update the stage! stage.update(); }
[ "function frameRate(fps) {\n timer = window.setInterval(updateCanvas,1000/fps);\n }", "function updateSpeed() {\n fps += 10;\n }", "function handleTick(evt)\n{\n stage.update(evt);\n}", "function tick(){\r\n\t\r\n\t//check for highscore display screen\r\n\tif(current_screen >= 50){\r\n\t\tlet...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the current test is being ran with withStubs(), this points to the sinon context's stub() method.
get stub() { return this._stub }
[ "clearStubs() {\n sinon.restore()\n }", "function stub_for(method_name) {\n function method_missing_stub() {\n // Copy any given block onto the method_missing dispatcher\n this.$method_missing.$$p = method_missing_stub.$$p;\n\n // Set block property to null ready for the next call (stop fals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function is used to process the showing of qrcode within an interval
function processQr() { document.getElementById('qrCode0').style.display='block'; document.getElementById('result').innerHTML='20'; enableScroll(); startTimer(20); var num = 0; var myVar = setInterval(function() { document.getElementById('qrCode'+n...
[ "function qrScanPoints() {\n let lastResult, countResults = 0;\n\n function onScanSuccess(decodedText) {\n if (decodedText !== lastResult) {\n ++countResults;\n lastResult = decodedText;\n // Handle on success condition with the decoded message\n if (!isNaN(d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends creates a listitem link to `uri` with `text` and appends it to `parent`
function WL_appendHiddenLink(parent, text, uri) { var listItem = document.createElement('li'); var linkItem = document.createElement('div'); var listLink = document.createElement('a'); listLink.setAttribute('class', 'waybackLinks WLItem'); listLink.href = uri; listLink.innerHTML = text; lin...
[ "function createListItem(parent, id, style, text){\n\tvar li = createElementNode('li', id, style);\n\tsetNodeContent(li, text);\n\tparent.appendChild(li);\n\treturn li;\n}", "function createAndAppendLink(href, place, content, parent){\n\tconst newElem = document.createElement('p');\n\tnewElem.textContent = `Link ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flag the feature tour as shown.
featureTourShown() { this.state.preferences.unset('showFeatureTour'); this.state.preferences.save(null, { success: () => { this.trigger(this.state); } }); }
[ "function showTour() {\n $state.go('default.projects');\n\n $timeout(function () {\n $rootScope.tourOn = true;\n }, 100);\n showStep(0);\n }", "showFertilityLayer () {\n this.showFertility = !this.showFertility\n this.showMoisture = false\n }", "function toggle_f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the time in stopwatch
function setStopwatch(hours, minutes, seconds, milliseconds){ jQuery("#hours").html(prependZero(hours, 2)); jQuery("#minutes").html(prependZero(minutes, 2)); jQuery("#seconds").html(prependZero(seconds, 2)); jQuery("#milliseconds").html(prependZero(milliseconds, 3)); }
[ "function setStopwatch(hours, minutes, seconds, milliseconds){\n $(\"#hours\").html(prependZero(hours, 1));\n $(\"#minutes\").html(prependZero(minutes, 2));\n $(\"#seconds\").html(prependZero(seconds, 2));\n }", "function setStopwatch(hours, minutes, seconds, milliseconds){\r\n $(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get other participant's userid
async getotherid(convid, userid){ try { var conv = await Conversation.findById(convid); } catch (err) { throw err; } return conv.participants[0] == userid ? conv.participants[1] : conv.participants[0]; }
[ "function getAnotherUser(){\n //find all userids in this chat rooms\n var arr = Chat.findOne({_id: Router.current().params.chatRoomId}).chatIds;\n \n //find and remove the userid of the current user\n var currentUserIdIndex = arr.indexOf(Meteor.userId());\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
9.5 Load burn down chart data
function fetchBurnDownData() { var burndownChart = document.getElementById("burndownChart"); loadChartSpinner(burndownChart); var ctx = burndownChart.getContext("2d"); $.ajax({ url: "Handler/ChartHandler.ashx", data: { action: "getBurnDownChart", projectID: projec...
[ "function loadManualData() {\n self.currentData = $.map(self.options.x, function(xVal, index) {\n return { 'x': self.options.x[index],\n 'y': self.options.y[index],\n 'index': index,\n 'added': false,\n 'selected': false\n };\n });\n self.re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
callback to getposts rpc when updating the timeline process the received posts (adding them to screen) and do another request if needed
function processReceivedPosts(req, posts) { //console.log('processReceivedPosts:'); //console.log(posts); //hiding posts can cause empty postboard, so we have to track the count... for( var i = 0; i < posts.length; i++ ) { if (willBeHidden(posts[i])) { req.reportProcessedPost(posts[i...
[ "function loadedPosts(e) {\n //don't clear if the url's got a timestamp marker in it, indicating \"load more posts\"\n if (e.target.responseURL.search(\"&before=\") < 0) postgrid.innerHTML = \"\";\n //console.log(e.target.response);\n let json = JSON.parse(e.target.response);\n let postdelay = 0;\n for (const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New item, update array and map for the type
onNewItem(item, type) { const { items, itemMaps } = this.state; items[type].push(item); Form.updateItemMap(type, itemMaps[type], items[type].length - 1, item.r, item.c, item.h, item.w); this.setState({ items, itemMaps, }); }
[ "function updateElementOfTypeArray(initialEntityObj, newEntityObj) {\n var type_id = (initialEntityObj.type_id.toUpperCase() != newEntityObj.type_id.toUpperCase()) ? true : false;\n var name_ru = (initialEntityObj.name_ru != newEntityObj.name_ru) ? true : false;\n var name = (initialEntityObj.name != newEn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate top of ETR480
function generateTop480(){ var height = 0.9; var Su0 = BEZIER(S0)([[0,0,0],[trainLength-0.13,0,0]]); var Su1 = BEZIER(S0)([[0,trainWidth,0],[trainLength-0.13,trainWidth,0]]); var control2 = [[0,0,0],[0,0,height],[0,trainWidth,height],[0,trainWidth,0]]; var Sv0 = BEZIER(S1)(control2); var control3 = [[trainL...
[ "function drawTunnelTop() {\n for (var i = 0; i < numTracks; i++) {\n drawImage((i * trackWidth) + trackGap / 8 + gameMargin, 60, tunnelTop, trackWidth - trackGap / 4, 75);\n }\n}", "function genFrontSide480(){\r\n\tvar adjust = 0.4;\r\n\tvar adjustBase = 0.15;\r\n\tvar leng = 3;\r\n\tvar height = 0.9;\r\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On keyboard close sets keyboard state to closed, resets the scroll view, removes CSS from body indicating keyboard was open, removes any event listeners for when the keyboard is open and on Android blurs the active element (which in some cases will still have focus even if the keyboard is closed and can cause it to rea...
function keyboardHide() { clearTimeout(keyboardFocusOutTimer); //console.log("keyboardHide"); ionic.keyboard.isOpen = false; ionic.keyboard.isClosing = false; if (keyboardActiveElement || lastKeyboardActiveElement) { ionic.trigger('resetScrollView', { target: keyboardActiveElement || lastKeyboardA...
[ "function keyboardHide() {\n clearTimeout(keyboardFocusOutTimer);\n //console.log(\"keyboardHide\");\n\n ionic.keyboard.isOpen = false;\n ionic.keyboard.isClosing = false;\n\n if (keyboardActiveElement) {\n ionic.trigger('resetScrollView', {\n target: keyboardActiveElement\n }, true);\n }\n\n ioni...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if survey was saved locally in order to prepopulate answers also checks if saved draft has expired, if so deletes from local storage
async checkSavedDraftEntry(surveyId, mrn, suppressNetwork) { var expireTime = localStorage.getItem(mrn + surveyId + "_expire"); if (expireTime != null && expireTime !== "") { const expTime = moment(expireTime, "MM/DD/YYYY HH:mm:ss"); const now = moment(); if (expTime != null && expTime.is...
[ "function saveAnswers(){\n localStorage.setItem(\"quiz_answers\", getAnswers());\n }", "function deleteSave() {\n localStorage.removeItem(\"savedQuiz\");\n}", "saveQuestion() {\n\t\tif (typeof(Storage) == undefined) {\n\t\t\talert(\"Você precisa habilitar o uso de cookies antes de usar o site...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Vertical Barchart accept [values0, values1, values2, values3]: 0 will be current (bar chart), 1, 2 is holt winter bands and 3 represents the statusMsg
function VBarchart(paper, x, y, width, height, values, opts) { opts = opts || {}; var chartinst = this, type = "square", gutter = parseFloat(opts.gutter || "20%"), chart = paper.set(), bars = paper.set(), covers = paper.set(), covers2 = paper.set(), total = Math.max.apply(Math, values), col...
[ "function chartBarVertical(placeholder) {\n\t\tvar basic = [\n\t\t\t[gt(2013, 10, 21), 188], [gt(2013, 10, 22), 205], [gt(2013, 10, 23), 250], [gt(2013, 10, 24), 230], [gt(2013, 10, 25), 245], [gt(2013, 10, 26), 260], [gt(2013, 10, 27), 290]\n\t\t];\n\n\t\tvar gold = [\n\t\t\t[gt(2013, 10, 21), 100], [gt(2013, 10, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define an action creator here:
function actionCreator() { return action }
[ "function actionCreator() {return action}", "function actionCreator() {\n return action\n}", "function actionCreator() {\n\treturn action;\n}", "function actionCreator() {\n return action;\n}", "function actionCreator(){\n return action;\n }", "function actionCreator() {\n return action;\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Testing for intersection between: 2D Circle and a 2D ray
function intersect_Circle_Ray2d (pCircle, pRay) { var vecQ = Vec2.create(); vecQ.X = pRay.v2fPoint.X - pCircle.v2fCenter.X; vecQ.Y = pRay.v2fPoint.Y - pCircle.v2fCenter.Y; var c = Vec2.lengthSquare(vecQ) - pCircle.fRadius * pCircle.fRadius; if (c < 0.0) { return 0.0; } var b = Vec2.d...
[ "function getIntersection(ray,segment){\n\n\t// RAY in parametric: Point + Delta*T1\n\tvar r_px = ray.a.x;\n\tvar r_py = ray.a.y;\n\tvar r_dx = ray.b.x-ray.a.x;\n\tvar r_dy = ray.b.y-ray.a.y;\n\n\t// SEGMENT in parametric: Point + Delta*T2\n\tvar s_px = segment.a.x;\n\tvar s_py = segment.a.y;\n\tvar s_dx = segment....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When authenticated, success will be true and fail will be false. When not authenticated, vice versa.
function authenticate() { success.value = true; fail.value = false; setTimeout(setLoggedIn, 100); }
[ "function isAuthorized(username, password) {\n var status = false; \n \n //...\n \n return status;\n}", "function printSuccess() { console.log(\"Authentication Succeeded\"); }", "isAuthenticated() {\n return !!this.credentials;\n }", "function authentication(a,b){\n for(var i=0; ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: deleteValueFromNote DESCRIPTION: removes the given value from a list within a design note. ARGUMENTS: fileURL the design note to remove the value from countvar the variable within the design note, which contains a count of the number of items for the given name name the prefix for the list of items value the ...
function deleteValueFromNote(fileURL,countvar,name,value) { if (fileURL.length) { // Make sure the variable names begin with "UD_" if (countvar.length < 3 || countvar.substr(0, 3) != "UD_") { countvar = "UD_" + countvar; } if (name.length < 3 || name.substr(0, 3) != "UD_") { name = "UD_" ...
[ "function addValueToNote(fileURL,countvar,name,value, bCaseInSensitive) {\n if (fileURL.length) {\n\n // Make sure the variable names begin with \"UD_\"\n if (countvar.length < 3 || countvar.substr(0, 3) != \"UD_\") {\n countvar = \"UD_\" + countvar;\n }\n if (name.length < 3 || name.substr(0, 3) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls `onUnauthorized` function if provided or hide element
function onUnauthorizedAccess() { if (angular.isFunction(permission.onUnauthorized)) { permission.onUnauthorized()($element); } else { PermissionStrategies.hideElement($element); } }
[ "function handleUnauthorized() {\n var authorizeButton = document.getElementById('authorize-button');\n var runDemoButton = document.getElementById('make-api-call-button');\n\n runDemoButton.style.display = 'none';\n authorizeButton.style.display = 'block';\n authorizeButton.onclick = handleAuthClick;\n outpu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
these functions are used only by the STANDARD editor (not IE) function to edit a template
function Tedit(templateid) { Tjump("edit&templateid=" + templateid + "&dostyleid=" + EXPANDSET + "&group=" + GROUP); }
[ "function loadTemplate() {\n htmlEditor.setValue('<!DOCTYPE html>\\n<html>\\n<head>\\n<title>HTML, CSS and JavaScript demo</title>\\n</head>\\n<body>\\n<!-- Start your code here -->\\n\\n<p class=\\\"lw\\\">Hello Weaver!</p>\\n\\n<!-- End your code here -->\\n</body>\\n</html>');\n cssEditor.setValue(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the legend cfg from theme, will mix the common cfg of legend theme
function getLegendThemeCfg(theme, direction) { var legendTheme = util_1.get(theme, ['components', 'legend'], {}); return util_1.deepMix({}, util_1.get(legendTheme, ['common'], {}), util_1.deepMix({}, util_1.get(legendTheme, [direction], {}))); }
[ "function getLegendThemeCfg(theme, direction) {\n var legendTheme = util_1.get(theme, ['components', 'legend'], {});\n return util_1.deepMix({}, util_1.get(legendTheme, ['common'], {}), util_1.deepMix({}, util_1.get(legendTheme, [direction], {})));\n}", "function getLegendThemeCfg(theme, direction) {\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
only call when bottomFlag < topFlag
upChangeTransition(topFlag) { this.redraw = false; if(topFlag > this.peekRedrawStack()) { this.pushRedrawStack(topFlag); return true; } return false; }
[ "get isTop() { return (this.flags & 1 /* Top */) > 0; }", "get isTop() { return (this.flags & 1 /* NodeFlag.Top */) > 0; }", "CantGoOverBottom() {\r\n if (this.y >= this.bottomBoundary) {\r\n this.y = this.bottomBoundary;\r\n }\r\n }", "hitTop() {\n if (this.y <= 1) {\n this.y = 1;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move any remaining htmlImports that are not inside the hidden div already, into the hidden div.
_moveUnhiddenHtmlImportsIntoHiddenDiv(ast) { const unhiddenHtmlImports = dom5.queryAll(ast, dom5.predicates.AND(matchers.eagerHtmlImport, dom5.predicates.NOT(matchers.inHiddenDiv))); for (const htmlImport of unhiddenHtmlImports) { parse5_utils_1.removeElementAndNewline(htmlImport); ...
[ "_moveOrderedImperativesFromHeadIntoHiddenDiv(ast) {\n const head = dom5.query(ast, matchers.head);\n if (!head) {\n return;\n }\n const firstHtmlImport = dom5.query(head, matchers.eagerHtmlImport);\n if (!firstHtmlImport) {\n return;\n }\n for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An UserEventHandlerProxy is a proxy object to manipulate multiple instances of UserEventHandlers as one.
function UserEventHandlerProxy() { this.items = []; }
[ "function eventProxy(e) {\n return this._listeners[e.type](options.event && options.event(e) || e);\n }", "function eventProxy(event) {\n this._listeners[event.type](event);\n}", "async subscribeToChannelFollowEvents(user, handler) {\n const userId = common_1.extractUse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method blocks the user to be able to access directly the 'fake' attribute hotels avoiding that way they can overwrite the list of hotels
set hotels(_) { throw new Error('You can not overwrite hotels!'); }
[ "function setAllUseApiExplodingHoof() {\n // Get all the characters.\n let characters = findObjs({\n _type: 'character'\n });\n\n _.each(characters, character => {\n let charId = character.get('_id');\n // Try to get the attribute for the character.\n let attr = findObjs({\n _...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SQLite3: Column Builder & Compiler Schema Compiler
function SchemaCompiler_SQLite3() { _compiler.default.apply(this, arguments); }
[ "function SchemaCompiler_SQLite3() {\n _compiler2.default.apply(this, arguments);\n}", "function SchemaCompiler_SQLite3() {\n\t _compiler2.default.apply(this, arguments);\n\t}", "generateSchema(dbName, tableCB, columnCB) {\n tableCB = tableCB || function() {};\n columnCB = columnCB || function() {};\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fills the slider with items
fillWithItems() { if (this.getIsFilled()) return; for (let i = 0; i < this.options.maxItems; i += this.initialItemElements.length) { if (this.getIsFilled()) break; const cell = insertElement(this.slider, this.options.classNames.cell); this.initialItemElements.forEach(item => this.addClone(item...
[ "generateItems() {\r\n const itemCount = slider.value;\r\n let colors = this.generateColors(itemCount);\r\n while (screenDiv.firstChild) {\r\n screenDiv.removeChild(screenDiv.lastChild);\r\n }\r\n for (let i = 0; i < itemCount; i++) {\r\n let div = document.createElement(\"div\");\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set graph to previous graph and jump to prev anchor
function prevGraph() { if(graphIndex === 0) { graphIndex = 4; } else { graphIndex--; } switchGraph(); location.href = '#prev-button'; }
[ "function previousSubGraph(){\n if(currentIndex > 0){\n currentIndex -= 1\n loadNewGraph(currentTactic.graphs[currentIndex])\n updateGraphNav()\n }\n}", "function prevState() {\n // if go out of bounds, keep at first state\n stateIndex = Math.max(0, stateIndex - 1);\n updateGra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }