query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Is the bundle valid.
static isValid(bundle) { let isValid = false; if (objectHelper_1.ObjectHelper.isType(bundle, bundle_1.Bundle) && arrayHelper_1.ArrayHelper.isTyped(bundle.transactions, transaction_1.Transaction)) { let totalSum = 0; const kerl = spongeFactory_1.SpongeFactory.instance().create...
[ "isGameFieldValid() {\n\t\tlet self = this;\n\t\tlet isValid = true;\n\t\tthis.birds.forEach(function(bird) {\n\t\t\tlet h = bird.getHeight();\n\t\t\tlet location = bird.getLocation();\n\t\t\tlet x = location.x;\n\t\t\tlet y = location.y;\n\t\t\tisValid = self.fieldSize.isWithinField(h, x, y);\n\t\t\tif (!isValid) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move the selection downwards, expanding or contracting depending on whether `isReversed`.
selectDown() { const blocks = this.getNavigableBlocks(); const selectedBlocks = blocks.filterBy('isSelected'); if (this.get('isReversed')) { if (selectedBlocks.get('length') === 1) { const idx = blocks.indexOf(selectedBlocks.get('firstObject')); const nextBlock = blocks.objectAt(idx +...
[ "selectUp() {\n const blocks = this.getNavigableBlocks();\n const selectedBlocks = blocks.filterBy('isSelected');\n\n if (this.get('isReversed')) {\n const idx = blocks.indexOf(selectedBlocks.get('firstObject'));\n if (idx === 0) return;\n blocks.objectAt(idx - 1).set('isSelected', true);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter for API client, which allows making requests.
setApiClient(apiClient) { this.apiClient = apiClient; }
[ "_initSwaggerClient() {\n LOG.debug('Initializing Client with Swagger URL: ', this._swaggerUrl);\n\n const CLIENT = new SwaggerClient({\n url: this._swaggerUrl,\n usePromise: true,\n });\n\n CLIENT.then((client) => {\n this.client = client;\n this._clientReady();\n LOG.debug('Sw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IMGUI_API bool InputTextWithHint(const char label, const char hint, char buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void user_data = NULL);
function InputTextWithHint(label, hint, buf, buf_size = buf instanceof ImStringBuffer ? buf.size : ImGuiInputTextDefaultSize, flags = 0, callback = null, user_data = null) { const _callback = callback && ((data) => callback(new ImGuiInputTextCallbackData(data, user_data))) || null; if (Array.isArray(b...
[ "function InputText(label, buf, buf_size = buf instanceof ImStringBuffer ? buf.size : ImGuiInputTextDefaultSize, flags = 0, callback = null, user_data = null) {\r\n const _callback = callback && ((data) => callback(new ImGuiInputTextCallbackData(data, user_data))) || null;\r\n if (Array.isArray(buf)) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Use this method to render separate lists for each L1 service
renderServiceLists() { const { facility: { attributes: { services }, }, } = this.props; if (!services) { return null; } return <div>{services.map(this.renderServiceBlock)}</div>; }
[ "function servicesList() {\n connection.query(\"SELECT * FROM servicesList\", function (err, results) {\n\n if (err) throw err;\n \n }\n\n )}", "getServices() {\n let services = []\n this.informationService = new Service.AccessoryInformation();\n this.informationSe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructor: Engine / Constructs a new Engine object. If width or height is given, / it will not attempt to fetch tiles outside the boundaries. / In that case 0,0 is assumed as the upperleft corner of the world, / but if no width/height is given also negative coords are valid. / / Parameters: / vp the instance to use a...
function Engine(viewport, tileFunc, w, h) { this.viewport = viewport; this.tileFunc = tileFunc; this.w = w; this.h = h; this.refreshCache = true; this.cacheEnabled = false; this.transitionDuration = 0; this.cachex = 0; this.cachey = 0; this...
[ "function makeWorldPoint(point, w, h, scale, cameraPos) {\n return {\n x: point.x - ((w * scale) / 2) + cameraPos.x,\n y: point.y - ((h * scale) / 2) + cameraPos.y\n };\n}", "function makeVisualPoint(point, w, h, scale, cameraPos) {\n return {\n x: point.x + ((w * scale) / 2) - camer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks app_key from the http request against "apps" collection. This is the first step of every write request to API.
function validateAppForWriteAPI(params) { common.db.collection('apps').findOne({'key':params.qstring.app_key}, function (err, app) { if (!app) { if (common.config.api.safe) { common.returnMessage(params, 400, 'App does not exist'); } return false; ...
[ "function checkNewApps() {\n if (!localStorage[\"apps\"]) {\n localStorage[\"apps\"] = JSON.stringify(apps);\n } else {\n for (var i = 0; i < storedApps.length; i++) { // Look through saved apps\n if (!apps[i] || storedApps[i].id != apps[i].id) { // If an app is misplaced\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the next available socket with higher weight
function getSocket() { var candidates = []; this.sockets.forEach(function(socket) { if (socket.status === C.SOCKET_STATUS_ERROR) { return; // continue the array iteration } else if (candidates.length === 0) { candidates.push(socket); } else if (socket.weight > candidates[0].weight) { ...
[ "function getSocketById(id){\n var count = openSockets.length;\n var socket = null;\n for(var i=0;i<count;i++){\n \n if(openSockets[i].id==id){\n socket = openSockets[i];\n break;\n }\n }\n return socket;\n}", "function getClientSocketNode(socket){\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
logger.enable(''); Internal Functions initPeer(el) Handle the initialization of a rtcremote target
function initPeer(el) { var propValue = el.getAttribute('rtc-peer'); var targetStream = el.getAttribute('rtc-stream'); var peerRoles = propValue ? propValue.split(reSep) : ['*']; // create a data container that we will attach to the element var data = el._rtc || (el._rtc = {}); function addStream(stream) ...
[ "addPeer() {\n\t}", "function initWebRTC() {\n SDK.NIM.use(WebRTC);\n console.log(nim);\n const Netcall = WebRTC;\n netcall = Netcall.getInstance({\n nim: nim,\n container: document.getElementById('containerLocal'),\n remoteContainer: document.getElementById('containerRemote'),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
13. Write a Javascript program which accepts the radius of the sphere as input and compute the volume. Sample Output: Input the radius of the circle: 5 The volume of the sphere is: 392.699081625.
function volumeOfCircle(inputs) { const { radius } = inputs; if (!isNaN(Number(radius)) && Number(radius) > 0) { const volume = (4/3 * Math.PI * Math.pow(radius, 3)).toFixed(8); return ` <p class="output">Input the radius of the circle: ${radius}.</p> <p class="output">Th...
[ "function calculate() {\n\t\t'use strict';\n\t\n\t\t// For storing the volume:\n\t\tvar volume;\n \n // Get a reference to the form values:\n var length = document.getElementById('length').value;\n var width = document.getElementById('width').value;\n var height = document.getElementById('height').va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/kmmabignay mar17 loadEndReservation Set Attribute for image
function loadStartReservationSetAttrImage(MainEndArr){ var loadImg = MainEndArr.split("*"); for(var i=0; i<devicesArr.length; i++){ if(loadImg.length==5){ devicesArr[i].ImageUrl = loadImg[2]; devicesArr[i].ImageDestination = loadImg[3]; devicesArr[i].TypeImage = loadImg[4]; devicesArr[i].LoadImageEnable...
[ "function saveEndReservationSetAttrImage(MainEndArr){\n\tvar saveImg = MainEndArr.split(\"*\");\n\tfor(var i=0; i<devicesArr.length; i++){\n\t\tif(saveImg.length==4){\n\t\t\tdevicesArr[i].SaveImageUrl = saveImg[1];\n\t\t\tdevicesArr[i].SaveImageDestination = saveImg[2];\n\t\t\tdevicesArr[i].SaveTypeImage = saveImg[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resolve contract code referenced by vmtrace in order to be used by asm listview. events: changed: triggered when an item is selected resolvingStep: when CodeManager resolves code/selected instruction of a new step
function CodeManager(_traceManager) { this.event = new EventManager(); this.isLoading = false; this.traceManager = _traceManager; this.codeResolver = new CodeResolver({ getCode: address => tslib_1.__awaiter(this, void 0, void 0, function* () { return new Promise((resolve, reject) => { this.tra...
[ "enterMethodInvocation_lf_primary(ctx) {\n\t}", "enterMethodReference_lf_primary(ctx) {\n\t}", "onResolve(context, reflection) {\n if (reflection.kindOf(index_1.ReflectionKind.ClassOrInterface)) {\n this.postpone(reflection);\n walk(reflection.implementedTypes, (target) => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function Build the default focal oject dropdown
function buildFocalObjectDropdown(){ for (var i=0; i < allObjects.length; i++) { if(i == 0){ selectedItem = allObjects[i][0]; } $("#focal-object-list").append( "<option>" + allObjects[i][0] + "</option>" ); } }
[ "function flavour1(){\n flavourSelect=[\"flavour1\", 100];\n }", "function buildMenu() {\n for (const item of countries) {\n let countryOption = document.createElement(\"option\");\n\n countryOption.innerHTML = item.name;\n countryOption.value = item.code;\n // Set U.S. as the default.\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::S3::Bucket.ReplicationRuleFilter` resource
function cfnBucketReplicationRuleFilterPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnBucket_ReplicationRuleFilterPropertyValidator(properties).assertSuccess(); return { And: cfnBucketReplicationRuleAndOperatorPropertyToCloudFormation(pr...
[ "function CfnBucket_ReplicationRuleFilterPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an ob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Defers removal of modal until animation completes.; removeInputBlocker is for the case when you wish to show one modal, dismiss/remove it, and show another immediately. We wouldn't want the input blocker to be removed then; just stay as is.
removeFromSuperview(removeInputBlocker = true) { this.userInteractionEnabled = false; if (removeInputBlocker) { this.removeInputBlocker(); } this.addAnimation(new PopOut(this)) .once('complete', () => { super.removeFromSuperview(); })...
[ "function hideDialogueUI() {\n\n\t\tif ( isInAnim ) return\n\n\t\tisInAnim = true ;\n\n\t\t// Hide joystick div\n\n\t\tdocument.getElementById('joystick-container').style.display = 'inherit' ;\n\t\tif ( input.params.isTouchScreen ) {\n\t\t\tdocument.getElementById('action-button').style.display = 'inherit' ;\n\t\t}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to hide a dialog with product substitutes
function hide_product_substitutes() { //Hide the substitute modal $("#product_view2").html(""); $('.overlay').hide(); $('#product_picker2').hide(); }
[ "function hide_add_product()\n{\n\t//hide the modal box \n\t$('.overlay').hide(); \n\t$('#product_picker').hide(); \n\tonBackKeyDown();\t\n\t//Redraw the screen \n\tredraw_order_list();\n}", "function hideCreateDialog() {\n if (document.getElementById('editID').value != '-1') {\n $('#rfelement' + docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detaches the component instance from its [`IdentityMap`](
detach() { if (this.hasPrimaryIdentifierAttribute()) { const identityMap = this.constructor.getIdentityMap(); identityMap.removeComponent(this); } Object.defineProperty(this, '__isAttached', { value: false, configurable: true }); return this; }
[ "detach() {\n const parentNode = this._container.parentNode;\n\n if (parentNode) {\n parentNode.removeChild(this._container);\n\n this._eventBus.fire('propertiesPanel.detach');\n }\n }", "detach() {\n this.surface = null;\n this.dom = null;\n }", "destroy() {\n this.map.off('draggi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
| | Remove item in an array. | | | var a = [a,b,c,d,e] | removeArray(a, index)
function removeArray(array, index) { array.splice(index,1) }
[ "removeItem (array, item, f) {\n const i = this.indexOf(array, item, f)\n if (i >= 0) array.splice(i, 1)\n }", "function arrayRemove(arr, value) { return arr.filter(function (ele) { return ele != value; }); }", "function remove(array, element) {\n const index = array.indexOf(element);\n var item = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if we need to compute the display states of the cues. This could be the case if a cue's state has been changed since the last computation or if it has not been computed yet.
function shouldCompute(cues){for(var i=0;i<cues.length;i++){if(cues[i].hasBeenReset||!cues[i].displayState){return true;}}return false;}// We don't need to recompute the cues' display states. Just reuse them.
[ "function privateCheckSongVisualization(){\n\t\tvar changed = false;\n\n\t\t/*\n\t\t\tChecks to see if the song actually has a specific visualization\n\t\t\tdefined.\n\t\t*/\n\t\tif( config.active_metadata.visualization ){\n\t\t\t\n\t\t\t/*\n\t\t\t\tIf the visualization is different and there is an active\n\t\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the contents of an entry
'entries.get' (entryId) { console.log('get text for entry'); // If no user is logged in, throw an error if (!Meteor.user()) { console.log("No user is logged in!"); throw Error("User is not logged in"); } // Locate the entry let entry = Jo...
[ "getEntries(t, e) {\n return this.getAllFromCache(t, e);\n }", "function readEntry(entry, done) {\n if (options.verbose) {\n console.log(\"Found \" + entry.path);\n }\n \n var ws = new MemoryStream();\n ws.on('finish', function() {\n var xml = ws.toString();\n xml2js(xml, functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shim requestAnimationFrame to ensure it is available to all browsers
shimRequestAnimationFrame() { /* Paul Irish rAF.js: https://gist.github.com/paulirish/1579671 */ var lastTime = 0; var vendors = ['ms', 'moz', 'webkit', 'o']; for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x] + '...
[ "function animate() {\n requestAnimationFrame(animate);\n // Insert animation frame to update here.\n }", "function update()\r\n{\r\n rebind.update()\r\n requestAnimationFrame(update)\r\n}", "function debouncedAnimationFrame(cb) {\n return buildScheduler(function (cb) { return requestA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setTreeMapLegendData gets legend info from chart Data
function setTreeMapLegendData(data) { var legendArray = []; for (var i = 0; i < data.chartData.children.length; i++) { if (legendArray.indexOf(data.chartData.children[i][data.dataTable.series]) == -1) { legendArray.push((data.chartData.children[i][data.dataTable.series])); } } ...
[ "function update_legend(legendData) {\n\n mymap.removeControl(legend);\n\n if(legendData) {\n currentLegendData = new Array();\n //Create an array that holds the bin intervals\n minValue = parseInt(legendData.min);\n interval = parseInt(legendData.interval);\n for(var i = 0; i <= 7; i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Take input and convert to unsigned uint64 bigendian bytes
function toBigendianUint64BytesUnsigned(i, bufferResponse = false) { let input = i if (!Number.isInteger(input)) { input = parseInt(input, 10) } const byteArray = [0, 0, 0, 0, 0, 0, 0, 0] for (let index = 0; index < byteArray.length; index += 1) { const byte = input & 0xFF // eslint-disable-line no-...
[ "function UInt32toUInt8(value) {\n console.log(value);\n t = [\n value >> 24,\n (value << 8) >> 24,\n (value << 16) >> 24,\n (value << 24) >> 24\n ];\n console.log(t);\n return t;\n}", "function read64() {\n var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64);\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display the panel to display game stats
function displayrpsStatsPanel() {}
[ "function displayGameScreen()\n{\n\t\n\tdisplayResourceElement();\n\t\t\t\n\tdisplayInfoElement();\n\t\n\tdisplayMapElement();\n\t\n\tjoinGame();\n\t\n\tif(player.onTurn == true)\n\t{\n\t\tdisplayEndTurnElement(\"salmon\");\n\t\t\n\t\tdisplayTurnCounterElement(\"lightGreen\");\n\t}\n\telse\n\t{\n\t\tdisplayEndTurnE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a functioning graph type button to the nav bar
function addGraphType(graphType, title, toolbar) { let dropdown = document.getElementById('graphdropdown') let a = document.createElement('a') a.setAttribute('href', '#') let t = document.createTextNode(title) dropdown.appendChild(a) a.appendChild(t) a.addEventLis...
[ "function addLoanMenuButton(loan) {\n const loanNavButton = `\n <button class=\"btn btn-primary loan-button\" onclick=\"displayGraph('${\n loan.name\n }')\">${loan.name.replace(\"_\", \" \")}</button>\n `;\n const $loanNavMenu = $(\"#loanNavMenu\");\n $loanNavMenu.append(loanNavButton);\n}", "function fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function moves workToMove to the top of the list of recdent work that can be edited, which will be reflected on the welcome page.
moveWorkToTop(workToMove) { // REMOVE THE WORK IF IT EXISTS this.removeWork(workToMove); // AND THEN ADD IT TO THE TOP OF THE STACK this.prependWork(workToMove); }
[ "function moveContinueWatchingToTop() {\n\t\tvar $continueWatching = getSectionByType('continueWatching');\n\t\t\n\t\tgetContainers().$mainView.prepend($continueWatching);\n\t}", "function moveMyListToTop() {\n\t\tvar $myList = getSectionByType('queue');\n\t\t\n\t\tgetContainers().$mainView.prepend($myList);\n\t}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The tree of nodes associated with the current `LView`. The nodes have been normalized into a tree structure with relevant details pulled out for readability.
get nodes() { const lView = this._raw_lView; const tNode = lView[TVIEW].firstChild; return toDebugNodes(tNode, lView); }
[ "get tree() {\n return this.buffer ? null : this._tree._tree\n }", "tree(tree) {\n if (tree) {\n this._tree = tree;\n }\n return this._tree;\n }", "buildTree() {\n this.clear();\n\n const columnsCount = this.#sourceSettings.getColumnsCount();\n let columnIndex = 0;\n\n whi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Input: a string strng an array of strings arr Output of function contain_all_rots(strng, arr) (or containAllRots or containallrots): a boolean true if all rotations of strng are included in arr (C returns 1) false otherwise (C returns 0) Examples: contain_all_rots( "bsjq", ["bsjq", "qbsj", "sjqb", "twZNsslC", "jqbs"]) ...
function containAllRots(strng, arr) { let copyStr = strng let letter = "" let restOfStr = "" let final = "" for (let i = 0; i < strng.length; i++) { if (arr.includes(copyStr)) { letter = copyStr[0] restOfStr = copyStr.substring(1) copyStr = restOfStr + letter } else { return ...
[ "function includesOneOf(str, arr) {\n for (let i = 0; i < arr.length; i++) {\n if (str.includes(arr[i])) return true;\n }\n return false;\n}", "function containsAny(str, arr){\n\tif(str == null){\n\t\treturn false;\n\t}\n\treturn arr.map(function(elem){\n\t\treturn str.toLowerCase().indexOf(elem.toLowerCase...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render pup to dog bar function
function renderPup(pup){ let divTag = document.getElementById("dog-bar") divTag.innerHTML += `<span data-id=${pup.id}>${pup.name}</span>` }
[ "function loadAllPups(pup) {\n const dogBar = document.getElementById('dog-bar')\n const dogNameButton = document.createElement('span')\n dogNameButton.innerText = pup.name\n dogNameButton.dataset.id = pup.id\n dogNameButton.style.cursor = \"pointer\"\n dogBar.appendChild(dogNameButton)\n\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handleRawImages() The callback function used to render the Raw Images section
function handleRawImages(o) { if (o.success == true) { if (!checkForTimeout(o)) { $('#raw_images').html(); $.jGrowl("Loading unprocessed images..."); $('#raw_images').html(o.rows); makeCroppable(); } } else { $.jGrowl(o.errors, {sticky: true}); } }
[ "function handleImage(request, response, next) {\n\t\tswitch (request.params.imageMode) {\n\t\t\tcase 'raw':\n\t\t\t\tproxyImage(request, response, next);\n\t\t\t\tbreak;\n\t\t\tcase 'debug':\n\t\t\t\tdebug(request, response, next);\n\t\t\t\tbreak;\n\t\t\tcase 'placeholder':\n\t\t\t\tplaceholder(request, response, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load the sensor home content
function loadContent(content) { $.get("/Main/LoadContent", { name: content },function (data) { //load the html comming back from the get request into the #main div $("#main").html(data); //Setup all the charting buttons for sensors (ie not == to home) if(content !== "Home") ...
[ "function loadOnScreen(){\n\tHeadingArray = getOnScreenHeadingArray();\n URLArray = getOnScreenURLArray();\n\t\n\tfor(var i = 0; i<HeadingArray.length; i++)\n\t getFeed(HeadingArray[i],URLArray[i]);\n}", "function homeContent() {\n\t$('#main-nav li').removeClass('current');\n\t$('#home-btn').parent().addCla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TAU returns the universal circle constant
function TAU() { return τ; }
[ "function calcSunRtAscension(t) {\n var e = calcObliquityCorrection(t);\n var lambda = calcSunApparentLong(t);\n var tananum = (Math.cos(degToRad(e)) * Math.sin(degToRad(lambda)));\n var tanadenom = (Math.cos(degToRad(lambda)));\n var alpha = radToDeg(Math.atan2(tananum, tanadenom));\n return alph...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
const WEB3STORAGE_TOKEN = require('./WEB3STORAGE_TOKEN')
function getAccessToken() { // If you're just testing, you can paste in a token // and uncomment the following line: // return 'paste-your-token-here' // In a real app, it's better to read an access token from an // environement variable or other configuration that's kept outside of // your code base. Fo...
[ "function getToken() {\n return localStorage.getItem('token');\n}", "function getToken() {\n\treturn localStorage.getItem('token')\n}", "createJWT () {\n const token = {\n iat: parseInt(Date.now() / 1000),\n exp: parseInt(Date.now() / 1000) + 20 * 60, // 20 minutes\n aud: this.mqtt.project\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public Methods Initializes the doco settings.
function initializeDocoSettings() { getDocoSettings(); }
[ "init(){\n this.dxcFolder = _path_.join( this.path, '.dxc'); \n this.binFolder = _path_.join( this.dxcFolder, 'bin');\n this.apiFolder = _path_.join( this.dxcFolder, 'api');\n this.cfgFolder = _path_.join( this.dxcFolder, 'cfg');\n this.devFolder = _path_.join( this.dxcFolder, 'de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compares answer given and valid color increments correct answers if needed resets words
function checkAnswerAndReset(colorChosen) { if (colorChosen === validColor) { setCorrectAnswers(correctAnswers + 1); } startNewGame(false); }
[ "function solveCurrentExamAnswer(containerId, currentAnswer, rightAnswer) {\n if (currentAnswer === rightAnswer) {\n $(\"#\" + containerId + \"Label\" + (currentAnswer)).css(\"color\", \"lightgreen\");\n } else {\n $(\"#\" + containerId + \"Label\" + (currentAnswer)).css(\"color\", \"red\");\n $(\"#\" + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load google translate(GT) APIs
function loadGoogleTranslate( win, rel ) { // load OLAS GT API with appropriate relative link if( typeof( rel ) == 'undefined' ) rel = ( win.name == 'myFrame' ? '../' : '' ) + '../../'; addJs( rel + "SCOFunctions/googletranslate.js?v=" + getPlayerWindow().GOOGLE_TRANSLATE_VERSION, win.document ); }
[ "function googleTranslateElementInit(){\n new google.translate.TranslateElement({pageLanguage:'en'},'google_translate_element');\n}", "function loadGmailApi() {\n gapi.client.load('gmail', 'v1', listLabels);\n }", "function loadAPIs(){\n\t\t\n\t\t//load youtube api\n\t\tif(g_temp.isYoutubePresent)\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
basic FS setup, for config data see setConfigData(), for voices see setVoiceData()
function setUpVFS() { var optionFiles = { 'croak': 'language variant\nname croak\ngender male 70\npitch 85 117\nflutter 20\nformant 0 100 80 110\n', 'f1': 'language variant\nname female1\ngender female 70\npitch 140 200\nflutter 8\nroughness 4\nformant 0 115 80 150\nformant 1 120 80 180\nformant 2 100 70 150 150\n...
[ "setUp(options){\n this.setUpDeviceListeners(undefined, this.onOSCMessage);\n this.setUpDevice({ osc: options });\n }", "init(){\n this.dxcFolder = _path_.join( this.path, '.dxc'); \n this.binFolder = _path_.join( this.dxcFolder, 'bin');\n this.apiFolder = _path_.join( this.d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset the parsley form or fields.
reset() { if (!isNone(fields)) { $(fields).each(function() { // reset parsley field. $(this).parsley().reset(); if ($(this).is('form')) { $('form .form-control-feedback').remove(); } }); } }
[ "function clear_form(){\n $(form_fields.all).val('');\n }", "function resetForm() {\n setInputs(initial);\n }", "destroy() {\n\t\t\t\t// destroy all parsley fields.\n\t\t\t\tif (!isNone(fields)) {\n\t\t\t\t\t$(fields).each(function() {\n\t\t\t\t\t\t// remove parsley on field.\n\t\t\t\t\t\t$(th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepare the players for ng repeat and save the game config to local storage
initPlayers() { for( var i = 0; i < this.gameConfig.numPlayers; i++ ) { this.gameConfig.players.push({ name : '', imgPath : 'img/ninja-odd.png', killed : false, nameToKill: '', word : '' }) } this.saveGameConfig(); }
[ "setNumPlayers( numPlayers ) {\n this.gameConfig.numPlayers = numPlayers;\n this.saveGameConfig();\n\n }", "configPlayersTasks() {\n\n let numPlayers = this.gameConfig.numPlayers - 1;\n\n this.gameConfig.players = _.shuffle(this.gameConfig.players);\n\n for( let i = 0; i <= numPlayers; i++ ) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public function `map`. Maps each value from the `data` to the corresponding predicate and returns the result object. Supports nested objects. If the `data` is not nested and the same function is to be applied across all of it, a single predicate function may be passed in.
function map (data, predicates) { assert.object(data); if (isFunction(predicates)) { return mapSimple(data, predicates); } assert.object(predicates); return mapComplex(data, predicates); }
[ "_mapData (root, data, entities) {\n if (!entities) entities = this.privateSchema\n\n Object.keys(entities).map(function (objectKey, index) {\n let entity = entities[objectKey]\n let item = data[entities[objectKey]._privateName]\n\n if (!this._isUndefined(entity._decorator)) {\n let deco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a tooltip and appends it to a parent
function createTooltip(title, tiptext, parent) { let box = create("td"); let tooltip = create("a"); append(box, tooltip); tooltip.classList.add("tooltip"); appendText(tooltip, title); let tooltipText = create("span"); tooltipText.classList.add("tooltiptext"); appendText(tooltipText, tiptext); append...
[ "function create_tooltips() {\n $(\"#additional_volunteers .might-overflow\").tooltip({ placement: \"left\"});\n $(\"#additional_volunteers .volunteer_name\").hover(function() {\n $(this).children(\".help-edit\").removeClass(\"hidden\");\n }, function() {\n $(this).children(\".help-edit\").addCla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show Google Pay payment sheet when Google Pay payment button is clicked
function onGooglePaymentButtonClicked() { const paymentDataRequest = getGooglePaymentDataRequest(); paymentDataRequest.transactionInfo = getGoogleTransactionInfo(); const paymentsClient = getGooglePaymentsClient(); paymentsClient.loadPaymentData(paymentDataRequest) .then(function(paymentData) { /...
[ "function onGooglePaymentButtonClicked() {\n pushTrackingEvents(createGooglePayEvent(\"GooglePayChosen\"));\n\n var paymentDataRequest = getGooglePaymentDataRequest();\n paymentDataRequest.transactionInfo = getGoogleTransactionInfo();\n\n var paymentsClient = getGooglePaymentsClient();\n paymentsClie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::IAM::ServiceLinkedRole` resource
function cfnServiceLinkedRolePropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnServiceLinkedRolePropsValidator(properties).assertSuccess(); return { AWSServiceName: cdk.stringToCloudFormation(properties.awsServiceName), CustomSuffix: c...
[ "role() {\n return this.props.projectData.role \n .map(role => \n <span className=\"tag is-size-5 is-white has-text-weight-bold\">{role}</span>\n );\n }", "get roleId() {\n return this.getStringAttribute('role_id');\n }", "function displayComponent() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Output: None. Input: array of courses and selected department code. Side effects: None. Notes: Filters through the courses for the chosen department. Creates a relationship matrix (used for the bundle visualization) and begins the visualization.
function split_buildings(courses, dept) { var buildings = []; selected_courses = []; if (dept != "Resize"){ if (selected_departments[0] == "All" || dept == "All"){ selected_departments = []; } if (dept != ""){ selected_departments.push(dept); } }...
[ "devideCoursesInSemesters(courses) {\n this.devidedCourses = {}; // Define empty object\n\n courses.map((course) => { // For each course\n // Have we seen a course in this semester before?\n if (this.devidedCourses[course.semester] == undefined)\n this.devidedCours...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle click on content item with children
function handleClickOnContentItemWithChildren(contentItem) { // Show loader Canvas.WindowManager.showLoader(true); // Get children Canvas.ContentItemService.findContentItemsByParentContent(contentItem); }
[ "function onContentItemClick() {\n var elementId = $(this).attr(\"data-id\");\n showFolderOrFileContentById(elementId);\n }", "function handleClickOnTimeline() {\r\n // Find clicked item\r\n var clickedContentItem = getContentItemOnMousePosition();\r\n\r\n // If n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether an item is in an array. We don't use Array.prototype.indexOf so we don't clobber any existing polyfills. This is a really simple alternative.
function inArray( arr, item ) { for ( var i = 0, len = arr.length; i < len; i++ ) { if ( arr[ i ] === item ) { return true; } } return false; }
[ "function includes(item, anArray) {\r\n\r\n for (let i = 0; i < anArray.length; i++) {\r\n if (anArray[i] == item) {\r\n return true;\r\n } \r\n }\r\n return false;\r\n}", "function in_array(val, array) {\n\t\tfor(var i = 0, l = array.length; i < l; i++) {\n\t\t\tif(array[i] == v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Integer GetNumElements(String prList) Returns number of elements in a list
function GetNumElements(prList) { var bLoop = true; var nElements = 0; var nIndexStr = -1; //Loop over the passed list. If the character is a comma, increment the number of elements. if(prList != "") { while(bLoop){ nIndexStr = prList.indexOf(",", nIndexStr + 1); if(nIndexStr != -1 && nIndexStr...
[ "function numStrings(list) {\n var count = 0;\n for(i = 0; i < list.length; i++) {\n\t\t//loops through each string, counting amount. \n \tif( typeof list[i] == \"string\") {\n \tcount++;\n \t}\n } \n \t\n return count;\n\n}", "function unit_list_size(unit_list)\n{\n return unit_list.length;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : loadConfigData AUTHOR : Clarice A. Salanda DATE : March 11, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : PARAMETERS :
function loadConfigData(data){ var mydata = data; if(globalInfoType == "XML"){ var parser = new DOMParser(); var xmlDoc = parser.parseFromString( mydata , "text/xml" ); var row = xmlDoc.getElementsByTagName('MAINCONFIG'); var uptable = xmlDoc.getElementsByTagName('DEVICE'); var lowtable = xmlDoc.getElements...
[ "function loadConfig() {\n\tconfig_file = fs.readFileSync(\"./config.json\");\n\tconfig = JSON.parse(config_file);\n}", "function wrs_loadConfiguration() {\r\n if (typeof _wrs_conf_path == 'undefined') {\r\n _wrs_conf_path = wrs_getCorePath();\r\n }\r\n\r\n var httpRequest = typeof XMLHttpRequest ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mimics the render() method in React that happens after the componentWillMount lifehook. "Renders the user data" using the logger function. And lets the DOM know that the component mounted.
render() { this.mounted = true this.logger('display') this.componentDidMount() }
[ "componentDidMount() {\n if(this.mounted === true) {\n this.simulateUserActions()\n }\n }", "onRender() {\n const users = this.users.length === 1 ? this.users : this.users.filter(user => !user.isMine);\n // Clear the innerHTML if we have rendered something before\n if (this.users.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the add to bag button selector
get addToBag() { return 'button#AddToBag' }
[ "button(x, y, content, opts){\n\n let button = new Button(x, y, content, opts);\n this.layer.buttons.push(button);\n return button;\n\n }", "function addButtons() {\n target.css({\n 'border-width': '5px'\n });\n //console.log(\"INSIDE addButtons, thisID: \" + thisId + \" and...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the scheduler to the supplied, approved sceduler.
function krnSetScheduler(newScheduler) { if(_Scheduler.processEnqueued) { _StdIn.putText("Please wait for executing processes to complete!"); } else if(_Scheduler.name === newScheduler) { _StdIn.putText("Scheduler is already in use!"); } else if(newScheduler === "fcfs") {...
[ "function updateSchedule(axios$$1, token, payload) {\n return restAuthPut(axios$$1, 'schedules/' + token, payload);\n }", "playScheduler() {\n this.deselect();\n this.scheduler.play();\n }", "function requestSchedule() {\n\tvar dataForm;\n\tdataForm = \"algorithmSettingForm\";\n\trequestScheduleAlgor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disable buttons (as if power is off)
function disableButtons() { let buttons = document.getElementsByTagName("button"); for (let i = 0; i < buttons.length; i++) { if (buttons[i].id !== "power-button") buttons[i].disabled = true; } }
[ "function disableAllButtons() {\n disableOrEnableButtons(false);\n }", "function disableControls() {\n $(\"button.play\").attr('disabled', true);\n $(\"select\").attr('disabled', true);\n $(\"button.stop\").attr('disabled', false);\n }", "function DisableCCButton(){\n\n\t EnCC.Dis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
scan to the previous interval.
function scanprev() { setTime(startdateinmilliseconds - diffmilliseconds, enddateinmilliseconds - diffmilliseconds); }
[ "function scanhalfprev() {\n setTime(startdateinmilliseconds - diffmilliseconds/2, enddateinmilliseconds - diffmilliseconds/2);\n}", "function scanUp() {\n fmRadio.scan(\n upconvert(band.getMin()),\n upconvert(band.getMax()),\n band.getStep());\n }", "function scanDown() {\n fmRad...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get PID values from quadcopter on connect
function readPidData() { return txChar.readValue() .then(originalPid => { // Convert from dataView to Uint8Array and save original PID data for possible reset originalPidData = new Uint8Array(originalPid.buffer, 0, 20); txCharVal = originalPidData; console.lo...
[ "controlViaPid() {\n console.log(\"PID\")\n const { pb, ti, td } = this.pidConsts;\n const KP = 1 / (pb / 100); // proportionalBand\n const KI = KP / ti; // integrativeTime\n const KD = KP * td; // derivativeTime\n const H = 0.1;\n\n const pidController = new Controller(KP, KI, KD, H);\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the simulated elections results
function getElectionsResults() { return electionsResults; } // getElectionsResults
[ "function getNumVotersPerElection() {\n return numVotersPerElection;\n } // getNumVoters", "function election(votes) {\n for(var student in votes) { \n var votesCast = votes[student];\n \n var counter = 1;\n for(var officer in votesCast) { //targeting the officer position and voted name\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load and execute a script with the file name as the only argument.
function exec_script(script_name) { $.getScript(script_name, function(){ alert(script_name + " loaded and executed."); }); }
[ "function playFile(fileName){\n // Starts the pythonscript with the --File= option\n args = [\"--File=\" + fileName];\n runPythonScript(args);\n}", "function loadUserWorkerScript() {\n\t\t// We've passed path of target worker script from master process to this worker proces in arguments.\n\t\tvar userScr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OffendingLine "subclass" for creating OffendingLine objects which contains the offense information needed to read and parse later. These objects are later stored in an OffendingFile object as a collection. If a parameter is undefined, the class will give its variables a default value. Extends: Collection
function OffendingLine ( line, line_num ) { Collection.call( this ); this._line = line || 'No line defined.'; this._line_num = line_num || -1; this.getLine = function () { return this._line; }; this.getLineNumber = function () { return this._line_num; }; }
[ "function OffendingFile ( path ) {\n Collection.call( this );\n this._path = path || 'No path defined.';\n \n this.getTotalOffenses = function () {\n var total = 0;\n for (var e in this._collection) {\n total += this._collection[e].getLength();\n }\n return total;\n };\n this.getFilePath = fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to Resize the selected image to MobileNet Input Size
function processImage(image_id){ // Code to Resize the selected image to MobileNet Input Size const img = new Image(); img.crossOrigin = "anonymous"; img.src = document.getElementById(image_id).src; img.width = 224; img.height = 224; return img; }
[ "function mobileImageResize() {\n\t\t$mirage('.imageStyle').each(function(){\n\t\t\tif( window.orientation == 0 ){\n\t\t\t\tif( ($mirage(this).width() > 280) ) {\n\t\t\t\t\t$mirage(this).width(280);\n\t\t\t\t}\n\t\t\t} else if ( (window.orientation == 90) || (window.orientation == -90) ) {\n\t\t\t\tif( ($mirage(thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find a row by entity type and id
function findByTypeAndId(entity, id, callback){ if( Database[entity] ){ Database[entity].find(id).success(callback); } else{ callback({err: "No entity matching the name '" + entity + "' was found."}); } }
[ "findRecord(store, type, id, record) {\n this.logToConsole(OP_FIND_RECORD, [store, type, id, record]);\n return this.asyncRequest(OP_FIND_RECORD, type.modelName, id);\n }", "find(type, group, instance) {\n\t\tif (Array.isArray(type)) {\n\t\t\t[type, group, instance] = type;\n\t\t} else if (typeof type === ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsertrace_file_clause.
visitTrace_file_clause(ctx) { return this.visitChildren(ctx); }
[ "visitDatabase_file_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitLog_file_group(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAdd_logfile_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitDrop_logfile_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
extract the text information form the html, in the return, it will return a list containing each text chunk and its coordinate information.
function extractTextInfo(pageContent) { text_block = pageContent; text_info = []; for (var i = 0; i < text_block.length; i++) { //getting the text coordinate information var res = text_block[i].split(";"); var coordinate_split_left = res[3].split(":"); var coordinate_split_top = res[4].split(":"); var...
[ "convertHtml(htmlText, lnMode) {\n const docDef = [];\n this.lineNumberingMode = lnMode || LineNumberingMode.None;\n // Cleanup of dirty html would happen here\n // Create a HTML DOM tree out of html string\n const parser = new DOMParser();\n const parsedHtml = parser.parse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Progression 3 Filter players that debuted in ___ year
function filterByDebut (year) { let arr = [] for (const i of players) { if (i.debut == year) { arr.push(i) } } return arr }
[ "function filterYear(data) {\n let filteredData = data.filter(function(d, i) {\n return data[i].year === \"1980\";\n });\n data = filteredData;\n return data;\n }", "function filterByNoOfAwardsxTeamxAge(awardwontimes, teamname, ageofplayer) {\n let list = [];\n players....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The number of cells in a given ring in a radial layout
function getNumCellsinRing(ringNumber) { if(ringNumber === 0) { return 1; } else if(ringNumber === 1) { return 6; } return getNumCellsinRing(ringNumber - 1) + 6; }
[ "function getTotalCellsInRadialLayout(numRings) {\n let total = 0;\n let currRing = 0;\n do {\n total += getNumCellsinRing(currRing);\n currRing++;\n } while(currRing < numRings);\n return total;\n }", "static countCells(prop) {\n let n = prop.range;\n n = (n & 0x15555)+(n>>1 & 0x1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a binary tree, how do you get its mirrored tree?
function mirror(node) { if(!node){ return ; } let root = node; let temp = root.left; root.left = root.right; root.right = temp; mirror(node.left); mirror(node.right); }
[ "function reconstruct(preorder, inorder) {\n const preorderLength = preorder.length;\n const inorderLength = inorder.length;\n if (preorderLength === 0 && inorderLength === 0) {\n return null;\n }\n\n if (preorderLength === 1 && inorderLength === 1) {\n return new Node(preorder[0]);\n }\n\n const root ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===================== DEFINITION OF CLASSES ===================== Purpose: Contains a list of Riddles and their answers
function Riddles() { //Private member variables var riddle = []; var answer = []; //Sets content and its correct answer this.Fill = function(content, solution) { //Answer and riddle should be on the same position when later getting both riddle.push(content); answer.push(solution); } //Get content...
[ "function getRightAnswers() {\n}", "function showRiddle()\n{\n\tvar riddle = document.getElementById('riddle');\n\t\n\t//Between 0 and 9\n\tvar diced = Dice.start();\n\t\n\triddle.innerHTML = MyRiddles.GetInfo(diced, \"riddle\");\n}", "function AddableExamResultSet(){\n this.examNumbers = [];\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Expand the next token only once (if possible), and return the resulting top token on the stack (without removing anything from the stack). Similar in behavior to TeX's `\expandafter\futurelet`. Equivalent to expandOnce() followed by future().
expandAfterFuture() { this.expandOnce(); return this.future(); }
[ "expandMacro(name) {\n if (!this.macros.get(name)) {\n return undefined;\n }\n\n const output = [];\n const oldStackLength = this.stack.length;\n this.pushToken(new Token(name));\n\n while (this.stack.length > oldStackLength) {\n const expanded = this.expa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the keyword for the selected value in the hkTypeForm UI element
function getHkTypeFromForm() { return document.getElementById("hkTypeForm").value; }
[ "_getSelectionItemType()\n {\n var keys = this.getSelectedItemKeys();\n var itemType = null;\n var urls = [];\n for (var index in keys)\n {\n var item = this.getSelectedItem(keys[index]);\n if (itemType === null)\n {\n itemType = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
onEditPagePasswordType is invoked when password type selection is changed.
function onEditPagePasswordType(page, typeSelect) { let disablePasswords = true; if (typeSelect.value == "") { disablePasswords = false; } // Toggle enabled/disabled flag on the password fields. var pass = page.getElementsByClassName("edit-page-password")[0]; pass.disabled = disablePasswords; var re...
[ "function updatePwLength() {\n let targetType = event.target.type;\n pwLength = event.target.value;\n\n if (targetType == \"range\") {\n document.getElementById(\"pw-length-textbox\").value = pwLength;\n } else {\n document.getElementById(\"pw-length-range\").value = pwLength;\n }\n\n displayPasswordToT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to convert an object map to a list
function mapToList(map, id_name) { var list = []; for (var key of Object.keys(map)) { var obj = {}; obj[id_name] = key; for (var field of Object.keys(map[key])) { obj[field] = map[key][field]; } list.push(obj); } return list; }
[ "function mapToJson(map) {\n let arr = [];\n var loopTrough = (value, key, map) => {\n arr.push([key, value]);\n }\n listing.forEach(loopTrough);\n return JSON.stringify(arr);\n}", "function convertMapsToObjects(arg) {\n if (arg instanceof Map) arg = Object.fromEntries(arg);\n\n if (typeof...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setExchange sets the exchange for which the fee is being paid.
setExchange (xc) { this.xc = xc }
[ "UPDATE_EXCHANGE_TARGET (_state, _exchangeTarget) {\n _state.exchangeTarget = _exchangeTarget\n }", "UPDATE_EXCHANGE_SOURCE (_state, _exchangeSource) {\n _state.exchangeSource = _exchangeSource\n }", "triggerOrder(order) {\n if (!(order instanceof ExchangeOrder)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the class name is the same as, or inherits from the anotherClassName class. Throws an exception if fullClassName is not registered.
function inheritsFrom (fullClassName, anotherClassName) { var def = getDefinition(fullClassName); if ( !def ) { _scriptFileMissing(fullClassName); } return def.inst.instanceOf(anotherClassName); }
[ "function hasSomeParentTheClass(element, classname) {\n element = element.target;\n if (element.className.split(' ').indexOf(classname)>=0) return true;\n return element.parentNode && hasSomeParentTheClass(element.parentNode, classname);\n}", "function isMember(element, classname)\r\n\t{\r\n\t\tvar class...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the type URL for this JPF, reading the header (URL and metadata) if necessary.
get typeURL() { return this._content[0]; }
[ "function getUrlType() {\n let url = document.location.href\n\n if(url.match(/http(s)?:\\/\\/open\\.spotify\\.com\\/playlist\\/.+/) != null)\n return 'playlist'\n\n if(url.match(/http(s)?:\\/\\/open\\.spotify\\.com\\/album\\/.+/) != null)\n return 'album'\n\n if(url.match(/http(s)?:\\/\\/open\\.spotify\\....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
true if currentBounds contains targetBounds, false otherwise
function boundsContain(currentBounds, targetBounds) { if ( targetBounds[0] >= currentBounds[0] && targetBounds[2] <= currentBounds[2] && targetBounds[1] >= currentBounds[1] && targetBounds[3] <= currentBounds[3] ) { return true; } return false; }
[ "includes(range, target) {\n if (Range.isRange(target)) {\n if (Range.includes(range, target.anchor) || Range.includes(range, target.focus)) {\n return true;\n }\n\n var [rs, re] = Range.edges(range);\n var [ts, te] = Range.edges(target);\n return Point.isBefore(rs, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tell if this is a blocker frame
is_blocker() { return false; }
[ "is_blocker() {\n return true;\n }", "tracking_block(type) { return this.blocks[type] !== undefined; }", "function adBlockNotDetected() {\n }", "has_block(type) { return (this.tracking_block(type)) ? this.blocks[type] : false; }", "function isDamagedFrame(frame) {\n // In real life, re-gen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call to send a message array to a bot. If this method returns true, `sendMessage` won't be called
sendMessages () { return false }
[ "static async bulkSendMessages ([conversation, messages, opts]) {\n const channelType = conversation.channel.type\n\n for (const message of messages) {\n let err = null\n\n // Try 3 times to send the message\n for (let i = 0; i < 3; i++) {\n try {\n await invoke(channelType, 'se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fibonacci Heap implementation, used interally for Matrix math.
function FibonacciHeap() { if (!(this instanceof FibonacciHeap)) throw new SyntaxError('Constructor must be called with the new operator'); // initialize fields this._minimum = null; this._size = 0; }
[ "function fibb() {\n var list = [0,1];\n for( i = 2; i < 100; i++) {\n\tlist[i] = list[i-1] + list[i-2];\n }\n return list;\n}", "function genfib() {\n let arr = [];\n\n return function fib() {\n if (arr.length === 0) {\n arr.push(0);\n } else if (arr.length === 1) {\n arr.push(1);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Automatically generated. Tests for the `Eq` constructor of the `:order` type.
function eq_ques_(order0) /* (order : order) -> bool */ { return (order0 === 2); }
[ "makeEq(field, target) {\n var match;\n if ( typeof target === 'string' ) {\n match = (v) => {\n return ( v === target);\n };\n } else {\n match = (v) => {\n return v.match(target);\n };\n }\n return ( item ) => {\n if( typeof item === 'string') {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
to save the tasks into the file
function storeTasks(file,tasks){ fs.write(file,JSON.stringify(tasks),(err)=>{ if (err) throw err console.log("Saved")}) }
[ "async function buildArray(task) {\n let tasksList = await checkTasksList();\n tasksList.tasks.push(task);\n fs.writeFile(todoPath, JSON.stringify(tasksList));\n console.log('Task engadida');\n}", "save() {\n\n let files = new Visitor(\n this.fullName,\n this.age,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process kids until we are left with just page objects
async processKids(objNum, pages = []) { return new Promise(async resolve => { const kidsMatch = /\/Kids\s*\[\s*\n*(.*)\s*\n*\]/gs // match /Kids[] const kidObjMatch = /(\d+\s+(?=0\s+R))/gs // match object reference numbers in the Kids array const obj = this.getObjectAt(objNum) // get the object ...
[ "async determinePages() {\n return new Promise(async (resolve, reject) => {\n try {\n const pageRegex = /(?:\\/Pages\\s*)(\\d+)/g // match /Type /Pages\n const pageKey = this.catalogObj.match(pageRegex)[0] // get the object reference of the /Pages object from catalog\n const pagesObjNum...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addToWatchDb adds symbol and price to the database, symbol is the parent and price is the child
function addToWatchDb(sym, price) { var dbPath = "watchlist/" + sym; currentWatchRow.currentPrice = price; database.ref(dbPath).update({"stockPrice": price}); }
[ "function addToWatchDb(sym, price) {\n var dbPath = \"/watchlist/\" + sym;\n\n currentWatchRow.currentPrice = price;\n console.log(\"in addToWatchDb() appUser.authenticated = \" + appUser.authenticated);\n if (appUser.authenticated) {\n appUser.addToWatch(sym);\n }\n database.ref(dbPath).upda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addToRecentDocuments : String > String Given a filepath Add it to native recent documents list (Windows & macOS) Add it to Home screen documents list
async function addToRecentDocuments(filepath) { try { await docList.addFileToDocList(filepath); await docList.setOpened(filepath); app.addRecentDocument(filepath); } catch (err) { await dialog.showMessageBox( errorAlert( "Recent Documents Error", `Couldn't add ${filepath} to re...
[ "updateRecentFiles(paths=[], dontWrite=false){\n // new paths array\n let recentFilePaths = [...paths, ...this.recentFilePaths];\n\n // remove any duplicates \n recentFilePaths = recentFilePaths.filter((val, i) => recentFilePaths.indexOf(val) === i);\n\n // 10 most recent \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This will cancel the current Future, the current transformation, and all stacked hot actions.
function Sequence$cancel(){ cancel(); transformation && transformation.cancel(); while(it = nextHot()) it.cancel(); }
[ "function Sequence$cancel(){\n\t cancel();\n\t action && action.cancel();\n\t while(it = nextHot()) it.cancel();\n\t }", "cancel() {\n\t\tthis.reconciling = false;\n\t}", "cancel() {\n if (this.raf) {\n cancelAnimationFrame(this.raf);\n }\n }", "function unsafe_cancel_exn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Active les clusterers (car, moto, collection) avec leurs options
function enableClusterers() { clusters.moto = { gridSize: 50, styles: [ {textColor: 'white', url: '/media/ui/img/map/cluster-blue.png', height: 33, width: 33}, {textColor: 'white', url: '/media/ui/img/map/cluster-blue.png', height: 33, width: 33}, {textColor: 'white', url: '/media/ui/img/map/cluste...
[ "function ClusterToolGetClusterMethod(objclusmethSelect) { \n \n var cmId = \"kmeans\"; \n var cmName = \"kmeans\"; \n objclusmethSelect.add(new Option(cmName, cmId)); \n cmId = \"dbscan\"; \n cmName = \"dbscan\"; \n objclusmethSelect.add(new Option(cmName, cmId)); \n \n}", "function enableClust...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::IAM::Group.Policy` resource
function cfnGroupPolicyPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGroup_PolicyPropertyValidator(properties).assertSuccess(); return { PolicyDocument: cdk.objectToCloudFormation(properties.policyDocument), PolicyName: cdk.stri...
[ "function cfnMultiRegionAccessPointPolicyPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnMultiRegionAccessPointPolicyPropsValidator(properties).assertSuccess();\n return {\n MrapName: cdk.stringToCloudFormation(properties.mrapName),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks to see if the current browser is capable of running visualizations. If the AudioContext is available, then the browser can play the visualization. Public Accessor: Amplitude.visualizationCapable()
function publicVisualizationCapable(){ if ( !window.AudioContext ) { return false; }else{ return true; } }
[ "function supportsDisplay() {\n var hasDisplay =\n this.event.context &&\n this.event.context.System &&\n this.event.context.System.device &&\n this.event.context.System.device.supportedInterfaces &&\n this.event.context.System.device.supportedInterfaces.Display\n\n return hasDisplay;\n}", "static isDispla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On component unmount, unregister scroll and resize handlers
componentWillUnmount() { window.addEventListener('scroll', this.handleScroll); window.removeEventListener('resize', this.handleWindowSizeChange); }
[ "destroy() {\n this.viewport.options.divWheel.removeEventListener('wheel', this.wheelFunction);\n }", "function unregisterEventHandlers() {\n if (oOrientationSensor != null) {\n oOrientationSensor.removeEventListener(\"orientationchanged\", orientationSensor_orientationChanged);\n }\n}", "compo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the max console height for all rooms.
static getMaxHeight() { var result = Math.max(MainUtil.findAllRooms().map(room => (room.memory.console && room.memory.console.height))); return result || 10; }
[ "function getHeight() {\n return maxy + 1;\n }", "getGameHeight() {\n return this.scene.sys.game.config.height;\n }", "get maxHeight() {\n\t\tlet maxHeight = 0, height;\n\n\t\tfor (let i = 0; i < this.count; i++) {\n\t\t\tif (this.cache[i]) {\n\t\t\t\theight = this.cache[i];\n\t\t\t} else {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new RawTexture3D
function RawTexture3D(data,width,height,depth,/** Gets or sets the texture format to use */format,scene,generateMipMaps,invertY,samplingMode,textureType){if(generateMipMaps===void 0){generateMipMaps=true;}if(invertY===void 0){invertY=false;}if(samplingMode===void 0){samplingMode=BABYLON.Texture.TRILINEAR_SAMPLINGMODE;}...
[ "function RawTexture(data,width,height,/**\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\n */format,scene,generateMipMaps,invertY,samplingMode,type){if(generateMipMaps===void 0){generateMipMaps=true;}if(invertY===void 0){invertY=false;}if(samplingMode===void 0){samplingMo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the logo with a "home" url based on the root link from the navigation
function setHomeLink(navigationSelector, logoSelector) { var $nav = $(navigationSelector), $logo = $(logoSelector); //Expect to update only a single logo if($nav !== undefined && $nav.length === 1 && $logo !== undefined && ...
[ "get homeLink() {\n // if we are on the homepage then load the first item in the manifest and set it active\n if (this.manifest) {\n const firstItem = this.manifest.items.find(\n (i) => typeof i.id !== \"undefined\"\n );\n if (firstItem) {\n return firstItem.slug;\n }\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
index first by attribute, then by vertex, then by frame
function getIndex(vertex, uv) { const attributeIndex = floor(frame / 2); const vertexIndex = vertex; const frameIndex = frame % 2; const uvIndex = uv; return attributeIndex * FRAME_UV_ATTRIBUTE_SIZE_PER_FRAME + vertexIndex * FRAME_UVS_PER_ATTRIBUTE * 2 + frame...
[ "visitIndex_attributes(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function attachVertexHelper(idx)\n{\n\t//var idx = labels.indexOf(INTERSECTED);\n\tvar vertices = planes[idx].geometry.vertices;\n\tfor (var i=0; i<vertices.length; i++){\n\t\t// get the global position\n\t\tvar position = {x: 0, y: 0, z: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears the edit form. Must call before loading data to form.
clearEditForm() { let editTitle = document.getElementById('editTitle'), wysiwyg = h.getEditorWysiwyg(); // Set the edit fields blank editTitle.value = ''; editContent.value = ''; // Remove the wysiwyg editor if (!_.isNull(wysiwyg)) { wysiwyg.remove(); } }
[ "function clearForm() {\n form.reset();\n }", "function clear_form(){\n $(form_fields.all).val('');\n }", "function clearEditFormFields() {\n $(\".edit-form #card-id\").val(\"\");\n $(\".edit-form #card-title\").val(\"\");\n $(\".edit-form #card-body\").val(\"\");\n $(\".edit-for...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the course names of the OUs the user gave
function filterOUs(course) { if (actionOUs.map(setStrings).indexOf(course.split('-')[0]) != -1) { actionCourses.push(course); } }
[ "getMentorsByCourseTitle(courseName) {\n let mentorsName = [];\n let mentors = this.getMentorList();\n mentors.forEach(mentor => {\n if (mentor.courses.indexOf(courseName) > -1)\n mentorsName.push(mentor.name)\n });\n return mentorsName;\n }", "stati...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addMarker function adds numbered markers on the map with respective to the restaurant found!
function addMarker(rest_add,count){ var address = rest_add; geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, ...
[ "static addMarkerForRestaurant(restaurant, map) {\n const marker = new google.maps.Marker({\n position: restaurant.latlng,\n title: restaurant.name,\n url: DBHelper.getRestaurantURL(restaurant),\n map: map,\n animation: google.maps.Animation.DROP}\n );\n return marker;\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This field contains a patient\'s most recent marital (civil) status.
get maritalStatus() { return this.__maritalStatus; }
[ "get maritalStatus () {\n\t\treturn this._maritalStatus;\n\t}", "get status() {\n if (!this._cancerProgression.value) return null;\n return this._cancerProgression.value.coding[0].displayText.value;\n }", "get status() {\n this._status = getValue(`cmi.objectives.${this.index}.status`);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assign a task 'sick' to resource wich have a duration egal to the given duration
function sickenResource(resourceDescriptor, duration) { var i, resInstance, taskDescriptor, listAbsences = Variable.findByName(gm, 'absences'); resInstance = resourceDescriptor.getInstance(self); for (i = 0; i < listAbsences.items.size(); i++) { if (listAbsences.items.get(i).getInstance(...
[ "function impact(task){\r\n\r\n }", "function task_cost_calculation(item, key_name, hourly_rate) {\n hourly_rate = hourly_rate || 15\n key_name = key_name || 'duration'\n minutes = parseFloat(item[key_name])\n cost = minutes * (hourly_rate / 60)\n return cost\n}", "set task (value) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register an input with this datepicker.
_registerInput(input) { if (this._datepickerInput && (typeof ngDevMode === 'undefined' || ngDevMode)) { throw Error('A MatDatepicker can only be associated with a single input.'); } this._inputStateChanges.unsubscribe(); this._datepickerInput = input; this._inputState...
[ "function runDatePickerWidget() {\n var date_input=$('input[name=\"date\"]'); //our date input has the name \"date\"\n var container=$('.bootstrap-iso form').length>0 ? $('.bootstrap-iso form').parent() : \"body\";\n var options={\n format: 'dd/mm/yyyy',\n container: container,\n today...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders a move on the board for the side that just moved
function renderMove(move, sideJustMoved) { // extract row and column of move var row = move.loc.row; var col = move.loc.col; // source of image file to show var imgsrc; // set image file source according to player that moved switch (sideJustMoved) { case board.playersEnum.N: ...
[ "moving() {\n\n let divId = this.piece.id\n this.totalMoves++\n\n if (this.totalMoves > 1) {\n this.currentTile++\n }\n\n //If the token hasn't made a full round, do not allow it into a color zone\n if (this.currentTile > TILE_BEFORE_ROLLEROVER && this.totalMoves...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that changes screen to zero
function zero() { calcScreen.innerText = "0"; }
[ "function clearScreen(){ displayVal.textContent = null}", "function clearScreen() {\n calculator.displayValue = '0';\n calculator.firstOperand = null;\n calculator.waitForNextOperand = false;\n calculator.operator = null;\n calculator.inBaseTen = true;\n}", "resetPosition() {\n if (this.hasGon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the zoom scale/speed.
setZoomScale(scale_zoom){ this.scale_zoom = scale_zoom; }
[ "setWheelScale(wheelScale) {\n this.scale_zoomwheel = wheelScale;\n }", "function setCurrentScale() {\n\t\tFloorPlanService.currentScale = $(FloorPlanService.panzoomSelector).panzoom(\"getMatrix\")[0];\n\t}", "set scale(newscale)\n\t{\n\t\tthis.myscale.x = newscale;\n\t\tthis.myscale.y = newscale;\n\n\t\tth...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Optimize request then send it
_optimize(method, url, data = {}, options = {}) { if (Is.object(url)) { options = url; if (!options.method) { options.method = method; } } else { options.data = data; options.url = url; options.method = meth...
[ "sendRequest(request) {\n let requestId = \"R\" + this.nextRequestId++;\n this.responseQueue[requestId] = request;\n\n let query = request.query;\n query.extensions = {requestId: requestId};\n this.connection.sendUTF(JSON.stringify(query));\n }", "_sendRequestFromQueue () {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }