query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Compare requesting URL with possible original URL for global rank.
function compareGlobalRank(requestingUrl, possibleOriginalUrl) { isGlobalRankLegit = [0, "No Global Rank!"]; // Requesting URL var requestingUrlGlobalRank = getGlobalRank(requestingUrl); // Original URL var possibleOriginalUrlGlobalRank = getGlobalRank(possibleOriginalUrl); // Verify that both requests are ...
[ "function getGlobalRank(url)\n{\n\t// Request for global rank (Global and Country Rank)\n\tvar startDate=\"2018-10\";\n\tvar endDate=\"2018-10\";\n\tvar mainDomain=false;\n\t\n\t// Requesting Website\n\tvar reqApiUrl=\"https://api.similarweb.com/v1/website/\"+url+\"/global-rank/global-rank?api_key=\"+pageStatsApiKe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Step 10 update the liveNeighborCount based on the number of living neighbors around each cell
updateNeighborCounts () { // for each cell in the grid for (var column = 0; column < this.numberOfColumns; column++) { for (var row = 0; row < this.numberOfRows; row++) { // reset it's neighbor count to 0 this.cells[column][row].liveNeighborCount = 0; // get the cell's neighbors this.get...
[ "function setMinesNegsCount(board) {\r\n var currSize = gLevels[gChosenLevelIdx].SIZE;\r\n for (var i = 0; i < currSize; i++) {\r\n for (var j = 0; j < currSize; j++) {\r\n var cell = board[i][j];\r\n var count = calculateNegs(board, i, j)\r\n cell.minesAroundCount = co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transforms commands to a normalized `Navigation`
function computeNavigation(commands) { if ((typeof commands[0] === 'string') && commands.length === 1 && commands[0] === '/') { return new Navigation(true, 0, commands); } var numberOfDoubleDots = 0; var isAbsolute = false; var res = commands.reduce(function (res, cmd, cmdIdx) { if (...
[ "function createNavigation() {\n \n // If a mobile device is detected, remove initial navigation list\n if (!isMobileDevice) {\n navigation.children(TAG_UL).html(CHAR_EMPTY);\n }\n \n // Iterate all available commands\n $.each(commands, function(key, v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a comm target handler.
removeCommTarget(targetName, callback) { if (!this.isDisposed && this._targetRegistry[targetName] === callback) { delete this._targetRegistry[targetName]; } }
[ "remove(handler) {\n // de-register all of its event types\n for (let et of handler.eventsHandled()) {\n this.deregister(et, handler);\n }\n // remove it from our list\n this.handlers.splice(this.handlers.indexOf(handler), 1);\n }", "onE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the percentage for the progress bar
function getPerc() { var perc = Math.ceil((index/maxIndex)*100); $(".progress-bar").attr("aria-valuenow", perc); $(".progress-bar").html(perc+"%"); $(".progress-bar").css("width", perc+"%"); }
[ "get percent() {\n return Math.max(0, (SongManager.player.currentTime - this.startPoint) / (this.endPoint - this.startPoint));\n }", "get percentage() {\n return this._percentage;\n }", "calcPercentage() {\n return Math.floor((this.volume / 20) * 100) + \"%\";\n }", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handleAddressLookup Handles the address look up by adding loading state to component, fetches addresses from API service, formats responses to suit custom select component, then displaying to user.
async handleAddressLookup() { /* Display loading template while API call happens */ this.isLoading = true; /* Disable the templates for New Address Search and Manual Entry. Enable the Search Results template. */ this.newSearchForm = false; this.manualEntryForm = false; t...
[ "function postalCodeLookup() {\n\tlet postalcode = document.getElementById(\"postalcodeInput\").value;\n\tlet selectedCountry = getDataId('countryInput', 'countries');\n\tctry = countryInput.value;\n\n\t//example: http://api.geonames.org/postalCodeLookupJSON?postalcode=6600&country=AT&username=demo\n\tlet request =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
follow all references in the object obj and mark them with the current mark if sp is a number, obj is assumed to be an array for which indices [0..sp] need to be followed (used for thread stacks)
function h$follow(obj, sp) { var i, ii, iter, c, work, w; ; var work, mark = h$gcMark; if(typeof sp === 'number') { work = obj.slice(0, sp+1); w = sp + 1; } else { work = [obj]; w = 1; } while(w > 0) { ; c = work[--w]; ; if(c !=...
[ "set_marks(mark) {\n this.V.forEach(v => {\n v.mark = mark;\n });\n }", "save_stack(s){\n var v = [];\n for(var i=0; i<s; i++){\n v[i] = this.stack[i];\n }\n return { stack: v, last_refer: this.last_refer, call_stack: [...this.call_stack], tco_counter: [...this.tco_cou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates modal dialog for choosing webview button icon.
function createIconDialog() { iconDialog = new ui.BaseElement({ type: "dialog", class: "mdl-dialog", innerHTML: "<h5 class=\"mdl-color-text--blue-A200\">Choose an icon</h5>", }).appendTo("body"); const icons = ui.arrayToElements( ui.IconButton, codepoints.map(e => ({ innerHTML: new ui.M...
[ "function ViewAssetClicked(url) {\n console.log(\"View Asset clicked!\");\n console.log(url);\n // get the click of the create button\n $('#assetModal').modal('show')\n .find('#viewAssetModalContent').load(url);\n $(\".modal-backdrop.in\").css({'opacity': 0});\n}", "function updateBrowserAct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setting random goal function
function randomGoal() { goal = Math.floor(Math.random() * 100 + 20); }
[ "function randomRobot(state) { \n return {direction: randomPick(roadGraph[state.place])};\n}", "function getRandomIntelligence(){\n var num = Math.random();\n intelligence = Math.round(num * 100);\n }", "function generateBotChoice () {\n return Math.floor(Math.random() * 3) + 1\n }", "rand...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SaveACPSettings(savePath) Save the current settings to the specified directory savePath is like Mysystem/ACP Settings
function SaveACPSettings(savePath) { Console.PrintLine(""); Console.PrintLine ("Saving ACP Settings"); for (var i in ACP_File_List) { var fileName = ACP_File_List[i]; if (FSO.FileExists(ACPApp.Path + "\\" + fileName)) { // Copy FilterInfo.txt FSO.CopyFile(ACPApp.Path + "\\" + fileName, savePath...
[ "function saveSettings() {\n\n var projectRoot = ProjectManager.getProjectRoot().fullPath;\n var file = FileSystem.getFileForPath(projectRoot + '.ftpsync_settings');\n\n function replacePwd(key, value) {\n if (key === \"pwd\") return undefined;\n return value;\n }\n // if save password is c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serializes the output id into a compressed string form
toString() { return "".concat(this.txId, ":").concat(this.outputIndex); }
[ "getID() {\r\n return this.id.toString().padStart(3, '0');\r\n }", "gen_id(type){\n\n var str_prefix = \"\";\n var num_id = null;\n var arr_elems = null;\n switch (type) {\n case 'tool': str_prefix = \"t-\"; arr_elems= this.get_nodes('tool'); break;\n case 'data': str...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Safely assert whether the given value is a Blob. In some execution environments Blob is not defined.
function isBlob(value) { return typeof Blob !== 'undefined' && value instanceof Blob; }
[ "function isXHR2WithBlobSupported() {\n if (!window.hasOwnProperty('ProgressEvent') || !window.hasOwnProperty('FormData')) {\n return false;\n }\n let xhr = new XMLHttpRequest();\n if (typeof xhr.responseType === 'string') {\n try {\n xhr.responseType = 'blob';\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate bitCount of short_message
function bitCount(msg, encoding) { if (defs.encodings[encoding] === undefined) { encoding = defs.encodings.detect(msg); } if (encoding === 'ASCII') { return defs.encodings.ASCII.encode(msg).length * 7; // * 7 since each character takes up 7 bits } else { return defs.encodings.UCS2.encode(msg).length * 8; // ...
[ "bitCount() {\n let result = 0;\n for(let i = 0; i < this.array.length; i++){\n result += BitSet.countBits(this.array[i]) // Assumes we never have bits set beyond the end\n ;\n }\n return result;\n }", "function countTheBits(num) {\n\tlet numString;\n\tnumStrin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the default assets to the repo.
function addDefaultAssets () { // Skip this step on the browser, or if emptyRepo was supplied. const isNode = require('detect-node') if (!isNode || opts.emptyRepo) { return callback(null, true) } const blocks = new BlockService(self._repo) const dag = new DagService(blocks) ...
[ "function default_webpack_assets() {\n\tvar webpack_assets = {\n\t\tjavascript: {},\n\t\tstyles: {}\n\t};\n\n\treturn webpack_assets;\n}", "function copyAssets(done) {\n var assets = {\n js: [\n \"./node_modules/jquery/dist/jquery.js\",\n \"./node_modules/bootstrap/dist/js/bootstra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: addBackgroundImage Params: imageSource
function addBackgroundImage(imgSrc) { //console.log('addBackgroundImage '+imgSrc); if (importTitleImage) { _uid = project.slideshow.uid; if (_uid == 'undefined') { _uid = project.uidCounter.createUid()+project.uidCounter.createUid()+'_'+Date.now(); project.slideshowuid = _uid; } p...
[ "function createBackground() {\n var background = this.add.image(256, 256, \"background\");\n background.setScale(2.2, 2.5);\n}", "function changeBackground(src) {\n if( preloaded.indexOf(src) === -1 ) {\n preloadImage(src);\n } else {\n removeLoadingOverlay();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DISPLAY SINGLE ELEMENT INFO // STAMFORD HILL 4025 get 8 days forcast container nextHeightDaysContainer.addEventListener('click', displaySingleView);
function displaySingleView() { // const get the id or unique identifier of the clicked element var elementClickedId = this.dataset.id; // get the object from the 8 days array object that correspond to the cliked element var clickedElementData = ''; if (!this.classList.contains('open_button')) { clickedEl...
[ "function clickDay() {\n let oldSelected = document.querySelector(\".selectedDayTile\");\n if (oldSelected != null) {\n oldSelected.classList.remove(\"selectedDayTile\");\n }\n this.classList.add(\"selectedDayTile\");\n let d = f(this.textContent);\n let monthYea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
attempts to prepend tileArr1 to gameState; returns true on success otherwise returns false
prependToGameState(tileArr){ let canPrepend = this.canPrepend(tileArr); if(canPrepend) { this.gameState.unshift(tileArr); } return canPrepend; }
[ "playTile(tilePositions){\n let checkValidPosition = this.validTileExists(tilePositions);\n let tileToPlay = [];\n if(checkValidPosition.positionToPlay!==-1){\n \n tileToPlay = this.stock[checkValidPosition.positionToPlay];\n \n if(checkValidPosition.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tumblr responses and handlers
function getTumblrResponse(apiVars, callback) { if (!apiVars.mediaToSearch.tumblr) { return callback(null); } var tumblr = require(path.join(nPkgDir, '/tumblr.js')); var client = tumblr.createClient(apiVars.tumblr); var query = apiVars.query.includes('#') ? apiVars.query.substring(1) : apiVars.query; client.t...
[ "function webhook(req, res, next) {\n\n console.log(\"Made it to the webhook!\")\n\n switch(req.body.type) {\n case \"message-created\":\n messageCreated(req.body);\n console.log(\"Message created!\")\n break;\n case \"space-members-added\":\n spaceMembersAdded(req.body);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If your peer may not be listening yet to your messages, you may call this to queue outgoing messages until receiving a "ready" message from the peer. I.e. one peer may call queueOutgoingUntilReadyMessage() while the other calls sendReadyMessage().
queueOutgoingUntilReadyMessage() { this._waitForReadyMessage = true; this._queueOutgoing(); }
[ "queueBroadcast() {\n\t\t// Endpoints do not perform routing, never broadcast routing info\n\t\tif(this.endpoint) return;\n\n\t\t// A broadcast is scheduled\n\t\tif(this.broadcastTimeout) return;\n\n\t\tthis.broadcastTimeout = setTimeout(() => {\n\t\t\tif(debug.enabled) {\n\t\t\t\tdebug('Broadcasting routing to all...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve the current page, without an extension
function getCurrentPage() { var paths = location.href.split('/'); return paths[paths.length-1].split('.')[0]; }
[ "function getActivePage() {\n return $.mobile.pageContainer.pagecontainer('getActivePage');\n}", "function GetPage() {\n return [location.href.split(\"/\")[4], location.href.split(\"/\")[5], location.href.split(\"/\")[6], location.href.split(\"/\")[7]].map(function (L) {\n if (typeof L === \"undefine...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A class for formatting number to significant digits. Copyright (C) 2001 Stephen Ostermiller This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any lat...
function SignificantFigures(s){ this.order = parseOrder(s); this.mantissa = parseMantissa(s); this.positive = parseSign(s); /** * Get the number of significant figures this object uses. * Leading zeros are not significant. Traling zeros up to * and after the decimal point are significan...
[ "function precision_function() {\n var a = 1234567.89876543210;\n document.getElementById(\"precision\").innerHTML = a.toPrecision(10);\n}", "function toprecision_number_method(number, precision){\n document.getElementById(\"PrecisionNumber\").innerHTML = \"To number \" + number\n + \" it was applied ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CALL API AND DESTRUCTURE DATA FROM API RESPONSE FOR ONE TARGET CITY (JQuery) Using city name, lat, long, API URL and API KEY, this function destructures current weather conditions plus those for next five days and returns the compiledCityWeatherInformationObject for ONE target city to the calling function getCityWeathe...
async function callWeatherAPI (currentCityName, currentCityLat, currentCityLon, API_KEY, WEATHERBIT_API_URL) { let compiledCityWeatherInformationObject = {}; try { var jQueryXMLHTTPResponse = await $.ajax({ dataType: "json", url: WEATHERBIT_API_URL, data: { key: API_KEY, lon: c...
[ "async function getCityWeatherData (TARGET_CITIES, API_KEY, WEATHERBIT_API_URL){\n let finalizedCityWeatherInformationObject = {};\n for (let targetCity in TARGET_CITIES){\n let currentCityName = targetCity;\n let currentCityLat = TARGET_CITIES[targetCity].lat;\n let currentCityLon = TARGET_CITIES[target...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads through continuous whitespace
skipWhitespace() { while (!this.isEOF() && this.isWhitespace(this.peekChar())) { this.readChar(); } }
[ "consumeSpaces() {\n for (;;) {\n const token = this.future();\n\n if (token.text === \" \") {\n this.stack.pop();\n } else {\n break;\n }\n }\n }", "eatSpace() {\n let start = this.pos\n while (/[\\s\\u00a0]/.test(this.str...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to randomly chose which file is chosen out of the sound files array
function audioFileShuffle(array) { soundbite = Math.floor(Math.random() * array.length); }
[ "function chooseSong() {\n song = _.sample(sampleArray);\n\n // while the id is in the recentlyPlayedSongs array, pick another\n while(recentlyPlayedSongs.some(function (e) { return e.id == song.id; })) {\n song = _.sample(sampleArray);\n }\n\n // adjust recentlyPlayedSongs\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import DataFetcing from './components/DataFetcing'; import CounterOne from './components/CounterOne'; import CounterTwo from './components/CounterTwo'; import CounterThree from './components/CounterThree'; import DataFetchingOne from './components/DataFetchingOne'; import DataFetchingTwo from './components/DataFetching...
function App() { return ( <div className="App"> {/* <DataFetcing /> */} {/* <CounterOne /> */} {/* <CounterTwo /> */} {/* <CounterThree /> */} {/* <DataFetchingOne /> */} {/* <DataFetchingTwo /> */} {/* <FocusInput /> */} {/* <ClassTimer /> */} {/* <HookTImer /> */} {/*...
[ "function App() {\n return (\n <div className=\"App\">\n <DataFetching />\n {/* <CompWillUnmountUseState /> */}\n {/* <UseEffectCondn /> */}\n {/* <UseEffectMouse /> */}\n {/* <IntervalHookCounter /> */}\n </div>\n );\n}", "function App() {\n return (\n <Provider store={store}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OPCUA server method Gets calles as the last step of initializing a OPCUA server. Defines the published OPCUA variables and methods. Creates a OPCUA client that connects to the initialized server afterwards.
function opcuaServerPostInitialize(){ var addressSpace = server.engine.addressSpace; var robot = addressSpace.addFolder(addressSpace.rootFolder.objects, {browseName: "Robot02"}); var opcua_servos = []; // Add OPCUA-Variable fo every servo of the robot arm for(var i = 0; i < servoCount; i++) opcu...
[ "function initializeOpcuaClient(){\n client = new OPCUAClient({keepSessionAlive:true});\n client.connect(\"opc.tcp://\" + os.hostname() + \":\" + port, onClientConnected);\n}", "_buildClient() {\n var metadata = (0, _frames.encodeFrame)({\n type: _frames.FrameTypes.DESTINATION_SETUP,\n majorVer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE: my_input will be string (operator) or array ([value_list])!
function iterator(my_key, my_value, my_input) { var snip; if (my_key === "operator") { my_input += ' ' + my_value + ' '; } else { snip = my_key + ': "'; my_input += ' (' + snip + my_value.join('" OR ' + snip) + '") '; } return my_input; }
[ "setInput(input) {\n\t\t// Ensure that number of inputs matches expected\n\t\tif (input.length != this.numInputs) {\n\t\t\tconsole.log(\"Unexpected number of inputs\");\n\t\t\treturn null;\n\t\t}\n\n\t\tthis.myInput = input.slice();\n\t\t// Iterate over each node, store output\n\t\tfor (let n = 0; n < this.numNodes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the node for a rename handler.
function createRenameNode(oldPath) { var body = document.createElement('div'); var existingLabel = document.createElement('label'); existingLabel.textContent = 'File Path'; var existingPath = document.createElement('span'); existingPath.textContent = oldPath; var nameTitl...
[ "visitRename_object(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitRename_index_partition(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function mangleNode(node, o)\n{\n\t// Don't mangle nodes more than once\n\tif (o.alreadyMangledNodes.has(node))\n\t\treturn;\n\t\n\tnode.name = mangleName(node....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create chainable isRequired validator Largely copied directly from:
function createChainableTypeChecker(validate) { function checkType(isRequired, props, propName, componentName) { componentName = componentName || '<<anonymous>>'; if (props[propName] == null) { if (isRequired) { return new Error('Required prop \'' + propName + '\' was not specified in \'' +...
[ "function isRequiredPropType(path) {\n return (0, getMembers_1.default)(path).some(member => (!member.computed && member.path.node.name === 'isRequired') ||\n (member.computed && member.path.node.value === 'isRequired'));\n}", "function setupRequired() {\n var short = $attrs['checkReq...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build the caption if needed
function build_caption(item) { if (item !== undefined) { return caption(item); } else { return ''; } }
[ "function setupCaption() {\n $('.caption-detail', $detail).text(node.text);\n var capHelperText = '';\n if (node.hscs) {\n capHelperText = node.hscs + '次合绳';\n } else if (node.nzcs) {\n capHelperText = node.nzcs + '次捻制';\n } else i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds data after first instance of given key. Nothing is changed if key is not found
addAfter(key, data) { if (this.head == null) return; let currentNode = this.head; while (currentNode != null && currentNode.data != key) { currentNode = currentNode.next; } if (currentNode) { let tempNode = currentNode.next; currentNode.next = new Node(data); currentNode.ne...
[ "addBefore(key, data) {\n if (this.head == null) return;\n \n let currentNode = this.head;\n let prevNode = null;\n\n while (currentNode != null && currentNode.data != key) {\n prevNode = currentNode;\n currentNode = currentNode.next;\n }\n\n if (currentNode) {\n let tempNode = n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Example pf creating a new event and adding command and parmams to it
function createEvent() { log('addOnEve'); getObjectValue(0, 'addEvent("some_important_event","some_command","some_command_params")', function (e) { }); }
[ "function createEvent(event){\n\n\t// Event Object: Type, Subtype, Description, StartTimeDate, Freshness, Status, NumberOfNotification, Reliability\t \n\tvar eventObject = new Object();\n\n\t// Type & Subtype Event\n\teventObject.type = event.type.type.charAt(0).toUpperCase() + event.type.type.slice(1).repla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provides a Menutopbar with home, back, search, autoplay, and favoriteelements. Inits the login and logout.
function createMenubar() { //Base containers var baseCon = document.createElement('div'); var menuCon = document.createElement('div'); var leftCon = document.createElement('div'); var rightCon = document.createElement('div'); //Set ids baseCon.setAttribute('id', 'baseCon'); men...
[ "function showLoggedInMenu(){\n\t\t$('#signup, #login').hide();\n\t\t$('#logout').show();\n\t}", "function updateNavOnLogin() {\n console.debug(\"updateNavOnLogin\");\n $(\".main-nav-links\").show();\n $navLogin.hide();\n $navLogOut.show();\n $userNavLinks.show();\n $navUserProfile.text(`${currentUser.usern...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get first idle interaction with a matching pointerType
idle({ pointerType, scope }) { for (const interaction of scope.interactions.list) { // if there's already a pointer held down if (interaction.pointers.length === 1) { const target = interaction.interactable; // don't add this pointer if there is a target interactable and it // ...
[ "function getPointerType(event) {\n\n // check for touch or mouse events\n if (event.type.indexOf('touch') === 0) {\n return PointerType.TOUCH;\n } else if (event.type.indexOf('mouse') === 0) {\n return PointerType.MOUSE;\n }\n\n // check MSPointer type\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
read the pixel data of the given texture face
function readPixels(texture, face) { var rt = new pc.RenderTarget({ colorBuffer: texture, depth: false, face: face }); var data = new Uint8ClampedArray(texture.width * texture.height * 4); var device = texture.device; device.setFramebuffer(rt._glFrameBuffer); device.initRenderTarget(rt); device....
[ "function getPixel(imageData, x, y) {\n var index = (y * 4) * imageData.width + (x * 4),\n data = imageData.data;\n\n return {\n index: {\n r: index,\n g: index + 1,\n b: index + 2,\n a: index + 3\n },\n\n 'byte': {\n r: data[i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when the mouse is dragged, change the color to orange
function mouseDragged() { console.log('- dragged...'); cursorColor = 'rgb(255,150,0)'; }
[ "function drop(e) {\n var color = e.dataTransfer.getData('color');\n setColor('picker', parseColor(color));\n }", "function dragStart() {\n colorBeingDragged = this.style.backgroundImage; // Will pick the color that is being dragged\n squareIdBeingDragged = parseInt(this.id); //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process a lexeme. Returns next position.
function processLexeme(buffer, lexeme) { var newMode; var endMode; var origin; modeBuffer += buffer; if (lexeme === undefined) { addSiblings(processBuffer(), currentChildren); return 0; } newMode = subMode(lexeme, top); if (newMode) { addSiblings(processBuffer(), c...
[ "lesx_parseElement() {\n var startPos = this.start,\n startLoc = this.startLoc;\n\n this.next();\n\n return this.lesx_parseElementAt(startPos, startLoc);\n }", "function peek() {\n return tokens[position];\n }", "nextInstruction() {\n const pat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a list of feature categories
function getCategoryList(category) { var catList = []; self.features.forEach(function(feat, index, array) { if (! mrlUtil.arrayContains(catList, feat.category)) { catList.push(feat.category); } }); return catList; }
[ "function getAllCateogorie () {\n return categorie;\n}", "function getFeatureList() {\n var featList = [];\n self.features.forEach(function(feat, index, array) {\n featList.push(feat.name);\n });\n return featList;\n }", "function getLabsCategories() {\n var getLabsCategoriesUrl;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
copy package.json and typings from package to typegeneration/test/.../node_modules
async function copy() { for (const outDir of outDirs) { const packages = [...defaultPackages] if (outDir === 'jest') { packages.push(...jestPackages) } if (outDir === 'jasmine') { packages.push(...jasminePackages) } // link node_modules ...
[ "async function generatePackageJson() {\n const original = require('../package.json')\n const result = {\n name: original.name,\n author: original.author,\n version: original.version,\n license: original.license,\n description: original.description,\n main: './index.js',\n dependencies: Objec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
You can use the AWS::GuardDuty::Filter resource to create a GuardDuty filter using the specified finding criteria. Documentation:
function Filter(props) { return __assign({ Type: 'AWS::GuardDuty::Filter' }, props); }
[ "function customFilterFactory(){\n return function(input){\n //change input\n return 'customFilter applied';\n }\n }", "eth_newFilter(filter) {\n return this.request(\"eth_newFilter\", Array.from(arguments));\n }", "function filterData(filterReq){\n\n if(filterReq){\n\n var filter...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
==Fire A Given Action== 'act' can be : a string refering to an botdata.actions[xx] an object containing an action a function
function fireAction(act) { inputState(false); botAction.next = getAction(act); processAllActions(); }
[ "playAction(name) {\n this.action(actions[name])\n }", "function greet(action){\n action();\n}", "call(actionType, ...params) {\n const handler = this.actions.get(actionType);\n if (!handler) {\n throw new Error(`A handler for ${actionType} has not been registered`);\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build a fulltext index from an array of references.
function buildIndex(references) { var index = lunr(function () { this.field('title', { boost: 10 }); this.field('author'); this.field('journal'); this.field('body'); this.field('abstract'); }); for (var id in references) { var ref = references[id]; var...
[ "function createSearchIndex(items){\n const builder = new lunr.Builder();\n let fields = null;\n if (CFG.search_fields){\n fields = CFG.search_fields.slice();\n } else {\n for (const [id, item] of Object.entries(items)) {\n const cur = Object.keys(item);\n if (fields ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use the AWS::IoT::ThingPrincipalAttachment resource to attach a principal (an X.509 certificate or another credential) to a thing. Documentation:
function ThingPrincipalAttachment(props) { return __assign({ Type: 'AWS::IoT::ThingPrincipalAttachment' }, props); }
[ "function PolicyPrincipalAttachment(props) {\n return __assign({ Type: 'AWS::IoT::PolicyPrincipalAttachment' }, props);\n }", "function addAttachment(payload, attachment, asInline = false) {\n if (asInline)\n payload.inline = [...utils_1.ensureArray(payload.inline), ...utils_1....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets up an unload function for all browsers to work (onunload or onbeforeunload)
function onUnload(func) { if (Browser.WebKit) { window.onbeforeunload = func; } else { window.onunload = func; } }
[ "function onPageUnload(e)\r\n{\r\n\tif (!isUnloadNotified)\r\n\t{\r\n\t\tvar flashObj = getFlashObject();\r\n\t\tif (flashObj && flashObj['unload']) flashObj.unload();\r\n\t\tisUnloadNotified = true;\r\n\t}\r\n}", "function popupPVAsWindow_onunload(event)\n{\n\ttry\n\t{\n\t\tif (!window.close())\n\t\t{\n\t\t\tdt_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when click on "remove selected" : remove from the list all the selected boxes and reattribute the numbers on each box, starting from 1
function remove() { for (let i = 0; i < allBoxes.length; i++) { if (allBoxes[i].className.includes("selected")) allBoxes[i].remove(); } boxListCount = allBoxes.length; for (let i = 0; i < boxListCount; i++) { allBoxes[i].innerHTML = `<span>${i + 1}</span>`; } }
[ "function deselectAll() {\n selected = 0;\n\n let selectedCards = qsa(\".selected\");\n let i;\n for (i = 0; i < selectedCards.length; i++) {\n selectedCards[i].classList.remove(\"selected\");\n }\n }", "function clearSelection() {\n currentPizza = undefined...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the mass of the element
getMass() { return this.mass; }
[ "function crewMass(arr){\n let mass = 0;\n for (i=0;i<arr.length;i++){\n mass += arr[i].mass;\n }\n return mass;\n }", "function calcMass(_massList) {\n\n var elementMass = 0;\n\n for (var i = 1; i <= 118; i++) {\n\n elementMass += _massList[i];\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Multiply (mix) two or more colors, MODIFIES FIRST ARGUMENT
function multiply_(color1, ...colors) { for (let i = 0; i < 3; i++) { for (let j = 0; j < colors.length; j++) { color1[i] *= colors[j][i] / 255; } color1[i] = Math.round(color1[i]); } return color1; }
[ "function blendColors(c0, c1, p) {\n var f=parseInt(c0.slice(1),16),t=parseInt(c1.slice(1),16),R1=f>>16,G1=f>>8&0x00FF,B1=f&0x0000FF,R2=t>>16,G2=t>>8&0x00FF,B2=t&0x0000FF;\n return \"#\"+(0x1000000+(Math.round((R2-R1)*p)+R1)*0x10000+(Math.round((G2-G1)*p)+G1)*0x100+(Math.round((B2-B1)*p)+B1)).toString(16).sli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
moveBy(1,2); moveBy(3,1); console.log(xLocation()); console.log(yLocation()); / second: create distFromHome().Assuming she moves diagonally , return her distance from home.
function distFromHome() { distanceFromHome = math.floor(math.sqrt(math.pow(x,2)+math.pow(y,2))); return distanceFromHome; }
[ "getDistance(x, y) {\n return Math.sqrt(Math.pow(this.x - x, 2) + Math.pow(this.y - y, 2));\n }", "distanceTo (x, y) { return this.get(x, y).dist }", "function distanceHome(arr) {\n\treturn Math.abs(arr.reduce((x, i) => x + i));\n}", "function calcDistance(node1, node2) {\n //could use Math.hypot i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show product description in a popover
function show_product_description_event() { /* Append product description to popover element */ $('.description').each(function(){ /* Unbind previous event */ $(this).unbind(); $(this).on('touchend', function(){ $('.my-popover .content-block').children().remove(); $('.my-popover .content-block').append($...
[ "function handleDescriptionCopy() {\n var copyText = document.getElementById(\"part-descriptions\");\n copyText.select();\n copyText.setSelectionRange(0, 99999);\n document.execCommand(\"copy\");\n setShow(true);\n setalertTitle(\"Copied\");\n setalertText(\"Copied the text: \" + copyText.value...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the proxy overlays on every new render to ensure positions are correct.
onChartRender() { this.updateProxyOverlays(); }
[ "updateProxyOverlays() {\n const chart = this.chart;\n // Always start with a clean slate\n this.proxyProvider.clearGroup('zoom');\n if (chart.resetZoomButton) {\n this.createZoomProxyButton(chart.resetZoomButton, 'resetZoomProxyButton', chart.langFormat('accessibility.zoom.re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a textual representation of this `Timestamp`.
toString() { return "Timestamp(seconds=" + this.seconds + ", nanoseconds=" + this.nanoseconds + ")"; }
[ "timestampAsLocalString() {\n return this.timestamp().toString();\n }", "timestamp() {\n return this._d.get(\"time\");\n }", "function getTimestampString(timestamp) {\n\n // use JSON data as it is\n return timestamp;\n\n var date = new Date(timestamp);\n // These methods are retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
converts the checkboxes object of the search form into parameters for the url
function searchCheckboxesToParams(checkboxes) { var params = ""; Object.keys(checkboxes).forEach(key => {//I iterate over each field of the object if (key !== "years") {//if it's not an year if (checkboxes[key]) {//if it's a true flag console.log(key) params +...
[ "function createFilterUrls()\n\t{\n\t\t$('.fltr-wrapper .fltr-check').each(function(){\n\t\t\tvar elem = $(this);\n\t\t\tvar getQuery = window.location.search.substring(1);\n\t\t\tvar category = elem.parent().data('property');\n\t\t\tif (!elem.hasClass('active')) {\n\t\t\t\tvar filterGetParameter = $.query.set('fil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to filter data by calling another function passing in search parameter of date criteria entered, user clicked filter button and therefore filter flag is set and passed as true within createUFO()
function filterUFO() { // assign variable using querySelector() method to return the first element that matches a specified CSS selector in the document // these are used to select html elements based on their id, classes, types, attributes, values of attributes, etc. var table = document.querySelector("tab...
[ "function filter () {\n \t\tjq('#tblList').DataTable().search(\n \t\tjq('#tblList_filter').val()\n \t\t).draw();\n }", "function filter_wrapper(filter_obj,meta_switch){\r\n\r\n // fetch filter inputs from the html user interface\r\n var age_from_val = +document.getElementById(\"FROM\").value;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================================== =================================================================================== Hide Selection Rectangle This method hides the selection rectangle the user created. ===================================================================...
function hideSelectionRect() { if(selectionRect === null) { var selectionRectElement = $scope.theView.parent().find('#selectionRectangle'); if(selectionRectElement.length > 0) { selectionRect = selectionRectElement[0]; } else { //$log.log(preDebugMsg + "No selection rectangle!"); } } if(sel...
[ "function hideOutline() {\n if (isVisible) {\n isVisible = false;\n $outline.detach();\n $outline.css(\"display\", \"\");\n $outline.css(\"height\", \"\");\n $outline.css(\"right\", \"\");\n $outline.css(\"width\", \"\");\n $outline...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Button for setting shader color flag
function shaderButton() { document.getElementById("shaderBtn").addEventListener("click", function () { colorMode == "Shader" ? colorMode = "Normal" : colorMode = "Shader"; }); }
[ "function updatePaletteSwatch(button, color)\n{\n if(color) \n button.setAttribute(\"data-color\", color);\n\n button.firstElementChild.style.background = \n button.getAttribute(\"data-color\");\n}", "_colorUpdate() {\n if(this.value){\n this.updateStyles({\n '--l2t-paper-color-indica...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new market controller
function marketController() {}
[ "function createCart(req, res) {\n\t(new DB.Cart(req.body)).save((err, newCart) => {\n\t\tres.json(newCart);\n\t});\n}//end of createCart()", "function create(req, res, next) {\n\tvar order = new Order()\n\torder.pOrder = req.body.pOrder\n\torder.atgOrder = req.body.atgOrder\n\torder.orderDateTime = req.body.orde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines which language definition to use and returns it. With no parameters, it will return the global language. If you pass in a language key, such as 'en', it will return the definition for 'en', so long as 'en' has already been loaded using moment.lang. If you pass in a moment or duration instance, it will decide...
function getLangDefinition(m) { var langKey = (typeof m === 'string') && m || m && m._lang || null; return langKey ? (languages[langKey] || loadLang(langKey)) : moment; }
[ "static getLanguageName() {\n let twoLetterLangName = global.language.value.toLowerCase().split('-')[0];\n switch (twoLetterLangName) {\n case \"en\":\n return \"english\";\n case \"de\":\n return \"german\";\n case \"es\":\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
< Train regressor or make predictions with a trained regressor.
function train(x, y, cb) { if ( x.length ) $( `cls = ${use}_train( x, y, solve ); `, { // train regressor x: x || null, y: y || null, solve: solve }, ctx => cb( ctx.cls ) ); else cb( null ); }
[ "function trainModel() {\n app.models.train(\"pets\").then(\n (response) => {\n console.log(response);\n },\n (error) => {\n console.error(error);\n } \n );\n}", "function train(model, syllables) {\n console.log('train')\n let x = syllables.map(extract)\n let y = syllables.map(({ tone ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Catch a gem (called when collide occure between player and gem)
catchGem(player, gem){ this.sound_gem.play(); gem.kill(); this.gems.remove(gem); this.score += 50; this.catchingGems ++; // Catching all the available gems if(this.catchingGems == this.totalGems){ this.sound_gameMusic.stop(); cle...
[ "function collectGem() {\n if (player.isTouching(gem)) {\n playSound(\"sound://category_instrumental/trumpet.mp3\", false);\n gem.destroy(); \n portal = createPortal();\n }\n}", "checkGemCollisions() {\n for (const gem of this.gems) {\n if (Math.abs(this.player.pos.x - gem.pos.x) > th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send socket volatile message
function sendVolatileMessage (id, event, message) { if (!id) { server.logger.error("Error: null socket"); server.logger.error("Event: " + event); server.logger.error("Message: " + JSON.stringify(message)); return; ...
[ "function sendMessageToServer(message) {\n socket.send(message);\n }", "function emit(message) { // ...arguments\n\n if (!message) { console.warn(\"SocketHandler.emit\", \"Invalid message\"); return; }\n if (!ws) { console.warn(\"SocketHandler.e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
iOS Safari has a bug where inputs in iframes will not dismiss the keyboard when they lose focus. We create a hidden button input that we can focus on and blur to force the keyboard to dismiss. See 229
function performBlurFixForIos(container) { var hiddenInput; if (!browserDetection.isIos()) { return; } if (document.activeElement === document.body) { hiddenInput = container.querySelector('input'); if (!hiddenInput) { hiddenInput = document.createElement('input'); hiddenInput.type =...
[ "async function exitFocus() {\n xapi.Command.UserInterface.Extensions.Panel.Update({ PanelId: 'focus_on_me', Visibility: 'Auto' })\n xapi.Command.UserInterface.Message.Alert.Display({ Title: 'System Lost Focus', Text: 'Access to Webex Assistant and Ultrasound Pairing disabled', Duration: 5 })\n await GMM.write('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace 12 & 18 with 1221 and 1881
function replaceN() { numbers[numbers.indexOf(12)] = 1221; numbers[numbers.indexOf(18)] = 1881; }
[ "function sevenAte9 (str) {\n let result = str.replace(/(797)/g, '77')\n return result.replace(/(797)/g, '77')\n}", "function formatPhone(pre,cont){\n return '0'+pre+'-15-'+cont;\n}", "function convertPhone(phone) {\n const numbers = phone.match(/\\d/g);\n console.log(numbers)\n let fixe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the askProduct function uses an inquirer prompt to ask the user which item (from array of productIDs) that they want
function askProduct() { inquirer.prompt([ { type: "list", name: "productPrompt", message: "What is the ID of the product you want to buy?", choices: productIDs } ]).then(({ productPrompt }) => { connection.query("SELECT * FROM products WHER...
[ "function productChoices() {\n inquirer\n .prompt([\n {\n type: \"input\",\n message: \"What is the ID of the product you would like to buy?\",\n name: \"productID\"\n },\n {\n type: \"input\",\n me...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Asigna el evento onChange al o los inputfile especificados en el config
function inputFileOnChange () { $(config.inputfile).on('change', $('body'), function(event) { parent = $(this).parent(); submitForm(); }); }
[ "async fileInputChanged () {\n Doc.hide(this.errMsg)\n if (!this.fileInput.value) return\n const loaded = app().loading(this.form)\n const config = await this.fileInput.files[0].text()\n if (!config) return\n const res = await postJSON('/api/parseconfig', {\n configtext: config\n })\n l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION START IS BEING CALLED, IT CREATES A DIV VARIABLE THEN FOR LOOP RUNS IT 25 TIMES ADDS ONE EACH TIME(LETTERS) VAR ELEMENT WITH "LET" VALUE IS CREATED, DIV IS CALLED AND NEW VALUE IS ASSIGNED TO IT IF STATEMENT IS CREATED THAT RETURNS THE DIVISON REMINDER WHICH CREATES 7 ROWS OF LETTERS AND CSS IS ADDED TO CLEAR ...
function start(){ var div = ""; for ( i = 0; i < 25; i++) { var element = "let" + i; div = div + '<div class = "letter" onclick = "check('+i+')" id="'+element+'">'+letters[i]+'</div>'; if ((i + 1) % 7 == 0) div = div + '<div style = "clear:both;"></div>'; } document.getElementById("alphabet").innerHTML = div;...
[ "function start()\r\n{\r\n \r\n let div_content =\"\";\r\n \r\n for (i=0; i<=11; i++)\r\n {\r\n let element = \"number\" + i;\r\n div_content = div_content + '<div class=\"letter\" onclick=\"run('+i+')\" id=\"'+element+'\">'+numbers[i]+'<br>'+letter[i]+'</div>';\r\n if ((i+1) % 3...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Select many to many association from paramsArray ojbect
function performManyToManySelect(client, rows, entity, callback) { if (!entity || !entity.manyToMany) { callback(null, rows); return; } var m2ms = entity.manyToMany; var totalm2ms = Object.keys(m2ms).length; var inArray = new Array(); for ( var i = 0; i < rows.length; i++) { inArray.push(rows...
[ "getObjectIDs() {\n let res = [];\n this.state.selectedCourses.map(function(info) {\n res.push(info._id);\n })\n return res;\n }", "findStudentCourses(courseArray){\r\n \tlet studentCourseList = [];\r\n \tfor(let courseName of courseArray){\r\n studentCou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns dynamic handler that can change the response depending on the request
getDynamicMockHandler (options) { const { uri, method, handler } = options; logService.info(reqFm(method, this.port, uri), '(dynamic)'); return (req, res) => { requestLogService.setEntryType(req.id, 'dynamic'); return handler(req, res); }; }
[ "function handlerMaker( type ) {\n\t\tvar input;\n\t\tif (\"post\" === type ) {\n\t\t\tinput = \"body\";\n\t\t} else if ( \"get\" === type ) {\n\t\t\tinput = \"query\";\n\t\t}\n\n\t\treturn function ( req, res ) {\n\t\t\t// get the error code\n\t\t\tvar errorCode = parseInt( req[input].error, 10 );\n\t\t\tif ( !err...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return 3 random words from the given category.
function getRandomWordsForCategory(category, numberOfWords) { if (numberOfWords === undefined) { numberOfWords = 3; } const categoryFile = getFileForCategory(category); if (categoryFile === null) { return null; } const contents = fs.readFileSync(c...
[ "function generateWords() {\n words = _.sampleSize(wordList, 3);\n}", "function generateRandomWord(category, level) {\n if (category === \"dictionary\") {\n getWordApi(level);\n } else {\n getLocalWord(level, category);\n }\n }", "function getWord() {\n for (let...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getting members Jason // and then loading page
function gettingJasonMembersObj(event) { const savedMembers = JSON.parse(event.target.responseText); appData.members = savedMembers.members jsonsState.push('true'); addLabelColors(); //checking only two since i have only 2 AJAX calls checkIfCanLoadPage(); // firstLoad(); // // firstLoad(); // for (...
[ "function getStaffByGender(url)\n {\n \n jQuery.getJSON( url, function( response ){\n\n var profileHTML = '<ul class=\"inst-profile\">';\n $.each(response, function(index, profile){\n if(jQuery.isEmptyObject(profile)){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a statement to the policy document.
addStatements(...statement) { this.document.addStatements(...statement); }
[ "addToPrincipalPolicy(statement) {\n return this.role.addToPrincipalPolicy(statement);\n }", "add(statement) {\n this.statements.push(statement);\n return this;\n }", "createStatement(statementData) {\n let statement, {\n subjectName, subjectID, verbDisplay, objectID, objectTy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If you call `enableDefaultRegistry`, any new elements will autoregister with the provided registry as soon as they're constructed.
static enableDefaultRegistry(registry) { Registry.defaultRegistry = registry; }
[ "reset() {\n this._registry = new Map();\n }", "register(elem, id) {\n id = id || elem.getAttribute('id');\n\n if (!id) {\n throw new X(\"Can't add element without `id` attribute to registry\", elem);\n }\n\n // Manually add id to index, then update other indexes.\n elem.setAttribute('id',...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
David, Eric is this right? Extracts CHCS Patient Lab results from a CHCS JSONLD object
function extractLabs(chcsJsonldObject) { if (_.isUndefined(chcsJsonldObject)) { throw Error("Cannot extract CHCS labs because patient data object is undefined!"); } return _.filter(chcsJsonldObject['@graph'], function(json) { return /c(hc|mump)ss:Lab_Result-63/.test(json.type); ...
[ "function _parseSearchResultInitialData(responseText, callback) {\n var re = /{.*}/;\n\n var $ = _cheerio.load(responseText);\n\n var initialData = $('div#initial-data').html() || '';\n initialData = re.exec(initialData) || '';\n\n if (!initialData) {\n var scripts = $('script');\n\n for (var i = 0; i < ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Combines a route and data object into a proper URL hash fragment
function setRoute(route, dataObj) { var path = route, data = []; if (dataObj !== null && dataObj !== undefined) { path += "?"; for (var prop in dataObj) { if (prop !== 'undefined' && dataObj.hasOwnProperty(prop)) { data.push(prop + '=' + encodeURIComponent(dataO...
[ "function setHash(props) {\n var currentObj = getObjectFromHash(window.location.hash);\n var newObject = Object.assign(currentObj, props);\n window.location.hash = objectToHash(newObject);\n}", "updateHash(slug) {\n window.location.hash = slug;\n }", "function buildUriSpec(data) {\n var uriSpec = ''...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turns hex to RGB so we can compare colorPicker.value (given in hex) to cell.style.backgroundColor (given in RGB)
function hexToRGB(h, cell) { let r = 0, g = 0, b = 0; let rgb = ''; h = colorPicker.value; // 3 digits if (h.length == 4) { r = "0x" + h[1] + h[1]; g = "0x" + h[2] + h[2]; b = "0x" + h[3] + h[3]; // 6 digits } else if (h.length == 7) { r = ...
[ "function colorCheck(rgb, cell) {\n if (cell.style.backgroundColor == rgb) {\n cell.style.backgroundColor = '';\n cell.className = '';\n } else {\n cell.style.backgroundColor = colorPicker.value;\n }\n}", "hex2rgb(hex) {\n var h=hex.replace('#', '');\n h = h.match(new ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if the map is full returns true if there are no empty cells and false otherwise
isFull() { return (this.emptyCells.size() == 0); }
[ "isFull() {\n return this.size == this.maxSize;\n }", "function checkFullRow() {\n var fullRows = [];\n\n for (i = 0; i < 20; i++) {\n if (boardStatus[i].includes(0) === false) {\n console.log('Row ' + i + ' is completely full');\n fullRows.push(i);\n }\n }\n return fullRows;\n}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines if the topology description has any known servers
get hasKnownServers() { return Array.from(this.servers.values()).some(sd => sd.type !== ServerType.Unknown); }
[ "IsRemoteConfigured() {\n\n }", "function checkServer(callback){\n\tps.lookup({command:config.webserverExecCmd},(err,result)=>{\n\t\tconsole.log(result)\n\t\tif(result.length>0) callback(true);\n\t\telse callback(false);\n\t});\n}", "hasMultipleConnections() {\n let result = false;\n this.getCo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Escapes special characters in attribute values See `str` the string to escape
attEscape(str) { var ampregex; if (this.options.noValidation) { return str; } ampregex = this.options.noDoubleEncoding ? /(?!&(lt|gt|amp|apos|quot);)&/g : /&/g; return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/\t/g, '&#x9;').r...
[ "function escape_xml (str) {\n\t return (\"\"+str).replace(/&/g, \"&amp;\")\n\t .replace(/\"/g, \"&quot;\")\n\t .replace(/\"/g, \"&quot;\")\n\t .replace(/</g, \"&lt;\")\n\t .replace(/>/g, \"&gt;\")\n\t .replace(/'/g, \"&#039;\");\n\t}", "enc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a dictionary and an M x N board where every node has one character.Find all possible words that can be formed by a sequence of adjacent characters.Note that we can move to any of 8 adjacent characters, but a word should not have multiple instances of the same node. Example: // Input: let dictionary = ["GEEKS", "F...
function findWords(board, words) { const root = buildTrie(words); let res = []; for (let i = 0; i < board.length; i++) { for (let j = 0; j < board[0].length; j++) { searchWord(root, i, j, board, res); } } return res; }
[ "function findWordsOnBoard()\n{\n var x,y;\n resetFoundWordList();\n heatMapReset();\n\n // Make sure a dictionary is loaded\n if (wordTree != null) {\n for (x = 0; x < boardTiles.length; x++) {\n for (y = 0; y < boardTiles[x].length; y++) {\n\n // Feed in :\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
d3 functions D3 Function to create stacked bar chart from Json input
function createStackedBarChart(jsonObj) { // create new svg var svg = d3.select("svg"), margin = {top: 20, right: 20, bottom: 30, left: 40}, width = +svg.attr("width") - margin.left - margin.right, height = +svg.attr("height") - margin.top - margin.bottom, g = svg.append("g").attr("transform",...
[ "function SVGStackedRowChart() {\n}", "function barchart(selectedID){\n d3.json(\"data/samples.json\").then((data) => {\n var dropdownMenu = d3.select(\"#selDataset\");\n selectedID = dropdownMenu.node().value;\n var samples = data.samples;\n var selectID = samples.filter(person=>person.id==selecte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
walk all shadowRoots on a given node.
function forRoots(node, cb) { var root = node.shadowRoot; while(root) { forSubtree(root, cb); root = root.olderShadowRoot; } }
[ "function walkViewTree(rootView, fn) {\n let visit_ = view => {\n fn(view);\n\n let nsArray = view.subviews();\n let count = nsArray.count();\n for (let i = 0; i < count; i++) {\n visit_(nsArray.objectAtIndex(i));\n }\n };\n\n visit_(rootView);\n}", "function walk(node) \n{\n // declarin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is getting called when saving the ANSI, and exports the asciis by saving the decimal values of the screen into a file
function myexport() { cursorY=firstLine; var html=""; while (cursorY+1<height) { var lineWidth=getDisplayWidth()-1; lineAsciiCode=screenCharacterArray[cursorY][lineWidth][0]; l...
[ "export() {\n let data = [];\n let totalAnimationSteps = this.stepCount + 1;\n\n writeUint8(totalAnimationSteps, data);\n \n for (var i = 0; i < totalAnimationSteps; i++) \n {\n\n let totalColorsInCurrentStep = Object.keys(this.colors[i]).length;\n\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to read in the matchID, and playerID, Draw the hero info and extra stats Paint the plotly graph Prepare the on_click statistics to display when the graph is clicked
function gameAdvantageGraph(matchID,playerID) { matchURL = `${baseURL}/matches/${matchID}` console.log(matchURL) d3.json(matchURL).then(function(match){ //Find the players team and index for (var i = 0 ; i < match.players.length ; i ++) { if (match.players[i].account_id === playe...
[ "function handleReadMatchstats() {\n var id = localStorage.getItem(\"datetime\");\n var themQuery = firebase.database().ref('/Games/' + id + '/stats/them');\n var usQuery = firebase.database().ref('/Games/' + id + '/stats/us');\n\n usQuery.once(\"value\").then(function(snapshot){\n var foulFor = snapshot.chi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a new ``address`` type for %%v%%.
static address(v) { return new Typed(_gaurd, "address", v); }
[ "function encode_addr(v) {\n if (!isString(v) ||\n !(v.length === 0 || v.length === 40)) {\n throw new Error(\"Address must be empty or 40 chars long\");\n }\n return decodeHex(v);\n }", "function decode_addr(v) {\n if (!(v.length === 0 || v.length === 20))...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
moves the key at index i up recursively, until the heap property is satisfied.
function _heap_increase_key(i){ var parent = _parent(i); // swap with parent until max-heap or min-heap property is not satisfied. while(i > 1 && _compare(_array[parent], _array[i]) > 0 ){ _swap(parent, i); i = parent; parent = _parent(i); } }
[ "heapUp(index) {\n\n if (index === 0) {\n return;\n }\n\n const childNode = this.store[index];\n let parentIndex;\n if (index % 2 === 0) {\n parentIndex = (index - 2) / 2;\n } else {\n parentIndex = (index - 1) / 2;\n }\n\n const parentNode = this.store[parentIndex];\n\n if (c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cours Related Functions ALL COURSES finding the count of courses
static async countCourses(){ const result=await pool.query('SELECT COUNT(coursecode) AS count FROM course'); return result[0].count; }
[ "function committees(x, conf){\n\t\tif (conf == undefined){\n\t\t\treturn x.committees.length;\n\t\t} else {\n\t\t\tvar count = 0;\n\t\t\tfor (var i=0; i < x.committees.length; i++){\n\t\t\t\tvar committee = x.committees[i];\n\t\t\t\tif (committee.conference.series == conf && withinRange(committee)){\n\t\t\t\t\tcou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Count mix entries by filter.
static count(filter = null){ let kparams = {}; kparams.filter = filter; return new kaltura.RequestBuilder('mixing', 'count', kparams); }
[ "static count(filter = null){\n\t\tlet kparams = {};\n\t\tkparams.filter = filter;\n\t\treturn new kaltura.RequestBuilder('baseentry', 'count', kparams);\n\t}", "static count(filter = null){\n\t\tlet kparams = {};\n\t\tkparams.filter = filter;\n\t\treturn new kaltura.RequestBuilder('cuepoint_cuepoint', 'count', k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function Change Circle Mouse
function changeCircle() { dsnGridMouseChange('a', 'override-circle'); dsnGridMouseChange('.site-header a', 'override-circle-none'); }
[ "function mouseclicks()\n{\n //mouse makes yellow dot\n fill(255,255,0);\n circle(mousex, mousey, d);\n \n}", "function mouseDragged(){\ncircles.push(new Circle(mouseX, mouseY));\n}", "function circlePos() {\n var color;\n switch (toggle) {\n case 0:\n color = blue;\n break;\n cas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The book doesn't specify whether or not we have a singlylinked list or a doublylinked list, so I'm going to code as if it's doublylinked first. A palindrome is a list or string that has the the same values in the same order going forwards or backwards. In other words, if you reverse the string or list, you should still...
function isPalindrome(theList) { if(theList == null) return false; //set up the nodes; counter counts the number nodes in the list - I'm assuming that info isn't given to us var listStart = theList, listEnd = theList, counter = 0; while(listEnd.next != null) { listEnd = listEnd.next; counter++; } ...
[ "function isListPalindrome1(l) {\n // creating array from list\n // checking if array is palindrome\n // N time, N space\n if (!l) return true;\n let current = l;\n let arr = [];\n while (current) {\n arr.push(current.value);\n current = current.next;\n }\n if (arr.length <= 1) return true;\n for (l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reduce an array of type definitions to a single type definition, which has merged all properties in order.
function collapse(typeDefs) { var collapsed = typeDefs.reduce(function (a, b) { var result = {}; copyKeys(result, a); copyKeys(result, b); // Special case: Do a merge, e.g. on "model" TO_MERGE.forEach(function (k) { ...
[ "addTypes(types) {\n for (const [key, value] of Object.entries(types)) {\n this.addType(key, value);\n }\n return this;\n }", "static getPrimaryType(types) {\n return TypedDataEncoder.from(types).primaryType;\n }", "function mergedTypeValuesOf(entities) {\n cons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import Frame from "./JSComponent/admin/frames/index"
function Admin() { return ( <div></div> // <Frame> // <Helmet> // <meta charSet="utf-8" /> // <title>Admin | ModestFun的个人博客</title> // <link rel="icon" href={fileIp.defaultIp + "/img/?name=logo"} /> // </Helmet> // <Switch> // { // adminRoutes.map(ro...
[ "ImportComponent(string, string) {\n\n }", "function index() {\n return (\n <div>\n <ShowHome />\n </div>\n )\n}", "if (!moduleName.startsWith('.')) {\n return `/${moduleName}`;\n }", "function IndexPage() {\n return (\n <div >\n {/* <Demo1/> */}\n home\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To fetch data arg1 var(string):: db url arg2 boolean:: wrap the data inside an array arg3 var(string):: errorcatch message
fetchDatafromDatabase(url, wrapArray, catch_err_msg) { fetch(url) .then((response) => { if (!response.ok) { throw Error(response.statusText); } return response; }) .then((response) => response.json()) .then((data) => { if (wrapArray === tru...
[ "function fetchOptionData(){\n limit = limitData[city];\n pageLimit = pageLimitData[city];\n page_number = pageNumberData[city];\n\n order = orderData[city];\n sortColId = sortColIDData[city];\n sortColNumber = sortColNumberData[city];\n \n}", "function applyDataFromPreviousPage(from,opt,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a new ``bytes2`` type for %%v%%.
static bytes2(v) { return b(v, 2); }
[ "static bytes(v) { return new Typed(_gaurd, \"bytes\", v); }", "static bytes22(v) { return b(v, 22); }", "static bytes8(v) { return b(v, 8); }", "static bytes23(v) { return b(v, 23); }", "static bytes25(v) { return b(v, 25); }", "static bytes9(v) { return b(v, 9); }", "static bytes24(v) { return b(v, 24...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prints 0 limit string length
function solution(string, limit) { if (string.length <= limit) { console.log(string); } else { console.log(string.slice(0, limit) + `...`); } }
[ "function getLength(string){\n\n\n}", "function limitWidth(string, len) {\n var lines = string.split('\\n');\n len = (typeof len === 'number') ? len : 80;\n var chars;\n for (var i = 0; i < lines.length; i++) {\n if (lines[i].length > len) {\n chars = lines[i].split('');\n lines[i] = lines[i].sli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the constructor function for the EnvironmentManager class, this class is responsible for managing the background
function EnvironmentManager() { Manager.call(this); }
[ "function setupEnviroment() {\n // Skybox\n const urls = ['./assets/img/skybox/px.png', './assets/img/skybox/nx.png', './assets/img/skybox/py.png', './assets/img/skybox/ny.png', './assets/img/skybox/pz.png', './assets/img/skybox/nz.png'];\n const skybox = new THREE.CubeTextureLoader().load(urls);\n scen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
member function buildRight() makes the player build under themself while moving right
buildRight(){ if(!this.canJump || this.ammo <= 0) return; this.moveRight(); var bpos = snapPoint(this.pos.plus(new vec2(0.4, 1).multiply(tilesize))); this.placeBlock(bpos); var dpos = this.tilePos().plus(vec2.right().multiply(tilesize / 1.5)); for(var i = blocks.length - 1; i >= 0; i--) if(blocks[i].c...
[ "moveRight() {\n\t\tsuper.moveRight(KEN_SPRITE_POSITION.moveRight, KEN_IDLE_ANIMATION_TIME, false, MOVE_SPEED);\n\t}", "function moveRight(){\r\n unDraw();\r\n const isAtRightEdge = current.some(index => (currentPosition + index) % width === (width-1));\r\n if (!isAtRightEdge){\r\n currentPo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show task() method i susded for show the valu inouted by user in the form of a table .........
function show_task () { document.getElementById('inp-task').value=''; html = ""; html+= "<table id='table-design'> <tr> <th>Sr-No </th> <th>Done/panding </th><th>Task-Name</th> <th>Edited Content</th><th>Action</th>"; for (var i=0; i<arr_for_task.length; i++) { html+="<tr> <td>"+(i+1)+"</td><td><input type='check...
[ "function generateTaskDetail(t) {\n // save selected task\n $scope.selectedTask = t;\n // save scroll position\n $scope.taskDetail.scrollTop = t.scrollTop;\n // Open task details state\n $scope.taskDetail.enabled = true;\n // show task det...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tokenizer for XML attributes
function tokenAttribute(stream, state) { var ch = stream.next(); if(ch == "/" && stream.eat(">")) { if(isInXmlAttributeBlock(state)) popStateStack(state); if(isInXmlBlock(state)) popStateStack(state); return ret("tag", "tag"); } if(ch == ">") { if(isInXmlAttributeBlock(state)) p...
[ "function AttributeTerm (text) {\n this._not = false;\n\n const parts = text.toLowerCase().split(':');\n this._name = parts[0];\n this._value = StringConvert.unquoteIfNecessary(parts[1]);\n\n this.not = (not) => {\n this._not = not;\n };\n\n this.isRelatedTo = (term) => {\n return (this._name === term....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets a bit mask to a int / uint
function bit_set( value, mask ) { value |= mask; return value; }
[ "function setBit(number,i) {\n\treturn number | (1 << i);\n}", "setMem(bitmask) {\n MMU.wb(regHL[0], MMU.rb(regHL[0]) | bitmask);\n return 16;\n }", "function setThirdBit(num) {\n\treturn (num | 4).toString(2)\n}", "function getBitFromByte(num, mask) {\n return Boolean(num & mask)\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Execute `callback` and update the `lastExec` timestamp.
function exec() { lastExec = Date.now(); callback.apply(self, arguments_); }
[ "run(callback) {\n let self = this;\n async.series([\n (xcallback) => {\n self.runInitScript(xcallback);\n },\n (xcallback) => {\n self.checkFilesInScriptsDir(xcallback);\n },\n (xcallback) => {\n self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Equivalent to project_position in project.glsl projects a user supplied position to world position directly with or without a reference coordinate system
function projectPosition(position, params) { const { viewport, coordinateSystem, coordinateOrigin, modelMatrix, fromCoordinateSystem, fromCoordinateOrigin } = normalizeParameters(params); const { geospatialOrigin, shaderCoordinateOrigin, offsetMode } = Object(_viewport_unifor...
[ "projection(other_vector) {}", "function worldToScreen(pos, camera) {\n var v = pos.clone();\n v.project(camera);\n v.x = window.innerWidth / 2 + v.x * (window.innerWidth / 2);\n v.y = window.innerHeight / 2 - v.y * (window.innerHeight / 2);\n return v;\n }", "project(x, y)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }