query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Get the AudioContext. Assuming this would be called when it's time to play.
getContext() { if (!this.audioContext) { let AudioContext = window.AudioContext || window.webkitAudioContext; this.audioContext = new AudioContext(); this.audioContext.resume(); } return this.audioContext; }
[ "function WebAudioExtended() {\n window.AudioContext = window.AudioContext || window.webkitAudioContext;\n /* global AudioContext */\n this.context = new AudioContext();\n this.soundBuffer = null;\n}", "get sampleRate() {\n if (this._buffer) {\n return this._buffer.sampleRate;\n } else {\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function determinesTimeState purpose: given an input hour, the function will determine where it occurs in relation to the current hour input: inputHour is the hour to compare to current hour return: string: "past" if the input hour occurs before the current hour "present" if the input hour is the same as the current ho...
function determineTimeState(inputHour) { let currentHour = moment().format("H"); if (inputHour < currentHour) return "past"; if (inputHour == currentHour) return "present"; if (inputHour > currentHour) return "future"; }
[ "function checkColor(hour) {\n let now = moment().format('h A');\n let momentTime = moment(now, 'h A');\n let laterMomentTime = moment(hour, 'h A');\n\n\n if (momentTime.isBefore(laterMomentTime)) {\n return \"future\";\n } else if (momentTime.isAfter(laterMomentTime)) {\n return \"past...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clicking on word adds properties of image to word
function handleWordClick(event) { // get letter associated with image let image = document.getElementById("image").src.substring(57,58) console.log("image name", image) let word = event.target.value console.log("word selected", word) for (let i=0; i<8; i++) { wordList[word][i]+=images[image][i] } ...
[ "function addImageAndText(annotationID, objectUrl, x, y, w, h, startOffset, startOffsetXpath, endOffset, endOffsetXpath, editable) {\r\n var image_iframe = document.getElementById('image-input');\r\n var rectDiv = image_iframe.contentWindow.document.createElement(\"div\");\r\n if (editable == true) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called by PluginManager upon receiving the __FxComponentLoadComplete event
function onLoaded() { Media.log('PluginComponent::onLoaded ' + id()); assert(pluginObj); pluginObj.onObjectLoaded(); }
[ "function loadComponent() {\n Media.log('PluginComponent::loadComponent ' + id());\n assert(state() == PluginComponent.State.Loading);\n assert(pluginObj.state() == Media.PluginObject.State.Attached);\n var args;\n try {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enables overseeing in tableview. Retrieves snapshot images from server and displays in a pulldown menu
function overseeInTable() { var maxHeight = ($(window).width()/6)/1.6 $("#menuContainer").resizable({maxHeight:maxHeight}); getCafeTables(cafe, function (response) { var cafes = JSON.parse(response); if(cafes.hasOwnProperty('error')) { console.log(cafes.er...
[ "function menuImageClick() {\n Data.Edit.Mode = EditModes.Image;\n updateMenu();\n}", "function mouseover_table(){\n $(\".profile tr\").not(':first').hover(\n\t\tfunction () {\n\t\t\t$(this).contents().find(\"img.help\").show();\t\n\t\t}, \n \t\tfunction () {\n\t\t\t$(this).find(\"img.help:last\").hide();\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get DIDs of those who have confirmed the given claim entries
getConfirmerIds(req, res) { const claimEntryIds = req.body.claimEntryIds ClaimService.retrieveConfirmersForClaimsEntryIds(claimEntryIds) .then(results => hideDidsAndAddLinksToNetwork(res.locals.tokenIssuer, results)) .then(results => { res.json({ data: results }).end() }) .catch(err => {...
[ "ListOfAuthorizedDeferredPaymentAccountForThisCustomer() {\n let url = `/me/paymentMean/deferredPaymentAccount`;\n return this.client.request('GET', url);\n }", "function getActiveUsersIds(channel_members){\n var ids_to_be_returned = [];\n if(channel_members){\n var y;\n for(y in channel_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a new ``uint8`` type for %%v%%.
static uint8(v) { return n(v, 8); }
[ "static bytes8(v) { return b(v, 8); }", "static uint(v) { return n(v, 256); }", "static int8(v) { return n(v, -8); }", "static uint88(v) { return n(v, 88); }", "static uint24(v) { return n(v, 24); }", "static uint240(v) { return n(v, 240); }", "static uint256(v) { return n(v, 256); }", "static uint168...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add functionality to delete buttons created with the tasks
function addDeleteBtns() { let deleteTasks = document.querySelectorAll('input[type="image"]'); deleteTasks.forEach( task => { task.addEventListener('click', (e) => { let selectedId = e.target.dataset.id; //Select trash image id that was clicked let selectedTa...
[ "'click .delete'() {\n\t\tMeteor.call('tasks.remove', this._id, (error) => {\n\t\t\tif (error)\n\t\t\t\tBert.alert( 'An error occured: ' + error.reason + '! Only the creator of the task can delete it.', 'danger', 'growl-top-right' );\n\t\t\telse\n\t\t\t\tBert.alert( 'Task removed successfully!', 'success', 'growl-t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
used to store the location where color is picked / Function checks which side's div is clicked and pop put the colorSelectBox with the position of the div popping out
function colorFieldPicker(onClickSide,side){ onClickSide.on('click', function(event){ //store the class of the colorHolder to a global variable colorHolder = $(this).attr('class'); var yVal = (event.clientY) + "px"; var xVal = (event.clientX) + "px"; $...
[ "function userColorPicked(event) {\n clickColor = event.target.value;\n mouseClickBtn.style.backgroundColor = clickColor;\n clickButton.style.backgroundColor = clickColor;\n}", "function selectedColor(color){\n\n color.addEventListener('click', e=>{\n eliminarSeleccion();\n e.target.style.bord...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the user's phone number.
async function updatePhoneNumber(user, credential) { await _link$1((0, _util.getModularInstance)(user), credential); }
[ "function ChangePhone(username, newPhoneNum) {\n if (userIsExisting(username)) {\n var x = lib.UserJSON2Obj(user.LayRaMotUser(username));\n try {\n user.CapNhatThongTinUser(username, x.ten_user, x.ngay_sinh, x.gioi_tinh, newPhoneNum, x.email, x.pass);\n return true;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a boolean if the task exists in the project
hasTask(taskTitle){ return this._tasks.some(ele=>ele.title==taskTitle); }
[ "hasProject(name) {\n return this.allWorkspaceProjects.has(name);\n }", "function isQaTask(taskName) {\n var isQA = false;\n if (QATasks.has(taskName)) {\n isQA = true;\n }\n return isQA;\n }", "function isUserTask(taskProjectID, userProjectArray){\n for (var i = 0; i < user...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fn close video popup
function closePopupVideo() { $body.removeClass('overflow'); $overlayVideo.removeClass('open'); setTimeout(function () { player.stopVideo(); }, 250); }
[ "function w3_openvd() {\n\tdocument.getElementById(\"closevideo\").style.display = \"block\";\n}", "function closeOverlay(e) {\n if (isVideoOpen === true) {\n const mosVideoWrapper =\n document.getElementsByClassName(\"mos-video-wrapper\");\n const flipCardInner = document.getElementsByClassNa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new NoiseProceduralTexture
function NoiseProceduralTexture(name,size,scene,fallbackTexture,generateMipMaps){if(size===void 0){size=256;}if(scene===void 0){scene=BABYLON.Engine.LastCreatedScene;}var _this=_super.call(this,name,size,"noise",scene,fallbackTexture,generateMipMaps)||this;_this._time=0;/** Gets or sets a value between 0 and 1 indicati...
[ "function ProceduralTexture(name,size,fragment,scene,fallbackTexture,generateMipMaps,isCube){if(fallbackTexture===void 0){fallbackTexture=null;}if(generateMipMaps===void 0){generateMipMaps=true;}if(isCube===void 0){isCube=false;}var _this=_super.call(this,null,scene,!generateMipMaps)||this;_this.isCube=isCube;/**\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all event invitations by event id
async getInvitationsByEventId(req, res) { const userAuth = jwt_decode(req.token); const { event_id } = req.params; try { const user = await User.findOne({ cognito_id: userAuth.sub }); // Check if user exist if (!user) { return res.status(400)...
[ "function getEventAttendees(calendarName, eventid)\n{\n\tvar attendees = {\n\t\t\t'firstName': 'Test',\n\t\t\t'lastName': 'User'\n\t\t\t};\n\t\t\t\n\tvar myEvent = getEvent( calendarName, eventid );\n\t\n\treturn myEvent.attendees;\n}", "deleteInvites(invitedId) {\n return new Promise((resolve, reject) => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts an string of numbers to array of numbers e.g. extractIntegers("1 2 3") > [1, 2, 3]
function extractIntegers(srcstr) { return srcstr.split(" ").map((substr) => parseInt(substr)); }
[ "function getNumberArraysFromString(string) {\r\n\t let array = [];\r\n\t let re = /\\[(.*?)(?=\\])/g;\r\n\t let matches;\r\n\t do {\r\n\t matches = re.exec(string);\r\n\t if(matches)\r\n\t array.push(matches[1].split(',').map(Number));\r\n\t } while (matches);\r\n\t\r\n\t return array;\r\n\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`usersuser` model create event listener to send welcome email to user. It renders the `userwelcomeemail` template to provide the body of the welcome email. The rendered result provides HTML message content, and is stripped of HTML tags to provide plaintext content.
_sendWelcomeEmail(model, user) { this.log.debug('Sending welcome email to', user.email) var link if (user.password) { link = "http://"+application.config.baseUrl+this.baseUrl+"login" } else { link = "http://"+application.config.baseUrl+this.baseUrl+"login-link?token="+user.resetPasswordToken...
[ "function welcomeUser(user) {\n user.notify('Welcome ' + user.getName() + '!');\n}", "function welcomeUser() {\n let greeting = \"No Current User\";\n\n if (isLoggedIn === true) {\n greeting = \"Welcome, \" + currentUser.name;\n }\n\n return greeting;\n }", "async inviteUser () {\n\t\tthis....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Medium create a function that takes in four numbers. Add the first two numbers and return the remainder of dividing the sum of the first two numbers by the difference of the last two numbers
function complicatedMath(n1,n2,n3,n4){ return (n1+n2) % (n3-n4) }
[ "function remainderOfFives({ first, second }) {\n if (first === second) return 0;\n if (first % 5 === second % 5) return Math.min(first, second);\n return Math.max(first, second);\n}", "function fourNums(n1, n2, n3, n4){\n console.log (n1 + n2 - n3 - n4)\n}", "function divBy4(num){\n return num/4\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delta Y (current_y previous_y).
getDeltaY() { return (this.getPageY() - ((this.__prevState.pageY !== undefined) ? this.__prevState.pageY : this.getPageY())) * this.getScaleY(); }
[ "_decreaseY() {\n if (!this._invertedY()) {\n this.valueY = Math.max(this.minY, this.valueY - this.stepY);\n } else {\n this.valueY = Math.max(this.maxY, this.valueY - this.stepY);\n }\n }", "_increaseY() {\n if (!this._invertedY()) {\n this.valueY = Math.min(this.maxY, this.valueY + t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a panel footer with link
static panelFooter (text, pageUrl, absolute = false, refresh = false, widgetName) { return ( <div className='panel-footer'> {pageUrl && !absolute && <Link className='title-text' to={`/dashboard/${pageUrl}`}> {text} <i className='fa fa-chevron-right'></i> </Link> ...
[ "function makeNewFooter()\n {\n var wuLogo = document.createElement('img')\n wuLogo.setAttribute('src', 'http://icons.wxug.com/graphics/wu2/logo_130x80.png')\n wuLogo.setAttribute('class', 'img-responsive')\n\n var link = document.createElement('a')\n link.appendChild(wuLogo)\n link.setAttribute('href',...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Skip the playback of the current ad.
skip () { this._debug.log("skip"); // Skip the ad player if (this._vastPlayerManager) { this._vastPlayerManager.skip(); } }
[ "skipNext() {\n const { selectedSongIdx } = this.state\n const isAtLoopPoint = selectedSongIdx >= this.countTracks() - 1 ||\n selectedSongIdx < 0\n\n const songIdx = isAtLoopPoint ? 0 : (selectedSongIdx + 1)\n\n this.selectSong(songIdx)\n this.play(songIdx)\n }", "skip...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the next batch of 10 cities processed and display them
function top10Cities() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlht...
[ "async getCities(country) {\n // get yesterday's date\n const offset = new Date().getTimezoneOffset() * 60000;\n const yesterday = new Date(Date.now() - 86400000 - offset)\n .toISOString()\n .slice(0, -5);\n\n // complete request\n const query = `?country=${country}&parameter=pm25&date_from...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
moveSelectedOptions(select_object,select_object[,autosort(true/false)[,regex]]) This function moves options between select boxes. Works best with multiselect boxes to create the common Windows control effect. Passes all selected values from the first object to the second object and resorts each box. If a third argument...
function moveSelectedOptions(from,to) { // Unselect matching options, if required if (arguments.length>3) { var regex = arguments[3]; if (regex != "") { unSelectMatchingOptions(from,regex); } } // Move them over for (var i=0; i<from.options.length; i++) { var o = from.options[i]; if (o.selected) { ...
[ "function moveOptionDown(obj) {\n\tfor (i=obj.options.length-1; i>=0; i--) {\n\t\tif (obj.options[i].selected) {\n\t\t\tif (i != (obj.options.length-1) && ! obj.options[i+1].selected) {\n\t\t\t\tswapOptions(obj,i,i+1);\n\t\t\t\tobj.options[i+1].selected = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function moveSele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FETCH ALL ARCHIVED NOTES
async getAllArchivedNotes(req, res) { try { const archivedNotes = await Notes.find({isArchived: 'true', author: res.user.id.email, isDeleted: false}); logger.verbose( `Status: ${res.statusCode}: Successfully fetched all archived notes` ); return res.status(200).json(archivedNotes); ...
[ "loadNotesFromDB (context) {\n return db.notes.orderBy('dateModified').reverse().toArray().then((notes) => {\n console.log(`${notes.length} notes loaded from db`)\n return context.commit({\n type: 'setNotes',\n options: notes\n })\n })\n }", "function getAllText...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a section for the diagram and returns a pointer to its content
function createDiagramSection() { // Reviews hack: Only do it once if ($('#stroke_order').length == 0) { let sectionHTML = '<section><h2>Stroke Order</h2><div style="width:100%;overflow-x: auto; overflow-y: hidden"><svg id="stroke_order"></svg></div></section>' s...
[ "function notebookStructure(){\n return '<section><div class=\"container\"><div class=\"timeline\"><div class=\"timeline-hline\"></div>'+notebook_content+'</div></div></section>'\n}", "addNodeInDefinition() {\n let node = this.get('selectedNode');\n\n if (isNone(node)) {\n return;\n }\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets a refresh for the highlighting in 500ms.
function setRefreshTimeout() { clearRefreshTimeout(); _highlightTimeout = setTimeout( refreshCallback, 500 ); }
[ "_updateAutoHighlight(info) {\n const pickingModuleParameters = {\n pickingSelectedColor: info.picked ? info.color : null\n };\n const {\n highlightColor\n } = this.props;\n\n if (info.picked && typeof highlightColor === 'function') {\n pickingModuleParameters.pickingHighlightColor = h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO(lmr): Make modulus able to be an animated value
function AnimatedModulo(a,modulus){_classCallCheck(this,AnimatedModulo);var _this=_possibleConstructorReturn(this,Object.getPrototypeOf(AnimatedModulo).call(this)); _this._a=a; _this._modulus=modulus; _this._listeners={};return _this;}
[ "function mod_0_360(x) {return mod0Real(360, x);}", "function mod(x, n) {\n return (x % n + n) % n;\n}", "function privateNext() {\n\t \timageCurrent++;\n\t \tif (imageCurrent > image.length - 1) {\n\t \t\timageCurrent = 0;\n\t \t\tcontainer.animate({left: \"+=\" + (sliceWidth * image.length - sliceWidth)}, sp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST. Basically, the deletion can be divided into two stages: Search for a node to remove. If the node is found, delete the node. Note: Time complexity should be O(heigh...
function solution_1 (root, key) { if (!root) return null; // EDGE CASE: empty input // `find` UTILITY FUNCTION - recursively searches input tree for a node with value matching `key`. // if such a node exists, returns an array containing (1) the node, and (2) its pare...
[ "delete(val) {\n debugger\n let currentNode = this.root;\n let found = false;\n let nodeToRemove;\n let parent = null;\n\n // find the node we want to remove\n while (!found) {\n if (currentNode === null || currentNode.val === null) {\n return 'the node was not found'\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Will toggle the inverted property of the Budgie element
changeInversion(){ this.options.inverted = !this.options.inverted; }
[ "invert() {\n for (let i = 0; i < this._data.length; i++) {\n this._data[i] = ~this._data[i];\n }\n }", "setSide (side) {\n this.reversed = (side === 'b')\n }", "setInvertLightness(invertFlag) {\n this._inverse.set_enabled(invertFlag);\n }", "reverseVisibility(){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Property is to get whether the userAgent is IOS.
static get isIos() { return Browser.getValue('isIos', REGX_IOS); }
[ "function chkMobile() {\r\n\treturn /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);\r\n}", "function useTouch() {\n return isNativeApp() || $.browser.mobile || navigator.userAgent.match(/iPad/i) != null;\n}", "function simulateMacSafari3() {\n userAgent.MAC = true;\n userAgent.WINDOWS = false;\n user...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add fields from config.fields to object with information about one package. Only fields from field list will be returned in generated object.
function packageDataToReportData(packageData, config) { let finalData = {} // create only fields specified in the config config.fields.forEach(fieldName => { if ((fieldName in packageData)) { finalData[fieldName] = packageData[fieldName] } else { finalData[fieldName] = config[fieldName].value } }) re...
[ "function fieldFromDerivedFieldConfig(derivedFieldConfigs) {\n var dataLinks = derivedFieldConfigs.reduce(function (acc, derivedFieldConfig) {\n // Having field.datasourceUid means it is an internal link.\n if (derivedFieldConfig.datasourceUid) {\n acc.push({\n // Will be filled out later\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sorts stock by id values
function sortStock(a, b) { if (parseInt(a[0]) > parseInt(b[0])) return 1; else return -1; }
[ "function valuesSortedById(obj) {\n return $.map(obj, function(x){return x;})\n .sort(function(a,b) {return a.id - b.id;});\n}", "sortDates() {\n this.datedRatings = this.datedRatings.sort(compareValues('id', 'desc'))\n }", "function sortMovieList(data, id) {\n if (id === \"episode\") {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve a face list's information, including faceListId, name, userData and faces in the face list. Face list simply represents a list of faces, and could be treated as a searchable data source in Face Find Similar. Http Method GET
faceListGetAFaceListGet(queryParams, headerParams, pathParams) { const queryParamsMapped = {}; const headerParamsMapped = {}; const pathParamsMapped = {}; Object.assign(queryParamsMapped, convertParamsToRealParams(queryParams, FaceListGetAFaceListGetQueryParametersNameMap)); Obje...
[ "faceListCreateAFaceListPut(queryParams, headerParams, pathParams) {\n const queryParamsMapped = {};\n const headerParamsMapped = {};\n const pathParamsMapped = {};\n Object.assign(queryParamsMapped, convertParamsToRealParams(queryParams, FaceListCreateAFaceListPutQueryParametersNameMap)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
renderTMEvents() primary API into TM Events API
function renderTMEvents(startDate, startTime, endDate, endTime, city, state, postalCode, countryCode, radius, maxEvents) { // We are expecting a valid date and city or else stop....TODO: return a valid error code if ((!startDate) || (!endDate) || (!city)) { alert("Fatal Error - no date or ...
[ "onRender() {}", "function renderSingleEvent(info) {\n return ('<div class=\"event_block animate-fadein\">' +\n '<div class=\"event_start_info\">' +\n '<div class=\"event_start_dt\">starts at</div>' +\n '<div class=\"event_start_time\">' +\n '<div class=\"time_h\">' + info.acf.hour + '</div>' +\n '<div cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a simple list of genes and weights. More complex signatures would be possible, but will require some work writing the xena query.
function parse(str) { if (str[0] !== '=') { return; } try { var list = parser(str.slice(1).trim()); return { weights: pluck(list, 0), genes: pluck(list, 1) }; } catch (e) { console.log('parsing error', e); } return; }
[ "function segmentByWeight(gender, products) {\n\tconst sql = `\n\t\tSELECT *\n\t\tFROM ? WHERE name LIKE '%Osprey%' AND (gender = '${gender}' OR gender = 'unisex')\n\t\tORDER BY weight->data->0->val ASC\n\t`;\n\treturn alasql(sql, [products]);\n}", "function genAttrQueries(a, h, t, rxs) {\r\n\t\tvar ra = {\r\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function that creates a new Genre in the database currently, the genre table has 3 entries: Action, Comedy, and Drama add one more Genre of your choice duplicate entries are not allowed (try it to learn about errors)
function insertNewGenre() { // Add code here }
[ "function createGenresTable() {\n client.query(`CREATE TABLE IF NOT EXISTS genres (\n genre_id SERIAL PRIMARY KEY,\n genre VARCHAR UNIQUE\n );`).then(function() {\n console.info('Created genres table');\n });\n }", "function deleteGenreYouAdded() {\n // Add code here\n}", "function val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================================================= / Q6 ============================================================================= / Create a ReadingList class by using OOP concept, where: Your class should has: "read" for the number of books that finish reading (number) "unRead" for the n...
function ReadingList(){ var read = 0, unRead = 0, toRead = [], currentBook, readBooks = []; return{ read : read, unRead : unRead, toRead : toRead, currentBook : currentBook, readBooks : readBooks, addBook : addBook, finishCurrentBook : finishCurrentBook } }
[ "function ReadingList()\n{\n\n var book={};\n\n book.read = 0;\n book.unread = 0;\n book.toRead = [];\n book.currentRead = undefined;\n book.readBooks = [];\n book.addBook = addBook;\n book.finishCurrentBook = finishCurrentBook;\n return book;\n }", "function changeReadStatus(bookTitle, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create mix guess list copy of original ordered list, but shuffled
shuffleGuessList() { this.mixedGuessList = super.shuffle(this.guessList.slice()); }
[ "function shuffle(list, length) {\n var i, rnd, temp;\n for (i = 0; i < length; i += 1) {\n rnd = i + Math.floor((Math.random() * (length - i)));\n temp = list[i];\n list[i] = list[rnd];\n list[rnd] = temp;\n }\n}", "shuffleElements() { \n this.deck.shuffle();\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if the prop paramter holds a string, then return the value of the style property that corresponds with the string
function _getstylevalue(el) { if(typeof prop == "string"){ var styleValue; var computedStyle = window.getComputedStyle(el).getPropertyValue(prop); var stylePropValue = el.style[prop]; if (typeof stylePropValue == "undefined" || stylePropValue == ""){ ...
[ "function css(ele,style_obj){\n if(ele === null || style_obj === null){\n return \"\";\n }\n\n if(typeof style_obj === \"string\"){\n return ele.style.style_obj;\n }\n}", "getStyleByName(name){\n\t\treturn this.styles[this.findIndexByName(name)];\n\t}", "function intCss(elem, prop) {\r\n return parse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Description Add dependency as edges to graph Input g / DirectedGraph Output none Exception Conflict Duplicated dependency
_add_service_graph_edges(g) { for (let type of this._types) { for (let neighbour of type.dependency) { try { g.add_edge(neighbour, type) } catch (e) { if (e instanceof error.Conflict && e.message === 'Edg...
[ "function addEdge() {\n \n //source input box\n twoNodesinp1 = createInput('');\n twoNodesinp1.input(myInputEvent);\n twoNodesinp1.position(800,50);\n twoNodesinp1.size(80,40);\n twoNodesinp1.changed(connectingText1);\n\n //var s = twoNodesinp1.value();\n\n //target input box\n twoNodesinp2 = createInput(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if the last error was set and throws it.
function throwLastError() { const er = in3w.ccall('in3_last_error', 'string', [], []); if (er) throw new Error(er + (in3w.sign_js.last_sign_error ? (' : ' + in3w.sign_js.last_sign_error) : '')) }
[ "function incrementoError()\n\t{\n\t\tif(presente === false)\n\t\t{\n\t\t\tmasUnError();//Instanciar la función que aumenta los fallos acumulados.\n\t\t}\n\t}", "function MultiError(errors)\n\t{\n\t\tmod_assertplus.array(errors, 'list of errors');\n\t\tmod_assertplus.ok(errors.length > 0, 'must be at least one er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
besetSelFormToObj() This is called by a couple of event handlers and decodes the currently selected BESet (in the dropdown form) and sets the cookieObj.besetName accordingly.
function besetSelFormToObj() { cookieObj.besetName = $j("#besetsel-sel").val(); }
[ "function bindSelectedToForm() {\n saveKPForm.find('#kp-id').val(selected.id);\n saveKPForm.find('#kp-number').val(selected.number);\n saveKPForm.find('#kp-name').val(selected.title);\n kpLevelList.val(selected.kLevel).trigger('change');\n saveKPForm.find('#kp-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`_readQuadPunctuation` reads punctuation after a quad
_readQuadPunctuation(token) { if (token.type !== '.') return this._error('Expected dot to follow quad', token); return this._readInTopContext; }
[ "function isPunctuation(input){\n\t\tvar lastChar = input.charAt(input.length-1);\n\t\tif((lastChar == ',') || (lastChar == '.') || (lastChar == ';')|| \n\t\t\t(lastChar == '!') || (lastChar == '?') || (lastChar == ':')){\n\t\t\treturn true;\t\t\n\t\t}\n\t\treturn false;\n\t}", "function has(w) {\n if (w.inclu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function applies the strategy you define in getstrategy(n): DON'T CHANGE
function applystrategy(hand, n) { var strat = getstrategy(n); return strat(hand); }
[ "function setStrategy(preferredStrategy) {\n strategy = preferredStrategy;\n }", "async strategies (obj, args, context, info) {\n let strategies = await WIKI.models.authentication.getStrategies(args.isEnabled)\n strategies = strategies.map(stg => {\n const strategyInfo = _.find(WIKI.dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change target url of letsplaybtn to a url of the selected team
function selectteam(targeturl){ //get target from link in lets play button var target = document.getElementById("lets-play-btn").getAttribute("href"); //if team is not set already add it to target url if (target.indexOf("&team=") == -1){ document.getElementById("lets-play-btn").setAttribute("hr...
[ "function selectgame(targeturl){\n //Before selecting the game we need to know which teams are going to play it, and show them in the modal\n //get all teams from Database and make the right buttons out of them, eventually in the future different games need different teams\n db_call('get','all_teams',gette...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accumulates without regard to direction, does not look for phased registration names. Same as `accumulateDirectDispatchesSingle` but without requiring that the `dispatchMarker` be the same as the dispatched ID.
function accumulateDispatches(id, ignoredDirection, event) { if (event && event.dispatchConfig.registrationName) { var registrationName = event.dispatchConfig.registrationName; var listener = getListener(id, registrationName); if (listener) { event._dispatchListeners = accumulateInto(e...
[ "function accumulator(xf) {\n function xformed(source, additional) {\n // Return a new accumulatable object who's accumulate method transforms the `next`\n // accumulating function.\n return accumulatable(function accumulateXform(next, initial) {\n // `next` is the accumulating function we are transf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if restore button shall appear or not
function checkRestoreButton(event){ fieldId = getFieldIdFromCurrentNode(event.target); backupFieldId = "#restore-field_" + fieldId; colorFieldId = "#color-field_" + fieldId; backupValue = getHexaColor(jQuery(backupFieldId).attr('value')); currentValue = jQuery(colorFieldId).attr('value'); if(backupValue ...
[ "function showBackBt() {\n if (_historyObj.length > 1) {\n return true;\n } else {\n return false;\n }\n }", "_addRestoreButton(){\n this.add(this.options, 'restore').name('Restore').onChange((value) => {\n if (this.isView3D) {\n this.threeRenderer.center3DCame...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace words with string in strings array
function replaceS() { strings[string.indexOf("words")] = "string"; }
[ "function SearchAndReplace(arr,oldWord,newWord) {\n var t = '';\n var text = arr.split(' ');\n for (let i = 0; i < text.length; i++) {\n if (text[i] == oldWord) {\n t = text[i].charAt(0);\n if (t == text[i].charAt(0).toUpperCase()) {\n t = newWord.charAt(0).toUpp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modifies an array of events in the following ways (operations are in order): clear the event's `end` convert the event to allDay add `dateDelta` to the start and end add `durationDelta` to the event's duration assign `miscProps` to the event Returns a function that can be called to undo all the operations. TODO: don't ...
function mutateEvents(events, clearEnd, allDay, dateDelta, durationDelta, miscProps) { var isAmbigTimezone = t.getIsAmbigTimezone(); var undoFunctions = []; // normalize zero-length deltas to be null if (dateDelta && !dateDelta.valueOf()) { dateDelta = nu...
[ "getDanglingAudioEvents(millis, events){\n let num = 0;\n\n for(let event of this.audioEvents){\n if(event.millis < millis && event.endMillis > millis){\n event.playheadOffset = (millis - event.millis);\n event.time = this.startTime + event.millis - this.songStartMillis + event.playheadOffs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:: > BOOLEAN Return TRUE if given value is an instance of YngwieView
static is(val) { return val instanceof YngwieView; }
[ "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === Resolver.__pulumiType;\n }", "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is used to get drug names based on group selection.
function getDrugNamesOnGroup(groupName) { if (groupName != null && groupName != "") { $.ajax({ type : 'GET', url : 'getDrugNamesOnGroup', data : { groupName : groupName }, success : function(data) { var jsonDrugNames = $.parseJSON(JSON.stringify(data)); var select = $("...
[ "function getDrugName(drugGroup, drugName) {\r\n\t\tvar groupName = drugGroup;\r\n\t\tif (groupName != null && groupName != \"\") {\r\n\t\t\t$.ajax({\r\n\t\t\t\ttype : 'GET',\r\n\t\t\t\turl : 'getDrugNamesOnGroup',\r\n\t\t\t\tdata : {\r\n\t\t\t\t\tgroupName : groupName\r\n\t\t\t\t},\r\n\t\t\t\tsuccess : function(da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to Get region Tree BY searching Region name
function fnSearchRegions() { if ($.trim($('#txtSearchNode').val()) == '') { fnGetRegionTreeByRegion(currentRegionCode_g, "dvRegionTree", "dvFilteredNode"); } else { fnGetRegionsByRegionName($('#txtSearchNode').val(), "dvRegionTree", "dvFilteredNode"); } }
[ "async function getAllRegions() {\n const regions = {\n regions: [\n {\n name: \"blackrod\",\n parent: \"bolton\",\n },\n {\n name: \"bolton\",\n parent: \"manchester\",\n },\n {\n name: \"bury\",\n parent: \"manchester\",\n },\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FizzBuzz is often one of the first programming puzzle people learn. Now undo it with reverse FizzBuzz! Write a function that accepts a string, which will always be a valid section of FizzBuzz. Your function must return an array that contains the numbers in order to generate the given section of FizzBuzz. Notes: If the ...
function reverseFizzBuzz(s) { let newS = s.split(' '); let firstNumberFound = []; let result = []; for(let i = 0; i < newS.length; i++){ if(parseInt(newS[i]) > 0){ firstNumberFound.push(i, newS[i]); break; }; }; if(firstNumberFound.length > 0){ let start = parseInt(firstNumberF...
[ "function fizzBuzzFactory(arr, arg) {\n let valueArr = [];\n let wordArr = [];\n\n arr.forEach((item) => {\n valueArr.push(item[0]);\n wordArr.push(item[1]);\n });\n\n let maxInd = valueArr.indexOf(Math.max(...valueArr));\n let minInd = valueArr.indexOf(Math.min(...valueArr));\n let midInd = 0;\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
uncomment when ready to test ~~~~BONUS Write a function that will print the id of each test and the name of the student who got the highest scores Example printBestStudent(students3) Test 0: Anthony Test 1: Pawandeep Test 2: Winnie
function printBestStudent(students) { //your code here... for (let i = 0; i < students.length; i++) { //iterates through students // console.log(students[i]["name"],students[i]["grades"] ); let student = students[i]; let grades = student.grades; // let bestGrade = grades[0].score...
[ "function printBestStudents(students) {\n var bestScores = {};\n\n for (var i = 0; i < students.length; i++) {\n var student = students[i];\n\n for(var j = 0; j < student.grades.length; j ++){\n var grade = student.grades[j];\n\n if(bestScores[grade.id] === undefined){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2 arrays of integers a and b of the same length integer k output integer number of tiny pairs pairs (x, y) such that x is from a and y is from b iterating through array a from left to right iterating through b from right to left to be tiny, the concatenation xy is less than k solved; 30/30
function countTinyPairs(a, b, k) { let revB = b.reverse(); let tinyCount = 0; for (let index = 0; index < a.length; index++) { const elementA = a[index]; const elementB = revB[index]; let concat = elementA + "" + elementB; concat = parseInt(concat); if (concat < k){...
[ "function polyvecPointWiseAccMontgomery(a, b, paramsK) {\r\n var r = polyBaseMulMontgomery(a[0], b[0]);\r\n var t;\r\n for (var i = 1; i < paramsK; i++) {\r\n t = polyBaseMulMontgomery(a[i], b[i]);\r\n r = polyAdd(r, t);\r\n }\r\n return polyReduce(r);\r\n}", "function merge(x, y, len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isThereADoorToGoToRoom function Checks whether the player can access a room or not, based on the doors in the current room
function isThereADoorToGoToRoom (handlerInput, room){ const sessionAttributes = handlerInput.attributesManager.getSessionAttributes(); // get the doors in the currentRoom const currentRoomDoors = sessionAttributes.gamestate.currentRoom.elements.doors var canGo = false; // check if...
[ "function Room(origin, length, width, front_door, back_door, right_door, left_door) {\n this.front_door = front_door;\n this.back_door = back_door;\n this.right_door = right_door;\n this.left_door = left_door;\n this.length = length;\n this.width = width;\n\n this.isInDoorWay = function(x, y, z) {\n if (t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
most useful when using specificType traverses the window until it comes across what you're looking for
getNearest(specificType = undefined) { return this.getSiteFromCandidates(Array.from(this.window.values()), false, specificType); }
[ "visitWindowing_type(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function recordsetDialog_searchByType(stype) {\r\n\tfor (ii = 0; ii < MM.rsTypes.length;ii++) {\r\n\t\tif (dw.getDocumentDOM().serverModel.getServerName() == MM.rsTypes[ii].serverModel) {\r\n\t\t\tif (MM.rsTypes[ii].type == stype) {\r\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse SID and produces the correct URL
function parseSidUrl(baseUrl, urlExt) { var sidPos = baseUrl.indexOf('/?SID='); var sid = ''; urlExt = (urlExt != undefined) ? urlExt : ''; if(sidPos > -1) { sid = '?' + baseUrl.substring(sidPos + 2); baseUrl = baseUrl.substring(0, sidPos + 1); } return baseUrl+urlExt+sid; }
[ "function makeId(base, input) {\n // check if not falsy\n if(input) {\n // check for full id\n if(input.indexOf('http://') === 0 || input.indexOf('https://') === 0) {\n return input;\n }\n // else a short id\n else {\n return base + '/' + input;\n }\n }\n\n return base;\n}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
unsigned char ptr[x][y] = v
function h$writePtrPtrU8(ptr, ptr_off, v, x, y) { x = x || 0; y = y || 0; var arr = ptr.arr[ptr_off+ 4 * x]; arr[0].dv.setUint8(arr[1] + y, v); }
[ "function toU8Array(ptr, length) {\n return HEAPU8.subarray(ptr, ptr + length);\n }", "function set_board_pixel(board, x, y, value)\n{\n\tvar index = x + y * get_game_width();\n\tboard[index] = value;\n}", "set(x, y, value) {\n this.content[y * this.width + x] = value;\n }", "function create_a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Video 'resized' event handler
function onVideoResized(vs, isPreview, size) { // notify the AVComponent that the video window size has changed pcAV.invoke('SetVideoWindowSize', vs._id(), vs.source.sink._videoWindow(), isPreview, size.width, size.height); }
[ "function videoResize() {\n if (window.innerWidth <= 600) {\n video.width = 320;\n video.height = 240;\n wallpaper.src=\"Images/whitney-houston-vertical-image.jpg\";\n } else {\n video.width = 640;\n video.height = 480;\n wallpaper.src=\"Images/whitney-houston-horizontal-image.jpg\"\n }\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Put the group_id and the receiver_id in an array of objects called mass_requests
function sendGroupJoinRequests() { vm.usersToInvite.forEach(user => { massRequest.push({ group_id: vm.group.id, receiver_id: user.id}); }); const massRequestObj = { mass_requests: massRequest }; Request .sendMassRequest(massRequestObj) .$promise .then(data => { ...
[ "_sendBatch() {\n if (_.isEmpty(this.events)) return;\n\n const events = Object.assign([], this.events);\n const body = JSON.stringify(events);\n const options = {\n url: `${this.endpoint}/${this.dataSet}`,\n headers: {\n 'X-Honeycomb-Team': this.writ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this method validates the input and checks whether billAmount is NaN(Not a Number) or bilAmount is less than equal to zero or totalPerson equal to zero in this case show the alert of Invalid Input
validateInputs() { if(isNaN(this.billAmount) || this.billAmount <= 0 || this.totalPerson == 0) return false; return true; }
[ "function validateInputs(hotelToSave){\n\t\tvar valid = true;\n\t\tif(isNaN(hotelToSave.ratePerRoom)) {\n\t\t\thotel.validationMessages.rateShouldBeNumber = true;\n\t\t\tvalid = false;\n\t\t}\n\t\tif( hotelToSave.contact !== undefined) {\n\t\t\tif(isNaN(hotelToSave.contact.phone1)) {\n\t\t\t\thotel.validationMessag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[0] Problem given a string of words, return an array of elements, each of which contains the number of vowels in the argument Input A string of ONE or MORE words Output An array, each element corresponds to the number of vowels in the argument word Algorithm Separate each word from the arguments string check how many v...
function vowelCount(stringOfWords) { let wordsArray = stringOfWords.split(' '); const VOWELS = 'aeiou'; if (stringOfWords.length === 0) return []; let vowelsArray = wordsArray.map(individualWord => { let vowelsInWord = 0; individualWord.split('').forEach(char => { if (VOWELS.includes(char.toLowerC...
[ "function vowels(str) {\n\t// let vowelCount = {\n\t// \t'a': 0,\n\t// \t'e': 0,\n\t// \t'i': 0,\n\t// \t'o': 0,\n\t// \t'u': 0\n\t// }\n\n\t// for (let char of str) {\n\t// \tchar = char.toLowerCase();\n\t// \tif (vowelCount.hasOwnProperty(char)) {\n\t// \t\tvowelCount[char] = vowelCount[char] + 1;\n\t// \t}\n\t//...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
params : request with path, _query and _headers ; prettyJson which is enriched with links ; resList whose size is used as paginating condition.
function addPaginationLinks(request, prettyJson, resList, successFunctionName) { // adding "..." link for pagination : // NB. everything is already encoded if (!successFunctionName) { successFunctionName = 'null'; } var start = 0; var limit = dcConf.queryDefaultLimit; // from conf var query ...
[ "getAll(req, res, next) {\n\n var\n request = new Request(req),\n response = new Response(request, this.expandsURLMap),\n criteria = this._buildCriteria(request);\n\n this.Model.paginate(criteria, request.options, function(err, paginatedResults, pageCount, itemCount) {\n /* istanbul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
opens window with choise of spell type
open() { document.querySelector(".spell-page").style.display = "block"; }
[ "chooseSpell(event) {\n this.kind = event.target.getAttribute(\"id\");\n document.querySelector(\".spell-page\").style.display = \"none\";\n document.querySelector(\".task-page\").style.display = \"block\";\n this.task = new _task__WEBPACK_IMPORTED_MODULE_0__[\"default\"]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called by the C++ internals when path validation is completed. This is a purely informational event that is emitted only when there is a listener present for the pathValidation event.
function onSessionPathValidation(res, local, remote) { const session = this[owner_symbol]; if (session) { process.nextTick( emit.bind( session, 'pathValidation', res === NGTCP2_PATH_VALIDATION_RESULT_FAILURE ? 'failure' : 'success', local, remote)); } }
[ "function OnPathComplete (newPath : Path) // the newly determined path is sent over as \"newPath\" type of Path\n{\n\tif (!newPath.error)//if the newPath does not have any errors\n\t{\n\t\tpath = newPath; //set the path to this new one\n\t\tcurrentWaypoint = 0;//now that we have a new path. make sure to start at th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a flattened list of changed fields in `this`
function getChangedFields (instance) { var changeSet = getChangeSet(instance) || []; var props = changeSet.reduce(function (accum, change) { // Distill the ultimate path(s) from path + rhs if rhs is an object, or just path if not. // This clause handles array changes because typeof rhs is `undefined...
[ "track() {\n const snapShot = () => {\n return JSON.stringify(this.fields.reduce((obj, key) => {\n obj[key] = this.ctx[key];\n return obj;\n }, {}))\n }\n\n const changeListener = () => {\n this.hasFieldChanges = this.oldState !== s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private function that traverses the nonbinary StoryTree Recursively goes through the tree and finds each available action ARGUMENTS: uidPath([int]) the uid array of the actions that have been traversed uid(int) the next uid to traverse to memory(Memory) the memory vector that we're setting up return void
function traverse(uidPath, uid, memory, cls){ counter++; if(counter > 5000){ console.log(uid); } //Get action object var actionObj = tree.actions[uid]; //evaluate each precondition for the action object var trig = false; for(var j = 0; j < actionObj.preconditions.length; j++){ var pre = actionOb...
[ "function i2uiManagePadTree(tablename, cellname, column, relatedtablenames, name, recurse, relatedroutine)\r\n{\r\n // allows related table to adjust to new width due to actions in current table\r\n if (recurse == null && relatedtablenames != null)\r\n {\r\n // only do this if not a leaf node\r\n var img =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This returns true if the image is decorative.
function isElementDecorative(element, elementData) { if ($(element).attr("aria-hidden") === "true") { return true; //TODO: this logic may need to change if screen readers support spec that says aria-label // should override role=presentation, thus making it n...
[ "is_image() {\n if (\n this.file_type == \"jpg\" ||\n this.file_type == \"png\" ||\n this.file_type == \"gif\"\n ) {\n return true;\n }\n return false;\n }", "function canHandleTrPxMan() {\n\t\tvar c, s1, s2;\n\t\tc = document.createElement(\"canvas\");\n\t\tc.width = 2;\n\t\tc.he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
STAGE 4 RCL is 3, building up to RCL 4
function stage4() { // HARVESTERS if(harvesters.length < 1) { // if harvesters less than 2, make more spawn.run('harvester4'); } // BUILDERS else if(builders.length < 2) { // if harvesters less than 2, make more spawn.run('builder4'); } ...
[ "BCS() { if (this.C) this.PC = this.checkBranch_(this.MP); }", "function C101_KinbakuClub_RopeGroup_Load() {\n\n\t// Load correct stage\n\t// After intro player has a choice each time she goes to the group, until a twin is released\n\tif (C101_KinbakuClub_RopeGroup_CurrentStage > 100 && C101_KinbakuClub_RopeGroup...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion que desaparece los repetidos marcados con cero
function desaparecerRepetidos(){ sustituirCero(obtenerRepetidos()); }
[ "function operacionResta() {\r\n for (var j = 0; j < vecAuxiliar.length; j++) {\r\n var nu1 = vecAuxiliar[j].dato;\r\n var nu2 = vecTramaG[j].dato;\r\n var r = nu1 - nu2;\r\n if (r < 0) {\r\n agregar(1, 5);\r\n // vecresta += 1;\r\n } else...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function changes the transparency of the optional layers if the layer is selected, otherwise ignore
function changeTranspOptionalLayers(selectedLayer, val, index, id_minus, id_plus, checkboxId) { var checkid = document.getElementById(checkboxId); if (checkid.checked == true)//check if the layer is selected { optionalArray[index] = optionalArray[index] + val; var optionOpacity = optionalArray[index];//locate ...
[ "function DisableTranspOptionalLayers(index, id_minus, id_plus, checkboxId)\n{\n\n\tvar checkid = document.getElementById(checkboxId);\n\n\n\tif (checkid.checked == true)//check if the layer is selected\n\t{\n\t\tvar optionOpacity = optionalArray[index];//localte which global opacity layer it is\n\n\t\t//Disables t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reports the collected statistics at the configured log level, and schedules a new report.
_report() { const msg = this.schedule.name + ' since ' + moment(this.lastRun).format('YYYY-MM-DD HH:mm') + ':\n' + this.reports.map(report => '\u2022 ' + report.name + ": " + (this.counts[report.name] || 0)).join('\n'); this.logger.log(this.schedule.level || 'info', msg); ...
[ "function runReport() {\n checkAnswers();\n calculateTestTime();\n calculateCheckedInputs();\n\n }", "function reportStats() {\n const now = Date.now();\n console.log(`STATS Tweets: ${totalTweets}\\tErrors: ${totalErrors}\\tUptime: ${Math.round((now - startStatus)/1000)}s`);\n}", "_sch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the API url stored in the component state
function get_url(){ return this.state.api_url; }
[ "apiUrl() {\n const url = this.globalConfigService.getData().apiUrl;\n return url || Remote_1.RemoteConfig.uri;\n }", "baseURL () {\n return config.api.baseUrl;\n }", "function getAPIURL() {\n return (\n `${baseRemoteURL}?${jQuery('#filters :input[value!=\\'all\\']').serialize()}`\n );...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the highlighted autocomplete entry
function acHighlightedText() { return Selector(".autocomplete-item.highlighted").textContent; }
[ "onFocusAutosuggest(event) {\n event.target.select();\n }", "function highlightActiveLineGutter() {\n return activeLineGutterHighlighter\n }", "function handleAutoCompleteEntryClick(tag) {\n\t\t// Get all tag entries\n\t\tconst tags = ref.current.value.split(/\\s/);\n\t\t// Set the input text to the...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add Company filter for comments
function addCompanyCommentsFilter(ev,companyFilter){ var companyFilterId = (companyFilter.company__id); var companyFilterName = (companyFilter.company__name); vm.showCompany = companyFilterName; //vm.showCompanyIdForDialog = ''; vm.showCompanyNameForFilter ...
[ "function createFilter(companies) {\n const searchFilter = document.querySelector('#companySearch');\n searchFilter.addEventListener('change', function() {\n const matches = findMatches(searchFilter.value, companies);\n htmlCompanyList.innerHTML = \"\";\n setCompanyLis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a single query parameter `name[=value]`
parseQueryParam(params) { const key = matchQueryParams(this.remaining); if (!key) { return; } this.capture(key); let value = ''; if (this.consumeOptional('=')) { const valueMatch = matchUrlQueryParamValue(this.remaining); if (valueMatch...
[ "function parse_query(query_string){\n\t\tvar vars = [],\n\t\t\t\tpairs = query_string.split('&');\n\t\t\n\t\tfor ( i = 0; i < pairs.length; i++ ) {\n\t\t\tvar tmp = pairs[i].split('=');\n\t\t\tvars[tmp[0]] = tmp[1];\n\t\t}\n\t\t\n\t\treturn vars;\n\t}", "function parseQueryParams(loc) {\n\tvar params = loc.searc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store the file title and ID using Google Properties Service This will persist through file save/loads until a new component file is associated with the document.
function setHDFile(docID,title) { var documentProperties = PropertiesService.getDocumentProperties(); documentProperties.setProperties({'hdID': docID, 'hdTitle': title}); onOpen(); }
[ "function refreshHDFile() {\n var documentProperties = PropertiesService.getDocumentProperties();\n var hdID = documentProperties.getProperty('hdID');\n var hdTitle = documentProperties.getProperty('hdTitle');\n \n loadHDFileIntoSheet(hdID,hdTitle);\n}", "updateManifest(documentId, props) {\n let state = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update a education by for a resume id
update(req, res) { return Education .find({ where: { id: req.params.educationId, resumeId: req.params.resumeId, }, }) .then(education => { if (!education) { return res.status(404).send({ message: 'education Not Found', ...
[ "async updateResearchPaper(id,researchPaper){\n const bearer = 'Bearer ' + localStorage.getItem('userToken');\n return await fetch(RESEARCH_PAPER_API_BASE_URI+\"/\"+id,{\n method:'PUT',\n headers:{\n 'content-Type':\"application/json\",\n 'Authorizat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns data from start of the month (up to 31 items)
listMonthly() { const today = new Date(); return this.trafficRepository.getMonthlyData(dateService.getYearStart(today), dateService.getYearEnd(today)) .then(data => { data = this.mapRepositoryData(data); const range = numberService.getSequentialRange(1, 12); const valuesToAdd = ran...
[ "populateDaysInMonth() {\n var daysInMonth = [];\n //first day of this.state.monthNumber\n var date = new Date(this.state.year, this.state.monthNumber);\n while (date.getMonth() === this.state.monthNumber) {\n daysInMonth.push(new Date(date));\n //Increment to next ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the "$" character from our cash values
function cleanCashString(str) { return str.replace("$", ""); }
[ "function prefixPoundSign(el){\n el.val(function (i, v) {\n return '£' + v.replace('£', '');\n }); \n }", "function removeCurrencySignAndPadding(value, selection) {\n var newValue = value;\n if (newValue.charAt(0) === config.currencySymbol) {\n newValue = newValue.substring(1); //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for roman/cyrl text insert 'a' after all consonants that are not followed by virama, dependent vowel or 'a' cyrillic mapping extracted from TODO capitalize cyrl too
function insert_a(text, script) { const a = (script == Script.CYRL) ? '\u0430' : 'a'; // roman a or cyrl a text = text.replace(new RegExp(`([ක-ෆ])([^\u0DCF-\u0DDF\u0DCA${a}])`, 'g'), `$1${a}$2`); text = text.replace(new RegExp(`([ක-ෆ])([^\u0DCF-\u0DDF\u0DCA${a}])`, 'g'), `$1${a}$2`); return text.rep...
[ "function encodeConsonantWord(word) {\n\n \n word = word.toLowerCase();\n let firstletter = word[0];\n let cons_phrase = \"-\";\n \n\n while\n (firstletter !== \"a\" || \n firstletter !== \"e\" || \n firstletter !== \"i\" || \n firstletter !== \"o\" || \n firstletter !== \"u\")\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decode text using `decodeURIComponent`. Returns the original text if it fails.
function decode(text) { try { return decodeURIComponent('' + text); } catch (err) { ( true) && warn(`Error decoding "${text}". Using original value`); } return '' + text; }
[ "function decode(content, encoding, decoder = \"text\") {\n if (encoding) {\n content = Buffer.from(content, encoding).toString();\n }\n switch (decoder) {\n case \"json\":\n try {\n return JSON.parse(content);\n } catch (e) {\n return undefined;\n }\n default:\n return content;\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves new settings to storage, and calls f if it exists
function saveNewSettings(settings, f=null){ for(let key of Object.keys(settings)){ let obj = {[key]: settings[key]}; chrome.storage.sync.set(obj, function(e){console.log(e);}); } if(f) f(); }
[ "apply() {\n localStorage.setItem(SETTINGS_KEY, this.export());\n const event = new SettingsEvent();\n event.fire();\n }", "function saveSettings() {\n // Update the sources variable.\n $('.js-social-media-source', modal).each(function () {\n var source = $(this).val();\n\n if (sources.h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create our path from the places array
makePath(places) { let path = places.map( x => ({lat: Number(x.latitude), lng: Number(x.longitude)}) ); if (places.length > 0) { path.push({lat: Number(places[0].latitude), lng: Number(places[0].longitude)}); } return path; }
[ "constructPath(cameFrom, goal) {\n let path = this.board.getNeighborTiles(goal[0], goal[1]);\n let pos = goal;\n while (pos !== null) {\n path.unshift(pos);\n pos = cameFrom[pos]; // set the pos to prev pos\n }\n\n return path;\n }", "function genPathways(waypoints) \n{\n\t// Define a da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Predicts tooltip top position based on the trigger element
function predictTooltipTop(el) { var top = el.offsetTop; var height = 40; // asumes ~40px tooltip height while(el.offsetParent) { el = el.offsetParent; top += el.offsetTop; } return (top - height) - (window.pageYOffset); }
[ "function _setTooltipPosition() {\n // eslint-disable-next-line no-new\n new PopperJs($element, _tooltip, {\n placement: lumx.position || 'top',\n modifiers: {\n arrow: {\n // eslint-disable-next-line id-blacklist\n element: `....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loadGame: Called by button handler Gets gameStateObject from local storage and puts into appropriate game data structures.
function loadGame() { // temp gameStateObject var gameStateObject = null; var tempString = ""; // get state object from local storage tempString = localStorage.getItem("GoblinKingGameData"); console.log("Loaded gamedata: " + tempString); gameStateObject = JSON.parse(tempString...
[ "loadGame(game) {\n if (game) {\n this.initialize();\n this.restore(game);\n } else {\n this.newGame();\n }\n }", "function loadState()\n{\n if( savedStateExists() )\n {\n console.log(\"Found a saved state to load.\");\n\n // pause game\n bPauseGame = true;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines if a specified element is a top level DOM element
function isTopLevelEl(el) { if (!el) { return false; } var tn = propAttr(el, 'tagName'); tn = tn ? tn.toLowerCase() : null; return tn === 'html' || tn === 'head'; }
[ "function isDescendantOf(element, tagName) {\n const tagNameTarget = tagName.toUpperCase();\n\n for (let node = element; node && node != document; node = node.parentNode) {\n if (node.tagName.toUpperCase() === tagNameTarget) return true;\n }\n\n return false;\n}", "function inDOM() {\n var closestBody...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
action for the Eval & start Job menu item on Jobs menu.
static start_job_menu_item_action() { let full_src = Editor.get_javascript() let selected_src = Editor.get_javascript(true) let sel_start_pos = Editor.selection_start() let sel_end_pos = Editor.selection_end() let start_of_job_maybe ...
[ "function show_job(page, process_name) {\n // Save info of the opened tab\n msg_or_job = 'Job';\n ProcessJobUpdate(page, process_name, true);\n}", "function showJobSelect(){\r\n showSelect(appendJobSelect, jobMoveDrop, empMoveCancel, showMoveEmp, \"jobSelected\", \"jobsArray\", \"jobs\", showFullEmpMo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The "watch" function is called at the DOM's animation frame rate continously
watch() { if (this.shouldUpdate()) { this.trigger('change', this.rect); } if(!this.shouldStop){ window.requestAnimationFrame(() => this.watch()); } }
[ "notify_speed_update() {\n this.speed_update = true;\n }", "function animate() {\n requestAnimationFrame(animate);\n // Insert animation frame to update here.\n }", "refresh(timeNow, enableAnimation) {\n }", "stopWatchIntervalHandler() {\n if (this.frames < 60) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether the underlying truth is a location
isLocation() { return this.truthObject.constructor.name == 'Location' }
[ "isLocation(value) {\n return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value);\n }", "function locationStatus(location, grid) {\n var gridWidth = grid.length;\n var gridHeight = grid[0].length;\n var x = location.x;\n var y = location.y;\n\n if (locati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns true if version is >= minimum
function compareSemVer(version, minimum) { version = parseSemVer(version); minimum = parseSemVer(minimum); var versionNum = version.major * 10000 * 10000 + version.minor * 10000 + version.patch; var minimumNum = minimum.major * 10000 * 10000 + minimum.minor * 10000 + minimum.patch; retur...
[ "function validSemanticVersion (version, minimum) {\n version = parseSemVer(version)\n minimum = parseSemVer(minimum)\n\n var versionNum = (version.major * 100000 * 100000) +\n (version.minor * 100000) +\n version.patch\n var minimumNum = (minimum.major * 100000 *...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copies the summary display text into the clipboard
copySummaryToClipboard() { copyToClipboard(this.summaryListContent()); }
[ "function handleDescriptionCopy() {\n var copyText = document.getElementById(\"part-descriptions\");\n copyText.select();\n copyText.setSelectionRange(0, 99999);\n document.execCommand(\"copy\");\n setShow(true);\n setalertTitle(\"Copied\");\n setalertText(\"Copied the text: \" + copyText.value...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build debugger panel for wrist.
buildWristDebugger() { // If not in headset, put the panel in view. let panelPosition = AFRAME.utils.device.checkHeadsetConnected() ? `position="0.1 0.1 0.1" rotation="-85 0 0"` : `position="0.0 ${this.playerHeight} -0.5"`; let debuggerPanelWrist = ``; // if ( window.location.hostname !== 'localhost') {...
[ "function dbg(prs, id, w, h, mode, fr){\n\t//save instance of visualizer\n\tthis._vis = viz.getVisualizer(\n\t\tVIS_TYPE.DBG_VIEW,\t\t\t\t//debugging viewport\n\t\tprs,\t\t\t\t\t\t\t//parser instance\n\t\tid,\t\t\t\t\t\t\t\t//HTML element id\n\t\tw,\t\t\t\t\t\t\t\t//width\n\t\th,\t\t\t\t\t\t\t\t//height\n\t\tfuncti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
comprobarPremioMinimo solo verificamos que es un objeto del tipo que toca y que tiene ID se usa en borrados
function comprobarPremioMinimo(premio) { // debe ser un objecto var comprobado = 'object' === typeof premio; // propiedades no nulas comprobado = (comprobado && premio.hasOwnProperty('idPremio')); return comprobado; }
[ "function Zidovi(sirina, boja) {\n//function napravi_zidove(sirina, boja) {\n// ova funkcija ucrtava zidove u igracki prostor i postavlja njihovo polje/parametre. sirina definira\n// sirinu zidova u pikselima, boja je css string koji govori o njihovoj boji. Ako zelis/ne zelis zid na donjem bridu\n// moras u ovoj fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Noti / Returns an array of all notifications by trip_id
getNotifications(url, trip_id) { return axios.get(`${url}notify/${trip_id}`).then(res => { return res.data; }); }
[ "async all() {\n const subscriptions = await this.db.subscriptions.toArray();\n return Promise.all(\n subscriptions.map(async (s) => ({\n ...s,\n new: await this.db.notifications.where({ subscriptionId: s.id, new: 1 }).count(),\n }))\n );\n }", "static async getRecentTrips() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
user params to generate and set the converted src
updateconvertedurl() { // src is only actually required property if (this.src) { const params = { height: this.height, width: this.width, quality: this.quality, src: this.src, rotate: this.rotate, fit: this.fit, watermark: this.watermark, wms...
[ "function addURLParam(element,newParam){var originalSrc=element.getAttribute('src');element.setAttribute('src',originalSrc+getUrlParamSign(originalSrc)+newParam);}", "set src(aValue) {\n this._logService.debug(\"gsDiggThumbnailDTO.src[set]\");\n this._src = aValue;\n }", "function setSrc(element,attribut...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
look for empty cell 16, then choose what cell move based on the keypressed
function lookForWhatToMove(key) { var coord = ""; for(var r = 0; r < dim_max; r++) { for(var c = 0; c < dim_max; c++) { if(m[r][c] == 16) { //console.log(key); switch(key) { //a, left case 65: case 37: if(validate(r, c+1)) coord = r+";"+c +"$"+ r+";"+(c+1); br...
[ "function keyPress(evt) {\n if (current_cell == null)\n return;\n var key, key1;\n if (evt) {\n // firefox or chrome\n key = evt.key;\n key1 = evt.keyCode;\n }\n else {\n // IE\n key = String.fromCharCode(event.keyCode);\n }\n if (key1 == 8 || key1 == 4...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
spotifyClientCredentialsFlow_relatedArtists Authorize Spotify with client credentials flow Guide on this authorization flow: Create Spotify app at
async function spotifyClientCredentialsFlow_playlist(context) { let { relatedArtists } = context; /** * Get the access token for your Spotify App * Authorization type: Basic * Input: client_id, client_secret, grant_type * Output: access token * @function getAccessToken * */ ...
[ "async function requestAccessToken() {\n\n/**\n * Function to get base64 encoded data from private spotify values.\n * @param {string} clientID - private spotify client id\n * @param {string} secret - private spotify secret key\n */\n async function getEncodedKey(clientID, secret) {\n const encodedVal = btoa(cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
read the actual content for the page
contentFor(page) { let reader = this.readers[page.extension]; let pathToFile = this.pathToPageContent(page); let content = ''; if (typeof reader.readFile !== 'undefined') { content = reader.readFile(pathToFile); } else { content = fs.readFileSync(pathToFile, 'utf8'); } if (!reader) { throw new ...
[ "function loadContent() {\n\t\tMassIdea.loadHTML($contentList, URL_LOAD_CONTENT, {\n\t\t\tcategory : _category,\n\t\t\tsection : _section,\n\t\t\tpage : 0\n\t\t});\n\t}", "function readData()\r{\r var pages = docData.selectedDocument.pages;\r $.writeln('# of pages: ' + pages.length);\r for (var x = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a query property into a knex `raw` instance.
function queryPropToKnexRaw(queryProp, builder) { if (!queryProp) { return queryProp; } if (queryProp.isObjectionQueryBuilderBase) { return buildObjectionQueryBuilder(queryProp, builder); } else if (isKnexRawConvertable(queryProp)) { return buildKnexRawConvertable(queryProp, builder); } else { ...
[ "function convertExistingQueryProps(json, builder) {\n const keys = Object.keys(json);\n\n for (let i = 0, l = keys.length; i < l; ++i) {\n const key = keys[i];\n const value = json[key];\n\n if (isQueryProp(value)) {\n json[key] = queryPropToKnexRaw(value, builder);\n }\n }\n\n return json;\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }