query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Return the rule stack depth where the nearest error rule can be found. Return FALSE when no error recovery rule was found. we have no rules now
function locateNearestErrorRecoveryRule(state) { var stack_probe = stack.length - 1; var depth = 0; // try to recover from error for(;;) { // check for error recovery rule in this state if ((TERROR.toString()) in table[state]) { ...
[ "findForcedReduction() {\n let { parser } = this.p,\n seen = []\n let explore = (state, depth) => {\n if (seen.includes(state)) return\n seen.push(state)\n return parser.allActions(state, (action) => {\n if (\n action &\n (262144...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates method Iterates through scooter array changes damage to false
repairAllScooter(){ for(var i = 0; i < ChargingStation.allScooter.length; i++){ if(this.damage = true){ this.damage = false } } }
[ "function unScareAlien(){\n aliens.forEach(alien => alien.isScared = false)\n }", "function weaponHit(e, m, ei, mi) {\n\n if(m.x <= (e.x + e.w) && (m.x + m.w) >= e.x && m.y <= (e.y + e.h) && (m.y + m.h) >= e.y) {\n enemyArray.splice(ei,1)\n weaponArray.splice(mi,1)\n new enemyExplosion...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
abrir model editar categoria
function editCategoriaModel(id_categoria) { $.ajax({ type: 'POST', dataType: 'json', url: 'Producto_controller/buscarCategoria', data: { 'id_categoria': id_categoria }, success: function (res) { document.getElementById('id_categoria_edit').value = res.id_categori...
[ "function pegaCategoria(e) {\n if (e.target.value === 'Alcóolico') {\n setCategoria(['Alcoholic', 'Non Alcoholic']);\n } else if (e.target.value === 'Categoria') {\n setCategoria([\n 'Ordinary Drink',\n 'Cocktail',\n 'Cocoa',\n 'Shot',\n 'Milk / Float / Shake',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse out the ChemProperties from the given json list of ChemProperties Place them all in CHEMICAL_PROPERTIES rawProperties: The list of properties
function parseChemProperties(rawProperties){ for(var i = 0; i < rawProperties.length; i++){ let p = rawProperties[i]; let c = p[CHEMICAL_PROPERTY_COLORS]; makeChemical( p[CHEMICAL_PROPERTY_SYMBOL], p[CHEMICAL_PROPERTY_NAME], p[CHEMICAL_PROPERTY_CREATOR], ...
[ "function cfnAnomalyDetectorJsonFormatDescriptorPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAnomalyDetector_JsonFormatDescriptorPropertyValidator(properties).assertSuccess();\n return {\n Charset: cdk.stringToCloudFormation(prop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is the main function of the personal doctors section. It loads information on the user's personal doctors and then displays it in the personal doctor window
function get_personal_doctor() { $.post("get_my_personal_doctors.php", {id: $("#USERID").val()}, function(data, status) { if(data.substr(0, 2) == 'ND') { // No Personal Doctor Found // Display message that the user does not have a personal doctor ...
[ "function people(click_id) {\n\t// Get current user login\n\tvar user = firebase.auth().currentUser;\n\n\t// update selected for each user and go to company's people page\n\tdb.collection('users').doc(user.uid).update({\n\t\tselected_company_id: click_id\n\t}).then(function () {\n\t\tremote.getCurrentWindow().loadU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
turns all 'running' files in directories to true for 30s
function turnAllOn() { console.log("**** Turning all 'running' files to true") // get all directories const getDirectories = source => fs.readdirSync(source, { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name) var directories = getDirectories(__dirname); // ...
[ "launch() {\n for (let d of this.forceDirs) {\n this._log(\"force to check dir \" + d.dir + \" with limit \" + d.limitMB);\n this._activateWatch(d.dir, d.limitMB);\n }\n\n if (this.autoDiscoverNewSubDirs) {\n this.objIntervalAutoScan = setInterval(() => {\n this._scanRoot();\n },...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Problem 2 How many normal people? From the previous question, we know 2530 is a "normal" BMI. Write a function that returns how many "normal" people are in a provided array of numbers. Examples: countNormal([24,25,22,30.1,18]) > 2 countNormal([18.5, 31]) > 1 countNormal([]) > 0
function countNormal(arr) { // Your code here return 0; }
[ "function calculatesNumberOFIntegers (array) {\n\nlet result = 0;\n for (let i = 0; i < array.length; i++) {\n\n if(isFinite(array[i]) && typeof array[i] === \"number\" && parseInt(array[i]) === array[i]) {\n\n result++;\n }\n }\n return result;\n}", "function numberOfMales(array...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getIndex : This function get's the index based on asc/desc condition
function getIndex(array, index, key, order) { var value = array[index][key], tempIndex = index; for (var i = index + 1; i < array.length; i++) { if (order === "asc" && array[i][key] < value || order === "desc" && array[i][key] > value) { tempIn...
[ "getIndex(attributeName) {\n const arg = this.args[attributeName];\n return arg ? arg.idx : null;\n }", "get indexType()\n {\n return 1;\n }", "get _firstVisibleIndex() {\n var firstVisible = this._rows.firstChild;\n if (!firstVisible || !firstVisible.hasAttribute(\"index\")) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates an existing permission item object. This action is available only to Kaltura system administrators.
static update(permissionItemId, permissionItem){ let kparams = {}; kparams.permissionItemId = permissionItemId; kparams.permissionItem = permissionItem; return new kaltura.RequestBuilder('permissionitem', 'update', kparams); }
[ "static update(permissionName, permission){\n\t\tlet kparams = {};\n\t\tkparams.permissionName = permissionName;\n\t\tkparams.permission = permission;\n\t\treturn new kaltura.RequestBuilder('permission', 'update', kparams);\n\t}", "edit(permission) {\n this.currentEditingUserPermission = permission;\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns editable content for each tile on the selected page
function displayPageTiles(e){ $.ajax({ url: pageEditorScript, data: {getPageTiles:"true",pageName:pageNameSelect.val()}, success: success, dataType: 'json' }); function success(data){ // Remove prevously existing editable tiles before new ones are added $(document).find($(pageEditorTileContainer).remove(...
[ "function render_editor()\n{\n\t// first get the piece to make show up\n\tvar piece = get_selected_piece();\n\n\t// get the pixel width and height to set the canvas\n\t// add space for the extra grid pixels\n\tvar canvas_width = tile_size * piece.width + grid_thickness;\n\tvar canvas_height = tile_size * piece.heig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses input into a SemVer interface
function parseSemver(input) { var match = input.match(SEMVER_REGEXP) || []; var major = parseInt(match[1], 10); var minor = parseInt(match[2], 10); var patch = parseInt(match[3], 10); return { buildmetadata: match[5], major: isNaN(major) ? undefined : major, minor: isNaN(mino...
[ "function SemVer(version) {\n if (typeof version !== 'string') {\n error(\"Error: cleanSemVer() needs a string to operate on...\\n\");\n return false;\n }\n // match valid semantic version strings (based on the LOOSE regular expression in npm/node-semver)\n var semVerRegX = new RegExp(\"^[v=\\\\s]*([0-9]+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fires native update query. Calling this has no side effects on the context (identity map).
async nativeUpdate(where, data, options) { return this.em.nativeUpdate(this.entityName, where, data, options); }
[ "visitUpdate_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "queryUpdated() {\n this.emit('core.state.queryUpdated', this)\n }", "visitFor_update_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "update ( data ) {\n this.store.update(data);\n }", "_update() {\n if (this.hyd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Metodo para actualizar los indices de revistas y congresos de las publicaciones existentes
function refreshIndexes(){ var pubs try { Publication.find({}).then((data) => { pubs = data pubs.forEach((pub) => { let tempPub = indexarPub(pub) Publication.updateOne({"_id":pub.id}, tempPub) }) }) } catch (error) { console.log(error) } }
[ "initializeIndex() {\n if (NylasEnv.config.get('threadSearchIndexVersion') !== INDEX_VERSION) {\n return this.clearIndex()\n .then(() => this.buildIndex(this.accountIds))\n }\n\n return this.buildIndex(this.accountIds);\n }", "resetIndexes()\n {\n const self = this;\n self[_re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a parallax effect to this.HEADER.
setUpParallaxHeader() { new Parallax(HEADER); }
[ "function runVertParallax() {\n $('.intro-download-section').parallax({imageSrc: 'images/sparks_med_res.jpg'});\n}", "function textParallax() {\r\n\tvar myScroll = $(this).scrollTop();\r\n\t$('.page-header-wrap .container').css({\r\n\t\t'opacity': 1 - (myScroll / 200)\r\n\t});\r\n}", "function initImageParal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initiliaze the static paths.
_initStaticPaths() { this.options.staticPaths.forEach((staticPath) => { this.app.use(koaMount(staticPath.url, koaStatic(staticPath.path))); }); }
[ "setupStatic() {\n }", "_addStaticRoutes() {\n const app = this._app;\n\n if (Deployment.shouldServeClientCode()) {\n // Map Quill files into `/static/quill`. This is used for CSS files but\n // not for the JS code; the JS code is included in the overall JS bundle\n // file.\n app.use...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate possible high targets model with classes with the best success rate
function populateHighTargets() { // Create new Array instance possibleHighTargetsModel = new Array(); let stack = []; let highestSuccess; // cycle through all dbClasses for (let i = 0; i < 81; i++) { let successRate = 0; // If Success and Total = 0 ... ( 0 / 0 does not work) -> ...
[ "function populateTargets(_callback) {\n // Create new Array instance\n possibleTargetsModel = new Array();\n // Cycle through each square within the square model\n for (let i = 0; i < squaresModel.length; i++) {\n // If the squares status is \"Unknown\" ->\n if (squaresModel[i].squareStatus =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide or show employee/dep view rights checkboxes if all employees checked/unchecked.
function showDepEmployeeViews() { if(this.checked) { $("#specific-view-rights").css("display", "none"); } else { $("#specific-view-rights").css("display", "block"); } }
[ "function showSetDepEmployeeViews() {\r\n if(this.checked) {\r\n $(\"#set-specific-view-rights\").css(\"display\", \"none\");\r\n } else {\r\n $(\"#set-specific-view-rights\").css(\"display\", \"block\");\r\n }\r\n }", "function hideUncheckedShowChecked() {\n\t// Hide the unchecked options\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funtion to sort movie list w.r.t.Episode name and year
function sortMovieList(data, id) { if (id === "episode") { data.sort((a, b) => a.fields.episode_id > b.fields.episode_id ? 1 : b.fields.episode_id > a.fields.episode_id ? -1 : 0); } else if (id === "year") { console.log(id); data.sort((a, b) => a.fields.release_date > b.fields.release_...
[ "function sortMoviesByAttr ( movies, sortAttr ) {\n// CODE GOES HERE\n for ( let j = 0; j < movies.length - 1; j ++ ) {\n let max_obj = movies[ j ];\n let max_location = j;\n let max = getMaxMovieObject ( movies, j, sortAttr );\n max_obj = max.max_obj;\n max_location = max.max_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::LookoutMetrics::Alert` resource
function cfnAlertPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnAlertPropsValidator(properties).assertSuccess(); return { Action: cfnAlertActionPropertyToCloudFormation(properties.action), AlertSensitivityThreshold: cdk.numberToClou...
[ "function cfnAlertActionPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAlert_ActionPropertyValidator(properties).assertSuccess();\n return {\n LambdaConfiguration: cfnAlertLambdaConfigurationPropertyToCloudFormation(properties.lamb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
class structure containing a polygon as list of points, a color, and the function to draw that polygon
function Polygon(points, color){ this.points = points; this.color = color; this.drawPolygon = drawPolygon; }
[ "function createPolygon(pointsArray){\n\tvar line = JSX.doc.pathItems.add();\n\tline.stroked = false;\n\tline.closed = true;\n\tline.setEntirePath(pointsArray);\n\tline.fillColor = colorFunc();\n}", "function GeneratePolygonElement(points, fill, opacity) {\n\tvar apoly=document.createElementNS(svgNS, \"polygon\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reset load counter to 0
function resetLoadedCounter() { _loadedCounter = 0; }
[ "resetEverything() {\n this.resetLoader();\n this.remove(0, Infinity);\n }", "resetCount() {\n this.setStatistics({\n fetchedDocuments: 0,\n migratedDocuments: 0,\n totalDocuments: 0,\n ignoredDocuments: 0,\n });\n }", "reset() {\n const _ = this;\n _._counter = _...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find all of the pages in the given website's Id
function findPagesByWebsiteId(websiteId) { var sitePages = []; for(var p in pages) { var page = pages[p]; if (page.websiteId === websiteId) { sitePages.push(page); } } return sitePages; }
[ "function findAllPagesForWebsite(websiteId) {\n\n return Page.find({_website: websiteId});\n\n }", "function findPageById(pageId) {\n return pages.find(function (page) {\n return page._id === pageId;\n });\n }", "function findWebsitesByUser(userId){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the rows to be displayed. Sorts items based on categories Totals the price of all items of a category Inserts category headers Adds total price to footer
function calculateRows(data) { // find unique categories var categories = new Set(); for (var _i = 0, data_1 = data; _i < data_1.length; _i++) { var item = data_1[_i]; categories.add(item.category); } // sort the categories var sortedCategories = A...
[ "function updateCategoryTotalRow(category, weight){\n let rows = Array.from(TABLE.rows); //Array object made from gradeTable rows\n let titlePath = \" > th\";\n let earnedPath = \" > td.assignment_score\";\n let totalPath = \" > td.possible.points_possible\";\n let detailsPath = \" > td.details\";\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validates that the second consecutive operator can only be a and that there can't be more than 2 concecutive operators and the starting operator can only be .
operatorValidator(expression){ const validOperators = ['-', '+', '/', '*']; const invalidStartingOperators = ['+', '/', '*'] let i = 0; let operatorCount = 0; while (i < expression.length){ //increment operatorCount by 1 if the char at index i is a validOperator. if(validOperators.incl...
[ "function isOperator(input) {\n return input == \"+\" || input == \"-\" || input == \"*\" || input == \"/\" || input == \"C\" || input == \"CE\";\n}", "function checkForOneVar(str) {\n for(var i=0;i<str.length;i++){\n if(isOperator(str[i]) || isBrackets(str[i])){\n printError(\"invalid lef...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A member of the targetPattern1 array, this holds the individual input node and it's target output (1).
function inputTargetOutput1(){ var input; //Contains the input pattern var targetOutput = outputNode1; //the outputNode target for this pattern this.setInput = function(newInputNode){ input = newInputNode; } this.getInput = function(){ return input; } this.getTargetOutput = function(){ return ta...
[ "function addNewInputTargetOutput2(newInputNode){\n\tvar newInputTarget = new inputTargetOutput2();\n\tnewInputTarget.setInput(newInputNode);\n\ttargetPattern2.push(newInputTarget);\n}", "setInput(input) {\n\t\t// Ensure that number of inputs matches expected\n\t\tif (input.length != this.numInputs) {\n\t\t\tcons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display trail results in the DOM
function displayTrailResults(trailResponseJson) { $('.js-trail-results').empty(); let result = trailResponseJson.trails.length; if (trailResponseJson.trails.length === 0) { $('.js-trail-results').text('No trails found. Please try a different address.'); } else { $('.js-trail-results').ap...
[ "function displayResult() {}", "function drawResults(obj) {\n\n //Clear the contents of contentsWrapper\n contentsWrapper.innerHTML = '';\n\n //If the object from our lookup exists, write out its properties\n if(obj) {\n for(var prop in obj) {\n if(obj.hasOwnProperty(prop)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if we can reuse an existing filesystem entry safely and overwrite it, rather than unlinking and recreating Windows doesn't report a useful nlink, so we just never reuse entries
[ISREUSABLE] (entry, st) { return entry.type === 'File' && !this.unlink && st.isFile() && st.nlink <= 1 && process.platform !== 'win32' }
[ "destroyDuplicateEntries() {\n const seen = new Set()\n for (const entry of this.entries.filter(isValidEntry)) {\n const stringOfEntry = entry.toString()\n if (seen.has(stringOfEntry)) entry.destroy()\n else seen.add(stringOfEntry)\n }\n }", "_doubleEntriesSizeAndRehashEntries() {\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes the priority of the given item
function changePriority(item) { if (item.priority <= 0) item.priority++; else item.priority = -1; storageService.set(vm.items); }
[ "function setPriority (data, command) {\n if (_.includes(['DISMISS', 'RECALL'], command.type)) {\n command.priority = 3;\n } else if (_.includes(['CHARGE', 'PARRY', 'RETREAT', 'SHIFT'], command.type)) {\n command.priority = 2;\n } else if (command.type === 'SKILL') {\n command.priority = (ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a ratio of the screen into a pixelsafe screen coordinate
ratioToScreenCoord(x, y) { return this.roundScreenCoord(x * this.canvas.width, y * this.canvas.height); }
[ "screenCoordToRatio(x, y) {\n x = x / this.canvas.width;\n y = y / this.canvas.height;\n return {x:x, y:y};\n }", "function findScreenHeight(width, ratio) {\n let height;\n ratio = ratio.split(':');\n \n height = (width / ratio[0]) * ratio[1];\n \n return width + 'x' + he...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a promise with the parsed ticket, this
parseTicket() { return new Promise((resolve, reject) => { this.matrix = this.rawTicket.matrix[0]; // validations this.winType = this.rawTicket.winType; this.isBonus = this.rawTicket.isBonus; if (this.isBonus === true) { new BonusTicket(this.rawTicket.bonusTicket).parseTicket().then(parsedTicket => ...
[ "async get (conditions) {\n const Ticket = await this.findOne(conditions).exec()\n if(Ticket){\n return Ticket\n }\n const err = new APIError('No such Ticket exists!',httpStatus.NOT_FOUND)\n return Promise.reject(err)\n }", "atenderTicket(escritorio) {\n\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : canvasSwipe() AUTHOR : Mark Anthony Elbambo DATE : March 24, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : for swipe event pagination when the canvas is empty PARAMETERS : ids id of canvas
function canvasSwipe(ids){ $("#"+ids).on("swiperight", function(){ if(globalMAINCONFIG[pageCanvas].MAINCONFIG[0].DEVICES.length == 0){ var cnvasLngt = $("#paginationcanvas li").length; if(pageCanvas > 0){ pageCanvas = pageCanvas - 1; }else{ pageCanvas = 0; ...
[ "function detectCanvasGestures() {\n\n let mc = new Hammer(pdfCanvas);\n //Enables pinches on the canvas\n mc.get('pinch').set({\n enable: true\n });\n\n mc.on(\"swipeleft swiperight pinch pinchend pan tap\", function (e) {\n switch (e.type) {\n case 'swiperight': //Changes t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Do not allow spacebar and ask for confirmation if enter key press USED IN: maintorders.jsp
function keyDownLogin(e){ var e = window.event || e; var key = e.keyCode; //space pressed if (key === 32) { //space e.preventDefault(); } // Enter Pressed if (key === 13){ if (confirm("Do you Confirm Changes?")) { alert("Update confirmed"); return true; ...
[ "function enterobs(e){\n if(e.which == 13 && !e.shiftKey){\n $('#pubob').click();\n e.preventDefault();\n }\n}", "function VerificarEnter(evt) {\r\n var charCode=(evt.which)?evt.which:evt.keyCode\r\n if(charCode==13){\r\n return false;\r\n }\r\n return true;\r\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detects Universal Windows Platform apps.
function isUWP() { return getUA().indexOf('MSAppHost/') >= 0; }
[ "function DetectPalmOS()\n{\n if (uagent.search(devicePalm) > -1)\n location.href='http://www.kraftechhomes.com/home_mobile.php';\n else\n return false;\n}", "function detectPlatform () {\n var type = os.type();\n var arch = os.arch();\n\n if (type === 'Darwin') {\n return 'osx-64';\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process a nested , generating typechecking code for it and its children. The nested is represented with an `if` structure, which creates a new syntactical scope for the type checking code for the template. If the has any directives, they can influence type inference within the `if` block through defined guard functions...
function tcbProcessTemplateDeclaration(tmpl, tcb, scope) { // Create a new Scope to represent bindings captured in the template. var tmplScope = new Scope(tcb, scope); // Allocate a template ctx variable and declare it with an 'any' type. var ctx = tmplScope.allocateTemplateCtx(tmpl); ...
[ "visitIf_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "funcOrTypeDecNotInLoop(context) {\n doCheck(\n !context.inLoop,\n `Functions and types cannot be declared in a loop`\n );\n }", "function FragmentsOnCompositeTypesRule(context) {\n return {\n InlineFragment(node) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks that all sets are in exclude;
function shouldExclude(sets) { for (var i = 0; i < sets.length; ++i) { if (!(sets[i] in exclude)) { return false; } } return true; }
[ "complement(otherSet) {\n return this.relativeComplement(otherSet);\n }", "isSubset(otherSet) {\n let result = this.set.every(function(element) {\n return otherSet.contains(element);\n });\n console.log('isSubset: ', result);\n }", "function validateSubsets(subsets, set) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return list of client review for a business and insert obj in the bussinessArr spacefing business's name, image_url, id
function reviewList(businesses) { let list = []; for (let i = 0; i < businesses.length; i++) { let obj = {}; obj["name"] = businesses[i].name; obj["image_url"] = businesses[i].image_url; obj["id"] = businesses[i].id; list.push(client.reviews(bu...
[ "function createReview(data, title) {\r\n var reviewList = [];\r\n // const regTitle = new RegExp('^' + title, \"i\");\r\n data[\"results\"].forEach(function(currObj) {\r\n // if (regTitle.test(currObj[\"display_title\"])) {\r\n if (currObj[\"display_title\"] == title) {\r\n // con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this script uses document.write to avoid user prompts in MSIE for object, applet and embed tags fix applied on 22/10/2007 4:30 PM
function iefixNindexi1f1() { document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100%" height="100%">\n') document.write(' <param name="movie" value="lab1.swf">\n') document...
[ "function dumpHTMLContent()\n{\n\t// the functional code is in the page dump.html\n\twindow.open(PATH_Lib + \"/Common/Test/Lib/dump.html\",\"sourceWindow\",\"resizable=yes scrollbars=no menubar=no\");\n\treturn false;\n}", "function editFVSSL()\n{\n //get the original code\n var dom = dw.getDocumentDOM();\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rotate icons between still/ready and running, and the completed check icon ready (still bus image) > running (animated bus) > Completed (check mark); then repeat bus id param is a string starting with ''; for example, '21';
function changeBusIcon1(busId) { let checkId = "#i" + busId.slice(-2); console.log('line 45 running changeBusIcon busId = ' + busId); let src = $(busId).attr("src"); console.log("line 47 busId = " + busId + ", src = " + src); if (!$(busId).hasClass("hidden")) { $(checkId).addClass("hidden"); if (src.i...
[ "function changeBusIcon2(busId) {\n let checkId = \"#i\" + busId.slice(-2);\n $(checkId).addClass(\"hidden\");\n console.log('running changeBusIcon2 busId = ' + busId);\n let src = $(busId).attr(\"src\");\n // hideCheckShowBus(busId);\n if (src.indexOf(\"still\") >= 0) {\n $(checkId).addClass(\"hidden\");\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cancel execution with matching id if it hasn't been executed yet. sets state to cancelled
function cancel(id) { var execItem = execData[id]; if (execItem && execItem.state == 'waiting') { clearTimeout(execItem.timeoutID); execItem.timeoutID = 0; execItem.state = 'cancelled'; } return this; }
[ "function Sequence$cancel(){\n\t cancel();\n\t action && action.cancel();\n\t while(it = nextHot()) it.cancel();\n\t }", "function cancelQuery() {\n if (cwQueryService.currentQueryRequest != null) {\n var queryInFly = mnPendingQueryKeeper.getQueryInFly(cwQueryService.currentQueryRequest);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check for betLines, and enables userInput on betline indicators
checkBetLinesShow () { if (this.getService("LinesService").getWinLines().length > 0){ linesManager.disableMouseOverForLabels(); } else { linesManager.enableMouseOverForLabels(); } }
[ "isBettingDone(lineup, dealer, state, bbAmount) {\n if (this.isHandComplete(lineup, dealer, state)) {\n return true;\n }\n const activePlayers = activeLineup(lineup, dealer, state, this.rc);\n let maxBet;\n if (state === 'waiting' || state === 'preflop') {\n try {\n maxBet = this.get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Normalize word by stem'ing it, removing all nonalphabetic characters and converting to lowercase.
function normalize(word) { return stem(word.toLowerCase()).replace(/[^a-z]/g, ''); }
[ "function normalize(w) {\n w = w.toLowerCase();\n var c = has(w);\n while (c != \"\") { //keep getting rid of punctuation as long as it has it\n var index = w.indexOf(c);\n if (index == 0) w = w.substring(1, w.length);\n else if (index == w.length - 1) w = w.substring(0, w.length - 1);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
document ready complete calculate spacing for fixed header/footer with container
function pageContainerSpacing (hh, iosf) { /*if( $('nav.ios-global-nav:visible').length === 0 ) { iosf = 0; } $('div.page-container').css({ 'padding-top': 15 + hh + 'px', 'padding-bottom': 15 + iosf + 'px' });*/ // //adjsuting height as per header and footer // var hh_ht = $(".global-header").hei...
[ "function setupStickyHeaderAndFooter() {\n\n //sticky(header) content variables must be initialized here to retain sticky location across page request\n stickyContent = jQuery(\"[data-sticky='true']:visible\");\n if (stickyContent.length) {\n stickyContent.each(function () {\n jQuery(this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a fake object to use to for argument to NdrServerCall2
function create_fake_object(exp) { // Needed for the stubs var malloc = exp.GetProcAddress("msvcrt.dll", "malloc"); if (malloc == null) { log("Can't find malloc"); return null; } var free = exp.GetProcAddress("msvcrt.dll", "free"); if (free == null) { log("Can't find free"); return null; } // Search for...
[ "function MockCuriousClient() { }", "function proxy(){\n\n var proxyFactory = function(){\n\n //The wrapped function to call.\n var fnToCall = arguments.length === 2 ? arguments[0][arguments[1]] : arguments[0];\n\n //A counter used to note how many times proxy has been call...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update config.json when the browser version is higher than config.json
async function updateConfig(deviceInfo, settings) { let browserInfo = deviceInfo.Browser.split('-'); let currentVersion = browserInfo[browserInfo.length - 1]; let needUpdate = false; if (! ('chrome_canary_version' in settings)) { needUpdate = true; } else if (settings.chrome_canary_version < currentVersi...
[ "get configVersion() {\n return '0.0.0'\n }", "updateConfig(application) {\n const updatedConfig = { };\n const configs = Array.prototype.slice.call(arguments, 1);\n\n return this.getConfig(application).then(existingConfig => {\n ld.assign.apply(this, [updatedConfig, existingCo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getIndi(item) Parse an indi subtree and collect information about it into flatter object. param: item an indi subtree return: object a flatter indi object more suitable to insert into database
function getIndi(item) { var indi = {}; var refid = cleanPointer(item.pointer); indi['indi'] = refid; indi['even'] = []; indi['fams'] = []; indi['birt'] = {}; indi['deat'] = {}; var tree = item.tree; for (i in tree) { var tag = tree[i]['tag']; var tag_lc = tag.toLower...
[ "function loadIndi(conn, item) {\n\n if (DEBUG) {\n console.log(JSON.stringify(item, null, 2));\n }\n\n if (VERBOSE) {\n var t = item.tree;\n for (i in t) {\n var tag = t[i]['tag'];\n if (typeof stats[tag] === 'undefined') {\n stats[tag] = 1;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deselects all checkboxes within the collection div that are marked with class 'krselectline' (used for multivalue select collections)
function deselectAllLines(collectionId) { jQuery("#" + collectionId + " input:checkbox.kr-select-line").attr('checked', false); setMultivalueLookupReturnButton(jQuery("#" + collectionId + " input:checkbox.kr-select-line")); }
[ "function do_deselect_all() {\n var baseurl = document.getElementById('baseurl');\n // Make asynchronous call to end point to deselect all for current page\n YUI().use(\"io-base\", function(Y) {\n var uri = baseurl.value + \"&action=bulk_checkbox_selection_deselectall\";\n var cfg = {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This files contains the primitives required to create drag images from HTML elements that serve as models. A snapshot of the computed styles of the model elements is taken when creating the drag image, so that it will look the same as the model, no matter where the drag images is grafted into the DOM. Creates a drag im...
function createDragImage(el) { var clone = deepClone(el); clone.style.position = 'fixed'; clone.style.margin = '0'; clone.style["z-index"] = '1000'; clone.style.transition = 'opacity 0.2s'; return clone; }
[ "function createGameObject(src){\n var img = $('<img class=\"draggable game_object\">');\n img.attr('src', src);\n img.appendTo('#playarea_container');\n}", "function buildDiagram(jsonData, elementName, autoPlacement) {\n\n var view = joint.dia.LinkView.extend({\n mouseover: function (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Triggers the hit event.
function emitOnHit(event) { if (self.onHit) { self.onHit(event); } }
[ "function onHit() {\n this.classList.remove(\"active\");\n this.classList.add(\"target\");\n scoreIncrement();\n time = time - 10;\n}", "handleHitAnimation() {\n push();\n tint(255, 255, 255, this.explosionHit);\n imageMode(CENTER, CENTER);\n image(imgExplosion, player.x, player.y, player....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start playing at the specified tempo
function start(beatsPerMinute) { if (playing) stop(); // assume each step is a 16th note stepsPerSecond = beatsPerMinute / 60 * 4; context = createNewContext(); synth = Synth(context); playing = true; scheduleSounds(getPosition(0)); context.resume(); onTick(); }
[ "start() {\n\n this.isPlaying = true; // set the 'playing' boolean to true\n\n this.playing = 0; // reset to the beginning\n this.playCurrent(); // start playing the current track\n }", "play(startTime, endTime) {\n let { remote, fullScreen, playin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set last ui state if not in sidebar
function rememberLastState() { if ( lastState.layout !== "sidebar" ) { lastState.position = $ui.position(); lastState.size = {}; lastState.size.uiWidth = $ui.outerWidth(); lastState.size.uiHeight = $ui.outerHeight() ...
[ "unfoldSidebarTemporarily() {\n this._yqSidebarService.getSidebar('chatPanel').unfoldTemporarily();\n }", "toggleSidebarFolded() {\n this._yqSidebarService.getSidebar('navbar').toggleFold();\n }", "function resetUiBounds()\n {\n // if ui is off the page, relocate it\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to get the index of a string after a particular position
function getPosition(str,start,needle){ var index = str.substr(start).indexOf(needle); if (index==-1) { return index; } return index+start; }
[ "function last(){\n\tvar isi = \"saya beajar di rumah beajar\";\n\tconsole.log(isi.lastIndexOf(\"beajar\",5)); //nilai angka berfungsi sebagai startnya di index\n}", "getIndexForPositionString (positionString = 'a1') {\n const { row, column } = this.getCoordinatesForPositionString(positionString)\n let inde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read variable length words to byte array
function readNWord(bytes, index, length) { if (length <= 4) { // Word fits in 32-bit let result = 0; for (let b = 0; b < length; b++) { result <<= 8; result |= bytes[index++]; } return result; } else { // Word requires 64-bit JS nastiness let lo = 0, hi = 0; for (let b = 4; b < length; b++)...
[ "function writeNWord(bytes, index, word, length)\n{\n\t// Writing \"backwards\" (from end of destination to start) is easier.\n\tif (length <= 4)\n\t{\n\t\tlet i = index + length - 1;\n\t\twhile (i >= index)\n\t\t{\n\t\t\tbytes[i--] = word & 0xff;\n\t\t\tword >>>= 8;\n\t\t}\n\t}\n\telse\n\t{\n\t\t// Backwards writi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class: Grid Object representing the grid on which the plot is drawn. The grid in this context is the area bounded by the axes, the area which will contain the series. Note, the series are drawn on their own canvas. The Grid object cannot be instantiated directly, but is created by the Plot oject. Grid properties can be...
function Grid() { $.jqplot.ElemContainer.call(this); // Group: Properties // prop: drawGridlines // wether to draw the gridlines on the plot. this.drawGridlines = true; // prop: gridLineColor // color of the grid lines. this.gridLineColor = '#cccc...
[ "constructor (xTickSpacing = 1, yTickSpacing = null, config = {}) {\n this.xTickSpacing = xTickSpacing;\n this.yTickSpacing = yTickSpacing == null ? xTickSpacing : yTickSpacing;\n this.gridWidth = config.gridWidth == null ? 1 : config.gridWidth;\n this.axisWidth = config.axisWidth == null ? 2 : config.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION TO RESET FIXED FIELD HEADERS ACTIVITY FOR TELEPHONE EMAIL
function resetFixedFieldActivity () { //alertx("In resetFixedFieldActivity function!"); totalInfoP.style.display = "none"; fieldSUM = 0;//clear to 0 in case TOTAL function has been used emailBtn.setAttribute('class','tdEdit');//if cancel CONTACTS or ignore flashing CONTACTS AND GO TO HOME SCRN CONTACTS BTN WILL STA...
[ "function coheUpdateMessageHeaders()\n {\n // Remove the height attr so that it redraws correctly. Works around a\n // problem that attachment-splitter causes if it's moved high enough to\n // affect the header box:\n document.getElementById('msgHeaderView').removeAttribute('height');\n\n // iterate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
upgrades the property to output this block return 0 if the property was upgraded, or is compatible, 1 if the shared information needs to be written out, but the property was upgraded 2 if the shared information needs to be reserialized
function upgrade(property) { if (!property) { return 1 } var compatibility if (property) { // same block was serialized last time, fast path to compatility if (property.insertedFrom === this && property.insertedVersion === this.version && ( property.recordUpdate || property.isFrozen || (property.length ==...
[ "checkWrite(){\n this.currentUpdates++;\n if(this.currentUpdates >= this.writeInfoToDiskAfter){\n //this is async but we are not looking if success or not\n this.write();\n }\n }", "getUpgradeMap(model) {\n\n let upgradeMap = {};\n\n for (let newTableName in mod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CheckPage /// : gets the last part of the current url, and checks the passed in string to see if they are the same.
function CheckUrlEnd(checkUrl){ var path = window.location.pathname; var pathSplit = path.split("/"); var urlEnd = pathSplit[pathSplit.length - 1]; if(urlEnd == checkUrl){ return true; } return false; }
[ "function isSamePage(href1, href2) {\n var page1 = href1.substring(href1.lastIndexOf('/')+1,href1.lastIndexOf('.html'));\n var page2 = href2.substring(href2.lastIndexOf('/')+1,href2.lastIndexOf('.html'));\n return (page1 == page2);\n}", "async isCorrectPageOpened() {\n let currentURL = await PageUtils.get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An exception class to be instantiated when a value is Not of type number
function NumberTypeError(value){ this.value = value; this.message = 'must be a number.'; this.toString = function(){ return this.value + ' ' + this.message; }; }
[ "validate(value) {\n if (value < 0) throw new Error('Valor negativo para preço');\n }", "isNumber(expression) {\n doCheck(this.typesAreEquivalent(expression.type, NumType), \"Not a number\");\n }", "function ISERR(value) {\n return value !== error$2.na && value.constructor.name === 'Error' || typeo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a portfolio for AWS Service Catalog. For more information, see CreatePortfolio in the AWS Service Catalog Developer Guide. Documentation:
function Portfolio(props) { return __assign({ Type: 'AWS::ServiceCatalog::Portfolio' }, props); }
[ "@action\n createPortfolio(portfolioName) {\n requester.Portfolio.create(portfolioName)\n .then(() => {\n this.getPortfolios(); // gets new portfolios\n })\n .catch(err => console.log(err));\n }", "static adicionar(portfolio, callback) {\n return db.query(\"insert into portfolio(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1. reservation.status = 0 (pending) 2. user.r_newcomer = 0 3. user.r_active = 1
function makeReservationRequest(r_context, callback) { var insertQuery = "insert into reservation (house_id, user_id, checkin, checkout, num_guest, price_total, created) values (?,?,?,?,?,?,?);"; var updateUser = "update user set r_newcomer = 0, r_active = 1 where id = ?"; return db.query(insertQuery + updateUser, ...
[ "async function updateStatus(req, res, next) {\n const { reservation_id } = req.params;\n const { status } = req.body.data;\n const reservation = await service.updateStatus(reservation_id, status);\n\n res.status(200).json({ data: { status: reservation[0] }});\n}", "async function updateStatus(req, res) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FullCalendarspecific DOM Utilities Given the scrollbar widths of some other container, create borders/margins on rowEls in order to match the left and right space that was offset by the scrollbars. A 1pixel border first, then margin beyond that.
function compensateScroll(rowEls, scrollbarWidths) { if (scrollbarWidths.left) { rowEls.css({ 'border-left-width': 1, 'margin-left': scrollbarWidths.left - 1 }); } if (scrollbarWidths.right) { rowEls.css({ 'border-right-width': 1, 'marg...
[ "function setBorders() {\n self.borders = {};\n\n self.nodes.forEach(function(node) {\n self.borders.minX = Math.min(\n self.borders.minX == undefined ?\n node['displayX'] - node['displaySize'] :\n self.borders.minX,\n node['displayX'] - node['displaySize']\n );\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the event listener to the 'manual scrobble'button.
function manScrobbleButton() { var manScrobbButton = document.getElementById("lastfm-man-scrobble"); manScrobbButton.addEventListener("click", scrobbleManual, false); }
[ "function dontScrobbleButton() {\r\n\tvar dontScrobbleButton = document.getElementById(\"lastfm-noscrobble\");\r\n\tdontScrobbleButton.addEventListener(\"click\", dontScrobble, false);\r\n}", "onListenButtonClick() {\n this.micIcon.classList.add(\"hidden\");\n this.loader.classList.remove(\"hidden\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNTIONS function for crawl Tiki
function crawlTiki() { var options = { url : "https://tiki.vn/api/v2/deals/collections/?category_ids=&sort=rand&type=now&page=1&per_page=20&from=1521963271&to=1527147271&apikey=2cd335e2c2c74a6f9f4b540b91128e55" // https://tiki.vn/api/v2/deals/collections/?category_ids=&sort=rand&type=now&page=1&per_...
[ "function displayTiddlers(src,titles,state,highlightText,highlightCaseSensitive,animate,slowly)\n{\n\tvar tiddlerNames = titles.readBracketedList();\n\tfor(var t = tiddlerNames.length-1;t>=0;t--)\n\t\tdisplayTiddler(src,tiddlerNames[t],state,highlightText,highlightCaseSensitive,animate,slowly);\n}", "function req...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Manual mode, set the next position of the spark
next(pos) { this.position = pos; this.points = this.points || []; this.points.push(pos); if (this.points.length > this.sparkResolution) { this.points.shift(); } }
[ "_carouselPointActiver() {\r\n const i = Math.ceil(this.currentSlide / this.slideItems);\r\n this.activePoint = i;\r\n this.cdr.markForCheck();\r\n }", "advanceStage()\n {\n this.stage = this.nextStage;\n }", "function nextSlide(step) {\n pos = Math.min(pos + step, 0);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Switch to proper visible iframe so driver can interacts with it's elements
async switchToIFrame(iframeName) { let iframeElement; if (iframeName === 'Login' || iframeName === 'Signup') { iframeElement = await this.driver.findElement(By.css(SELECTORS.iframeElementLoginSignup)); } else if (iframeName === 'Welcome') { iframeElement = await this.driv...
[ "function hideiframe() {\r\n\r\n browser = navigator.appName;\r\n\t\r\n\t$(\"#text\"+selected_div).css('visibility','');\r\n\t\r\n\tvar myIFrame = document.getElementById(\"iView\");\r\n var iframe_body_html = myIFrame.contentWindow.document.body.innerHTML;\r\n \r\n $(\"#text\"+selected_div).html...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create image from svg text
toImg(svgText, orgWidth, orgHeight, imgWidth, imgHeight) { // Create Canvas let canvas = document.createElement('canvas'); canvas.width = imgWidth; canvas.height = imgHeight; let ctx = canvas.getContext("2d"); // show canvas //this._refRenderer.current.appendChild(canvas); // Create image let img = ...
[ "function drawImgText(elText) {\n drawImage(gCurrImg)\n}", "createSVGElement(w,h){const svgElement=document.createElementNS(svgNs$1,'svg');svgElement.setAttribute('height',w.toString());svgElement.setAttribute('width',h.toString());return svgElement;}", "add_text(svg_target, txt, x_pos, y_pos, font_size, tra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a mixer with [ins] number of inputs
function LineMixer(ins) { this.inputs = []; for (var i = 0; i < ins; i++) { this.inputs[i] = audioContext.createGainNode(); } }
[ "function oscillatorCreator(num){\n let oscArray = [];\n for (var i = 0; i<num; i++){\n oscArray.push(audioCtx.createOscillator())\n }\n return oscArray\n}", "function Instrument (options) {\n\tvar i, waveForm, array, mod;\n\toptions = options || {};\n\n\tif (options.context) {\n\t\tthis.context = options....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call the callback with a single argument which is an object containing a property for each edit in the database; the property name is the PostingID, and the property value is the edit object for that posting.
function withEditsObj(callback) { db.nycapt_edits.find(function(err,edits) { //console.log('number of edits found is: ' + edits.length); var editsObj = {}; _.each(edits, function(edit) { editsObj[edit["PostingID"]] = edit; }); callback(editsObj); }); }
[ "function displayEditPost(post){\r\n\t\t\t$(\"form#edit-form input#title\").val(post.title);\r\n\t\t\t$(\"form#edit-form textarea#content\").val(post.body);\r\n\t\t}", "function saveOrUpdatePost(){\n\t\t\n\t\t//get the values from the input elements\n\t\tvar title=$('#edittitle').val();\n\t\tvar text=$('#edittext...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update the global appliance list
function updateGlobalList(id) { var tag = id.split('-')[1] if (document.getElementById(id).checked) { globalApplianceList[tag] = getApplianceList(tag); } else { delete globalApplianceList[tag] } }
[ "async updateAppliances() {\n while (true) {\n try {\n await this.homeconnect.waitUntilAuthorised();\n let appliances = await this.homeconnect.getAppliances();\n this.log.debug('Found ' + appliances.length + ' appliances');\n await this.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
target the thing to track. Tracks at its center. offset offset that the Tracker's location is positioned relative to the target's computed origin trackRotation if set, `offset` will be computed relative to the target's rotation. internalOffset the final offset that will be applied to make this entity line up as desired...
constructor(target, offset = new Point(), trackRotation = true, internalOffset = new Point()) { super(); this.target = target; this.trackRotation = trackRotation; this.offset = offset.copy(); this.internalOffset = internalOffset.copy(); }
[ "function snapToTargetMid(event, target) {\r\n var targetMid = mid(target);\r\n\r\n AXES.forEach(function(axis) {\r\n if (isMid(event, target, axis)) {\r\n setSnapped(event, axis, targetMid[ axis ]);\r\n }\r\n });\r\n}", "refreshCenter()\n {\n let { x, y } = this.editing == \"start\"? { x:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether the binding part with the given index belongs to the current model name and is not a static binding
function isPartForModel(iPartIndex) { return aParts[iPartIndex].model == sModelName && aParts[iPartIndex].value === undefined; }
[ "function isExistingIndexVarNameInStep(sO, name) {\r\n\r\n for (var d = 0; d < sO.dimNameExprs.length; d++) {\r\n\r\n if (sO.dimNameExprs[d].str == name)\r\n return true;\r\n }\r\n\r\n return false;\r\n}", "function checkBindings () {\n addLog('checkBindings() was Triggered');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the array of course keys for which the student has registered from local storage.
function getCourseArray(){ var courseArray = localStorage.getItem("courseArray"); if(!courseArray){ courseArray = [] localStorage.setItem("courseArray", JSON.stringify(courseArray)); } else { courseArray = JSON.parse(courseArray); //Turns JSON string back into a JavaScript object } return courseArray; }
[ "getDatasetsKeys(){\n let keys=this.localStorageService.keys();\n\n return keys;\n }", "static async getAllKeys() {\n try {\n const allKeys = await StorageSystem.getAllKeys();\n return allKeys\n } catch (err) {\n return []\n }\n }", "getCourseIDs(studentID) {\n const courseIns...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if id provided is corresponding to video download
function findCurrentDownloadByID(id){ if (currentDownloadVideos[id] === undefined) { // if id is invalid return undefined; } else { // if valid return videos[id] return currentDownloadVideos[id]; } }
[ "function isValidVideoId(id) {\n // this returns a promise and resolves to true if the video id is valid\n // in the interest of time this is the quickest way to return a 200 or 404 based on the given video id.\n return new Promise((resolve, reject) => {\n axios.get(`https://vimeo.com/api/oemb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format the rawsequencing file download query string.
formatRawSequencingFileQuery() { const query = this.buildBasicQuery(); query.addKeyValue(`${this._fileQueryKey}.output_type`, this._outputType); query.addKeyValue(`${this._fileQueryKey}.output_category`, this._outputCategory); this._rawSequencingFileQueryString = query.format(); }
[ "buildQuerry (query){\n var ecodedQuery = encodeURIComponent(query);\n return ecodedQuery;\n }", "function buildSolrQueryLinkString(direction, querystring, position, total, rows){\n\n\tvar offset = jQuery(document).getUrlParam(\"start\") / 1;\n\tposition = position / 1;\n\ttotal = total / 1;\n\tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get value from numpad and set it to currently highlighted cell
function inputValue() { //*1 Get clicked numpad value const value = getNumpadValue(); //*2 if a digit has been clicked if (value !== 0 && !isNaN(value)) { setCellValue(value); } else if (value === "clear") { setCellValue(""); } else return; resetNumpad(); }
[ "function selectKnCell(e){\n\tvar knCell = keynapse.currentKnCell;\n\tstopKeynapse();\n\n\tif(knCell.type == 'text'){\n\t\t$(knCell).focus();\t\t\n\t} else {\n\t\t$(knCell).focus();\n\t\t$(knCell).trigger(\"click\");\n\t}\n}", "function markCell(){\r\n\tdocument.getElementById(\"selected\").style.backgroundColor ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
number of unclaimed bingos on this card by the user constructor loads the card (cardArr) with random numbers (represented by Cells)
constructor() { let chosenNums = []; for (let i = 0; i < 5; i++) { //row this.cardArr.push([]); for (let j = 0; j < 5; j++) { //column const num = Math.floor(Math.random() * 15) + 15 * j; if (chosenNums.indexOf(num) === -1) { chosenNums.push(num); this.cardArr[i][...
[ "function createCards(){\n //this shuffles the card faces\n //the cardFace array produces different cards as the i first cards\n //every time the game is reloaded\n cardFace = shuffle(cardFaceOrdered);\n //creates the card objects\n preCard = [];\n for (var i = 0; i < cardNb; i++){\n if(i < cardNb/2){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the available anytime acquisition times.
populateAcquisitionTimes(acquisitionTimeOptions) { if (!this.props.combinatorContract || !acquisitionTimeOptions || acquisitionTimeOptions.length == 0) { return []; } var acquisitionTimes = []; var combinators = splitContract(this.props.combinatorContract); var index...
[ "static channel_times() {\n return {\n MSNBCW: [\n '4:00pm',\n '5:00pm',\n '6:00pm',\n '7:00pm',\n '8:00pm',\n ],\n CNNW: [\n '5:00pm',\n '6:00pm',\n '7:00pm',\n '8:00pm',\n '9:00pm',\n ],\n FOXNEWSW: [\n '6:00p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears the pledge form
function clearPledgeForm() { pledgeAddressData = {}; $.each(pledgeRootElement.find('input, textarea'), function(index, value) { setPledgeFieldValidity($(value), null); $(value).val(''); }); $.each(pledgeRootElement.find('label'), function(index, value) { $(value).removeClass('active');...
[ "function clear_form(){\n $(form_fields.all).val('');\n }", "function clearForm() {\n form.reset();\n }", "function creditClear(){\n CCT.index.creditClear();\n \n document.mForm.mCreditTransID.value = \"\";\n document.mForm.mCreditC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a [range](rangeset.Range) with this value.
range(from, to = from) { return new Range(from, to, this); }
[ "function Range() {\n\tthis.minCells = 2 // Can operate on a minimum of 2 cells\n\tthis.maxCells = 4 // Can operate on a maximum of 4 cells\n\tthis.symbol = 'range'\n}", "range(start, end) {\n return new vscode.Range(start, end);\n }", "range (length) { return this.repeat(length, (i, a) => { a[i] = i ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove last row from risk array of relevent category object
function removeRisk(event) { // Capture which category to add criteria too var categoryId = $(event.currentTarget).attr('data-id'); // Remove last criteria from array projectManager.removeRiskFrom(projectManager.getCategory(categoryId)); // Update interface update(); }
[ "function destructivelyRemoveLastKitten(){\n kittens.pop();\n}", "function remove_category_row(thisObj) {\n\tthisObj.closest('.row').fadeOut('normal', function(){\n\t\tthisObj.closest('.row').remove();\n\t\tupdate_pricing_table();\n\t});\n}", "deleteWeight(){\n //If they only have one weight logged, the...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
webpackBootstrap install a JSONP callback for chunk loading
function webpackJsonpCallback(data) { /******/ var chunkIds = data[0]; /******/ var moreModules = data[1]; /******/ /******/ /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback /******/ var moduleId, chunkId, i = 0, resolves = []; /******/ fo...
[ "function webpackPluginServe(_a) {\n var _this = this;\n var staticPaths = _a.staticPaths, historyApiFallback = _a.historyApiFallback, options = tslib_1.__rest(_a, [\"staticPaths\", \"historyApiFallback\"]);\n if (process.env.STORYBOOK) {\n return {};\n }\n var historyFallback = !!historyApiFa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is to return a list of hints (label and value) and the replacement location if chosen. It will be called by Codemirror in a number of circumstances... when the user has entered a dot following a parameter > token is the . and prior is the parameter when the user has clicked on showHint with cursor immedia...
function myPropHint(cm, options) { var cur = cm.getCursor(); var token = cm.getTokenAt(cur); var priorToken = token.start > 0 ? cm.getTokenAt({ line: cur.line, ch: token.start - 1 }) : null; var priorChar = cm.getValue().substring(token.start - 1, token.start); ...
[ "function printHint() {\n $('#hint').text(current_word.hint);\n}", "function getHintValue() {\n hint = ((category == \"dictionary\") ?\n ((hintCollection.length >= 1) ? hintCollection[Math.floor(Math.random() * hintCollection.length)] : `First letter in this word is: ${firstLetter}`) :\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The user name, repository name, and description can be set when an instance of this class is created
constructor(userName, repoName, description) { this.userName = userName; this.repoName = repoName; this.description = description; // all `GutHubRepo` objects should start with an empty array for the files property. this.files = []; }
[ "constructor(firstName, lastName, username, password, guid)\n\t{\n\t\tthis.guid = guid;\n\t\tthis.username = username;\n\t\tthis.firstName = firstName;\n\t\tthis.lastName = lastName;\n\t\tthis.password = password;\n\t\tthis.preferences = new UserPreferences();\n\t}", "function User(userName, fullName, accessType,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set's i to random number and removes item (i) from array GemNum
function gemSplice(){ // Remove array gemNum item i gemNum.splice(i, 1); // Console log updated array //("Gem Array Updated: " +gemNum); }
[ "function crystValues(){\n for (i = 0; i < gemArray.length; i++) {\n gemArray[i] = Math.floor(Math.random() * 12) + 1;\n} \n//prints values of each item\n //console.log(gemArray);\n}", "function gemRandomNumber() {\n for (var i = 0; i < 4; i++) {\n var num = Math.floor(Math.random() *...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shortcut function called when a section unloaded by the Theme Editor 'shopify:section:unload' event.
onUnload() { // Do something when a section instance is unloaded }
[ "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}", "onBeforeUnload(callback) {\n return this.windowEventHandler.addUnloadCallback(callback);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Paginaged version of allTransactions request
allTransactionsPaginated(address, params) { if (params === undefined) params = {}; return new AllTransactionsPageable_1.AllTransactionsPageable(this, address, params); }
[ "static async getEthTransactions() {\n const walletAddress = await this.getWallet().then(wallet =>\n wallet.getAddressString(),\n );\n\n return fetch(\n `https://api.ethplorer.io/getAddressTransactions/${walletAddress}?apiKey=freekey`,\n )\n .then(response => response.json())\n .then...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
can only create company template, not default template You need to update database manually to create default template
async function createTemplate(obj, args, context, info) { // 1. user login let userId = store.getUserId() if (!userId) { return { err_code: 4000, err_msg: 'User token is not valid or empty' } } // 2. get my company let myCompany = await Company.findUserCompany(userId) if (!myCompany...
[ "async createProjectTemplate(event, data) {\n const result = await this.templateCreator.create(data.type, data.location);\n if (!result || result.err) {\n let msg = `Could not create ${data.type} template at ${data.location}`;\n if (result && result.err) {\n msg = result.err;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles a selection event by highlighting/outling the shape that bounds the clicked point
function handleSelection( e ) { //Get selected features var features = e.selected; var feature; //TODO???: Handle multi-select? if( features != undefined ) { feature = features[0]; if( feature != undefined ) $("#shapeList").val( feature.getId() ).trigger('change'); } }
[ "highlightSelected() {\n\n this.highlighter.setPosition(this.xStart + this.selected * this.distance, this.yPosition + this.highlighterOffsetY);\n\n }", "function render_select(context)\n{\n\tif(selection_coordinates != null)\n\t{\n\t\tstroke_tile(selection_coordinates.x, selection_coordinates.y, grid_se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use our own pitcher override [framework]loader pitcher
function replacePitcher( { rules, query = [], pitcherLoader: loader } ) { const pitcherRule = findRuleByQuery( rules, query ) if ( !pitcherRule ) { return } const pitcherUse = pitcherRule.use const pitcherLoader = pitcherUse[ 0 ] // replace pitcherLoader.loader = loader }
[ "function SoundTARLoader() {}", "_preload () {\n const preloader = new Preloader();\n\n preloader.run().then(() => { this._start() });\n }", "function PxLoaderHowl(options) {\n var me = this,\n loader = null;\n\n me.tags = options.tags;\n me.priority = options.priority;\n\n me.sound = ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display all the even numbers contained in sampleArray. (244, 758, 450, ..., 940, 472)
function kata12(smplArr){ let newElement = document.createElement("article"); newElement.className = "articleClass"; let headingElement= document.createElement("h1"); headingElement.className = "subHeadingClass"; headingElement.appendChild(document.createTextNode("12--Display all the even numbers co...
[ "function kata13(smplArr){\n let newElement = document.createElement(\"article\");\n newElement.className = \"articleClass\";\n let headingElement= document.createElement(\"h1\");\n headingElement.className = \"subHeadingClass\";\n headingElement.appendChild(document.createTextNode(\"13--Display all ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move a ring from one tower to another. The last element of the tower's array represents the top ring on the tower.
function moveRing(from, to) { if (from < 0 || from > 2 || to < 0 || to > 2 || from === to) { throw new Error(`Invalid rings: ${from}, ${to}`); } const movingRing = towers[from][towers[from].length - 1]; towers[from] = towers[from].slice(0, towers[from].length - 1); towers[to].push(movingRing)...
[ "moveSnake() {\n\t\tthis.moveQueue.unshift(this.direction);\n\n\t\tfor (let i = 0; i < this.snake.length; i++) {\n\t\t\tconst {r, c} = this.snake[i];\n\t\t\tconst {newR, newC} = this.nextCoordinates(r, c, this.moveQueue[i]);\n\n\t\t\tthis.checkBounds(newR, newC);\n\n\t\t\tif (this.board[newC][newR] === 2) {\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that deletes technical skill
function deleteTechnicalSkill(userSkill) { return new Promise((resolve, reject) => { dashboardModel.deleteTechnicalSkill(userSkill).then((data) => { resolve({ code: code.OK, message: '', data: data }) }).catch((err) => { if (err.message === message.INTERNAL_SERVER_ERROR) reject({ cod...
[ "function DeleteSkill(id) {\n var URL = API_HOST + API_SKILLS_PATH +'/'+ id;\n Axios.delete(URL).then(() => console.log(\"skill is deleted\"));\n return true;\n}", "function delSkill(eleId)\n{\n var skldata = document.getElementById('skillarray').textContent;\n var arrSkill = skldata.split(\",\");\n d = doc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether the component instance is detached from its [`IdentityMap`](
isDetached() { return !this.isAttached(); }
[ "static isDetached() {\n return !this.isAttached();\n }", "detach() {\n if (this.hasPrimaryIdentifierAttribute()) {\n const identityMap = this.constructor.getIdentityMap();\n identityMap.removeComponent(this);\n }\n Object.defineProperty(this, '__isAttached', {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets element directly below cursor
function getItemBelowCursor(container, mouseY) { let items = [...container.querySelectorAll('.item:not(.dragging)')] return items.reduce((closestOffset, item) => { // returns the rectangle that makes up an item const box = item.getBoundingClientRect() const offset = mouseY - box.top - box.height / 2 // offs...
[ "function moveCursorToEnd (el) {\r\n\r\n\t// Move to the end of the element\r\n\tel.setSelectionRange(0, el.value.length);\r\n\tel.focus();\r\n\t\r\n}", "function move_cursor_to_end(ele) {\n var document = ele.ownerDocument;\n var selection = document.defaultView.getSelection();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Caches a downloaded file (GUID) and installs it into the tool cache with a given targetName
function cacheFile(sourceFile, targetFile, tool, version, arch) { return __awaiter(this, void 0, void 0, function* () { version = semver.clean(version) || version; arch = arch || os.arch(); core.debug(`Caching tool ${tool} ${version} ${arch}`); core.debug(`source file: ${sourceFile}`...
[ "function onSaveButtonClicked(event) {\n\t// console.log('clicked');\n\tif ('caches' in window) {\n\t\tcaches.open('user-requested')\n\t\t .then(function (cache) {\n\t\t\t cache.add('https://httpbin.org/get');\n\t\t\t cache.add('/src/images/sf-boat.jpg');\n\t\t });\n\t}\n}", "function loadFile...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Escapes characters that can not be in an XML attribute.
function escapeAttribute(value) { return value.replace(/&/g, '&amp;').replace(/'/g, '&apos;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); }
[ "function escapeXml(xml) \n{\n return xml.replace(/[<>&'\"]/g, function (c) {\n switch (c) {\n case '<': return '&lt;';\n case '>': return '&gt;';\n case '&': return '&amp;';\n case '\\'': return '&apos;';\n case '\"': return '&quot;';\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the keyword token.
getKeywordToken() { return this.compilerNode.keywordToken; }
[ "function peek() {\n return tokens[position];\n }", "getNextToken_() {\n const character = this.cssText[this.offset];\n let token;\n this.currentToken_ = null;\n if (this.offset >= this.cssText.length) {\n return null;\n }\n else if (common_1.matcher....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the path to the html version of the man page
htmlMan (man) { const sect = manSectionNames[man.match(manNumberRegex)[1]] const f = path.basename(man).replace(manNumberRegex, '') return 'file:///' + path.resolve(this.npm.npmRoot, `docs/output/${sect}/${f}.html`) }
[ "function man(args) {\n var manual = false;\n Object.getOwnPropertyNames(commands).forEach(\n function (val, idx, array) {\n if (val == args[0]) {\n manual = 'Manual: ' + val + stringUnderline('Manual: ' + val, '-');\n if (commands[val]['description']) {\n manual += '<br> DESCRIPTIO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update the team dev_plan to this url
function updateTeamDevPlan(url) { updateTeam({id: tid, dev_plan: url}).then(function (data) { if (data.error) { oh.comm.alert('错误', data.error.friendly_message); } else { $('#projectPlanModal').modal('hide'); $('#dev_plan_span').text('上传文件'...
[ "async update(plan) {\n try {\n // Fetch a matching plan\n const monthlyPlan = await Plan.getByNickname(plan);\n const meteredPlan = await Plan.getByNickname(plan + '_requests');\n if (!monthlyPlan || !meteredPlan) {\n throw new Error(\n `Monthly or metered plans for ${plan} n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate current quiz by selecting top 5 elements from shuffled STORE
function generateQuizFromStore() { shuffleArray(STORE); return STORE.slice(0,5); }
[ "function displayTrivia(){\n copyAnswerArray = answerArray.slice(0); // create a copy of the questions\n shuffle(copyAnswerArray);// shuffle the answers\n if (question[0].length > 50){ // Changes font size of question if too big\n questionDisplay.style.fontSize = 1.25 + 'em';\n }\n else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populate the list in the selected match day
function populateMatchesList(matchday){ // Remove all the previous items $('#matchList li').remove(); var currentMatches = storage.matches[matchday]; storage['currentMatches'] = currentMatches var sortedCurrentMatches = [] $.each(currentMatches, function(matchID, currentMatch){ so...
[ "function dynamicDateList(location) {\n var listItems = document.querySelector(location);\n for (var i = 0; i < 7; i++) {\n listItems.options[i + 1].innerHTML = getCurrentDate(i);\n }\n}", "function populateComboBox(){\r\n $('#select-matchday').empty();\r\n $('#select-matchday-map').empty();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }