query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Returns `true` if any or a combination of this collection's permissions allow revoking `permission` from grantee.
mayRevoke(permission, granteePermissions = []) { return this._mayGrantOrRevoke('mayRevoke', permission, granteePermissions); }
[ "_mayGrantOrRevoke(functionName, newPermission, granteePermissions = []) {\n const newPerms = _.flatten(this._unwindParameters(newPermission));\n const ourPerms = this.permissions();\n return _.every(newPerms, (newPerm) => {\n return _.some(ourPerms, (ourPerm) => ourPerm[functionName](newPerm, gra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A custom implementation of setObjectNotExistsAsync object is always provided, and it does not matter if object was created or not. At the moment there is no way to distinguish between creation and no creation. We will see if this is sufficient.
setObjectNotExistsAsync(id, object, options) { return (0, rxjs_1.from)(this.bshb.getObjectAsync(id, options)).pipe((0, rxjs_1.switchMap)(obj => { if (!obj) { return (0, rxjs_1.from)(this.bshb.setObjectAsync(id, object)).pipe((0, operators_1.tap)(o => o._bshbCreated = true), (0, rxjs_...
[ "function setValueIfNotExists(obj, key, val) {\n if (obj === undefined)\n return;\n if (!(key in obj))\n obj[key] = val;\n}", "exists(objectHash) {\n return objectHash !== undefined\n && fs.existsSync(nodePath.join(Files.gitletPath(), 'objects', objectHash));\n }", "async notExist...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a function for switching to a different action panel
function mmrpg_action_panel(thisPanel, currentPanel){ // Switch to the event actions panel $('.wrapper', gameActions).css({display:'none'}); var newWrapper = $('#actions_'+thisPanel, gameActions); if (currentPanel != undefined){ newWrapper.find('.action_back').attr('data-panel', currentPanel); ...
[ "function mmrpg_action_panel(thisPanel, currentPanel){\n\n // Update the current panel in the game settings for reference\n gameSettings.currentActionPanel = thisPanel;\n\n // Switch to the event actions panel\n $('.wrapper', gameActions).css({display:'none'});\n var newWrapper = $('#actions_'+thisPa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes an array of elements (in this case 3 td elements). If all of the elements have the same value and are not blank we return true else return false It is important to note that checkRow does not care about what it is comparing. This is why the diangle rows works with this function.
function checkRow(row){ // since the element is just that. We wrap it with jquery so it is easier to use. var cell1 = $(row[0]).text(); // we grab the text value out of the first td element. if( cell1 && // does the first cell have a text value. remember if it is blank '' this will evaluate as ...
[ "function rowsChecker(puzzle){\n for(let i=0;i<9;i++){\n if(repeatsChecker(getRow(puzzle,i))===false){\n return false\n }\n }\n return true\n}", "function match3Column() {\n console.log('Checking column matches')\n for (let i = 0; i < width ** 2; i++) {\n if (i >= width ** 2 - width * 2) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private Method: inxbuild sorts network and builds netindex[0..255]
function inxbuild() { var i, j, p, q, smallpos, smallval, previouscol = 0, startpos = 0; for (i = 0; i < netsize; i++) { p = network[i]; smallpos = i; smallval = p[1]; // index on g // find smallest in i..netsize-1 for (j = i + 1; j < netsize; ...
[ "function setLinkIndexAndNum()\r\n {\r\n for (var i = 0; i < finalResult[1].length; i++)\r\n {\r\n if (i != 0 &&\r\n finalResult[1][i].source == finalResult[1][i - 1].source &&\r\n finalResult[1][i].target == finalResult[1][i - 1].target)\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return an array containing all the `id` property of the `assignedIssue` property for each issue with a `pull_request` property that is not `null`
get withPullRequest() { return issues.filter(obj => obj.pull_request !== undefined && obj.pull_request !== null) .map(obj => obj.id); }
[ "get withAssignee() {\n return issues.filter(obj => obj.assignee !== null)\n .map(obj => obj.id);\n }", "get ids() {\n return issues.map(obj => obj.id);\n }", "function getAssignmentDetails (arr) {\n var arrOut = []\n arr.forEach(element => {\n arrOut.push(element.id)\n })\n return arrOut\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert that an Output with the given properties exists in the CloudFormation template. By default, performs partial matching on the resource, via the `Match.objectLike()`. To configure different behavior, use other matchers in the `Match` class.
hasOutput(logicalId, props) { const matchError = (0, outputs_1.hasOutput)(this.template, logicalId, props); if (matchError) { throw new Error(matchError); } }
[ "hasResourceProperties(type, props) {\n const matchError = (0, resources_1.hasResourceProperties)(this.template, type, props);\n if (matchError) {\n throw new Error(matchError);\n }\n }", "templateMatches(expected) {\n const matcher = matcher_1.Matcher.isMatcher(expected)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The detune spread between the oscillators when sourceType === "fat". See [[FatOscillator.count]]
get spread() { if (this._getOscType(this._oscillator, "fat")) { return this._oscillator.spread; } else { return undefined; } }
[ "function getFarmersFoodGain() {\n return Math.floor(_varibale.foodGain.farmer * _varibale.other.tf * _varibale.population.farmers);\n} // get food consumed by farmers", "get speedVariation() {}", "removeDiscount() {\n var price = PriceList.beverages[this.beverageType];\n this.condiments.forEach(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to format the Xaxis for Latitude and Longtitude axises This function will set axis.tickDecimals number after the '.' and append the ' km' part to each tick label.
function kmFormatter(v, axis){ return v.toFixed(axis.tickDecimals) + " km"; }
[ "function formatXaxis(format) {\n\treturn d3.axisBottom(_xRange).tickFormat(d3.timeFormat(format));\n}", "function c_pinLbl2XAxisMidPt(xAxis, eleSpace, inPad, outPad) {\n\t// xAxis is the same as \"this\" \n\txAxis.selectAll('.tick').attr('transform', function(d, i) {\n\t\treturn 'translate(' + (outPad+(2*i+1)*el...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrive the zipcodea for the locations and set them in their marker data
function setPostal(markerArray) { markerArray.forEach(function(marker) { let lat = marker.getPosition().lat(); let lng = marker.getPosition().lng(); let url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='; url += lat; url...
[ "function createZipCodeZones(zipCodeData, zipp) {\n // create an object named options.\n // specify the callback for style, filter, and onEachFeature\n\n let options = {\n onEachFeature: onEachFeature,\n style: onStyle,\n filter: onFilter,\n };\n\n // create geojsonLayer Object. pass Chicago Zip Code ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Try to extract any extra information about why context creation failed
function onContextCreationError(error) { onError("WebGL context: ".concat(error.statusMessage || 'Unknown error')); }
[ "function validateContext(con) {\n}", "function getContext(){\n \n if(!domain.active || !domain.active.context){\n if(this.mockContext) return this.mockContext\n \n logger.error(\"getContext called but no active domain\", domain.active);\n logger.error(\"Caller is \", arguments...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build the search page listing of books
buildSearchPage() { const myBooks = this.books.getMyBooks(); if (this.searchedBooks === undefined) { return; } this.booksView.buildBookListing(this.searchedBooks, this.displayBook, myBooks); this.booksView.buildPagination(this.totalBooks, 100, this.currentPage, this.gotoPage, "topPagination");...
[ "function renderGoogleBookData(results){\n $(\".bookcls\").html(\"\");\n $(\".bookcls\").html(`<h2 class=\"conHead\">Books</h2>`);\n\n let html = '<ul class=\"content-list\">';\n results.forEach(function(value){\n \n html += `\n <li class=\"book-cls content-list-item\">\n <h1 class=\"booktitl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates and array of rows. Each row holds an array of images to place inside the row and the total width of that row. It converts a flat array of images into a matrix of rows and images.
generateRows(images, widths, perRowWidth) { const imagesCount = images.length; let rows = []; let totalWidth = 0; let baseLine = 0; // used as an "image index", we need this because we need to 'unflat' the images array while (baseLine < imagesCount) { const row = { ...
[ "function rowsX (board) {\n var rows = []\n\n for (var y = 0; y < 4; y++) {\n for (var z = 0; z < 4; z++) {\n var row = []\n for (var x = 0; x < 4; x++) {\n row.push(board[z][x][y])\n }\n rows.push(row)\n }\n }\n\n return rows\n}", "function getHorizontalPattern() {\n l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A simple data structure to represent the forms of the Tetrominoes.
function Tetromino() { this.matrices = []; // matrices[0] = 0 degrees rotation // matrices[1] = 90 degrees rotation // matrices[2] = 180 degrees rotation // matrices[3] = 270 degrees rotation this.ghostColor = "#000"; this.preview = []; // hold & next display }
[ "createTetronimo(position, type) {\n\t\tif (type === TETRONIMO_TYPES.RANDOM) {\n\t\t\ttype = this._randomType();\n\t\t}\n\n\t\tconst origin = new Block(position);\n\t\tconst blocks = this._createOtherBlocksAround(position, type);\n\t\tblocks.push(origin);\n\n\t\treturn new Tetronimo({ origin: origin, blocks: blocks...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A feed can contain a meta.
function FeedMeta(props) { var children = props.children, className = props.className, content = props.content, like = props.like; var classes = (0, _classnames.default)('meta', className); var rest = (0, _lib.getUnhandledProps)(FeedMeta, props); var ElementType = (0, _lib.getElementType)(Feed...
[ "function FeedMeta(props) {\n\t var children = props.children,\n\t className = props.className,\n\t content = props.content,\n\t like = props.like;\n\t\n\t\n\t var classes = (0, _classnames2.default)('meta', className);\n\t var rest = (0, _lib.getUnhandledProps)(FeedMeta, props);\n\t var ElementT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stops auto rotation and animated moves.
function stopAnimation() { animatedMove = {}; autoRotateSpeed = config.autoRotate ? config.autoRotate : autoRotateSpeed; config.autoRotate = false; }
[ "stopRotation() {\n this._options.rotation.enable = false;\n }", "function stopAnimation() {\n $(\"start\").disabled = false;\n $(\"stop\").disabled = true;\n document.querySelector(\"textarea\").disabled = false;\n clearInterval(timer);\n timer=null;\n $(\"readarea\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whichever of the two operator indexes exists, or if both exist, whichever is first (readying from the left), call applyOperator there
function decideOperators(opIndex1, opIndex2) { if (opIndex1 !== -1) { if (opIndex2 !== -1) { newStr = applyOperator( newStr, opIndex1 < opIndex2 ? opIndex1 : opIndex2 ); return evaluate(newStr); } else { newStr = applyOperator(newStr,...
[ "isOperator (op) {\n return this.isQueryOperator(op) || this.isLogicalOperator(op);\n }", "function precedence(op1, op2) {\n if (OPERATOR_PRECEDENCE[op1.type] > OPERATOR_PRECEDENCE[op2.type]) {\n return 1;\n } else if (OPERATOR_PRECEDENCE[op1.type] < OPERATOR_PRECEDENCE[op2.type]) {\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler called when the graph is finally loaded. As loading is asynchronous, this may be called already after the application has started the run loop
onGraphLoaded() { this.axis = new CGFaxis(this, this.graph.axis_length); this.loadAmbient(); this.loadBackground(); this.initLights(); // Adds lights group. this.interface.addLightsGroup(this.graph.light); // Adds camera options this.interface.addCameraOptions(this.graph.views); ...
[ "onGraphLoaded() {\r\n\r\n this.defaultView = this.graph.defaultView;\r\n this.initViews();\r\n\r\n this.camera = this.cameras[this.defaultView];\r\n this.interface.setActiveCamera(this.camera);\r\n\r\n this.axis = new CGFaxis(this, this.graph.referenceLength);\r\n\r\n this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Run CronJob to disable physics for dominoes to improve performance every 2 seconds
disablePhysicsCronjob() { if (Date.now()-this.lastCronJobTime > 2000) { this.lastCronJobTime = Date.now() for (let i = 0; i<this.dominoRigidBodies.length; i++) if (this.dominoRigidBodies[i][1].position.y <= 402) this.dominoRigidBodies[i][0].setMas...
[ "stop(){\n let cron = this.cron\n Object.keys(cron).map((cronName)=>{\n cron[cronName].stop()\n })\n return true\n }", "timeProcess(itself=(cov_50nz68pmo.b[1][0]++,this)){cov_50nz68pmo.f[3]++;cov_50nz68pmo.s[7]++;// define begin cooldown\ninitTime=new Date().getTime();// function to send clockBa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show trip details form to edit
function showTripDetailsToEdit(tripId) { $.ajax({ method: 'GET', url: `/trips/${tripId}`, headers: { Authorization: `Bearer ${authToken}` }, contentType: 'application/json', success: function(trip) { const startDate = formatDate(trip.startDate); const endDate = formatDate(trip.endDate); const c...
[ "function showTripDetails(trip) {\n\tconst content = `\t\n\t\t<section class=\"trip-details\">\n\t\t\t\n\t\t</section>\n\t`\n\t$('main').html(content);\n\t$('.trip-details').html(tripToHtml(trip, false));\t\n\t//$('.trip-info').html(tripToHtml(trip));\n}", "function setTripDetails() {\n\t\t\t\t\t// Trip Name\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
eslintenable camelcase Setup handling of events related to updates using the new updater.
function setupUpdaterEventsWithUpdater(updater) { _electron.app.on(_Constants.MenuEvents.CHECK_FOR_UPDATES, () => checkForUpdatesWithUpdater()); _ipcMain.default.on(_Constants.UpdaterEvents.CHECK_FOR_UPDATES, () => { return checkForUpdatesWithUpdater(updater); }); _ipcMain.default.on(_Constant...
[ "InstallMultipleEventClasses() {\n\n }", "function onUpdate(fromVersion, toVersion) {\n\tconsole.log('Extension has been updated from version ', fromVersion, ' to version ', toVersion);\n}", "setupServerEventHandlers() {\n const self = this;\n\n this.server.onTitleScreenUpdates(function(info) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrieves the resource mapper object
get resourceMapper() { return this._resourceMapper; }
[ "function getResource() {\n r = $resource(OpenmrsSettings.getContext() + \"/ws/rest/v1/location/:uuid\",\n {uuid: '@uuid'},\n {query: {method: \"GET\", isArray: false}}\n );\n return new dataMgr.ExtendedResource(r,true,resourceName,false,\"uuid\",null);\n }", "async resource(resour...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the cell by its id and updates the border's style to show that it's selected
function updateCellBorder() { newCell = document.getElementById(`cell-${selectedCell[0]}-${selectedCell[1]}`); newCell.style.border = selectedBorder; }
[ "function markCell(){\r\n\tdocument.getElementById(\"selected\").style.backgroundColor = \"yellow\";\r\n}", "function cellClick(id) {\n\n\tplayerMove = id.split(\",\");\n\tif (playerMove[0] == currentCell[0] && playerMove[1] == currentCell[1]) {\n\n\t\tvar cellClicked = document.getElementById(id);\n\t\tcellClick...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this makes the results div invisible and 'unclickable'
function hideResult() { resultWrapper.css("opacity", 0) resultWrapper.css("pointer-events", "none") }
[ "function showResults(){\n\t\tdocument.getElementById(\"resultsArea\").style.display=\"block\";\n}", "function hideResults() {\n $('.js-search-results').hide();\n}", "function searchtoresults()\n{\n\tshowstuff('results');\n\thidestuff('interests');\t\n}", "function displayNoResults() {\n\t\t\t\tmoreLikeThisB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find commmon ancestor between 2 paths
function commonAncestor(pathA, pathB, debug = false) { // make sure there are absolute if (pathA) pathA = path.resolve(pathA) if (pathB) pathB = path.resolve(pathB) if (!pathA) return pathB if (!pathB) return pathA let cnt = 0 // nb of common ancestor const a = split(pathA) const b = sp...
[ "isAncestor(path, another) {\n return path.length < another.length && Path.compare(path, another) === 0;\n }", "async getChildLocationAncestorFromPath(inpPath) {\r\n // Get the ID to open\r\n const { ID, path } = this.getExtractID(inpPath);\r\n // Get the ancestor itself\r\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a random unfinished page from the database
function getRandomPage() { return new Promise(function(resolve, reject) { var query = {state: {$ne: "done"}}; // First retrieve count, then use count to retrieve random page Page.count(query).exec(function(err, count) { if (err) { reject(err); } // Query just based on state Page.findOne(...
[ "function getPage(n) {\n return new Promise(function(resolve, reject) {\n // Query based on state and number of differences\n var query = {state: {$ne: \"done\"}, $where: \"this.differences.length > \" + n};\n // First retrieve count, then use count to retrieve random page\n Page.count(query).exec(func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns information about the user
function getUserInfo() { return user; }
[ "function getUserInfo(username) {\n fetch(`https://api.github.com/search/users?q=${username}`)\n\t.then(response => response.json())\n\t.then((responseObject) => {\n renderObject(responseObject)\n })\n}", "function getUserInfo() {\n\ttry {\n\t\treturn os.userInfo();\n\t} catch (e) {\n\t\t/* istanbul ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save searches to local storage
function storeSearches() { localStorage.setItem("storedSearches", JSON.stringify(storedSearches)); }
[ "function storeSearchHistory() {\nlocalStorage.setItem(\"searchHistory\", JSON.stringify(userSearchArray))\n}", "function checkSavedSearches() {\n var checkStorage = JSON.parse(localStorage.getItem(\"saved\"));\n if (checkStorage !== null) {\n searchStorage = checkStorage;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `VirtualRouterServiceProviderProperty`
function CfnVirtualService_VirtualRouterServiceProviderPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected a...
[ "function CfnGatewayRoute_GatewayRouteVirtualServicePropertyValidator(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('Exp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds new media entry by importing the media file from a search provider. This action should be used with the search service result.
static addFromSearchResult(mediaEntry = null, searchResult = null){ let kparams = {}; kparams.mediaEntry = mediaEntry; kparams.searchResult = searchResult; return new kaltura.RequestBuilder('media', 'addFromSearchResult', kparams); }
[ "static add(entry){\n\t\tlet kparams = {};\n\t\tkparams.entry = entry;\n\t\treturn new kaltura.RequestBuilder('externalmedia_externalmedia', 'add', kparams);\n\t}", "static addFromUrl(mediaEntry, url){\n\t\tlet kparams = {};\n\t\tkparams.mediaEntry = mediaEntry;\n\t\tkparams.url = url;\n\t\treturn new kaltura.Req...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start a new task with the given options in next tick.
static start(options = {}) { const task = new this(options); process.nextTick(() => { task.start().catch(err => { throw err; }); }); return task; }
[ "function runTask(taskName, initialOptions) {\n var task = tasks[taskName];\n var currentStep = 0;\n if (!task) {\n log.error(colors.fatal('Non-existent task requested: ') + colors.normal(taskName));\n fail();\n return null;\n }\n var steps = task.getSteps();\n var stepDefaults = task.getStepDefaults...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get one thought by id
getThoughtById({params}, res) { Thought .findOne({_id: params.thoughtId}) .then(dbThoughtData => { if (!dbThoughtData) { res.status(404).json({message: 'No thought found with this id!'}); return; } re...
[ "getTrainerById(id) {\n logger.debug(`get trainer by id: ${id}`);\n return this.store.findOneBy(this.collection, {\n id: id\n });\n }", "function getDrink( id ) {\n return rp( {\n url: \"http://www.thecocktaildb.com/api/json/v1/1/lookup.php?i=\" + id,\n json: true\n }).then(func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inject link to larger image
function injectEnlargeLink() { //---------------------------- // Get profile image link //---------------------------- var imageContainer = getProfileImageContainer(); //---------------------------- // No image? //---------------------------- if ( ! imageContainer.length ) { ...
[ "function load_image( href ) {\n\t\t\tvar image = new Image();\n\t\t\timage.onload = function() {\n\t\t\t\treveal( '<img src=\"' + image.src + '\">' );\n\t\t\t}\n\t\t\timage.src = href;\n\t\t}", "function insertIMGlinks() {\n //LOGGER.debug(\"FMA insertIMGlinks Function Executing\");\n let imgsrc = $('#imag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Append the Product Sku to Product Hero dropdown list
function inputProducts(data){ data = sortAsc(data, "name") var htm = selectInput(data, "_id", "name") $('select[role="product-list"]').each(function() { $(this).html(htm); }); var template = $('#heroTemplate').html().replace('<option value="0" disabled="">Select One...</option>', htm); $('#heroTemplate'...
[ "function showSelectManufacturer() {\n var msg = callAPI(uRLBase + \"Manufacturer\", \"GET\");\n $('#commodity-owner').html('<option value=\"\"> --- Chọn nhà sản xuất ---</option>');\n\n if(msg)\n {\n $.each(msg, function(key, value){\n var newRow = '<option value=\"' + value['$class'] + '#' +value['tra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets cache after time interval 12 hours used to free memory
function resetCacheInterval() { const hourDiff = dayjs().diff(cacheResetTime, 'hours') log('LOG (temp): Last Reset', cacheResetTime.format()) if (hourDiff >= 12) { log('LOG: reset full cache timer') // empty cache cache = {} // reset start time cacheResetTime = dayjs() } }
[ "invalidateColonyCache() {\n\t\tlet lastTick = this.memory.cache.lastTick ? this.memory.cache.lastTick : 0;\n\t\tlet cacheTime = Game.time - lastTick;\n\t\tthis.memory.cache = {};\n\t\tthis.memory.cache.lastTick = Game.time;\n\t\tLogger.log(\"clearing colony cache for \" + this.name + \" after \" + cacheTime + \" t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create queue, upload MARC, process spool, load the newly created queue
function batchUpload() { var queueName = dijit.byId('vl-queue-name').getValue(); currentType = dijit.byId('vl-record-type').getValue(); var handleProcessSpool = function() { if( vlUploadQueueImportNoMatch.checked || vlUploadQueueAutoOverlayExact.checked || vlU...
[ "function createQueue(queueName, type, onload, importDefId) {\n var name = (type=='bib') ? 'bib' : 'authority';\n var method = 'open-ils.vandelay.'+ name +'_queue.create'\n fieldmapper.standardRequest(\n ['open-ils.vandelay', method],\n { async: true,\n params: [authtoken, queueN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Text to Xml to Workspace Translation
function toXml() { var xml = Blockly.Xml.workspaceToDom(workspace); tarea.value = Blockly.Xml.domToPrettyText(xml); tarea.dispatchEvent(keyboardEvent); //Simulate Keypress }
[ "function StringToXML(txt) {\n\tif (window.DOMParser) {\n\t\t// code for Chrome, Firefox, Opera, etc.\n\t\tparser=new DOMParser();\n\t\txml=parser.parseFromString(txt,\"text/xml\");\n\t} else {\n\t\t// code for IE\n\t\txml=new ActiveXObject(\"Microsoft.XMLDOM\");\n\t\txml.async=false;\n\t\txml.loadXML(txt); \n\t};\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when the player collects a coin, play a sound, kill coin, update score
function collectCoin(player, Coin){ CoinPU.play(); Coin.kill(); coinsCollected+=1; }
[ "takeCoin(player, coin){\n coin.kill();\n }", "function collectFuel(){\n powerUpSound.play();\n playerFuel += 20;\n if(playerFuel > 100){\n playerFuel = 100;\n }\n updateFuel();\n}", "function updateYouLost() {\r\n if ( slotIds.indexOf(board[clickCount]) > -1 ) { //you're in a slot;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Defining a normal function getMessage
function getMessage() { return "I am normal function"; }
[ "function message(exn) /* (exn : exception) -> string */ {\n return exn_message(exn);\n}", "function returnMessage(x) {\n return x;\n}", "get message() {\n return this.result.message;\n }", "createMessage(){\n let message = ((this.formData.name !==\"\") ? (\"Mr/Ms \"+this.formData....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
uu.audio.create create audio element
function uuaudiocreate(placeHolder) { // @param Node(= <body>): placeholder Node // @return Node: new element var audio = uu.node(uu.ie ? "AUDIO" : "audio"); // [IE][!] need upper case placeHolder || (placeHolder = doc.body.appendChild(uu.node())); // <body><div /></bo...
[ "createAudio() {\n // create an AudioListener and add it to the camera\n let listener = new THREE.AudioListener();\n this.camera.add(listener);\n\n // create a global audio source\n this.sound = new THREE.Audio(listener);\n }", "function createAudioElement(blobUrl, type) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the Babel `NodePath` that can be used to reference the lexical scope where any shared constant statements would be inserted. There will only be a shared constant scope if the expression is in an ECMAScript module, or a UMD module. Otherwise `null` is returned to indicate that constant statements must be emitted...
getConstantScopeRef(expression) { // If the expression is of the form `a.b.c` then we want to get the far LHS (e.g. `a`). let bindingExpression = expression; while (t.isMemberExpression(bindingExpression)) { bindingExpression = bindingExpression.object; } if (!t.isIde...
[ "getConstantStatements() {\n const importGenerator = new LinkerImportGenerator(this.ngImport);\n return this.constantPool.statements.map(statement => this.translator.translateStatement(statement, importGenerator));\n }", "function analyze_constant_declaration(stmt) {\n const name = constant_de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a buffer containing the command message, and enqueues it for transmission. Parses and error checks the deviceId, converting group commands appropriately.
_sendCommand(deviceId, command, callback) { const device = this._splitDeviceId(deviceId); if (device.unitCode === 0) { command = command + 2; } let buffer = [device.idBytes[0], device.idBytes[1], device.idBytes[2], device.houseCode, device.unitCode, command, 0, 0,...
[ "sendCommand (name, deviceId, remoteType, groupId, command) {\n if (this.mqttClient) {\n var path = this.mqttTopicPattern.replace(':hex_device_id', '0x' + deviceId.toString(16).toUpperCase()).replace(':dec_device_id', deviceId).replace(':device_id', deviceId).replace(':device_type', remoteType).replace(':gr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds by raycasting the figure which was clicked and calls the appropriate Javamethods in the Spiellogikplugin.
function findAndProcessClicked(event) { var vector = new THREE.Vector3( (event.clientX / renderer.domElement.width) * 2 - 1, -(event.clientY / renderer.domElement.height) * 2 + 1, 0.5); projector.unprojectVector(vector, camera); var ray = new THREE.Ray(camera.position, vector.subSelf(camera.position) ...
[ "function clickOnPoint() {\n var x = 58,\n y = 275;\n _DygraphOps[\"default\"].dispatchMouseDown_Point(g, x, y);\n _DygraphOps[\"default\"].dispatchMouseMove_Point(g, x, y);\n _DygraphOps[\"default\"].dispatchMouseUp_Point(g, x, y);\n }", "onLayerClick() {}", "attachEvents() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function add the overlay element to the graph when mouse interaction takes place need to call this after drawing the lines in order to put mouse interaction overlay on top
function addOverlay() { //the graph rectangle area chartRect = mainChart.append('rect') .attr('class', 'chartOverlay') .attr('width', width) .attr('height', height) .on('mouseover', function () { ...
[ "function addOverlay() {\n console.log('add OVERLAY');\n $('body').append('<div class=\"overlay\"></div>');\n }", "drawOverlay(updateStepDuration) {\n if (this.colorchartShown) {\n this.drawOutline()\n }\n\n // Apply new data and obtain selections\n let [enterSel, upd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chapter 101 RopeGroup Player threatens amelia to try stopping her.
function C101_KinbakuClub_RopeGroup_TryStopMe() { if (ActorGetValue(ActorSubmission) <= 0) { C101_KinbakuClub_RopeGroup_CurrentStage = 125; OverridenIntroText = GetText("StoppingYou"); } else LeaveIcon = "Leave"; }
[ "function C006_Isolation_Yuki_CheckToStop() {\n\n\t// Yuki doesn't allow the player to stop if she has the egg\n\tif (C006_Isolation_Yuki_EggInside) {\n\t\tOverridenIntroText = GetText(\"NoPullEgg\");\n\t\tC006_Isolation_Yuki_CurrentStage = 200;\n\t\tC006_Isolation_Yuki_AllowPullBack = false;\n\t}\n\n\t// Yuki does...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns number of timeseries in request
function getNumberOfTimeSeries(desc) { if (!desc || $.isEmptyObject(desc)) return 0; var nTimeSeries = 1; for (var i = 0; i < desc.Stub.length; i++) { var dim = desc.Stub[i]; nTimeSeries = nTimeSeries * dim.Members.length; } return nTimeSeries; }
[ "getNumSongs(data) {\n let num = 0;\n data.sets.set.forEach((set) => num += set.song.length)\n return num;\n }", "count() {\n const values = utils.removeMissingValuesFromArray(this.values);\n return values.length;\n }", "function last_chunk_size(lastreq) {\n let tot = 0;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
select text by annotation id
function selectAnnotation(id) { let query = "[data-aid='"+id+"']"; let annotationElements = document.querySelectorAll(query); selectElementContents(annotationElements); selectedAnnotation = id; }
[ "function annotationOnClick(id) {\n \n console.log(\"about to send getAnnotation: \" + id);\n chrome.runtime.sendMessage({action: \"getAnnotation\", id: id}, \n function(response) {});\n}", "function select_annotation(evt) {\n select_button(evt.target);\n }", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store reference to selenium child process or exit or error.
function onSeleniumStart (config, cb) { return function onSeleniumStart (error, child) { if (error) { if (cb) return cb(error.message) process.stderr.write(error.message) process.exit(1) } config.seleniumProcess = child if (cb) { cb(null, child) } } }
[ "_spawnProcess (command, args, onstdout, onstderr) {\n return new Promise((resolve, reject) => {\n let shell = Spawn(command, args);\n shell.on('close', (code) => {\n resolve(code);\n });\n\n shell.stdout.on('data', (data) => {\n if (onstdout) {\n let d = data.toString(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function runs after the initAJAX() entry point collects raw data for both stars and planets First, it displays some basic stats about the raw data in the HTML tables. Then it normalizes the stars and planets together in one object
function normalizeData(stars, planets) { // The "data" of the AJAX calls is returned as arrays at index 0 -- assign to variables for use in all the codez! dataStars = stars[0]; dataPlanets = planets[0]; dataNormalized = []; // Start building hierarchical solar systems from the raw star and planet data -- st...
[ "function initAJAX() {\n // This waits for the Star and Planet API calls to both finish before running the normalizeData() function to normalizing the flat data back to hierarchical data\n $.when($.getJSON(urlDistinctStars), $.getJSON(urlDistinctPlanets)).done(normalizeData);\n}", "function prepareDataForTable(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterate over viewport descriptors and render viewports at specified positions
_renderViewportComponents() { const {viewports} = this.props; const children = []; viewports.forEach((viewportOrDescriptor, i) => { const {viewport, component, Component, props = {}} = viewportOrDescriptor; // Check if this is a descriptor with a component, otherwise ignore if (viewport...
[ "repaintViews() {\n\n for (let viewport of this.viewports) {\n if (viewport.isVisible()) {\n viewport.repaint()\n }\n }\n\n if (typeof this.track.paintAxis === 'function') {\n this.paintAxis()\n }\n\n this.repaintSampleInfo()\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
indcpaDecrypt is the decryption function of the CPAsecure publickey encryption scheme underlying Kyber.
function indcpaDecrypt(c, privateKey, paramsK) { var result = indcpaUnpackCiphertext(c, paramsK); var bp = result[0]; var v = result[1]; var privateKeyPolyvec = indcpaUnpackPrivateKey(privateKey, paramsK); var bp2 = polyvecNtt(bp, paramsK); var mp = polyvecPointWiseAccMontgomery(...
[ "function RSADecrypt(ctext) {\n var c = parseBigInt(ctext, 16);\n var m = this.doPrivate(c);\n if (m == null) return null;\n return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3);\n }", "function indcpaUnpackCiphertext(c, paramsK) {\r\n var b = polyvecDecompres...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
replace(obj: Object, selectors: String|Array, replacer:Replacer) => Object Replacer : (val: Value) => Value
function replace(obj, selectors, replacer) { match(selectors, obj).forEach(function (match) { match.parent[match.key] = replacer(match.value, match.path) }) return obj }
[ "function replacer(match, type, offset) {\r\n\t\r\n\t\t// Find start position (all positions here are relative to the matched substring,\r\n\t\t// not the entire original document (which is available as a 4th parameter btw))\r\n\t\tvar start = type.length;\r\n\t\t\r\n\t\t// Ensure we haven't already parsed this lin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Binding the selected Value in Category Drop down
function selectCategoryOptionValue(event) { var text = $(event.currentTarget).text(); var value = $(event.currentTarget).attr('data-attr-value'); processCategoryOption(value, text); //accessiblity $('#category').attr('aria-expanded','false'); $('.categoryOption').attr('aria-hidd...
[ "function selectCategory(event)\n{\n var category = jQuery(this).attr('ref');\n if (null != categoryTreeCash[category])\n {\n _updateSubCategoryPad(category, categoryTreeCash[category]);\n }\n else\n {\n jQuery.ajax({\n url: '/cash-register/index/get-categories/category/' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set the team settings to enable the autojoin feature for the second team
setSecondTeamSettings(callback) { this.doApiRequest( { method: 'put', path: `/team-settings/${this.secondTeam.id}`, token: this.secondTeamToken, data: { autoJoinRepos: [this.secondRepo.id] } }, callback ); }
[ "function goToTeamSelection(){\n clientValuesFactory.setActiveWindow(windowViews.selectTeam);\n }", "function setTeamAMDS(newTeamA){\r\n if(currentTeamB !== \"\"){\r\n showMDSDataFromTo(currentSeason[0], currentSeason[currentSeason.length - 1])\r\n if(newTeamA === \"Choose team ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
monitorConnection allows interested parties to hook into event messages when the DB connection either connects or disconnects
_monitorConnection(snap) { this._isConnected = snap.val(); // call active listeners if (this._isConnected) { if (this._eventManager.connection) { this._eventManager.connection(this._isConnected); } this._onConnected.forEach((listener) => listen...
[ "function onConnectionChange() {\n window.console.log('Connection changed. Attempting to sync…');\n syncIfPossible();\n }", "_setupDBEvents() {\n this.db.on('connected', ()=>{\n this._status='connected';\n this.logger.info(`DB connected.`);\n });\n\n this.db.on('error', (err)=>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads content from the server.
function loadContent() { MassIdea.loadHTML($contentList, URL_LOAD_CONTENT, { category : _category, section : _section, page : 0 }); }
[ "function loadContent()\n {\n xhrContent = new XMLHttpRequest();\n xhrContent.open(\"GET\",\"Scripts/paragraphs.json\",true);\n xhrContent.send(null);\n xhrContent.addEventListener(\"readystatechange\",readParagraphs);\n }", "function loadContent(page) {\n\t// Builds an XMLHttpRequest if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a document entry.
static deleteAction(entryId){ let kparams = {}; kparams.entryId = entryId; return new kaltura.RequestBuilder('document_documents', 'delete', kparams); }
[ "deleteDoc(doc) {\n this.docs.delete(doc.getIdentifier());\n }", "async delete(req, doc, options = {}) {\n options = options || {};\n const m = self.getManager(doc.type);\n await m.emit('beforeDelete', req, doc, options);\n await self.deleteBody(req, doc, options);\n a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
4.Extract all the countries containing only four characters from the countries array and print it as array
function countryFind4(arr){ let countryFound = []; for(i=0; i<arr.length; i++){ if(arr[i].length === 4){ countryFound.push(arr[i]) } } return countryFound; }
[ "function countryFind1(arr) {\n let resultArr = [];\n for (i=0 ; i < arr.length ; i++) {\n if(arr[i].includes(\"land\")){\n resultArr.push(arr[i]);\n }\n }\n\n return resultArr; \n}", "function getCountryNames(){\n for(let i = 0; i < country_info[\"ref_country_codes\"].length; i++){\n let...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The id of the user that cancelled the request, only defined when phase is PHASE_CANCELLED
get cancellingUserId() { const myCancel = this._eventsByUs.get(CANCEL_TYPE); const theirCancel = this._eventsByThem.get(CANCEL_TYPE); if (myCancel && (!theirCancel || myCancel.getId() < theirCancel.getId())) { return myCancel.getSender(); } if (theirCancel) { return theirCancel.getSen...
[ "canceledError() {\n const error = new Error(\"Canceled\");\n error.name = error.message;\n return error;\n }", "function cancelChallenge() {\n challengesService.getActiveChallengeByCompetitionByPlayer(vm.competitionId, vm.currentUserPlayer._id).then(function (challenge) {\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::AppMesh::GatewayRoute.GrpcGatewayRouteMatch` resource
function cfnGatewayRouteGrpcGatewayRouteMatchPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnGatewayRoute_GrpcGatewayRouteMatchPropertyValidator(properties).assertSuccess(); return { Hostname: cfnGatewayRouteGatewayRouteHostnameMatchPrope...
[ "function cfnGatewayRouteGrpcGatewayRoutePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnGatewayRoute_GrpcGatewayRoutePropertyValidator(properties).assertSuccess();\n return {\n Action: cfnGatewayRouteGrpcGatewayRouteActionPropertyT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Source buffers need a mutex to protect them, return a promise when the update is finished.
safeUpdate(buffer,data) { let promise = new Promise((resolve,reject) => { if (buffer.updating) { setTimeout(() => { this.safeUpdate(buffer,data).then(resolve); },100); } else { buffer.onupdateend=() => { buffer.onupdateend=null; r...
[ "fillBuffer_() {\n if (this.sourceUpdater_.updating()) {\n return;\n }\n\n if (!this.syncPoint_) {\n this.syncPoint_ = this.syncController_.getSyncPoint(this.playlist_,\n this.mediaSource_.duration,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hides all GLA rules blocks.
function hideRuleBocks() { $("#ruleBlock1").hide(); $("#ruleBlock2").hide(); $("#ruleBlock3").hide(); }
[ "function hidePlayer() {\r\n setBlockVis(\"annotations\", \"none\");\r\n setBlockVis(\"btnAnnotate\", \"none\");\r\n if (hideSegmentControls == true) { setBlockVis(\"segmentation\", \"none\"); }\r\n setBlockVis(\"player\", \"none\");\r\n}", "hide() {\n\n let svm = symbologyViewModel;\n let vm = this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the team data from state and returns a custom TeamDisplay component
renderTeamDisplay() { const teamData = this.state.members; return <TeamDisplay data={teamData} />; }
[ "render() {\n return (\n <div className=\"CurrentTeam\">\n {this.name + \" (\" + this.shortName + \")\"}\n </div>\n );\n }", "renderTeamInputs() {\n\t\tlet content;\n\t\tlet table = this.renderTable();\n\t\tlet fullTeamInput = this.renderFullTeamInput();\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a single input string, write a function that produces all possible anagrams of a string and outputs them as an array. At first, don't worry about repeated strings. What time complexity is your solution? Extra credit: Deduplicate your return array without using uniq(). example: var result = anagrams('abc'); consol...
function anagrams(str) { if (str.length === 1) { return [str]; } else { const allAnagrams = []; for (let i = 0; i < str.length; i += 1) { const letter = str[i]; const short = str.substr(0, i) + str.substr(i + 1, str.length - 1); const shortAnagrams = anagrams(short); for (let j =...
[ "function stringAnagrams(str) {\n var arr = str.split(\"\");\n var result = [];\n var str2 = \"\";\n rStrAnagrams(arr, str2, result);\n return result;\n}", "getAnagrams(letters) {\n if(typeof letters !== 'string') {\n throw(`Anagrams expected string letters, received ${typeof letters}`)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
transport layer for api
function transport (type, path, params, callback, settings) { var headers = null; var noApiPath = false; /* set aparams to array if they are not initialized */ if(typeof params === "undefined"){ params = new Array(); } /** url with server and path */ ...
[ "function GenericRequest() {}", "function make_simple_transport () {\n simple_transport.queuemap = {}\n\n return simple_transport\n\n function simple_transport (options) {\n var seneca = this\n var tu = seneca.export('transport/utils')\n\n seneca.add('role:transport,hook:listen,type:simple', hook_list...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1. WRITE YOUR OWN VERSION OF THE INCLUDES METHOD (do not use array.includes) Function Name: includes Parameters: item: the item to search for anArray: the array to search in Purpose: Search anArray for item. Return true if item is in anArray, else return false. Return Value: true or false, depending on whether item is ...
function includes(item, anArray) { for (let i = 0; i < anArray.length; i++) { if (anArray[i] == item) { return true; } } return false; }
[ "contains (array, item, f) { return this.indexOf(array, item, f) >= 0 }", "function includes(arr, val) {\n return arr.includes(val);\n}", "function include(){\n\tvar aku = ' saya belajar di pasar ';\n\tconsole.log(aku.includes(\"belajar\"));\n\tconsole.log(aku.includes(\"sa\"));\n\t}", "function isin(element...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
True if given a LineTerminatorSequence token or MultiLineComment token that is lexically equivalent to a LineTerminatorSequence because it contains an embedded newline. False if given a different valid EcmaScript 5 token. 7.4 Comments ... If a MultiLineComment contains a line terminator character, then the entire comme...
function isLineTerminator(token) { return /(?:^|\/\*.*)[\r\n\u2028\u2029]/.test(token); }
[ "function isMultilineDiffBlock ({value}) {\n return value.indexOf('\\n') !== -1\n}", "function isComment(token) {\n return token.type === 'LineComment' || token.type === 'BlockComment';\n}", "isEndOfLine(editor) {\n const curPos = editor.getCursor();\n return (curPos.ch == editor.getDoc().getLine(curPos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================= Funcion que se ejecuta cuando clickamos en el div de ELEMENTOS DEl INSPECTOR Permite mostrar u ocultar los conrtoles para un mejor rendimiento del app ==============================================
function clickDivElementos(){ $(".div_3").click(function(){ mostrarDivElementos(); }); }
[ "selectDessert3() {\n I.waitForElementLeaveDom(settings.config.helpers.Appium.platform, commonObjects.progressBar);\n //I.downScroller(foodObjects.hersheysBrownie);\n I.tap(foodObjects.hersheysBrownie);\n I.waitForElementLeaveDom(settings.config.helpers.Appium.platform, commonObjects.progressBar);\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List rooms to a user
function listRooms(user) { user.notify(Room.getRoomList()); }
[ "function getUserRooms(user) {\n return users.filter(user => user.usermame === user);\n}", "listRooms() {\n /** List Current Existing Rooms */\n \n /**\n * Notify user that there are no existing rooms.\n */\n if (this._rooms.length === 0) {\n console.warn('\\nNo existing rooms.');\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
STRIP FILE EXTENSION AND EVERYTHING AFTER A URL
function stripExtension(url) { var lastDotPos = url.lastIndexOf('.'); if(lastDotPos > 0) return url.substring(0, lastDotPos - 1); else return url; }
[ "function cleanURL(path) {\n var cleanPath = path.replace(/\\/study\\/.+?(?=\\/|$)/, '/study'); // to strip study name (/study/leap to /study)\n return cleanPath.replace(/(\\/\\d+)/g, ''); // then to strip ids (/subject/1 to /subject)\n }", "function removeUrlAnchor(url){\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
detect when click button search & run fetch_search_classrooms()
function call_tracking_input_search(){ $('.cus-btn-search').on("click",function(){ //show loading image $('.loading_ani_img').show(); var query = change_alias($('#table-search').val()); //check if fetching classrooms or students var isFetchingStudents = window.location.href....
[ "function searchForClassesAndRegister(){\n\t$('.search-register').click(function(event){\n\t\tevent.preventDefault();\n\t\ttoggleResponsiveClass();\n\t\tenableButtons();\n\t\tdisplayErrorMessage('');\n\t\ttoggleHiddenClass($('.search-sections'));\n\t\t$('.search-button').attr('disabled', false);\n\t\t$('.course-sec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
private function to create script for bridge
function buildConnectScript() { return `(() => { var bridgeCall = ${this.func} ; var bridgeCallback = function (detail) { document.dispatchEvent(new CustomEvent("${this.eventHandle}", {detail: detail})); }; bridgeCall(); })();`; }
[ "function makeTMRubyScript(aScript) {\n\tlines = aScript.split(\"\\n\");\n command = '';\n\tfor (line in lines) {\n\t\tcommand = command + lines[line] +'\\\\\\n';\n\t}\n\tcommand = command + '\\n';\n\t\n\treturn command;\n}", "function createGlobalScript(axios$$1, identifier, request) {\n return restAuthPos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a list of MapView Markers that represent veterans. TODO (Ken): See if you can use underscore.js partials instead of rocket function to bind the onPress method
renderVeteranMarkers() { const locations = new Set(); let currentVets = this.state.currentVets; if (this.state.currentVets.length + this.state.currentPos.length > 10) { currentVets = this.state.currentVets.slice( 0, 10 - this.state.currentPos.length ); } return currentVet...
[ "function extractFastners() {\n self.meetupList().forEach(function(meetup){\n // Need a venue id to pull location\n if (meetup.hasVenue()) {\n var pin;\n var id = meetup.venueObject.id;\n if (hasFastnerId(id)) {\n // push the meetup object onto the pin's meetups\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Discover types and subjects for search.
function discoverTypes () { // rdf:type properties of subjects, indexed by URI for the type. const types = {} // Get a list of statements that match: ? rdfs:type ? // From this we can get a list of subjects and types. const subjectList = kb.statementsMatching( undefined, UI.ns.rdf('t...
[ "searchDocuments() {\n\n let searchObj = {}\n if (this.searchType === 'query') {\n searchObj.query = this.query;\n } else if (this.searchType === 'field') {\n searchObj.fieldCode = this.queryField;\n searchObj.fieldValue = this.queryFieldValue;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to turn a commaseparated list of strings into an array of strings. Also ensures each is one of the provided options.
function parseStrings(s, propName, options) { let res = new Array(); for (let raw_chunk of s.split(',')) { let chunk = raw_chunk.trim(); // Man, I really want array and set semantics. Ah well. O(n) check. if (options.indexOf(chunk) === -1) { throw new ...
[ "function makeArray(values){\n\t\tif(typeof values !== 'undefined'){\n\t\t\tif (!(values instanceof Array)){\n\t\t\t\tif(typeof values === 'string'){\n\t\t\t\t\tif(values.indexOf(' ') >= 0){\n\t\t\t\t\t\tif(((typeof opts !== 'undefined') && (typeof opts.breakIntoLetters !== 'undefined') && opts.breakIntoLetters)){\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function access to elementTarget fetch the text for element if correct hide the correct answer add in dev and then add the audio and img warning or not
function visiblElement(elementTarget) { elementTarget.removeClass("correctSound"); $("span.question").each(function(index) { var incorrect = $(this).hasClass("incorrect"); var thisElementText = $(this).text(); var thisElement = $(this); var buttonDisable = $(".result"); if (thisElementText === answer...
[ "function incorrectstyleeffect(){\n console.log(\"Hello \"+currentQuestion);\n $(\"#result\").show();\n $(\"#result\").html(\"Nope! That was not correct !!<br>The correct answer was: \"+ans);\n $(\"#quiz\").hide();\n console.log(incorrectAns);\n shownextq();\n}", "function toggleAnswers_() {\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SFS handler for login error event
function onLoginError( evt ) { alert("Login Error!"); }
[ "function _authError() {\n next('Invalid User ID / Password');\n }", "function loginClickHandler() {\n var values = this.getLoginForm().getValues();\n var e = new ExtJSCodeSample.event.SessionEvent(values.username, values.password, this.getRememberMeCheckBox().getValue());\n this.appl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the parent of a node at a specific path.
parent(root, path) { var parentPath = Path.parent(path); var p = Node$1.get(root, parentPath); if (Text.isText(p)) { throw new Error("Cannot get the parent of path [".concat(path, "] because it does not exist in the root.")); } return p; }
[ "get parent() {\n return new Path(this.parentPath);\n }", "function parentDir (path) {\n var lastSlash = path.lastIndexOf('/');\n return lastSlash > 0 ? path.substring(0, lastSlash + 1) : undefined;\n }", "async getChildLocationAncestorFromPath(inpPath) {\r\n // Get the ID to open\r\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handlers handler for retrieve spreadsheet data, calling readFormulas on DBSSStore instance
function doRetrieveSpreadSheet(app){ return async function(req, res, next){ try{ const {spreadSheetName} = req.params; const spreadSheetRes = await app.locals.ssStore.readFormulas(spreadSheetName); res.json(spreadSheetRes); } catch(err) { next(err); } } }
[ "function refreshWorksheetData(){\n const worksheet = props.selectedSheet;\n worksheet.getDataSourcesAsync().then(sources => {\n for (var src in sources){\n sources[src].refreshAsync().then(function () {\n console.log(sources[src].name + ': Refreshed Successf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set a chapter as active in summary and update state
function setChapterActive($chapter, hash) { // No chapter and no hash means first chapter if (!$chapter && !hash) { $chapter = $chapters.first(); } // If hash is provided, set as active chapter if (!!hash) { // Multiple chapters for this file if ($chapters.length > 1) { ...
[ "function setActiveSubsection(activeHref) {\n var tocLinkToActivate = document.querySelector(\".toc a[href$='\" + activeHref + \"']\");\n var currentActiveTOCLink = document.querySelector(\".toc a.active\");\n if (tocLinkToActivate != null) {\n if (currentActiveTOCLink != null && currentActiveTOCLin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the next index based on the current index and step.
function getNextIndex(currentIndex, length, step, loop) { if (step === void 0) { step = 1; } if (loop === void 0) { loop = true; } var lastIndex = length - 1; if (currentIndex === -1) { return step > 0 ? 0 : lastIndex; } var nextIndex = currentIndex + step; if (nextIndex < 0) { re...
[ "getStepIndex(){\n\t\tvar currentPath = this.state.path;\n\n\t\treturn this.findStepIndex(currentPath);\n\t}", "getNextStep (time, asIndex) {\n\t\tlet ref = this.tzero;\n\t\ttime -= ref;\n\t\ttime /= (60 * 1000);\n\t\tlet ret = Math.ceil(time / this.getStepInterval());\n\t\tif (asIndex)\n\t\t\tret = ret % this.ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a new type of annotation.
static define() { return new AnnotationType(); }
[ "static define() {\n return new AnnotationType()\n }", "function newAnnotation(type) {\n \n updateAutori();\n //ricavo il testo selezionato\n selezione = selection();\n \n //differenza tra selezione e fragmentselection: per operare sui nodi serve il primo, poichè è sostanzialmente\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
runs intcode with input n
function runIntCode(n) { // reads the file, recording the data as a string var input = fs.readFileSync('5.txt').toString(); // turns the string into an array of ints.. i miss list comprehension var intcode = []; var i = 0; for (i = 0; i < input.split(',').length; i++) { intcode....
[ "function printInt(n) {\n // Using a loop print from 1 to n\n // start: 1\n // var i = 1;\n // // stop: n\n for(var x=1;x<=n;x++){\n //console.log(x); \n }\n }", "function prog14()\n{\n\tvar n= prompt(\"Enter Even No\");\n\tn=parseInt(n);\n\t\n\t\tfor( var i=n+2;i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new ITextDocument literal from the given uri and content.
function create(uri, languageId, version, content) { return new FullTextDocument(uri, languageId, version, content); }
[ "function fetchDocument(uri) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var docUrl, documentRef, response, rawDocument, triples, aclRef, webSocketRef;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ADD USER TO SHAREPOINT GROUP
function addUserToSharePointGroup(groupID, key) { console.log(groupID + ' : ' + key); var siteUrl = '/asaalt/hqdag8/quad'; var clientContext = new SP.ClientContext(siteUrl); var collGroup = clientContext.get_web().get_siteGroups(); var oGroup = collGroup.getById(groupID); var userCreat...
[ "async addMembers (usersOrIds, attrs = {}, { transacting } = {}) {\n const updatedAttribs = Object.assign(\n {},\n {\n active: true,\n role: GroupMembership.Role.DEFAULT,\n settings: {\n sendEmail: true,\n sendPushNotifications: true,\n showJoinForm: fals...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
'fix2' function for copycanvas
function fix2(){ let style_height = +getComputedStyle(canvas2).getPropertyValue("height").slice(0,-2); let style_width = +getComputedStyle(canvas2).getPropertyValue("width").slice(0,-2); canvas2.setAttribute('height',style_height * dpi); canvas2.setAttribute('width',style_width * dpi); ...
[ "function setOriginal() {\n\n let cnv = document.getElementById('imgHtml');\n let cnx = cnv.getContext('2d');\n\n cnx.clearRect(0, 0, cnv.width, cnv.height);\n cnx.beginPath();\n\n cnx.moveTo(0, 0);\n cnx.stroke();\n\n imgNormal(backup.original);\n\n}", "copyTexImage2D(ctx, funcName, args) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes a new Combat.
constructor() { this.entityList = new EntityList(); // Current Round In Combat this.round = 0; // The position within the current round this.currentStep = 0; this.started = false; this.dispatchRoundChanged(); }
[ "static init()\n {\n let aeSerial = Component.getElementsByClass(document, PCx86.APPCLASS, \"serial\");\n for (let iSerial = 0; iSerial < aeSerial.length; iSerial++) {\n let eSerial = aeSerial[iSerial];\n let parms = Component.getComponentParms(eSerial);\n let seria...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop recording the drum notes.
function stopRecording() { isRecording = false; currentTrack = audioManager.createRecordedTrack( data.recorded, CHANNEL, DRUM_TAG ); }
[ "function stopRecording() {\n isRecording = false;\n currentTrack = audioManager.createRecordedTrack(\n data.recorded,\n CHANNEL,\n PARALLELOGRAM_TAG\n );\n }", "recordingStopped() {\n if (this.stopAfterRecording) {\n this.stopBuffering();\n }\n }", "function s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get content keys for input key ids.
static getContentKeys(keyIds){ let kparams = {}; kparams.keyIds = keyIds; return new kaltura.RequestBuilder('playready_playreadydrm', 'getContentKeys', kparams); }
[ "function _getSelectedTilesKeys() {\n var tilesKeys = [];\n var nbSelectedtiles = lv_cockpits.winControl.selection.count();\n for (var tileIterator = 0; tileIterator < nbSelectedtiles; tileIterator++) {\n var currentItem = lv_cockpits.winControl.selection.getItems()._value[tileIterat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert bytes to kilobytes
_convertBytesToKilobytes(bytes) { if( isNaN(bytes) || ! bytes ) return ''; return Math.round(bytes / 1024); }
[ "function parseMB(str) {\n var n = toNumber(str.slice(0, -1));\n var u = str.slice(-1);\n switch (u.toUpperCase()) {\n case 'G':\n n = n * 1024;\n case 'M':\n n = n * 1024;\n case 'K':\n n = n * 1024;\n n = n / (1024 * 1024);\n n = Number(n.toPrecision(2));...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to check all a form's checkboxes Supply form ID and input class
function checkAll(form, field) { var getForm = getElem(form).getElementsByTagName('input'); for (i = 0; i < getForm.length; i++) { if (getForm[i].attributes['class'] && getForm[i].attributes['class'].nodeValue == field) { getForm[i].checked = true ; } } }
[ "function checkboxes() {\n\t\t\treturn $('#' + self.id + ' .check > :checkbox');\n\t\t}", "function uncheckAll(form, field)\n{\n var getForm = getElem(form).getElementsByTagName('input');\n for (i = 0; i < getForm.length; i++) {\n if (getForm[i].attributes['class'] && getForm[i].attributes['class'].n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Temporarily suspend reloading hosts Load local ip > hostname mappings
function loadHosts() { if (noLoadHosts) return; noLoadHosts = true; // Debounce var file = __dirname + "/" + hostsFile; fs.exists(file, function(exists) { if (!exists) return; hosts = {}; fs.readFile(file, function(err, data) { _.each(data.toString().split(/[\n\r]+/), function(line) { line =...
[ "function updateHosts(ip, host) {\n if (!hosts[ip] || hosts[ip].indexOf('*') != 0 && host != getHost(ip)) {\n\thosts[ip] = host;\n\tsaveHosts();\n\tconsole.log('Added host', ip + ':', host);\n }\n}", "function saveHosts() {\n var file = __dirname + \"/\" + hostsFile;\n if (hosts && _.keys(hosts).lengt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialises the help tour.
function ksfHelp_mainTourInit() { ksfHelp_mainTour.init(); ksfHelp_mainTour.start(); }
[ "function Help_initialiseAll(){\n\t\n\t// object holding all help class instances\n\tHelp_All = new Object();\n\t\n\t// ids of all main help divs\n\tvar $helpDivs = $('.hapi-help');\n\t\n\t$.each($helpDivs, function(index, $helpDiv){\n\t\t\n\t\t// id\n\t\tvar divId = $helpDiv.id; \n\t\t\n\t\t// create a new instanc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for getV3ProjectsIdMergeRequestMergeRequestIdCommits
getV3ProjectsIdMergeRequestMergeRequestIdCommits(incomingOptions, cb) { const Gitlab = require('./dist'); let defaultClient = Gitlab.ApiClient.instance; // Configure API key authorization: private_token_header let private_token_header = defaultClient.authentications['private_token_header']; private_token_he...
[ "getV3ProjectsIdMergeRequestsMergeRequestIdCommits(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\npriva...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a simplex noise expression; values range from 1 to 1
function simplex(pos) { return new SimplexNoise(pos); }
[ "function noise1D(){\n\t/*xoff needs to be global, otherwise it wont change every frame\n\tbecause xoff is reset to 0 everytime it produces the same output\n\t(but only as long as the program is running i.e. refreshing the page creates a new output)\n\t*/\n\txoff=0;\n\n\tfor (let x=0; x < windowWidth; x++) {\n\t\tx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function:SavePageByName (pageName) Purpose:Saves 'pageName'
function SavePageByName (PageName) { doActionEx('MPEA_SAVE_PAGE', 'Result', 'PageName', PageName); return (PageName); }
[ "function SavePage ()\n{\n\tvar PageName = doAction('REQ_GET_FORMVALUE', \"PageName\", \"PageName\");\n\tif (!PageName)\n\t{\n\t\tPageName = doAction('ST_GET_STATEDATA', 'CurrentPageName', 'CurrentPageName');\n\t\tif (!PageName || PageName == '')\n\t\t\tPageName = gHOME_PAGE;\n\t}\n\tvar seObj = generateSEObjects (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper to verify that the path endpoints are close to eachother
function arePathsClose(paths) { var numPaths = paths.length, i, j, path, isClose, separation; if (numPaths > 1) { for (i = 0; i < numPaths; i++) { // only measure separation for active paths path = paths[i]; if (path.isActive) { ...
[ "function approximatelyEqual(path1, path2) {\n // convert to numbers and letters\n const path1Items = pathToItems(path1);\n const path2Items = pathToItems(path2);\n const epsilon = 0.001;\n\n if (path1Items.length !== path2Items.length) {\n return false;\n }\n\n for (let i = 0; i< path1Items.length; i++) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display Status messages baseed on return value
function DisplayStatus(code) { switch (code) { case 2: InvalidStatus("Operation Failed"); break; case 4: InvalidStatus("IP/Username already exists in the database"); break; case 10: SuccessStatus("System updated successfully"); ...
[ "status(title, status) {\n const statusString = status === false ? symbols.error : symbols.success;\n console.log(Log.fill(`\n [${chalk.yellow(title)}] [FILL] [${statusString}]\n `));\n }", "function displayResult() {}", "function getStatusMessage(status, jsStatus, cssStatus, jqStatus) {\n\tvar o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : loadConfInit AUTHOR : Clarice Salanda DATE : March 15, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : initializes data in table PARAMETERS : RETURN :
function loadConfInit(){ var confStat=''; var loadConfStat=''; if(globalInfoType == "JSON"){ var devices = getDevicesNodeJSON(); }else{ var devices =devicesArr; } for(var i = 0; i < devices.length; i++){ if(HostName && HostName != "" && devices[i].HostName != HostName){continue;} confSt...
[ "function loadConfigData(data){\n\tvar mydata = data;\n\tif(globalInfoType == \"XML\"){\n\t\tvar parser = new DOMParser();\n\t\tvar xmlDoc = parser.parseFromString( mydata , \"text/xml\" );\n\t\tvar row = xmlDoc.getElementsByTagName('MAINCONFIG');\n\t\tvar uptable = xmlDoc.getElementsByTagName('DEVICE');\n\t\tvar l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A small utility function that allows me to apply a passed in ref along with my own custom ref logic.
function applyRef(instance, ref) { if (!ref) { return; } if (typeof ref === "function") { ref(instance); } else if (typeof ref === "object") { ref.current = instance; } }
[ "function assignRef(ref, value) {\n if (ref == null) return;\n\n if (typeCheck_dist_reachUtilsTypeCheck.isFunction(ref)) {\n ref(value);\n } else {\n try {\n ref.current = value;\n } catch (error) {\n throw new Error(\"Cannot assign value \\\"\" + value + \"\\\" to ref \\\"\" + ref + \"\\\"\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }