query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
It validates the targeting details entered by user in the lineItem Targeting Table fields
function validateAddTargets(){ var returnFlag = true; clearCSSErrors("#lineItemTargetingTable", "#lineItemTargeting"); // Target Type should not be null while adding the targeting to the lineItem Targeting Table if ($('#sosTarTypeId').val() == "") { $('#sosTarTypeId').addClass("errorElement ...
[ "function addTargetsToLineItem(){\r\n\tif (validateAddTargets()) {\r\n\t\tvar valueToPrint = \"\";\r\n\t\tvar selectedElements = [];\r\n\t\tvar level = \"--\";\r\n\t\tvar not= \"--\";\r\n\t\tvar operation = \"--\";\r\n\t\tvar previousRowId = $(\"#geoTargetsummary\" , \"#lineItemTargeting\").find(\"tr:last\").attr(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flag the IDL selection as clean. This does not change the selection.
function setUISelectionClean(element) { element[UISelection] = undefined; }
[ "function UnselectAll() {}", "deselectAll() {\n window.getSelection().empty();\n }", "_cleanSelections(uuid) {\n const markers = this.selectionMarkers[uuid];\n if (markers) {\n markers.forEach(marker => {\n marker.clear();\n });\n }\n delete t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: checkAdvRS DESCRIPTION: Check the AdvRS version ARGUMENTS: version the version to check RETURNS: true if the furrent version is greater than the given one false othervise (no advrs installed / version smaller than given one)
function checkAdvRS(version) { if ((!MM.AdvRs_Version) || (MM.AdvRs_Version < version)) { return false; } return true; }
[ "function checkSdkVersion(version, next) {\n\n\tif(version) {\n\n\t\tSdkGlobalVersion.findOne({}, function(err, sgv){\n\n\t\t\tif(err) {\n\n\t\t\t\tlog.error(err);\n\t\t\t\tnext(false);\n\n\t\t\t} else {\n\n\t\t\t\tvar temp = version.split(\";\"),\n\t\t\t\t\ttype = temp[0],\n\t\t\t\t\tver = temp[1];\n\n\t\t\t\tif(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Foreach reel, play its spinning animation
playSpinningAnimations() { this.reels.forEach((reel, i) => { reel.play(`reel${i + 1}Animation`); }); }
[ "function spin_reels() {\n $('#keyframes').empty();\n $('.reel, #results *').removeClass('active');\n\n var reel_params = get_reel_params();\n\n $('#keyframes').append(keyframe_rule('reel-1-spin', reel_params[0]),\n keyframe_rule('reel-2-spin', reel_params[1]),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets all the methods names in the class, and insert the chosen method.
function insertMethod(method) { var methods = hidden.value.split("\n"); experior.editor.insertMethod(method); experior.contentWindow.focus(); }
[ "function appendMethods(list, addition) {\n\t for (var i = 0; i < addition.length; i++) {\n\t var method = addition[i];\n\t if (list.indexOf(method) === -1) {\n\t list.push(method);\n\t }\n\t }\n\t}", "function appendMethods(list, addition) {\n for (var i = 0; i < addition.length; i++) {\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
'''load_search''' loads the West Corporation style search query for the job title set by my_query.job_title r loads the first 20 alphabetically otherwise if my_query.job_title isn't set Letting json_response=JSON.parse(response.responseText), json_response.d.results should have a list of objects of the results to the q...
function loadSearch() { var json={"firstRecord":0,"groupIds":my_query.groupIds,"lastRecord":19, "portletInstanceId":my_query.portletInstanceId, "searchTerm":my_query.job_title,"sortOrder":"LastName,FirstName ASC","searchByJobTitle":true}; if(my_query.job_title===und...
[ "function buildResults(searchKeyword,searchLocation,limit,resultsnum,pageNumber,first,home) {\n\n\tvar searchKey =searchKeyword;\n\tvar searchLoc = searchLocation;\n\tvar lim = limit;\n\tvar resultsNumber = resultsnum;\n\tvar pagenum = pageNumber;\n\tvar initialSearch = first;\n\tvar center = home;\n\n\tgetCenter(c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when we don't know what we're looking for, we use `queryRecord` on the `Page` adapter to look up a wagtail page by its URL path this will redirect to a deatil view, but since we don't know the ID ahead of time, this needs to be a query.
queryRecord(_store, _type, query = {}, options = {}) { let preview = get(options, 'adapterOptions.preview'); if (!query.html_path && !preview) { throw new Error('html_path is a required argument'); } let url; if (preview) { let { identifier, token } = query; identifier = encodeURI...
[ "handleSingleResultRedirect() {\n const {\n embed, units, getAddressNavigatorParams, isFetching, match,\n } = this.props;\n\n // If not currently searching and view should not fetch new search\n // and only 1 result found redirect directly to specific result page\n if (!isFetching && !this.shoul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return base project scope, given a `parentScope`. TODOC...
getScope(parentScope = SpellParser.rootScope) { // Make a parser that depends on the parentScope's parser // This way rules added to the project won't leak out. const parser = parentScope.parser.clone({ module: this.path }) return new ProjectScope({ name: this.projectName, path: this.path, ...
[ "getParentScope() {\n let scope;\n //use the global scope if we didn't find a sope and this is not the global scope\n if (this.program.globalScope !== this) {\n scope = this.program.globalScope;\n }\n if (scope) {\n return scope;\n }\n else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get next valid paragraph format from field
getNextValidCharacterFormatOfField(fieldBegin) { let startInline = fieldBegin; if (HelperMethods.isLinkedFieldCharacter(fieldBegin)) { if (isNullOrUndefined(fieldBegin.fieldSeparator)) { startInline = fieldBegin.fieldEnd; } else { start...
[ "getNextValidCharacterFormat(inline) {\n let startInline = this.getNextTextElement(inline);\n if (isNullOrUndefined(startInline)) {\n return inline.characterFormat;\n }\n let fieldBegin = undefined;\n if (startInline instanceof FieldElementBox) {\n if (fieldB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /api/styles get all the styles from db controllers.styles.index
function index(req, res) { db.Style.find({}, function(err, foundStyles) { console.log("this is styles u logged", foundStyles); res.json(foundStyles); }); }
[ "function getStylesList() {\n $http({\n method: \"GET\",\n url: '/api/styles/list'\n }).then(function mySuccess(response) {\n vm.styles = vm.styles || response.data;\n }, function myError(response) {\n vm.styles = null;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Balls slowly spinning around y axis, camera rotating on z axis, and clouds slowly rotating.
animate() { this.renderScene() this.frameId = window.requestAnimationFrame(this.animate) this.camera.rotation.z -= .0004; this.clouds1.rotation.y += .001; this.clouds2.rotation.y += .001; this.yinYang.rotation.y += 0.00; this.earth.rotation.y += 0.001; th...
[ "animateClouds() {\n\tconst globeClouds = this.getObjectByName(ObjectName.GlobeClouds);\n\t['x', 'y', 'z'].forEach(axis => {\n\t globeClouds.rotation[axis] += Math.random() / 10000;\n\t});\n }", "function animate() {\n let now = Date.now();\n let deltat = now - currentTime;\n currentTime = now;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adapted from `shutdownAccService()` in accessible/tests/browser/head.js
function shutdownAccService() { return [ CommonUtils.addAccServiceShutdownObserver(), CommonUtils.observeAccServiceShutdown(), ]; }
[ "function shutdown() {\n RobotUtils.onService(function(ALSystem) {\n // Bind button callbacks\n ALSystem.shutdown();\n });\n}", "_shutdown () {\n if (this._shuttingDown) {\n return\n }\n this._shuttingDown = true\n clearInterval(this._heartbeat)\n this.removeAllListeners('upnpD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Now stitch the fragments back together into rings.
function stitchFragments(fragments) { var i, n = fragments.length; // To connect the fragments start-to-end, create a simple index by end. var fragmentByStart = {}, fragmentByEnd = {}, fragment, start, startFragment, end, endFragment; // For each fragment… for (i = 0; i <...
[ "function stitchFragments(fragments) {\n var i, n = fragments.length;\n // To connect the fragments start-to-end, create a simple index by end.\n var fragmentByStart = {}, fragmentByEnd = {}, fragment, start, startFragment, end, endFragment;\n // For each fragment…\n for (i = 0; i < n; ++i) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a jQuery list, a target element within the list and a direction (+1 for successor, 1 for predecessor), find the adjacent element in the list, or null if no such element exists. Parameters $list a jQuery node list $target the starting point, a jQuery element delta the direction in which to find the neighbor TODO: ...
function adjacentInList($list, $target, delta) { if ($list.length === 0 || $target.length === 0) { return null; } var target = $target[0]; var $result = null; $list.each(function(index, element) { if (target === element) { $result = $list.slice(index + delta, index + delta + 1); ...
[ "function insetInSortedList(list, target) {\n if (list.head === null) return list.head = target;\n if (list.head.value > target.value) {\n target.next = list.head;\n list.head = target;\n return;\n }\n\n let current = list.head;\n while (current.next !== null && current.next.value < target.value) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RMXF viewer constructor method Usage: var viewer = new RMXFViewer("UrlToConnect", tagToInsertViewerInto [ , ParameterPair1 [ , ParameterPair2, ...]]);
function RMXFViewer(url, tag) { if (url == null) return null; if (tag == null) return null; rmxfViewers[rmxfViewers.length] = this; this.SetSize = RMXFViewer_SetSize; this.Destroy = RMXFViewer_Destroy; var rawurl = url; var proto; var pi = rawurl.indexOf("://"); if (pi >= 0) { proto = rawurl.s...
[ "function RMXFViewer(url, tag)\n{\n if (!url) return null;\n if (!tag) return null;\n\n this.rmxfidx = rmxfViewers.length;\n rmxfViewers[this.rmxfidx] = this;\n\n this.SetSize = RMXFViewer_SetSize ;\n this.Destroy = RMXFViewer_Destroy ;\n this.Connect = RMXFViewer_Connect ;\n this.Disconnect ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disable the facets while reusults are being retrieved.
function disableFacets() { return vm.isLoadingResults; }
[ "function disableFacets() {\n return vm.isLoadingResults;\n }", "function disable() {\n severities.disable();\n $('.gallery-filter').prop(\"disabled\", true);\n }", "_applyFacets() {\n let defaultState = this.getInitialState()\n let rubrics = this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the custom column and add it to the column list if necessary.
updateCustomColumn() { olArray.remove(this.scope['columns'], this.customColumn); var name = (this.labelConfig && this.labelConfig['customName'] || '').trim(); if (name) { // update the custom column if the column name has been set this.customColumn['name'] = name; this.customColumn['field...
[ "function _update_column_list() {\n vm.file.data.forEach(function(column) {\n var computed = (!column.computed && !column.energy && !\n column.map_col);\n if (computed && cp.columns.indexOf(column.name) < 0) {\n cp.columns.push(column.name...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exposure level constructor, used when creating a request for just the given exposure. Implicitly creates an ISOClaimSearchRequest.
construct(inExposure : Exposure) { super(inExposure) }
[ "function ExposureFx () { \n\tif (!(this instanceof ExposureFx)) return new ExposureFx();\t\n}", "function createExpenseRequest() {\n return { type: types.CREATE_EXPENSE_REQUEST };\n}", "function RestSearchACLRequest() {\n _classCallCheck(this, RestSearchACLRequest);\n\n _defineProperty(this, \"Queries...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the start speed of play balls, parameter a is the pressed angle
function getSpeedLeft(a) { v0_L = v0max * a / getLeftAngle(-leftPhi0); //speed prop. with angle if (v0_L < v0min) { v0_L = v0min; } vx0_L = v0_L * sin(a); vy0_L = v0_L * cos(a); xball_L = x0L; yball_L = y0L; vx_L = vx0_L; vy_L = vy0_L; }
[ "function acceleration(a){\n while(a.getSpeed()<70){\n a.accelerate();}\n return a.getSpeed();\n }", "steerFromSpeed() {\n if(this.speed<1) {\n return this.angleMax*this.speed;\n }\n else {\n return this.angleMax;\n }\n }", "function getSpeedSide(){\n var speed = 1;\n if(canvas....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save the folders open state in storage, indexed by their stable bookmark id Returns a promise to signal save completion
function saveFldrOpen () { let saveObj; saveObj = curFldrOpenList; browser.storage.local.set({ savedFldrOpenList: saveObj }) // .then( // function () { // trace("Saved curFldrOpenList"); // trace(Object.keys(saveObj)); // trace(Object.values(saveObj)); // } // ) ; }
[ "async saveFolder() {\n if (this.state.state !== 'LOADED_PINBOARD') {\n return;\n }\n let folder = this.state.folderBuffer.join('');\n if (this.state.predictedFolder !== 'undefined' && typeof this.state.predictedFolder !== 'undefined') {\n folder += this.state.predi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
converts a string of accessories such as "eyes ears moustache" into an array of strings such as ["eyes", "ears", "moustache"] and returns the array
function getAccessoriesArray(accessoriesString) { return accessoriesString.strip().split(" "); }
[ "function string_to_array(x){\n return x.split(\" \");\n}", "function arrayNow(str) {\n ans = str.split(\" \");\n return ans;\n}", "function string2Array(string) {\r\n eval(\"var result = \" + string);\r\n return result;\r\n}", "function string2Array(string) {\n\t eval(\"var result = \" + strin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DFS caclulation of refCount for nodes Returns input node for syntactic sugar purposes.
function calcRefCounts(root) { var k; for( k in root.children) { calcRefCounts( root.children[k]); } root.refCount++; return root; }
[ "function DFS(node, graph) {\n let count = 1;\n // visit the node \n const children = graph[node].slice() // to copy it\n graph[node] = null;\n\n // get unvisited current children\n children.forEach(child => {\n if (graph[child] !== null) {\n count += DFS(child, graph);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a method that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array. You will always get an valid array. And it will be always exactly one letter be missing. The length of the array will always be at least 2. The array will always contain letters in only one ...
function findMissingLetter(array) { // iterate through array // compare the value of each letter to next letter in array // if next letter is != 1 along, then a letter is missing // missing letter is therefore current letter -1 const lowerCase = array.map(x => x.toLowerCase()); const alphabet ...
[ "function findMissingLetter(array) {\n let alph = 'abcdefghijklmnopqrstuvwxyz';\n let missing;\n\n for (let i = 0; i < array.length; i++) {\n let char1 = array[i].toLowerCase();\n let char2 = array[i+1].toLowerCase();\n let idx1 = alph.indexOf(char1);\n let idx2 = alph.indexOf(c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GetJsonService.$inject = ['$q', 'AjaxService']
function GetJsonService(){ var service = this; service.getSightJson = function (category){ return myJson[category]; }; /*service.getSightJson = function (category){ var promise = AjaxService.checkjson(category); promise .then(function(response){ console.log(myJson[category]); return myJson...
[ "get json() {\n // TODO return each service as something that can be parsed on the other side\n }", "function AfAjaxGetJson(url, successFunc, errorFunc)\n{\n return AfAjax({\n method: 'GET',\n url: url,\n dataType: 'json',\n success: successFunc,\n error: errorF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Facilitator function for findConcert to display the result PARAMS: body = returned data body parameter from calling "request" maxEvents = the maximum number of events to list
printConcertInfo(data, maxEvents = this.maxEvents) { // let data = JSON.parse(body); // console.log(data); for (let i = 0; i < data.length && i < maxEvents; i++ ) { let element = data[i]; let venue = element.venue; let location = [venue.city, venue.region, venue.country ...
[ "findConcert(artistName, maxEvents = this.maxEvents) {\n let query = \"https://rest.bandsintown.com/artists/\" \n + artistName + \"/events?\" + this.key;\n\n console.log(`\\n=======\\nFinding concerts for \"${artistName}\"`);\n this.request(query, (error, response, body) => {\n if (erro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save methods ////////// POST: add a new hero to the server
addHero(hero) { return this.http.post(this.heroesUrl, hero, httpOptions).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["tap"])((newHero) => this.log(`added hero w/ id=${newHero.id}`)), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["catchError"])(this.handleError('addHero'))); }
[ "addHero(hero) {\n // Seguindo a documentacao o heroi precisa ser enviado dentro de um objeto\n // com a chave \"hero\"\n const heroParams = { hero: hero };\n return this.http.post(`${this.heroesUrl}/heroes`, heroParams, this.httpOptions).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new `Injector` which is configured using a `defType` of `InjectorType`s.
function createInjector(defType) { var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var additionalProviders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var name = arguments.length > 3 ? arguments[3] : undefined; var in...
[ "function createInjector(defType) {\n var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var additionalProviders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n var name = arguments.length > 3 ? arguments[3] : undefined;\n var injector = create...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Step 7: Make the PATCH request to edit the studyCard
function editCard(studyCardID, payload) { // 7-2 PATCH request to the db to update the studyCard found at studyCardID return axios.patch(`https://api.airtable.com/v0/appgyWdA8yP0KXZr4/My%20Study%20Cards/${studyCardID}?api_key=${airtableKey}`, payload) .then((resp) => { if (resp.status === 2...
[ "function updateCard() {\n\n // 6-1 Create the payload object.\n const payload = {\n fields: {\n Name: this.name,\n Notes: this.note\n }\n }\n\n // 6-2 Edit the card:\n this.editCard(this.idToEdit, payload)\n}", "function initCardToEdit(studyCard) {\n\n // 5-1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Specifies the behaviour of the method "_updatePointer".
_setUpdatePointerMethod() { const that = this; if (that.analogDisplayType === 'needle') { that._updatePointer = function (value) { if (that._customSVGElements) { for (let i = 0; i < that._customSVGElements.length; i++) { that._draw...
[ "function updatePointerState(ev, pointer) { // 1711\n var point = getEventPoint(ev); // 1712\n var x = pointer.x = point.pageX; ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the internal object of selected nodes.
function _updateSelectedObject() { var data = $('.listTree').data('listTree'); // Filter the context to the selected parents. var selected = _.filter($.extend(true, {}, data.context), function(parent) { return $('.listTree > ul > li > span > input[value="' + parent.key + '"]').prop(...
[ "function _updateSelectedObject() {\n var data = $('.listTree').data('listTree');\n // Filter the context to the selected parents.\n var selected = _.filter($.extend(true, {}, data.context), function (parent) {\n return $('.listTree > ul > li > span > input[value=\"' + parent.key + '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adding functions for Perssitency Code hasnt been reviewed VinaySheel Code to be reviewed by Vinay / Following function checks for a single quote in a search criteria text field. Language : JavaScript accepts : textField returns : boolean (true , false) does : checks whether the given input box contains a single quote o...
function isSingleQuote(fld) { var val = ""; for (i=0; i<fld.length ; i++) { if(fld.charAt(i) == "'") { return false; } } return true; }
[ "function checkStringForDoubleQuotes(strText){\n var strQuotes = \"\\\"\";\n\n if (strText.indexOf(strQuotes) > -1) {\n \treturn true;\n }\n else\n {\n \treturn false;\n }\n \n\t}", "function checkSearch() {\n\tvar search = document.getElementById(\"searchStri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is invoked when we receive a "Discovery" message from Alexa Connected Home Skill. We are expected to respond back with a list of appliances that we have discovered for a given customer.
function handleDiscovery(event, context) { // Creating response header. var headers = createHeader(NAMESPACE_DISCOVERY, RESPONSE_DISCOVER); var processedPayload = {}; log('Discovery', 'Handling discovery..'); if (event.header.name == REQUEST_DISCOVER) { requestForUserEmail(event) .then(requestForUs...
[ "function handleDiscovery(event, context) {\n\n /**\n * Crafting the response header\n */\n var headers = {\n namespace: 'Discovery',\n name: 'DiscoverAppliancesResponse',\n payloadVersion: '1'\n };\n\n /**\n * Response body will be an array of discovered devices.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show the insertion point at the given edge of the given block...usually used when dropping a new block(s) into the construct
showInsertionPointForEdge(block, edge) { // insertion point may alternate so ensure we remove the block cursor this.hideBlockInsertionPoint(); // get node representing this part and its AABB const node = this.layout.nodeFromElement(block); const AABB = node.getAABB(); const xposition = edge ===...
[ "showInsertionPointForBlock(block, edge) {\n // insertion point may alternate so ensure we remove the block cursor\n this.hideEdgeInsertionPoint();\n // create insertion point as necessary\n if (!this.insertionBlockEl) {\n this.insertionBlockEl = document.createElement('div');\n this.insertion...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OPEN: Function to confirm if users would like to place an order
function confirmToOrder() { inquirer.prompt([ { type: "list", name: "confirm", message: "Would you like to place an order?", choices: ["Yes", "No"] } ]).then(function (answer) { if (answer.confirm === 'Yes'){ orderItems(); } else { console.log("Thank you for visiting Bamazon! Have ...
[ "function confirmOrder() {\n \n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"orderPlace\",\n message: \"Please confirm the order above.\",\n default: false\n }\n \n ]).then(function(order) {\n if (order.orderPlace == false)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public function `equal`. Returns true if `lhs` and `rhs` are strictly equal, without coercion. Returns false otherwise.
function equal (lhs, rhs) { return lhs === rhs; }
[ "function equal(lhs, rhs) {\n return lhs === rhs;\n }", "function equal(lhs, rhs) {\n return lhs === rhs;\n }", "function looseEquals(a, b) {\n if (a==b) {return true;}\n return false\n}", "function strictEquals(val1, val2) {\n return val1 === val2 || (val1 !== val1 && val2 !== val2);\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
deep copies the attributes of source into dest. Returns a reference to dest
function deepCopyInto(source, dest, overwrite){ if(typeof(overwrite)==='undefined') overwrite = true; for(attr in source){ if(source.hasOwnProperty(attr) && typeof source[attr] != 'undefined'){ if(source[attr].constructor == Array){ dest[attr] = deepCopyInto(source[attr], []); }else if(type...
[ "#copyAttributes( dest, src ){\n for( const att of src.attributes ){\n dest.setAttribute( att.name , att.value ) ;\n }\n }", "function copyAttributes( dest, src ){\n for( const att of src.attributes ){\n dest.setAttribute( att.name , att.value ) ;\n }\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Get Generated Player Props by Player / / Year of the season and the season type. If no season type is provided, then the default is regular season. Examples: 2018REG, 2018PRE, 2018POST / Week of the season. Valid values are as follows: Preseason 0 to 4, Regular Season 1 to 17, Postseason 1 to 4. Example: 1, 2, etc / ...
getGeneratedPlayerPropsByPlayerPromise(season, week, playerid){ var parameters = {}; parameters['season']=season; parameters['week']=week; parameters['playerid']=playerid; return this.GetPromise('/v3/nfl/odds/{format}/PlayerPropsByPlayerID/{season}/{week}/{playerid}', parameters)...
[ "getGeneratedPlayerPropsByWeekPromise(season, week){\n var parameters = {};\n parameters['season']=season;\n parameters['week']=week;\n return this.GetPromise('/v3/nfl/odds/{format}/PlayerPropsByWeek/{season}/{week}', parameters);\n }", "getGeneratedPlayerPropsByTeamPromise(season, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the current web is the root of a site collection associated with a group. Otherwise it returns false.
function isGroupWebContext(pageContext) { 'use strict'; return pageContext && !!pageContext.groupId && pageContext.webAbsoluteUrl === pageContext.siteAbsoluteUrl; }
[ "function inSPGroup(usergroup){\r\n\tvar trueorfalse = false;\r\n\t// check if in SharePoint User Group\r\n $().SPServices({\r\n operation: \"GetGroupCollectionFromUser\",\r\n userLoginName: $().SPServices.SPGetCurrentUser(),\r\n async: false,\r\n completefunc: function (xData, Status...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
i_check, j_check is the cell to be checked. returns "empty" if empty, "capture" if occupied by opponent, "stop" if occupied by self of is off board.
isFilled(i_check, j_check){ let currentView = this.state.layout.length-1; if(i_check>=8 || j_check>=8 || i_check<0 || j_check<0){ return "stop"; } let square_value = this.state.layout[currentView][i_check][j_check]; if(square_value === 32){ return "empty"; } if(this.state.whitesM...
[ "function checkBoard() \n {\n \tvar winner, empty = false\n\n\n\n \t// check board vertically and horizontally by looping through the cell rows and if it is equal\n \t// to a winning combo, it declares a winner\n\n for (var i = 0; i < 3; i++) \n {\n if (cell(i, 0) != '' && cell(i, 0) == cell(i, 1) && cell...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stop the timer and append link text
function stopAddThisTimer() { clearInterval(timer); jQuery('.addthis_toolbox a').each(function(){ var linkText = jQuery(this).attr('title'); jQuery(this).prepend('<span class="element-invisible">'+linkText+'</span>'); }); }
[ "function countdown(startTime) {\n if(torpedo.target.classList.contains(\"torpedoTimerFinished\")) startTime = 0;\n if(torpedo.target.classList.contains(\"torpedoTimerShowing\")) startTime = torpedo.time;\n\n var time = startTime\n torpedo.time = time;\n var t = torpedo.tooltip;\n\n $(t.find(\"#to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove existing video from model
remove(video) { this.videos = this.videos.filter(v => v !== video); this.emit('change'); }
[ "async removeFromIDB() {\n const db = await getIDBConnection();\n\n await db.removeVideo(this.getId(), this.internal.files);\n this.init(this.internal.videoData, this.internal.cacheName);\n }", "deleteVideo(video){\n \tif(video){\n \t\tdeleteFromArray(video, this.videos);\n \t\tdeleteFromArray(video,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterate over all the elements via the getterSetter. Fcn args: The getterSetter with its index set to [0, length) The current index
forEach (fcn, getterSetter = this.sharedGetterSetter) { for (var i = 0, len = this.length; i < len; i++) { getterSetter.ix = i fcn(getterSetter, i) } }
[ "function makeArrayAccessors(obj) {\n if (!Object.defineProperty) { return; }\n\n function makeArrayAccessor(index) {\n Object.defineProperty(obj, index, {\n 'get': function () { return obj._getter(index); },\n 'set': function (v) { obj._setter(index, v); },\n enumerable: true,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns layer by index from render order
getLayerByIndex(index) { if (index >= 0 && index < this.layers_order.length) { return this.layers[this.layers_order[index]]; } else { console.log(this.channelName, `ERROR: getLayerByIndex() index ${index} out of bounds`); } }
[ "getLayerIndex() {\n return this.layer.index;\n }", "getFrameLayerOrder(frameIndex) {\r\n return [1, 0];\r\n }", "getSortedLayers() {\n\t\t// sort by z-index\n\t\treturn this.layers.sort((a, b) => {\n\t\t\treturn a.getZIndex() - b.getZIndex();\n\t\t});\n\t}", "orderLayers() {\n for (let...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add e service for this BLE Device
addService(service_id, service){ //Test if a service for the given ID was already registered. if (this.services.indexOf(service_id) !== -1) { this.services[service_id] = service; }else{ throw new aux.BLE_Exception('Error, service with ID "'+service_id+'" already exits.');...
[ "_addService( name, service ) { this.services[ name ] = service; }", "function AddVehicleService() {\n }", "function EdisonDeviceInformationService() {\n EdisonDeviceInformationService.super_.call(this, {\n uuid: '180A',\n characteristics: [\n new EdisonDeviceManufacturerCharacteristic()\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function set time zone
function setTimeZone() { localStorage.setItem('timeZone', timeZone.value); }
[ "SetTimezone(tz)//set time zone\r\n{\r\n\tif(tz==undefined){ this.m_tz=ceDateTime.ltzoh(); }\r\n else if(tz<=14 || tz>=(-12)){ this.m_tz=tz; }\r\n}", "function SetPCTimeZone(PCTimeZone)\n{\n var objShell = Sys.OleObject(\"Wscript.Shell\")\n objShell.Exec(\"tzutil.exe /s \" +aqString.Quote(PCTimeZone))\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get (or create) a room:
function getRoom(name="default") { if (!rooms[name]) { rooms[name] = { name: name, clients: {}, } } return rooms[name] }
[ "getRoom() {\n const id = this.roomName;\n\n if (!activeRooms.hasOwnProperty(id)) {\n throw new Error('Room requested does not exist: ' + id);\n }\n\n return activeRooms[id];\n }", "static get(roomId) {\n if (!ROOMS.has(roomId)) {\n ROOMS.set(roomId, new Room(roomId));\n }\n\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate loader string to be used with extract text plugin
function generateExtractLoaders (baseLoader) { // Ignore the style loader (the first item), extractText doesn't need it var loaders = baseLoader.split('!').slice(1) // Get their plugin names and source maps return loaders.map(function (loader) { return loader + '-loader' + (SOURCE_MAP ? '?sourceMap' : '') ...
[ "function generateLoaders(loaders) {\n var sourceLoader = loaders\n .map(function(loader) {\n var extraParamChar;\n if (/\\?/.test(loader)) {\n loader = loader.replace(/\\?/, '-loader?');\n extraParamChar = '&';\n } else {\n loader = loader + '-loader';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make the Registration a_reg suitable for the current piano type: if it is missing a property in the current piano, add the default value if it has a property not in the current piano, delete the property
function refit_reg( a_reg ) { for (let ix = 0; ix < g_itemInfo.length; ix++) { let propID = g_itemInfo[ix].name; // GetSafeRegProperty will throw an error if any of // 'singleTone', 'splitLowerTone', 'dualTone2' // use a Tone that isn't valid on this piano try { ...
[ "function SetSafeRegProperty( a_reg, a_property, a_value )\n{\n switch (a_property)\n {\n case 'comment':\n // Comment is a proprietary property not in Roland standard UPG.\n //\n // JSON would allow strings of arbitrary lengths. But we don't know\n // the implementation of the FP-90, and...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles an update to the netid dropdown in the comment form, and narrows the remaining drop downs accordingly
async handleCommentFormNetIDUpdate(selection) { let date = this.state.updatedCommentWeek["label"]; let comment = ""; if (!date == false) { let projectID = this.props.match.params.projectID; let netID = selection["label"]; let response = await fetch(`../api/get...
[ "handleCommentFormUserUpdate(selection) {\n let name = selection[\"label\"];\n let netids = this.nameToNetID.get(name);\n this.resourceNetIDOptions = [];\n for (let i = 0; i < netids.length; i++) {\n this.resourceNetIDOptions.push({ label: netids[i], value: 1 });\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the mountain tiles and makes them impassable
function gridSetMountains(){ for(var i=0; i<squareTiles.length; i++){ if(squareTiles[i].column === maxColumnNumber || squareTiles[i].column === 0 || squareTiles[i].row === maxRowNumber || squareTiles[i].row === 0){ squareTiles[i].terrainVariable = 'Mountain'; } } for(var i in squareTiles){ if(squareTiles[i...
[ "function setUpTiles() {\r\n var sector;\r\n\r\n sector = this;\r\n\r\n sector.tilesByIndex = [];\r\n sector.newTiles = [];\r\n sector.tiles = [];\r\n\r\n // Get the old and new tiles for this sector, and set up neighbor states for the expanded grid\r\n // configuration\r\n collectOldTilesIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A time varying set of 2D parametric equations. Paramteric equations over P, P > x = Asin(aP + i), y = Bsin(bP) ( Normally parametric equations are described using parameter t, but this is confusing with the time tick so I used P to describe the free parameter in the parametric equations) At each time tick, t, a lissajo...
function lissajous(A, a, B, b, i) { return Parameter.from(A).combine(function () { return function (A, a, B, b, i) { return [function (t) { return A * Math.sin(a * t + i); }, function (t) { return B * Math.sin(b * t); }]; }; }, Parameter.from(a), Parameter.from(B), Parameter.from(b), Parameter.from(i));...
[ "function bSpline(gl, p) {\n\n for (var t = 0; t < 1; t += 0.1) {\n\tvar ax = (-p[0].x + 3*p[1].x - 3*p[2].x + p[3].x) / 6;\n\tvar ay = (-p[0].y + 3*p[1].y - 3*p[2].y + p[3].y) / 6;\n\tvar bx = (p[0].x - 2*p[1].x + p[2].x) / 2;\n\tvar by = (p[0].y - 2*p[1].y + p[2].y) / 2;\n\tvar cx = (-p[0].x +p[2].x) / 2;\n\tvar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set max of seek bar when audio selected
function initSeekBar() { seekbar.max = audio.duration; maxTime.innerHTML = toMinSec(audio.duration); }
[ "function sliderSetMax() {\n sliderSeek.max = audio.duration;\n }", "function setValueForSeekBar(sender, currentValue, maxValue) {\r\n\tif (sender.attr('data-seeking') == 'false') {\r\n\t\t$(sender).attr('max', maxValue);\r\n\t\t$(sender).attr('value', currentValue);\r\n\t\t$(sender).slider(\"refresh\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine wether or not the provided value is a delegate
function isDelegate(value) { return typeof value === 'function' && typeof value.element === 'function'; }
[ "static isCallback(value){\n return (typeof value == 'function');\n }", "function isFn (val) {\n return (typeof val === 'function');\n }", "function isDelegateCtor(typeStr){return DELEGATE_CTOR.test(typeStr)||INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr)||INHERITED_CLASS.test(typeStr)&&!INHERIT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mutates sigma graph to recolor node n and its edges, with optional color
function colorSigma(sg, n, color) { color = color || '#78afc0' // nodes _.each(sg.nodes, function(nObj){ if (nObj.id == n) nObj.color = color }) // incident edges _.each(sg.edges, function(eObj){ if (eObj.source == n || eObj.target == n) eObj.color = color }) }
[ "function setAdjEdgeColors(nodeId, colorPri) {\n var edges = document.getElementsByClassName(nodeId + \"edge\"),\n otherNodeId, otherNodePri;\n\n for (var i = 0; i < edges.length; i++) {\n //finding the other node's id number\n if(edges[i].id.substr(4,3) == nodeId){\n otherNodeId = edges[i].id.sub...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function Name: searchEmail Description:validate user entered email
function searchEmail(email){ var x; if (validateEmail(email)) { x = true; } else { x = false; } callHerokuApi(x,"email=", email); }
[ "function testEmailSearch(){\n searchEmail('Raymondgonzalez22@gmail.com'); // invalid\n\t searchEmail(\"doesmith@example.com\"); // valid entry\n\t searchEmail(null); // invalid entry\n\t searchEmail(1); // invalid entry\n }", "function simpleEmailValidation(emailAddress) {\n\n}", "function verifyEmail(em...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Give ACE to post functionality
function acePost() { if (vm.postAced) { postService.unAcePost(vm.postData.id) .then(function() { --vm.postData.aceCount; vm.postAced = false; }); } else { postService.acePost(vm.postData.id) .then(function() { ++vm.postData.ac...
[ "function POST(){\n\n}", "function postData() {}", "function doPost(e) {\n return doGetAndPost(e); //Have doGetAndPost handle it.\n}", "function post(fn) {\n postFunction = fn;\n }", "watch_post ( ) {\n let _that = this;\n yootil.form.any_posting().each(function(){\n $(this).find(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `DocumentAttributeValueProperty`
function CfnDataSource_DocumentAttributeValuePropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, ...
[ "function valueMatches(frame, prop) {\n if (frame.elem.tagName==\"assessmentItem\") {\n let vars = getResponseVariables(frame.elem).filter(decl=>decl[prop]);\n let matches = vars.filter(decl=>decl.value && match(decl[prop], decl.value));\n return matches.length==vars.length;\n } else {\n return false;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a mark to the node at position `pos`.
addNodeMark(pos, mark) { this.step(new AddNodeMarkStep(pos, mark)); return this; }
[ "placeMark(pos, mark) {\n if (this.isValidPos(pos)){\n this.grid[pos[0]][pos[1]]= mark;\n return true;\n }\n return false;\n }", "function newNodeMark(pos, colourTrait) {\n var bullet = document.createElementNS(NS, \"ellipse\");\n var radius = 0.0; // Will be set appropriately by...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
determines cursor y offset relative to canvas(if canvas is moved or other objects are edited then this function may not be accurate anymore)
function getCursorYoffset(){ //Get Frame width for left and top and get frame top margin var frameStyle = getComputedStyle(document.getElementById("Frame"), null); var frameTopWidth = measureToNumber(frameStyle.borderTopWidth); var frameTopMargin = measureToNumber(frameStyle.marginTop); //Get MainNav box height v...
[ "get cursorDeltaY() {\n\t\treturn this._cursorDeltaPos[1];\n\t}", "function getY(){\n\t\treturn ((cursorY - prevCursorY));\n\t}", "get cursorY() {\n\t\treturn this._cursorPos[1];\n\t}", "function cursorY() {\n return cy;\n }", "function getCursorPositionXY(e) {\n const rect = canvas.getBounding...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to return a list of answers from the student
async function getStudentAnswers(teacherName, classToRead, studentName) { var listOfAnswers; await db.collection("classroom").doc(teacherName).collection("classes").doc(classToRead).collection("student_name").doc(studentName).get().then((studentAnswers) => { listOfAnswers = studentAnswers.data(); })...
[ "function answersByStudent(answersString='') {\n return answersString.split('\\n')\n}", "function getAnswers() {\n let result = [];\n for (var i = 0; i < data.length; i++) {\n result.push(data[i].answer);\n }\n return result;\n}", "function getAnswers() {\n\t\treturn answers;\n\t}", "function getAns...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get angle at a specific delta
function getAngle(delta, setCircle) { c = getCircle(delta); //circle = Math.floor(ct/360)%2; if (setCircle == true) { circle = c; } if ( c == 0) { returnAngle = 0 + ((delta/1000) * speed); } else { returnAngle = 180 - ((delta/1000) * speed); //going backwards if on the right circle ...
[ "getAngle() {\n var ratio = 0;\n var offset = 0;\n if (this.x > 0) {\n if (this.y > 0) {\n offset = 0;\n ratio = this.y / this.x;\n } else {\n offset = (3 * Math.PI)/2;\n ratio = this.x / this.y;\n }\n } else {\n if (this.y > 0) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions / Opens a box based on element or selector provided
function openBox(box) { // Adds the class that refers to this box as revealed $(box).addClass('-is-revelead'); // Hides the default content $(box).find('.panel__default').addClass('-is-hidden'); // And shows the hover content $(box).find('.panel__hover').removeClass('-is-hidden'); }
[ "function openBox(name)\n{\n var box = document.getElementById(name);\n var boxChildren = box.getElementsByTagName(\"div\");\n box.style.display = boxChildren[0].style.display = boxChildren[1].style.display = \"block\";\n}", "function openOrCloseBox(el) {\n // Clear the help timer and remove the help if it ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the Gadget.Interop dll from the registry and the GAC
function UnregisterGadgetInterop() { try { var fullPath = System.Gadget.path + assemblyStore; var asmPath = fullPath + assemblyName; RegAsmUninstall("HKLM", progID, "Gadget.Interop.GadgetAdapter", guid, "Gadget.Interop, Version...
[ "UnRegisterAssembly() {\n\n }", "function uninstall() {\n try {\n var registrar = new ActiveXObject(\"GoogleDesktop.Registrar\");\n registrar.UnregisterComponent(g_scriptSampleId);\n } catch (e) {\n return false;\n }\n \n return true;\n}", "function uninstall() {}", "function uninstall() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a style sheet with style id under given parent
static createStylesheet(id, parent) { let style = document.createElement('style'); style.setAttribute('type', 'text/css'); style.setAttribute('gs-style-id', id); // eslint-disable-next-line @typescript-eslint/no-explicit-any if (style.styleSheet) { // TODO: only CSSImportRul...
[ "function create (style, id) {\n var css = new Element('style', { type: 'text/css' });\n\n if (Prototype.Browser.IE) {\n css.styleSheet.cssText = style;\n }\n else {\n css.update(style);\n }\n\n if (id) {\n css.setAttribute('id', id);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a function that will show even numbers from 0 to 100 as output
function evenNumber(){ for(i=0;i<=100;i++){ if(i%2==0){ console.log(i); } } }
[ "function evenNumbers () {\n for (i= 0; i <= 100; i++) {\n if (i % 2 === 0) {\n console.log(i);\n }\n }\n}", "function evenNumbersTo99() {\n for (let i = 1; i <= 99; i += 1) {\n if (i % 2 === 0) {\n console.log(i);\n }\n }\n}", "function evenNum(){\n for(let i=0; i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Invoke Service API Gateway: JLL API, Operation : Get Work Order
function callWorkOrder(userId, data, output, item, size, count, resolve, status) { var getWorkOrderOutput = ""; request( { url : jllAPI_getWorkOrder + item, headers : { "Content-Type" : "application/json" } }, function (error, response, body) { if(body...
[ "function retrieveOrderToFill(orderJson)\n{\n //Check that json is in correct format\n if(orderJson.hasOwnProperty('order'))\n {\n if(orderJson.order.hasOwnProperty('value'))\n {\n parseOrder = String(orderJson.order.value);\n order = parseOrder.replace(uriKB, \"\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Match anything we hover over to check for youtube links
function magic(input){ // Match youtube urls let re = new RegExp(/youtube\.com|youtu\.be/gi); // Check for youtube link if(input.target.href && re.test(input.target.href)){ // Save the hovered element for later element = input.target; // Parameters for our XHR request ...
[ "function youtubeLink() {\n var r = /^http\\:\\/\\/www\\.youtube\\.com\\/watch\\?v=([A-Za-z0-9\\-_]*)(&(.*))?$/i.exec(resources[activeIndex][0]);\n return (r != null) ? r[1] : false;\n }", "function youtubeCheck(url) {\n // https://gist.github.com/jlong/2428561\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: clickGuia2 Mostra as principais informa&ccedil;&otilde;es sobre o WMS escolhido tendo como fonte o getcapabilities Veja:
function clickGuia2() { //mostraGuia("guia2"); i3GEO.guias.mostraGuiaFerramenta("guia2"); if ($i("servico").value == ""){i3GEO.janela.tempoMsg($trad('servico',i3GEOF.conectarwms.dicionario));} else { var metadados = function(retorno){ if (retorno.data != undefined) { aguarde("none"); $i("resultadog...
[ "function dodajMenuInformacjiOSkrypcie() {\r\n\tGM_registerMenuCommand(\"Informacje o '\" + STALA_NAZWA_SKRYPTU + \"' wersja \" + STALA_WERSJA_SKRYPTU, function(e) {\r\n\t\tvar instrukcja=\"Podaję informację o aktualnym stanie zboża.\\nAnalizowane są dostawy do osady.\\n\\nWYNIKI ZAPISANE SĄ W LOGU Greasemonkey.\\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the state if after a search there are drivers found in price range
function setSTPrice_Found(data) { return { type: 'uiData/MomDrvList/setSTPrice_Found', payload: data } }
[ "filterByPrice(min, max) {\n const filterProducts = this.state.originalProducts.filter((val) => {\n const price = val.defaultPriceInCents / 100;\n return min <= price && max >= price;\n });\n this.setState({ products: filterProducts });\n }", "handlePriceChange() {\n let filtered = this.sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validation for tax name
function validate_taxname (id) { /*var obj = document.getElementById(id).value; //alert('hiii'); obj = obj.replace(/^\s+|\s+$/g, ""); var CharArray = obj.split(" "); //alert(CharArray.length); if (CharArray.length <= 1 && /^[a-zA-Z]+$/.test(obj) ) { $('#'+id).css({'border':'1px solid #d...
[ "function nameIsValid() {\n var nameValue = $name.val();\n return (nameValue.length > 0 && !$.isNumeric(nameValue)) ;\n }", "function xenos$ns$views$tradeEntry$validationForTax() {\n var taxRate \t= $.trim($('#taxRate',$tradeEntry$contaxt).val());\n var taxRateType = $.trim($('#taxRateType',$tradeE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function checksubplotnumber() retrieves the Subplot Number value entered by the user. The function checks to make sure that the value entered only contains numerics and lies between 125. Save button is disabled or enabled depending on the status of the validation.
function checksubplotnumber(){ var spn = document.forms["censusform"]["subplotnumber"].value; if (spn == null || spn == "") { return; } var regex = /^\d+$/ if (!new RegExp(regex).test(spn)) { alert("Please make sure that your entry only contains numerics."); d...
[ "function checkplot(){\r\n var plot = document.getElementById('plotnumber').value;\r\n var regex = /^\\d+$/;\r\n \r\n \r\n if (!new RegExp(regex).test(plot)) {\r\n alert(\"The plot number is a unique number assigned to the 1ha plot at each TEAM Site. Please check your entry.\");\r\n docum...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve selection row format
retrieveRowFormat(start, end) { if (start.paragraph.isInsideTable && end.paragraph.isInsideTable) { this.rowFormat.copyFormat(start.paragraph.associatedCell.ownerRow.rowFormat); this.getRowFormat(start.paragraph.associatedCell.ownerTable, start, end); } else { ...
[ "getRowFormat(query,row) {\n let format = query.format;\n let columnsFormat = format.columns ? format.columns : [];\n let groupsFormat = format.groups;\n let style = {};\n let groupFormat = null;\n let hierarchyLevel = row[columnsFormat.length].hierarchyLevel ? row[columnsF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build() Build a bindable object and try to resolve data, if resolved creates initial bind too
build(model) { // set bindable data this.priority = 1; this.resolver = RaziloBindCoreDetector.resolver(this.resolvable, this.node); this.alterer = RaziloBindCoreDetector.resolver(this.alterable, this.node); this.config = RaziloBindCoreDetector.resolver(this.configurable, this.node); this.model = model; /...
[ "build(model) {\n\t\t// set bindable data\n\t\tthis.priority = 1;\n\t\tthis.resolver = RaziloBindCoreDetector.resolver(this.resolvable, this.node);\n\t\tthis.alterer = RaziloBindCoreDetector.resolver(this.alterable, this.node);\n\t\tthis.config = RaziloBindCoreDetector.resolver(this.configurable, this.node);\n\t\tt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end do_buy name: buy_towers_click description: handales the click event for each buy btn input:none output:none
buy_towers_click() { if (this.phase !== "buy") { return; } var tt = this; var w = tt.world; if (tt.normal_tower.clicked(2)) { this.do_buy("normal"); } if (tt.ice_tower.clicked(2)) { this.do_buy("ice"); } if (tt.poison_tower.clicked(2)) { this.do_buy("pois...
[ "do_buy(name) {\n var tt = this;\n var w = tt.world;\n\t//try to buy the tower\n if (w.buy_tower(this.yparent, name)) {\n tt.remove_children();//remove buy btns\n this.tower_stats();//show tower stats\n this.phase = \"stats\";//change state (also disables buy btns)\n } else {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Interleave Create the function `interleave` that accepts strings as arguments: interleave("FOO", "bar"); The task is to "interleave" the strings, such that the resulting string (return value) looks like: interleave("FOO", "bar"); // RETURNS: "FbOaOr" Also, `interleave` can accept any number of strings: interleave("HHh"...
function interleave () { const strings = Array.from(arguments); const maxLen = strings.reduce((accum, item) => { if (item.length > accum) return item.length; else return accum; }, 0); let output = ''; for (let char = 0; char < maxLen; char++) for (let str = 0; str < strings...
[ "function interleave2(x, y) {\n x &= 0xFFFF;\n x = (x | x << 8) & 0x00FF00FF;\n x = (x | x << 4) & 0x0F0F0F0F;\n x = (x | x << 2) & 0x33333333;\n x = (x | x << 1) & 0x55555555;\n y &= 0xFFFF;\n y = (y | y << 8) & 0x00FF00FF;\n y = (y | y << 4) & 0x0F0F0F0F;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UPDATE DATABASE ONCE DISCOUNT EMAIL IS SENT
function updateEmailSent(uid) { let pool = db.connection.INSTANCE(); let sql = "UPDATE invoices SET discount_sent = true WHERE uid = '" + uid + "';"; pool.query(sql, (err, res) => { if (err) { console.log(err); } else { console.log("DISCOUNT EMAIL SENT, UPDATING DB")...
[ "async function resetNumInvited(){\n await db('account').where('updated_at','<',new Date())\n .where('num_invited', '>=', MAXINVITE)\n .update('num_invited',0)\n}", "static unsubscribe(email) {\n return db.result(`delete from emails where email=$1`, [email])\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
slides row based on direction 1 > left, 1 > right
slide(row, dir) { let nonzero = row.filter(val => val); nonzero = nonzero.concat(new Array(row.length - nonzero.length).fill(0)); return dir > 0 ? nonzero : nonzero.reverse(); }
[ "function handle_turn_row1_right() {\n}", "function slideLeft () {\n\n if (canSlideLeft()) {\n index = Math.max(0, index - cols);\n update(true);\n }\n }", "function handle_turn_row1_left() {\n}", "function slideRight () {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an AST, this function tries to find the exported component definitions. If a definition is part of the following statements, it is considered to be exported: modules.exports = Definition; exports.foo = Definition; export default Definition; export var Definition = ...;
function resolveExportedComponent(ast) { var components = new ts_map_1.default(); var nonComponentsIdentifiers = []; function setComponent(exportName, definition) { if (definition && !components.get(exportName)) { components.set(exportName, normalizeComponentPath(definition)); } ...
[ "function findAllComponentDefinitions(ast, _parser, importer) {\n const definitions = new Set();\n function classVisitor(path) {\n if ((0, isReactComponentClass_1.default)(path, importer)) {\n (0, normalizeClassDefinition_1.default)(path);\n definitions.add(path);\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RETURN PARAM ////////////////////////////////////////////////////////////////////////// amReturnParam(map_id, param) This function is called when you request a setting from a map by calling the this.map.getParam(param) function.
function amReturnParam(map_id, param) { Ammap.publish('amreturnparam', map_id, param); }
[ "getParam(name) {\n return this.parameterMap[name];\n }", "get paramMap() {\n if (!this._paramMap) {\n this._paramMap = this.params.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"map\"])((p) => convertToParamMap(p)));\n }\n return this._paramMap;\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for the 'touchend' event.
function onTouchEnd(event) { touch.handled = false; }
[ "function handleTouchEnd() {\n clearTimeout(touchTimeout);\n }", "function onTouchEndCaptured(tracker,event){handleTouchEnd(tracker,event);$.stopEvent(event);}", "function touchendForSearchResults(event)\n{\n //console.log('touchend');\n}", "function onTouchEndCaptured( tracker, event ) {\n hand...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
not used: in case later search model by maker names
function getModelsByMaker(makerName) { return new Promise( function(resolve, reject) { Promise.all([ getAllMakers(), getAllModels() ]).then( values => { const maker = values[0].find(x=> x.name === makerName); if (maker) { cons...
[ "model(name) { return this.models[name.name || name]; }", "findmodel(name)\n {\n for (var i=0; i<models.length; i++)\n if (models[i].t==name)\n return models[i];\n\n return undefined;\n }", "function find_model_names(query, callback) {\n\t\tif( !config.model_names_url ) {\n\t\t\tconsole.log(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates snap friendly structure out of an array ofsimple keyValue json object or just single on of them.
_createSnapStructure(input){ return utils.jsonToSnapList(input); }
[ "function singleArrayToObject(singleArray) {\n var objFromArray = {};\n for (var i = 0; i < singleArray.length; ++i)\n objFromArray[ i + 1 ] = singleArray[i]; //because our db references will always start at 1\n return objFromArray;\n}", "arrayToObject(array, keyField) {\n const modifiedObj = array.red...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a single sport by ID
async function getSport(id) { return await api.get(`/sports`, { params: { id } }).then((res) => { return res.data; }); }
[ "function getSingleDancer(id) {\n return fetch(danceURL + `/${id}`)\n .then(res => res.json())\n}", "function get_season(id){\n\t\t// Get season containing a date\n\t\tif (typeof id == \"number\"){\n\t\t\treturn self.seasons[Math.floor((id - 1) / SEASON_DAYS)];\n\t\t}\n\t\t\n\t\t// Get season by string ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a tally of records with start options and given option
function tallyColumn(field2,option2) { var option2Name = fieldOptions[field2][option2]; var totalValues; totalValues = new Array(getOptionsOfStartField().length); for( var st=0; st<totalValues.length; st++ ) { totalValues[st] = 0; ...
[ "function tallyStack(field1,option1,field2,option2)\n {\n // console.log(field1 + \" \" + option1 + \" \" + field2 + \" \" + option2);\n var option1Name = fieldOptions[field1][option1];\n var option2Name = fieldOptions[field2][option2];\n var totalValues;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executes SERIALIZABLE transaction until it succeeds
async executeSerizlizableTransaction(transaction) { while (true) { // eslint-disable-line no-constant-condition try { await this.database.transaction(async (trx) => { // eslint-disable-line babel/no-await-in-loop await trx.raw('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE'); retu...
[ "async beginTransaction() {\n }", "async function submitPendingTransactions() {\n // See what transactions in the db are still pending\n var pendingTransactions = connection.query(\"SELECT * FROM stellartransactions WHERE state = ?\", [\"pending\"]);\n \n\n if (pendingTransactions.length > 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
drawCuboids(): According to the positions defined in CUBOIDS_POSITIONS, creates the cuboids in the scene.
function drawCuboids() { "use strict"; var cuboids = new THREE.Group(); var geometry = new THREE.BoxBufferGeometry(GRID_WIDTH, GRID_HEIGHT, GRID_DEPTH, CUBOIDS_SEGMENTS, CUBOIDS_SEGMENTS, CUBOIDS_SEGMENTS); geometry.addAttribute('lightPos', POINT_LIGHT_POSITIONS.GPUBuffer); var gridPositio...
[ "generateFaces(length,height,width,rotation){//Sets up the six faces of the cuboid using local position\n //Define the faces on the ends of current cuboid\n this.faces.push(this.generateFace([createVector(0,-height,0),createVector(0,-height,2*width),createVector(0,height,2*width),createVector(0,height,0)],rot...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
requireRegion fetches the AWS region, requiring that it exists; if it has not been configured, an error is thrown.
function requireRegion() { if (vars_1.region === undefined) { throw new Error("No AWS region has been configured"); } return vars_1.region; }
[ "function getRegion_AWS(region) {\n var awsRegion = JSON.parse('{\"US East\": \"us-east-1\", \"US West\": \"us-west-2\", \"EU (London)\": \"eu-west-2\", \"Europe Central\": \"eu-central-1\",\"Asia Pacific (Singapore)\": \"ap-southeast-1\",\"Asia Pacific (Japan)\": \"ap-northeast-1\",\"Asia Pacific (Sydney)\": ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Export coach file data to CSV
function exportCoachFileCSV(){ var rows=[['num','adj','name','lf','cf','rf','3rd','2nd','1st','ss','c','p']]; for (var r = 0; r<24; r++){ t = roster_teams[r]; rows.push([r.toString(),t.getTeamAdjStr(),t.getTeamNameStr(),Players[t.left_field].Name,Players[t.center_field].Name,Players[t.right_field].Name,Play...
[ "exportCSV() {\n let csvContent = `data:text/csv;charset=utf-8,Title,${this.getDateHeadings(false).join(',')}\\n`;\n\n // Add the rows to the CSV\n this.outputData.listData.forEach(page => {\n const pageName = '\"' + page.label.descore().replace(/\"/g, '\"\"') + '\"';\n\n csvContent += [\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
output the heading followed by a twocolumn table containing indices and elements of "theArray"
function outputArray( heading, theArray, output ) { var content = "<h2>" + heading + "</h2><table>" + "<thead><th>Index</th><th>Value</th></thead><tbody>"; // output the index and value of each array element var length = theArray.length; // get array's length once before loop for ( var i =0; i < length; +...
[ "function outputArray( heading, theArray, output )\n{\n var content = \"<h2>\" + heading + \"</h2><table>\" +\n \"<thead><th>Index</th><th>Value</th></thead><tbody>\";\n\n // output the index and value of each array element\n var length = theArray.length; // get array's length once before loop\n\n for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renames a file in the file system and creates an event to represent it.
function renameFile(newFilePath, newFileName, oldFilePath, timestamp) { //if this should be ignored due to the st-ignore.json file if(!ignoreThisFileOrDir(newFilePath)) { //get the id of the renamed file var fileId = getIdFromFilePath(oldFilePath); //if the file i...
[ "rename(newFilePath) {\n }", "rename( file, callback ) {\n\n // Verify that the path exists.\n if( context.fs.exists(file) ) {\n\n // Rename the file.\n utils.rename(file, callback);\n\n }\n\n }", "function onNewFile(file) {\n\n\tconsole.log(\"onNewFile() - watch_old: \" + this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
close chat with delay
closeChatWithDelay(delay) { setTimeout((_this) => { _this.closeChat(); }, delay, this); }
[ "function closeChat() {\n chatSocket.close();\n}", "function leaveChat()\n{\n chatChannel.close();\n}", "function closeChat() {\n isChatOpen = false;\n document.getElementById(\"chat\").style.display = \"none\";\n}", "function chatBoxClose(){\n\tnanuTalk.style.display='none';\n\tchatAreaShow.style...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get receipt Ids for messages
function getReceiptIds(tickets) { let receiptIds = []; for (let ticket of tickets) { if (ticket.id) { receiptIds.push(ticket.id); } } return receiptIds; }
[ "function extractMessageIds(messages) {\n var ids = [];\n if (messages) {\n for (var i = 0; i < messages.length; i++) {\n ids.push(messages[i].id);\n }\n }\n return ids;\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change the name of the hero
function changeName (hero){ const stats = document.getElementById("stats"); const newName = document.getElementById("name").value; hero.name = newName; displayStats(hero); return hero; }
[ "function changeName() {\n const name = document.getElementById('name')\n hero.name = name.value\n alert(\"Name of hero succesfully changed to \" + name.value + \"!\")\n}", "function chooseHero(name) {\n $(name).remove();\n $(\".arena\").append(name);\n $(name)\n .attr(\"id\", \"hero\")\n .remov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
buildChain and addLink are used to build out the chain by passing in an array of classes
buildChain (chain){ // chain is an array chain.forEach(link => this.addLink (link, this)); }
[ "function Chain () {\n // Steps array\n this.stack = []\n this.steps = []\n this.currentStepIndex = 0\n}", "function _Chain() {}", "linkChain() {\n for (const arg in arguments) {\n try{\n if (shortid.isValid(arguments[arg][0].id) && shortid.isValid(arguments[arg][0].id)){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new unique item entry in MongoDB
function create_item(item, cb) { var items = db.get().collection('items'); items.ensureIndex({id:1}, {unique:true}, function(err, indexName) { if (err) cb("duplicate id", null); else { items.insert(item, {w:1}, function(err, rspdoc) { if (err) ...
[ "create () {\n this.preCreate()\n this.db.addCollection(this.collectionName, {\n unique: this.uniqueKeys\n })\n this.postCreate()\n }", "async addItemIfNotExists(querySpec, item) {\n\n //Check if item exists\n const exists = await this.find(querySpec); //Execute the query\n\n //Add item if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a multipart upload instance
async createMultipartUpload(filename, options) { const path = options.dashboard && options.widget ? `/data/files/${options.dashboard}/${options.widget}` : `/files`; const result = await this.doRequest({ path, method: "POST", body: { multipart_action: "...
[ "create_object_upload(params, object_sdk) {\n return this.multipart_ns.create_object_upload(params, object_sdk);\n }", "function handleMultipart(req, res) {\n const tmpDir = os.tmpdir();\n const destination = `${tmpDir}/vhmc/uploads`;\n\n const jobData = {\n input_url: null,\n origin: null,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a permission request for the user of the mentioned type and stream
function requestPermission(stream, type) { PermissionsService.requestPermission(stream, type).then(function(response) { if(response.success) { if(type === 'write') stream.writeRequestStatus = 1; else if(type === 'admin') { ...
[ "function requestPublishPermission() {\n\t\tif (Ti.App.Properties.getString(KEY_IS_LOGINED, false)) {\n\t\t\tif (!Ti.App.Properties.getBool(KEY_PUBLISH_PERMISSION, false)) {\n\t\t\t\t_fb.requestNewPublishPermissions(['publish_actions'], _fb.AUDIENCE_FRIENDS, function(e) {\n\t\t\t\t\tif (e.success) {\n\t\t\t\t\t\tTi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if no index is passed, or index is out of bounds, return null else iterate through linked list until i === index return data at that index.
getValue(index = -1){ if(index < 0 || index >= this.size){ return null; } let i = 0; let current = this.head; while(i <= index && current !== null){ if(i === index){ return current.data; } i++; current = current.next; } }
[ "getAt(index){\n let current = this.head;\n let count = 0;\n\n while(current) {\n if(count == index) {\n console.log(current.data);\n return current.data;\n }\n count++;\n current = current.next;\n }\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
whether or not the unit can act or not. This does not check for potential collisions into other units or enemy cities
canAct() { return this.cooldown < 1; }
[ "canAttack() {\n return this.hasCombatTarget() && this.inRange() && this.timerCooled() && this.notMoving()\n }", "function CanControlUnit(entity, player, controlAll)\n{\n\tlet cmpIdentity = Engine.QueryInterface(entity, IID_Identity);\n\tlet canBeControlled = IsOwnedByPlayer(player, entity) &&\n\t\t(!cm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a binary string row.
function deleteRow() { div = document.querySelector(".letter"); document.querySelector("#binary-container").removeChild(div); }
[ "eraseChar() {\n this.rows_[this.row_].pop();\n }", "function removeSyncRow(row) {\n\tvar DB = new SQLite('_alloy_');\n\n\tDB.table(exports.config.syncTableName)\n\t.where(row)\n\t.delete()\n\t.run();\n}", "function remove_tag(table_arr, row, col, tag_type) {\n\tlet curr_cell = table_arr.rows[row].cells[col...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }