query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
recursively follow named links to the target node
function follow(cid, links, err, obj) { if (err) { return cb(err); } if (!links.length) { // done tracing, obj is the target node return cb(null, cid.buffer); } const linkName = links[0]; const nextObj = obj.Links.find(link => link.Name === linkName); ...
[ "function follow (links, err, obj) {\n if (err) {\n return cb(err)\n }\n if (!links.length) {\n // done tracing, obj is the target node\n return cb(null, obj.multihash)\n }\n\n const linkName = links[0]\n const nextObj = obj.links.find(link => link.name === linkNam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mode value value, which appears most often Information only For calculating real mode value use analyzer
get mode(): number { return this.xm; }
[ "function mode(v) {return v.get().mode;}", "function mode_value(values) {\r\n if (values.length < config.MINIMUM_TRANSACTIONS_FOR_RECURRING) return 0;\r\n modes = Array.from(stats.mode(values));\r\n if (modes.length == 0 && (values[0] == values[1])) return values[0];\r\n else if (modes.length == 1) re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save your current session and download the file
function savefile() { // send a request to the server to write the current session to a file // may be a long running process that requires a loading bar or spinner // when done, file will download to user }
[ "function download() {\n downloadSession(this.dataset.uuid);\n}", "function exportSession()\n{\n\n // Create an invisible link containing the downloadable session data\n var link = document.createElement( 'a' );\n link.setAttribute( 'href', 'data:text/plain;charset=utf-8,' + encodeURIComponent( sessionT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
73 RQNPN test cases
function GetTestCase_RQNPN () { var testCases = []; for (NN = 1; NN < 4; NN++) { if (NN == 1) nodeId = 0; if (NN == 2) nodeId = 1; if (NN == 3) nodeId = 65535; for (Pindex = 1; Pindex < 4; Pindex++) { if (Pindex == 1) paramIndex = 0; if (Pindex == 2) paramIndex = 1; if (Pindex == 3) paramInd...
[ "function LO4DPR3F3R3NC3S() {\r\n\tLO4DPR3FS();\r\n\tvar PR3F4RR = [];\r\n\tvar P3RSON, N4M3, QU1RK, QU1RX, L3N, J, I = 0;\r\n\tfor (P3RSON in P3OPL3) {\r\n\t\tN4M3 = P3OPL3[P3RSON];\r\n\t\tif (typeof N4M3 != \"string\" // FOR 1N C4N G3T S1LLY SOM3T1M3S\r\n\t\t|| SHOULD1GNOR33NT1R3LY(P3RSON) ) { // DONT PROD 4NGRY...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for generate line chart for highchart category = Category xAxis text = Text in yAxis data = dataset dom = dom for render title = title for chart subtitle = subtitle for chart
function graph_line_generate(category,text,data,dom,title,subtitle,color) { $('#' + dom).highcharts({ title: { text: title }, subtitle: { text: subtitle }, xAxis: { categories: category, crosshair: true }, yAxis:...
[ "function createDiagramMoney(categoriesArr, linesArr, textTitle) {\n // plugin options \n\n Highcharts.setOptions({\n colors: ['green', 'blue', 'red', 'aqua', 'black', 'gray']\n })\n\n $('#container_diagram_money').highcharts({\n plotOptions: {\n series: {\n lineWidth: 3,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: getAboutUs Create a div that stores about us info. Parameters: none Returns: html node about us info
function getAboutUs() { var aboutus = document.createElement("div"); var h2 = document.createElement("h2"); h2.innerHTML = "About Us"; var info1 = document.createElement("p"); info1.innerHTML = "Computer Forge at CU is a student organization that promotes software project collaboration. Any full-time student a...
[ "function displayAbout() {\n\t\t\n\t\tvar newdiv1 = document.createElement(\"div\");\n\t\t$.getJSON(\"https://people.rit.edu/~sarics/web_proxy.php?path=about\")\n \n\t\t.done(function (data) {\n\t\t\t\n\t\t\tvar newdiv2 = document.createElement(\"div\");\n\t\t\tvar newdiv3 = document.createElement(\"div\");\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Example: oddSubstringMS('1357') 1) 1st iteration: str = 1357. currentNum = 1, 13, 135, 1357. count = 4. 2) 2nd iteration: str = 357. currentNum = 3, 35, 357. count = 7. 3) 3rd iteration: str = 57. currentNum = 5, 57. count = 9. 4) 4th iteration: str = 7. currentNum = 7. count = 10. 5) Final count is 10 so 10 is returne...
function oddSubstringsMS(str) { let count = 0; while (str.length > 0) { for (let i = 0; i < str.length; i++) { let currentNum = str.slice(0,i+1); if (/[13579]/.test(currentNum.substr(-1))) {count++;} } str = str.replace(/^./, ''); } return count; }
[ "function oddSubstrings(s){\n return [...s].reduce((count,n,i) => count + (+n % 2 ? i + 1 : 0), 0);\n}", "function countTwos(num) {\n let counter = 0;\n let string = ''\n for (let i=1; i<=num; i++) {\n string +=`${i}`\n }\n for (let j=0; j<string.length; j++) {\n if (string[j]==2) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create new building permit
function create(req, res, next) { let payload = req.body; payload = removeRestrictedFields(payload); validateCreatePayload(payload, (validationErr) => { if (validationErr) { const e = new Error(validationErr); e.status = httpStatus.BAD_REQUEST; return next(e); ...
[ "createNewBuild(name, race)\n\t{\n\t\tif (name.length === 0) {\n\t\t\talert('Du måste ange ett namn.');\n\t\t\treturn false;\n\t\t}\n\n\t\tconst newBuild = {\n\t\t\tname: name,\n\t\t\trace: race,\n\t\t\tlevels: []\n\t\t};\n\n\t\tthis.saveBuild(newBuild, -1)\n\n\t\tthis.loadedBuildKey = this.getAllBuilds().length - ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the mean results and stores them in a global variable, resultsLine and resultsPie
function averageResults(algorithmType){ var count; var elecUsageList = tempResultsLine[0][0]; //Retrieves the data stored temporatily in a global variable var overLimitList = tempResultsLine[0][1]; var iterations = tempResultsLine.length; for (count = 1; count < iterations; count++){ var listCount; fo...
[ "function summary_stats(results) {\n var stats = {\n \"inaccurate_incorrect\": 0,\n \"inaccurate_correct\": 0,\n \"accurate_incorrect\": 0,\n \"accurate_correct\": 0\n };\n var total = 0\n results.forEach(function (line) {\n line.forEach(function (d) {\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Part 2 Acceleration Define a fuction to calculate the acceleration of an object as a function of mass and force To determine acceleration, we will use the formula: F = Ma or rearranged to solve for a a = F/M
function Acceleration(force, mass) { }
[ "applyForce(force) {\n let f = p5.Vector.div(force, this.mass);\n this.acceleration.add(f);\n }", "applyForce(force) {\n this.acceleration.add(force);\n // note that we can do more physics simulation here\n // eg give the car mass and calculate the acceleration\n // delta as A = F / M...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Click an element located by selector Validate element is visible before clicking on it
function click(selector) { isVisible(selector); Reporter_1.Reporter.debug(`Click an element ${selector}`); tryBlock(() => browser.click(selector), `Failed to click on ${selector}`); }
[ "clickValidProduct() {\n return this\n .waitForElementVisible('@validProduct')\n .click('@validProduct');\n }", "async waitForVisible(selector) {\n try {\n await this.page.waitForSelector(selector, { visible: true });\n return true;\n } catch (e) {\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set select post id to be editted and set editmode to true
setPostEditId(id){ localStorage.setItem("posteditid",id); localStorage.setItem("editidmode",true); }
[ "edit() {\n this.set('newTitle', this.get('post.title'));\n this.set('isEditing', true);\n }", "function EditPost() {\n if (post.user._id === \"60f67bd86bce175ba8dec1d7\") {\n setEdited(!edited);\n } else {\n alert(\"You can't Edit someone's post!!!\");\n }\n }", "function edit_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update extension items in context menu.
updateContextMenu(saveCleanFiles) { const title = (saveCleanFiles) ? 'contextMenuScanAndDownloadTitle' : 'contextMenuScanTitle'; if (contextMenus[MCL_CONFIG.contextMenu.scanId]) { chrome.contextMenus.update(MCL_CONFIG.contextMenu.scanId, { title: chrome.i18n.getMessage(title)...
[ "function updateContextMenu(id) {\n\t// Update contextMenus with highlighted selection\n\tchrome.contextMenus.update(id, {\"title\": \"Search Urban Dictionary for '%s'\"});\n}", "updateMenus() {\n atom.menu.template = _.deepClone(this.menu.main);\n this.updateMainMenus(this.configuration.main, atom.menu.tem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes in an ast node and returns either a basic lima object or undefined basic lima objects: string, number, variable, object
function basicValue(node) { if(utils.isNodeType(node, 'string')) { return coreLevel1.StringObj(node.string) } else if(utils.isNodeType(node, 'number')) { return coreLevel1.NumberObj(node.numerator, node.denominator) } // else if(utils.isNodeType(node, 'variable')) { // return cor...
[ "function walk_tree(ast) {\n var walker = {\n \"assign\" : function() {\n var assign_expr = new assign_expression();\n assign_expr.type = \"assign_expr\";\n assign_expr.left_expr = walk_tree(ast[2]);\n assign_expr.right_expr = walk_tree(ast[3]);\n ass...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter out DOM nodes and hidden edges that represent internal V8 / Chrome state.
function filterNoDom(n, e) { return isNotHidden(e) && nonWeakFilter(n, e) && shouldTraverse(e, false); }
[ "discardFilter() {\n let selection = document.querySelectorAll(this.node.dataset.filterTarget);\n [...selection].forEach(node => {\n if(!BEM.hasModifier(this.node, MODIFIER_CLASS_ONLY)) {\n node.style.removeProperty('display');\n }\n BEM.removeModifier(n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
import as more from 'highcharts/highchartsmore.src'; import as exporting from 'highcharts/modules/exporting.src'; import as highstock from 'highcharts/modules/stock.src';
function highchartsFactory() { // Default options. highcharts__WEBPACK_IMPORTED_MODULE_48__["setOptions"]({ time: { useUTC: false } }); return [highcharts_modules_exporting_src__WEBPACK_IMPORTED_MODULE_49___default.a]; }
[ "function HighchartsStatic() {\n var hc = highcharts_js_highcharts__WEBPACK_IMPORTED_MODULE_2__, hm = __webpack_require__(/*! highcharts/highcharts-more */ \"./node_modules/highcharts/highcharts-more.js\"), sg = __webpack_require__(/*! highcharts/modules/solid-gauge */ \"./node_modules/highcharts/modules/sol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setScales Scales the size of each object.
setScales() { this.room2_E_KeyImg.setScale(0.4); this.room2_wall_info_1.setScale(0.75); this.room2_activity1A.setScale(0.67); this.room2_activity2A.setScale(0.5); this.room2_activity2B.setScale(0.67); this.room2_activity3A.setScale(0.67); this.room2_activity3B.set...
[ "setScales() {\n this.r2a0_floor.scaleX = 1.98;\n this.r2a0_floor.scaleY = 0.95;\n this.wall_info_2.setScale(0.75);\n this.E_KeyImg.setScale(0.4);\n this.r1_notebook.setScale(0.75);\n this.r1_map.setScale(0.75);\n\t// this.paper_stack.setScale(1.1);\n this.Sre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serialize the column properties of section.
serializeColumns(writer, section) { writer.writeStartElement(undefined, 'cols', this.wNamespace); writer.writeAttributeString(undefined, 'equalWidth', this.wNamespace, '1'); writer.writeAttributeString(undefined, 'space', this.wNamespace, '0'); writer.writeEndElement(); // Column...
[ "serializeSectionProperties(writer, section) {\n writer.writeStartElement('w', 'sectPr', this.wNamespace);\n if (section.headersFooters) {\n this.serializeHFReference(writer, section.headersFooters);\n }\n // if (IsNeedToSerializeSectionFootNoteProperties(section))\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of strings for which IsStructurallyValidLanguageTag() returns false
function getInvalidLanguageTags() { var invalidLanguageTags = ["", // empty tag "i", // singleton alone "x", // private use without subtag "u", // extension singleton in first place "419", // region code in first place "u-nu-latn-cu-bob", // extension sequence without language "hans-cmn-cn", // "hans" cou...
[ "function getInvalidLanguageTags() {\n var invalidLanguageTags = [\n \"\", // empty tag\n \"i\", // singleton alone\n \"x\", // private use without subtag\n \"u\", // extension singleton in first place\n \"419\", // region code in first place\n \"u-nu-latn-cu-bob\", // extension sequence without ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setContentTypeForms: Sets the forms for a list content type
function setContentTypeForms(listName, contentTypeName, newFormUrl, displayFormUrl, editFormUrl) { var ctx = {}; ctx.listName = listName; ctx.contentTypeName = contentTypeName; ctx.newFormUrl = newFormUrl; ctx.displayFormUrl = displayFormUrl; ctx....
[ "listContentTypes(ctx) {\n const contentTypes = Object.keys(strapi.contentTypes)\n .filter(uid => {\n if (uid.startsWith('strapi::')) return false;\n if (uid === 'plugins::upload.file') return false;\n\n return true;\n })\n .map(uid => {\n return service.formatContentTy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[MSOFFCRYPTO] 2.3.4. EncryptionInfo Stream
function parse_EncryptionInfo(blob, length) { var vers = parse_CRYPTOVersion(blob); switch(vers.Minor) { case 0x02: return parse_EncInfoStd(blob, vers); case 0x03: return parse_EncInfoExt(blob, vers); case 0x04: return parse_EncInfoAgl(blob, vers); } throw new Error("ECMA-376 Encryped file unrecognized Versio...
[ "function parse_EncInfoStd(blob){var flags=blob.read_shift(4);if((flags&0x3F)!=0x24)throw new Error(\"EncryptionInfo mismatch\");var sz=blob.read_shift(4);//var tgt = blob.l + sz;\nvar hdr=parse_EncryptionHeader(blob,sz);var verifier=parse_EncryptionVerifier(blob,blob.length-blob.l);return{t:\"Std\",h:hdr,v:verifie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add some text nodes to `root` and highlight them with `highlightRange`. Returns all the highlight elements.
function createHighlights(root, cssClass = '') { let highlights = []; for (let i = 0; i < 3; i++) { const span = document.createElement('span'); span.textContent = 'Test text'; const range = new Range(); range.setStartBefore(span.childNodes[0]); range.setEndAfter(span.childNodes[0...
[ "function highlight() {\n const lastLength = selectedNodes.length;\n const range = getRange();\n\n // is range if null then the selection is invalid\n if (range == null) return;\n\n const start = {\n node: range.startContainer,\n offset: range.startOffset,\n };\n const end = {\n node: range.endConta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the Scale domains
function _updateScales() { xScale.domain(d3.extent([].concat.apply([], data.map(function(d) { return d.data.map(function(pointData) { return new Date(pointData.timestamp); }); })))); yScale.domain([ _getMinY(), _getMaxY() / 100 * 105 ]); n...
[ "function updateScales() {\n dataDomain.x = pc.stat.spec.timestamp;\n dataDomain.y = pc.stat.spec.kwhGen;\n chartDomain.x = d3.extent(dataDomain.x, function (d) {\n return parseDate(d);\n });\n chartDomain.y = [0, d3.max(dataDomain.y)];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A class that mocks the sdk Job class and warns that the instance has been deprecated when a property is accessed.
function MockSdkJob(sdkService, sid) { this._sdkJob = new sdk.Service.Job(sdkService, sid); _.forEach(this._sdkJob, function(prop, propName) { Object.defineProperty(this, propName, { get: function() { // We use the _load method internally, so don't wa...
[ "get deprecated() {\n return false;\n }", "_buildDeprecatedInstance() {\n // Build a default instance\n let instance = this.buildInstance(); // Legacy support for App.__container__ and other global methods\n // on App that rely on a single, default instance.\n\n this.__deprecatedInst...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ajax that gets the vehicles
function ajaxForVehicles(){ createDropDown(maxNumberOfVehicles, $dropDownVehicles); hideTheRestDropDowns($dropDownVehicles); $spanInfo.text("Number of Vehicles"); $divContent.show(); //initial value when link is clicked generateVehicles(initialNumberDisplayed); // get the ajax request $.get("http://swap...
[ "function getVehicles() {\n $.ajax({\n url: \"../../backend/api/get-vehicles.php\",\n success: base\n })\n }", "function getVehicles() {\n $.ajax({\n type: \"GET\",\n url: \"http://localhost/ger/vehicle/GetByUser\",\n data: {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the peek data from the queue without modifing the queue Note: Queue is Firstin Firstout
peek() { const peekData = this.queue[0]; debug(`\nLOG: ${peekData} is on peek of the queue`); return peekData; }
[ "function peek(){\n return queue[0];\n }", "function peek(queue) {\n if(!queue.first) {\n return null\n }\n const first = queue.first\n console.log(first.value)\n return first\n}", "function peek(queue) {\n if (!queue.first) {\n console.log('Queue is empty!');\n return;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[END apps_script_data_studio_auth_reset_user] [START apps_script_data_studio_auth_reset_key]
function resetAuth() { var userProperties = PropertiesService.getUserProperties(); userProperties.deleteProperty('dscc.key'); }
[ "function resetLoginAndPassword() {\n settings.set('User', {\n 'Username': 'null',\n 'Password': 'null'\n });\n}", "function resetLoginAndPassword() {\n\tsettings.set('User', {\n\t\t'SerialNo': 'null',\n\t\t'CtlUrl': 'null',\n\t\t'Mail': 'null',\n\t\t'Nick': 'null'\n\t});\n}", "async resetLo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
recheck dnd mode because of date synchronization
recheck () { logger.info(`time synchronized, recheck dnd mode`) if (this.fsmStatus === FSM_WAITING) { if (this.fsmWaitingBreaker) { logger.info('fsm waiting break') this.fsmWaitingBreaker() } } else if (this.fsmStatus === FSM_END) { this.start(FSMCode.Start) } else { ...
[ "function checkDate() {\n // Update the date\n date = new Date();\n if (date.getDate() != lastDay) {\n resetBot();\n }\n\n lastDay = date.getDate();\n}", "checkNewDay() {\n if (!this.day) {\n this.day = this.getDate();\n } else {\n if (this.day !== this.getDate()) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add event listener for authentication
onAuthentication(func) { this._onAuthCallbacks.push(func); }
[ "function attachAuthListeners() {\n addSignInListener();\n addSignInChanged();\n }", "OnAuthenticated(string, string) {\n\n }", "addLoginEventListener() {\n\n\t\t$(\"#login_button\").click((e) => {\n\t\n\t\t\tlet isValid = this.validateUsername();\n\t\t\tif(!isValid) {\n\t\t\t\te.preventDefault();\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The function creates data required by the miner ID revocation procedure. The data are written into the MINERID_REVOCATION_DATA_FILENAME file. Note: At this stage the revocation key private key must be accessible.
function createMinerIdRevocationData (aliasName, compromisedMinerIdPubKey, isCompleteRevocation) { console.log('Compromised minerId to be revoked: ', compromisedMinerIdPubKey) // minerId revocation data to be written into the file. let revocationData = {} revocationData["complete_revocation"] = isCompleteRevoca...
[ "function readMinerIdRevocationDataFromFile (aliasName) {\n const minerIdRevocationData = _readDataFromJsonFile(aliasName, MINERID_REVOCATION_DATA_FILENAME)\n if (!minerIdRevocationData) {\n return\n }\n _checkRequiredDataField(minerIdRevocationData, \"complete_revocation\", MINERID_REVOCATION_DATA_FILENAME)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if current expand mode is one of the following.
_expandModeIs(modesArray) { const that = this; return modesArray.indexOf(that.expandMode) > -1; }
[ "function _isExpandable ( row ) {\n return $scope.options && $scope.options.expandable;\n }", "get expandMode() {\n\t\treturn this.nativeElement ? this.nativeElement.expandMode : undefined;\n\t}", "get isExpanded() {}", "function isConfigureMode(){\n return $('.ms-quick-bar-list...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes Edges Vector from mol vector, with numeric edges, and maxC the maximum edge number
function makeEdgesVector(molvi,maxC) { var edgeBool, oneEdge, molve = [], molvL, freeEdg = [], boundEdg = [], output; var molvC, jline, varNm, varIn, varOut, varBound; for (var i=0; i<=maxC; i++) {molve.push([]);} for (var i=0; i<molvi.length; i++) { freeEdg.push(false); edgeBool = false; switch (mo...
[ "setNumEdges(v){\n const num = Number(v)\n if(this.state.activeProperty === \"Cycle\"){\n this.updateVertexEdgeBounds(this.state.numV, num, false, this.state.activeProperty)\n } else if (this.state.activeProperty === \"Connected\"){\n this.updateVertexEdgeBounds(this.state...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
findKeywordPhrases(args) Find the keyword phrases. Return them in the order of longest phrases to shortest phrases. For example: "Industrial Workers of the World", "Revolutionary Anarchist", etc..
function findKeywordPhrases(args) { var inputwords = args['inputwords']; var inputwordscount = args['inputwordscount']; var skipwords = args['skipwords']; var finaloutput = ''; var separator = getKeywordSectionSeparator(); if($('.include-phrases').is(':checked')) { // Six-Word Phrases var si...
[ "function phraseOptimization(searchPhrase) {\n var optimizedPhrase = []\n for (var word = 0; word < searchPhrase.length; word++) {\n var currentWord = searchPhrase[word]\n exclusion = false\n for (var keyword = 0; keyword < keywordExclusions.length; keyword++){\n if (currentWord == keywordExclus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
job error system callback
function failedCb(){ dbm.updateJobFailed(uuid, function(err, rows, fields){ if(err) log.error('update status error:', err); dbm.loadJobById(uuid, function(err, rows, fields){ if(err) { log.error('load job by id:%s error', uuid, err); return; } //delete job first log....
[ "function callback_failure_job_details(request, response)\r\n{\r\n writeSR3(\"GetJobDetails failed\", false);\r\n setTimeout(\"writeSR3('', false)\", 10000);\r\n}", "function sendError (job, errorMessage) {\n job.error = errorMessage;\n job.success = false;\n process.send(job);\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the page info
function pageInfo() { var nums = numbers(), pages = pager.pages(), pdata = sparse(pages), res; //Get the hashes. $scope.info.forEach(copyHash); //Get the info res = nums.map(info); return res; ...
[ "function getPageInfo() {\n\tlet page = {\n\t\turl: window.location.href,\n\t\tsite: 'furaffinity'\n\t};\n\tlet split = page.url.split('/');\n\tpage.page = split[3];\n\tpage.modern = $('#ddmenu') ? true : false;\n\n\tif (['user', 'journals', 'gallery', 'scraps', 'favorites', 'commissions'].includes(page.page)) {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrive tag resub categores
retriveTagResuCategores(context, payload) { axios .get("/get/resub/categores/tag", { params: payload }) .then((res) => { context.commit('RETRIVE_TAG_RESUB_CATEGORY', res.data); }) .catch((error) => { console.log(error); }); }
[ "getTagCategories() {\n const categories = this.words\n .flatMap(word => word.getTagCategories());\n return _.uniq(categories);\n }", "getTagCategories() {\n const categories = this.words.flatMap((word) => word.getTagCategories());\n return _.uniq(categories);\n }", "function disneyCategories...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Revert to a default style of a marker
function revertMarker(marker, infowindow) { isHighlighted = false; marker.setIcon(); infowindow.close(); }
[ "rmMarkerStyle() {\n const open_marker = document.querySelector('.open-marker');\n if (open_marker != null) {\n open_marker.classList.toggle('open-marker');\n }\n return;\n }", "resetStyle()\n {\n this.setStyle(this._defaultValue);\n }", "_setSelectedMarkerStyleDefaultSettings() {\n le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets a timer to announce the winner at whatever time is in the config file.
function setTallyTimer() { var tallyTime = new Date(); tallyTime.setHours(CONFIG.tallyTime.hour, CONFIG.tallyTime.minute); var rightNow = new Date(); if (tallyTime > rightNow) { setTimeout(function () { var winner = false, numVotes = 0, tie = false; //Goes thr...
[ "function winner() {\n let timer = setTimeout(winnerAlert, 1000);\n }", "function timerSetup() {\n // MINIGAME 1: 35sec\n if (minigame1) {\n timer = 35;\n }\n // MINIGAME 2: 5sec\n else if (minigame2) {\n timer = 5;\n }\n}", "function setupTimer(end) {\n\t\tvar interval...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the value of 'openLoginAs' to true in the state to open the "login as" dialog
_openLoginAs() { this.setState({ openLoginAs: true }); }
[ "openLogin(){\n\t\t\t//Hide the register modal\n\t\t\tsetTimeout(function () { $('#modalRegister').modal('hide'); });\n\n\t\t\t//Load modal\n\t\t\t$('#modalLogin').modal('show');\n\t\t\t//Restart panel stack and activate panel login\n\t\t\tthis.panelStack = [];\n\t\t\trestoreInputs([\"user\"]);\n\t\t\tactivatePanel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display daily practice schedule in season and appropriate messages out of season
function displayPractice() { var d = new Date(); var day = d.getDay(); var month = d.getMonth(); var date = d.getDate(); // in case of pool closing set day = 8 practice canceled for repairs; day=9 practice canceled for meet ------------------------------------------------- //if (month == 6 && date == lastPract...
[ "function showDay(day){\r\n\r\n\t\t// get from database mission type assigned for this day and appends to HTML\r\n\t\tappendMission(day, getUndoneMissions(day),'undone')\r\n\t\tappendMission(day, getWaitMissions(day),'wait')\r\n\t\tappendMission(day, getDoneMissions(day),'done')\r\n\r\n\t}", "function showDay(day...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get id of the first unused projectile object
function getUnusedProjectileId(list) { var id = -1; //init to negative //only return objects not alive var filteredList = getProjectilesByStatus(list, false); //check if found if (filteredList.length > 0) { id = filteredList[0].id; //get id from first index } ...
[ "function getTileImgId() {\n var tileId;\n getTileImgId.id = ++getTileImgId.id || 1;\n tileId = \"tile\" + getTileImgId.id.toString();\n return tileId;\n}", "function findTileID(object) {\n let currentObject = object;\n let result = currentObject.tileId;\n while (isNaN(result)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Requests the role for the current game ID from the server
function askForRole() { var gameID = getGameID(); console.log("asking server for role with game ID: ", gameID); var getURL = globalURL + "addPlayer/" + gameID + "/" + getParticipantID(); $.ajax({ type: 'GET', url: getURL, success: function(data) { console.log("Received role:", data); partic...
[ "async UserRoleById(request, response) {\n response.send(await UserRoleServices.getUserRoleById(request.params.id));\n }", "getRole(target = this.walletAddress) {\n return __awaiter(this, void 0, void 0, function* () {\n const res = yield this.get({ function: 'role', target });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
noneOf:: String > Parser Char
function noneOf(str){ var chrs = str.split(""); return parser(function(st){ if(st.length < 1) { return parse_error("Unexpect file ending."); } var fst = st.charAt(0); return jHaskell.elem(fst,chrs) ? parse_error("Unexpect " + fst,st): ...
[ "function noneOf(chars) {\n return function(input) {\n var match = new RegExp('[^' + chars + ']');\n if(input.charAt(0).search(match) != -1) {\n return {rest: input.substr(1, input.length - 1),\n parsed: input.charAt(0),\n ast: input.charAt(0)};\n }\n else {\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
highlight all occurrences of the given cipher letters
function highlightLetters(letters) { unhighlightAll(); for (var row=0; row<cipher[which].length; row++) { for (var col=0; col<cipher[which][row].length; col++) { id = row + "_" + col; letter = cipher[which][row].substring(col,col+1); for (var i=0; i<letters.length; i++) { if (letter == letters.s...
[ "function draw_highlighted_letter(ctx, word_index, plaintext, text_start_x,\n box_width){\n ctx.fillStyle = \"#F8CA4D\";\n ctx.textAlign = \"center\";\n ctx.font = '1.30rem PT Mono';\n ctx.fillRect(margin + word_index * box_width, 0, box_width, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Limit Switch 2 Extends mxShape.
function mxShapeElectricalLimitSwitch2(bounds, fill, stroke, strokewidth) { mxShape.call(this); this.bounds = bounds; this.fill = fill; this.stroke = stroke; this.strokewidth = (strokewidth != null) ? strokewidth : 1; }
[ "function mxShapeElectricalProximityLimitSwitch2(bounds, fill, stroke, strokewidth)\n{\n\tmxShape.call(this);\n\tthis.bounds = bounds;\n\tthis.fill = fill;\n\tthis.stroke = stroke;\n\tthis.strokewidth = (strokewidth != null) ? strokewidth : 1;\n}", "function mxShapeElectricalTwoPositionSwitch2(bounds, fill, strok...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle the focused modifier based on the input node focus state.
_toggleFocused() { let focused = document.activeElement === this.inputNode; this.toggleClass('lm-mod-focused', focused); }
[ "_toggleFocused() {\n let focused = document.activeElement === this.inputNode;\n this.toggleClass('p-mod-focused', focused);\n }", "activateFocus() {\n const {FOCUSED, LABEL_FLOAT_ABOVE, LABEL_SHAKE} = MDCTextFieldFoundation.cssClasses;\n this.adapter_.addClass(FOCUSED);\n if (this.botto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if we're logged in. The easy and stupid way, check to see if the sign out link is present...
function isLoggedIn() { //return document.querySelector("#SingOut1_lnkSignOut") != null; //New web page version return document.querySelector(".icon-sign-out") != null; }
[ "function checkIfSignedIn() {\n if (gapi && gapi.auth2 && gapi.auth2.getAuthInstance().isSignedIn.get()) {\n // User is signed in\n $('#userIdBox').removeClass('hidden');\n $('#loginBox').addClass('hidden');\n $('#mainInfo').removeClass('hidden');\n } else {\n // No valid user signed in\n $('#us...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move lab inside a folder
function moveLab(lab, path) { var deferred = $.Deferred(); var type = 'PUT'; var url = '/api/labs' + lab + '/move'; var form_data = {}; form_data['path'] = path; $.ajax({ cache: false, timeout: TIMEOUT, type: type, url: encodeURI(url), dataType: 'json', ...
[ "function moveLab(lab, path) {\n var deferred = $.Deferred();\n var type = 'PUT';\n var url = '/api/labs' + lab + '/move';\n var form_data = {};\n form_data['path'] = path;\n $.ajax({\n timeout: TIMEOUT,\n type: type,\n url: encodeURI(url),\n dataType: 'json',\n data: JSON.stringify(form_data),...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open/close read more on home page
function openClose() { $this = $(this); var entry = $(this).prev('.entry-content'); entry.find('.content').toggle(); entry.find('.excerpt.short').toggle(); var text = $this.text() == 'More' ? 'Less' : 'More'; $this.text(text); }
[ "function readmore(){\n\tjQuery('#show-this-on-click').slideDown();\n\tjQuery('.readmore').hide();\n jQuery('.readless').show();\n}", "function readless(){\n\tjQuery('#show-this-on-click').slideUp();\n\tjQuery('.readless').hide();\n jQuery('.readmore').show();\n}", "function readMore() {\n\t$('.update-tex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to initialize the etave replay ui
function initUi() { // Set player values timeInp.value = millisecondsToIso(0); timeLeftInp.value = millisecondsToIso(duration); progressInp.max = duration; urlbar.value = site.url; updateOptions(false); addProgressBackground(); }
[ "function initUI() {\r\n createTopBar();\r\n root.append(mainPanel); // TODO JADE\r\n makeSidebar();\r\n METADATA_EDITOR.init(); // initialize different parts of the editor\r\n LOCATION_HISTORY.init();\r\n THUMBNAIL_EDITOR.init();\r\n MEDIA_EDITOR.init();\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flot plumbing Hooks the pyramid plugin options processor when _flot_ initializes the _plot_.
function init(plot) { plot.hooks.processOptions.push(processOptions); }
[ "function ApexPlotOptions() { }", "function setupMainPlot() {\n plot = $.plot($(\"#placeholder\"), \n getRecentData(), \n options \n );\n }", "function preInit(target, data, options) {\n options = options || {};\n options.axesDefaults = options.axesDefaults || ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts all points in a leg Params: The leg taken from the googlemaps API
function extractPoints (leg){ return leg.steps.reduce(function (collection, step) { return collection.concat(step.path.map(function (path) { return [path.lng(), path.lat()]; })); }, []); }
[ "getPoints() {\n let valueArray = this.getPointsRaw()\n let returningArray = []\n valueArray.forEach((coordinate) => {\n returningArray.push(new google.maps.LatLng(coordinate[0],coordinate[1]))\n })\n return returningArray\n }", "function getPoints() {\r\n legCoordinates = le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Playback one event (i.e. stroke)
function playEvent( ctx, event ) { switch ( event.type ) { case "draw": drawCurve( ctx, event); break; case "erase": eraseCurve( ctx, event ); break; } }
[ "function startStroking(input) {\n\tsendMessage(\"%stroke_Start%\");\n\tplayStrokePace(input);\n}", "function startPressPen(event) {\n isDrawning = true\n\n // start draw here, go make some dots\n draw(event)\n }", "function draw() {\n background(128, 128, 0);\n\n click2.draw();\n\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts the stream names from the EventStreams spec.
function formatAvailableStreams (spec) { // /v2/stream/{streams} endpoint spec has a list of all available streams. return spec.paths['/v2/stream/{streams}'].get.parameters[0].schema.items.enum; }
[ "static get eventNames() {\n\t\t// allEvent\n\t\tvar allEvents = {};\n\t\tvar superEvents = super.eventNames;\n\n\t\tvar myEvents = {\n\t\t\tNkMedia_EventNames_Start_Here: \"NkMedia_EventNames_Start_Here\",\n\n\t\t\t//--------------------------------------------------------\n\t\t\t// See RtcMedia eventNames for do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
these apply to all perigram readers:
function PerigramReader(g, rx, ry, speed) { Reader.call(this, g, rx, ry, speed); // superclass constructor this.type = 'PerigramReader'; // superclass variable(s) this.phrase = ''; this.consoleString = ''; this.downWeighting = .6; this.upWeighting = .12; this.defaultColorDark = hexToRgb("#FA0007"); // ...
[ "_read() {\n\n }", "setHints(hints) {\n this.hints = hints;\n\n let tryHarder = hints != null && hints.ContainsKey(DecodeHintType.TRY_HARDER);\n let formats = ((hints == null) ? null : hints.getValuesByKey(DecodeHintType.POSSIBLE_FORMATS));\n this.readers = new ArrayList();\n if (formats != null...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop automatic interaction externally
function stopInteraction() { if (GC.interactor !== null) { GC.interactor.kill(); } }
[ "function stop() {\n this.noAutomation = true;\n}", "stop() {\n\n this.editor.setOption('readOnly', false);\n\n this.shouldStop = true;\n if (this.currentRejectPromise !== undefined) {\n this.currentRejectPromise('Interrupted execution');\n }\n if (Sk.rejectSleep !== undefined) {\n Sk....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all the text from the book into one string
function bookText(b) { var lines = b.pages.map(function(p) { return p.text; }); lines.push(b.title); lines.push(b.author); var s = lines.join(' '); return s; }
[ "function getTextBook() {\n return fetch(URL)\n .then(response => response.json())\n .then(data => data.response)\n .then(response => {\n return {\n title: response.name,\n textBook: response.text\n }\n })\n}", "get richText() {}", "async function getText(source) {\n // initialize cheerio ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to delete a seed instance by Id
static delete(req, res) { const { seedId } = req.params; models.Seed.findOne({ where: { id: seedId }, attributes: ["id", "strain"] }) .then(function (foundSeed) { if (foundSeed) { models.Seed.destroy({ where: { id: seedId ...
[ "delete(id) {\n assert.ok(id)\n return this.collection.findOneAndDelete({ id })\n }", "async delete(id) {\n return await Database.getConnection().models.Mode1.destroy({ where: { _id: id } });\n }", "function destroy(id) {\n return db('tutorials')\n .where({ id })\n .del()\n .returning('*')\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fonction qui affiche le compteur
function displaycompteur() { $compteur.innerHTML = pattern.length; }
[ "function spectre(){//perte de tous les souvenirs et multi\n\t\tsouvenirs = 0;\n\t\tSouvenirs.innerHTML = souvenirs;\n\t\tauto = 0;\n\t\tif(compteur >1){\n\t\tcompteur = 1;\n\t\t}\n\t\t//Bonus_malus.innerHTML = compteur ;\n\t}//tres mechant----", "function displayComum() {//pega o display da Calculadora COMUM e ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Operation: getNoParam summary: Test no parameters valid responses: '200': description: ok
async getNoParam() { return ""; }
[ "function noParams() {}", "function noParams () {}", "function noOp(param) {\n return param;\n}", "function expectNoParameterHint() {\n expect(ParameterHintManager.popUpHint()).toBe(null);\n }", "function noOp(parameter) {\n\n return parameter;\n\n}", "static noContent(value, error= ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if cell is in hover range
function inHoverRange(cellStartRow, cellRowSpan, startRow, endRow) { var cellEndRow = cellStartRow + cellRowSpan - 1; return cellStartRow <= endRow && cellEndRow >= startRow; }
[ "_rectIsHovered(rect: Rect, mouseOffsetPosition: Position): boolean {\n const positionWithinRect =\n getRelativePosition(mouseOffsetPosition, rect);\n\n return 0 <= positionWithinRect.left &&\n positionWithinRect.left < rect.width &&\n 0 <= positionWithinRect.top &&\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears highlights from a given source group and a range of lines To clear a source group in the entire buffer, pass in 1 and 1 to lineStart and lineEnd respectively.
clearHighlight(args = {}) { const defaults = { srcId: -1, lineStart: 0, lineEnd: -1, }; const { srcId, lineStart, lineEnd } = Object.assign({}, defaults, args); return this.notify(`${this.prefix}clear_highlight`, [ srcId, lineSt...
[ "clearHighlight() {\n let { matchIds } = this;\n let { nvim } = workspace_1.default;\n if (matchIds.size == 0)\n return;\n nvim.pauseNotification();\n nvim.call('coc#util#clearmatches', [Array.from(matchIds)], true);\n nvim.command('redraw', true);\n nvim....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add class 'mobile' to nav when < 600px size scren
function resize() { if ($window.width() < 600) { return $nav.addClass('mobile-nav'); } $nav.removeClass('mobile-nav'); }
[ "function mobileMenu() {\n var $navMenu = $('#nav-menu'),\n smallClass = 'small-menu',\n breakPoint = 941;\n\n\n if ( $(window).width() < breakPoint ) {\n if ( ! $navMenu.hasClass(smallClass) ) {\n $navMenu.addClass(smallClass).prepend('<a id=\"toggle-me...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update product details. PUT or PATCH product/:id
async update ({ params, request, response }) { const product = await Product.find(params.id) const data = request.only([ "name", "description", "price" ]) product.merge(data) if (product) { response.status(200).json({ success: 'Product Updated', data: ...
[ "function updateProduct(product) {\n $.ajax({\n method: \"PUT\",\n url: \"/api/products\",\n data: product\n })\n .then(function() {\n window.location.href = \"/update\";\n });\n }", "function editProduct(id) {\n \n console.log(\"TODO: Edit product \" + id)\n old_product ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal Reactjs function > Get example state from sessionStorage
componentWillMount() { if (sessionStorage.getItem(this.props.example.key)) { const exampleStatus = JSON.parse( sessionStorage.getItem(this.props.example.key) ); this.setState(() => ({ enyo: exampleStatus.enyo, css: exampleStatus.css, enyoCheck: exampleStatus.enyoChe...
[ "componentDidMount() {\n let userProfile = JSON.parse(sessionStorage.getItem('userProfile'));\n this.setState({ userProfile: userProfile });\n }", "function get_state(s) {\n return session_state;\n}", "static getSessionStorage() {\n return JSON.parse(sessionStorage.getItem('personalGallery'));\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
similar to normal thunkify, but puts callback after 1 argument rather than at end
function thunkify1(fn) { return function () { var args = [].slice.call(arguments); var results; var called; var cb; args.splice(1, 0, function () { results = arguments; if (cb && !called) { called = true; cb.apply(this, results); } }); fn.apply(this, args); return function (fn) { ...
[ "function thunkify(fn) {\n return function() {\n var args = Array.prototype.slice.call(arguments);\n var ctx = this;\n\n return function(cb) {\n args.push(cb);\n fn.apply(ctx, args);\n };\n };\n}", "function thunk(fn /*, args */) {\n\n}", "function thunkify(thunkFn) {\n return (...args)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether this node's markup correspond to the given type, attributes, and marks.
hasMarkup(type, attrs, marks) { return this.type == type && compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) && Mark$1.sameSet(this.marks, marks || Mark$1.none); }
[ "_hasMarkup(path, type, from, to) {\n const markups = this.map.getIn(path.concat('markups', type));\n\n for (let i = 0, j = markups.size; i < j; i++) {\n const range = markups.get(i);\n if (from >= range.getIn(['range', 0]) &&\n to <= range.getIn(['range', 1])) {\n return true;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======================================= Get Var Priority Value =======================================
function getVarPriorityValue (priority) { RMPApplication.debug("begin getVarPriorityValue"); c_debug(dbug.priority, "=> getVarPriorityValue: priority = ", priority); var priority_value = ""; switch (priority) { case '1': case '1 - Critical': case '1 - Critique': pr...
[ "function _getPriority(obs) {\n const depItem = obs._getDepItem();\n return depItem ? depItem._priority : 0;\n}", "currentPriority(actionContext) {\n const { value: priority, error } = this.priority.tryGetValue(actionContext.state);\n if (error) {\n return -1;\n }\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a string reverse the order of words.
function reverseWords(string){ return string.split(" ").reverse().join(" ") }
[ "function revWords(str){\n return str.split(' ').reverse();\n}", "function reverseWords(str){\n reverse = str.split(\" \").reverse().join(\" \");\n return reverse; // reverse those words \n }", "function reverseWords(str){\n return str.split(' ').map(word => {\n return word.split('')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This will return the index of the last point where the numbers were decreasing. If the numbers just keep decreasing and the pattern doesn't change, then 1 will be returned.
function decreaseArr(arr) { let index; for(let i = 0; i < arr.length; i++) { if(arr[i+1] - arr[i] > 0) { index = i; break; } else { index = -1; } } return index; }
[ "function getLastDelta(array) {\n\tlet last = null\n\tif (array.length > 1) {\n\t\tfor (let i=array.length-1; i>0; i--) {\n\t\t\tif (array[i] != 0) {\n\t\t\t\tif (!last) {\n\t\t\t\t\tlast = array[i]\n\t\t\t\t} else {\n\t\t\t\t\treturn last - array[i]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn 0\n}", "function fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all polygon options
getOptions(polygon) { if (this.getPolylabelType() === 'collection') { return polygon.options.getAll(); } else { return polygon.options; } }
[ "allPolygons() {\n let polygons = this.polygons.slice();\n if (this.front)\n polygons = polygons.concat(this.front.allPolygons());\n if (this.back)\n polygons = polygons.concat(this.back.allPolygons());\n return polygons;\n }", "allPolygons() {\r\n let polygons = this.polygons.slice(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funzione per eseguire il setup dei componenti
function setupComponents() { planComponents= { walls: [], fornitures: [] } }
[ "setupComponents() {\n\t\tthis.contactBar = new ContactBar();\n\t\tthis.contactBar.setup();\n\n\t\tthis.modal = new Modal();\n\t\tthis.modal.setup();\n\n\t\tthis.accordion = new Accordion();\n\t\tthis.accordion.setup();\n\n\t\tthis.mediaGallery = new MediaGallery();\n\t\tthis.mediaGallery.setup();\n\t}", "setup (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enable plugin for this Handsontable instance.
enablePlugin() { if (this.enabled) { return; } if (typeof this.hot.getSettings().contextMenuCopyPaste === 'object') { this.swfPath = this.hot.getSettings().contextMenuCopyPaste.swfPath; } if (typeof ZeroClipboard === 'undefined') { console.error('To be able to use the Copy/Paste fe...
[ "enablePlugin() {\n if (this.enabled) {\n return;\n }\n\n this.setPluginOptions();\n\n if (isUndefined(this.hot.getSettings().observeChanges)) {\n this.enableObserveChangesPlugin();\n }\n\n this.addHook('afterTrimRow', () => this.sortByPresetColumnAndOrder());\n this.addHook('afterUnt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: elm_deleteEmailAddress(id) Description: Deletes a selected email address from the database.
function elm_deleteEmailAddress(id) { sendBackendRequest("Back_End/DeleteEmailAddress.php","SID="+getSID()+"&ID="+id); main_loadLog(); //refresh the log return; }
[ "static delete(emailAddressId) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const contactEmailAddress = (yield db_1.db.delete.table('ContactEmailAddresses').where('emailAddressId', '=', emailAddressId).delete()).rowCount;\n return (contactEmailA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find a valid cursor or leaf node selection starting at the given position and searching back if `dir` is negative, and forward if positive. When `textOnly` is true, only consider cursor selections. Will return null when no valid selection position is found.
static findFrom($pos, dir, textOnly = false) { let inner = $pos.parent.inlineContent ? new TextSelection($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly); if (inner) return inner; for (let depth = $pos.depth - 1; depth >= 0; depth--) { let found2 = dir < ...
[ "function findSelectionFrom($pos, dir, text) {\n var inner = $pos.parent.isTextblock ? new TextSelection($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, text);\n if (inner) return inner;\n\n for (var depth = $pos.depth - 1; depth >= 0; depth--) {\n var found = dir < 0 ? findSel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Encuentra un contacto por su nombre
read(nombre) { const contactoOne = this.contactos.find( contacto => contacto.nombre === nombre.toLowerCase()); // if (!contactoOne) { // throw Error('No existe contacto con ese Nombre'); // } return contactoOne; }
[ "function ajouterContact(nom, prenom){\n\tnouveauContact = new personne(nom, prenom);\n\tlistesContact.push(nouveauContact);\n\tconsole.log(nouveauContact.messageAjout()) ;\n}", "function creerContact(prenomContact, nomContact) {\n var nouveauContact = Object.create(Contact);\n nouveauContact.init(prenomCon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If an ID value is given return the corresponding entity. Otherwise return a new entity that hasn"t been added to the model yet.
entity(id) { if (arguments.length === 0) { return new Entity(this); } else { return internal(this).entities.get(id); } }
[ "getById(id) {\r\n\t\tfor(let i = 0; i < this.entities.length; ++i) {\r\n\t\t\tlet entity = this.entities[i];\r\n\t\t\tif(entity.id == id) {\r\n\t\t\t\treturn entity;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\t}", "function findEntity(entity,ID){\n const result = entity.get(ID)\n if(result)\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage t...
async setAccessTier(tier, options = {}) { var _a; const { span, updatedOptions } = createSpan("BlobClient-setAccessTier", options); try { return await this.blobContext.setTier(toAccessTier(tier), Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditi...
[ "async setAccessTier(tier, options = {}) {\n return tracingClient.withSpan(\"BlobClient-setAccessTier\", options, async (updatedOptions) => {\n var _a;\n return assertResponse(await this.blobContext.setTier(toAccessTier(tier), {\n abortSignal: options.abortSignal,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Traverse ancestors and return all sequenceables
get sequenceableAncestors () { return this.ancestors.filter((patch) => { return patch.sequenceable; }) }
[ "*ancestors() {\r\n let state = this.prev;\r\n while (state != null) {\r\n yield state;\r\n state = state.prev;\r\n }\r\n }", "ancestors() {\n\t const nodes = [];\n\n\t let parent = this.caller;\n\t while (parent) {\n\t nodes.push(parent);\n\t paren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds an entry item to the database and returns a promise with the auto increment id as resolve value.
function addEntry(item){ var d = $.Deferred(); // set dateAdded item.dateAdded = $.now(); db.transaction(function (tx) { tx.executeSql('SELECT sortIndex FROM entries ORDER BY sortIndex DESC LIMIT 1', [], function (tx, results) { // fetch greate...
[ "function addAttempt(attempt)\n{\n return new Promise((resolve) => {\n \n let transaction = attemptsDb.transaction(['attempts'],'readwrite')\n transaction.oncomplete = e => {\n resolve(e);\n };\n\n let store = transaction.objectStore('attempts');\n store.add(a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subscribe to the root menus mouse move events and update the tracked mouse points.
_subscribeToMouseMoves() { this._ngZone.runOutsideAngular(() => { fromEvent(this._menu.nativeElement, 'mousemove') .pipe(filter((_, index) => index % MOUSE_MOVE_SAMPLE_FREQUENCY === 0), takeUntil(this._destroyed)) .subscribe((event) => { this._points.p...
[ "updateMouseMoveEvents() {\n this.updateEventsContainer('mouse-move');\n }", "function bindMouseMove() {\r\n canvas.addEventListener('mousemove', function(e) {\r\n mousePos = getMousePos(e);\r\n });\r\n }", "function updateMousePos2() {\n var rect = canvas.getBoundingCli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUBLIC Sets whether the network element has border or not.
function setBorderNE(hasBorder) { if (!eval(hasBorder)) { this.borderColor = null; } }
[ "function setMinimapBorder(hasBorder) {\n\t\tif (!eval(hasBorder)) {\n\t\t\tthis.borderColor = \"#ffffff\";\n\t\t}\n\t}", "setBorder() {\r\n this.removeBorder();\r\n if (this.currentElement !== null){\r\n this.currentElement.style.border = \"1.5px solid blue\";\r\n }\r\n }", "setBorder() {\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates caret to page.
updateCaretToPage(startPosition, endPage) { if (!isNullOrUndefined(endPage)) { this.viewer.selectionEndPage = endPage; if (this.owner.selection.isEmpty) { this.viewer.selectionStartPage = endPage; } else { // tslint:disable-next-lin...
[ "function updateCaret() {\n\t\t\tcaret = selection.start - offset;\n\t\t}", "function updatePosition(){\n\t\tpositionInfo.html( caretPos() );\n\t}", "function putCaret(pos){\n _caret = pos;\n }", "saveCaretPosition () {\n\n var selection = window.getSelection();\n var previousElement = s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate a "track" event.
function validateTrackEvent(event){assert(event.anonymousId||event.userId,'You must pass either an "anonymousId" or a "userId".');assert(event.event,'You must pass an "event".');}
[ "function validateTrackEvent (event) {\n assert(event.anonymousId || event.userId, 'You must pass either an \"anonymousId\" or a \"userId\".')\n assert(event.event, 'You must pass an \"event\".')\n}", "function validate(artist, track, callback) {\n\t\t// dummy song structure - we dont use it globally yet\n\t\tv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the export declaration associated with this export specifier.
getExportDeclaration() { return this.getFirstAncestorByKindOrThrow(typescript_1.SyntaxKind.ExportDeclaration); }
[ "getExportSymbol() {\r\n return this._context.typeChecker.getExportSymbolOfSymbol(this);\r\n }", "parseExportSpecifier() {\n const node = this.startNode();\n node.localName = this.parseModuleExportName();\n if (this.eat('as')) {\n node.exportName = this.parseModuleExportName();\n } else...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts each nested Array into an employee record and accumulates it to a new Array
function createEmployeeRecords(arrOfArrays){ return arrOfArrays.map(createEmployeeRecord) }
[ "function transformEmployeeData(array) {\n const output = [];\n array.forEach(el => {\n output.push(fromListToObject(el));\n })\n return output;\n}", "function createEmployeeRecords(arrayOfArrays) {\n return arrayOfArrays.map(employeeArray => {\n return createEmployeeRecord(employeeAr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AccuracyVisit picker event handler
function OnAccuracyVisit_Change( e , type ) { Alloy.Globals.AeDESModeSectionEight["ACCURACY_VISIT"] = e.id ; // If the selected item is not "Other" the OtherName will be set to empty if( e.id != 7 ) { $.widgetAppTextFieldAeDESModeFormsSectionEightOther.set_text_value( "" ) ; Alloy...
[ "onGradientTypeSelect(e) {\n const { actions, dispatch } = this.props;\n dispatch(actions.updateGradientType(e.currentTarget.value));\n }", "function visit_num_onchange() {\n var selectedVisitNum = parseInt(document.getElementById(\"visitNumSelectId\").value);\n var selectedRegion = parseInt(do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to fetch soundcloud URLs and parse the response into artist counts
function fetchSoundcloudUrl (soundcloudUrl) { soundcloudUrl = `${soundcloudUrl}&client_id=${CLIENT_ID}&app_version=1553260698&app_locale=en` https.get(soundcloudUrl, (res) => { if (res.statusCode !== 200) { console.error(`Could not complete request to ${soundcloudUrl}`) finished += 1 } else { ...
[ "async function getSongsapi() {\n let songs = await fetch(\"https://shazam.p.rapidapi.com/songs/list-artist-top-tracks?id=xxxxxxxx&locale=en-US\", {\n \"method\": \"GET\",\n \"headers\": {\n \"x-rapidapi-key\": \"xxxxxxxxxxxxxxxxx\",\n \"x-rapidapi-host\": \"shazam.p.rapidapi....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets one raw scraping directive. Checks for the depth, simplifies and runs it.
function interpretScrapingDirective(directive, context, implicitArgument) { try { if (!depthChecker.isValidDepth(directive)) { throw new exceptions.RuntimeError('Depth of nesting of the instruction is too high'); } var simplified = simplifier.simplifyScrapingDirective(directive); return evaluat...
[ "parse() {\n const lines = this.data.split(/\\r?\\n/);\n for (let line of lines) {\n line = line.trim();\n if (!line || line.startsWith(\"#\")) {\n continue;\n }\n const [directive, ...tokens] = line.split(/\\s/);\n const parseMetho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
saving basic card to log.txt
function basicSave(flash) { fs.appendFile('log.txt', 'Front: ' + flashcard.front + 'Back: ' + flashcard.back + '\n', 'UTF-8', function(error) { if (error) throw error; }); }
[ "function saveBasic(flashcard){\n\tfs.appendFile(\"output.txt\", `Front: ${flashcard.front} Back: ${flashcard.back} \\n`, \"UTF-8\", function(error){\n\t\tif (error) throw error;\n\t});\n}", "function appendCard (cardEntry) {\nfs.appendFile('log.txt', cardEntry, function (error) {\nif (error) {\n console.log(err...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is called when a giveaway needs to be saved in the database.
async saveGiveaway(messageId, giveawayData) { // Add the new giveaway to the database giveawayDB.set(messageId, giveawayData); // Don't forget to return something! return true; }
[ "async saveGiveaway(messageId, giveawayData) {\n // Add the new giveaway to the database\n await db.push('giveaways', giveawayData);\n // Don't forget to return something!\n return true;\n }", "async saveGiveaway(messageID, giveawayData){\r\n // Add the new one\r\n db....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
skip all white spaces and new line characters
skipSpaces() { while (this.currentChar === " " || this.currentChar === '\n') { this.consume(); } }
[ "function skipWhitespace() {\n\t\t\tfor (; cursor < input.length; cursor++) {\n\t\t\t\twhile (input[cursor] == \"\\\\\" && (cursor < input.length-1 && whitespace(input[cursor+1])))\n\t\t\t\t\tcursor++;\n\t\t\t\tif (!whitespace(input[cursor]))\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}", "function skipWhitespace() {\n\t\tf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete all news like of user with id
async deleteNewsLike() { const newsLike = await NewsLike.query().where('user_id', this.id); if (newsLike) await NewsLike.query() .delete() .where('user_id', this.id); return newsLike; }
[ "async function deleteLike({ id }) {\n const newLikesArray = likes.filter(like => like.id !== id);\n setLikes(newLikesArray);\n await API.graphql({ query: deleteLikeMutation, variables: { input: { id } }});\n }", "async deleteNews() {\n const allNews = await News.query().where('user_id', this.id);\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function which opens addressbook for added new delegate.
function eventAddDelegate(moduleObject, element, event) { var windowData = new Object(); windowData["hide_groups"] = ["dynamic", "normal", "everyone"]; windowData["hide_companies"] = true; parentWebclient.openModalDialog(-1, 'addressbook', DIALOG_URL+'task=addressbook_modal&storeid='+ moduleObject.storeid +'&type=...
[ "function open_address_book_window(aController) {\n if (aController === undefined) {\n aController = mc;\n }\n\n windowHelper.plan_for_new_window(\"mail:addressbook\");\n EventUtils.synthesizeKey(\n \"b\",\n { shiftKey: true, accelKey: true },\n aController.window\n );\n\n // XXX this should proba...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calcPersian Update from Persian calendar
function calcPersian() { setJulian(persian_to_jd((new Number(document.persian.year.value)), document.persian.month.selectedIndex + 1, (new Number(document.persian.day.value)))); }
[ "function calcPersian()\n{\n setJulian(persian_to_jd((new Number(document.persian.year.value)),\n document.persian.month.selectedIndex + 1,\n (new Number(document.persian.day.value))));\n}", "toPersian(gDate) {\n return window.Helper.gregorianToJal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of all supported exchanges.
getExchanges() { return tslib_1.__awaiter(this, void 0, void 0, function* () { return yield this.getRestData('/exchanges'); }); }
[ "function getAllExchanges (opts, callback) {\n try {\n let exchanges = Object.keys(Clients.EXCHANGES)\n\n let result = exchanges.reduce((memo, ex) => {\n let exchange = Clients.EXCHANGES[ex]\n\n if (!exchange || !exchange.enabled) return memo\n\n memo.push({\n enabled: exchange.enabled,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a `Buffer` to a `Number`.
function bufferToInt(buf) { return new bn_js_1.default(toBuffer(buf)).toNumber(); }
[ "function toNumberString (buffer, radix) {\n let high = readInt32(buffer, 0)\n let low = readInt32(buffer, 4)\n let str = ''\n\n radix = radix || 10\n\n while (1) {\n const mod = (high % radix) * UINT_MAX + low\n\n high = Math.floor(high / radix)\n low = Math.floor(mod / radix)\n str = (mod % radix...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the normals corresponding to the face of the sphere and the cube, which is used for flat shading
function setFaceNormals() { for (var i = 0; i < pointsArray.length; i += 3) { var normal = normalNewell(pointsArray[i], pointsArray[i + 1], pointsArray[i + 2]); for (var j = 0; j < 3; j++) { faceNormals.push(normal); } } }
[ "function setNormals(vertex, normals, faces)\n{\n //populate all vertex normals with 0\n for( i = 0; i < vertex.length; i++ )\n {\n // var temp = vec3.fromValues(0,0,0);\n normals.push(0);\n }\n // console.log(\"set\"+normals.length);\n //find average face normals and add them to each ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the newRecord object with API response data
function updateNewRecord(newRecord, resp, appConfig) { try { var avsResponseCode = resp.avsResponseCode; var avsResponseMessage = resp.avsResponseMessage; var cvnResponseCode = resp.cvnResponseCode; var cvnResponseMessage = resp.cvnResponseMessage; ...
[ "function updateNewRecord(newRecord, resp, appConfig) {\r\n\r\n try {\r\n var avsResponseCode = resp.avsResponseCode;\r\n var avsResponseMessage = resp.avsResponseMessage;\r\n var avsResponse = avsResponseCode + ': ' + avsResponseMessage;\r\n var paymentOperation =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Only need a single Audio Mixer, so the class is static Responsible for managing all the audio in the app
function AudioMixer() { AudioMixer.superclass.constructor.call(this); this.sounds = {}; // If AudioMixer is disabled, do not do anything else if(!AudioMixer.enabled) { console.log("AudioMixer is currently disabled"); return; } this.crossFadeComplete = th...
[ "createAudio() {\n this.audios = {};\n this.audios.running = this.sound.add('running', { loop: true });\n this.audios.harvest = this.sound.add('harvest', {volume: 0.5});\n this.audios.dig = this.sound.add('dig', {volume: 0.4});\n this.audios.sell = this.sound.add('sell', {volume: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }