query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
get the sum of all absolute values of matrix
function sumaM(x_in) { var y = 0; var lt=x_in.length; var y = 0.0; for (igo = 0; igo < lt; igo++) { for (jgo = 0; jgo < lt; jgo ++) { y = y + Math.abs(x_in[igo][jgo]) } } return y; }
[ "get absSum() {\r\n var _absSum = 0;\r\n for(var mY = 0; mY < this.sizeY; mY++) {\r\n for(var mX = 0; mX < this.sizeX; mX++) {\r\n _absSum += Math.abs(this.matrixElement[mX][mY].value);\r\n }\r\n } \r\n return _absSum;\r\n }", "function getAbsSum(arr){\n return arr.map(a => Math....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sanitized modulus function that always returns in the range [0, d) rather than (d, 0] if v is negative
function mod(v, d) { var out = v % d; return out < 0 ? out + d : out; }
[ "function mod(v, d) { return ((v % d) + d) % d; }", "function mod(v, d) {\n var out = v % d;\n return out < 0 ? out + d : out;\n}", "function mod(v,d){ return ((v%d) + d) % d; }", "function modulus(vector) {\n\treturn distanceTo([0,0], [vector[0], vector[1]])\n}", "function mod( a, b ){ let v = a % b;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
call to search with all countries
function searchAllCountries() { GetAjaxData("https://restcountries.eu/rest/v2/all?fields=name;topLevelDomain;capital;currencies;flag", response => createArrayFromAllCountries(response) , err => console.log(err)) }
[ "function searchCountries() {\n\tvar countryName = document.getElementById('country-name').value;\n\tif (!countryName.length) countryName = 'Poland';\n\tfetch(url + countryName)\n\t\t.then(function(resp) {\n\t\t\treturn resp.json();\n\t\t})\n\t\t.then(showCountriesList);\n}", "function searchCountry() {\n\tif (se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to apply default values to a component props object. This function is intended for function components, to maintain parity with the `defaultProps` feature of class components. It accounts for properties that are specified, but undefined.
function getPropsWithDefaults(defaultProps, propsWithoutDefaults) { var props = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, propsWithoutDefaults); for (var _i = 0, _a = Object.keys(defaultProps); _i < _a.length; _i++) { var key = _a[_i]; if (props[key] === undefined) { props[...
[ "__applyDefaultProps(props, defaultProps) {\n for (let propName in defaultProps) {\n if (props[propName] === undefined) {\n props[propName] = defaultProps[propName];\n }\n }\n }", "function fillDefaultProps(props...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
print sum of even number using function
function sumOfEvenNumber(num) { var sum = 0; for(var i = 1; i <= num; i++) { if(i % 2 === 0) { sum = sum + i; } } console.log(sum); }
[ "function summationEven () {}", "function evenOddSums() {}", "function firstEvenNumbersSum(n) {\n\n}", "function evenNum(){\n var sum =0;\n for(var i = 0; i <= 1000 ; i++){\n if(i%2 == 0){\n sum += i;\n }\n }\n return sum;\n}", "function sumOfodd(sum,num) {\n if(num %...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turns off hot keys for when the tour isn't running
function unsetHotKeys() { hotkeys.del('esc'); hotkeys.del('right'); hotkeys.del('left'); }
[ "function disableHotKeys() {\n \n h_win_disableHotKeys = function( e ) { \n if( \n e.ctrlKey && \n ( \n e.which == 65 || \n e.which == 66 || \n e.which == 67 ||\n e.which == 70 ||\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
7///////////////// PARSE ALERT IDS ////////////////////////////////////////// triggered by: open_alerts > msg to server,response > parse_msg > this arguemnts: list of alert ids and MID what it does: remove loading, call add_alert() AND request alert_details for each ID in ids why: to prepare alert view for incoming pic...
function parse_alert_ids(ids_open,ids_closed,open_max,closed_max,mid){ // remove loading it and add a ack all button var closed_disp=$("#"+mid+"_alarms_closed_display"); var open_disp=$("#"+mid+"_alarms_open_display"); var closed_stopper=$("#"+mid+"_alarms_closed_stopper"); var open_stopper=$("#"+mid+"_alarms_ope...
[ "function add_alert(aid,mid,view){\n\t// if m2m lable ist 123456789 and alarm is 1010 then we should get this:\n\t// <div id=\"alert_123456789_1010\">\n\t// \t<img id=\"alert_123456789_1010_img\"> -> id changes to set_alert_123456789_1010_img</img>\n\t//\t<div id=\"alert_123456789_101_side>\n\t//\t \t<div id=\"aler...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if callback is undefined, then all callbacks associated with child will be removed
off(type, child, callback) { manager.subscribe(this, type, child, callback); return this; }
[ "function removeCallbacks() {\n callbacks.forEach(function (d) {\n viz.on(d.on, null);\n })\n }", "function removeListener(callback) {\n callbacks = callbacks.filter(function (cb) {\n return cb !== callback;\n });\n }", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
I load the remote data from the server.
function loadRemoteData() { // The comment service returns a promise. Userservice.getUsers().then(function(Users) { applyRemoteData(Users); }); }
[ "function loadRemoteData() {\n\t\tretailService.getData().then(\n\t\t\t\tfunction( records ) {\n\t\t\t\t\tapplyRemoteData( records );\n\t\t\t\t}\n\t\t);\n\t}", "function loadRemoteData() {\n // The HelloService returns a promise.\n HelloService.getData().then(\n function( data ) {\n appl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete Content Audio File
deleteAudioFile(type){ if(type=='content') { const activityContent = this.state.activityContent; activityContent['filename'] = ''; this.setState({ activityContent:activityContent, }) } else { const textFields = this.state.textFields; textFields ['pronunciation'] = '' this.setState({ t...
[ "function removeAudioFile() {\n var audioFile = Ti.Filesystem.getFile(res.data.filePath);\n audioFile.deleteFile();\n }", "function deleteFavesAudio() {\n fs.readdirSync(getUserHome() + \".sonospowermate/sound\").forEach(function(fileName) {\n fs.unlinkSync(getUs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the title and content of an entry in a notebook
function getTitleAndContent(notebookFileName, entryId) { var xmlDoc = $.parseXML($('#txtCache-' + notebookFileName).text()); var title = ""; var titleElement = $(xmlDoc).find('entry[id="' + entryId + '"] title')[0]; if (typeof titleElement != 'undefined') { if (titleElement.childNodes.length > 0) ...
[ "function getNotebookContent() {\n $('.collections').on('click', '.js-open-notebook', function () {\n const id = $(this).attr('id');\n const title = $(this).text();\n $('#editor').attr('data-book', id);\n $.ajax(`/notebooks/${id}`, {\n beforeSend...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Watches the "horoscope" form and sets the sunsign and day variables, before passing them to the API function
function watchFormTwo() { $('.js-horoscope').submit(event => { event.preventDefault(); sunsign = $('#js-sunsign').val().toLowerCase(); let day = $('#js-query').val(); getHoroscope(sunsign, day); }) }
[ "function getHoroscope () {\n $('#js-horoscope-error').empty();\n let apiCall = URL + signSelected + \"&day=today\";\n fetch(apiCall, {\n method: 'POST'\n})\n .then(response => {\n if (response.ok) {\n return response.json();\n }\n throw new Error(response.statusText);\n })\n .the...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dev / support route to run migration to ad insurane names ot invoices, EXTMOJ2235
function addInsuranceNamesToInvoices( args ) { Y.doccirrus.inCaseUtils.migrationhelper.addInsuranceNamesToInvoices( args.user, false, onMigrationComplete ); function onMigrationComplete( err ) { if( err ) { Y.log( `Problem in migration to set insurance names ...
[ "function adminOfferingMigrateSchema(offerings) {\n var numMigrated = 0;\n offerings.forEach(function(offering) {\n if (offering.description && offering.description.length > 0) {\n numMigrated = numMigrated + 1;\n var enTitle = {\n language: 'en',\n text: offering.descriptionEnglish\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to hide Expanded result when minimze button is clicked
function hideExpandedResult() { var hideExpandedResult = document.getElementById('result-expanded'); hideExpandedResult.classList.add('hidden'); var expandButton = document.getElementById('expand-button'); expandButton.classList.remove('hidden'); }
[ "function hideShowExpandToggle() {\n if (minWidth) {\n setExpandedWidth(\"60%\");\n } else {\n setExpandedWidth(\"80%\");\n }\n\n if (isExpanded) {\n setExpanded(false);\n } else {\n setExpanded(true);\n }\n }", "function sho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
turns a dotteddecimal address into a UInt32
function parseIPv4(addr) { if (typeof(addr) !== 'string') throw new TypeError('addr (string) is required'); var octets = addr.split(/\./).map(function (octet) { return (parseInt(octet, 10)); }); if (octets.length !== 4) throw new TypeError...
[ "function unpackUInt32(buffer, offset) {\n\t\treturn ((buffer.charCodeAt(offset + 3) & 0xff) << 24 |\n\t\t\t\t(buffer.charCodeAt(offset + 2) & 0xff) << 16 |\n\t\t\t\t(buffer.charCodeAt(offset + 1) & 0xff) << 8 |\n\t\t\t\t(buffer.charCodeAt(offset + 0) & 0xff));\n\t}", "function addressToNumber(addr) {\n if (!...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether the target element is absolute or not.
function isAbsolute() { return position === 'absolute'; }
[ "function isAbsolute() {\n\t\t\treturn position === 'absolute';\n\t\t}", "function isAbsolute() {\r\n return position === 'absolute';\r\n }", "isAbsolute() {\n return path_1.default.isAbsolute(this.internalPath);\n }", "isAbsolute() {\n return pathLib.isAbsolute( this.getPat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compile the templates for the other values used in the webview.
function compileVariableTemplates (templateVariables) { templateVariables.title = utilities.compileTemplate(templateVariables.title, templateVariables); templateVariables.instructions = utilities.compileTemplate(templateVariables.instructions, templateVariables); templateVariables.cancelButton = utilities.compileTe...
[ "function compileTemplates() {\n\t\twindow.templates = {};\n\t\twindow.templates.common = Handlebars.compile($(\"#control-customize-template\").html());\n\t\t\n\t\t/* HTML Templates required for specific implementations mentioned below */\n\t\t\n\t\t// Mostly we donot need so many templates\n\t\t\n\t\twindow.templa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a date that is the last day of the year of the provided date.
function getYearEnd(date) { return new Date(date.getFullYear() + 1, 0, 0, 0, 0, 0, 0); }
[ "function LAST_YEAR() {\n var date = new Date(); \n date.setDate(date.getDate() - 365);\n return dateTo_yyyy_mm_yy(date);\n}", "function lastYear() {\n const departureInput = getDepartureDate();\n const depart = new Date(departureInput);\n const subtractYear = depart.setDate(depart.getDate() - 3...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set/update size class for given window and expected geometry.
function set_win_size_class($win, win_geo) { for (var i = 0, I = WIN_SIZES.length; i < I; i++) { $win.removeClass(WIN_SIZE_CLASS_PREFIX + WIN_SIZES[i]); } $win.addClass(WIN_SIZE_CLASS_PREFIX + get_win_size(win_geo)) }
[ "_updateSize() {\n if ( this._windowSize.width != window.innerWidth ||\n this._windowSize.height != window.innerHeight ) {\n\n this._windowSize.width = window.innerWidth;\n this._windowSize.height = window.innerHeight;\n\n // update the object that deals with view interaction\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cause issues, values not correct Creates a rotation which rotates from fromDirection to toDirection.
setFromToRotation(fromDirection, toDirection) { this.setFromQuaternion( Quaternion.fromToRotation(fromDirection, toDirection) ); return this; }
[ "setRotations() {\n this.room2a_puzzle1.angle = 90;\n this.room2a_returnDoor.angle = 270;\n }", "set targetRotation(value) {}", "function rotate(interpolator, length, from, to) {\n\t return {\n\t length: length,\n\t updateProperties: function (t, prop) {\n\t var rad = interpo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether the player will encounter a vote wanderer on the next turn, providing an "I Voted!" sticker is equipped.
function isVoteWandererNow() { return (0, _kolmafia.totalTurnsPlayed)() % 11 == 1; }
[ "function isVoteWandererNow() {\n return kolmafia_1.totalTurnsPlayed() % 11 == 1;\n}", "function isVoteWandererNow() {\n return (0,kolmafia__WEBPACK_IMPORTED_MODULE_0__.totalTurnsPlayed)() % 11 == 1;\n}", "missionVoteChecker() {\n this.missions.addVotes(this.mission, this.round, this.votesRound);\n let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns bounds for all clusters
getBounds() { const bounds = this.options.bounds ? L.latLngBounds(this.options.bounds) : this._clusters.getBounds() if (bounds.isValid()) { return toLngLatBounds(bounds) } }
[ "getBounds() {\n return Bounds.fromVertices(this.points);\n }", "function bounds() {\n var minX = 1000000;\n var maxX = -1000000;\n var minY = 1000000;\n var maxY = -1000000;\n nodes.forEach(function(thisnode) {\n if ((thisnode.x-thisnode.r)<minX) {minX=(thisnode.x-thisnode.r); minXnode=thisnod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HTMLbased input behavior for text fields. To activate behavior, add class `podlovecheckinput`. trims whitespace from beginning and end Add these data attributes to add further behavior: `datapodloveinputtype="url"` : verifies against URL regex `datapodloveinputtype="avatar"`: verifies against URL or email regex `datapo...
function clean_up_input() { (function ($) { $(".podlove-check-input").on('change', function () { var textfield = $(this); var textfieldid = textfield.attr("id"); var $status = $(".podlove-input-status[data-podlove-input-status-for=" + textfieldid + "]"); textfield.removeClass("podlove-invalid-input"); ...
[ "function input_field(propname, proplabel, proptype, {\n maxlength = '', pattern = '', hint = '', required=false} = {}) {\n var templ = HtmlService.createTemplateFromFile('input_field')\n templ.properties = PropertiesService.getUserProperties()\n templ.propname = propname\n templ.proplabel =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transpose and cast the input before the conv3d.
function preprocessConv3DInput(x, dataFormat) { return tfjs_core_1.tidy(function () { common_2.checkDataFormat(dataFormat); if (dataFormat === 'channelsFirst') { return tfc.transpose(x, [0, 2, 3, 4, 1]); // NCDHW -> NDHWC. } else { return x; } }); ...
[ "function preprocessConv3DInput(x, dataFormat) {\n return tfc.tidy(function () {\n checkDataFormat(dataFormat);\n if (dataFormat === 'channelsFirst') {\n return tfc.transpose(x, [0, 2, 3, 4, 1]);\n } else {\n return x;\n }\n });\n}", "function preprocessConv3DInput(x, dataFormat) {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert rating from string to number
function convertToNumber(rating) { switch (rating) { case "nti": return 1; case "okay": return 2; case "good": return 3; case "excellent": return 4; } }
[ "function ratingTextToNum(text) {\n if (text == oneRating)\n return 1;\n else if (text == twoRating)\n return 2;\n else if (text == fourRating)\n return 4;\n else if (text == fiveRating)\n return 5;\n else\n return 3;\n}", "function convertRating(rating) {\n // console.log(rating)\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
selectGrid> Si se selecciona una fila del grid
function selectGrid() { window.location.href = "#accionTarea"; $("#txtestado").val(2); tag_estado(); //var seleccion = $(".k-state-selected").select(); var grid = $("#tareas").data("kendoGrid"); var seleccion = grid.select(); $('#txtid').val(this.dataItem(seleccion).tar_int_id); getSele...
[ "function selectFeatureFromGrid(event) {\n // close view popup if it is open\n view.popup.close();\n // get the ObjectID value from the clicked row\n const row = event.rows[0]\n const id = row.data.OBJECTID;\n\n // setup a query by specifying objectIds\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the actual elements (not just ids) of selected elements in handlers resize and mvoe
getSelectedActualElements(elementIdString, ids, resize) { const array = []; const templateElements = !this.state.translationModeOn ? this.props.templateElements : this.props.templateTranslationElements; _.each(ids, id => { if (resize) { if (!templateElements[id].document_field_choices) { ...
[ "getAllUIElements() {\n return [];\n }", "function selectElements(e) {\r\n $(document).unbind(\"mousemove\", openSelector);\r\n $(document).unbind(\"mouseup\", selectElements);\r\n var maxX = 0;\r\n var minX = 5000;\r\n var maxY = 0;\r\n var minY = 5000;\r\n var totalE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The constructor sets the initial value for field height and width.
constructor(height, width) { this.height = height; this.width = width; }
[ "constructor (w, h) {\n // if w and h are bigger than 0 --> define the instance attribute.\n if (w > 0 && h > 0) {\n this.width = w;\n this.height = h;\n }\n }", "constructor(width, height) { // Javascript version of initialize\n this.width = width\n this.height = height\n }", "cons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is carried out when the 'Collect Branches' button is clicked
function collectBranches() { branchBank += randInt(1,3); if (randInt(1,10) == 1) { fungusBank += 5; } action(1,1,1); advanceTime(); updateDisp(); }
[ "function collectBerries()\n\t\t\t{\n\t\t\t\tberryTurns -= 1;\n\t\t\t\tberryBank += 3;\n\t\t\t\tdocument.querySelector(\".eatBerries\").disabled = false;\n\t\t\t\taction(1,1,1);\n\t\t\t\tadvanceTime();\n\t\t\t\tupdateDisp();\n\t\t\t}", "function refreshBranches() {\n deploymentsService.getRepositoryBra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function that returns the middleware for a given method and service `getArgs` is a function that should return additional leading service arguments
function getHandler(method, getArgs, service) { return function (req, res, next) { res.setHeader('Allow', allowedMethods(service).join(',')); // Check if the method exists on the service at all. Send 405 (Method not allowed) if not if (typeof service[method] !== 'function') { debug('Method \'' + me...
[ "function getHandler(method, getArgs, service) {\n return function (req, res, next) {\n res.setHeader('Allow', allowedMethods(service).join(','));\n\n // Check if the method exists on the service at all. Send 405 (Method not allowed) if not\n if (typeof service[method] !== 'function') {\n debug('Meth...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draws a title and an optional subtitle on the screen as a message to the user.
function drawText(title, subtitle) { ctx.fillStyle = TEXT_COLOR; ctx.textAlign = "center"; ctx.font = "bold 40px Courier"; ctx.fillText(title,(gridWidth * unitScale) / 2, 100); ctx.font = "bold 30px Courier"; ctx.fillText(subtitle,(gridWidth * unitScale) / 2,130); }
[ "function draw_title() {\n // Draw the red area\n display.fill(0, 0, display.getWidth(), 1, \"white\", \"red\", ' ');\n\n // Draw the title and author\n display.text(1, 0, \"Etch A Sketch\");\n display.text(display.getWidth() - 14, 0, \"by Ricky Rung\");\n}", "function infoText() {\n let style = n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function initializes al lthe values in the marker ( with a length of MAX^2 ) to false.
function initMarker(){ marked = new Array(MAX*MAX); for (var i = 0; i < marked.length; i++){ marked[i] = false; } }
[ "function marker() {\n mark = 1;\n\t\tunmark = 0;\n }", "function addFalseValues() {\n for (let i = 0; i < 8; i++) {\n for (let j = 0; j < 8; j++) {\n steps[i][j] = false;\n }\n }\n}", "function initNeedle () {\r\n needle[0] = 100; needle[1] = 0;\r\n }", "constructor(initi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add document to smart contract for identify it with wallet
async addDocument(hash_id, isSign) { const overrides = { gasLimit: ethers.BigNumber.from("2000000"), gasPrice: ethers.BigNumber.from("10000000000000"), }; const callPromise = await this.contract.addDocument(`0x${hash_id}`, overrides); const receipt = await this.provider.getTransactionReceip...
[ "_addDocumentRecord(documentId, type, name, path) {\n this._sessions.manifest.transaction(tx => {\n let documents = tx.find('documents');\n let docEntry = tx.createElement('document', { id: documentId }).attr({\n name: name,\n path: path,\n type: type\n });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the user clicks on the [Greet Parent from Child] button in the ChildComponent, this function will be executed (child component calling parent component's method and passing parameters)
greetParentFromChild(childName) { alert(`Hello ${this.state.parentName}, from ${childName}.`); }
[ "function ChildComponent(props) {\n return (\n <div>\n {/* If we want to pass the parameter to the parent we should use the arrow function */}\n <button onClick={()=>props.greetHandler('child')}>Greet Parent</button>\n </div>\n )\n}", "function ChildComponent(props) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Metodo de acceso de lectura por el atributo fecha
probarFechaNacimiento(){ //lectura del atributo fecha console.log(this.fecha.getFecha()) //escritura del atributo console.log(this.fecha.setFecha(new Date(2000, 4, 6))) console.log(this.fecha.getFormatoLargo()) console.log(this.fecha.setFecha(new Date(2000, 4, 6))) ...
[ "testFecha(){\n console.log(this.fecha);\n console.log(this.fecha.fecha);\n console.log(this.fecha.setFecha(new Date(2007,4,20)));\n console.log(this.fecha.getFormatoCorto());\n console.log(this.fecha.getFormatoExtendido());\n console.log(this.fecha.setFecha(new Date(2027,4...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the 'skills' of a Member JSON
function listSkills(member) { var skills=""; for (var i = 0; i < member["skills"].length; i++) { skills += member["skills"][i]; skills += "<br />"; } return skills; }
[ "function getSkills() {\n skillService.getAll( function(response) {\n vic.skills = response;\n }, function(){});\n }", "get skills() {\n return this._skills;\n }", "function getSkills() {\n skillService.getAll( function(response) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createMenu function accept 2 parameter: list of specific data (list of dates or list of names) and element ID. Using with two parameter generate dropdown options for index.html
function createMenu(dataList, elementID) { let dropDownMenu = document.getElementById(elementID); for (let i=0; i < dataList.length; i++) { let optn = dataList[i]; let newEl = document.createElement('option'); newEl.textContent = optn; dropDownMenu.appendChild(newEl); } }
[ "function createMenu(menuItem, num) {\r\n\tvar name = 0, className = 1, ref = 2;\r\n\t\r\n\tif (menuItem[className] == \"none\") {\r\n\t\tvar list = document.createElement(\"li\");\r\n\t\tlist.id = \"list\" + num;\r\n\t\tvar anchor = document.createElement(\"a\");\r\n\t\tanchor.href = menuItem[ref];\r\n\t\tanchor.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Give all the CHOICES to experiment incrementally/sequentially. Validate choice against CONSTRAINS. Updates de next position to search. [valid, currX, currY, newX, newY, orientation, partialScore] = getNextValidPosition(newX, newY, state, stateHorizontal,stateVertical, currWord, lastOrientation);
getNextValidPosition(inX, inY, state, stateHoriz, stateVert, currWord, lastOrientation){ let valid = false; let currX = -1; let currY = -1; let newX = -1; let newY = -1; let partialScore = 0; let x = -1; let y = -1; let res = null; let fla...
[ "function prepare_board_for_next()\n\t\t{\t\n\t\t\tcurrent_character_number+=1;\n\t\t\tvar correct_position;\n\t\t\tif(current_character_number<=perfect_word.length)\n\t\t\t{\n\t\t \t\tvar sub_word=perfect_word.slice(0,current_character_number);\n\t\t \t\tvar option_list=get_option_list_for(sub_word);\n\t\t \t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a function to update the javascript link
function updateLinkHref() { var codeHeader = "(function() {"; var codeFooter = "})(); void 0;"; var codeBody = editor.getSession().getValue(); // minify var full_code = codeHeader + codeBody + codeFooter; full_code = full_code.replace(/\n/g, '').replace(/ /g, ''); link.href = 'javascript: ' + full_code; v...
[ "function update(){\r\n //needs to update server with link/navigation information\r\n //ajax\r\n}", "function updateLink() {\n\tif(document.getElementById(\"link_span\").childElementCount > 0) {\n\t\tvar url = parseURL(document.getElementById(\"link_span\").firstChild.href);\n\t\turl.params[\"lat\"] = unsafeWindo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete Alt Image By Id
function deleteAltImgById(e, id) { $(e.currentTarget).parent('.pip').remove(); $.ajax({ method: 'POST', url: window.delete_alt_img_by_id, data: { _token: $('meta[name="csrf-token"]').attr('content'), id: id, }, success: function (result) { ...
[ "function removeImage(id){\n return db('images')\n .where({ id })\n .del();\n}", "function deleteImage(imageId) {\n $(imageId).attr('src', 'CSS/itemimage/deleted.jpg');\n}", "function remove(id) {\n return db(\"image\").where({ id }).del();\n}", "function deleteImage(id) {\n $.ajax({\n me...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to pick a random food location on grid
function pickLocForFood() { var cols = floor(windowWidth/s.sWidth); var rows = floor(windowHeight/s.sHeight); foodPosition =createVector(floor (random(cols)), floor(random(rows))); foodPosition.x = constrain (foodPosition.x * s.sWidth, 20, windowWidth-s.sWidth-60); foodPosition.y = constrain (foodPosition.y * s.sH...
[ "function pickLocation() {\n food = createVector(floor(random(cols)), floor(random(rows)));\n food.mult(scl);\n}", "function place_food(){\r\n\tdo{\r\n\t\tvar random_x = Math.floor(Math.random()*(config.grid_size-2))+1;\r\n\t\tvar random_y = Math.floor(Math.random()*(config.grid_size-2))+1;\r\n\t}while(squares[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a function to a set of listeners that are invoked whenever `setConfig` is called. The subscribed function will be passed the options object that was used in the `setConfig` call. Topics can be subscribed to to only get updates when specific properties are updated by passing a topic string as the first parameter. R...
function subscribe(topic, listener) { var callback = listener; if (typeof topic !== 'string') { // first param should be callback function in this case, // meaning it gets called for any config change callback = topic; topic = ALL_TOPICS; } if (typeof callback !== 'function') {...
[ "function subscribe(topic, listener, options = {}) {\n let callback = listener;\n\n if (typeof topic !== 'string') {\n // first param should be callback function in this case,\n // meaning it gets called for any config change\n callback = topic;\n topic = ALL_TOPICS;\n options = liste...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the asteroid is out of bounds and below the world kill it
asteroidBelow() { if (this.body.center.y > 0) { this.kill() } }
[ "dead() {\n let x = this.x;\n let y = this.y;\n new Explosion(this.scene, x, y);\n this.lives -= 1;\n\n //prevents new collision\n this.canBeKilled = false;\n this.x = -700;\n this.y = -700;\n\n }", "function killPlayer1(player, hazard) {\n\t\t\tif (invin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Analog of crypto_scalarmult in crypto_scalarmult/curve25519/ref/smult.c
function crypto_scalarmult(q, n, p, arrFactory) { "use strict"; if (!arrFactory) { arrFactory = new ArraysFactory(); } var work = arrFactory.getUint32Array(96) , e = arrFactory.getUint32Array(32); e.set(n); e[0] &= 248; e[31] &= 127; e[31] |= 64; // partial views of work array var work_32 = work.subarray...
[ "function crypto_scalarmult(n, p) {\n\t\tconst indexes = copyToWasmMemory({\n\t\t\tq: {paddingBefore: 32},\n\t\t\tn: {array: n},\n\t\t\tp: {array: p},\n\t\t\talloc: {paddingBefore: 928}\n\t\t});\n\t\twasmInstance.exports.crypto_scalarmult(\n\t\t\tindexes.q,\n\t\t\tindexes.n,\n\t\t\tindexes.p,\n\t\t\tindexes.alloc\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO(atscott): Create special `ts.QuickInfo` for `ngtemplate` and `ngcontainer` as well.
function createNgTemplateQuickInfo(node) { return quick_info_1.createQuickInfo('ng-template', QuickInfoKind.TEMPLATE, utils_1.getTextSpanOfNode(node), /** containerName */ undefined, /** type */ undefined, [{ kind: quick_info_1.SYMBOL_TEXT, text: 'The `<ng-templ...
[ "function createNgTemplateQuickInfo(node) {\n return createQuickInfo('ng-template', QuickInfoKind.TEMPLATE, getTextSpanOfNode(node), \n /** containerName */ undefined, \n /** type */ undefined, [{\n kind: SYMBOL_TEXT,\n text: 'The `<ng-template>` is an Angular elem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resize the image to the new width and height
resize(newWidth, newHeight) { this.image.resize(newWidth, newHeight); }
[ "function changeImgSize(img, w, h) {\n img.height = h;\n img.width = w;\n}", "resize(width, height) {\n this.updateImageFormat(width, height);\n }", "function resizeImage() {\n\n\n\n }", "_resize() {\n const scale = this.model.get('scale');\n const origW = this._$origImage.data('i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Eng number to JP number
function engToJp(x) { var intermediateValue = x; var japaneseValue = ""; for (i = 0; i < units.length; i++) { // console.log(units[i]); if ((intermediateValue / units[i][0]) >= 1) { japaneseValue += Math.floor(intermediateValue / units[i][0]) + units[i][1]; // console.log(japaneseValue)...
[ "function JpToEng(x) {\r\n var intermediateValue = x;\r\n var japaneseValuePlaceholder = \"\";\r\n var westernValue = 0;\r\n for (i = 0; i < intermediateValue.length; i++) {\r\n var unit = findUnit(intermediateValue.charAt(i));\r\n if (unit !== null) {\r\n westernValue += parseInt(japaneseValuePlaceh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the spatial boxes are a pure translation.
function areSpatialBoxesTranslated(_box1, _box2) { return !areSpatialVectorsDifferent(Vector.diff(_box1[1], _box1[0]), Vector.diff(_box2[1], _box2[0])) && !areSpatialVectorsDifferent(Vector.diff(_box2[0], _box1[0]), Vector.diff(_box2[1], _box1[1])); }
[ "get isTranslation () { return this.vector.x !== 0 || this.vector.y !== 0 }", "isTranslation() {\n return this.type === Matrix3Type.TRANSLATION_2D || this.m00() === 1 && this.m11() === 1 && this.m22() === 1 && this.m01() === 0 && this.m10() === 0 && this.m20() === 0 && this.m21() === 0;\n }", "isTranslation...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the tooltip content from the relavent items associated with the tab holding the icon being hovered over.
function generateTabIconTooltipHTML(pageIndex, typeImage) { var tooltipHTML = ""; var $sourcePage = $(".page").eq(pageIndex); var tooltipMaxIconCount = 1; $.each($sourcePage.children(".pageRowScrollContainer").children(".pageRow"), function () { var $images = $(this).childre...
[ "displayToolTip(item) {\n console.log(\"Hovering Over Item: \", item.name);\n }", "toolTipTitle(tooltipItems, data){\t\t\n\t\treturn \"\";\n\t}", "function addOverviewTooltipBehaviour() {\n $('.overview-list li a[title]').tooltip({\n position: 'center right',\n predelay: 500,\n effect: 'fade...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if at least one valid move on the board exists
function hasMoves() { for (var x = 0; x < cols; ++x) { for (var y = 0; y < cols; ++y) { if (canJewelMove(x, y)) { return true; } } } return false; }
[ "atLeastOneMove() {\n const color = this.turn;\n for (let i = 0; i < V.size.x; i++) {\n for (let j = 0; j < V.size.y; j++) {\n if (this.board[i][j] != V.EMPTY && this.getColor(i, j) == color) {\n const moves = this.getPotentialMovesFrom([i, j]);\n if (moves.length > 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show a hand signal from the strategy.
showHandSignal() { // ˅ return this.strategy.showHandSignal(); // ˄ }
[ "showHand() {\n process.stdout.write(`\\n${this.name}: `);\n this.hand.forEach(card => process.stdout.write(`${card.displayName} `));\n process.stdout.write('\\n\\n');\n }", "displayHumanHand(hand) {\r\n let promptString = \"\";\r\n if (this.errorString) {\r\n promptString += this.errorString...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that takes in an observation and displays the third row of calculation: label for P(O=observation,S=state) textboxes to input answers check button to trigger the controller's checkOnS function allows user to move to the next row of calculation
function displayOnSInputRow(observation){ for (var i = 3; i<=91; i++){ $("#MathJax-Span-"+i).css("color","black"); } for (var i = 22; i<=33; i++){ $("#MathJax-Span-"+i).css("color","red"); } for (...
[ "function displayOgSInputRow(observation){\n $('.dispOgS').remove(); //remove button\n for (var i = 3; i <= 91; i++){\n $(\"#MathJax-Span-\"+i).css(\"color\",\"black\");\n }\n for (var i = 48; i <= 61; i++){\n $(\"#MathJax-Span-\"+i).css(\"co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save the competition membership tab details
function saveCompetitionFeesMembershipTabAction(payload, competitionId, affiliateOrgId) { return { type: ApiConstants.API_SAVE_COMPETITION_FEES_MEMBERSHIP_TAB_LOAD, payload, competitionId, affiliateOrgId, }; }
[ "async saveCompetitionFeesMembershipTab(payload, competitionId) {\n let orgItem = await getOrganisationData();\n let organisationUniqueKey = orgItem ? orgItem.organisationUniqueKey : 1;\n var url = `api/competitionfee/membership?competitionUniqueKey=${competitionId}&organisationUniqueKey=${organisationUniq...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send the error message when the voice cannot load
sendVoiceErrorMessage(toast) { toast.open({ duration: 5000, message: `Olivia's voice cannot load, her voice is now the default english one.`, position: 'is-top', type: 'is-danger' }) }
[ "function onSoundLoadError() { }", "audioOnError() {\n clearTimeout(this.loadTimeoutFn);\n this.triggerEvent('error');\n this.next({'type': 'ended'});\n }", "onAudioLoadError(e) {\n console.error('audio load err', e)\n }", "onAudioLoadError(e) {\n console.error(\"audio load err\", e);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches a new files path
fetchPath( newpath: string ) { fetch( '/files', { method: 'post', headers: { 'Content-type': 'application/json' }, body: JSON.stringify({ path: this.getCWD() ? path.resolve( this.getCWD(), newpath ) : './' }) }) ...
[ "function getFile() \n {\n // file path to append to file system root\n var filePath = document.getElementById('filePath').value,\n // get file entry\n callback = function(entry) {\n entry.getFile(\n // file pat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_funcPath :: (Boolean, Array String, a) > Nullable Function
function _funcPath(allowInheritedProps, path, _x) { var x = _x; for (var idx = 0; idx < path.length; idx += 1) { var k = path[idx]; if (x == null || !(allowInheritedProps || has(k, x))) return null; x = x[k]; } return typeof x === 'function' ? x : null; }
[ "function _funcPath(allowInheritedProps, path, _x) {\n var x = _x;\n for (var idx = 0; idx < path.length; idx += 1) {\n var k = path[idx];\n if (x == null || !(allowInheritedProps || has (k, x))) return null;\n x = x[k];\n }\n return typeof x === 'function' ? x : null;\n }", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the student data for profile and indicator
function setIndividualStudent(student) { var data = filterDataByStudent(jsonData, student); $scope.individualStudent = ((data[0] !== null) && (data[0] !== undefined)) ? data[0] : null; }
[ "function populateStudentInfo({ name, grade, advisor, major, graduationYear, imageUrl }) {\n updateStudentName(name)\n updateStudentGradeLevel(grade)\n updateStudentAdvisor(advisor)\n updateMajor(major)\n updateStudentGraduationYear(graduationYear)\n updateStudentImage(imageUrl)\n}", "'SET_STUDE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ExecutedTrade execute a trade between two owners in the world state.
async ExecutedTrade(ctx, idSell, idBuy, price) { var value; // get sell and buy trades from id const tradeSellString = await this.ReadTrade(ctx, idSell); const tradeBuyString = await this.ReadTrade(ctx, idBuy); const tradeSell = JSON.parse(tradeSellString); const tradeB...
[ "async CreateExecutionTrade(ctx, id, ownerSell, ownerBuy, tradeType, value, price, creationDate) {\n const executionTrade = {\n ID: id,\n OwnerSell: ownerSell,\n OwnerBuy: ownerBuy,\n TradeType: tradeType,\n Value: value,\n Price: price,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the index in the model of the empty spot
function getEmptySpot() { for(var i=0; i < items.model.count; i++) { if(items.model.get(i).value === 0) return i } }
[ "getIndexCount() {\n return 0;\n }", "findEmptyTrackIdx() {\n return this.tracks.length + 1\n }", "get index() {\n return this._cell\n ? ArrayExt.findFirstIndex(this._notebook.content.widgets, c => c === this._cell)\n : this._index;\n }", "get activeCell...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function cloneSVG cloneSVG tree
function cloneSVG(){ //Source var el = document.getElementById("origsvg").firstChild; //Clone Variable var cel = null; //Append Clone var pdest = document.getElementById("dest_clone"); //Delete All nested elements while (pdest.firstChild) { pdest.removeChild(pdes...
[ "function cloneSVG(){ // 6812\n return this.element.cloneNode(true); // 6813\n }", "function cloneSVG(){\r\n return this.element.clo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fills the config.xml template with the list of plugins, the app name and the app id and then copies the result to the project folder.
function fillConfigXml(pluginTags) { return gulp.src(config.configXml.source) .pipe(plugins.replaceTask( { patterns: [ { match: /<plugins-placeholder\/>/g, replacement: pluginTags.join('\n') }, { match: 'appName', ...
[ "function setupPlugins() {\n\n mylog(\"Setting up plugins\");\n var plugin_dirs = API.ls(\"application\", \"plugins\", \"*\");\n \n for (var j = 0; j < plugin_dirs.length; j++) {\n var plugin_dir = plugin_dirs[j];\n var plugin_name = plugin_dir;\n var regexp = new RegExp(\"plugin_\" + plugin_name + \"_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Morph one tree into another tree no parent > same: diff and walk children > not same: replace and return old node doesn't exist > insert new node new node doesn't exist > delete old node nodes are not the same > diff nodes and apply patch to old node nodes are the same > walk all child nodes and append to old node
function nanomorph (oldTree, newTree) { // if (DEBUG) { // console.log( // 'nanomorph\nold\n %s\nnew\n %s', // oldTree && oldTree.outerHTML, // newTree && newTree.outerHTML // ) // } assert.equal(typeof oldTree, 'object', 'nanomorph: oldTree should be an object') assert.equal(typeof newTree,...
[ "function nanomorph (oldTree, newTree, options) {\n // if (DEBUG) {\n // console.log(\n // 'nanomorph\\nold\\n %s\\nnew\\n %s',\n // oldTree && oldTree.outerHTML,\n // newTree && newTree.outerHTML\n // )\n // }\n assert.equal(typeof oldTree, 'object', 'nanomorph: oldTree should be an object')\n a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apply a new sync
applySync(sync, required) { this.needFirstSync = false; this.gameEngine.trace.debug(() => 'framySync applying sync'); let world = this.gameEngine.world; for (let ids of Object.keys(sync.syncObjects)) { let ev = sync.syncObjects[ids][0]; let curObj = ...
[ "applySync(sync, required) {\n\n this.needFirstSync = false;\n this.gameEngine.trace.debug(() => 'framySync applying sync');\n let world = this.gameEngine.world;\n\n for (let ids of Object.keys(sync.syncObjects)) {\n let ev = sync.syncObjects[ids][0];\n let curObj =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `CustomRequestHandlingProperty`
function CfnRuleGroup_CustomRequestHandlingPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, bu...
[ "function CfnWebACL_CustomRequestHandlingPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an ob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
install given list of npm packages to the global location.
function npmInstall(packages, opts) { if (packages.length == 0 || !packages || !packages.length) { Promise.reject("No packages found"); } if (typeof packages == "string") packages = [packages]; if (!opts) opts = {}; var cmdString = "npm install " + packages.join(" ") + " " + (opts.global ? " -g"...
[ "function installPackages(packages) {\n spawn.sync('npm', [\n 'install',\n '-D',\n ...packages\n ], { stdio: 'inherit' });\n}", "function installPackages(arr) {\n\n spawn('npm', ['i', '--save'].concat(_toConsumableArray(arr)));\n\n return arr;\n}", "async install(packageNames){\n\t\t//Build cache\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders all stats connected to P elements
function renderPStats() { var statsNames = ['Name: ', 'Race: ', 'Hit Points: ', 'AC: ', 'Gold: ']; var statsValues = [player.name, player.race, player.hitPoints, player.armor, player.equipment]; for (var i = 0; i < statsNames.length; i++) { var newP = document.createElement('p'); newP.textContent = stats...
[ "function renderPStats() {\n\n var statsNames = ['Name: ', 'Race: ', 'Hit Points: ', 'AC: ', 'Gold: '];\n var statsValues = [player.name, player.race, player.hitPoints, player.armor, player.equipment[0]];\n for (var i = 0; i < statsNames.length; i++) {\n var newP = document.createElement('p');\n newP.textC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy and Save the latest allurereport into a new destination Folder: Report:
function copy_report(tc_name){ fs.copy('./output', './Report/' + tc_name + '_' + timestamp) .then(() => console.log('.')) .catch(err => console.error(err)) }
[ "function saveReport(){\n var newReport = {\n build: model.config.Version,\n reportData:model.jsonReport,\n overallFR: 1.40,\n stableFR: 1.98,\n unstableFR: model.unstableFailureRate,\n config: model.config,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the "if not exists" modifier. If the table already exists, no error is thrown if this method has been called.
ifNotExists() { return new CreateTableBuilder({ ...this.#props, node: create_table_node_js_1.CreateTableNode.cloneWith(this.#props.node, { ifNotExists: true, }), }); }
[ "tableExists (table) {\n return !!this.tables[table]\n }", "function createUserBetTableIfNotExists(){\n\tdb.query('CREATE TABLE IF NOT EXISTS UserTipps (Spieltag INT,User VARCHAR(255),Heim VARCHAR(255),Gast VARCHAR(255),ToreHeim INT,ToreGast INT)');\n}", "async function waitForTableNotExists() {\n dy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions for setupTiles and teardownTiles tests begin here
function setupTiles() { TileRewireAPI.__Rewire__('tileInfo', { NAME_1: { id: 1, a: '1', b: '2' }, NAME_2: { id: '2', c: '3', d: '4' }, }); TileRewireAPI.__Rewire__('tileNames', { 1: 'NAME_1', 2: 'NAME_2' }); }
[ "setupTilePiles() {\n const tilePiles = this.chooseSetofTiles() // Choose a, b, c tiles randomly\n this.set('tilePiles', tilePiles)\n }", "setupStartingTiles() {\n // var startingTiles = this.addRandomTile();\n var startingTile1 = this.addRandomTile();\n var startingTile2 = t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Note that the absolute difference of two integers is the distance between them on the real number line. For example, the absolute difference of 5 and 5 is 10, and the absolute difference of 5 and 4 is 1. You can assume that there will only be one pair of numbers with the smallest difference. Sample Input: arrayOne = [1...
function smallestDifference(arrayOne, arrayTwo) { let difference = Math.abs(arrayOne[0] - arrayTwo[0]); let arrayOneInteger = arrayOne[0]; let arrayTwoInteger = arrayTwo[0]; // Iterate through first array for (let i = 0; i < arrayOne.length; i++) { // Compare to each number in 2nd array for (let j = 0...
[ "function smallestDifference(arrayOne, arrayTwo) {\n \n\t// sort arrays in place increasing order\n\tarrayOne.sort((a,b) => a - b);\n\tarrayTwo.sort((a,b) => a - b);\n\t\n\tlet pair = [];\n\t\n\t// use two pointers starting at begin of both arrays\n\tlet l = 0;\n\tlet r = 0;\n\t\n\t// create var to track smallestD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provides an identifier for this secret for use in IAM policies. If there is a full ARN, this is just the ARN; if we have a partial ARN due to either importing by secret name or partial ARN then we need to add a suffix to capture the full ARN's format.
get arnForPolicies() { return this.secretFullArn ? this.secretFullArn : `${this.secretArn}-??????`; }
[ "get partialArn() {\n return core_1.Stack.of(this).formatArn({\n service: 'secretsmanager',\n resource: 'secret',\n resourceName: secretName,\n arnFormat: core_1.ArnFormat.COLON_RESOURCE_NAME,\n });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to get an X coordinate, input is the day
function getXCoordinates(xDay) { let startingDistanceX = 50; xDay = x + (xDay * (y / data.length)); return xDay + startingDistanceX; }
[ "function getX(timeValue, day) {\n var hour = Math.floor(timeValue / 100);\n var min = timeValue % 100;\n return ((hour + 72 - times[0]) % 24) * hourSpace + day * 24 * hourSpace + min * minSpace;\n}", "function date2XPos(date) {\n var date = new Date(date);\n return this.now_offset + this.hour_widt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turn each step into a callable tape test Returns an array of scenario tests
function build() { var missing = validate() if (missing.length > 0) { throw new Error("Missing steps: " + JSON.stringify(missing)) } return testQueue.map(function (scenario) { var tapeSteps = scenario.steps.map(function (step) { var stepData = st...
[ "function scenarios() {\n return testQueue.map(function (test) {\n return test.name\n })\n }", "function runScenarios() {\n for(var i=0; i<scenarios.length; i++) {\n resetEnvironment();\n var ok = true;\n var errorMessage = \"\";\n\n scenarios[i](function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Web scenarios management calls
function addWebScenario(scenarioTitle) { var url = "addScenario/" + scenarioTitle; $.ajax({ type : "POST", url : url, dataType : "json", contentType : 'application/json', success : function(data) { addScenarioToList(data.id, data.name); } }); return false; }
[ "function doGet() {\n // Resources.createRecordOnlyTestCase();\n Resources.sampleExecution();\n}", "workitemslistPlan (baseUrl,username,spacename){\n browser.get(baseUrl + username + \"/\" + spacename +\"/plan\");\n }", "function get_user_scenarios(){\r\n\t\treturn ajaxrequest({ // get scenario list\r\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle signature verification and decryption for contents which are expected to be signed and encrypted. This works for single and multiplayer reads. In the case of multiplayer reads, it uses the gaia address for verification of the claimed public key.
function handleSignedEncryptedContents(caller, path, storedContents, app, username, zoneFileLookupURL) { var appPrivateKey = caller.loadUserData().appPrivateKey; var appPublicKey = (0, _keys.getPublicKeyFromPrivate)(appPrivateKey); var addressPromise = void 0; if (username) { addressPromise = getGaiaAddres...
[ "function handleSignedEncryptedContents(caller, path, storedContents, app, privateKey, username, zoneFileLookupURL) {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n const appPrivateKey = privateKey || caller.loadUserData().appPrivateKey;\n const appPublicKey = keys_1.getPublicKey...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the body or query string to be used in the mock name. In any case we will prepend the value with a double dash so that the mock files will look like: POSTMyBody=123.mock or GETquery=string&hello=hella.mock
function getBodyOrQueryString(body, query) { if (query) { return '--' + query; } if (body && body !== '') { return '--' + body; } return body; }
[ "function defaultMockFilename(config, req) {\n var reqData = prismUtils.filterUrl(config, req.url);\n // include request body in hash\n if (config.hashFullRequest(config, req)) {\n reqData = req.body + reqData;\n }\n\n var shasum = crypto.createHash('sha1');\n shasum.update(reqData);\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new MediaTypeUpdate.
constructor() { MediaTypeUpdate.initialize(this); }
[ "function MediaType (type, subtype, suffix) {\n this.type = type\n this.subtype = subtype\n this.suffix = suffix\n}", "function MediaType (type, subtype, suffix) {\r\n this.type = type\r\n this.subtype = subtype\r\n this.suffix = suffix\r\n}", "static update(id, mediaFileType){\n\t\tlet kparams = {};\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maptimize.Proxy.GoogleMapsetIcon(icon) > undefined icon (GIcon): marker icon Sets icon for marker displayed on the map. Must be called before displaying any marker on the map.
function setIcon(icon) { this.icon = icon; }
[ "setIcon(icon) {\r\n\t\tthis.iconURL = icon;\r\n\t}", "function changeIconMarker(myMarker) {\n myMarker.setIcon(\"http://maps.google.com/mapfiles/ms/icons/red-dot.png\");\n}", "function _setIcon(marker, useSpiderfied) {\n var manager = marker.manager;\n if (useSpiderfied) {\n if (_atMaxSize)\n mana...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Different radius based on trees amount
function getRadius(feature) { if (feature.properties.name) { const treesAmount = feature.properties.name .substring(0, 8) .replace(/\D/g, ""); return treesAmount > 1000 ? 32 : treesAmount > 500 ? 26 : treesAmount > 200 ? 22 : treesAmount > 100 ? 18 :...
[ "function getRadius(depth) {\n return depth * 0.5;\n \n}", "function depth_to_radius(depth) {\n return 35.0 / (depth + 1);\n}", "function radius (node) {\n return 25 + 2 * node.seed;\n}", "function Radius(d) {\n return d._children ? Config[0].parent.size + 25// collapsed package\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Verify the fetch request was sent, if not , do not display the response
function verifyFetch(response) { errorMsg.innerText = ""; if (!response.ok) { // If there is an error display this error message errorMsg.innerText = "Whoops " + searchbox.value + " is not a valid city"; throw Error(response.statusText + " -- " + response.url); } else { retur...
[ "function nextFetchIsValid() {\r\n if(localStorage.getItem('next_fetch') === \"\") {\r\n const html = `<h2>Ya no hay mas personajes</h2>`;\r\n renderHTML(html, $app);\r\n intersectionObserver.disconnect(); \r\n return false;\r\n }\r\n return true;\r\n}", "function checkState(request) { return (requ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays an agent in a paragraph.
display_agent(agent){ this.single_agent.selectAll("p") .data(build_string(agent).split("\n")) .transition() .duration(100) .text((d)=>{return (d);}); }
[ "function displayHoroscope(msg){\n document.getElementsByTagName('p')[0].innerHTML = msg\n }", "function displayPoem() {\n rectMode(CORNER);\n fill(191,191,191);\n textSize(22);\n textFont(font);\n textAlign(LEFT);\n \n if (titleauthorscractive) {\n text(\" \" + join(poem, \" \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: MV_SetCallBack Set the function to call when a voice stops.
function MV_SetCallBack($function) { MV_CallBackFunc = $function; }
[ "onStop(callback) {\n\t\tthis.onStopCallback = callback;\n\t}", "setQuestionnaireStoppedCallback(questionnaireStoppedCallback) {\n this.questionnaireStoppedCallback = questionnaireStoppedCallback;\n }", "function callbackclose() {\n console.log(\"mic closed\");\n}", "function endCall(){\n sour...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the two kinds of primitives 1. the real one 2. the wrapped one
function primitives(value) { return value instanceof Primitive ? Primitive(value) : value; }
[ "function Real() {}", "function primitives (value) {\n return value instanceof Primitive ? Primitive(value) : value\n }", "function isPrimitive(v) {\n if (v === undefined) return false;\n if (v === null) return true;\n if (v.constructor == String) return true;\n if (v.constructor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply page break before this widget
pageBreakBefore() { this.props({ pageBreak: 'before' }) return this }
[ "insertPageBreak() {\n if (!this.owner.isReadOnlyMode) {\n if (this.viewer.selection.start.paragraph.isInsideTable ||\n this.viewer.selection.start.paragraph.isInHeaderFooter) {\n return;\n }\n this.initComplexHistory('PageBreak');\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Multiplies an RGB (0255) color by a factor.
function adjustColor(color, factor) { return color.map(c => Math.max(0, Math.min(255, Math.round(c * factor)))); }
[ "function brighten(color, factor)\r\n{\r\n var result = '#';\r\n var chans = /^#?(\\w{2})(\\w{2})(\\w{2})$/.exec(color);\r\n for (var i = 1; i <= 3; i++)\r\n {\r\n var c = parseInt(chans[i], 16);\r\n c = Math.round((1 - factor) * c + factor * 255);\r\n c = c.toString(16);\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Each cell in the two dimensional array can be one of 'O', 'X', or null. Return 'O' if O makes a winning row. Return 'X' if X makes a winning row. Return null if there is no winning row on the board. Examples: > ticTacToe([ ['O', 'O', 'O'], ['X', null, 'X'], [null, 'X', null] ]) 'O' > ticTacToe([ ['O', 'X', 'O'], ['O', ...
function ticTacToe(someArray) { let winningScores = [3,12,21,9,15]; let winner = "null"; let xScore = 0; let oScore = 0; let scoreArray = []; // create one array out of all 3 for (eachArray of someArray) { for (item of eachArray) { scoreArray.push(item); } } // check each item in the...
[ "function ticTacToe(array){\n let winner;\n if(array[0][0] === 'O' &&\n array[0][1] === 'O' &&\n array[0][2] === 'O'){\n winner = 'O';\n }\n else if(array[1][0] === 'O' &&\n array[1][1] === 'O' &&\n array[1][2] === 'O'){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add your addodd code here:
function addodd(x) { if (x === 0){ return 0; } else if (x === 1) { return 1; } else if (x%2 === 1){ return x + addodd(x-2); } else if (x%2 === 0){ return x-1 + addodd(x-2); } }
[ "addOddTill(m,n) {\n for (let index = m; index < n; index++) {\n if (index & 1) { // index % 2 === 1\n this.items.push(index);\n }\n }\n }", "function addOddClassToLi(el) {\n\tvar ul = (typeof(el) == 'object') ? el : $('#' + el);\n\n\tif(sonyPicturesPortal.isI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Requests a list of the current modes of the user.
getModes () { this.client.getLocalUserModes(this) }
[ "modes() {\n\t\tlet _self = this;\n\n\t\tthis.api.call(\n\t\t\t'list_game_modes',\n\t\t\tfunction (data) {\n\t\t\t\tdata.forEach(function (mode, idx) {\n\t\t\t\t\t_self.app.sendMessage((idx + 1) + '. ' + mode.name);\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}", "function getAllModes() {\n return allModes\n}", "get mode...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Append an OR conjunctive between WHERE causes.
or() { return this._addConjunctive('or'); }
[ "function whereOrAnd() {\n whereCondition += whereCondition ? \" AND \": \"WHERE \";\n }", "function queryJoinerOr(queries) {\n var returnQuery = \"\"\n queries.forEach(function (query) {\n returnQuery += \"(\"\n returnQuery += query\n returnQuery += \") OR \"\n })\n if (r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns Object Room controller
function getController(room) { return room.controller; }
[ "getRoom() {\n return this.room;\n }", "getRoom() {\n const id = this.roomName;\n\n if (!activeRooms.hasOwnProperty(id)) {\n throw new Error('Room requested does not exist: ' + id);\n }\n\n return activeRooms[id];\n }", "ActiveRoom(){\r\n\t\tif(this.roomsMgr.RoomExists(this.activeRoom)){\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
storing best times in localStorage
function storeBestTimes() { var retrievedTimes = JSON.parse(myStorage.getItem("bestTimes")); retrievedTimes.push(gameTime); sortBestTimes(retrievedTimes); myStorage.setItem("bestTimes", JSON.stringify(retrievedTimes)); return retrievedTimes; }
[ "function AddToBestTime(time)\n{\n //pushing new time to array\n bestTimes.push(time);\n //sorting array\n bestTimes.sort(function (a, b) { return b - a });\n //cutting array to 5 elements\n if (bestTimes.length > 5)\n bestTimes.pop(); \n //clearing local storage\n localStorage.clear(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle "fire" [rocket] events
function fireRocket() { if (!state.running) { return; } console.log('Firing rocket...'); handleSound('rocket'); // NOTE: source - https://www.raspberrypi.org/learning/microbit-game-controller/images/missile.png var rocketDivStr = "<div id='r-" + rocketIdx + "' class='rocket'><img src='img/rocket.png'/><...
[ "_fire(event) {\n this.fire(event.type, event);\n }", "function onFireRocketPlayer(data) {\n \"use strict\";\n var playerPointer = playerById(this.id),\n sector = openSectors[playerPointer.sector],\n uuid = uuidV1(),\n newRocket = {\n \"name\": uuid,\n \"id\": uuid,\n \"type\": \"shi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an object representing a Harfbuzz buffer.
function createBuffer() { var ptr = exports.hb_buffer_create(); return { ptr: ptr, /** * Add text to the buffer. * @param {string} text Text to be added to the buffer. **/ addText: function (text) { const str = createJsString(text); exports.hb_buffer_add_utf16...
[ "function instantiateBuffer(buffer, imports) {\n return instantiate(new WebAssembly.Module(buffer), imports);\n}", "function Buffer(){}", "function Buffer() {\n}", "function ObjFormatBufferParser(sourceBuffer) {\n\n\tthis.kCharacterVertexAttrJoin = \"/\";\n\t\n\tthis.kCommandCommentStr = \"#\"\n\tthis.kComma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Basic constructor setting THREE.js Scene object
constructor() { this.scene = new THREE.Scene(); }
[ "function Scene() {\n\tObject3D.call( this );\n\n}", "function Scene() {}", "function ThreeJsScene_() {\n log_.information_('Creating ThreeJs Scene');\n\n this.scene_ = new THREE.Scene();\n}", "function initScene(){\n\t\n\t// the scene contains all the 3D object data\n\tscene = new THREE.Scene();\n}", "se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wire property for getrecord Decide when to show or hide the icon returns 'utility:anchor' or null
get detailsTabIconName() { if(this.wiredRecord.data!= null) { console.log('wiredRecord',this.wiredRecord.data); return 'utility:anchor'; } else{ return null; } }
[ "get detailsTabIconName() { \n return this.wiredRecord.data ? 'utility:anchor' : null;\n }", "get detailsTabIconName() {\n return this.wiredRecord.data ? 'utility:anchor' : null;\n }", "get visibility () {\n return new IconData(0xe8f4,{fontFamily:'MaterialIcons'})\n }", "get icon() {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if food is nearby and if they're close enough to eat
checkForFood(foods) { for (var i=0; i < foods.length; i++) { let distance = Math.abs(super.subtractVectors(this.position, foods[i].position)); if (distance <= this.senseRadius && distance >= 0) { if (distance <= this.stepSize / 2 && distance >= 0) { th...
[ "checkForFood(foods) {\n\n let minFoodDistance = this.sense;\n\n for (var food of foods) {\n\n let distance = Vector.getMagnitude(Vector.subtractVectors(this.position, food.position));\n if (distance <= this.sense && food.value > 0) {\n this.foodIsNear = true;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a basic sanity check that an object is probably a directive def. DirectiveDef is an interface, so we can't do a direct instanceof check.
function assertDirectiveDef(obj) { if (obj.type === undefined || obj.selectors == undefined || obj.inputs === undefined) { throwError("Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape."); } }
[ "function assertDirectiveDef(obj) {\n if (obj.type === undefined || obj.selectors == undefined || obj.inputs === undefined) {\n throwError(\"Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.\");\n }\n}", "function assertDirectiveDef(obj) {\n if (obj.t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion para eliminar los favoritos, se encarga de eliminar los favoritos del localStorage, una vez eliminado, se vuelve a convertir en string y se vuelve a guardar sobreescribiendo los valores anteriores
function eliminarFavoritos() { let favoritoId = $(this).attr("myAttr2"); let usuariosFavsLocalStorage = window.localStorage.getItem("AppProductosFavoritos"); let usuariosFavsJSON = JSON.parse(usuariosFavsLocalStorage); if (usuariosFavsJSON && usuariosFavsJSON.length > 0) { for (let i = 0; i < us...
[ "function deleteFavoritoStorage(idFavorito) {\n // Nos quedamos sólo con los favoritos que no coinciden con el id pasado por parámetro\n let nuevaListafavoritos = status.favoritos.filter(\n (fav) => fav.id != idFavorito\n );\n status.favoritos = nuevaListafavoritos;\n localStorage.setItem(\"status\", JSON.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate Max Loan Amount Another function of same name in /annuityloanschedule
calculateMaxLoanAmount(p) { return new AnnuitySchedule(this.options).calculateMaxLoanAmount(p); }
[ "function bankBorrowMax(){\n\t\t\tborrowLoan(maxloan);\n\t\t}", "findMaximumValue() {\n\n }", "function calculateMonthlyMortgagePayment(args){\n\tvar principal = args.loanAmount;\n\tvar interestRate = args.interestRate == 0 ? 0 : args.interestRate/100;\n\tvar monthlyInterestRate = interestRate == 0 ? 0 : inter...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the pane from DOM, and void pane when layer removed from map
onRemove() { this._active = false; this._map.removeLayer(this._canvasLayer); if (this.options.onRemove) this.options.onRemove(); }
[ "onRemove() {\n if (this._container) {\n this._container.remove();\n this._container = null;\n }\n if (this._options.style === 'auto') {\n this._map.events.remove('styledata', this._mapStyleChanged);\n }\n this._map = null;\n }", "onRemove() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }