query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Registers a TimeSeries and returns a Point if the specified labelValues is not already associated with this cumulative, else returns an existing Point.
registerTimeSeries(labelValues) { const hash = utils_1.hashLabelValues(labelValues); // return if the specified labelValues is already associated with the point. if (this.registeredPoints.has(hash)) { return this.registeredPoints.get(hash); } if (this.labelKeysLength ...
[ "getOrCreateTimeSeries(labelValues) {\n validations_1.validateArrayElementsNotNull(validations_1.validateNotNull(labelValues, 'labelValues'), 'labelValue');\n return this.registerTimeSeries(labelValues);\n }", "function addDataSeriesPoints(\n peerConnectionElement, dataSeriesId, label, times, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Schedule Title fixed on scroll
function registerFixedHolyMassTitle() { $(window).scroll(function () { var $title = $('.langDateUserTitle:visible'); var offset = $('.fullHeight:visible').offset(); if ((offset.top - $(this).scrollTop()) < 75) { $title.addClass('fixed-top'); } else { $title.removeClass('fixed-top'); } ...
[ "_updateTitle()\n {\n document.head.querySelector('title').innerText = `[${this._toString('HH:mm:ss')}] @amjs/working-on`;\n }", "function setupTitle() {\n var alarmRichlist = document.getElementById(\"alarm-richlist\");\n var reminders = alarmRichlist.childNodes.length;\n\n let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns list of unused cards (cards)
function getUnusedCardIDs() { //return list let r = new Array(); //copy card ids and add them to r cardIDs.forEach(id => { r.push(id); }); //for each used cards id subtract it from r cardIDsUsed.forEach(id => { if (r.includes(id)) r.splice(r.indexOf(id), 1); ...
[ "dealRandomCardsFromDeck(nb) {\n\n let out = new Array(nb);\n let temp = new Card();\n\n for(var i = 0; i < nb; i++) {\n do {\n temp = this.deck.randomCardObject();\n } while(this.cardsDealt.includes(temp));\n\n // Add the card to the cards dealt ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get noUISlider Value and write on
function getNoUISliderValue(slider, percentage) { slider.noUiSlider.on('update', function () { var val = slider.noUiSlider.get(); $(slider).parent().find('span.js-nouislider-value').text(parseInt(val)); }); }
[ "onSliderValueChanged() {\n this.setBase();\n const label = `${this.name}: ${JSON.stringify(this.value)}`;\n ChromeGA.event(ChromeGA.EVENT.SLIDER_VALUE, label);\n }", "function getSliderValue() {\n if (!AgeRecalculating) {//todo: weird bug that a second map-move is asked with strange pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Carrega a lista dos blocos fixos.
function loadFixedBlocks() { _fixedBlocks = [ // Fixed line 1 {line: 1, column: 1, block: new BoardBlock("FIX_11", true, false, false, true, true, _itemTypes[0])}, {line: 1, column: 3, block: new BoardBlock("FIX_13", true, false, true, true, true, _itemTypes[6], getNextF...
[ "function criar_baralho(){\n let b = [];\n\n //Percorre todos os naipes\n for( i in naipes ){\n //Cria cada uma das cartas definidas na constante (padrao: 13)\n for( let carta = 1; carta <= numero_cartas; carta++ ){\n //Define um nome de exibição da carta\n let nome;\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates svg container, QTc calculator and toolbar container for images with ruler facility
function create_svg_ecgtoolbar_container(that) { var desc_id = that.attr("id"); var img = that.find("img."+toolbar_class); if (img.length != 0) { var img_src = img.attr("src"); time_1_second_in_pixels = img.attr('data-time_1_second_in_pixels'); ...
[ "toSVG(opt) {\n const options = { ...this.options, ...opt };\n const {\n width,\n height,\n padding,\n color,\n background,\n container,\n xmlDeclaration,\n pretty,\n join,\n swap,\n predefined,\n } = options;\n\n const { modules } = this.qrcode;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DiscussionListProfile for clicked User
function DiscussionListProfile(props) { return ( <div className={classes.disc}> {props.discussionList.map(c => <Discussionprofile lat={c.lat} lng={c.lng} id={c._id} topic={c.topic} title={c.title} votes={c.votes} />)} </div> ); }
[ "function Discussionprofile(props) {\n return (\n <div className={classes.discussion}>\n <Button size=\"small\" variant=\"outlined\" className={props.topic === 'Nature' ? classes.nature : props.topic === 'Request' ? classes.request : props.topic === 'Walking' ? classes.walking : props.topic === 'Phot...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function delete the distribution details attached to the vendor bill
function deleteDistributionDetails(stVBId,action) { var arrBDD = getBillDistributionDetails(stVBId); if(arrBDD) { if(action=='delete') { for(var i=0; i<arrBDD.length; i++) { nlapiDeleteRecord('customrecord_svb_bill_dist_details',arrBDD[i...
[ "handleDestroy() {\n const deleteInfo = {\n id: this.data.id,\n index: this.index,\n };\n this.$store.dispatch('deleteLicense', deleteInfo);\n }", "delete(req, res) {\n const attributes = {\n purchaseId: req.params.purchaseId\n };\n\n PurchaseModel.delete(attributes)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function subtracts Jeans number for M_W&F by 1
function countJeansMwfMinus() { if(instantObj.noOfJeansMWF > 0) { instantObj.noOfJeansMWF = instantObj.noOfJeansMWF - 1; countTotalBill(); } }
[ "function countJeansMwiMinus() {\n\t\t\tif(instantObj.noOfJeansMWI > 0) {\n\t\t\t\tinstantObj.noOfJeansMWI = instantObj.noOfJeansMWI - 1;\n\t\t\t\tcountTotalBill();\n\t\t\t}\n\t\t}", "function countJeansWwiMinus() {\n\t\t\tif(instantObj.noOfJeansWWI > 0) {\n\t\t\t\tinstantObj.noOfJeansWWI = instantObj.noOfJeansWW...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Spell check the Ace editor contents.
spellCheck() { if (!this.isSpellChecking) return // Wait for the dictionary to be loaded. if (this.dictionary == null) { return; } if (this.currently_spellchecking) { return; } if (!this.contents_modified) { return; } console.log("spell check!") this.curren...
[ "function spellCheck() {\r\n\twith(currObj);\r\n\tvar query;\r\n\t\r\n\tif(currObj.spellingResultsDiv)\r\n\t{\r\n\t\tcurrObj.spellingResultsDiv.parentNode.removeChild(currObj.spellingResultsDiv);\r\n\t\tcurrObj.spellingResultsDiv = null;\r\n\t}\r\n\t\r\n\tif(currObj.config['useIcons'])\r\n\t{\r\n\t\tcurrObj.actionS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send Data Function This function's primarily role is to house all of the logic needed to buffer and send log data for historical data analysis, leveraging the COUNT and BUFFER variables declared above to write data at a predetermined cadence. In this example, the function triggers sendData every 3 seconds and adds to t...
async function sendData(){ //Increment count everytime sendData is invoked. COUNT++; console.log('COUNT: ', COUNT); console.log('BUFFER: ', BUFFER); //Read last three minutes of log data from stream and store into an array of objects. const streamData = await redis.readRedisStream(); //Logic sho...
[ "function sendData() {\n\n // Get all PID input data and store to right index of charVal\n for(var i = 1; i <= 18; i++) {\n txCharVal[i] = select(inputMap[i]).value;\n }\n\n // Get all control input data and store to right index of exCharVal\n exCharVal[0] = select('#throttle').value;\n\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
' Name : handleUserGuestOnSuccess ' Return type : None ' Input Parameter(s) : None ' Purpose : Function is used for handle the response of USER_GUEST Api. ' History Header : Version Date Developer Name ' Added By : 1.0 24th May,2013 Karuna Mishra '
function handleUserGuestOnSuccess(isContFlag) { setCookie("userId", user_guest_obj.userId); setCookie('userName', user_guest_obj.username); /* Store Account ID of guest user, to display on Edit Profile Page. */ setCookie("walletId", user_guest_obj.walletId); setCookie("userAccountNumber", user_guest_ob...
[ "function handle_user_guest(req, startTime, apiName) {\n this.req = req; this.startTime = startTime; this.apiName = apiName;\n}", "function handle_upgrade_guest_user(req, startTime, apiName) {\n this.req = req; this.startTime = startTime; this.apiName = apiName;\n}", "function is_in_guest_list...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle a visibility change signal from a completer widget.
onVisibilityChanged(completer) { // Completer is not active. if (completer.isDisposed || completer.isHidden) { if (this._editor) { this._editor.host.classList.remove(COMPLETER_ACTIVE_CLASS); this._editor.focus(); } return; } ...
[ "listenForPageVisibility_() {\n this.client_.makeRequest(\n MessageType_Enum.SEND_EMBED_STATE,\n MessageType_Enum.EMBED_STATE,\n (data) => {\n this.hidden = data['pageHidden'];\n this.dispatchVisibilityChangeEvent_();\n }\n );\n }", "addVisibilityListeners() {\n documen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST: Create a Cake
create(request, response) { console.log('creating cake...', request.body); Cake.create(request.body) .then(cake => response.json(cake)) .catch(error => response.json(error)); }
[ "createAction(req, res) {\n let robot = new Robot();\n robot.name = req.body.name;\n\n robot.save((err) => {\n if (err)\n this.jsonResponse(res, 400, { 'error': err });\n\n this.jsonResponse(res, 201, { 'message': 'Robot created!' });\n });\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get mapping of macro_key > macro
async getMacros() { return this._get(this._macrosKey_, {}); }
[ "getMacro(name) {\n const len = this.stack.length - 1;\n for (let i = len; i >= 0; i--) {\n const inst = this.stack[i]._getMacro(name);\n if (inst !== null) {\n return inst;\n }\n }\n return null;\n }", "function decodeMacroChain(featureMacro, dataMatrix, index){\n\tvar macroLis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: _fnSortAttachListener Purpose: Attach a sort handler (click) to a node Returns: Inputs: object:oSettings dataTables settings object node:nNode node to attach the handler to int:iDataIndex column sorting index function:fnCallback callback function optional
function _fnSortAttachListener ( oSettings, nNode, iDataIndex, fnCallback ) { $(nNode).click( function (e) { /* If the column is not sortable - don't to anything */ if ( oSettings.aoColumns[iDataIndex].bSortable === false ) { return; } /* * This is a little bit odd I admit... I d...
[ "function aa_tableColumnSort(table,settings)\n{\n\tvar thead = jQuery(table).find('>thead')[0];\n\taa_registerHeaderEvent(thead,'mouseup',clickHandler,'Sort','no dominant');\n\t\n\tfunction clickHandler(e,thead,th) {\n \t var jth = jQuery(th);\n\t if (!thead.LastMouseDown || thead.LastMouseDown.th != th) ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
| | Content Under Nav js |
function contentUnderNav(){ if(document.querySelector("nav").classList.contains("fixed-top") && document.querySelector("nav").classList.contains("_content_under_nav")){ document.body.style.paddingTop = (document.querySelector("nav").clientHeight-.17)+"px"; } }
[ "function slideInNav() {\n $mainNavContainer.toggleClass('visible'); \n $contentContainer.toggleClass('main-nav-showing');\n $breadcrumb.toggleClass('push-over');\n }", "function add_navigation_bar() {\n\tlet nav=document.createElement('nav');\n\tnav.setAttribute('id','mi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if a given popstate event is an extraneous WebKit event. Accounts for the fact that Chrome on iOS fires real popstate events containing undefined state when pressing the back button.
function isExtraneousPopstateEvent(event) { return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1; }
[ "function unexpectedEventsNotDispatched()/* : Boolean*/\n {\n for (var i/*:uint*/ = 0; i < this._unexpectedEventTypes$_LKQ.length; ++i )\n {\n var unexpectedEvent/* : String*/ = this._unexpectedEventTypes$_LKQ[i];\n \tif ( this.unexpectedEventNotDispatched( unexpectedEvent ) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getStatistics: Get statistics information of the bucket.
getStatistics(callback) { return this.getStatisticsRequest().sign().send(callback); }
[ "getStatisticsRequest() {\n let operation = {\n 'api': 'GetBucketStatistics',\n 'method': 'GET',\n 'uri': '/<bucket-name>?stats',\n 'params': {\n },\n 'headers': {\n 'Host': this.properties.zone + '.' + this.config.host,\n },\n 'elements': {\n },\n 'proper...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CREATE DEPARTMENT> Takes in the Supervisor's Choices department_name: over_head_costs:
function createDepartment(name, cost) { log(`\n\n`); log(y(`ADDING NEW DEPARTMENT...`)); log(`\n\n`); connection.query(`INSERT INTO departments SET ?`, { department_name: name, over_head_costs: cost }, function (err, res) { if (err) throw err; log(y(`DEPARTMENT --${name}-- ...
[ "function addDepartment() {\n\tinquirer.prompt(prompt.insertDepartment).then(function (answer) {\n\t\tvar query = \"INSERT INTO department (name) VALUES ( ? )\";\n\t\tconnection.query(query, answer.department, function (err, res) {\n\t\t\tif (err) throw err;\n\t\t\tconsole.log(\n\t\t\t\t`You have added this departm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
asyn function init argument object of opeartion class wait for execuation of Serial function and after that call Show function to change DOM
async function init(opt){ await opt.Serial(opt.calculateLength); /* show data function here opt ( object of operation) taking reference from init method */ show = () =>{ document.getElementById("lengthIn").innerHTML = opt.data.Legth; ...
[ "function startViz(){ \r\n\tmyProcess.setCallback(updateViz);\r\n}", "async init() {\n this.handleEventHandlers()\n await this.model.load().then(\n res => {\n if (res) {\n this.setupView(res)\n }\n }\n )\n }", "async onBegin() {\n\t}", "async init() { }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether the help tour is still in focus, and if not ends it.
function ksfHelp_mainTourRefocus(event) { if(!ksfHelp_mainTour.ended()) { if($(event.target).parents('.tour-ksfHelp_mainTour').length == 0) { ksfHelp.mainTourEnd(); } } }
[ "function outOfFocus(){\n if(playGame) env.pause(true);\n }", "function ksfHelp_mainTourEnd()\n{\n\tksfHelp_mainTour.end();\n}", "function toggleHelp () {\n if (domClass.contains(\"helpUnderlay\", \"help-isVisible\")) {\n closeHelp();\n } else {\n openHelp();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
\brief: modif a textarea dimension \elementId = textarea idea \height = nb pixels to add to the height (the number can be negative) \width = nb pixels to add to the width \formid = form id (needs to have 2 input rows and cols
function textareasize(elementId, height, width, formId) { textarea = $jq(getElementById(elementId))[0]; form1 = textarea.form; if (textarea && height !== 0 && textarea.rows + height > 5) { textarea.rows += height; if (form1.rows) { form1.rows.value = textarea.rows; } } if (textarea && width !==...
[ "function resizeTextArea() {\n\n \t// textarea element\n \tvar textarea = $('#task-body'),\n \ttextarea2 = $('#taskBox-body'),\n \t// hidden element\n \tclonedTextarea = $('.hiddendiv'), \n\n \t// init content as null\n \tcontent = null;\n\n \t// evet to get the input and height\n \ttextarea.on('keyup focus keypres...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
filter schemes by status
function filterStatus(status){ $("#search").val("") $(".scheme").hide(); $(".ministry").hide(); $("#no-matches").hide(); $(".scheme-status." + status).closest(".scheme").show(); $(".scheme-status." + status).closest(".ministry").show(); if ($("#ministries-wrapper").height() == 0) { $("#no-matches")...
[ "filterGames() {\n const { games } = this.state\n return games.filter(game => game.status === \"Just Started\" || game.status === \"In Progress\" || game.status === \"Almost Done\")\n }", "function filterSchemes(scheme){\n\n $(\"#search-status .option-status\").removeClass(\"active\");\n $(\"#no-matches\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse HTTP Headers in order to get the link for next page
function parseHttpHeaders(jqXHR) { // Parse the HTTP headers // ------------------------------------------- // Split headers at newline into array var headersArray = jqXHR.getAllResponseHeaders().split("\r\n"); // Crate JSON object to populate var headersJSON = {}; // Iterate over HTTP h...
[ "function getMetaData(linkHeader) {\n\n if(!linkHeader) return null;\n\n var metadata = {\n first_page: 1,\n last_page: null,\n next_page: null,\n prev_page: null\n };\n\n var linkArr = linkHeader.split(',');\n\n _.each(linkArr, function (link) {\n var start_pos = link.indexOf('<') + 1;\n var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given song data, create a bar chart showing the median value of each trait in the data set. INPUT: medianSvg (Object) data (Object) height (Number) width (Number) OUTPUT: returns nothing, but draws a bar chart
function drawMedians(medianSvg, data, height, width) { const medians = data.medians; const medianXScale = scaleLinear() .domain([min(Object.values(medians)) - 0.05, max(Object.values(medians))]) .range([0, width]); const medianYScale = scaleBand() .domain(Object.keys(medians)) .range([0, height]);...
[ "function drawHistogram(svg, trait, data, height, width) {\n // extract each song's trait value from data\n const songs = data.songs;\n const traitValues = songs.map(function getTraitValue(d) {\n return d[trait];\n });\n // create x-y scales & frequency bins\n const histYScale = scaleLinear()\n .domain(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Searches all inputfields with class autocompleterTextfield and initialize the Autocompleter
function initAutocompleterTextfields() { $$('input.autocompleterTextfield').each(function(el){ new AutocompleterTextfield(el); }); }
[ "function setAutoComplete(arr) {\n searchInput.autocomplete({source: arr});\n}", "function init() {\n var elementsArray = getAllElementsFromSelectos(inputAutocompleteSelector);\n //addEventsToElements(elementsArray, \"keydown\", disableChatOnPressReturn);\n\n for (v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If page name is equal to active pageName, this function returns the element in the page. The element in the partial page is not selected.
getViewElementInActivePage($el) { let selector; if ($el.length > 1) { selector = _.filter($el, (childSelector) => { if (_.isEmpty($(childSelector).closest('[data-role = "partial"]')) && _.isEmpty($(childSelector).closest('[wmprefabcontainer]'))) { return c...
[ "function getActivePage() {\n\t\treturn document.querySelector('li[data-active-page=\"true\"]');\n\t}", "function getActivePage() {\n return $.mobile.pageContainer.pagecontainer('getActivePage');\n}", "function getSelected() {\n\t\t\tif (!activeElement) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tvar elem = do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build modules for injection
function buildModules() { // loop through modules for (var i = 0, l = modules.length; i < l; i++) { var options = modules[i].options; // process styles var styleData; // loop through options for (var j = 0, m = options.length; j < m; j++) { if (options[j].isEn...
[ "registerModules( modules ) {\n modules.forEach( function( module ) {\n if ( !module instanceof baseModule ) {\n console.log( 'Error trying to attach module to tatty-screen', module.name );\n return;\n }\n\n this.modules.push( module );\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
textWidth() determine the width of a line of text (i.e. the text that would be drawn with drawText()); the resulting width is in units of the current coordinate space
function textWidth(txt,fontHeight) { var w; var sx = canvas.width / 2; var sy = canvas.height / currentBlock.getHeight(); var fontSz = fontHeight * sy; ctx.save(); ctx.scale(1/sx,1/sy); ctx.font = fontSz + "px " + DEFAULT_FONT; w = ctx.measureText(txt).wi...
[ "getCharWidth() {\n var el = document.createElement( 'span' );\n el.style.opacity = 0;\n el.innerHTML = 'm';\n this.parent.appendChild( el );\n var fontWidth = el.offsetWidth;\n this.parent.removeChild( el );\n return fontWidth;\n }", "function drawMultiLineText...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an array of numbers, find the largest consecutive gap between two elements.
function largestGapConsecutiveElements (arr){ var gap = 0; for(var i = 0; i < arr.length; i++){ var diff = arr[i] - (arr[i+1]) if (diff > gap){ gap = diff; } } return gap; }
[ "function largestGapBetweenTwo(arr){\n arr.sort(function(a,b){\n return a-b;\n });\n return arr[arr.length-1] - arr[0];\n}", "function gap(num) {\n const binaries = [...num.toString(2)];\n let longestGap = 0,\n currentGap = 0;\n\n for (const bin of binaries) {\n if (+bin === 0) currentG...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs all currently registered internal data handlers. If any such handler returns false, we will stop invocation of additional handlers as well as the callback function.
function runInternalDataHandlers($data) { return runGenericHandlers($data, internalDataHandlers); }
[ "function runPreAjaxCallbackHandlers($data) {\n return runGenericHandlers($data, preAjaxCallbackHandlers);\n }", "_applyDataHandlers(datahandlers, componentData=[]) {\n let _handlers = datahandlers;\n let _appliedFilters = this.state.appliedFilters || {};\n let _data = DataHandler.handle.call(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The AWS::Lambda::Function resource creates an AWS Lambda (Lambda) function that can run code in response to events. For more information, see CreateFunction in the AWS Lambda Developer Guide. Documentation:
function Function(props) { return __assign({ Type: 'AWS::Lambda::Function' }, props); }
[ "functionRunLambdaNodeJs(evt) {\n\n let _this = this;\n _this.evt = evt;\n\n if (!_this.evt.options.path || _this.evt.options.path.split('/').length < 2) {\n return BbPromise.reject(new SError('Invalid function path. Function path should be in this format: component/function .'));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test empty routes file
function routesEmpty() { fs.copySync(path.join(__dirname, 'assets', 'emptyModule.js'), routesFilePath); fs.copySync(path.join(__dirname, 'assets', 'ftlRoutes.js'), path.join(__dirname, 'tmp', 'ftlRoutes.js')); fs.removeSync(combinedFilePath); processor.process(filePaths, ...
[ "function noRoutes() {\n fs.removeSync(path.join(__dirname, 'tmp', 'routes.js'));\n fs.copySync(path.join(__dirname, 'assets', 'ftlRoutes.js'), ftlRoutesFilePath);\n fs.removeSync(combinedFilePath);\n processor.process(filePaths, combinedFilePath, function() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by Java9ParserfieldAccess_lf_primary.
enterFieldAccess_lf_primary(ctx) { }
[ "enterClassInstanceCreationExpression_lf_primary(ctx) {\n\t}", "enterMethodInvocation_lf_primary(ctx) {\n\t}", "enterFieldAccess_lfno_primary(ctx) {\n\t}", "enterMethodReference_lf_primary(ctx) {\n\t}", "enterArrayAccess_lf_primary(ctx) {\n\t}", "enterMethodInvocation_lfno_primary(ctx) {\n\t}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format is one of the QPL format shortcuts: +, ~, _
function qplCharFormat(ko, Format) { var SB = Components.classes["@mozilla.org/intl/stringbundle;1"] .getService(Components.interfaces.nsIStringBundleService) .createBundle("chrome://qplwrapper/locale/qplwrapper.properties"); var QPLWrapper = SB.GetStringFromName('QPLWrapper'); var SelectTextToEscape = S...
[ "function MessageFormat(pattren) {\n this.pattern;\n //\"(C) Currency: . . . . . . . . {0:C}\\n\" +\n //\"(D) Decimal:. . . . . . . . . {0:D}\\n\" +\n //\"(E) Scientific: . . . . . . . {1:E}\\n\" +\n //\"(F) Fixed point:. . . . . . . {1:F}\\n\" +\n //\"(G) General:. . . . ....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepares metadata for usage in VuePress and collects additional headers which will be inserted manually into the page. Changes to the metadata will be written back into the given object.
transoformMetadataAndCollectHeaders (metadata) { delete metadata.description delete metadata.examples this.filterInheritedMembers(metadata) this.sortByName(metadata.properties) this.sortByName(metadata.methods) // We need to temporarily disbale the vue router link rule since the rendered mark...
[ "extractMetadata(content) {\n const metadata = {};\n const both = this.splitHeader(content);\n\n // if no content returned, then that means there was no header, and both.header is the content\n if (!both.content) {\n if (!both.header) {\n return { metadata, rawContent: content };\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculating new height of bottle
function calculateHeight() { return (val / capacity) * bottleHeight; }
[ "function getHeight() {\n return 2;\n }", "_calculateHeight() {\n\t\tif (this.options.height) {\n\t\t\treturn this.jumper.evaluate(this.options.height, { '%': this.jumper.getAvailableHeight() });\n\t\t}\n\n\t\treturn this.naturalHeight() + (this.hasScrollBarX() ? 1 : 0);\n\t}", "set requestedHeight(va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add dummy divs to the top and bottom of body to avoid common problems with measuring content size
function createDummyDiv() { var dummyDiv = document.createElement('div'); dummyDiv.innerHTML = '&nbsp;'; // Avoids vertical collapsing margins dummyDiv.style.clear = 'both'; // Avoids floated layouts getting 0 height ...
[ "function initTiles() {\n let body = document.getElementsByTagName(\"body\")[0];\n const dimension = (1 / GRID_SIZE) * 100;\n for (let i = 1; i <= noTiles; i++) {\n let newTile = document.createElement(\"div\");\n newTile.classList.add(\"tile\");\n newTile.classList.add(\"tile\" + i);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the variable 'page' has a value equal to 1, then the program will perform the area of a circle calculation. Whatever is typed into the 'dinput' input box as the diameter will be turned into an integer and assigned to the variable dInput. The value of dInput will be divided by 2 and assigned to the variable 'radius'....
function calculate () { if (page === 1) { dInput = document.getElementById('d-input').value dInput = parseInt(dInput) radius = dInput / 2 area = Math.PI * radius ** 2 area = area.toFixed(2) document.getElementById('area-result').innerHTML = area document.getElementById('radius-result').inn...
[ "function radiusOutput () {\n dInput = document.getElementById('d-input').value\n dInput = parseInt(dInput)\n radius = dInput / 2\n document.getElementById('radius').style.display = 'block'\n document.getElementById('radius-input').innerHTML = radius\n if (document.getElementById('d-input').value === '') {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide vertical helper line and highlighted data points.
function hideHelper(graph) { graph.find('.svg-helper').attr({'x1': -10, 'x2': -10}); graph.find('.svg-point-highlight').attr({'cx': -10, 'cy': -10}); }
[ "function verticesTooltipHide() {\n vis.verticesTooltip.style(\"opacity\", 0);\n }", "function hideDragLine() {\r\n if (editable) {\r\n dragLine.classed(\"hidden\", true);\r\n\r\n // Reset mouse down and up nodes\r\n mousedownNode = null;\r\n mouseupNode = null;\r\n restart();\r\n }\r\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
BlankArgument is a marker that the argument wasn't typed but is there to fill a slot. Assignments begin with their arg set to a BlankArgument.
function BlankArgument() { this.text = ''; this.prefix = ''; this.suffix = ''; }
[ "function FalseNamedArgument() {\n this.text = '';\n this.prefix = '';\n this.suffix = '';\n}", "function assertSaneArgs (args) {\n for (var i = args.length - 1; i >= 0; i--) {\n var arg = args[i]\n assertHasProperty(arg, 'name')\n assertHasProperty(arg, 'type')\n // assertHasProperty(arg, '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds text to circle
function addCircleText(obj, cssClass, lineHeight) { $("<span></span>") .appendTo(obj) .addClass(cssClass) .html(text) .prepend(icon) .css({ 'line-height...
[ "function drawText() {\n push();\n textAlign(CENTER);\n fill(this.color);\n textSize(this.size);\n text(this.txt, this.x, this.y);\n pop();\n}", "function textToCircles(text, xaxis,yaxis,x,y) {\n \n text.transition()\n .duration(1000)\n .attr(\"x\", function(d) { return x(d[xaxis])-5; })\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a database for pluses
function createDb() { pluses_db.run("CREATE TABLE pluses (nick text, pluses)", function(err) { if (err) { console.log(err); } }); }
[ "function createDb() {\n backupDb('rename');\n db.createdb.newDb();\n}", "function databaseInitialize() {\n if (!db.getCollection(collections.PLACES)) {\n db.addCollection(collections.PLACES);\n }\n\n if (!db.getCollection(collections.RATINGS)) {\n db.addCollection(collections.RATINGS);\n }\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this will effectively set the enddate to (startdate + val), expects hours
set duration(val) { this.timestamp.end = new Date(this.timestamp.start); this.timestamp.end.setHours(this.timestamp.end.getHours()+val); }
[ "_addDate() {\n const valueLink = this.props.valueLink;\n const value = valueLink.value || {};\n const slots = (value.slots || []).slice();\n const start = this.state.start.getTime();\n const end = start + this.state.duration;\n\n // Store the timeslot state as seconds, not ms\n slots.push([sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reportTemplate function is used to list reports or contents into the page. isComment parameter decides whether comment list or not that you are listing.
function reportTemplate(id,username,date_time,report,operaVersion,operaBuildNumber,OS,domain,page,isComment){ var content=''; // parent element that specifies a list element is created content="<article><h6><a href='?mode=get_comment_list&include_report=true&user="+username+"'>"+username+"</a> said on "+dat...
[ "function printReport() {\n\n\tvar report = Banana.Report.newReport(param.reportName);\n\n\treport.addParagraph(param.title, \"heading1\");\n\treport.addParagraph(\" \");\n\treport.addParagraph(param.headerLeft + \" - \" + param.headerRight, \"heading3\");\n\treport.addParagraph(\"Periodo contabile: \" + Banana.Con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all needed items for this RoomObject
removeNeededItems() { this.neededItems = []; }
[ "purge(){\n this.airports = [];\n this.airportsMap.clear();\n }", "newScene() {\n if (confirm(\"Clear all objects of current room?\")) {\n let room_buffer = this._room_canvas;\n let scale_buffer = this._scale;\n let canvas_objects = room_buffer.getObjects()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide unchecked options and show checked options
function hideUncheckedShowChecked() { // Hide the unchecked options for(var i = 0; i < unchecked.length; i++) { if($('#memberBody tr').hasClass(selectedState) || selectedState == 'state-All') { $('.party-' + unchecked[i].value).hide(); } } // Show the checked options filterStateAll(); }
[ "function toggleHiddenCheckItems() { \n STORE.hide = !STORE.hide;\n}", "toggleSelectedForAllCheckedOptions() {\n const enabledCheckedOptions = this.checkedOptions.filter(o => !o.disabled);\n const force = !enabledCheckedOptions.every(o => o.selected);\n enabledCheckedOptions.forEach(o => (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsermodel_iterate_clause.
visitModel_iterate_clause(ctx) { return this.visitChildren(ctx); }
[ "visitLoop_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitData_manipulation_language_statements(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitExprlist(ctx) {\r\n console.log(\"visitExprlist\");\r\n let exprlist = [];\r\n for (var i = 0; i < ctx.star_expr().len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends a "BroadcastRequest" to the wallet. This method can be used to inject an already signed transaction to the network.
requestBroadcast(input) { return __awaiter(this, void 0, void 0, function* () { if (!input.signedTransaction) { throw yield this.sendInternalError('Signed transaction must be provided'); } const network = input.network || { type: NetworkType.MAINNET }; ...
[ "async _broadcast(rawTx) {\n const main = await this.manager._provider.sendTransaction(rawTx)\n for (const node of this.manager._broadcastNodes) {\n try {\n await new ethers.providers.JsonRpcProvider(node).sendTransaction(rawTx)\n } catch (e) {\n console.log(`Failed to send transaction...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
dev mode for autoreloadpackageservice
consumeAutoreload(reloader) { return reloader({pkg:"live-code-runner",files:["package.json"],folders:["lib/"]}); }
[ "function packageModifications(cb){\n var packageConfig = config.packageChanges();\n if(packageConfig){\n mess.load(\"Modifying package.json file\");\n perf.start(\"Package.json changes\");\n package.modify(packageConfig, (success) => {\n mess.stopLoad(true);\n perf....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is the list of ingredients that will populate on the burger(right pane) after the user clicks on the ingredient(left pane) TODO declare some functions
function stackBurger(e) { //this function adds the clicked ingredient to the burger stack const ingToAdd = ingredients.filter(ing => ing.name === e.target.innerText);//this is an array of all the ingredients added to the burger setStack([ingToAdd[0], ...stack]); //this adds clicked ingredients to the array by s...
[ "showIngredients(ingredients) {\r\n let output = \"\";\r\n ingredients.forEach((ingredient) => {\r\n output += `<li>${ingredient.original}</li>`;\r\n });\r\n\r\n document.getElementById(\"ingredientList\").innerHTML = output;\r\n }", "function ingredients() {\n let meal = this.attributes.ingr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
process user follow topic params object value params object id return void
function handleFollowTopic(id, callback) { appAjax( '/ajax/follow-topic', 'post', {id: id}, 'json', function(response) { callback(response); if (!response.error) { console.log('success'); } else { console.log('error'); } } ); }
[ "function getTopicInfo()\n\t{\tvar userid= {};\n\t\tvar posts ={};\n\t\t\t\t\t\n\t\t\tPostFactory.getTopicInfo($routeParams, function (result){\t\n\t\t\tif(result){\n\t\t\t\t$scope.topicInfo = result;\n\t\t\t\t//Adding the id of the user who posted the topic to an object to reuse the getClikeduser\n\t\t\t\t//method...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates an array of valid Bingo numbers
function generateBingoNumbers() { var userCardNumbers = []; for (var currentColumn = 0; currentColumn < NUM_COLS; currentColumn++) { for (var currentRow = 0; currentRow < NUM_ROWS; currentRow++) { if (!(currentColumn === 2 && currentRow === 2)) { var currentNumber = ge...
[ "function roboNumbers(number) {\n const numbersArray = [];\n for(let i = 0; i <= number; i++){\n if (checkIfContains3(i)){\n numbersArray.push(\"Won't you be my neighbor?\");\n } else if(checkIfContains2(i)) {\n numbersArray.push(\"Boop!\");\n } else if(checkIfContains1(i)) {\n numbersArra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : fullHubDisEna AUTHOR : Mark Anthony ELbambo DATE : March 26, 2014 DESCRIPTION : for disable/enable of checbox for fullmesh/hub device list PARAMETERS :
function fullHubDisEna(){ if(globalDeviceType == "Mobile"){ if(globalSelectedDeviceList.length > 1){ $("#hubspokedev").removeAttr("disabled").checkboxradio('enable').checkboxradio("refresh"); $("#fulmeshdev").removeAttr("disabled").checkboxradio('enable').checkboxradio("refresh"); ...
[ "function DisableCCButton(){\n\n\t EnCC.Disable = true;\n\t EnCCFull.Disable = true;\n\t DiCC.Disable = true;\n\t DiCCFull.Disable = true;\n}", "function checkProductFamily(val){\t\n\tif (val!=\"\") {\n\t\t$(\"#newdevmodel\").removeAttr('disabled');\n\t\t$(\"#newdevmodel1\").removeAttr('disabled');\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by Java9ParserenumConstantList.
enterEnumConstantList(ctx) { }
[ "exitEnumConstantList(ctx) {\n\t}", "enterEnumEntries(ctx) {\n\t}", "enterEnumClassBody(ctx) {\n\t}", "exitEnumConstantModifier(ctx) {\n\t}", "enterLiteralConstant(ctx) {\n\t}", "exitEnumConstantName(ctx) {\n\t}", "function parse_IntExpr(){\n\tdocument.getElementById(\"tree\").value += \"PARSER: parse_I...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Default result handler replaced by consumer
function resultHandler(data) { console.warn('SpeakToMe: You need to set a result handler with setResultHandler!'); }
[ "function makeResultHandler(request, response, options) {\n return function (error, results) {\n if (error) {\n log.error(error);\n response.status(500).send('Database error: ', error.toString());\n } else {\n if (options.postLoadProcessor) {\n results = options.postLoadProcessor(result...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the percentage from a skill (defined as divobject)
function get_percentage_from_skill(skill) { // get svg path for circle arc var g = skill.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.childNodes[1]; var path = g.childNodes[2].getAttribute("d"); // get relevant information out of path if (path.includes('L')...
[ "function getPercentage(object)\n{\n var percent = 0 ;\n if(object.volume>25)\n {\n percent=0.5;\n }\n else\n {\n if(object.volume>10)\n {\n percent = 0.3;\n }\n else\n {\n if(object.volume>5)\n {\n percent = 0.1;\n }\n }\n }\n return percent;\n \n}", "get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get file from cache
get(path) { return this.cache.get(path); }
[ "async function readCachedFile(file) {\n const hash = await getCachedFileObjectHash(file);\n if (!hash) return null;\n return readCachedObject(hash);\n}", "function loadFileCache() {\n\tcachedFileInfo = getLocalSetting(\"cachedFileInfo\", {});\n}", "get(url) {\n const cached = splunkd.cached.cache...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the Player Position Reference Action
function playerPositionReferenceAction() { const action = { type: ApiConstants.API_PLAYER_POSITION_REFERENCE_LOAD, }; return action; }
[ "function firebirdPlayerReferenceAction() {\n const action = {\n type: ApiConstants.API_FIREBIRD_PLAYER_REFERENCE_LOAD,\n };\n return action;\n}", "function getAction() {\r\n\r\n return( action );\r\n\r\n }", "function getPos(callback){\n\tfindPos(genLap, callback);\n}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The AWS::Budgets::Budget resource creates, replaces, or deletes budgets for Billing and Cost Management. For more information, see Managing Your Costs with Budgets in the AWS Billing and Cost Management User Guide. Documentation:
function Budget(props) { return __assign({ Type: 'AWS::Budgets::Budget' }, props); }
[ "deductBudget() {\n let price = parseInt(costClothing.value, 10);\n runningBudget -= price;\n updateBudget();\n }", "function getBudgets() {\n $http.get('/budgets')\n .then(function(response) {\n self.budgets = response.data;\n });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Slider image scale [update] handler
function _updateImageScale ( values, handle ) { updateScale.call( this, values, handle ); }
[ "function _changeImageScale ( values, handle ) {\n\t\tchangeScale.call( this, values, handle );\n\t}", "function scale_changed() {\n\n var s = document.getElementById(\"scale_input\");\n //alert(\"slider value \" + s.value);\n\n var range = s.value / 100; // .25 - 2\n\n g_config.scale_factor = range;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert a regular JavaScript obejct to a dataframe. Each row in the dataframe represents a field from the object.
function fromObject(obj) { return new DataFrame(Object.keys(obj) .map(function (fieldName) { return ({ Field: fieldName, Value: obj[fieldName], }); })); }
[ "static restructureDataFrame( obj, named ){\n\n let cols = obj.$names.length;\n let rows = obj.$data[obj.$names[0]].length;\n let arr = new Array(rows);\n\n if( named ){\n for( let i = 0; i< rows; i++ ){\n arr[i] = {};\n for( let j = 0; j< cols; j++ ){\n let name = obj.$names...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the empty cell.
function getEmptyCell() { return game.querySelector(".empty"); }
[ "function getEmptyAdjacentCellIfExists(cell) {\n // Gets all adjacent cells\n let adjacent = getAdjacentCells(cell);\n \n // Searches for empty cell\n for (let i = 0; i < adjacent.length; i++) {\n if (adjacent[i].className == \"empty\") {\n return adjacent[i];\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find the , and attach the `formdata` listener
connectedCallback() { this._form = this.findContainingForm(); if (this._form) { this._form.addEventListener('formdata', this._handleFormData); } }
[ "function addFormData() {\n\t\t\t// console.log(\"called addFormData\");\n\t\t\t$(settings.form).find(':input').each(function(){\n\t\t\t\t// console.log(\"addFormData: \"+$(this).attr('name'));\n\t\t\t\tif ($(this).attr('name') !== undefined) {\n\t\t\t\t\t// exclude .bt_size, need ! in_array()\n\t\t\t\t\tif ($(this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
name_servers computed: true, optional: false, required: false
get nameServers() { return this.getListAttribute('name_servers'); }
[ "_getClientNames() {\n const names = [];\n for (let key in this.clients) {\n names.push(this.clients[key].name);\n }\n return names;\n }", "static processServerOrConnectionString(value, credentials) {\n // If the value contains a connection string server name key, assume it is a connectio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Service for submitting a message
function submitMessage({ name, text }) { return request.post(API_URL, { name, text }); }
[ "function postMessage(form) {\r\n\r\n var token = localStorage.getItem(\"token\");\r\n\r\n // if called from home view, no recipient\r\n var to_email = document.getElementById(\"toEmail\").value;\r\n if(to_email == \"\") to_email = null;\r\n\r\n // make sure message is not empty\r\n if( form.message.value == ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extend the length of slice
function _sslice_extend( slice, count ) { if (count===0) return slice; var idx = slice.start + slice.len; if (count > 0) { _char_iter(slice.str, idx, function(c,i,nexti) { count--; idx = nexti; return (count <= 0); }); } else { _char_reviter(slice.str, idx-1, function(...
[ "function extend(slice0, count) /* (slice : sslice, count : int) -> sslice */ {\n return _sslice_extend(slice0,count);\n}", "function advance(slice0, count) /* (slice : sslice, count : int) -> sslice */ {\n return _sslice_advance(slice0,count);\n}", "range (length) { return this.repeat(length, (i, a) => { a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a pipe definition to the output context.
function compilePipeFromRender2(outputCtx, pipe, reflector) { var definitionMapValues = []; var name = identifierName(pipe.type); if (!name) { return error("Cannot resolve the name of " + pipe.type); } var metadata...
[ "createPipe(addr) {\n const pipeProps = {\n onNotified: (action) => {\n if (__IS_SERVER__ && action.type === SOCKET_CONNECT_TO_DST) {\n const [addr, callback] = action.payload;\n return this.connect(addr, () => {\n this._isHandshakeDone = true;\n callback();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: create a fadeOut function. Incrementally decreases the opacity until it reaches 0; once opacity is 0, switch to the new image and fadeIn()
function fadeOut() { if (opacity > 0) { opacity = opacity - 0.05; targetImage.style.opacity = opacity; // fade some more.... requestAnimationFrame(fadeOut); } else { console.log('targetImage is transparent'); // image is transparent, swap to the next image targetImage.src = images[currentImage]; // fa...
[ "function fadeSlide() {\n var $fadeImage = $('img').eq(1);\n $.each(pictures, function (index, picture) {\n $fadeImage.delay(1000).fadeOut(2500, function () {\n $fadeImage.attr(\"src\", \"images/\" + picture);\n }).fadeIn(2500, fadeSlide);\n });\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Overrides the default system trust store.
override_default_trust_store_from_path(ca_dirpath, ca_filepath) { this.ca_dirpath = ca_dirpath; this.ca_filepath = ca_filepath; }
[ "function secure(spec) {\n\n /*\n * Based on web workers. The sandboxed env. is isolated\n * through a separate process + web browser DOM isolation\n * in Web Workers.\n */\n\n sandbox({\n policy: policy(spec.policy),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
const s1=new EightGrader("Carl"); s1.sayName(); s1.grade;
function NinthGrader(name){ this.name=name; this.grade=9; }
[ "constructor(name, weight, eyeColor){\n//Assigns it to this instance\n// this is the object that is instantiated (created) \nthis.name = name //assigns value to this specific instance of a gorilla\nthis.weight = weight\nthis.isAlive = true // a default can also be set\nthis.eyeColor = eyeColor\nthis.bananasEaten = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new zoomaware vector layer by passing layer options, a reference to the map instance to whose zoom level the layer is supposed to be bound and optionally the minimum and maximum zoom levels.
constructor(options, map, minZoom, maxZoom) { //Call vector layer constructor and pass layer options super(options); this._minZoom = 0; this._maxZoom = Number.POSITIVE_INFINITY; this._displayIntention = true; this.map = map;...
[ "constructor(options, labelOptions, map) {\n //If certain options were not set then provide a default value for them\n options.style = options.style || ol.style.arcLabelStyleFunction;\n options.updateWhileAnimating = options.updateWhileAnimating || false;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Beverage's event listener. Clicking any beverage on the view, shows size for clicked beverage inorder to select one size.
function setBeverageListListener() { $(".beverage-size-list").hide(); $(".beverage-list").click(() => { // Clears selection in pizza menu if (currentPizza) { $('input[name="e-item"]').prop('checked', false); $('input[name="psize"]').prop('checked',...
[ "function addSizeEvent(){\n const btn = document.querySelector(\"#btnSize\");\n\n btn.addEventListener('click', (e) => {\n let newSize = window.prompt('How many squares on each side this time?');\n squareDimension = newSize;\n resetContainer(newSize);\n });\n}", "focusSize(size) {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if the user input is a valid position in grid check if input is a number and between the range of 19 (08 for index), check grid position is available
function isValid(position) { return !isNaN(position) && parseInt(grid[position]) && (position >= 0 && position <= 8); }
[ "function isValidPosition(position) {\n\t\t\treturn ((position[0] >= 0) && (position[1] >= 0) && (position[0] <= 4) && (position[1] <= 4));\t\n\t\t}", "function validateInput() {\n\tvar valid = false;\n\tvar maxPins = 0;\n\tif (!((pins==0)||(pins==\"1\")||(pins==2)||(pins==3)||(pins==4)||(pins==5)||(pins==6)||(pi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
== The EventHub Class == Creating an instance of this class takes no arguments.
function EventHub() { let self = this; let listeners = {}; function ensureEventName(eventName) { if (!(eventName in listeners)) listeners[eventName] = []; }; // === {{{EventHub.addListener()}}} === // // Adds a listener which will be called back whenever an event // of the given name occurs....
[ "constructor() {\n\n V1Event.initialize(this);\n }", "function ChatEvents() {\n\n events.EventEmitter.call(this);\n\n}", "constructor() { \n \n ClientAddEventAllOfPayload.initialize(this);\n }", "constructor() { \n \n JsonV1EventSeries.initialize(this);\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle command download Resource.
_handleRequestResourceDownload(options) { var mimetype = options.resource.get('resource_type_full').mimetype; var ext = options.resource.get('resource_type_full').extension; var filename = options.resource.get('name') + '.' + ext; let a = document.createElement('a'); a.href =...
[ "function reply_download(req, res, info) {\n var downloadLength = parseInt(info.downloadLength);\n if (isNaN(downloadLength) || downloadLength < 1) {\n info.error = '400 Invalid length for download';\n return reply_400(req, res, info); // null return but will invoke res.end() \n }\n var datastream = new...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if the current question is the last one then change button style and onclick event(function) to finalize, otherwise continue to the next question
function checkIfTheLastQuestion(button) { console.log("currentIndex: ",currentIndex); if (currentIndex == quizQuestions.length-1) { console.log(currentIndex +" " + quizQuestions.length); button.className = "finalize";//change the color button.innerHTML = "Finalize"; button.onclick = finalize...
[ "function nextQuestion(){\n deleteButton(buttonDiv);\n deleteButton(questionTitle);\n if (q !== questions.length - 1){\n q++;\n showNextQA();\n } else {\n finalScore();\n deleteButton(buttonDiv);\n deleteButton(questionTitle);\n }\n}", "function setNextQuestion() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change bg of button
function changeButtonBg(color){ document.getElementById("btn").style.background = color; }
[ "function updatePaletteSwatch(button, color)\n{\n if(color) \n button.setAttribute(\"data-color\", color);\n\n button.firstElementChild.style.background = \n button.getAttribute(\"data-color\");\n}", "function setColor() {\r\n console.log('color button pressed');\r\n\r\n let note = this.parent...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function attaches a then() and a catch() to a promise that was returned from a selector's get() (either explicitly or implicitly by running a function that uses the "async" keyword). If a selector's get() returns a promise, we have two possibilities: 1. The promise will resolve, in which case it will have complete...
function wrapResultPromise(store, promise, state, depValues, executionID, loadingDepsState) { return promise.then(value => { if (!selectorIsLive()) { // The selector was released since the request began; ignore the response. clearExecutionInfo(store); throw CANCELED; } con...
[ "function wrapPendingDependencyPromise(store, promise, state, existingDeps, executionID, loadingDepsState) {\n return promise.then(resolvedDep => {\n if (!selectorIsLive()) {\n // The selector was released since the request began; ignore the response.\n clearExecutionInfo(store);\n thro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DataProvider containing Records, FieldProperties and record display expectations User fields
function userDataProvider() { var userString = '{"userId":"RYVP73_UB", "firstName":"dave", "lastName":"isaman", "screenName":"disaman", "email":"disaman@intuit.com", ' + '"deactivated":false, "anonymous":false, "administrator":false, "intuitID":"rc0isu4jlxqmjvqfhnp9", "userProps":null, ...
[ "renderField() {}", "function addRecords() {\n\n var gridData = [\n { firstName : \"Susan\", lastName : \"Ivanova\", age : 36 },\n { firstName : \"Stephen\", lastName : \"Franklin\", age : 39 }\n ];\n gridStore.loadData(gridData, true);\n\n}", "_data() {\n return {\n nameCases: this.nameCase,\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new collaborator on the server
function createCollaborator(doc, collaborator, cb) { if (!authenticated()) return cb("Creating collaborator failed. Login first."); $.ajax({ type: 'POST', headers: { "Authorization": "token " + token() }, data: { "collaborator": collaborator }, url: Substance.settings.hub_api + '...
[ "function CollabServer(config) {\n CollabServer.super.apply(this, arguments);\n\n this.scope = 'substance/collab';\n this.documentEngine = config.documentEngine;\n this.collabEngine = new CollabEngine(this.documentEngine);\n\n // Here we store additional collaborator data\n this._collaboratorInfo = {};\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
component will render by mapping through data passed in through props, rendering a Photo comp for each item... or the NoResults component which handles both loading and no actual results.
render(){ if(this.props.data.length > 0) { return ( <div className="photo-container"> <h2>Results</h2> <ul> {this.props.data.map( obj => ( <Photo key={obj.id} data={obj}/> ...
[ "getPictures() {\n let pictures = this.props.photoData.map( pic => \n <Photo \n url={`https://live.staticflickr.com/${pic.server}/${pic.id}_${pic.secret}_w.jpg`} \n key={pic.id} \n alt={pic.title}\n />\n );\n\n return pictures;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get input value (by id) and return as number
function getInputValue(id) { var inputValue = document.getElementById(id).value; return parseInt(inputValue, 10); }
[ "function parseFloatForInput(id){\n\t\treturn parseFloat(document.getElementById(id).value, 10);\n\t}", "function view_GetFooterFormGradeInputValue() {\n return parseInt($(\"#input-grade\").val());\n}", "function view_getGradeInputForId(id) {\n return $(`#${uniqueIDPrefix}input-grade${id}`).val();\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to delete record by setting id on form and then submitting the form sets value of student_class id in hidden delete form and submits form not completely ideal but wanted to take advantage of flash messages in sails
function deleteRecord(record_id){ $("#deleteform input[name=student_class_id]").val(record_id); $("#deleteform").submit(); }
[ "deleteStudent(req, res) {\n\n }", "function view_deleteStudentFromView(id) {\n $(`#${id}`).remove();\n}", "function deleteRA(){\n\tif (!confirm('Are you sure want to delete this Risk Assessment?')){\n return false;\n }\n\t$.ajax({\n\t\turl : \"/riskAssessment/delete\",\n\t\ttype : 'DELETE',\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replaces right angle brackets (>) with the appropriate XML character reference when part of the string "]]>".
function escapeRightAngleBracketsInCdataTerminator(str) { return str.replace(/]]>/g, "]]&gt;"); }
[ "function escapeLeftAngleBrackets(str) {\r\n return str.replace(/</g, \"&lt;\");\r\n}", "function escapeXml(xml) \n{\n return xml.replace(/[<>&'\"]/g, function (c) {\n switch (c) {\n case '<': return '&lt;';\n case '>': return '&gt;';\n case '&': return '&amp;';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
subclass vehicleFactory to create a factory class that builds Trucks
function TruckFactory() {}
[ "function TruckFactory() {\n TruckFactory.prototype = new VehicleFactory();\n TruckFactory.vehicleClass = Truck;\n}", "function Truck( options) {\n\n this.state = options.state || \"used\";\n this.wheelSize = options.wheelSize || \"large\";\n this.color = options.color || \"blue\";\n\n //NOT def...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render a form to update an existing receita. GET receitas/:id/edit
async edit ({ params, request, response, view }) { }
[ "function getEditAuthorForm(req, res) {\n Author.findById(req.params.authorsIdForEditForm, function(err, authorToEditFromDb) {\n res.render('authorsViews/edit', {\n authorToEditReferenceForEJS: authorToEditFromDb,\n title: `Edit ${authorToEditFromDb.name}`\n })\n })\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get party heal power
function partyHPS() { let power = 10; if (!character.party) return power; //Add priest heals for (let key in parent.party_list) { let member = parent.party_list[key]; let entity = getCharacterData()[member] || parent.entities[member]; if (!entity || entity.ctype !== 'priest') con...
[ "function partyDPS() {\n let power = 0;\n if (!character.party) return 0;\n for (let key in parent.party_list) {\n let member = parent.party_list[key];\n let entity = getCharacterData()[member] || parent.entities[member];\n if (!entity || entity.ctype === 'merchant') continue;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Get Betting Results By Market / / The MarketId of the desired market for which to pull all outcomes/bets.
getBettingResultsByMarketPromise(marketId){ var parameters = {}; parameters['marketId']=marketId; return this.GetPromise('/v3/nhl/odds/{format}/BettingMarketResults/{marketId}', parameters); }
[ "getBettingMarketsByMarketTypePromise(eventId, marketTypeID){\n var parameters = {};\n parameters['eventId']=eventId;\n parameters['marketTypeID']=marketTypeID;\n return this.GetPromise('/v3/nhl/odds/{format}/BettingMarketsByMarketType/{eventId}/{marketTypeID}', parameters);\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===================================================================== shows slider content with actual movies
function showSliderContent() { // request example: https://api.themoviedb.org/3/movie/now_playing?api_key=<<api_key>>&language=en-US&page=1 axios.get(`/movie/now_playing?api_key=${API_KEY}&language=en-US&page=1`) .then(function (response) { // console.log(response.data.results); renderSliderContent(respon...
[ "displayMovieFromLS() {\n const movies = this.getMovieFromLS()\n movies.forEach(movie => {\n this.addMovieToUI(movie)\n })\n }", "function setMoviesPage() {\n\n // display movie genres list\n listMovieGenres();\n\n // display movie year list with forwarded range data\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IMGUI_API void EndTabBar(); // only call EndTabBar() if BeginTabBar() returns true!
function EndTabBar() { bind.EndTabBar(); }
[ "closeTab () {\n if (this.currentTab) {\n this.currentTab.contentElement.setAttribute('aria-hidden', 'true')\n this.setAriaSelected(this.currentTab.titleElement, false)\n this.setAriaSelected(this.tabNavItems[this.currentTab.position], false)\n this.previousTab = t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove code inside condition directive, except keep " "
function RemoveConditionalsScanner_text( code, offset ) { try { if ( this._inDirective == 0 ) this._sb.append( code ); else if ( code.search(/&nbsp;/) != -1 ) this._sb.append( code ); } catch( e ) { this._scan_error = true; return false; } return true; }
[ "function RemoveConditionalsMutation() {\n BaseMutation.call(this, 'RemoveConditionals', ['DoWhileStatement', 'IfStatement', 'ForStatement', 'WhileStatement']);\n}", "function conditional(){\n disjunction();\n if (globalTP < tokens.length && (tokens[globalTP] == \"bicond\" || tokens[globalTP] == \"cond\")){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update self audio track
updateAudioTrack(state, track) { Vue.set(state.self.tracks, 'audio', track) }
[ "update() {\n this.updatePlayers(this.audioPlayer.getSoundPlayers());\n }", "resetSong() {\n this.audio.currentTime = 0\n }", "updateVideoTrack(state, track) {\n\t\tVue.set(state.self.tracks, 'audio', track)\n\t}", "componentDidUpdate(prevProps) {\n if(prevProps.soundSource !== this.props...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that is called if we are looking to autoscale the image up or down
function autoscale(){ // find our parentHeight and parentWidth to compare to var el = image_div.parentNode; var parentWidth = ''; var parentHeight = ''; while(el !== null && parentWidth === '' && parentHeight === ''){ if (typeof el.style !== 'undefined'){ parentWidth = parseInt(el.style.width); par...
[ "onTransformScaling() {\n const scale = this.getClosestScaleToFitExtentFeature();\n this.setScale(scale);\n }", "function scaleImage(scalePercentage){\n\n imgInContainer.style.width=scalePercentage+\"%\";\n imgInContainer.style.height= \"auto\";\n\n}", "function _updateImageScale ( values, hand...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to create a new JrResult object and store a success message in it
static makeSuccess(msg) { if (msg === "" || msg === undefined) { // throw an error, or just do nothing, since lack of error means success throw new Error("makeSuccessInJrResultCannotHaveBlankReason"); } const jrResult = new JrResult(); jrResult.pushSuccess(msg); return jrResult; }
[ "static makeNew() {\n\t\t// static helper.\n\t\treturn new JrResult();\n\t}", "function successResponse()\n{\n // Finished\n return newResponse(true);\n}", "static makeMessage(msg) {\n\t\tconst jrResult = new JrResult();\n\t\tjrResult.pushMessage(msg);\n\t\treturn jrResult;\n\t}", "updateResult() {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shim for placeholder text used in IE which does not support
function placeholderShim( el ) { if ('placeholder' in document.createElement('input')) { return; } var _i = this; // locals var l = {}; l.color = null; l.placeholderText = null; // constants var c = {}; c.placeholderColor = "#A9A9A9"; l.onBlur = function() { if (( el.value == "" ) || ( el...
[ "function handlePlaceholder() {\r\n if ($.browser.msie && $.browser.version.substr(0, 1) < 9) { // ie7&ie8\r\n $('input[placeholder], textarea[placeholder]').each(function () {\r\n var input = $(this);\r\n\r\n $(input).val(input.attr('placeholder'));\r\n\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw framerate, use in draw for debugging
function drawFramerate() { fill(0); stroke(0); text(getFrameRate(), 10, 10); }
[ "function drawFrame(c)\n{\t\t\n\tgame.frame.endFrameMillis = game.frame.startFrameMillis;\n\tgame.frame.startFrameMillis = Date.now();\n\n\tgame.frame.dt = game.frame.startFrameMillis - game.frame.endFrameMillis;\n\t\n\t\t// modify the delta time to something we can use\n\t\t// we want 1 to represent 1 second, so i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updating vote sum on a post
async function updateVoteSum(params, isRemoval){ try { let postObj = Question; if(params['post-type'] == 'answer'){ postObj = Answer; } let vote = await Vote.findById(params['vote-id']); let valueToChange = vote.vote; if(isRemoval){ valueToChange = -valueToChang...
[ "function vote() {\n for (party in total_votes_per_party) {\n if (total_votes_per_party[party] > 0) {\n // Calculate the increment for this party\n var increment = Math.round(multiplier * Math.random());\n // Vote and then remove those votes from the counters\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inherit properties of Car
function Price(color, make, model, price){ // this is how I can inherit the properties of Car Car.call(this,color, make, model) this.price = price // return `car color ${this.color}, model ${this.model}, maker ${this.make} and price is $${price}` }
[ "inherit(property) {\n }", "function Car(vehicletype,name,model,type){ //\nVehicle.call(this, vehicletype)\n if(typeof(vehicletype) == typeof(\"\")){\n this.vehicletype = vehicletype;\n }\n else{\n this.vehicletype = \"Car\";\n }\n if(typeof(name) == typeof(\"\")){\n this.name = nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }