query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Updates the title of the column with a localized value.
UpdateTitle() { var Key = this.TitleKey || this.Name; var self = this; tp.Res.GS(Key, function (Value, UserTag) { self.Title = Value; }, null, Key, this); }
[ "function fnUpdateTitle()\n{\n var oTitleCell = element.children[0].rows[0].cells[0]\n if (gbShowTitle)\n //Risun changed, Overturn the order of month and year. 2000.8.7\n//==============================================\n//Risun changed for multi language. 2001.7.20\n//-----------------------------------------...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds sample to the array if the timestamp is not more than 5 seconds since the last timestamp. and determines if this sample is valid by: 1. Ensuring there is an adequate sample size (>=5). 2. Ensuring the stddev of the sampling is +/4. 3. The average of the sampling is +/4 of the last valid sample.
function isValidSample(value, timestamp) { // Has it been more than 5 seconds since last sample received. if (timestamp > lastTimestamp+5) { resetSamples(); } offsetSamples.push(value); lastTimestamp = timestamp; if (hasValidSampleSize()) { ...
[ "addSample(t, val) {\n let previous_value;\n if (this._time[this._idx] === t) {\n // Overwrite last @_values.\n this._values[this._idx] = val;\n return;\n } else if (this._time[this._idx] > t) {\n console.log(\"Error: RunningAverageFilter: cannot add sample with @_time less than previou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Invoke the given replicator and return a promise that signals completion of the replication.
function replicate(replicator) { var deferred = Q.defer(); expect(replicator).not.toBe(null); var mtimer; function poll(replicator) { mtimer = setInterval(function () { replicator.getState() .then(function (result) { expect(result).not.toBe(null); ...
[ "function replicateFromRemoteDB(){\n\t\tvar opts = {\n\t\t\tlive: true,\n\t\t\tretry: true,\n\t\t\tfilter: function(doc){\n\t\t\t\treturn !doc._deleted;\n\t\t\t}\n\t\t};\n\n\t\tconsole.log('Start replicating from remote database...');\n\n\t\tvar d = $q.defer(),\n\t\t\tpromise = d.promise;\n\n\t\t// d.resolve(true);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
void :: resolve_system(...) state :: GameState id :: GameState index of system apply :: function(state, reg_object) => A Function to manipulate state based on the entity A generic function for systems to act upon the state safely with entities. This should be used by most systems. This way code is not copied and instan...
function resolve_system(state, id, apply){ if(state[id] !== undefined){ for(var i = 0; i < state[id].registry.length; i ++){ if(resolve_registry(state, state[id].registry[i].entity, state[id].registry, i)){ apply(state, state[id].registry[i]); } } } }
[ "function resolve_spawn(state){\n resolve_system(state, spawning_id, (state, registry_obj) => {\n const entity_id = registry_obj.entity;\n const list_id = registry_obj.spawn_list;\n switch(registry_obj.type){\n case spawn_type_periodic:\n default:\n resol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loads a hds from a client file
function loadHds () { var input = this; var components = input.value.split("/"); if (components.length < 2) components = input.value.split("\\"); d3.select("input#filename").attr("value",components [components.length-1]); var fileobj = input.files[0]; var reader = new FileReader(); // Closure t...
[ "function h$loadFileData(path) {\n if(path.charCodeAt(path.length-1) === 0) {\n path = path.substring(0,path.length-1);\n }\n if(typeof h$nodeFs !== 'undefined' && h$nodeFs.readFileSync) { // node.js\n return h$fromNodeBuffer(h$nodeFs.readFileSync(path));\n } else if(typeof snarf !== 'undefined') { // Spi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In this Kata, you will be given an array of strings and your task is to remove all consecutive duplicate letters from each string in the array. For example: dup(["abracadabra","allottee","assessee"]) = ["abracadabra","alote","asese"]. dup(["kelless","keenness"]) = ["keles","kenes"]. Strings will be lowercase only, no s...
function dup(s) { return s.map((val) => removeDublicateChars(val)); function removeDublicateChars(str) { let res = ""; for (let i = 0; i < str.length; i++) { if (str[i] !== str[i + 1]) { res += str[i]; } } return res; } }
[ "function dup(s) {\n //input: array of string\n //output: array of string\n\n // algo\n // [x]look at array of string\n // [x]look at each letter in the string\n // [x]check to see if the next letter is the same\n // [x]if it is remove letter\n // return modified string\n\n var arrayPlace...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
disableAcceptButton() enableAcceptButtonEnable a button "accept"
function enableAcceptButton() { var xbutton = document.getElementById("acceptbutton"); if( xbutton != undefined ){ document.getElementById("acceptbutton").removeAttribute('hidden'); acceptButton = true; } return true; }
[ "function disableAcceptButton() {\t\t\n\tvar xbutton = document.getElementById(\"acceptbutton\");\n\tif( xbutton != undefined ){\n\t\tdocument.getElementById(\"acceptbutton\").setAttribute('hidden', 'true');\n\t\tacceptButton = false;\n\t}\n\treturn true;\n}", "function enableInsConsButton() {\t\t\n\tvar xbutton ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used by the 'loadballottemplatemodal' to load the user selected ballot template.
function loadBallotTemplate() { let templateCode = vm.selectedBallotTemplateCode; if (usingLocalStorage) { loadBallotTemplateLocal(templateCode); } else { $log.info('Loading ballot template with code: ' + templateCode); optionDesignerSe...
[ "function _loadTemplate()\n {\n var memento = {\n 'templateId': pageModel.getTemplateModel().getId(),\n 'pageId': currentPageId,\n 'tabId': \"perc-tab-layout\"\n };\n $.PercNavigationManager.goToLocation($.PercNavigationManager.VIE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks what company issued a card with invalid cardnumber Returns an array containing one instance of each company, and at what index this company had an invalid card
function idInvalidCardCompanies (invalidCards) { let companies = []; let x = 0; for (let i = 0; i < invalidCards.length; i++) { if (invalidCards [i] [0] == 3) { if (!companies.includes('American Express')) { console.log(`Index ${i}, American Express`); companies [x] = 'American Express'...
[ "function idInvalidCardCompanies(invalidCredCards){\n let invalidCardCompany=[];\n let companyDetails={\n \"3\":'Amex (American Express)',\n \"4\":'Visa',\n \"5\":'Matercard',\n \"6\":'Discover'\n }\n for(invalidCard of invalidCredCards){\n if(companyDetails[invalidCard[0]]){\n if(!invalidCar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addRange function adds ranges to range array
addRange(high, low, mid) { this.range.push({ 'high': high, 'low': low, 'mid': mid, }) //return this.range }
[ "add(range) {\n this.list.push(range);\n this.addRangeToList();\n }", "addRange() {\n var range = this.scope['loadRanges'][this.scope['loadRanges'].length - 1];\n this.scope['loadRanges'].push({'start': range.start, 'end': range.end});\n }", "function add(rangeList, range) {\n // Noop if range co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a map pattern
addMapPattern() { if(this.pattern !== "random") { if(this.pattern === "lack") { this.environnement.placeBlockPattern(this.map.getRandomRow(1, (this.map.size - 7)), this.map.getRandomCol(1, (this.map.size - 7)), this.gameData.mapPatterns[this.pattern]); } else ...
[ "function addPattern() {\n var patternContainers = [].slice.apply(getPatternContainers());\n patternContainers.forEach(function (container) {\n addPatternLogger.debug('Pattern Container:', container);\n\n // pre-fill default options\n var options = {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bugzilla: 1684525 Polarion: assignee: gtalreja casecomponent: Cloud initialEstimate: 1h caseimportance: medium casecomponent: CandU testSteps: 1. Setup EC2 instance with CloudWatch Metrics Agent( AmazonCloudWatch/latest/monitoring/metricscollectedbyCloudWatchagent.html) 2. Enable Memory metrics 3. Add EC2 Provider to C...
function test_ec2_instance_memory_metrics() {}
[ "metricMemoryUtilization(props) {\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_aws_cloudwatch_MetricOptions(props);\n }\n catch (error) {\n if (process.env.JSII_DEBUG !== \"1\" && error.name === \"DeprecationError\") {\n Error.captureStackTrace(error, this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
round num to p places
function round(num, p) { let m = Math.pow(10, p); return Math.round(num * m) / m; }
[ "function prec(n, p) {\n return Math.round(p * n) / p;\n }", "function round(p) {\r\n return Math.max(0, Math.min(p, 1));\r\n}", "function roundPlaces(num, places) {\n var sign = (num < 0 ? -1 : 1);\n var p = 10; // p = 10 ^ places\n for (var i = 1; i < places; i++) { ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checkForTeamsInvite Currently a meeting invite is simple. The route is to the chat lobby AND there is a 'room' parameter whose value is the room name to be entered in the lobby field. If a meeting invite is found, the route should be the chat lobby IF a user is logged in, and the login page if no user is logged in.
checkForTeamsInvite() { const params = new URLSearchParams(this.props.location.search); const pathname = this.props.location.pathname; const isMeetingInvite = pathname === Routes.Chat && params.has('room'); // Grab any needed user info from the state directly because if we pass ...
[ "checkForJoinOrHost() {\n // Grab any needed user info from the state directly because if we pass\n // it through props we'll re-render after logging in when we really\n // don't need to.\n const state = store.getState();\n\n const pathname = this.props.location.pathname;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API test for 'EnumAccess', Get access list
function Test_EnumAccess() { return __awaiter(this, void 0, void 0, function () { var in_rpc_enum_access_list, out_rpc_enum_access_list; return __generator(this, function (_a) { switch (_a.label) { case 0: console.log("Begin: Test_EnumAccess"); ...
[ "get accessList() {\n const value = this.#accessList || null;\n if (value == null) {\n if (this.type === 1 || this.type === 2) {\n return [];\n }\n return null;\n }\n return value;\n }", "static get AccessPerm () {}", "static get ACC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to query FDA API
function queryFdaApi(recipeNumber, upcID) { // GET request if (upcID && upcID.length == 12) { getData(upcID) .then((response) => response.json()) .then((responseJson) => { // On success, set fdaOutput to the JSON string setFdaOutput(responseJson); if (upcID ==...
[ "function queryfda(q, callback) {\n query(\"https://api.fda.gov/drug/event.json\", q, callback);\n}", "function queryAPI(\n\tquery = queryAllAnime,\n\tvariables = variablesFoQuery,\n\tcallback = displayAllAnime\n) {\n\tconst url = 'https://graphql.anilist.co';\n\t// HTTP request details\n\tlet options = {\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Restaurant image URL Small.
static imageUrlForRestaurantS(restaurant) { if (restaurant.photograph === undefined){ return 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; } return (`/img/400_${restaurant.photograph}.jpg`); }
[ "static smallImageUrlForRestaurant(restaurant) {\n\t\treturn (`/img/${restaurant.photograph_small}`);\n\t}", "static largeImageUrlForRestaurant(restaurant) {\r\n //Photos are named based on Restaurant IDs so use that to find the different sized images\r\n let photoRef = restaurant.id;\r\n return (`/images_s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the media content mime type when available.
getMimeType() { return this.mime; }
[ "function getContentType(){\n\tlog(\"Info: getContentType: start\")\n\tlog(\"Info: getContentType: end\")\n\treturn getEnv().HTTP_CONTENT_TYPE;\n}", "hasMimeType(mimetype) {\n let outputs = this.base || this.remote;\n if (isStream(outputs) && TEXT_MIMETYPES.indexOf(mimetype) !== -1) {\n return \"text\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert bib item entry
function convertBibitem(bibitem, bibitems, ctex, baseOptions) { if (bibitem.bibtype==="xdata") return null; // resolve cross references resolveCrossRefs( bibitem, bibitems, baseOptions ); // extend base options with local options var itemOptions = optionsParse( bibitem.options ); var options; i...
[ "function bibitemToCitation(item, volChoices, url) {\n if (url === undefined) url = null;\n\titem.entryTags['journal'] = journalTitle;\n\tvar number = typeof(item.entryTags['number']) == 'undefined' ?\n\t null :\n\t item.entryTags['number'];\n\titem.entryTags['year'] = yearFromVol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays a dialog when there is an error purchasing the app and allows the user to retry the purchase
function displayPurchaseErrorDialog(includeCancelButton) { // Prompt the user to buy the app by displaying a message dialog var messageDialog = new Windows.UI.Popups.MessageDialog("Something went wrong with the purchase. Please try again so you can continue playing the addictive, jumbled madness!", "L...
[ "function purchaseErrorDialogCallback(elements) {\n\t\tvar btn = elements[0].buttonClicked;\n\t\tswitch (btn) {\n\t\tcase \"retry-purchase\" :\n\t\t\t// Hide the dialog\n\t\t\t$U.core.View.hideDialog();\n\t\t\t// Restart the purchase workflow\n\t\t\t$U.mediaCard.MediaCardController.intialisePurchaseWorkFlow(media);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MATLAB Highlighter 1.55, a small and lightweight JavaScript library for colorizing your MATLAB syntax. Licensed under the MIT license Copyright (c) 2013, Zoltan Fegyver
function highlightMATLABCode(d) { function g(i) { return (i >= "A" && i <= "Z") || (i >= "a" && i <= "z") || (i == ")") } function m(r, j, i) { var s = j.index, t; while (s >= i) { t = r.charAt(--s); if (t == "\n") { break } if (t == "'") { continue } else { return !g(t) } }...
[ "function CustomHighlight() {}", "function highlightColorSel() {\n\n}", "function highlight(js) {\n return js\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\\/\\/(.*)/gm, '<span class=\"comment\">//$1</span>')\n .replace(/('.*?')/gm, '<span class=\"string\">$1</span>')\n .replace...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
dummy component which handles Sort and filter for any onChange event and passes to App.js
render() { return ( <div className='filter'> {/* We need have count of prods, sorting prods latest, lowest and highest, filter sizes */} <div className="filter-result">{this.props.count} Products</div> {/* sortProducts function handles sort for $,$$$ comes from <FILTER> from App.js</FI...
[ "onSortingChange(pagerInfo, filterInfoDoNotUse, sortInfo) {\n const { pager } = this.props;\n\n // Page changed, delegate to appropiate method\n if(pagerInfo && pagerInfo.current != pager.currentPage) {\n this.onPaginationChange(pagerInfo.current);\n return;\n }\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to copy billing address in shipping address fields
function CopyBillingAddress(){ var billing_address = document.getElementById("txt_quote_bill_address").value; var billing_city = document.getElementById("txt_quote_bill_city").value; var billing_pin = document.getElementById("txt_quote_bill_pin").value; var billing_state = document.getElementById("txt_quote...
[ "function CopyBillingAddress(){\r\n\t\tvar billing_address = document.getElementById(\"txt_bill_address\").value;\r\n\t\tvar billing_city = document.getElementById(\"txt_bill_city\").value;\r\n\t\tvar billing_pin = document.getElementById(\"txt_bill_pin\").value;\r\n\t\tvar billing_state = document.getElementById(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RECT, CIRC, LINE, FREE, SELECT NOTE: Initial scd (saved canvas data) is in js/scd.js
function saveCanvas() { canvas.isDrawingMode = false; drawState = "SELECT"; scd = JSON.stringify(canvas); // save canvas data console.log(scd); }
[ "draw(game, canvas, sData, src) {\n sData = sData === null || sData === undefined ? {} : sData; var data = {}; var v;\n for (v in sData) data[v] = sData[v];\n var defaults = {x: 0, y: 0, w: 100, h: 100, t: 0, r: 0, transparency: 1, type: \"rect\", animate: false, n: 2}; // type: rec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retuns an HTMLCollection of all DOM elements that have the A11yClassNames.POPUP class
getAllPopups() { return document.getElementsByClassName(A11yClassNames.POPUP); }
[ "function overflowElts() {\n return overflowPopup().getElementsByClassName(OVERFLOW_ITEM_CLASS);\n }", "function topLevelElts() {\n return self.popupElt.getElementsByClassName(TOPLEVEL_ITEM_CLASS);\n }", "function attach_inpage_popup(element) {\n var targets = $(element);\n var popups = [];\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loading cached fields to be used in LoganaLogForm.
loadCachedFields(){ //Caching fields before full load application this.api.getForums((r)=>{ console.log(r.data); const dataForums = r.data.map( el => ({ key: el.pk, value: el.pk, text: el.fie...
[ "function _qForm_loadFields(){\n\tvar strPackage = _getCookie(\"qForm_\" + this._name + \"_\" + _c_strName);\n\t// there is no form saved\n\tif( strPackage == null ) return false;\n\n\tthis.setFields(_readCookiePackage(strPackage), null, true);\n}", "function loadForm(key){\n\temptyForm();\n\n\t$('.noNav').collap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exported FunctionPlotterGrid / global d3
function FunctionPlotterGrid(options) { let domain, grid, range, scales, where, tickEvery; grid = this; init(options); return grid; /* INITIALIZE */ function init(options) { _required(options); // _default(options); grid.xTicks = addXTicks(); grid.yTicks = addYTicks(...
[ "_appendGrid() {\n this._svg.append(\"g\")\n .attr(\"class\", \"grid\")\n .attr(\"transform\", \"translate(0,\" + this._svgHeight + \")\")\n .call(this._make_x_axis()\n .tickSize(-this._svgHeight, 0, 0)\n .tickFormat(\"\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
directly saving the comp duplicated in studioserver
function saveComp(toSave,original,comp,project,force,projectDir,destFileName) { var _iswin = /^win/.test(process.platform); var projDir = projectDir; if (comp.indexOf('studio.') == 0 && project == 'studio-helper') projDir = 'projects/studio'; if (!original) { // new comp var srcPath = `${p...
[ "function saveComponent(domain, comp) {\n body = jsyaml.safeDump(comp)\n component = comp.Component + \" - \" + comp.Version\n return fetch(\"http://\" + window.location.hostname + \":\" + window.location.port + \"/component/\" + domain, {method: \"POST\", body: body})\n .then((response) => response.text...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete a todo list and all of its todos (handled by cascade). Returns a Promise that resolves to `true` on success, false if the todo list doesn't exist.
async deleteTodoList(todoListId) { const DELETE_TODOLIST = ` DELETE FROM todolists WHERE id = $1 AND username = $2`; let resultTodoList = await dbQuery(DELETE_TODOLIST, todoListId, this.username); return resultTodoList.rowCount > 0; }
[ "async deleteTodoList(todoListId) {\n const DELETE_TODOLIST = `DELETE FROM todolists\n WHERE id = $1\n AND username = $2`;\n let result = await dbQuery(DELETE_TODOLIST, todoListId, this.username);\n return result.rowCount > 0;\n }", "function del...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function gives a random coordinate 'x' and 'y' with board[x][y] = 0 here we create a arr of all the board indices x and y (we create a string of 'x' + 'y') with value = 0 finally if there is no index with board value = 0 then we just return object with x any = 1 else we use random function to get the arr index bet...
function getRandomTile(){ var arr = []; for(var i = 0;i<4;i++){ for(var j = 0;j<4;j++){ if(board[i][j] == 0){ var first = i.toString(); var second = j.toString(); arr.push(first + second); } ...
[ "randomPositionGenerator(){\n let x = Math.floor(Math.random() * BOARD_WIDTH);\n let y = Math.floor(Math.random() * BOARD_HEIGHT);\n x -= (x % this.cellWidth);\n y -= (y % this.cellWidth);\n return([x, y]);\n }", "function randoCoordinate() {\n var y = findRow(); //random ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: fetchLocalNode Fetch a local node at given path. Loads a and extends it with the following: data data of the node, as received from deleted whether this node is considered deleted.
function fetchLocalNode(path, isDeleted) { return store.getNode(path). then(function(localNode) { logger.info("fetch local", path, localNode); if(isForeignPath(path)) { // can't modify foreign data locally isDeleted = false; } function yieldNode(node) { ...
[ "function fetchLocalNode(path, isDeleted) {\n logger.info(\"fetch local\", path);\n var localNode = store.getNode(path);\n localNode.data = store.getNodeData(path);\n\n if(isForeignPath(path)) {\n // can't modify foreign data locally\n isDeleted = false;\n }\n\n if(typeof(isDeleted) == '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
10.0 Function: Join selectedChars as createdPassword
function joinSelectedChars() { createdPassword = selectedChars.join("") }
[ "function buildPassword() {\n var password = \"\";\n var selectedCharType = [];\n\n // Use if statements to determine which arrays to add to selectedCharType\n if (useLowerCase) {\n selectedCharType = selectedCharType.concat(lowerCase);\n }\n if (useUpperCase) {\n selectedCharType = selectedCharType...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Try to get user session info from the server.
async function getUserInfo() { if (user && user.name) return; try { // See if the server has session info on this user const response = await fetch(`${telescopeUrl}/user/info`); if (!response.ok) { // Not an error, we're just not authenticated if (response.status...
[ "function getFullSession() {\n if (g_debugJs) console.debug('getFullSession');\n\n return wsCall(g_plugin_webservices ? 'glpi.getMyInfo' : 'getFullSession')\n .done(function(response) {\n if (g_debugJs) console.debug('getFullSession, response: ', response);\n\n if (response.hasOwnProperty(\"a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_ESAbstract.Construct / global IsConstructor, OrdinaryCreateFromConstructor, Call 7.3.13. Construct ( F [ , argumentsList [ , newTarget ]] )
function Construct(F /* [ , argumentsList [ , newTarget ]] */) { // eslint-disable-line no-unused-vars // 1. If newTarget is not present, set newTarget to F. var newTarget = arguments.length > 2 ? arguments[2] : F; // 2. If argumentsList is not present, set argumentsList to a new empty List. var argumentsList ...
[ "function Construct(F /* [ , argumentsList [ , newTarget ]] */) { // eslint-disable-line no-unused-vars\n // 1. If newTarget is not present, set newTarget to F.\n var newTarget = arguments.length > 2 ? arguments[2] : F;\n\n // 2. If argumentsList is not present, set argumentsList to a new empty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
put initial cupcakes on page.
async function showInitialCupcakes() { const response = await axios.get(`${BASE_URL}/cupcakes`); for (let cupcakeData of response.data.cupcakes) { let newCupcake = $(generateCupcakeHTML(cupcakeData)); $("#cupcakes-list").append(newCupcake); } }
[ "function setUpUserPage() {\n // update all user information elements\n profileHeader.innerHTML = profileUser.name;\n followers.innerHTML = profileUser.followers;\n following.innerHTML = profileUser.following.length;\n writtenCount.innerHTML = profileUser.writtenBook.length;\n description.innerHTM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Translates the path to 0,0 and scales the path based on the actual size
updatePath(pathData, bounds, actualSize) { let isScale = false; let newPathString = ''; let scaleX = -bounds.x; let scaleY = -bounds.y; let arrayCollection = []; if (actualSize.width !== bounds.width || actualSize.height !== bounds.height) { scaleX = actualSiz...
[ "function onResize(event) {\n path.position = view.center;\n}", "function _resizePath(path, rect) {\n if (!path.applyTransform) {\n return;\n }\n\n var pathRect = path.getBoundingRect();\n var m = pathRect.calculateTransform(rect);\n path.applyTransform(m);\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setup webpack compiler and server for the renderer process
function startRenderer () { return new Promise((resolve) => { const compiler = webpack(rendererConfig); const serverOptions = { host: "localhost", port: devPort, hot: true, onListening: function (devServer) { const port = devServer.server.address().port; console.log("Li...
[ "async initWebpackProd () {\n const webpack = require('webpack')\n const timer = new Date()\n const build = webpack([this.config.client, this.config.server])\n const compile = promisify(build.run).bind(build)\n await compile()\n cubic.log.monitor('Webpack build successful', true, `${new Date() - t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ebay listing will now advanced to stage 'form'
function updateEbayListingStage() { let tabId = window.itemData.tab; let newStage = "form"; let data = { tab: tabId, stage: newStage, }; chrome.runtime.sendMessage({ command: "update-ebay-active-tab-stage", data: data, }); }
[ "function update_ebay_fields_from_shopify(){\n\t// Title\n\t$('input#ebay-title').val( $('input#shopify-title').val() );\n\t\n\t// Description\n\tapply_ebay_template();\n\t\n\t// Weight\n\t// \tTODO: update weight appropriately\n\t\n\t// Condition\n\t// \tTODO: map Shopify condition to eBay condition\n\t\n\t// Manu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load and display the correct background depending on what assignmentNr is
function loadBackground(assignmentNr) { if(assignmentNr === 0 || assignmentNr === 1 || assignmentNr === 2 || assignmentNr === 3) { //Add blue background background = game.add.image(game.world.centerX, game.world.centerY, 'homeKeysBackground'); } else if(assignmentNr === 4 || assignmentN...
[ "function loadBackground(assignmentNr)\n{ \n \n if(assignmentNr === 0 || assignmentNr === 7 || assignmentNr === 8)\n {\n //Add sea background\n background = game.add.image(game.world.centerX, game.world.centerY, 'marglyttaBakgrunnur');\n }\n else if(assignmentNr === 5 || assignmentNr ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function loop to display all topics in buttons
function displayTopics() { for (var i = 0; i < topics.length; i++) { $('#buttons').append('<div class="btn btn-info get-giphy" data-attribute=' + topics[i] + '>' + topics[i] + '</div>'); } }
[ "function listTopics(topic) {\n $(\"#topic-holder\").html(\"\")\n for (i = 0; i < topic.length; i++) {\n $(\"#topic-holder\").append($(\"<button>\").addClass(\"btn btn-outline-primary ind-topic\").attr(\"id\", \"item-\" + i).text(topic[i]));\n }\n}", "function loadTopics() {\n $(\"#button-c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to form an array of all of the matches both players were in
function compareMatchLists(playerMatches, eMatchList, inCommon, playerID, enemyID){ for(var i = 0; i< playerMatches.totalGames; i++){ if(eMatchList.indexOf(playerMatches.matches[i].matchId) != -1){ inCommon.push(playerMatches.matches[i].matchId); } } //REM...
[ "function winners(matches) {\n return matches.map(m => m.winner);\n}", "function findMatches(winning, player) {\n var matching = [];\n for (var i = 0; i < winning.length; i++) {\n // look for each played number in winning array, if found add to matching array\n if (winning.ind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Event handler when a mouse click occurs
function canvasClick(e) { blockus.mouseClicked(); }
[ "function mouseClicked() {}", "function mouseClicked() { // For testing\n}", "mouseClicked()\n {\n // virtual\n }", "function handler_click() {\n\t\t//\tStuff to do on the click\n\t}", "function clickHandler(event){\n\t\t\tif(ignoreClick){\n\t\t\t\tignoreClick = false;\n\t\t\t\treturn;\n\t\t\t}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This patch is required to show raw requests and response in a console Works if DEBUG flag is true
function enableHttpDebugOutput() { // generate random trace id if it was not set if (!config.TRACE_ID) { config.TRACE_ID = generateTraceId(); } console.log(chalk.red('\nDEBUG output enabled')); console.log(chalk.red(`X-B3-TraceId: ${config.TRACE_ID}\n`)); // path HTTP requests to log ...
[ "function _dumpOnScreen(response) {\n _Debug2.default.dump(response);\n}", "function tracer(req, res, next) {\n console.log('Method: %s\\nPath: %s\\nHeaders:\\n\\n%s\\n\\nBody:\\n\\n%s\\n\\n',\n req.method,\n req.path,\n JSON.stringify(req.headers, null, 4),\n JSON.stringify(req....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creating two global variables to keep track of list of alerts and disesase details
function createAlerts(alerts) { //This function helps in creating alerts by comparing changes in positions and number of cases as well as handling new entries var cnt = 0; drank_result = []; for (cnt; cnt < 5; cnt++) { allDisease.push(alerts[cnt]); if (alerts[cnt].drank > 0 && alerts[cnt].drank < 6) { ...
[ "function addAlertListFunctionality(){\n\t\t\t\t//This private variable will keep track of the alert links for keyboard navigation purposes\n\t\t\t\tvar alertLinksTabbableArray;\n\t\t\t\tupdateAlertLinksTabbableArray();\n\t\t\t\t\n\t\t\t\t$(\"#ANDI508-alerts-container-scrollable a\").each(function(){\n\t\t\t\t\t//a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
drawTally() draws lines to show the tally of the amount of times "replay" was clicked
function drawTally() { // this is the tally text("tally:", titleOffset, height - 125) // fix stroke settings strokeWeight(4); stroke(255); // loop through to make tallies for (let i = 0; i < tally; i++) { line( (i * 20) + 100, height - 150, (i * 20) + 100, height - 100); } ...
[ "function updateTally(outcome) {\n totalPoints += parseInt(outcome);\n \n // Draw tally using HTML\n tally = display_element.querySelector(\".tally\");\n tally.innerHTML = `Total Points: ${totalPoints}`\n \n }", "incrementTally() {\r\n tally++;\r\n }", "function clickCount...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show categories on the page
async function showCategories() { const res = await axios.get(`${MD_BASE_URL}/categories.php`); $('<div class="col-10"><h3 class="title text-center">CATEGORIES</h3></div>').appendTo($cateList); for (let cate of res.data.categories) { generateCatHTML(cate); } }
[ "function showCategoriesFuntions(){\n $(\".categories\").show();\n }", "function showCategories() {\n\t$.categoryListView.hide();\n\tif (!isCategoryListViewVisible) {\n\t\tisCategoryListViewVisible = true;\n\t\t$.categoryListView.show();\n\t} else {\n\t\tisCategoryListViewVisible = false;\n\t}\n\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns quantity for a product item
function getQuantityByProduct(itemNode) { var qtyNode = itemNode.querySelector(".quantity-input"); var qty = qtyNode.value; return qty; }
[ "function quantity() {\n for (i = 0; i < shoppingCart.length; i++) {\n var item = shoppingCart[i];\n total = total + item.quantity;\n }\n return total;\n }", "function getQty() {\n var cartQty = 0;\n for (i=0; i<cart.length; i++) {\n cartQty = cartQty += parseInt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Link to delete userConnection handler
function deleteConnection() { window.location.href = "/user/delete/" + this.id.substring(3); }
[ "removeConnection(data) {\r\n userDBConnection.deleteOne({ connectionID: data.connectionID }, function (err, data) {\r\n if (err) return console.error(err);\r\n })\r\n }", "function handleDelete() {\n tripsAPI.getLogout(deleteUser);\n }", "handleRemoveConnection() {\n\n le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AutoResolution Function Finds the ideal resolution for any given monitor
function ctAutoRes() { switch (screen.width) { case 1280: msize.w = 1280; msize.h = 720; break; case 1366: msize.w = 1366; msize.h = 768; if (screen.availHeight < msize.h) { resetRes() } b...
[ "function ctAutoRes() {\n switch(screen.width) {\n case 1280:\n msize.w = 1280;\n msize.h = 720;\n break;\n case 1366:\n msize.w = 1366;\n msize.h = 768;\n if(screen.availHeight < msize.h) {\n resetRes()\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change a specific parameter value and update the state.
changeParameter(index, event) { // console.log('onChange', index, event); const originalParameters = this.state.parameters; originalParameters[index].defaultParameterValue.value = event; this.setState({ parameters: originalParameters }); }
[ "changeSetting(state, {name, value}) {\r\n if(name in state)\r\n state[name] = value;\r\n }", "function ParameterChanged(param, value) {\n\t\n\t// which voice is it?\n\tvar voiceIndex = (param % 2 == 0) ? param / 2 : (param - 1) / 2;\n\n\tfor(var i in activeNotes){\n\t\tvar voiceT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Will check the toggle status for Queue which is set while aaPhoneMenuCtrl
function isRouteQueueToggle() { return routeQueueToggle; }
[ "onQueueShow (stamp) {\n this.getJobState('queue', stamp, false, '')\n }", "function afo_queue_toggleOpen() {\n\t\t$('#afo-queue-box').slideToggle('fast', function() {\n\n\t\t\t$('#afo-queue-box').toggleClass('closed');\n\n\t\t\tvar openVal = 'yes';\n\t\t\tif($('#afo-queue-box').hasClass('closed')) openVa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to show next form.
function show_next_form() { var meta = $('#sample_meta') meta.show(); $('#meta_footer').show(); scroll_to_ele(meta); }
[ "function show_next_form() {\n var header = $('#sample_meta_header');\n header.show();\n $('#sample_meta_common').show();\n scroll_to_ele(header);\n }", "function goto_next_form() {\n context.current++;\n if (context.current >= context.workflow.length) {\n return fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an xml file from the contents of an Rxt file
function createXml(rxtFile){ var content=rxtFile.content.toString(); var fixedContent=content.replace('<xml version="1.0"?>',EMPTY) .replace('</xml>',EMPTY); return new XML(fixedContent); }
[ "function createXml(rxtFile) {\n\n var content = rxtFile.content.toString();\n\n var fixedContent = content.replace('<xml version=\"1.0\"?>', EMPTY)\n .replace('</xml>', EMPTY);\n return new XML(fixedContent);\n }", "function generateXML(filepath, callback) {\n var args = [\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function : ReadItem Reads the Item from the Dynamo DB
function readItem(a) { // Initialize the Amazon Cognito credentials provider AWS.config.region = 'us-east-1'; // Region AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'us-east-1:d640cf23-7fca-44bc-9af0-dd362df3b1c9', }); var docClient = new AWS.DynamoDB.DocumentClient(); ...
[ "function readDynamoItem(params, callback) {\n var AWS = require('aws-sdk');\n AWS.config.update({region: AWSregion});\n\n var docClient = new AWS.DynamoDB.DocumentClient();\n\n console.log('READING -- reading item from DynamoDB table');\n\n docClient.get(params, (err, data) => {\n if (err) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Access Light color form control
get Lighter() { return this.Form.get('lighter'); }
[ "function EBX_ColorPicker() {\n\n}", "function EBX_ColorPicker() {\r\n\r\n}", "function LIGHT$static_(){IconDisplayFieldSkin.LIGHT=( new IconDisplayFieldSkin(com.coremedia.ui.skins.DisplayFieldSkin.LIGHT.getSkin()));}", "function lgColor(o){this.setOptions=function(o){for(i in o){var n=\"set\"+i.charAt(0).toU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by LUFileParsernestedIntentName.
exitNestedIntentName(ctx) { }
[ "exitNestedIntentNameLine(ctx) {\n\t}", "exitNestedIntentBodyDefinition(ctx) {\n\t}", "exitNestedIntentSection(ctx) {\n\t}", "exitNestedExpressionAtom(ctx) {\n\t}", "exitNestedRowExpressionAtom(ctx) {\n\t}", "exitNested_item(ctx) {\n\t}", "exitDml_event_nested_clause(ctx) {\n\t}", "visitNestedIntentNa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Append `count` cells to a table row `tr`. Optionally set the content of the first and/or last cells
function append_cells(tr, count, first_content, last_content, cls) { if (!first_content) { first_content = ''; } if (!last_content) { last_content = ''; } if (!cls) { cls = ''; } for (var c = 1; c <= count; c++) { var td = elem('td').addClass(cls); if (c == 1 && first_content) { td.html(first_conte...
[ "function addRow(tbl, count) {\n var newRow = tbl.insertRow();\n for (var i = 0; i < count; i++) {\n newRow.insertCell();\n }\n}", "function addRow(table, values, startInd) {\n var cell;\n // for all cells in the table\n for (var i = 0; i < values.length; i++) {\n // insert a cell ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enables async http requests
enableAsyncRequest() { this._asyncRequest = true; }
[ "enableAsyncMode() {\n this._asyncMode = true;\n for (let i in this.instances) {\n this.instances[i].enableAsyncRequest();\n }\n }", "_startHttp() {\n this.httpEnabled = getFromObject(this.config, 'http.enabled', false);\n if (this.httpEnabled) {\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method will set a simple string value with the given solrPropName in the solrRecord to the vprPropName field in the vprRecord. It verifies the existence of the field before attempting to set the solr value. solrRecord: The SOLR record that is being updated. solrPropName: The name of the SOLR property field to be u...
function setStringFromSimple(solrRecord, solrPropName, vprRecord, vprPropName) { if ((_.isObject(solrRecord)) && (_.isObject(vprRecord)) && (_.isString(vprRecord[vprPropName]))) { solrRecord[solrPropName] = vprRecord[vprPropName]; } else if ((_.isObject(solrRecord)) && (_.isObject(vprRecord)) && ((_.isNumb...
[ "function setStringFromSimple(solrRecord, solrPropName, vprRecord, vprPropName) {\n if ((_.isObject(solrRecord)) && (_.isObject(vprRecord)) && (_.isString(vprRecord[vprPropName]))) {\n solrRecord[solrPropName] = vprRecord[vprPropName];\n } else if ((_.isObject(solrRecord)) && (_.isObject(vprRecord)) &&...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sequence :: (Applicative f, Traversable t) => (TypeRep f, t (f a)) > f (t a) . . Inverts the given `t (f a)` to produce an `f (t a)`. . . This function is derived from [`traverse`](traverse). . . ```javascript . > sequence (Array, Identity ([1, 2, 3])) . [Identity (1), Identity (2), Identity (3)] . . > sequence (Identi...
function sequence(typeRep, traversable) { return traverse (typeRep, identity, traversable); }
[ "function sequence(typeRep, traversable) {\n return traverse(typeRep, identity, traversable);\n }", "function sequence(applicative, traversable, tfa) {\n return traversable.traverse(applicative, _Identity.id, tfa);\n}", "_createSequence(array) {\n return new Proxy(array, {\n get: (target,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ADD GAME DIFFICULTY BUTTONS
function addDifficulty() { $('.difficulty-container').html('<button class="easy">Easy</button><button class="normal">Normal</button><button class="hard">Hard</button>') }
[ "function newGameButton() {\n \tself.clearButton();\n \tself.whatever.playerOneScore = 0;\n \tself.whatever.playerTwoScore = 0;\n \tself.whatever.counter = 1;\n \tself.whatever.showPlayerOneName = true;\n \tself.whatever.showPlayerTwoName = true;\n \t\tself.whatever.pl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
launches Publications page into its own window instead of as a tab in the current window
function launchPublications(pub) { var Win1 = open(pub,"","height=800,width=1000,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes"); Win1.focus(); }
[ "function addModalWindowToPage(){\n\t\taddProfileView();\n\t\taddModalWindowClose();\n\t\taddShare();\n\t}", "function _plmpom_openmultipom()\r\n{\r\n\tvar nwWindow = window.open('multipom.do?method=view', '', 'width=1146, height=600,resizable=yes, toolbar=no, scrollbars=yes, left=165, top=100');\r\n\tnwWindow.fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the active plugin with this key, if any, from an editor state.
get(state) { return state.config.pluginsByKey[this.key]; }
[ "get activeOption() {\n if (this.autocomplete && this.autocomplete._keyManager) {\n return this.autocomplete._keyManager.activeItem;\n }\n return null;\n }", "function getActiveOption(current, key) {\n var whichHighlighter = !current || current === splitButtonView.lastE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse n, M and T from instance file
getNMT() { let unparseNMT = this.#rawtext[0].split("\n"); this.productsLength = parseFloat(unparseNMT[0].split('\t')[1]); this.maintenanceTime = parseFloat(unparseNMT[1].split('\t')[1]); this.timeForMaintenance = parseFloat(unparseNMT[2].split('\t')[1]); }
[ "function processFile(contents,fullFileName) {\n let splitter = \"Instance:\"\n //let arResults = []\n let arInstances = contents.split(splitter); //the instances defined in this file\n\n arInstances.forEach(function(i) { //check each instance\n\n let fileContents = splitter + i //a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears the event storage.
clear() { window.localStorage.removeItem(this.storageKey); Logger.debug('Event storage cleared!'); }
[ "clear() {\n debug('Clearing all previously stashed events.');\n this._eventsStash = [];\n }", "clear() {\n this._eventsStash = [];\n }", "clear() {\n this.storage.clear();\n }", "clear() {\n this._events = [];\n this._eventTimes = [];\n }", "function clearEvents() {\n\t\tevents = [];\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate grade for semester
function gradecalc(firstInSem, secondInSem, finalSem, assignment, attendance) { var total = (firstInSem * 30) / 100 + (secondInSem * 30) / 100 + (finalSem * 50) / 100 + (assignment) + (attendance); var grade = total.toFixed(2); document.getElementById('gradeObject').innerHTML = ("Your Marks :-", grade); conso...
[ "calculatedGrade () {\n\t\t\tlet p = this.participation;\n\t\t\treturn 0.15 * p.studio + 0.05 * p.feedback + 0.05 * p.other + .75 * this.homeworkAverage;\n\t\t}", "function calculateStudentGrade() {\r\n\tif(totalAnswers <= 0){ // no answers were given\r\n\t\tstudentGrade = 0;\r\n\t}\r\n\telse{\r\n\t\tstudentGrade...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add new channels to drop down.
function appendChannel(channel) { let option = document.createElement("option") option.innerHTML = channel; document.querySelector("#channel").append(option); }
[ "function addChannel(channel) {\n\n // Get a handle to the channel list <select> element\n var select = $('#channels-list');\n\n // Create a new <option> for the <select> with the new channel's information\n var users = channel.users || [];\n var numUsers = users.length;\n\n var option = $('<option id=\"'+\"c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redraws the icons of all markers to ajust to new filters
function redrawMarkers() { for(var victim in victimsPoints){ for(var i = 0; i < victimsPoints[victim].length; i++) updateMarkerIcon(victimsPoints[victim][i]); } }
[ "function refreshAllMarkers() {\n/* markerList.forEach(marker => {\n marker.refreshIcon();\n }); */\n}", "function ResetMarkers(){\n var len=markers.length;\n for (var i = 0; i < len; i++) {\n markers[i].setIcon(regularPin);\n markers[i].setVisible(false);\n }\n}", "function updateFiltering () {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to establish the derivedbase inheritance relationship
function establishInheritance(derived, base) { //Set the prototype to the base class prototype. After this is done any virtual methods //that need to be overwritten will be done as follows: //derived.prototype.method = function{} //If not, then the base method will be called because of the relationship we...
[ "function findDerivedClass() {\n\t\t\t\t\tvar derived = baseClass.derivedClasses;\n\t\t\t\t\tvar derivedPromise = AH.when();\n\t\t\t\t\tvar cl;\n\t\t\t\t\tfor (var i = 0; i < derived.length; i++) {\n\t\t\t\t\t\tcl = derived[i];\n\t\t\t\t\t\tderivedPromise = derivedPromise.then(getClass);\n\t\t\t\t\t}\n\t\t\t\t\tret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find all neighbors of piece at location[i][j]
findNeighbors(i, j) { this.Neighbors.enumerate().forEach(neighbor => { let yOffset; let xOffset; let piece = this.pieces[i][j]; let point = new Point(piece.point.x + this.Neighbors[neighbor].x, piece.point.y + this.Neighbors[neighbor].y); let check = this.hashmap.getPointFromMap(point,...
[ "getNeighbors(){\n\n var offSetDir = [\n [[-1,-1], [-1, 0], [0,1], [1, 0], [1,-1], [0, -1]],\n [[-1, 0], [-1, 1], [0,1], [1,1], [1, 0], [0, -1]]\n ]\n var parity = this.index.row % 2;\n var neighbors = []\n for(var i = 0; i<6; i++){\n var assocNeighbor = {row: this.index.row + offS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
interpret and extract time zone from API response Also print timezone to screen to help user
function timezn(tzURL) { $.ajax({ url: tzURL, method: "GET", dataType: 'json', success : function (data) { var obj = data; var tz = obj.timeZoneId; document.getElementById('tz').innerHTML=tz; } }) }
[ "async function GetTheTimezoneInfoForAspecificLocation() {\n let timeService = new time.TimeService(process.env.MICRO_API_TOKEN);\n let rsp = await timeService.zone({\n location: \"London\",\n });\n console.log(rsp);\n}", "function timeZoneCheck() {\n var timeZoneLog = document.querySelector(\".timezo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset Icons resets the rock, paper, scissors, lizard, and spock icons to their original state.
function resetIcons() { let icons = document.querySelectorAll(".icon-selection-area i"); for (let icon of icons) { icon.classList.remove("fas"); icon.classList.add("far"); } }
[ "function reseticones(){\r\n\t\t\t\t\t\ticonemosaic.className = \"ico icomosaiclic\";\r\n\t\t\t\t\t\ticonegauche.className = \"ico icogauche\"; \r\n\t\t\t\t\t\ticonedroite.className = \"ico icodroite\"; \r\n\t\t\t\t\t\ticoneimage.className = \"ico icoimage\"; \r\n\t\t\t\t\t\ticonediapo.className = \"ico icoimage\";...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
here we can set up the panhandlers before render
componentWillMount() { this.attachPanHandlerEvents(); }
[ "didPanStart(){}", "componentWillMount() {\n this.panResponder = PanResponder.create({\n onStartShouldSetPanResponder: () => true,\n onPanResponderGrant: (e, gs) => this.onResponderGrant(e, gs),\n onPanResponderMove: (e, gs) => this.onResponderMove(e, gs),\n onPanResponderRelease: (e, gs) =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the head value is not passed, the head is initialized to null.
constructor (head = null) { this.head = head; }
[ "constructor(head = null) {\n this.head = head;\n }", "constructor() {\n this.head = null;\n this.size = 0;\n }", "constructor() {\n this.head = null; // No initial\n this.tail = null; // No initial\n this.size = 0; // Set initial size\n }", "empty()\n {\n this.head = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function checkyearofmd() retrieves the Year of Metadata value entered by the user. The function checks to make sure that the value entered only contains numerics with no more than four digits long. Submbit button is disabled or enabled depending on the status of the validation.
function checkyearofmd() { var yomd = document.getElementById('yearofmd').value; var regex = /^\d{4}$/; if (!new RegExp(regex).test(yomd)) { alert("Please make sure your entry is in this format, 2013 (YYYY)."); document.getElementById("yearofmd").style.border = "2px solid red"; ...
[ "function checkMortYear(){\n\tvar val = document.mortgage.mortYear.value;\n\tvar valid = true;\n\tvar chari;\n\tvar count;\n\tvar myDate = new Date();\n\tvar myYear = myDate.getFullYear();\n\t//Must be present\n\tif (val.length === 0){\n\t\tmessages += \"<p>Please Enter the Mortgage Year</p>\";\n\t\tvalid = false;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns album with generated urls to photos
function generatePhotoUrls(album) { album.map(function (photo) { var user = album.postedBy && album.postedBy.username ? album.postedBy.username : photo.postedBy.username; photo.imageUrl = '/' + user + '/' ...
[ "async getAlbums(){\n const token = await GoogleSignin.getTokens();\n await this.getDbUserData();\n data = {\n URI: 'https://photoslibrary.googleapis.com/v1/albums?excludeNonAppCreatedData=true',\n method: 'GET',\n headers: {\n 'Authorization': 'B...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates the visible left position of an element If _noOwnScroll is true, method not include scrollLeft of element itself.
_getVisibleLeftPosition(_id, _noOwnScroll) { return this._getVisibleLeftOrTop(_id, _noOwnScroll, 'offsetLeft', 'scrollLeft'); }
[ "function xScrollLeft(e, bWin)\n{\n var offset=0;\n if (!xDef(e) || bWin || e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {\n var w = window;\n if (bWin && e) w = e;\n if(w.document.documentElement && w.document.documentElement.scrollLeft) offset=w.document.docu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort function to sort ranges by index.
function $qQQH$var$sortByRangeIndex(a, b) { return a.index - b.index; }
[ "function sortByRangeIndex(a,b){return a.index-b.index;}", "function sortByRangeIndex(a, b) {\n return a.index - b.index;\n}", "function sortByRangeIndex (a, b) {\n\t return a.index - b.index\n\t}", "function sortRanges(ranges){\n ranges.sort(function(rangeA, rangeB){\n var dateA = (isVali...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the neighbors of vertex of index index
getNeighbors(vertices, index, adj){ const neighbors = []; for(let i = 0; i < vertices.length; i ++){ if(adj[index][i] === 1) neighbors.push(i); } return neighbors; }
[ "function getNeighbors(index) {\n index = Number(index);\n neighbors = []\n if ((index % cols) != 0) {\n neighbors.push(index - 1);\n }\n if (((index + 1) % cols) != 0) {\n neighbors.push(index + 1);\n }\n if (index > cols) {\n neighbors.push(index - cols);\n }\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shows cost of am item
function showCost(el, cost) { el.querySelector(".item-cost").innerHTML = `${cost}`; }
[ "static getCost (item) { return item }", "function showAllItemsCost() {\n\tshowCost(healthKitShopItemEl, healingCost);\n\tshowCost(improveMagazineShopItemEl, magazineIncreaseCost);\n\tshowCost(fasterReloadShopItemEl, decreaseReloadingTimeCost);\n\tshowCost(increasePowerUpDurationShopItemEl, powerUpDurationIncreas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find out the first blank spot
function locateBlankSpot (board) { for (var t = 0; t < 3; t++) { if (baseBoard[t].indexOf(null) !== -1) { return [t, baseBoard[t].indexOf(null)]; } } return; }
[ "findIndexOfFirstEmptyCell(word)\r\n {\r\n return this.findIndexOfNextEmptyCell(word, this.coordsToIndex(word.x, word.y));\r\n }", "function findEmptySpot(col) {\n for (let row = ROWS - 1; row >= 0; row--) {\n if (!board[row][col]) {\n return row;\n }\n }\n return null;\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers a mutation observer to observe any mention chip deletions triggered by a backspace after a mention chip
function registerMentionChipDeletionObserver() { var target = document.querySelector(DIV_BODY); if (!MentionChipDeletionObserver) { MentionChipDeletionObserver = new MutationObserver(function(mutations) { if (!MentionChipDeletionListener) { return; } // Check for mutated mention chips ...
[ "function registerMentionObserver() {\n var target = document.querySelector(DIV_BODY);\n if (!MentionObserver) {\n MentionObserver = new MutationObserver(function(mutations) {\n var range = getRange();\n var mentionToken;\n var chipAncestor;\n mutations.forEach(function(mutation) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
signIn Initiates the OAuth flow for Account Linking
function signIn() { // Calculating the redirect URI for current window let redirectURI = window.location.origin + '/auth'; // Google's OAuth 2.0 endpoint for requesting an access token let oauthEndpoint = PROD_ENDPOINT + projectId + "/auth"; // Create <form> element to submit parameters to OAuth 2.0 endp...
[ "signInLinkedin() {\n if (!window.linkedinJS_SDKLoaded) {\n alert('Linkedin library failed to load');\n return;\n }\n\n if (IN.ENV.auth.oauth_token && IN.ENV.auth.oauth_token !== '') {\n this.getLinkedInUserdata();\n } else {\n IN.User.authoriz...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds out national phone number type (fixed line, mobile, etc)
function getNumberType(input, options, metadata) { // If assigning the `{}` default value is moved to the arguments above, // code coverage would decrease for some weird reason. options = options || {}; // When `parse()` returned `{}` // meaning that the phone number is not a valid one. if (!input.country) {...
[ "function getNumberType(input, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {}; // When `parse()` returned `{}`\n // meaning that the phone number is not a valid one.\n\n if (!input...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compute the term frequencies pass the concordance for each article
function computeTF(articleConfourdance) { var words = []; //loop through the words in each article. Object.keys(articleConfourdance).forEach(function(key) { //name let term = key; //value let tf = articleConfourdance[key]; //calculate df for the word with a f...
[ "calculateTermFrequency(term, doc) {\n let numOccurences = 0;\n for (let i = 0; i < doc.length; i++){\n if (doc[i].toLowerCase() == term.toLowerCase()){\n numOccurences++;\n }\n }\n return (numOccurences * 1.0 / (doc.length + 1))\n }", "function doTF(c){\n termfrequency = {};\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function writes the concepts, depending on the user's choice from the Concepts dropdown menu
function concept() { let concept = $("#concepts").val(); let chapters = $("#chapters").val(); if(chapters == "top"){ $("#text").html(" "); } else if(chapters == "2"){ if (concept === "1") { $("#text").html( "Local Conditions: </br></br> Heating demand is given in heating degree-days. "...
[ "function concepts() {\r\n let choice = $(\"#concepts\").find(\":selected\").text();\r\n\r\n if (choice === \"local conditions\") {\r\n console.log(\"Local conditions:\");\r\n console.log(\"Heating demand is given in heating degree-days. The length of a Canadian heating season is the number of d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if crushable candies on board. If so, crush candies.
function checkIfCrushableExists(){ canDrag = false; Promise.all(crushPromises).then(function(){ var crushables = rules.getCandyCrushes(); if (crushables.length > 0){ automaticCrush(); } else { crushPromises = []; resetHintCounter(); canDrag = true; } }); }
[ "function checkCrushOnceValid() {\n if (rules.getCandyCrushes().length > 0) {\n crushing = true;\n crushOnce();\n } else {\n crushing = false;\n }\n}", "function candyCrush(board) {\n // assuming you get a legit board as input\n \n const numRows = board.length;\n const rowL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Aggregate the column filter settings into a big string ==========================================================================================
function updateFilterString() { // Create our a string that will be used for our sort properties.filterString = ""; // If filters are enabled, go update, else string remains as empty if (!properties.filterDisabled) { // Loop over each of the filterable ...
[ "_getFilteringSettings() {\n const table = this;\n const result = [];\n const cg = this._columnManager._configGenerator;\n\n for (let i = 0; i < cg.columnsConfig.length; i++) {\n const col = cg.columnsConfig[i];\n\n if (col.filter) {\n if (col.filter.value) { result.push(table._makeFilt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to hide snackbar
function hideSnackBar() { setSnackBarVisible(false); }
[ "function hideSnackBar() {\n setSnackBarVisible(false);\n }", "hide () {\n this.isVisible = false\n setTimeout(() => {\n // Without timeout snackbar will revert to default before it disappears\n this.reset()\n }, 500)\n }", "function snackbarClose() {\n\tsnackbar.classList.remove('snackb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes an Event from the Eventlist by Event Object.
removeEvent(event: Event) { console.log("[AGEventHandler] Removing Event [ID: " + event.ID + "]."); this._events.splice(this.findEventIndex(event), 1); }
[ "_removeEvent(event, events) {\n const index = events.indexOf(event);\n\n if (index !== -1) {\n events.splice(index, 1);\n }\n\n this._updateListeners();\n }", "unsubscribe(event,object) {\n let index = this.events[event].indexOf(object);\n if (index !== -1) this.events[event].spli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch quizzes by category.
fetchQuizzesByCategory ({ commit }, payload) { commit('SET_LOADING_ON'); db.collection('quizzes') .where('categories', 'array-contains', payload.categoryId) .where('isPublic', '==', true) .where('isQRQuiz', '==', false) .where('isDeleted', '==', false) .onSnapshot(snap => { ...
[ "static async getQuestionsOf(category) {\n try {\n const data = await database.select('*', 'questions', `WHERE category = ${category}`);\n return data;\n } catch (e) {\n throw e;\n }\n }", "getQuestions(category, num) \n {\n let categories = \"{\" + category.join()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get a random hex value
function randomHex() { return Math.floor(Math.random() * 16).toString(16); }
[ "function randomHex() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n}", "function hex() {\n return ((Math.floor((Math.random()*222)+33).toString(16))+(Math.floor((Math.random()*222)+33).toString(16))+(Math.floor((Math.random()*222)+33).toString(16)).toString(16));\n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_CClientFrame class (c) 1999 Claus Wahlers
function _CClientFrame(_x, _y, _width, _height, _parentObj) { this.x = _x; this.y = _y; this.width = _width; this.height = _height; this.childObj = null; this.parentObj = null; this.parentLayer = null; if(typeof _parentObj == "undefined") this.parentLayer = _CFrame.getRootObject(); else { ...
[ "function _CFrame(_x, _y, _width, _height, _parentObj)\r\n{\r\n\tthis.x = _x;\r\n\tthis.y = _y;\r\n\tthis.width = _width;\r\n\tthis.height = _height;\r\n\r\n\tthis.childObj = null;\r\n\tthis.parentObj = null;\r\n\tthis.parentLayer = null;\r\n\r\n\tif(typeof _parentObj == \"undefined\")\r\n\t\tthis.parentLayer = _CF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO getNumberOfCompetencyDescendants adjust for multinode clusters
function getNumberOfCompetencyDescendants(compId) { var cpd = selectedFrameworksCompetencyData.competencyPacketDataMap[compId]; if (cpd) return countNumberOfCpdDescendants(cpd.children); return 0; }
[ "get totalNumberOfDescendants() {\n let n = 0;\n const counter = (vampire) => {\n for (let offspring of vampire.offsprings) {\n n ++;\n counter(offspring);\n }\n };\n\n counter(this);\n return n;\n }", "function candies(n, m) {\n\t// Step1: Create a variable that will hold ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to delete all object from the users model.
deleteAll() { realm.write(() => { const user = realm.objects('User'); realm.delete(user); }); }
[ "function deleteAllUsers() {\n return knex.from('users')\n .del();\n}", "async deleteAll() {\n try {\n await this.connection('user_musics').delete();\n } catch (error) {\n throw error;\n }\n }", "static async deleteAll() {\n // Delete all user documents f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function That Gets Employee Info And Asks What Employee Needs To Be Removed
async function getRemoveEmployeeInfo() { const employees = await getEmployeeNames(); return inquirer .prompt([ { name: "employeeName", type: "list", message: "Which Employee Needs To Be Removed?", choices: [ ...employees ] ...
[ "function removeEmployee() {\n\tvar questions = [\n\t\t{\n\t\t\tname: 'employeeName',\n\t\t\ttype: 'input',\n\t\t\tmessage: 'Enter an employee to exclude from the lunch groups: (0 to cancel)\\n',\n\t\t\tvalidate: function (employeeName) {\n\t\t\t\tif(employeeName == ''){\n\t\t\t\t\treturn console.log('\\nPlease ent...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Declar o functie multiply care va itera de la 010 Pentru ficare iteratie multiplica cu 9 Afiseaza resultatul pentru fiecare.
function multiply() { for (i = 0; i <= 10; i++) { var mul = i * 9; console.log(mul); } }
[ "function multiply(multiplicand, multiplier){\n let product = 0\n for (let i = 0; i < multiplier; i++){\n product += multiplicand\n } return product\n}", "function multiplyBy2() {}", "function prixMulti() {\n return 20 * nbMultiplicateur;\n}", "multiplyBy(r)\n {\n for(var ct=0; ct<this.size...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
these are for the html 5 drag and drop functionality which is used to drop NEW componets from outside the main svg element
onDrop( event ) { event.preventDefault() let svg = document.getElementById( "svg-el" ) let point = svg.createSVGPoint() // translate the screen point to svg's point point.x = event.clientX point.y = event.clientY; point = point.matrixTransform( svg.getScreenCTM().inverse() ) /////////...
[ "function enable_drag_drop() {\n chanaka.select(document.getElementById(\"viz\")).selectAll(\"svg\").selectAll(\".dragme\").call(drag), chanaka.select(document.getElementById(\"viz\")).selectAll(\"svg\").selectAll(\".dragme\").on(\"mousemove\", function(e) {\n var t = chanaka.select(this)[0][0].id;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`size` returns the number of triples in the store.
get size() { // Return the triple count if if was cached. var size = this._size; if (size !== null) return size; // Calculate the number of triples by counting to the deepest level. var contexts = this._contexts, subjects, subject; for (var contextKey in contexts) for (var subjectKe...
[ "get size() {\r\n // Return the triple count if if was cached.\r\n var size = this._size;\r\n if (size !== null)\r\n return size;\r\n\r\n // Calculate the number of triples by counting to the deepest level.\r\n var graphs = this._graphs, subjects, subject;\r\n for (var graphKey in graphs)\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show: Scene 3 Hides Scene 2, Scene 4 Scene 3 should be from 20022020 showing monthly data
function setScene3() { // Set Scales xScales.domain(xOverview); yScales.domain(yMonth); d3.selectAll(".slide-info") .attr("class", "slide-info inactive") d3.selectAll("#slide3-1") .attr("class", "slide-info") d3.selectAll("#slide3-2") .attr("class", "slide-info") ...
[ "function setScene4() {\n xScales.domain(xTrump);\n yScales.domain(yMonth);\n\n d3.selectAll(\".slide-info\")\n .attr(\"class\", \"slide-info inactive\")\n\n d3.selectAll(\"#slide4-1\")\n .attr(\"class\", \"slide-info\")\n\n d3.selectAll(\".scene3\")\n .transition()\n .dur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }