query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Remove the specified user from the given domain's block list
function removeUser( domain, user, callback ) { getBlockList( domain, function( list ) { var index = list.indexOf( user ); if( index != -1 ) { list.splice( index, 1 ); setBlockList( domain, list, callback ); } } ); }
[ "function removeUserFromList(listName, userName) {\r\n\tvar curList\t= getValue(listName,'');\r\n\r\n\t// We add a leading and trailing ;, so that when searching for ;username; to replace will find even the ones at the beginning or end of the string\r\n\tcurList\t\t= ';' + curList\r\n\r\n\t// escape the userName an...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the specified domain type's regular expression for matching sample values.
function getSampleDataRegExp(domainType) { if (angular.isUndefined(domainType.$regexp)) { domainType.$regexp = getRegExp(domainType.regexPattern, domainType.regexFlags); } return domainType.$regexp; }
[ "function getFieldNameRegExp(domainType) {\n if (angular.isUndefined(domainType.$fieldNameRegexp)) {\n domainType.$fieldNameRegexp = getRegExp(domainType.fieldNamePattern, domainType.fieldNameFlags);\n }\n return domainType.$fieldNameRegexp;\n }", "function g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allows a user to vote for a given poll. TODO: Add encryption
vote(event) { var BN = this.props.objects.web3.utils.BN; if (event) event.preventDefault(); let encryptedVote = getEncryptedVote(new BN(this.curVote.value)); console.log("vote " + encryptedVote); // cast vote this.props.objects.Voting.castVote(parseInt(this.votePollID.value), encryptedVote, ...
[ "_vote () {\n\t\tif(isUserAuthed()) {\n\t\t\t//update our state to show the different button state\n\t\t\tthis.setState({voted: !this.state.voted});\n\n\t\t\tvar newVoteCount = this.state.vote_count;\n\t\t\t//increment/decrement vote count\n\t\t\tif(this.state.voted) {\n\t\t\t\tnewVoteCount = newVoteCount - 1;\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
select the specified row via step value, if the step is not assigned, the current row is selected as the combogrid value.
function selectRow(target, step){ var opts = $.data(target, 'combogrid').options; var grid = $.data(target, 'combogrid').grid; if (opts.multiple) return; if (!step){ var selected = grid.datagrid('getSelected'); if (selected){ setValues(target, [selected[opts.idField]]); // set values $...
[ "function selectRow(target, step){\n\t\tvar opts = $.data(target, 'combogrid').options;\n\t\tvar grid = $.data(target, 'combogrid').grid;\n\t\tif (opts.multiple) return;\n\t\t\n\t\tif (!step){\n\t\t\tvar selected = grid.datagrid('getSelected');\n\t\t\tif (selected){\n\t\t\t\tsetValues(target, [selected[opts.idField...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the select list for herdnames & settle event
function createSelectList(herdNames) { herdList .selectAll("option") .data(herdNames) .enter() .append("option") .attr("value", d => d) .property("selected", d => d === herd) .text(d => d) herdList .on("chan...
[ "function makeDropDownList(){\n fetchInfluencers.then(response => {\n response.json().then(data => {\n var dropdownlist = document.getElementById(\"dropdownlist\");\n for (i = 0; i <= data.data.length; i++) {\n var option = document.createElement(\"option\");\n option.setAttribute(\"labe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Put outpoint record in database. If the record already exists, add the request id to it. TODO: refactor so that it accepts an outpoint instead of an orecord
async putOutpointRecord(orecord, request) { assert(orecord instanceof OutpointRecord); if (await this.hasOutpointRecord(orecord)) { assert(request instanceof Request); assert(Buffer.isBuffer(request.id)); const r = await this.getOutpointRecord( orecord.prevout.hash, orecord.p...
[ "async addRequest(request) {\n // make sure these writes are atomic\n\n if (!this.batch)\n this.start();\n\n const r = await this.putRequest(request);\n let orecord, srecord;\n\n // index the outpoint when it contains data\n if (!request.spends.isNull()) {\n orecord = OutpointRecord.from...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
'addiv' Write a function called arePalindromes that takes two strings as arguments and return true if one is the palindrome of the other returns returns false otherwise
function arePalindromes(a, b) { const sortedA = a .split(" ") .join("") .split("") .sort() .join(""); const sortedB = a .split(" ") .join("") .split("") .sort() .join(""); return sortedA === sortedB; }
[ "function isPalindrome() {\n\n}", "function isPalindrome(word) {\n\treturn reversed(word) === word\n}", "function checkIfPalindrome() {\n let userInput = getUserInput(\"Please enter a word to check to see if it's a palindrome:\");\n let backwardsWord = reverseAString(userInput);\n if(userInput === backwardsW...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
lower bound for distance from a location to points inside a bounding box
function boxDist(lng, lat, minLng, minLat, maxLng, maxLat, cosLat, sinLat) { if (minLng === maxLng && minLat === maxLat) { return greatCircleDist(lng, lat, minLng, minLat, cosLat, sinLat); } // query point is between minimum and maximum longitudes if (lng >= minLng && lng <= maxLng) { i...
[ "function getSearchRadius(bounds) {\n\tvar ne = bounds.getNorthEast();\n\tvar sw = bounds.getSouthWest();\n\tvar nw = new google.maps.LatLng(ne.lat(), sw.lng());\n\tvar width = google.maps.geometry.spherical.computeDistanceBetween(ne, nw);\n\tvar height = google.maps.geometry.spherical.computeDistanceBetween(sw, nw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Below method is used to generate an noutofm Multisignature (multisig) PayToScriptHash (P2SH) bitcoin address
async function genP2SH() { var privKeys = [bitcoin.ECKey.makeRandom(), bitcoin.ECKey.makeRandom(), bitcoin.ECKey.makeRandom()] var pubKeys = privKeys.map(function(x) { return x.pub }) var redeemScript = bitcoin.scripts.multisigOutput(2, pubKeys) // 2 of 3 var scriptPubKey = bitcoin.scripts.scriptHashOutput(redeem...
[ "function generateNewAddress(){\n \n server.accounts()\n .accountId(source.publicKey())\n .call()\n .then(({ sequence }) => {\n const account = new StellarSdk.Account(source.publicKey(), sequence)\n const transaction = new StellarSdk.TransactionBuilder(account, {\n fee: S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls POST /tale/:id/copy and returns the copied tale
copyTale(tale) { return new Promise((resolve, reject) => { if (tale._accessLevel > 0) { // No need to copy, short-circuit resolve(tale); } const token = this.get('tokenHandler').getWholeTaleAuthToken(); let url = `${config.apiUrl}/...
[ "function copyToClipboard() {\n const el = document.createElement('textarea');\n el.value = event.target.getAttribute('copy-data');\n el.setAttribute('readonly', '');\n el.style.position = 'absolute';\n el.style.left = '-9999px';\n document.body.appendChild(el);\n el.select();\n document.execCommand('copy')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns target back to where it was before dragging
returnToLocation(target) { target.setPosition(target.input.dragStartX, target.input.dragStartY); }
[ "function BeginDragDropTarget() {\r\n return bind.BeginDragDropTarget();\r\n }", "swap(dropTarget) {\n const previousDrag = dropTarget.draggable;\n previousDrag.revert();\n this.drop(dropTarget);\n }", "_getUpEventTarget(originalTarget) {\n const that = this;\n let target = ori...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mostrar loading en el contenedor del valor de volumen
function colocarLoadingValorVolumen(){ $("#loadingVolumen").show(); $("#valorVolumen").hide(); }
[ "function showLoadingStatus() {\n console.log(\"[menu_actions.js] Showing loading status\");\n showElementById(\"loading-status\");\n}", "function loadingScreen() {\r\n textAlign(CENTER);\r\n textSize(40);\r\n image(player, width/4, width/4, width/2, width/2);\r\n text(\"LOADING. . .\", width/2, width/2);\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
animate background Background animation: Using remainder formula, cycle through array of background colors. Use animate effect to ensure smooth transition. Code inspired by last project.
function animateBackground() { colors = ["#FDDFDF", "#FCF7DE", "#DEFDE0", "#DEF3FD", "#F0DEFD"]; animateLoop = function() { $('.background').animate({ backgroundColor: colors[i++ % colors.length] // find the remainder of }, ANIMATION_TIME, function() { animateLoop(); }); }; animateLoop()...
[ "function updateBackground() {\n if (++currBackground > backgroundColors.length - 1){\n currBackground = 0;\n }\n document.getElementById(\"bg\").style.backgroundColor = backgroundColors[currBackground];\n}", "function updateBackground() {\n var whichBackgroundIndex = (currentStep / bgChangeStepI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Logs the current version.
function logVersion() { logger.info(`skyux-cli: ${getVersion()}`); }
[ "function logStatus() {\n if (logging) {\n console.log(\"Elevator \" + index + \" | Queue: \" + floorButtonsQueue + \" | Current Floor: \" + elevator.currentFloor() + \" | Direction: \" + elevator.travelDirection + \" | Current Load: \" + elevator.loadFactor() + \" | Capacity: \" + elevator.maxPasse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes edit or remove buttons, reverts 'Cancel' button to 'Edit PC' or 'Remove PC'
function removeInlineButtons () { const pcDivs = PCdiv.children; for (let i = 0; i < pcDivs.length; i++) { pcDivs[i].querySelector('button').remove() }; if (editPCbutton.textContent === 'Cancel') alterButton(editPCbutton, 'Edit PC', removeInlineButtons, editPC); if (removePCbutton.textContent === 'Cancel') alterBu...
[ "function clearAddOnButtons(addOnButtons) {\r\n}", "function removePC () {\n\t// To avoid bugs, disallow function if currently editing PCs or if no PCs are being displayed\n\tif (editPCbutton.textContent !== 'Edit PC') return false;\n\tif (!PCdiv.childNodes.length) return false;\n\n\t// Change text content to 'Ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Distribute space among the given sizing items. The distributes the given layout spacing among the sizing items according the following algorithm: 1) Initialize the item's size to its size hint and compute the sums for each of size hint, min size, and max size. 2) If the total size hint equals the layout space, return. ...
function distributeSpace(items, space) { var count = items.length; if (count === 0) { return; } // Setup the counters. var totalMin = 0; var totalMax = 0; var totalSize = 0; ...
[ "_update() {\r\n // Clear the dirty flag to indicate the update occurred.\r\n this._dirty = false;\r\n // Bail early if there are no widgets to layout.\r\n let widgets = this.order || this.widgets;\r\n if (widgets.length === 0) {\r\n return;\r\n }\r\n // S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates the total value of each of the darts in the Throw and assigns it to the Throw.total.
calculateTotal() { this.total = [this.darts.one, this.darts.two, this.darts.three] .map(dart => this.getDartValueFromID(dart)) .reduce((a, b) => a + b, 0); }
[ "getTotalValue() {\n var totalVal = 0.0;\n for (var i in this.state.stocks) {\n //check if not null\n if (this.state.stocks[i][\"totalValue\"]) {\n totalVal += this.state.stocks[i][\"totalValue\"];\n }\n }\n // return totalVal.toFixed(3) + \" \" + currSymbol;\n return parseFloat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert into the tail
insertToTail(data) { const node = new Node(data); let tail = null; //if empty, make it head if (!this.head) { this.head = node; } else { tail = this.head; while (tail.next) { tail = tail.next; } tail.next = node; } this.size++; }
[ "addToTail(value) {\n const newNode = {\n value: value,\n next: null\n };\n\n if (!this.head && !this.tail) {\n this.head = newNode;\n this.tail = newNode;\n return;\n }\n this.tail.next = newNode;\n this.tail = newNode;\n }", "insertAt(idx, val) {\n if(idx>this.leng...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
max() that takes three number
function maxofThree(a,b,c){ return max(max(a,b),c); }
[ "function biggestOfThree (a,b,c){\n\tif (a > b){\n\t\tif (a > c){\n\t\t\treturn a;\n\t\t} else {\n\t\t\treturn c;\n\t\t} \n\t\t}\n\t\tif (c > b) {\n\t\t\treturn c;\n\t\t} else {\n\t\t\treturn b;\n\t\t}\n\t}", "function MaximumProductOfThree(arr) {\n let maxArr = [];\n for (let i = 0; i < arr.length; i++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Notifies the layout that the bounds of the currently selected item have changed.
onItemBoundsModifiedNotification(bounds) { this._setBounds(bounds, false); }
[ "selectionSetDidChange() {}", "itemsChanged() {\n this._processItems();\n }", "function updateActiveDropdownPosition() {\n $rootScope.$broadcast('lx-dropdown__update');\n }", "function onSelectedChanged(val) {\n scope.$emit('selectedchange', val);\n }", "childrenChang...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6. Write a function that has 4 function inside and returns an object of all those 4 function with keys as function names and values as function calling.
function name() { function one() {return "one"} function two() {return "two"} function three() {return "three"} function four() {return "four"} return {one: one(), two: two(), three: three(), four: four(),} }
[ "function listFunctionsRecursive(list) \n{\n\tvar obj = {};\n\tfor (var key in list) \n\t{\n\t\tif (list.hasOwnProperty(key))\n\t\t{\n\t\t\tobj = list[key];\n\t\t\tswitch (obj.type)\n\t\t\t{\n\t\t\t\tcase \"FunctionDeclaration\":\n\t\t\t\t\t/*\n\t\t\t\t\t * In our design we like the input code to be in an array. \n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change the state of the selectedStyle once we click on a thumbnail
selectStyleThumbnail(style) { this.setState({ selectedStyle: style }, () => { this.checkOutOfStock(); this.props.changeSelectedStyle(this.state.selectedStyle); // need to check quantity too once we change a style }); }
[ "onClick() {\n if (this.state.backgroundSelection === \"Header-background-1\") {\n this.setState({\n backgroundSelection: \"Header-background-2\",\n backgroundText: this.imageTextTwo()\n })\n } else if (this.state.backgroundSelection === \"Header-background-2\") {\n this.setState(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the Media tree
static getMediaTree(req, res) { MediaHelper.getTree(req.project, req.environment) .then((tree) => { res.status(200).send(tree); }) .catch((e) => { res.status(404).send(ApiController.printError(e)); }); }
[ "get tree() {\n return this.buffer ? null : this._tree._tree\n }", "get thumb() {\n const animatedThumb = this.thumbRef.current;\n return animatedThumb && animatedThumb.getNode();\n }", "function getMediaList( err ) {\n if( err ) {\n Y.log( 'error i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
submit button click handler to update reservation and table when sat
async function submitHandler(event) { event.preventDefault() const abortController = new AbortController() setErrors(null) const select = document.querySelector('select') const selectedId = select.options[select.selectedIndex].id try { await seatReservation(...
[ "function handleUpdateTrip() {\n\t$('main').on('submit','.edit-trip-form', function(event) {\n\t\tevent.preventDefault();\n\t\tconst tripId = $(this).data('id');\n\t\tconst toUpdateData = {\n\t\t\tid: tripId,\n\t\t\tname: $('.trip-name').val(),\n\t\t\tstartDate: new Date($('.start-date').val()),\n\t\t\tendDate: new...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: isRightMouseButton Returns true if the right mouse button was pressed. Note that this button might not be available on some systems. For handling a popup trigger should be used.
function isRightMouseButton(evt){ if ('which' in evt) { return evt.which === 3; } else { return evt.button === 2; } }
[ "isRightClicking() {\r\n return this.activeClick === RIGHT_CLICK_ID;\r\n }", "function detectLeftButton(evt) {\n evt = evt || window.event;\n if (\"buttons\" in evt) {\n return evt.buttons == 1;\n }\n var button = evt.which || evt.button;\n return button == 1;\n}", "_handleRowRightClic...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Translates the given message given the `TranslationBundle` This is used for translating elements / blocks see `_translateAttributes` for attributes noop when called in extraction mode (returns [])
_translateMessage(el, message) { if (message && this._mode === _VisitorMode.Merge) { const nodes = this._translations.get(message); if (nodes) { return nodes; } this._reportError(el, `Translation unavailable for message id="${this._translations.dig...
[ "function translate(messageParts, substitutions) {\n const message = parseMessage(messageParts, substitutions);\n const translation = $localize.TRANSLATIONS[message.translationKey];\n const result = (translation === undefined ? [messageParts, substitutions] : [\n translation.messageParts,\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copyright 2020 Inrupt Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,...
function internal_isDatasetCore(input) { return (typeof input === "object" && input !== null && typeof input.size === "number" && typeof input.add === "function" && typeof input.delete === "function" && typeof input.has === "function" && typeof input.match === "functi...
[ "function validateDataElementReference() {\n\tvar ids = {};\n\n\n\t//Data elements/data sets from indicator formulas\n\tvar result;\n\tif (metaData.indicators) {\n\t\t\n\t\tfor (var i = 0; metaData.indicators && i < metaData.indicators.length; i++) {\n\t\t\tresult = utils.idsFromIndicatorFormula(metaData.indicators...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Expand and normalize finder options
function mapFinderOptions(options, Model) { if (options.attributes && Array.isArray(options.attributes)) { options.attributes = Model._injectDependentVirtualAttributes(options.attributes); options.attributes = options.attributes.filter(v => !Model._virtualAttributes.has(v)); } mapOptionFieldNames(options...
[ "function toggleOptions() {\n\t\t\tif (optsView.className.indexOf('adi-hidden') !== -1) {\n\t\t\t\tremoveClass(optsView, 'adi-hidden');\n\t\t\t} else {\n\t\t\t\taddClass(optsView, 'adi-hidden');\n\t\t\t\tpathView.textContent = '';\n\t\t\t\tattrView.querySelector('.adi-content').innerHTML = '';\n\t\t\t\trefreshUI();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CREATED: David Levine 03/12/2018 Description: calculates the value of a unary function given a string representing the function and the corresponding value to evaluate. parameters: funcString: A string representing one of five supported functions, "fact" for factorial, "sin" for sine, "cos" for cosine, "tan" for tangen...
function evaluateFunction(funcString, funcParam, trigMode) { var valToReturn; switch (funcString) { case "fact": valToReturn = factorial(funcParam); break; case "inv": valToReturn = 1 / funcParam; break; case "sin": if(trigMod...
[ "function calculateFactor(tokenQueue, trigMode) {\n console.log(tokenQueue);\n /* Functions names that may appear in the factor. */\n var funcNames = [\"inv\",\"fact\", \"sin\", \"cos\", \"tan\", \"sqrt\"];\n var value;\n var token = tokenQueue.shift();\n\n /* Case expression wrapped in parenthesi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convierte las coordenadas en formato cartesiano a un punto
function Coordenadas_Cartesianas_APunto(Cartesiano) { try { var Noroeste = MapaCanvas.getProjection().fromLatLngToPoint(Bordes.getNorthEast()); var SurEste = MapaCanvas.getProjection().fromLatLngToPoint(Bordes.getSouthWest()); var Escala = Math.pow(2, ZoomMinimo...
[ "function hexToCartesian(hexCoordinates) {\n\tvar x = X_UNIT_VEC.x * hexCoordinates.x + Y_UNIT_VEC.x * hexCoordinates.y \n\t\t\t+ Z_UNIT_VEC.x * hexCoordinates.z;\n\tvar y = X_UNIT_VEC.y * hexCoordinates.x + Y_UNIT_VEC.y * hexCoordinates.y \n\t\t\t+ Z_UNIT_VEC.y * hexCoordinates.z;\n\treturn {x: x, y: y};\n}", "g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for getV3GroupsIdIssues
getV3GroupsIdIssues(incomingOptions, cb) { const Gitlab = require('./dist'); let defaultClient = Gitlab.ApiClient.instance; // Configure API key authorization: private_token_header let private_token_header = defaultClient.authentications['private_token_header']; private_token_header.apiKey = 'YOUR API KEY';...
[ "function getIssuesByProjectId(id){\n var deferred = $q.defer();\n\n $http.get(BASE_URL + 'projects/' + id + '/issues')\n .then(function(response){\n deferred.resolve(response.data);\n });\n\n return deferred.pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove `position`s from `tree`.
function removePosition(node, force) { visit(node, force ? hard : soft) return node }
[ "prune(callback) {\n if (_.isArray(this.contents)) {\n const length = this.contents.length;\n\n if ((this.type === \"REPEAT\" && length > 0) || (this.type === \"REPEAT1\" && length > 1)) {\n // Any subtree may be removed\n for (let i = 0; i < length; i++) {\n const tree = _.clone...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Starts the next game in the game sequence
moveToNextGame() { this._startGame(this._getNextGame()); }
[ "startGame() {\r\n this.generateInitialBoard();\r\n this.printBoard();\r\n this.getMoveInput();\r\n }", "function startNewGame(){\n\ttoggleNewGameSettings();\n\tnewGame();\n}", "checkNextGame (){\n\n }", "function startGame() {\n removeWelcome();\n questionIndex = 0;\n star...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
utilized ideas from here: and here: returns true if css is disabled in users browsers else returns false
function disabledCssCheck() { // check color style of 'cssCheck' div tag (should be set to red) if(window.getComputedStyle(document.getElementById("cssCheck"), null)["color"] == "rgb(255, 39, 39)" || window.getComputedStyle(document.getElementById("cssCheck"), null)["color"] == "rgb(255, 0, 0)"){ r...
[ "function isCssLoaded(name) {\n\n for (var i = 0; i < document.styleSheets.length; ++i) {\n\n var styleSheet = document.styleSheets[i];\n\n if (styleSheet.href && styleSheet.href.indexOf(name) > -1)\n return true;\n }\n ;\n\n return false;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears the save timer that tracks when to update google drive
function clearSaveTimer() { if (UpdateTimeOut) { window.clearTimeout(UpdateTimeOut); UpdateTimeOut = null; } }
[ "function deleteTimeDetails() {\n let timeDetails = myStorage.timeDetails;\n timeDetails = null;\n myStorage.timeDetails = timeDetails;\n myStorage.sync();\n}", "clear() {\n\t\tthis.watchList.forEach((item) => this.remove(item.uri));\n\t\tthis.watchList = [];\n\n\t\tchannel.appendLocalisedInfo('cleare...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : enableSelection AUTHOR : Juvindle C Tina DATE : March 26, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : enable/disable selection session type PARAMETERS : src,deviceresid
function enableSelection(src,deviceresid){ if(src != ""){ var cnt2 = 0; var cnt = 0; $('.openSelectedDevice').each(function(){ var did = $(this).attr('did'); if($(this).is(':checked')){ cnt++; $('#open_'+did).removeAttr("disabled"); }else{ $('#open_'+did).attr("disabled",true); } cnt2+...
[ "function LoadSaveOption(source,opt,opt2,from) {\n if (source.checked == true) {\n $('input[name=\"'+opt2+from+'Sel\"]').each(function() {\n $(this).prop('checked',true);\n $(this).parent().parent().addClass('highlight');\n var dev = $(this).val();\n enableRow1(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve all the model instances, paginated
getAll(req, res, next) { var request = new Request(req), response = new Response(request, this.expandsURLMap), criteria = this._buildCriteria(request); this.Model.paginate(criteria, request.options, function(err, paginatedResults, pageCount, itemCount) { /* istanbul ignore next ...
[ "paginate({ unlimited = false } = {}) {\r\n const { page: qPage, limit: qLimit, skip: qskip } = this.queryObj;\r\n\r\n const page = qPage * 1 || 1;\r\n let limit = unlimited ? undefined : defaultRecordPerQuery;\r\n if (qLimit)\r\n limit = qLimit * 1 > maxRecordsPerQuery ? maxRecordsPerQuery : qLimi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fileInputChanged will read the selected file and attempt to load the configuration settings. All loaded settings will be made visible for inspection by the user.
async fileInputChanged () { Doc.hide(this.errMsg) if (!this.fileInput.value) return const loaded = app().loading(this.form) const config = await this.fileInput.files[0].text() if (!config) return const res = await postJSON('/api/parseconfig', { configtext: config }) loaded() if...
[ "function inputFileOnChange () {\n $(config.inputfile).on('change', $('body'), function(event) {\n parent = $(this).parent();\n submitForm();\n });\n }", "function upload_config(){\n\tvar fileInput = document.getElementById('file_upload');\n\tvar file = fileInput.files[0];\n\tconsole.log('process...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
subprocess: only when it is not triggeredByEvent activity: only when it attach a compensation boundary event callActivity: no limitation
function canActivityBeCompensated(activity, boundaryEvents) { return (is(activity, 'bpmn:SubProcess') && !activity.triggeredByEvent) || is(activity, 'bpmn:CallActivity') || isCompensationEventAttachedToActivity(activity, boundaryEvents); }
[ "_spawnProcess (command, args, onstdout, onstderr) {\n return new Promise((resolve, reject) => {\n let shell = Spawn(command, args);\n shell.on('close', (code) => {\n resolve(code);\n });\n\n shell.stdout.on('data', (data) => {\n if (onstdout) {\n let d = data.toString(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
jvizTool navbar button icon class
function jvizToolNavbarBtnIcon(obj) { //Check for undefined object if(typeof obj === 'undefined'){ var obj = {}; } //Button ID this.id = (typeof obj.id !== 'undefined')? obj.id : ''; //Button class this.class = (typeof obj.class !== 'undefined')? obj.class : 'jvizFormBtnIconLight'; //Button title this.title ...
[ "function jvizToolNavbarBtn(obj)\n{\n\t//Check for undefined object\n\tif(typeof obj === 'undefined'){ var obj = {}; }\n\n\t//Button ID\n\tthis.id = (typeof obj.id !== 'undefined')? obj.id : '';\n\n\t//Button class\n\tthis.class = (typeof obj.class !== 'undefined')? obj.class : 'jvizFormBtn';\n\n\t//Button title\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the start of Hijri Month. `hMonth` is 0 for Muharram, 1 for Safar, etc. `hYear` is any Hijri hYear.
function getIslamicMonthStart(hYear, hMonth) { return Math.ceil(29.5 * hMonth) + (hYear - 1) * 354 + Math.floor((3 + 11 * hYear) / 30.0); }
[ "getMonthOfYear() {\n switch (this.getJMonth()) {\n case '1':\n return 'فروردین';\n case '2':\n return 'اردیبهشت';\n case '3':\n return 'خرداد';\n case '4':\n return 'تیر';\n case '5':\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
new ArgumentParser(options) Create a new ArgumentParser object. Options: `prog` The name of the program (default: Path.basename(process.argv[1])) `usage` A usage message (default: autogenerated from arguments) `description` A description of what the program does `epilog` Text following the argument descriptions `parent...
function ArgumentParser(options) { if (!(this instanceof ArgumentParser)) { return new ArgumentParser(options); } var self = this; options = options || {}; options.description = (options.description || null); options.argumentDefault = (options.argumentDefault || null); options.prefixChars = (options....
[ "function handle_options(optionsArray) {\n var programName = [];\n var currentItem = optionsArray.shift();\n var defaults = amberc.createDefaultConfiguration();\n\n while (currentItem != null) {\n switch (currentItem) {\n case '-C':\n defaults.configFile = optionsArray.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers the ts hook to compile typescript code within the memory
function registerTsHook(appRoot) { try { require(helpers_1.resolveFrom(appRoot, '@adonisjs/assembler/build/src/requireHook')).default(appRoot); } catch (error) { if (isMissingModuleError(error)) { throw new Error('AdonisJS requires "@adonisjs/assembler" in order to run typescript...
[ "function recompile() {\n if(compiling) {\n return;\n }\n\n compiling = true;\n\n console.log('Starting compile'.green);\n\n shell.exec('npm run tsc', {async: true}, (code, stdout, stderr) => {\n if(code === 0) {\n console.log(`Typescript compile completed`.green);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the element and Removes the entire Lesson Also deletes it from the page when it deletes it from the database
function removeLesson(element, lux){ console.log("=======Removing a Lesson========="); var fullLesson = element.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; var id = fullLesson.getElementsByClassName("lesson-name")[0].id; fullLesson.parentNode.removeChild(fullLesson); if(lux){ Ajax("../Lux/...
[ "function delSkill(eleId)\n{\n var skldata = document.getElementById('skillarray').textContent;\n var arrSkill = skldata.split(\",\");\n d = document;\n var childEle = d.getElementById(eleId);\n var parentEle = d.getElementById('SkillsObj');\n \n parentEle.removeChild(childEle);\n \n //delete arrSkill[eleI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets first element in an array that matches given predicate. Throws an error if no match is found.
function first(array, predicate) { for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { var x = array_3[_i]; if (predicate(x)) return x; } throw new Error("first:No element satisfies the condition.!"); }
[ "function firstVal(arr, func) {\n func(arr[0], index, arr);\n}", "function find(arr, searchValue){\n\treturn arr.filter(i=>{\n\t\treturn i===searchValue;\n\t})[0];\n}", "function firstMatch(array,regex) {\n return array.filter(RegExp.prototype.test.bind(regex))[0];\n}", "function findOrCreate(arr, predica...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Swaps a preexisting report with an updated version
function swapReports(newReport) { var index = reportCompare(newReport); // Report exists, swap it if(index > -1) reports[index] = newReport; else // Report doesn't exist, add it reports.push(newReport); return true; ...
[ "static discardOldVersions (records) {\n for (let i=0; i < records.length-1; i++) {\n for (let j=i+1; j < records.length; j++) {\n if (records[i].spell_name === records[j].spell_name) {\n let dateA = new Date(records[i].published);\n let dateB =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an approver for an ERC721 Token
async function getApproved(tokenID) { console.log('Getting Approver for an NF Token', tokenID); const nfToken = await NFTokenMetadata.at(await getContractAddress('NFTokenMetadata')); return nfToken.getApproved.call(tokenID); }
[ "async getContract() {\n let res = await axios(`${rahatServer}/api/v1/app/contracts/Rahat`);\n const { abi } = res.data;\n res = await axios(`${rahatServer}/api/v1/app/settings`);\n const contractAddress = res.data.agency.contracts.rahat;\n return new ethers.Contract(contractAddress, abi, wallet);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine knockback, stagger, or neither.
applyKnockbackStagger(victim, attackEntity) { // pre-extraction let isKnockbackable = victim.has(Component.Knockbackable); let isStaggerable = victim.has(Component.Staggerable); let otherComps = this.ecs.getComponents(attackEntity); let attack = otherComps.get...
[ "function hungry(hunger){\n \nreturn hunger <= 5 ? 'Grab a snack': 'Sit down and eat a meal';\n}", "function isSnowingv2() {\n if (weather === \"snowing\") {\n return \"it's snowing\";\n }\n else {\n return \"check back later for more details\";\n }\n}", "function C006_Isolation_Yuk...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add this object to the list of drawable entities of this Canvas.
attach(obj) { if (obj.draw) { this.entities.add(obj); return true; } throw new Error("The object passsed is not drawable."); }
[ "draw() {\r\n this._ctx.clearRect(0, 0, this._ctx.canvas.width, this._ctx.canvas.height);\r\n this._ctx.save();\r\n for (let i = 0; i < this._entities.length; i++) {\r\n this._entities[i].draw(this._ctx);\r\n }\r\n this._ctx.restore();\r\n }", "add_element(obj) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function LMSGetStudentID() Inputs:none Return:Unique Identifier used by the LMS to identify student OR null if the call failed Description: Note: The student_id is a read only field in SCORM and there is no corresponding SetValue
function LMSGetStudentID() { return(LMSGetValue("cmi.core.student_id")) }
[ "function LMSGetStudentName()\n{\n\treturn(LMSGetValue(\"cmi.core.student_name\"))\n}", "getCourseIDs(studentID) {\n const courseInstanceDocs = CourseInstances.find({ studentID }).fetch();\n const courseIDs = courseInstanceDocs.map((doc) => doc.courseID);\n return _.uniq(courseIDs);\n }", "getMSID() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check email input patten check phone number input pattern check zipcode pattern check whether password are the same or not
function checkValid() { if(!document.getElementById("email").value.match(/\S+@\S+\.\S+/)){ if (document.getElementById("email").value != "") { alert("Email Format is wrong!") return false; } } if (!document.getElementById("phone_number").value.match("^\\d{3}-\\d{3}-\\d{4}$")) { if (document.getElementBy...
[ "function validateSignupPassword(password1, password2)\n{\n var re = new RegExp(/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^0-9a-zA-Z].*).{6,}$/);\n if(password1.value == \"\" || password2.value == \"\") {\n $('#caMsg').html(\"You must enter a password.<br> (atleast 6 characters containing one uppercase AND lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the minimum zoom level (inclusive) at which the layer may be visible.
get minZoom() { return this._minZoom; }
[ "getZoomLevel() {\n return this.dynamics.zoom.current;\n }", "set minZoom(value) {\n this._minZoom = value;\n //Update visibility if necessary\n this.updateVisibility();\n }", "function currentZoomMap() {\n if(map)\n return map.getZoom();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Generic Distribution Provider Action by id.
static get(id){ let kparams = {}; kparams.id = id; return new kaltura.RequestBuilder('contentdistribution_genericdistributionprovideraction', 'get', kparams); }
[ "static getByProviderId(genericDistributionProviderId, actionType){\n\t\tlet kparams = {};\n\t\tkparams.genericDistributionProviderId = genericDistributionProviderId;\n\t\tkparams.actionType = actionType;\n\t\treturn new kaltura.RequestBuilder('contentdistribution_genericdistributionprovideraction', 'getByProviderI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add an AI player to the game
function addAI() { if (!availableIDs.length) { // No more room return; } logger.info("Adding AI"); clientCount++; var playerID = availableIDs.pop(); var newHand = new Hand(0); var ai = new Player(playerID, null, "Agent " + playerID, newHand); // Give hand to new player dealHand(ai, FACEDOWN); ai.han...
[ "function addPlayer(username)\n{\n // Check that this player isn't in a lobby already\n if (lobbies.some(lobby =>\n lobby.players.some(player =>\n player.username == username\n )\n ))\n {\n throw 'This player is already in a lobby.';\n }\n\n // Creat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates template with the given node and question
updateTemplateForNode(node) { console.log('Updating for node: ' + node.node_id); // Lookup related question for given node var matchingQuestion = this.findQuestionForQuestionId(node.question_id); // Reset document.getElementById("sp-text").value = null; document.getElementById("sp-radio-...
[ "function generateQuestionElement(currentQuestion) {\n let tempQuestion = STORE.questions[currentQuestion];\n let tempPageNum = STORE.questionNumber + 1;\n return `<section id=\"question set\">\n <div class=\"page\">\n <form id=\"js-form\" name=\"form\">\n <h2>${tempQuestion.question}</h2>\n <input id ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns `true` if the either is an instance of `Left`, `false` otherwise
function isLeft(ma) { switch (ma._tag) { case 'Left': return true; case 'Right': return false; } }
[ "noMovesLeft () {\n if (this.movesLeft < 1) {\n return true\n } else {\n return false\n }\n }", "isLeftClicking() {\r\n return this.activeClick === LEFT_CLICK_ID;\r\n }", "function checkForOverlap(currentDropArea , leftPos,width) {\n\t\tvar children = currentDropArea.children;\n\t\tfor(v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if box fits on bed
function isOnBed(bed, box) { setOutline(bed); return (insideHull(box, getOutline(bed)) >= 0); }
[ "function collides(bed, box) {\n\tif (isEmpty(bed)) {\n\t\treturn false;\n\t}\n\n\tfor (var i = 0; i < bed.boxes.length; i++) {\n\t\t//Check if boxes are the same (then outsideHull will return)\n\t\tif (equalBoxes(box, bed.boxes[i])) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!outsideHull(box, getHull(bed.boxes[i]))) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merge two text nodes: `node` into `prev`.
function mergeText(prev, node) { prev.value += node.value; return prev; }
[ "function merge(n) {\n if (n.nodeType === Node.TEXT_NODE) {\n if (n.nextSibling && n.nextSibling.nodeType === Node.TEXT_NODE) {\n n.textContent += n.nextSibling.textContent;\n n.nextSibling.parentNode.removeChild(n.nextSibling);\n }\n\n if (n.previousSibling && n.previo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selects and sets an existing stack matching the stack name, failing if none exists.
selectStack(stackName) { return __awaiter(this, void 0, void 0, function* () { // If this is a remote workspace, we don't want to actually select the stack (which would modify global state); // but we will ensure the stack exists by calling `pulumi stack`. const args = ["stac...
[ "static selectStack(args, opts) {\n return __awaiter(this, void 0, void 0, function* () {\n const ws = yield createLocalWorkspace(args, opts);\n const stack = yield stack_1.Stack.select(args.stackName, ws);\n return remoteStack_1.RemoteStack.create(stack);\n });\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function declarations test function to check memory use
function checkMemory() { const used = process.memoryUsage(); for (let key in used) { console.log(`${key} ${Math.round(used[key] / 1024 / 1024 * 100) / 100} MB`); } }
[ "function test2() {\n const v8 = require('v8');\n console.log(v8.getHeapSpaceStatistics());\n}", "function m_private_memory_size() {\n return 4224;\t\t// This is specific to descrypt8m\n}", "function clearMemory(){ memory = [] }", "check() {\n if (this.refCounts.size == 1) return 0; // purerc root...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
methodsetHTML returns HTML for the methodset of the specified TypeInfoJSON value.
function methodsetHTML(info) { var html = ""; if (info.Methods != null) { for (var i = 0; i < info.Methods.length; i++) { html += "<code>" + makeAnchor(info.Methods[i]) + "</code><br/>\n"; } } return html; }
[ "function setupTypeInfo() {\n for (var i in document.ANALYSIS_DATA) {\n var data = document.ANALYSIS_DATA[i];\n\n var el = document.getElementById(\"implements-\" + i);\n if (el != null) {\n // el != null => data is TypeInfoJSON.\n if (data.ImplGroups != null) {\n el.innerHTML = implement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert size from percent to pixels, using max as reference for 100%
function percentToPixel(size, max) { let percentRegexp = /^[0-9]{1,3}%$/; let pixelRegexp = /^[0-9]*px$/; if (pixelRegexp.exec(size)) { return parseInt(size); } else if (percentRegexp.exec(size)) { return (parseInt(size) / 100.0) * max; } else return parseInt...
[ "function scalePercent(percent, min, max) {\n const scale = max - min;\n return clamp((percent - min) / scale, 0, 1);\n }", "pixelToPercent(x)\n {\n if (!this.field || !this.field.offsetWidth)\n {\n return 0;\n }\n\n const percent = x / this.field.offsetWidth;\n\n if (this.props.steps)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replaces the contents of devices collection with the new device list minimizing the number of collection events fired during the update. This is achieved by adding new devices and deleting removed devices (vs. emptying the collection and filling it up from scratch).
function updateDeviceCollection(collDevices, devices) { var keysToDelete = []; // compare current device collection with the newly built set; // after this array devices should contain only new devices to be ...
[ "update() {\n for (let device of this.devices) {\n device.update();\n }\n }", "loadDevices() {\n\t\t\t$.get('/devices', devices => {\n\n\t\t\t\tdevices.forEach(device => {\n\t\t\t\t\tif (device.id in this.entities)\n\t\t\t\t\t{\n\t\t\t\t\t\t// Update existing\n\t\t\t\t\t\tthis.entities[device.id].devi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes an HTML string, converts to HTML using a DOM parser and recursivly parses the content into pdfmake compatible doc definition
convertHtml(htmlText, lnMode) { const docDef = []; this.lineNumberingMode = lnMode || LineNumberingMode.None; // Cleanup of dirty html would happen here // Create a HTML DOM tree out of html string const parser = new DOMParser(); const parsedHtml = parser.parseFromString(...
[ "function buildDom(htmlString) {\r\n const div = document.createElement(\"div\");\r\n div.innerHTML = htmlString;\r\n return div.children[0];\r\n}", "function Markdown(text){var parser;return\"undefined\"==typeof arguments.callee.parser?(parser=eval(\"new \"+MARKDOWN_PARSER_CLASS+\"()\"),parser.init(),argument...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes word from display
function removeWord () { firstWord.remove(); }
[ "function hideLetters() {\n\t\t\thide = '';\n\t\t\tfor(i = 0; i < word.length; i++) {\n\t\t\t\thide += \"-\";\n\t\t\t}\n\t\t\tconsole.log(hide);\n\t\t\tvar targetA = document.getElementById(\"word\");\n\t\t\ttargetA.innerHTML = hide;\n\t\t}", "function unfocusWord() {\n $('.word').removeClass('word-active'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that applies styling to the uv index to call attention to the different levels
function uvStyles(uvIndex){ if(uvIndex > 0 && (uvIndex < 3)) { cityUv.className = "low"; } if(uvIndex > 3 && (uvIndex < 6)){ cityUv.className = "medium"; } if(uvIndex > 6 && (uvInde...
[ "function uvIndexBackground(uviNum) {\n let uvi = $(\"#uvi\");\n console.log(\"uvi\", uviNum);\n // let uvIndP = $(\"#uvIndexPara\");\n if (uviNum >= 0 && uviNum < 3) {\n uvi.css(\"background\", \"greenyellow\");\n } else if (uviNum >= 3 && uviNum <= 5) {\n uvi.css(\"background\", \"yellow\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
optimisticGet transforms a get promise and sets response data into object
function optimisticGet(get, injectInto, withPropertyName) { get.then(function (response) { injectInto[withPropertyName] = response.data; return response; }); }
[ "function get_load(id, req){\r\n var fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl;\r\n const key = datastore.key([LOAD, parseInt(id, 10)]);\r\n var format = []; \r\n return new Promise( function(resolve, reject){\r\n datastore.get(key, (err, entity)=>{\r\n if(err ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the default interpolation time in millis.
setDefaultInterpolationTime(duration) { this.timedRot .default_duration = duration; this.timedPan .default_duration = duration; this.timedzoom.default_duration = duration; }
[ "function changeDefaultTimeOut() {\n let user = db.ref('users/' + userId);\n\n const newDefaultTime = app.getArgument('newDefaultTime');\n\n if (newDefaultTime && (newDefaultTime * 60) > 0) {\n let minutes = parseInt(newDefaultTime) * 60;\n let promise = user.set({userId: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resolution du maze automatiquement
function resolveMaze(){ tryMaze(positionFixe); traceRoad(chemin_parcouru,"color2"); traceRoad(tabVisite); }
[ "get gridResolutionZ() {}", "set gridResolutionZ(value) {}", "get gridResolutionY() {}", "function Maze($where, size) {\n\t\n\tvar $canvas = $where.find('canvas')\n\t$canvas.attr({width:size, height:size})\n\tthis.$log = $where.find('#moves').eq(0)\n\tthis.$description = $where.find('#description').eq(0)\n\tt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1s after load, Mole appears in random hole
function assignMole() { var circle = circles[Math.floor(Math.random() * circles.length)]; circle.style.backgroundImage = "url(mole.png)"; circle.hasMole = true; }
[ "function repeatMoles () {\r\n randHoleIdx = Math.floor(Math.random()*(holes.length)+1);\r\n holes[randHoleIdx].classList.toggle(\"mole\");\r\n}", "function moveMole() {\n let timerId = null;\n //performs randomSquare function every 1000ms or 1s\n timerId = setInterval(randomSquare, 100...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unregisters the listener for detecting an NFC peertopeer target.
function unsetPeerListener() { if (!_security.unsetPeerListener) { throw new WebAPIException(errorcode.SECURITY_ERR); } if (!powered || !_data.listener.onPeerDetected) { return; } _data.listener.onPeerDetected = null; }
[ "static detachListener(cb) {\n firebase.database().ref(BASE).off(\"value\", cb);\n }", "disconnectedCallback() {\n super.disconnectedCallback();\n document.removeEventListener('incoming-custom-event', this.handleIncoming)\n }", "undelegate(eventName, selector, listener, uid) {\n\n\t\tif (this.e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the given function throws the given value when invoked. The value may be: undefined, to merely assert there was a throw a constructor function, for comparing using instanceof a regular expression, to compare with the error message a string, to find in the error message
function functionThrows(fn, context, args, value) { try { fn.apply(context, args); } catch (error) { if (value == null) return true; if (isFunction(value) && error instanceof value) return true; var message = error.message || error; if (typeof message === 'string') { if (_isRege...
[ "function raises (fn, errorValidator) {\n\t verify(low.fn(fn), 'expected function that raises')\n\t try {\n\t fn()\n\t } catch (err) {\n\t if (typeof errorValidator === 'undefined') {\n\t return true\n\t }\n\t if (typeof errorValidator === 'function') {\n\t return errorValidator(err)\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether the button is checked.
get checked() { return this.buttonToggleGroup ? this.buttonToggleGroup._isSelected(this) : this._checked; }
[ "isItemChecked(item) {\n return this.composer.getItemPropertyValue(item, 'selected') === true;\n }", "get defaultChecked() {\n return this.hasAttribute('checked');\n }", "function checkCheckBox(cb){\r\n\treturn cb.checked;\r\n}", "isTriggered() {\n return this.buttonClicked;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A searchable list of journal entries
function JournalEntryList(elementId, entries, filterCallback = () => { }) { // The element Id containing the list this.elementId = elementId; // The list of journal entries this.entries = entries.slice(); this.entries.sort(); this.entries.reverse(); // The list entries currently displayed...
[ "function EntryList() { }", "getJournals() {\n console.log(\"fetching journals\")\n API.getJournalEntries().then(parsedJournals => {\n displayJournals(parsedJournals);\n })\n }", "function entries() {\n var each = function each(callback) {\n for (var i = 0; i < this.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
class ChatWindow encapsulates the data and methods required to display chat messages and notifications, and to process the user events generated for a specific chat channel
function ChatWindow(channelName,chatClient) { var self= this; self._channel = channelName; self._client = chatClient; self._players = {}; //set up the main chat area self._chatWindow = $('<div class="ChatWindow"></div>'); //setup the chat log area self._chatLogContainer = $('<d...
[ "function ChatBoxWindow( userObject, parentElement )\n{\n\t/** private variables **/\n\t\n\tvar myUser = userObject;\n\tvar windowElement = null;\n\tvar chatBoxContentElement = null;\n\tvar chatBoxBufferTextInputElement = null;\n\tvar listenerList = new Array( );\n\tvar selfReference = this;\n\t\n\t/** methods **/\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the last node entry in a root node from a path.
last(root, path) { var p = path.slice(); var n = Node$1.get(root, p); while (n) { if (Text.isText(n) || n.children.length === 0) { break; } else { var i = n.children.length - 1; n = n.children[i]; p.push(i); } } return [n, p...
[ "function getLastPath() {\n if (url.path.components.length > 0) {\n return url.path.components[url.path.components.length - 1];\n }\n }", "function lastRealPoint(path) {\n if (path.isEmpty()) {\n console.warn(\"Attemtped to obtain the last segment of an empty path\");...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Match mother of the person
mother(person) { return person.mother; }
[ "function calcMotherAge(p) {\n console.log(\"person: \" + JSON.stringify(p));\n var mother = byName[p.mother]\n var mother_age = p.born - mother.born;\n console.log(\"mother: \" + p.mother + \", age: \" + mother_age);\n return mother_age;\n}", "function extractMother(paragraph) {\n var start = p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
targetSlide display slide containing ID=target, or the target'th slide
function targetSlide(target) { var h, n; if ((h = document.getElementById(target))) /* Find enclosing .slide or preceding H1 */ while (h && !isStartOfSlide(h)) h = h.previousSibling || h.parentNode; else if ((n = parseInt(target)) > 0) /* Find the start of the n'th slide. */ for (h = document.bod...
[ "function MM_effectSlide(targetElement, duration, from, to, toggle)\n{\n\tSpry.Effect.DoSlide(targetElement, {duration: duration, from: from, to: to, toggle: toggle});\n}", "moveToSlide( slide) {\n console.debug( \"dia-show › moveToSlide()\", slide);\n this.slide = slide != undefined ? slide : null;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! longDate(date) ! Returns a long Date ! ! QML: MoviePage.qml and MovieDetails.qml
function longDate(date) { var myDate=date; myDate=myDate.split("-"); var newDate=myDate[1]+"/"+myDate[0]+"/"+myDate[2]; var d = new Date(newDate).getDay(); var m = new Date(newDate).getMonth(); var month_names_short = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov'...
[ "function movieDateDetail(date)\n{\n\n var myDate=date;\n myDate=myDate.split(\"-\");\n var newDate=myDate[1]+\"/\"+myDate[0]+\"/\"+myDate[2];\n var m = new Date(newDate).getMonth();\n\n var month_names_short = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set Const.prototype.__proto__ to Super.prototype
function inherit (Const, Super) { function F () {} F.prototype = Super.prototype; Const.prototype = new F(); Const.prototype.constructor = Const; }
[ "function extend(__proto__) {\n for (var key in __proto__) {\n if (hasOwnProperty.call(__proto__, key)) {\n this[key] = __proto__[key];\n }\n }\n return this;\n }", "function inheritPrototype(subType, superType) {\n var proto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the Universal Coordinated Time (UTC) of solar noon for the given day at the given location on earth in degrees in minutes from zero Z
function calcSolNoonUTC(t, longitude) { // First pass uses approximate solar noon to calculate eqtime var tnoon = calcTimeJulianCent(calcJDFromJulianCent(t) + longitude/360.0); var eqTime = calcEquationOfTime(tnoon); var solNoonUTC = 720 + (longitude * 4) - eqTime; // min var newt = calcTimeJulianCe...
[ "function calcSunriseUTC(JD, latitude, longitude) {\n var t = calcTimeJulianCent(JD);\n // Find the time of solar noon at the location, and use that declination.\n // This is better than start of the Julian Day\n var noonmin = calcSolNoonUTC(t, longitude);\n var tnoon = calcTimeJulianCent (JD+noonmin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an anum type. Examples ```ts db.schema.createType('species').asEnum(['cat', 'dog', 'frog']) ```
asEnum(values) { return new CreateTypeBuilder({ ...this.#props, node: create_type_node_js_1.CreateTypeNode.cloneWithEnum(this.#props.node, values), }); }
[ "function addType() {\n\t\tvar args = extract(\n\t\t\t{ name: 'name', test: function(o) { return typeof o === 'string'; } },\n\t\t\t{ name: 'type', parse: function(o) {\n\t\t\t\treturn (o instanceof Type) ? o : new Type(this.name || o.name, o);\n\t\t\t} }\n\t\t).from(arguments);\n\n\t\ttypeList.push(args.type);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the keys of current user's favorites.
getFavoriteKeys() { return apiFetch( { path: '/vtblocks/v1/layouts/favorites', method: 'GET', } ).then( favorite_keys => { return favorite_keys; } ).catch( error => console.error( error ) ); }
[ "getFavorites() {\n\t\treturn apiFetch(\n\t\t\t{\n\t\t\t\tpath: '/vtblocks/v1/layouts/favorites',\n\t\t\t\tmethod: 'GET',\n\t\t\t}\n\t\t).then(\n\t\t\tfavorite_keys => {\n\t\t\t\tlet favorites = [];\n\n\t\t\t\tObject.values( this.state.all ).forEach( function( item ) {\n\t\t\t\t\tif ( favorite_keys.includes( item.k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import BeerFavourites from './components/BeerFavourites';
function App() { return ( <div className="App"> <img src="brewdoglogo.png" width="175" height="200"/> <BeerContainer /> {/* <BeerFavourites /> */} </div> ); }
[ "function bouUp () {\r\n return(\r\n \r\n <AppComponent/>\r\n\r\n //<displayWeather/>\r\n\r\n \r\n );\r\n}", "function App() {\n return (\n <div>\n {/* <BaiTapBurger /> */}\n <BaiTapBauCua />\n </div>\n );\n}", "function App() {\n return (\n <div className...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the wip segment only exists if there is a wipshape in progress with a point.
get wipSegment() { if (this.wip == null) return null; if (this.wip.points.length === 0) return null; return [ last(this.wip.points), this.mouse ]; }
[ "function isInBounds(point) {\n\t\tif (point >= bounds.sw && point <= bounds.nw) {\n\t\t\tconsole.log(\"point in bounds\");\n\t\t}\n\t}", "function check_point(p) {\n if (p.x < 0 || p.x > 9) {\n return false;\n } else if (p.y < 0 || p.y > 9) {\n return false;\n } else if (spielfeld[p.y][p.x...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Date picker manager. Use the singleton instance of this class, $.datepick, to interact with the date picker. Settings for (groups of) date pickers are maintained in an instance object, allowing multiple different settings on the same page.
function Datepick() { this._uuid = new Date().getTime(); // Unique identifier seed this._curInst = null; // The current instance in use this._keyEvent = false; // If the last event was a key event this._disabledInputs = []; // List of date picker inputs that have been disabled this._datepickerShowing = false;...
[ "function createDatePicker(controlId, options) {\n var fieldId = jQuery(\"#\" + controlId).closest(\"div[data-role='InputField']\").attr(\"id\");\n jQuery(function () {\n var datePickerControl = jQuery(\"#\" + controlId);\n datePickerControl.datepicker(options);\n datePickerControl.datepi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs every monitor frame. Each repeater will then be ran the number of times required to appear to be running at the required frames per second
function runRepeaters () { var i = 0, j, dte = +new Date(), repeater; for (; i<repeaters.length; i+=1 ) { repeater = repeaters[i]; if ( repeater.isrunning ) { j = repeater.mspt === -1 ? 1 : Math.floor( (dte - repeater.tick) / repeater.mspt ); for (; j>0; j-=1 ) { repeater.tick...
[ "function start_loop(fps) {\n fps_interval = 1000 / fps;\n then = Date.now();\n loop();\n }", "function loop() {\n\tcount = new Date().getHours();\n\tdocument.body.style.backgroundImage = ((count > 3 && count < 21) ? url_day : url_night);\n\tdocument.body.style.backgroundPosition = \"top, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assigns the header height for a table to be a given value of the height of another table's header. tableid the table id headerheight desired height of last header row in pixels releatedid the id of a related table (typcially a master in a sync case) return none Compatibility: IE restrictions : single row headers only
function i2uiAssignHeaderHeight(tableid, headerheight, relatedid) { var headeritem = document.getElementById(tableid+"_header"); if (relatedid != null) { var relatedheaderitem = document.getElementById(relatedid+"_header"); headerheight = relatedheaderitem.rows[0].style.height; } headeri...
[ "function i2uiResizeColumnsWithFixedHeaderHeight(tableid, headerheight, slave)\r\n{\r\n var headeritem = document.getElementById(tableid+\"_header\");\r\n var dataitem = document.getElementById(tableid+\"_data\");\r\n var scrolleritem = document.getElementById(tableid+\"_scroller\");\r\n\r\n if (header...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Filter Group Key Name
async function getFilterGroupKeyName(internalName, key){ let data = await FiltersService.getFilter(key, internalName); let filterName = key; if(internalName == 'peopleId'){ let peopleData = await PeopleService.getPeople(key); filterName = peopleData[0].firstName + " " + peopleData[0].lastName; } if(da...
[ "function _getGroupKeySelector(item) {\n return item.group.key;\n }", "function FILTER_KEY(key) {\n var string = %ToString(key);\n if (%HasProperty(this, string)) return string;\n return 0;\n}", "function extGroup_getDataSourceFileName(groupName)\n{\n return dw.getExtDataValue(groupName, \"dataSou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prevent element from initializing properties when it's upgrade disabled.
_initializeProperties() { if (this.hasAttribute(DISABLED_ATTR)) { this.__isUpgradeDisabled = true; } else { super._initializeProperties(); } }
[ "onDisabled() {\n this.updateInvalid();\n }", "function storeOriginalDisabledProperty(element) {\n //capture original disabled property value\n if (element.data('original-disabled') === undefined) {\n element.data(\"original-disabled\", element.prop(\"disabled\"));\n }\n}", "wakeUp () ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An action icon (e.g., "edit") is clicked next to entry
function onEntryAction(evt) { if ($(this).hasClass("edit")) { zdPage.navigate("edit/existing/" + $(this).data("entry-id")); //window.open("/" + zdPage.getLang() + "/edit/existing/" + $(this).data("entry-id")); } }
[ "function on_edit_button_click(){\n\t\tif ($(this).text()=='Edit'){\n\t\t\t$(\"#middle\").find(\"button.edit\").text('Edit')\n\t\t\t\t.siblings('span').hide()\n\t\t\t\t.siblings('span.value').show();\n\n\t\t\t$(this).siblings('span').show()\n\t\t \t\t\t .siblings('span.value').hide();\n\t\t\t$(this).text('Cancel')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
approve Property Registration on the network
async approvePropertyRegistration(ctx, propertyId) { // Verify the CLient is an registar or not let cid = new ClientIdentity(ctx.stub); let mspID = cid.getMSPID(); if (mspID !== "registrarMSP") { throw new Error('You are not authorized to invoke this fuction'); ...
[ "async propertyRegistrationRequest(ctx, propertyId, price, status, name, aadharNumber){\r\n\r\n\t\tconst userKey = ctx.stub.createCompositeKey('org.property-registration-network.regnet.user',[name, aadharNumber]);\r\n\r\n\t\tconst requestKey = ctx.stub.createCompositeKey('org.property-registration-network.regnet.re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a promise with all the products in the catalog
function searchAllProducts() { let all_products = new Promise(function(resolve, reject) { setTimeout(function() { if(catalog.length > 0) { resolve(catalog); } else { reject("Catalog em...
[ "function getAllProducts () {\r\n return db.query(`SELECT * from products`).then(result => {\r\n return result.rows\r\n })\r\n}", "function getProducts() {\n var params = getParams();\n params[\"categoryID\"] = $scope.categoryId;\n categoryApiService.getProductsByCategoryId(p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subtracts value of each new purchase from budget total
deductBudget() { let price = parseInt(costClothing.value, 10); runningBudget -= price; updateBudget(); }
[ "function _adjust_campaign_budget(my_tot_cost) {\n var today = new Date();\n // Accounting for December\n var eom = (today.getMonth() == 11) ? new Date(today.getFullYear()+1,0,1) : \n new Date(today.getFullYear(),today.getMonth()+1,1);\n var days_left = Math.round((eom-toda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
After calling this, if `this.point` != null, the next range is a point. Otherwise, it's a regular range, covered by `this.active`.
next() { let from = this.to, wasPoint = this.point this.point = null let trackOpen = this.openStart < 0 ? [] : null for (;;) { let a = this.minActive if ( a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a]....
[ "next() {\n let from = this.to;\n this.point = null;\n let trackOpen = this.openStart < 0 ? [] : null, trackExtra = 0;\n for (;;) {\n let a = this.minActive;\n if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by Java9ParserelementValueList.
enterElementValueList(ctx) { }
[ "enterElementValuePairList(ctx) {\n\t}", "function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseCounter][1]; //check type of token\n\n\tif (tempDesc == ' print' || tempType == 'identifier' || tempType == 'type' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fungsi string index of unrtuk mengetahui urutan indexnya
function indexoff(){ var isi = "saya beajar di rumah"; console.log(isi.indexOf("beajar")); }
[ "function last(){\n\tvar isi = \"saya beajar di rumah beajar\";\n\tconsole.log(isi.lastIndexOf(\"beajar\",5)); //nilai angka berfungsi sebagai startnya di index\n}", "function getJouerParIndex(index) {\n let JoueurID = `#Joueur_${index}`;\n return $(JoueurID).val();\n}", "function findWordIndex(word) {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update month totals array after refund
function updateMonths() { var tgtMonth = -1; var i; //find the index of the month for which order is being refunded for(i = 0; i < months.length; i++) { if(orderDate.includes(months[i])) { tgtMonth = i; break; } } var diff = monthTotals[tgtMonth]...
[ "function copyMonthTotalsToMaster() {\n var column,\n month,\n range,\n row,\n sheet,\n values,\n spreadsheet,\n sheet;\n \n spreadsheet = SpreadsheetApp.getActiveSpreadsheet();\n sheet = spreadsheet.getActiveSheet();\n \n month = ScriptProperties.getProperty('month');\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Uploads the last file fragment and commits the file. The current file content is changed when this method completes. Use the uploadId value that was passed to the StartUpload method that started the upload session. This method is currently available only on Office 365.
async finishUpload(uploadId, fileOffset, fragment) { const response = await spPost(File(this, `finishUpload(uploadId=guid'${uploadId}',fileOffset=${fileOffset})`), { body: fragment }); return { data: response, file: fileFromServerRelativePath(this, response.ServerRelativeUrl), ...
[ "function commitJob(done) {\n if (!req.params.fullUploadPath) {\n return done(new Error(\"Upload path could not be created\"));\n }\n\n async.waterfall([\n async.apply(AppdataJob.findById.bind(AppdataJob), jobId),\n function(job, cb) {\n var fileNamePath = path.join(req.params.fullUpl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Here is how the email feature works. We move the bitcoins to be sent over to a new random bitcoin address and email the recipient the a code containing the private key matching the bitcoin address. The recipient can then move the bitcoins to their own bitcoin address. So the whole process actually requires two bitcoin ...
function homeMakeEmailTx(){ var to, from, amount, date, message, rawCode, rand, key, bita, pw var k1, redeem, recover, code to = removeWhiteSpace($('#homeSendToEmail').val().toLowerCase()) if (to == ''){ alert('To Email must be given.'); return null; } from = G.email amount = p...
[ "'mobileRecoverPasswordEmail'(email) {\n Email.send({\n to: email,\n from: \"kupongoteam@kupongo.com\",\n subject: \"Password recovery\",\n html: /*link this to mobile Reset.js page */ \"Link to reset page\",\n });\n }", "static async inviteUsers(company_id, user_emails) {\n\t\t// find company...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }