query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Searches Solidity source code for compiler version range.
function parseSolidityVersionRange(source) { var SOLIDITY_VERSION_RANGE_REGEX = /pragma\s+solidity\s+(.*);/; var solcVersionRangeMatch = source.match(SOLIDITY_VERSION_RANGE_REGEX); if (solcVersionRangeMatch === null) { throw new Error('Could not find Solidity version range in source'); } var...
[ "function parseSolidityVersionRange(source) {\n const SOLIDITY_VERSION_RANGE_REGEX = /pragma\\s+solidity\\s+(.*);/;\n const solcVersionRangeMatch = source.match(SOLIDITY_VERSION_RANGE_REGEX);\n if (solcVersionRangeMatch === null) {\n throw new Error('Could not find Solidity version range in source')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Failure :: a > Result a b
function Failure(value) { return new _Result('Failure', value); }
[ "function failed(result) {\n return { kind: \"failed\", result: result };\n }", "function orForResult(a, b) {\n if (a.ok) {\n return a;\n }\n return b;\n}", "function Failure(e) {\n return new TFailure(e);\n}", "failing() {}", "function logMismatch (a,b) {\n return a + \" and \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Release all references to user data objects.
_releaseAllUserData() { this.#userDataPtrMap = {}; this.#userDataIIdMap = {}; this.#userDataPointer = 0; }
[ "function unloadAllAndClearMemory() {\n\t\t\tobjectCausality.resetObjectIds();\n\t\t\timageCausality.resetObjectIds();\n\t\t\tdelete instance.persistent;\n\t\t\tdbIdToDbImageMap = {};\n\t\t\tsetupDatabase();\n\t\t}", "function clearDataFromMemory() {\n user = null;\n token = null;\n }", "_releaseUs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Listen to blockchain for tx to be mined. Once Tx is mined refresh game state from blockchain TODO have some mechanism to stop watching if tx not picked up in n blocks
listenForHash(txHash) { const _this = this; // Wait for tx to be mined var filter = web3.eth.filter('latest').watch((err, blockHash) => { // Get info about latest Ethereum block web3.eth.getBlock(blockHash, (err, block) => { // Found tx hash? if (block.transactions.indexOf(txHash...
[ "async onTokensReceived(event) {\n this.state.lastBlockNumber = +event.blockNumber // update here too, because there's no guarantee MonoplasmaWatcher's listener gets called first\n if (this.state.lastBlockNumber >= this.state.lastPublishedBlock + this.minIntervalBlocks) {\n const ee = aw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
New final contest object
function generateNewContest() { var state = 'finished'; var isUnfinished = faker.random.number(1000) >= 600; if (isUnfinished) { state = faker.random.array_element(states); } var dates = newDates(state); var header = newHeader(); return { 'description': '<p>' + firstUpperCase(...
[ "function updateContests() {}", "function Contest() {\r\n\tthis.toString = function() { return \"<a href=\\\"\" + this.url + \"\\\"><b>\" + this.name + \"</b></a>\"; }\r\n}", "function Contest(networks){\n // A list of players in the contest\n this.players = [];\n for (var p = 0; p < networks.length; p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validates a qualitative value to be within the range dictated by the fields valid_values first and second elements. Assumes 'unknown' if value is equal to field.unknown
function validateQuantitative(value, field) { if (!field.valid_values) return [] if ( value.toString() === field.unknown || parseInt(value) === parseInt(field.unknown) ) return [] if (value.toString() === 'NaN') return ['This field can not be empty'] let v = parseInt(value) if (v.toString() === 'NaN') re...
[ "validateRange(value) {\n\t\tif (typeof(value) !== \"number\")\n\t\t\treturn false;\n\t\tif (this.valid === undefined || this.valid.range === undefined)\n\t\t\treturn true;\n\t\tlet strictLo = this.valid.range[2];\n\t\tlet strictHi = this.valid.range[3];\n\t\tif (strictLo && value <= this.valid.range[0])\n\t\t\tret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler for the download button where the user can download their drawing history as a JSON file in order to upload later
function downloadDrawing() { // Create Float arrays whose sizes are the amounts of vertices and colors we have let vertices = new Float32Array(gl.currentCoordByteOffset / Float32Array.BYTES_PER_ELEMENT); let colors = new Float32Array(gl.currentColorByteOffset / Float32Array.BYTES_PER_ELEMENT); gl.bindB...
[ "function handleDownload() {\n // retrieve graph via its unique title (doubles as id)\n const canvasSave = document.getElementById(props.title);\n canvasSave.toBlob(function (blob) {\n saveAs(blob, `${props.title}.png`);\n });\n }", "saveClick() {\n this.downloadFi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
navbar toggle add class on body
function initNavbarToggle() { $('.navbar-toggle').on('click', function(e) { e.preventDefault(); $('body').toggleClass('nav-active'); }); }
[ "function toggle_navbar_menu() {\n var navbar = document.getElementById(\"top_navbar\");\n if (navbar.className == nav_class) {\n navbar.className += \" open\";\n } else {\n navbar.className = nav_class;\n }\n}", "function BodyToggleClass(n){\n if(n === true){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets weight of club through a calculation by fnCalcWeight
get Weight() { return fnCalcWeight(this.Shaft, this.Length); }
[ "function fnCalcWeight(paramShaft, paramLength)\n{\n let varResults = 0;\n \n // What material is this club made out of\n switch (String(paramShaft).toLowerCase())\n {\n case String(\"Steel\").toLowerCase():\n //If Steel, use Density of 0.28 lb/in**3(cubed) + Estimated weight of Club Head\n varRes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
search the divs for one with a class day that matches the classname, and append to that div.
function appendtoWeekday() { for (i = 0; i < $weekDayDiv.length; i++) { if ($weekDayDiv[i].className === fitClass.day) { $weekDayDiv.eq(i).append(classTemplate); } } }
[ "addToParentByClass (divClass, child) {\n $(`.${divClass}`).append(child);\n }", "function thisweek() {\n let week = document.querySelectorAll(\".week\");\n for (let i = 0; i < week.length; i++) {\n let d = week[i].childNodes;\n for (let a = 0; a < d.length; a++) {\n if (d[a].className == \"today...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tunnel1_bgp_asn computed: true, optional: false, required: false
get tunnel1BgpAsn() { return this.getStringAttribute('tunnel1_bgp_asn'); }
[ "get bgpAsn() {\n return this.getNumberAttribute('bgp_asn');\n }", "get tunnel2BgpAsn() {\n return this.getStringAttribute('tunnel2_bgp_asn');\n }", "get bgpPeerId() {\n return this.getStringAttribute('bgp_peer_id');\n }", "function ASN1HEX() {\n return ASN1HEX;\n}", "getAddre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles killing off the selenium and webpack servers.
function killServers() { logger.info('Cleaning up running servers'); if (seleniumServer) { logger.info('Closing selenium server'); seleniumServer.kill(); } if (webpackServer) { logger.info('Closing webpack server'); webpackServer.close(); } process.exit(0); }
[ "async shutdown() {\n winston.info(MODULE, 'start shutdown');\n await this.headless.close();\n await this.chrome.kill();\n this.webappServer.close();\n this.headless = null;\n this.chrome = null;\n this.webappServer = null;\n winston.info(MODULE, 'finished shutdown');\n }", "function kill...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`deleteGraph` removes all triples with the given graph from the store
deleteGraph(graph) { return this.removeMatches(null, null, null, graph); }
[ "deleteGraph(graph) {\n return this.removeMatches(null, null, null, graph);\n }", "deleteGraph(graph) {\n return this.removeMatches(null, null, null, graph);\n }", "function deleteGraphStore(datasetName, graph) {\n return graphStoreClient('DELETE', datasetName, graph);\n}", "deleteGraph...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Input: requestDetails, an object containing information about the request. Output: An object blocking/not blocking the request.
function onBeforeSendHeaders(requestDetails) { if (typeof requestDetails.tabId !== 'number' || requestDetails.tabId < 0) { console.log('tabid is', requestDetails.tabId); console.log(requestDetails.url); } else { chrome.tabs.get(requestDetails.tabId, function(tab) { let requestType = classifyReque...
[ "function requestListener(reqDetails) {\n if (reqDetails.tabId === activeTabId) {\n console.log('request started', reqDetails.requestId);\n requests.push({\n id: reqDetails.requestId,\n });\n } \n return {};\n }", "request() {\n this.requestId = requestIdleCallback(idleDea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `RegexPatternSetReferenceStatementProperty`
function CfnWebACL_RegexPatternSetReferenceStatementPropertyValidator(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 o...
[ "function CfnRuleGroup_RegexPatternSetReferenceStatementPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function iFibonacci that behaves like the following: rFibonacci(0) = 0 => 0 rFibonacci(1) = 1 => 1 rFibonacci(2) = 1 => 1 rFibonacci(3) = 1 + 1 => 2 rFibonacci(4) = 1 + 2 => 3 rFibonacci(5) = 2 + 3 => 5 rFibonacci(6) = 3 + 5 => 8 Or I guess it can be written this way too... rFibonacci(0) = 0 => 0 rFibonacci(1) ...
function rFibonacci(num){ if(num === 0){ return 0; }else if(num === 1 || num === 2){ return 1; }else{ return rFibonacci(num - 2) + rFibonacci(num - 1); } }
[ "function recursiveFibonacci(n) {\n var fibs = [0,1];\n \n if (n === 0 || n ===1){\n return n;\n } else {\n \n return recursiveFibonacci(n-2) + recursiveFibonacci(n-1)\n } \n}", "function Fibonacci(n){\n if(n == 0){\n return 0;\n }\n if(n == 1){\n return 1;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shows the hyperlink dialog
showHyperlinkDialog() { if (this.hyperlinkDialogModule && !this.isReadOnlyMode && this.viewer) { this.hyperlinkDialogModule.show(); } }
[ "showHelpLink() {\n if ( !!this._options.helpLink ) {\n window.open( this._options.helpLink );\n }\n }", "function openLink() {\n window.open(link_placeholder);\n return false;\n }", "function showLinkModal () {\n var linkDialog = $(\"#link-dialog\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task Given two cells on the standard chess board, determine whether they have the same color or not. Example For cell1 = "A1" and cell2 = "C3", the output should be true. For cell1 = "A1" and cell2 = "H3", the output should be false. Input/Output [input] string cell1 [input] string cell2 [output] a boolean value true i...
function chessBoardCellColor(cell1, cell2) { const sum = Math.abs(cell1.charCodeAt(0) - cell2.charCodeAt(0)) + Math.abs(parseInt(cell1[1]) - parseInt(cell2[1])); return sum % 2 === 0; }
[ "function chessBoardCellColor(cell1, cell2) {\n let first = [cell1.charCodeAt(0), parseInt(cell1.charAt(1))];\n let second = [cell2.charCodeAt(0), parseInt(cell2.charAt(1))];\n \n return (first[0] % 2 == first[1] % 2) == (second[0] % 2 == second[1] % 2);\n \n}", "function chessBoardCellColor(cell1,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates new instance of "notification" module.
function NotificationModule() { /* constructor code here */ }
[ "function Notification() {\r\n var id = null;\r\n this.getId = function () {return id;};\r\n\r\n if (1 == arguments.length && arguments[0][rhoUtil.rhoIdParam()]) {\r\n if (moduleNS != arguments[0][rhoUtil.rhoClassParam()]) {\r\n throw \"Wrong class instantiation!\";\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HACK for IE7 only : if IE7 , move to left 100 pixels
function shiftForIE7() { if (jQuery.browser.msie && jQuery.browser.version == '7.0') { var tabDiv = document.getElementById('tabsetDiv'); tabDiv.scrollLeft = tabDiv.scrollLeft + 100; } }
[ "function move_to_left(target,speed){\r\n\t\t$(target).animate({\r\n\t\tleft:'+=10'\r\n\t},speed);\r\n}", "function move(element) {\n left = element.offset().left;\n element.css('left', left + 10);\n }", "function shiftToleft() {\n hideHint(0);\n var cur = ($('#Slider_HorizontalList').posi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the body and recursively generate a list of errors for any misnamed properties.
function getBodyErrors(style, body) { const errors = []; let parsed; try { parsed = yaml.safeLoad(body); } catch (err) { // Body can't be parsed, but this will be reported elsewhere. } if (parsed) { if (parsed instanceof Array) { checkArray(errors, style, parsed); } else if (parsed i...
[ "function bodyCheck(body) {\n if (body) {\n body = JSON.parse(body);\n } else {\n return;\n }\n\n if (body.results && body.results[0] && body.results[0].error) {\n throw new Error(body.results[0].error);\n }\n}", "getDetailedBodyViolations(string) {\n const violations = {};\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get starterkit options from $Home/.steamer/starterkits/starterkits.js
getKitOptions() { if (!this.fs.existsSync(this.kitOptionsPath)) { let options = { list: {}, timestamp: Date.now() }; this.fs.ensureFileSync(this.kitOptionsPath); this.fs.writeFileSync( this.kitOptionsPath, ...
[ "function initializeOptions() {\n const options = localStorage.getItem('options')\n if(options) return JSON.parse(options)\n return {\n showOptions: false,\n ignorePods: true,\n ignoreShuttles: true,\n ignoreRookieShips: true,\n showHighsec: false,\n showLowsec: tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
after releasing, destroy packages data & free "plugins" list, using "data" in arguments for "destroy" plugin's Orchestrator method
destroyAll(...data) { return Promise.resolve().then(() => { const _destroyPlugin = (i = this.plugins.length - 1) => { return -1 < i ? Promise.resolve().then(() => { const pluginName = this.plugins[i].name; // emit event retu...
[ "uninstall(plugin, ...data) {\n let directory = \"\";\n let key = -1;\n let pluginName = \"\";\n // check plugin\n return Promise.resolve().then(() => {\n return (0, checkOrchestrator_1.default)(\"uninstall/plugin\", plugin).then(() => {\n key = this.getP...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function samples a point from the metaball's density function Implement a function that returns the value of the all metaballs influence to a given point. Please follow the resources given in the writeup for details.
sample(point) { var isovalue = 1.1; var normal = new THREE.Vector3(0,0,0); this.balls.forEach(function(ball) { var d = point.distanceTo(ball.pos); var i = (ball.radius * ball.radius) / (d * d); isovalue += i; // formula for normals: http://blackpawn.com/texts/metanormals/ (gradient)...
[ "sample(point) {\n // @TODO\n \n var isovalue = 0;\n // Add up the total contribution from each metaball\n for(var i = 0; i < this.balls.length; i++) {\n var currentMetaball = this.balls[i];\n \n // Compute the displacement for each component\n var xDisplacement = currentMetaball....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads and parses development application details from the specified PDF.
async function parsePdf(url) { let developmentApplications = []; // Read the PDF. let buffer = await request({ url: url, encoding: null, proxy: process.env.MORPH_PROXY }); await sleep(2000 + getRandom(0, 5) * 1000); // Parse the PDF. Each page has details of a single application (which in some case...
[ "async function parsePdf(url) {\n let developmentApplications = [];\n // Read the PDF.\n let buffer = await request({ url: url, proxy: process.env.MORPH_PROXY, encoding: null });\n await sleep(2000 + getRandom(0, 5) * 1000);\n // Parse the PDF. Each page has details of a single application.\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a constructor function called "Car" car takes an options object as its only argument your options object should have "make", "model", "year" properties on it assign these properties you pass in with options to the constructors 'this' object. add a speak() method to your object that when called will log out the c...
function Car(options) { this.make = options.make; this.model = options.model; this.year = options.year; }
[ "function car(make, model, year){\n this.make = make\n this.model = model\n this.year = year\n}", "function Car(make, speed){\n this.make = make;\n this.speed = speed;\n}", "function ToyCar(color, price, name) {\n this.color = options.color;\n this.price = options.price;\n this.name = op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function selectTab for changing login, sign up and user information tabs
function selectTab(evt, tabTitle) { var inputfield, tablinks; evt = event || window.event; // Assingns variables to inputfield and tablink elements inputfield = document.getElementsByClassName("inputfield"); tablinks = document.getElementsByClassName("tablinks"); //navBar = document.getElementById("minNav"...
[ "function selectTab() {\n var href = tab.href.split('#')[1];\n var panel = layout.content_.querySelector('#' + href);\n layout.resetTabState_(tabs);\n layout.resetPanelState_(panels);\n tab.classList.add(layout.CssClasses_.IS_ACTIVE);\n panel.classList.add(layout.CssClasses...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Special getter for accessing scope
get scope() { return this[scope]; }
[ "function getScope() {\n return $SCOPE;\n }", "getScope() {\n return Object.create(this.scope);\n }", "__get(node) {\n return this.__nodeToScope.get(node);\n }", "getScopeIdentifier () {\n return this._scopeIdentifier\n }", "getCurrentScopeName() {}", "function Scope() {}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attaches a policy to this user.
attachInlinePolicy(policy) { try { jsiiDeprecationWarnings.aws_cdk_lib_aws_iam_Policy(policy); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, this.attachInlinePolicy); ...
[ "attachInlinePolicy(policy) {\n this.attachedPolicies.attach(policy);\n policy.attachToUser(this);\n }", "attachInlinePolicy(policy) {\n this.attachedPolicies.attach(policy);\n policy.attachToRole(this);\n }", "addToRolePolicy(statement) {\n this.role.addToPolicy(stateme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
showOrHideMenu recieve a boolean called isOpen if the menu is open log out "close the menu" otherwise Log out "show the menu"
function showOrHideMenu(isOpen) { if (isOpen) { console.log ("close the menu"); } else { console.log ("show the menu"); } }
[ "function toggleMenuState() {\n\n if (isVisible(menu)) {\n hideMenu ();\n }\n else {\n // show\n menu.style.display = 'block';\n }\n\n }", "onShowMenu(){\n\t\tif(!this.menu_shown){\n\t\t\tactions.toggleMenu();\n\t\t}\n\t}", "function openUserMenu() {\n userMenu.classList.remove('h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function:enableButton(objBtn) purpose:Enabled button parameters :Object of button return value : First time : 20020705 Author : ChenHongRi
function enableButton(objBtn) { objBtn.className = "headbtn"; objBtn.disabled = false; //objBtn.tabIndex = objBtn.tmpIndex; return true; }
[ "function SA_EnableButton(oButton, bEnable)\r\n{\r\n\tvar oException;\r\n\ttry \r\n\t{\r\n\t\t//\r\n\t\t// Validate arguments\r\n\t\tif ( oButton == null )\r\n\t\t{\r\n\t\t\tSA_TraceOut(\"SA_EnableButton\", \"oButton argument was null.\");\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif ( oButton.type != \"button\" )\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[2,4,6,8] 2. Take an array of numbers and make them strings.
function stringItUp(arr){ return arr.map(number => String(number)) }
[ "function numToStrings(array) {\n return array.map(el => el + '')\n }", "function numberToString(arr) {\n const result = arr.map(String);\n return result;\n}", "function stringItUp(arr){\n return arr.map(function(num){\n return num.toString();\n })\n }", "function stringItUp(arr){\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
from map, remove the marker of the input restaurant based on the place_id attribute
function removeRestaurantMarkers(restaurant) { for (var j = 0; j < markers.length; j++) { if (markers[j].place_id === restaurant.getAttribute("place_id")) { markers[j].setMap(null); } } }
[ "function removePlace(lData) {\n// console.log(\"remove Place: \" + JSON.stringify(lData.title));\n lData.mapMarkerDetail.setMap(null);\n}", "function remove_marker( map, index ) {\r\n\r\n var marker = map.markers[index];\r\n\r\n // Remove hidden marker field\r\n map.jq_obj.parent().fin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display a modal form for updating/creating a group.
function groupForm(box_id, group_id) { group_id = typeof group_id !== 'undefined' ? group_id : ""; // Delete any existing instance of the form with the same name if($('#' + box_id).length ) { $('#' + box_id).remove(); } var data = { box_id: box_id, render: 'modal' }; var url = site['uri']['...
[ "function new_kb_group() {\n $('#kb_group_modal').modal('show');\n $('.edit-title').addClass('hide');\n}", "function new_kb_group(){\n $('#kb_group_modal').modal('show');\n $('.edit-title').addClass('hide');\n}", "function showGroupInfo(g) {\n currentGroupId = g.id;\n // Populate the U...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This sample demonstrates how to Creates or updates the file share.
async function fileSharesCreateOrUpdate() { const subscriptionId = "9eb689cd-7243-43b4-b6f6-5c65cb296641"; const deviceName = "HSDK-4XY4FI2IVG"; const fileServerName = "HSDK-4XY4FI2IVG"; const shareName = "Auto-TestFileShare1"; const resourceGroupName = "ResourceGroupForSDKTest"; const managerName = "hAzure...
[ "async shareCreate(share) {\n\t\tow(share, ow.string.nonEmpty);\n\n\t\treturn call(`share create \"${share}\"`);\n\t}", "function share(yunData, fidlist, cb){\n\t$.ajax({\n\t\ttype: \"POST\",\n\t\turl: \"https://pan.baidu.com/share/set?web=1&channel=chunlei&web=1&bdstoken=\"+yunData.bdstoken+\"&clienttype=0\",\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the date of birth string from an eployees array object, parses it into a date object to extract only the necessary information and then puts it back into a string to be formatted. Returns formatted date string (mm/dd/yy)
function formatDateOfBirth(string) { let date = new Date(Date.parse(string)); let month = date.getMonth() + 1; let day = date.getDate(); let year = date.getYear(); let dob = month + '/' + day + '/' + year; return dob; }
[ "function convertBirthdate() {\n let birthday = logedIn.birthday;\n let key = \"-\";\n let year = \"\",\n month = \"\",\n day = \"\";\n let date = [];\n for (let i = 0; i < birthday.length; i++) {\n if (birthday[i] != key && i < 4) {\n year += birthday[i];\n } e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert 2D control points to 3D
to3D() { if (this.dimension === 3) { return; } console.assert(this.dimension === 2); let cpoints = this.cpoints.toArray(); for (let i = 0; i < cpoints.length; i++) { cpoints[i].push(0); } this.cpoints = common_1.arr(cpoints); ...
[ "function controlsPointTransformation(controls) {\r\n var arr = [];\r\n for(var i=0; i<controls.length; i++) {\r\n for(var j=0; j<3; j++) {\r\n var arr2 = [];\r\n arr2[j] = controls[i][j+2];\r\n arr2[j+1] = controls[i][j];\r\n arr2[j+2] = (-1)*controls[i][j+1];\r\n j+=3;\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers an icon resolver function with the registry. The function will be invoked with the name and namespace of an icon when the registry tries to resolve the URL from which to fetch the icon. The resolver is expected to return a `SafeResourceUrl` that points to the icon, an object with the icon URL and icon options...
addSvgIconResolver(resolver) { this._resolvers.push(resolver); return this; }
[ "_getIconConfigFromResolvers(namespace, name) {\n for (let i = 0; i < this._resolvers.length; i++) {\n const result = this._resolvers[i](name, namespace);\n if (result) {\n return isSafeUrlWithOptions(result) ?\n new SvgIconConfig(result.url, null, resu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The offsetLeft is a JavaScript DOM property. It tells us how far left an element is relative to the nearest ancestor without a static position. You'll be using the offsetLeft property to tell how far, in pixels, the htmlToken has traveled from the left edge of the game board. This value is needed to calculate the new l...
get offsetLeft() { return this.htmlToken.offsetLeft; }
[ "moveLeft() {\n if (this.columnLocation > 0) {\n this.htmlToken.style.left = this.offsetLeft - 76; //updates the position of the htmlToken\n this.columnLocation -= 1; //updates the current column location\n }\n }", "moveLeft() {\n if (this.columnLocation > 0) {\n this.htmlToke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isSignedFloat (STRING s [, BOOLEAN emptyOK]) True if string s is a signed or unsigned floating point (real) number. First character is allowed to be + or . Also returns true for unsigned integers. If you wish to distinguish between integers and floating point numbers, first call isSignedInteger, then call isSignedFloat...
function isSignedFloat (s) { if (isEmpty(s)) if (isSignedFloat.arguments.length == 1) return defaultEmptyOK; else return (isSignedFloat.arguments[1] == true); else { var startPos = 0; var secondArg = defaultEmptyOK; if (isSignedFloat.arguments.length > 1) ...
[ "function isSignedFloat (s) {\r\n if (isEmpty(s)) {\r\n if (isSignedFloat.arguments.length == 1) {\r\n return defaultEmptyOK;\r\n } else {\r\n return (isSignedFloat.arguments[1] == true);\r\n }\r\n } else {\r\n var startPos = 0;\r\n var secondArg = defa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pads a `tf.Tensor2D` with a given value and paddings. See `pad` for details.
function pad2d_(x, paddings, constantValue) { if (constantValue === void 0) { constantValue = 0; } util.assert(paddings.length === 2 && paddings[0].length === 2 && paddings[1].length === 2, function () { return 'Invalid number of paddings. Must be length of 2 each.'; }); return exports.pad(x, paddin...
[ "function pad2d_(x, paddings, constantValue) {\n if (constantValue === void 0) {\n constantValue = 0;\n }\n assert(paddings.length === 2 && paddings[0].length === 2 && paddings[1].length === 2, function () {\n return 'Invalid number of paddings. Must be length of 2 each.';\n });\n return pad(x, paddings,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::ApplicationInsights::Application.JMXPrometheusExporter` resource
function cfnApplicationJMXPrometheusExporterPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnApplication_JMXPrometheusExporterPropertyValidator(properties).assertSuccess(); return { HostPort: cdk.stringToCloudFormation(properties.hostPort)...
[ "function cfnApplicationHAClusterPrometheusExporterPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnApplication_HAClusterPrometheusExporterPropertyValidator(properties).assertSuccess();\n return {\n PrometheusPort: cdk.stringToCloudF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Percentage of time, the closing value was above 200 Day EMA
function BullishScore( data,period ) { var tot = 0.0; for ( var x = period-1 ; x < data.length; x++ ) { tot += data[x]['AboveEMA'] ; } return ( 100.0 * tot/( data.length - period ) ) ; }
[ "percentChange() {\n const lastCoreEquity = this.rawData.portfolio.last_core_equity\n return (this.absChange() / lastCoreEquity) * 100\n }", "function evaluateGrowth1M(chart) {\n var startPrice = chart[chart.length - 7 - end].close;\n var endPrice = chart[chart.length - 1 - end].close;\n\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Looks over the results and returns a summary of timings, execution and errors, if any, that may have occurred.
get results() { return { stepped: this.hasStepped, timing: this[TTIME].summary, totalTime: this[TTIME].time, hasErrors: this[SDATA].reduce((p,c,i,a) => { if (p) { return true } if (c.error) { return true } return false; }, false), errors: this[SDATA] ...
[ "function reportResults() {\n let sorted_results = Array.from(results_grouped_by_function.values())\n\n sorted_results.sort((a, b) => b.long_ops_worst_time - a.long_ops_worst_time)\n\n for (let result of sorted_results) {\n let description = result.line_in_code_description + ' - ' + result.long_ops_worst_time...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new ExternalTaskQueryDto. A JSON object with the following properties:
constructor() { ExternalTaskQueryDto.initialize(this); }
[ "constructor() { \n \n SortTaskQueryParametersDto.initialize(this);\n }", "function buildQuery() {\n let q = {\n \"query\": query, // the query\n \"max_results\": 100, // max results per request, 100 is the maximum for standard licenses in sandboxed environments \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
VixenMenuClass // VixenMenuClass Vixen menu class Vixen menu class including Vixen context menu
function VixenMenuClass(objMenu) { //Config this.config = { 'Level1': { 'left': 10, 'width': 50, 'height': 50, 'spacing': 5, 'backgroundColor': "#FFFFFF" }, 'Level2': { 'left': 0, 'width': 160, 'height': 20, 'spacing': 5, 'backgroundColor': "#D5E0F8" }, 'waitOpen': 0, ...
[ "function ContextMenu(){}", "function Venus() {}", "function ContextMenu(options){this._idTick=0;this._items=[];this.menu=new Menu(options);}", "function ContextMenu(parent) {\n this.parent = parent;\n this.init();\n }", "function FIND_CONTEXT_MENU$static_(){VersionHistory.FIND_CONTEXT_MENU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given the content of a file, write it to our IPFS cluster
function writeToIPFS(fileContent) { const ipfs = ipfsClient('ipfs.infura.io', '5001', { protocol: 'https' }); // leaving out the arguments will default to these values if(ipfs) { return ipfs.add(Buffer.from(fileContent)).then((res) => { let ipfsHash = res[0].hash; console.log('Saved IPFS f...
[ "function writeToFile(fileName,content){\n fs.writeFile(fileName, content, {\n encoding: 'utf8'\n }, function(err) {\n if (err) console.log(err);\n console.log('finished writing');\n });\n}", "function writeToFile() {\n\tFS.root.getFile(filename,{create : true},gotFileEntryforWriter,failed);\n \n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When dropdown selection changed, load the new inner sched page
function loadNewSeason(season) { //set up tracking var track = document.getElementById("track_dropdown_change"); if (track) { track.src = "http://secure-us.imrworldwide.com/cgi-bin/m?ci=us-cstvclicks&cg=hist_sched&si=http://" + document.domain + "_switch_season_" + season + "&rnd=" + Math.random(); } //l...
[ "function optionChanged(newSubjectID) {\n console.log(\"User selected subject ID:\", newSubjectID);\n populatePage(newSubjectID);\n}", "function completeScheduling(){\n View.parentTab.parentPanel.selectTab('select');\n}", "function onSchoolSelect(e) {\n $.ajax({\n url:'api/course_admin.php',\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a generalized graph and two vertex IDs, return whether a path exists from first to second vertex. Second: on success, return array of vertex IDs representing one possible path.If none exist, return [].
isReachable(vertID1, vertID2, curr=null, path=[]) { if(curr == vertID1) { return []; } if(curr == vertID2) { path.push(curr); return path; } let result = []; curr = curr || vertID1; for(let edge of this.edgeList) { if(edge[0] == curr) { path.push(edge[0]); ...
[ "function pathExists(n1, n2){\n\t\tif(!contains(n1) || !contains(n1)) return false;\n\t\telse return graph[n1].connectedTo.has(graph[n2]);\n\t}", "checkIfEdgeExists(fromVertex, toVertex) {\n return fromVertex.edges.some(edge => edge === toVertex) && \n\t\t\t toVertex.edges.some(edge => edge === fromVertex);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
deleteUserDefaultsForKey Delete an object from NSUserDefaults
function deleteUserDefaultsForKey(key, callback) { NativeBridge.call('deleteUserDefaultsStringForKey', [key], callback); }
[ "remove(key) {\n delete this.#defaults[key];\n }", "function deletePreferences() {\n PropertiesService.getUserProperties().deleteAllProperties();\n}", "function deletePublicPref() {\n\t\tpublicStorage.remove();\n\t}", "function purgePrefs() {\n\tfor (var key in localStorage) {\n\t\tif (key.indexOf(\"mtd_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
eslintdisable complexity Mappings from complete tags to preferred values. Derived from IANA Language Subtag Registry, file date 20180330.
function updateLangTagMappings(tag) { assert(IsObject(tag), "tag is an object"); assert(!hasOwn("grandfathered", tag), "tag is not a grandfathered tag"); switch (tag.language) { case "hy": // hy-arevela -> hy if (tag.variants.length >= 1 && callFunction(ArrayIndexOf, tag.v...
[ "static uposTags() {\n // return [ \"ADJ\", \"ADP\", \"ADV\", \"AUX\", \"CONJ\", \"DET\", \"INTJ\", \"NOUN\", \"NUM\", \"PART\", \"PRON\", \"PROPN\", \"PUNCT\", \"SCONJ\", \"SYM\", \"VERB\", \"X\" ]\n return [\n {\n \"value\": \"ADJ\",\n \"label\": \"Adjective\"\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return red if the delivery date is over 40 days from now, or green if it's less
function getDateColor(deliveryDate){ var d = deliveryDate.match(/- (.*)/); if(!d) return "#dd1e31"; /* hack: red, input is 'no date range, so no match */ d = new Date(d[1]); d.setFullYear((new Date()).getFullYear()); if(d < Date.now()) d.setFullYear(d.getFullYear() +1); ...
[ "function getColorForDaysSinceSpider(dayDiff){\r\n\tif(dayDiff < 7)return 'green';\r\n\tif(dayDiff >= 7 && dayDiff <= 10)return '#ffca00';\r\n\tif(dayDiff > 10)return 'red';\r\n\treturn 'black';\r\n}", "function giveColorClass(){\n let today = dayjs().format('ddd MMM D YYYY');\n if (today === props.followup...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save the open note
function saveNote(){ if($('.notes-list-container').children('.note-item').length > 0){ let content = editor.getContents(); editNoteContent(editorNotebook, editorNote, editor.getContents()); $('.notes-list-container .note-item.selected .note-item-title h4')...
[ "saveNote() {\n var note = new Note({\n date: document.getElementById('note-date-input').value,\n text: document.getElementById('note-text-input').value\n });\n this._notes[note.date.getTime()] = note;\n this.renderNotes();\n this.removeEditNoteScreen();\n this._saveNotepad();\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback for embeddedSearch.newTabPage.onmostvisitedchange. Called when the NTP tiles are updated.
function onMostVisitedChange() { reloadTiles(); }
[ "function triggerRefreshMostVisited () {\r\n if (mostVisitedBNId != undefined) {\r\n\tif (beforeFF63) {\r\n\t browser.topSites.get()\r\n\t .then(refreshMostVisited);\r\n\t}\r\n\telse { // After FF63, get the favicon data URL which is now made available\r\n\t let maxResults = 10;\r\n\t let url = mostVisitedBN.u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the platform has entered to the canvas from above.
hasEntered() { this.requestCameraAttention(); return this.y > 0; }
[ "hasReachedTarget() {\n return this.y >= CANVAS_HEIGHT - SHOOTER_SIZE;\n }", "out_of_canvas() {\n if (this.x > width || this.y > height){\n return true;\n }\n if (this.x <0 || this.y <0) {\n return true;\n }\n else{\n return false;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to find the number of possible permutations with the given letters
function numOfPermutations(lettersArr) { let num = 1; for (let i = 1; i <= lettersArr.length; i++) { num *= i } return num }
[ "function permAlone(str) {\n\n const calculatePermutations = (str) => {\n\n if (str.length === 1){\n return [str]\n }\n \n let permutations = [];\n for (let i = 0; i < str.length; i++) {\n const currentLetter = str[i];\n const remainingLetters =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create functiondecorator, that limits launches of function
function onceTimeDecorator (f) { var functions = {}; return function () { if (functions[f]) { return new Function; } else { functions[f] = true; return f.apply(this, arguments); }; } }
[ "function limitCallsDecorator(fn, n) {\n return function(...args) {\n if (n > 0) {\n n -= 1;\n return fn(...args);\n }\n };\n}", "function callTImeOnly(fn, count){\n return function(args){\n let context = this;\n if(functionMap.has(fn.name) && functionMap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fill in code that creates the triangles for a cone with diameter 1 and height of 1 (centered at the origin) with the number of subdivisions around the base of the cone (given by radialdivision) and the number of subdivisions along the surface of the cone given by heightdivision.
function makeCone (radialdivision, heightdivision) { // fill in your code here. var triangles = []; var circ_triangles = []; // Contains triangles from the top and bottom var side_triangles = []; // Contains triangles from the side and var Bottom_Center = [0, -0.5, 0]; var Apex = [0, 0.5, 0]; const radius ...
[ "function makeCone (radialdivision, heightdivision) {\n var pi = Math.PI;\n var rad = 360 * (pi/180); //360 in radians\n var circleOffset = rad / radialdivision;\n var heightOffset = 1 / heightdivision;\n var roundError = circleOffset - ((circleOffset*9)/10);\n var heightRoundError = heightOffset ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
similar to dngettext pass $context=null for no context
function n__(context,strings,stringp,n) { //return portal_translateOptionalContext_plural($strings,$stringp,$n,$context); return _i18n.dcnpgettext(null, context, strings, stringp, n); }
[ "function t_translationstring_TranslationString() {}", "t(t, params) {\n return $translate.textWithParams(t, params);\n }", "function $gettext (msg) {\n return msg\n}", "function load_translation_context() {\n var context = current_context;\n \n if($(context).data('transl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List the cluster.hadoop.Task objects [PRODUCTION] [See on api.ovh.com](
TasksAssociatedWithThisHadoopCluster(serviceName, status) { let url = `/cluster/hadoop/${serviceName}/task?`; const queryParams = new query_params_1.default(); if (status) { queryParams.set('status', status.toString()); } return this.client.request('GET', url + queryP...
[ "function listTasks() {\n const query = datastore.createQuery('Task').order('created');\n\n datastore\n .runQuery(query)\n .then(results => {\n const tasks = results[0];\n\n console.log('Tasks:');\n tasks.forEach(task => {\n const taskKey = task[datastore.KEY];\n console.log(tas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end function GetSomewhereinPhoneticModifiedCharaceter Determines whether its a bornosoft modifier character or not. Coded by : S M Mahbub Murshed Date: September 30, 2007
function IsBornosoftModifierCharaceter(CUni) { if(CUni=='হ' || CUni=='`' || CUni=='~' ) return true; return false; }
[ "function IsSomewhereinPhoneticModifierCharaceter(CUni)\r\n{\r\n\tif(CUni=='হ' || CUni=='গ' \r\n\t|| CUni=='ঘ' || CUni=='ণ'\r\n\t|| CUni=='ঃ' || CUni=='ট'\r\n\t|| CUni=='ো' \r\n\t|| CUni=='ই' || CUni=='ি' \r\n\t|| CUni=='উ' || CUni=='ু'\r\n\t|| CUni=='র' || CUni=='ড়' )\r\n\t\treturn true;\r\n\treturn false;\r\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the columnDefs configuration depending on the number of columns
function getColumns() { if (countCols() === 4) { return [ {'targets': 0, 'orderable': true}, {'targets': 1, 'orderable': false}, {'targets': 2, 'orderable': false, 'width': '120px', 'className': 'operation-column'}, {'targets': 3, 'orderable': false, 'searchab...
[ "generateColumnDefs() {\n const columnConfigArray = [];\n const self = this;\n this.tableTitles.map((val, index) => {\n const columnnConfig = {};\n columnnConfig.title = val;\n columnnConfig.targets = index;\n const columnWidthArray = [\n '15%',\n '15%',\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Missile Action Actor source Actor target
function MissileAction(source, target) { "use strict"; this.source = source; this.target = target; this.coordsxy = {}; this.elapsedTime = 0; // cost of missile action this.source.decAP(1); }
[ "receivePlayerSelection(action, target) {\n if (action === 'attack') {\n this.units[this.index].attack(this.enemies[target]);\n const enemy = this.enemies[target];\n enemy.healthBar.decrease(100 * (enemy.hp / enemy.maxHp));\n }\n // next turn in 3 seconds\n this.time.addEvent({\n del...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
METROPOLIS ALGORITHM function to initialize Metropolis algorithm
function metropolisInit () { data.metropolis = Object(); data.metropolis.x = Object(); data.metropolis.y = Object(); // define initial values data.metropolis.x.val = targetMuX; data.metropolis.y.val = targetMuY; // define arrays that will store all values data.metropolis.x.vals = []; ...
[ "pow22523(z) {\r\n const t0 = new FieldElement();\r\n const t1 = new FieldElement();\r\n const t2 = new FieldElement();\r\n let i;\r\n t0.square(z);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
determines if selected slot is filled.
slotFilled(slot) { return slot.classList.contains('filled'); }
[ "areSlotsAllFilled() {\n return !this.getNotFilledSlot()\n }", "function allSlotsFilled() {\n\t\tif (($(\"li\", slot0).length) && ($(\"li\", slot1).length) && ($(\"li\", slot2).length) && ($(\"li\", slot3).length)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}", "function isFilled() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if queryPattern is matched with request query object
matchQuery(reqQuery) { return _.isMatchWith( reqQuery, // obj this.queryPattern, // src (objVal, srcVal) => (objVal === srcVal || (srcVal === true && objVal)) ); }
[ "function checkSearch(req) {\n\n\t\tlet searchParam = req.query.s\n\n\t\treturn searchParam != undefined\n\t}", "static pathMatcher(req, pathTemplate) {\n const pathPrefix = pathTemplate.split(':')[0];\n //TODO use url.parse\n if (req.url.indexOf(pathPrefix) === 0) {\n var pathPart...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is aiming to resolve wehter or not we're to be firing an edge level event.
function determineEventResolution( ) { if ( hasFired ) return false; //Don't fire again until reset if ( isVertical ) { if ( atEdgeTop && wheelData > 3 ) { hasFired = true; console.log("TOP-EDGE SWIPE"); var ha = handlers[ PublicAccess.EDGE_EVENT_TOP ]; for ( var i = 0, l = ha.length; i < l...
[ "function OnEdgeDetect(evt) {\n //alert(\"Status: \" + evt.status + \" Reason: \" + evt.reason);\n\n}", "function touchenexEdgeCond(){\n\treturn touchenexInfo.exEdgeInfo.isUse && TOUCHENEX_UTIL.isEdge();\n}", "isCorrectEventType() {\n return true;\n }", "function _checkEdges ( a_object )\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends story id to page url and urls form publsih panel and makes publish panel visble if request was sent from /edit/ page.
function addStoryIdToUrls() { if (xhr.readyState === 4 && xhr.status === 200) { var newId = xhr.responseText; if (!document.URL.endsWith(newId)) { window.history.pushState( 'new_id', 'Title', '/edit/' + newId ); ...
[ "function putOwnStoriesOnPage() {\n $ownStories.empty();\n\n if (currentUser.ownStories.length === 0) {\n $ownStories.append(\"<h5>No stories added by user yet!</h5>\");\n } else {\n for (let story of currentUser.ownStories) {\n let $story = generateStoryMarkup(story, true);\n $ownStories.append(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if two revisions are the same, ignoring different tid values.
_checkSameRev(firstRev, secondRev) { const normalizeRev = (rev) => { const result = {}; Object.keys(rev).forEach((key) => { const value = rev[key]; // Ignore the tid attribute // Ignore all falsy values, as well as an empty array ...
[ "_sameType(firstVersion, secondRevision) {\n return firstVersion && secondRevision && firstVersion.entityId === secondRevision.entityId;\n }", "systemModstampsAreDifferent(firstRecord,secondRecord){// treat systemModstamp being null/undefined as being present and different and thereby return true\n // enti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
blank settings check function
function settingsValidation() { if (settings.get("OPTION_ID") && settings.get("MAIN_TABLE") && settings.get("MAIN_PK_FIELD") && settings.get("SPC_TABLE") && settings.get("SPC_PK_FIELD")) { return true; } else { eventEmmitter.emit("message", "Unable to Process Action Due to Settings Configuration Incomplete...
[ "hasInvalidSettings(settings){}", "function checkSettings () {\n// If no setting found\n settings.defaultSettings(true)\n // Apply them\n applySettings()\n // Set theme\n setTheme(settings.mobySettings.Theme)\n}", "function check_settings(){\n var safe_defaults = {\n login: '',\n password:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Interleave bits of 3 coordinates, each with 10 bits. Useful for fast octree codes.
function interleave3(x, y, z) { x &= 0x3FF; x = (x | x << 16) & 4278190335; x = (x | x << 8) & 251719695; x = (x | x << 4) & 3272356035; x = (x | x << 2) & 1227133513; y &= 0x3FF; y = (y | y << 16) & 4278190335; y = (y | y << 8) & 251719695; y = (y...
[ "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" ] ] } }
determine if session should be touched (touch means refresh maxAge)
function shouldTouch(req) { // cannot set cookie without a session ID if (typeof req.sessionID !== 'string') { debug('session ignored because of bogus req.sessionID %o', req.sessionID); return false; } return cookieId === req.sessionID && !shouldSave(req); }
[ "function shouldTouch(req) {\n\t // cannot set cookie without a session ID\n\t if (typeof req.sessionID !== 'string') {\n\t debug('session ignored because of bogus req.sessionID %o', req.sessionID);\n\t return false;\n\t }\n\n\t return cookieId === req.sessionID && !shouldSave(req)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name: storeVanityNumbers Purpose: Writes the list of vanity numbers returned by the function to the database Author: Paul Travis Created: 3/14/2021 Last Changed: 3/18/2021 Last Changed By: Paul Travis
async function storeVanityNumbers(str_number, arr_vanity_numbers) { const ARR_DATA_TO_WRITE = {"callingNumber": str_number, "vanityNumbers": arr_vanity_numbers}; //create item to be stored in the database const DDB_DOCUMENT_CLIENT = new AWS.DynamoDB.DocumentClient({region: 'us-east-1'}); const PARAMS = { ...
[ "function createNumber(number,vanityNumArray){\n const params = {\n TableName : 'VANITY_NUMBERS',\n Item : {\n 'customerNumber' : number,\n 'vanity' :vanityNumArray\n }\n }\n return ddb.put(params).promise();\n}", "function produceVanityNumbers(str_processed_number, str_numbe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recibe un usuario y te retorna el style con el que se ve su nombre
styleForUser(user) { return {fontWeight: 'bold', color: this.colorForUsers[user.color]}; }
[ "function user_style() {\r\n\tres.contentType = 'text/css';\r\n\tres.write(this.custom_style);\r\n}", "function name(user) {\n Dom.span(function () {\n Dom.style({\n textTransform: 'initial',\n color: '#999',\n fontWeight: 'bold',\n verticalAlign: 'center'\n });\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PART 1: You fly into the asteroid belt and reach the Ceres monitoring station. The Elves here have an emergency: they're having trouble tracking all of the asteroids and can't be sure they're safe. The Elves would like to build a new monitoring station in a nearby area of space; they hand you a map of all of the astero...
function bestAsteroidLocation (part, asteroidStr, n, startX, startY) { // n, startX, and startY are for part 2 // UTILITY FUNCTION: GIVEN INTEGER INPUTS, FIND POSITIVE GREATEST COMMON DENOMINATOR function GCD (num, denom) { // uses Euclidean algorithm (https:/...
[ "function badChaosAI(board) {\r\n // The cell ID the turn is played on, and the mark to place (O vs X)\r\n var move = {\r\n cell: 0,\r\n mark: 0\r\n };\r\n\r\n initLines(board);\r\n\r\n // Go through all lines\r\n for (var lineId = 0; lineId < numLines; lineId++) {\r\n var line = lines[lineId];...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the id of the box that was clicked
function getIdFromBox() { console.log("clicked"); displayEvents(this.id); }
[ "function getBoxID(e){\n\t\tvar boxID = e.target.id;\n\t\tchangeBGColor(boxID);\n\t}", "function getClickedBox(el) {\n const clickedBox = el.closest(\".ms_grid_row_box\");\n const clickedRow = el.closest(\".ms_grid_row\");\n if (!clickedBox || !clickedRow) return;\n const row = grid_rows.indexOf(clickedRow);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an extension manager.
createExtensionManager() { const coreExtensions = this.options.enableCoreExtensions ? Object.values(extensions) : []; const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension) => { return ["extension", "node", "mark"].includes(extension === null || extension === void 0 ? voi...
[ "createExtensionManager() {\r\n const coreExtensions = this.options.enableCoreExtensions\r\n ? Object.values(extensions)\r\n : [];\r\n const allExtensions = [...coreExtensions, ...this.options.extensions].filter(extension => {\r\n return ['extension', 'node', 'mark'].i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send the SMS alert, check Twilio DOCSs
function sendSMSAlerts(_message,toNumber){ twilioClient.messages .create({ body: _message, from: fromNumber, to: toNumber, }) .then(message => console.log("Sent SMS with SID:",message.sid)) .done(); }
[ "function alertSMS() {\n if (!config.TWILIO_ACCT_SID || !config.TWILIO_AUTH_TOKEN) {\n return;\n }\n\n // only send SMS every 1 minute\n if (smsSent) {\n return;\n }\n\n var opts = { to: config.NUMBER_TO_SEND_TO,\n from: config.TWILIO_OUTGOING_NUMBER,\n body: \"fall detected\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sendNotificationAndroid Purpose: This function is used sendNotificationAndroid Precondition: None Postcondition: None. Parameters: , Returns: void
async function sendNotificationAndroid0(notification_data) { if(notification_data && notification_data.user_id){ //const userDetail = await Users.getUserByid(notification_data.user_id); return new Promise((resolve,reject)=>{ Request.post({ "headers": { ...
[ "function sendNotification() { //Dont want to send notification right away because first have to verifiy from that we have permission to do so, so put our notificaiton sending code inside another function that can be called when we are ready.\n Notifications.setNotificationHandler({ //override default be...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if the /trends/apple route in the API has a response length of more than 5
test_trends_apple() { axios.get("https://protected-ravine-04165.herokuapp.com/trends/apple") .then((response) => { if(response.data.length > 5) { console.log("TEST: API /trends/apple returns data - PASSED"); } else { console.log("TEST: API /trends/...
[ "test_complete_trends_apple() {\n axios.get(\"https://protected-ravine-04165.herokuapp.com/complete/trends/apple\")\n .then((response) => {\n if(response.data.length > 5) {\n console.log(\"TEST: API /complete/trends/apple returns data - PASSED\");\n } else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Final submission attempt for new instance. Serverside validation should be performed on the input data.
function instanceAddSubmitInstance() { blockScanResults(); afAddNewInstance(); }
[ "newSubmission() {\n this.set('newSubmissionObject', this.get('store').createRecord('submission'));\n }", "submit() {\n this.processAll()\n if (this.valid) {\n ipcRenderer.send('teacherCreation', {\n fullName: this.name.value,\n so...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get auction by id
function findById(id) { return db("Auctions").where("id", id).first() }
[ "async function getAuction(id) {\n try {\n return await auctionModel.findById(id);\n } catch (error) {\n console.error(\"getAuction:\", error.message);\n return {};\n }\n }", "function loadAuction(id){\n var url = 'http://barrettjacksonservices.azurewebsites.net/api/auction/' + id;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
read all sections of library and add them to library, then read items of library
function readSections(xmlLibrary, library) { // read section var xmlSections = xmlLibrary.getElementsByTagName("sections"); var sectionList = xmlSections[0].getElementsByTagName("section"); var j, m; for (j = 0, m = sectionList.length; j < m; j++) { var xmlSec...
[ "function readLibraryItems(xmlLibrary, library) {\r\n var xmlLibraryItems = xmlLibrary.getElementsByTagName(\"shapes\");\r\n if (!xmlLibraryItems.length) {\r\n return;\r\n }\r\n var moList = xmlLibraryItems[0].getElementsByTagName(\"shape\");\r\n var j, m;\r\n\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Esse construtor permite que componentes vizinhos interajam entre si. Nesse caso o input na barra de pesquisa filtra o objeto robo.
constructor(){ super() this.state = { robo: [], //Campo de pesquisa começa vazio a medida que for inputado valores começara a filtragem. campoPesquisa: '' } }
[ "constructor(marca,modelo,color,combustible,precio,volante, radio){\n super(marca,modelo,color,combustible,precio)//super hace referencia al padre al que aparece en extens y le pasa los valores \n this.volante = volante\n this.radio = radio\n }", "constructor(parametroNombre, parametroTemp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function resets the image to its original state
function reset() { Caman("#canvas", img, function () { this.revert(); }) brillo = 0; contraste = 0; saturacion = 0; exposicion = 0; ruido = 0; difuminacion = 0; resetearbotones(); }
[ "function resetImage() {\n originalImage.drawTo(canvas);\n}", "function doReset(){\n for (pixel of image.values()){\n pX = pixel.getX();\n pY = pixel.getY();\n var npx = rimage.getPixel( pX,pY);\n image.setPixel( pX, pY, npx);\n }\n image.drawTo(canvas);\n}", "function doReset() {\n image.dra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Protected > Refresh Waypoints / Refresh waypoints on image load
_refreshWaypoints(){ let lazyImgs = $(this.lazyLoadSelector); lazyImgs.on('load', () => { Waypoint.refreshAll(); }); }
[ "refreshWaypoints() {\n this.lazyImages.on('load', function(){\n Waypoint.refreshAll();\n });\n }", "refreshWaypoints() {\n /* the jquery on() method takes two arguments */\n /* the first argument is the event we want to be on the lookout for */\n /* the second arg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The following 4 crate functions show the crates, detect if you touch one & if you are currently on a crate, if you are on a crate the bars can't hurt you.
function crateShow(){ crate.x = bgLeft + 500; imageMode(CENTER); image(crateImg, crate.x, crate.y,crate.sizeX, crate.sizeY); crateTouch(crate.x); for(let j = 0; j < 5; j++){ crate.x += 1000; imageMode(CENTER); image(crateImg, crate.x, crate.y,crate.sizeX, crate.sizeY); crateTouch(c...
[ "doesClosetHaveOpenDrawers() {\n let closetDrawers=this.closet.getProducts(ProductTypeEnum.DRAWER);\n for(let closetDrawer of closetDrawers)\n if(closetDrawer.isOpen())\n return true;\n return false;\n }", "checkCheatNotes() {\n let cheatKey = true\n let cheatTouch = true\n for (let...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render currently visible view
render() { return this._visibleView === null ? null : this._visibleView.render(); }
[ "onRender()\n {\n this._showSubviews();\n }", "renderView() {\n this.view.render();\n }", "function render() {\n if (STORE.view === 'start') {\n renderStartQuiz();\n $('.intro').show();\n $('.quiz').hide();\n $('.result').hide();\n $('.quizStatus').hi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load origin and destination from user preferences and prefill the form if they're set
function setFromUserPreferences() { var origin = UserPreferences.getPreference('origin'); var destination = UserPreferences.getPreference('destination'); if (origin && origin.location) { typeaheads.origin.setValue(UserPreferences.getPreference('originText')); } else { ...
[ "function setPrefsFromUrl() {\n var params = Utils.getUrlParams();\n if (params.destination) {\n UserPreferences.setPreference('method', 'directions');\n setPrefs(DIRECTIONS_ENCODE, params);\n } else if (params.origin) {\n UserPreferences.setPreference('method',...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Restore selection wrapper, preventing plugins / UI from accessing rangy directly.
function selectionRestore() { if (savedSelection) { rangy.restoreSelection(savedSelection); savedSelection = false; } }
[ "function restoreSelection() {\n if(savedSel) {\n rangyPlgn.restoreSelection(savedSel);\n }\n //Every time the selection is restored, we'll save it again so it will be possible to restore it afterwards\n saveSelection();\n }", "restoreSelection() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `S3OriginConfigProperty`
function CfnDistribution_S3OriginConfigPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); errors.collect(cdk.propertyValidator('originAccessIdentity', cdk.validateString)(properties.originAccessIdentity)...
[ "function CfnStreamingDistribution_S3OriginPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('domainName', cdk.requiredValidator)(properties.domainName));\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
input: distance matrix and starting point output: a route solution solution[i][0] = 'city' solution[i][1] = distance from last city
function nearNeigh(matrix, start) { var visited = []; var solution = []; var current = start; //update list of visited cities with the start city visited.push(current); //update solution with start city and distance 0 solution.push([current,0]); //loop while # of visited cities is less than //total ...
[ "function findDistances(matrix, route)\r\n{\r\n\t// [i][0] - city number\r\n\t// [i][1] - distance\r\n\t//console.log(route);\r\n\tvar previous = route[0][0];\r\n\tvar current = route[0][0];\r\n\tvar newRoute = [];\r\n\tnewRoute.push([current,0]);\r\n\tfor (var i = 1; i<route.length; i++)\r\n\t{\r\n\t\tcurrent = ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create an new alpha from layer channel mask, returns channel object.
function channelMaskToAlphaChannel() { var desc = new ActionDescriptor(); var ref = new ActionReference(); ref.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('Msk ') ); desc.putReference( charIDToTypeID('null'), ref ); executeAction( charIDToTypeID('Dplc')...
[ "function alphaToChannelMask( alpha ) {\r\n\tvar desc = new ActionDescriptor();\r\n desc.putClass( charIDToTypeID( \"Nw \" ), charIDToTypeID( \"Chnl\" ) );\r\n\tvar ref = new ActionReference();\r\n ref.putEnumerated( charIDToTypeID( \"Chnl\" ), charIDToTypeID( \"Chnl\" ), charIDToTypeID( \"Msk \" ) );\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isLeft :: Either a b > Boolean . . Returns `true` if the given Either is a Left; `false` if it is a Right. . . ```javascript . > S.isLeft (S.Left ('Cannot divide by zero')) . true . . > S.isLeft (S.Right (42)) . false . ```
function isLeft(either) { return either.isLeft; }
[ "function isLeft(xe) {\n return either(internal_1.constant(true), internal_1.constant(false))(xe);\n}", "function isLeft(either) /* forall<a,b> (either : either<a,b>) -> bool */ {\n return (either._tag === 1);\n}", "isLeft() { return !this._isRight; }", "function isLeft(e) { return e[0] == 'Left'; }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return category object from global categoryList array / Requires: / catId: String representing the category to locate / Returns: / Object with the following properties: / category: Category name / category_icon: Font Awesome icon class eslintdisablenextline nounusedvars
function getCategory(catId) { /* Locate a record within the global categoryList array based on the */ /* category name */ let result = categoryList.find( (category) => category.category.toLowerCase() === catId.toLowerCase()); // If no result is found, result is false if (!result) { ...
[ "getCategory(id) {\n return this.project.categories[id];\n }", "async function getCategory(idCategory) {\n\t\tconst res = await axios.get('https://jservice.io/api/category', { params: { id: idCategory } });\n\t\t//creates array of clue objects\n\t\tconst arrClues = res.data.clues.map(clue => {\n\t\t\tre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
| Converts an array containing the entire week forecast into | an array of day forecasts. Each day forecast consists | is an array of hourly forecasts.
function processWeekForecast(raw_forecast, hour_offset) { var week_forecast = []; var date; var date_str; var processed_hour_data; var processHourForecast = function(hour_data, index, array) { date_str = hour_data.dt_txt.replace(' ', 'T'); date = new Date(date_str); processed_hour_data = conc...
[ "function calculateWeekData(data){\n\t\tvar values = [];\n\t\tvar arrayOfValues = [];\n\t\tvar weekDaydata = {Mon:{\"01\":0,\"02\":0,\"03\":0,\"04\":0,\"05\":0,\"06\":0,\"07\":0,\"08\":0,\"09\":0,\"10\":0,\"11\":0,\"12\":0,\"13\":0,\"14\":0,\"15\":0,\"16\":0,\"17\":0,\"18\":0,\"19\":0,\"20\":0,\"21\":0,\"22\":0,\"2...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Game built for python course, wanted to also try to build in javascript 0 rock 1 Spock 2 paper 3 lizard 4 scissors converts name to number
function name_to_number(name) { var number = 0; switch (name) { case "rock": return number; break; case "Spock": return number = 1; break; case "paper": return number = 2; break; case "lizard": re...
[ "function name_to_number(player_name){\n if(player_name === \"rock\") {\n player_name = 0;\n return player_name;\n } else if (player_name === \"paper\") {\n player_name = 1;\n return player_name;\n } else if (player_name === \"scissors\") {\n player_name = 2;\n return player_name;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the active tool buttons of type tag (html tags)
getActiveTags() { let tag = ""; this.bar.buttons.forEach(button => { if (button.active) { if (button.type == "tag") { tag = button.name; } } }); return tag; }
[ "function getActiveTags() {\n\treturn data.activeTags;\n}", "getActiveTbId() {\n return [$(this.toolbar.primary.el).find('.btn.active').index(),\n $(this.toolbar.secondary.el).find('.btn.active').index()];\n }", "get toolbarBtns() {\n let defaultBtns =\n 'heading,bold,italic,quo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When a game finishes, the lobby is "reinitialized"
reinitializeLobby() { this.gameInProgress = false; this.multiplayerGame = null; this.multiplayerGameInterval = null; // this.wss = wss; // TODO: Check to see if this is necessary this.gameHasEnded = false; // Send update to all clients, telling those who are connected // to this lobby to clear their own ...
[ "fullLobby() {\n\t\t//change this back to 4 when game is complete\n\t\tif (this.waitingPlayers.length == 4) {\n\t\t\tdelete lobbies[this.lobbyName];\n\t\t\tthis.start();\n\t\t}\n\t}", "endGame() {\n if (this.game) {\n this.game = null\n\n this.status = \"IN_MENU\"\n this.sendLobbyUpdateToAll()\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enable or disable the contact content in the analyserpanel
function toggleContact() { toggleAnalyserPanel('contact'); }
[ "onEnable () {\n const arePointersVisible = this.arePointersVisible\n this.showPointers()\n this.arePointersVisible = arePointersVisible\n }", "function enableButton() {\n if (\n announcement !== null &&\n announcement.nombre !== \"\" &&\n announcement.descripcion !== \"\" &&\n an...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }