query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
section: base Maptimize.AddressChooser.WidgetshowPlacemark(index) > undefined index (Integer): index of suggested placemark, must be valid Displays suggested placemark on the map.
function showPlacemark(index) { if (this.placemarks && index< this.placemarks.length) { var placemark = this.placemarks[index]; if (this.options.markerDraggable) { this.mapProxy.showPlacemark(placemark, this.options.showAddressOnMap, _markerDragEnd, this); } else { this.mapPr...
[ "function showPlacemark(placemark, showAddress, callback, context) {\n var accuracy = placemark.AddressDetails.Accuracy,\n address = showAddress ? placemark.address.split(',').join('<br/>') : false,\n zoom = 1;\n if (accuracy >= 9) zoom = 17;\n else if (accuracy >= 6 ) zoom = 14;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All CelestialArtifacts must have an imageSrc and a unique ID
constructor(id, imageSrc) { if (new.target === CelestialArtifact){ throw new TypeError("Cannot construct abstract base class CelestialArtifact directly"); } this.id = id; this.imageSrc = imageSrc; }
[ "function ActualizeImage(_divId_, sourceId) {\n let source = document.getElementById(sourceId);\n let value = source.value;\n let toact = document.getElementById(_divId_);\n if (value.indexOf(\"./images/\")=== -1) {\n toact.src = \"./images/\" + value;\n } else {\n toact.src = value;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches the ticket's full details from its related tables
function fetchFullTicketDetail() { return new Promise( async(resolve, reject) => { try { const ticketCon = await ticketModel(); const user = userAccount(); ticketCon.aggregate([ {$match: {user_id: user.id || '5c7e2e2f1f353e05f496ae40'}}, ...
[ "function getAllTickets(){\n if (authorized.admin(this.userId)){\n return Tickets.find({});\n } else {\n // If not admin, have limited fields\n if (authorized.user(this.userId)){\n return Tickets.find({},\n {\n fields: {\n timestamp: 1,\n claimId: 1,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Queues a web component for rerendering
static renderDeferred(webComponent) { // Enqueue the web component const res = invalidatedWebComponents.add(webComponent); // Schedule a rendering task RenderScheduler.scheduleRenderTask(); return res; }
[ "set renderQueue(value) {}", "_queueRender() {\n if (!this._nextFrameTimer) {\n const handler = this._nextFrameHandler || (this._nextFrameHandler = (...args) => {\n let {onStatsUpdate, onBeforeRender, onAfterRender} = this\n let start = onStatsUpdate && Date.now()\n\n if (onBeforeRend...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load text to search
function loadText(text) { $('#status').html(""); bwtIndex = getBWTIndex(text); bwtView.loadText(text); var suffixes = getSortedSuffixes(text); var suffixArray = this.bwtIndex.suffixArray; var ranks = this.bwtIndex.ranks; bwtView.load(text, suffixes, suffixArray, ranks); }
[ "function textSearch() {\n fs.readFile('./random.txt', \"utf-8\", function read(err, data) {\n // Logs any read errors\n if (err) {\n return console.log(err);\n };\n var arr = data.split(\",\");\n searchItem = arr[1];\n searchType(arr[0]);\n });\n}", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inverts the velocity of the given axis (x or y)
function invertVelocity(axis) { if (axis == "x") { ballVelocityX = ballVelocityX * -1; } else if (axis == "y") { ballVelocityY = ballVelocityY * -1; } }
[ "invertDirection(){\n this.setVelocity(\n this.getVelocity().map(x=>x * (-1))\n );\n }", "flipXDir(){\n\t\tlet vx = this.velocity.getX() * -1;\n\t\tthis.velocity.setX(vx);\n\t}", "reverseX(){ this.dx = -this.dx; }", "_reverseX() {\n this._dx = -this._dx;\n }", "flipYDir(){\n\t\tlet vy ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a numeric hash, return a location Precision needs to be given to account for leading zeroes.
function numericHashToLocation(hash, precision) { if (!precision) precision = 25; var octant = hash % 8; hash = Math.trunc(hash / 8); var i = 3; var levels = []; while(i < precision) { levels.push( hash % 4 ); hash = Math.trunc(hash / 4); i += 2; } return levelsToLocation(octant, levels); }
[ "function readableHashToLocation(hash) {\n\tvar octant = hash[0];\n\tvar precision = 3;\n\tvar levels = [];\n\tvar l = hash.length;\n\tvar i = 1;\n\twhile(i < l) {\n\t\tlevels.push( hash[i++] );\n\t\tprecision += 2;\n\t}\n\t\n\treturn levelsToLocation(octant, levels);\n}", "function extractPoint(hash) {\n if (ha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a subTree for the given path.
function treeSubTree(tree, pathObj) { // TODO: Require pathObj to be Path? var path = pathObj instanceof Path ? pathObj : new Path(pathObj); var child = tree, next = pathGetFront(path); while (next !== null) { var childNode = Object(_firebase_util__WEBPACK_IMPORTED_MODULE_2__["safeGet"])(child.n...
[ "function treeSubTree(tree, pathObj) {\r\n // TODO: Require pathObj to be Path?\r\n var path = pathObj instanceof Path ? pathObj : new Path(pathObj);\r\n var child = tree, next = pathGetFront(path);\r\n while (next !== null) {\r\n var childNode = util.safeGet(child.node.children, next) || {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates gym document with new information.
function update() { updateGym(id, name, address1, address2, town, county, openingHours) .then(() => { alert("Gym Information updated!"); }) .catch((error) => { alert(error.message); }); }
[ "function updateDocument() {\n var id = getObject(\"field-documentId\").value;\n\n var title = getObject(\"field-documentTitle\").value;\n var filename = getObject(\"field-documentFilename\").value;\n\n // Now datetime\n var now = new Date();\n // Put into the following ISO format: yyyy-MM-dd'T'HH:mm:ss.SSSXX...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detects collision of ball to paddle and borders
function ballCollision() { if (ballY + ballDY < ballRadius) { ballDY = -ballDY; } if ( ballX + ballDX + ballRadius > canvas.width || ballX + ballDX < ballRadius ) { ballDX = -ballDX; } if ( ballX > paddleX && ballX < paddleX + paddleWidth && ballY + ballDY > paddleY - ballRadius...
[ "function collides(b, p) {\n if(b.x + ball.r >= p.x && b.x - ball.r <=p.x + p.w) {\n if(b.y >= (p.y - p.h) && p.y > 0){\n paddleHit = 1;\n return true;\n }\n \n else if(b.y <= p.h && p.y == 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
closePullRequest('jsarava', '3', 'testingrepo', githubtoken); REST call to close a specific pull resquest of the given repository and the owner.
function closePullRequest(owner,pull,repo,githubtoken) { var sync = true; var out = null; var data = '{"state": "closed"}'; var options = { url : 'https://github.ncsu.edu/api/v3/repos/' + owner + '/' + repo + '/pulls/' + pull, method: 'PATCH', ...
[ "function closePullRequest(owner,pull,repo,githubtoken)\n{\n var sync = true;\n var out = null;\n var data = '{\"state\": \"closed\"}';\n var options = {\n url : 'https://github.ncsu.edu/api/v3/repos/' + owner + '/' + repo + '/pulls/' + pull,\n method: 'PAT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the response area to represent a proper response to the current inputted email and location (or lack thereof)
function updateResponseArea() { let locVal = $('#location').children("option:selected").val(); if (locVal == "[select a location]") { locVal = ""; } let emailVal = $('#email').val(); if (emailVal == "undefined") { emailVal = ""; } let locEmpty = (locVal == ""); let emailE...
[ "function updateResponses() {\n\tvar responseForm = rightPane.querySelector('form[id=\"response-form\"]');\n\tvar name = responseForm.querySelector('input[type=\"text\"]');\n\tvar response = responseForm.querySelector('textarea[type=\"text\"]');\n\tif(name.value && response.value) {\n\t\tappendResponseToResponseLis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createPatternCheckbox generate the checkbox which allows the user to choose what year he just finished
function createPatternCheckbox() { var onPatternCheckbox = document.getElementById('checkboxInput'); onPatternCheckbox.onclick = function() { toggleVisibility('year-select-dd'); if (prerequisiteTable) prerequisiteTable.resetSelection(); } }
[ "function createYearLabel() {\n\n var\n yearFocused = MONTH_FOCUSED.YEAR,\n yearsInSelector = SETTINGS.yearSelector\n\n\n // If there is a need for a years selector\n // then create a dropdown within the valid range\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
12.1 The Intl.DateTimeFormat constructor ================================== Define the DateTimeFormat constructor internally so it cannot be tainted
function DateTimeFormatConstructor () { var locales = arguments[0]; var options = arguments[1]; if (!this || this === Intl) { return new Intl.DateTimeFormat(locales, options); } return InitializeDateTimeFormat(toObject(this), locales, options); }
[ "function DateTimeFormatConstructor() {\n\t var locales = arguments[0];\n\t var options = arguments[1];\n\n\t if (!this || this === Intl) {\n\t return new Intl.DateTimeFormat(locales, options);\n\t }\n\t return InitializeDateTimeFormat(toObject(this), locales, options);\n\t}", "function Date...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addCode(num) triggered by pressing a button in the keypad add a digit to the keypad display
function addCode(num) { // get the current digit let code = $(".keypad-code").text(); // limit digits to only 4 if (code.length >= 4) { $(".keypad-code").text(num); // add one if not greater than 4 digits } else { code += num; $(".keypad-code").text(code); } SOUND_BEEP.play(); }
[ "function keyboardAddNumber(event) {\n if (!selectedOperation) {\n if(event.keyCode === 48) {\n number = 0;\n }\n else if (event.keyCode === 49) {\n number = 1;\n }\n if(event.keyCode === 50) {\n number = 2;\n }\n else if (event.ke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
jqGrid // to load the vertical menu pages
function LoadVerticalMenu(page, menuId) { $('#horizontalMenu').find('li[class=ActiveMenu]').removeClass(); if (page != null) $(page).parent('li').addClass('ActiveMenu'); $.post('/NavMenu/VerticalMenuById', { iMenuId: menuId }, function (data) { window.location.pathname = '/Home/Home'; //win...
[ "function loadGridMenu(){\n\t$.ajax({\n url: \"pages/ConfigEditor/gridPopup.html\",\n dataType: 'html',\n success: function(data) {\n\t\t\t$(\"#gridPanel\").append(data);\n//\t\t\t$( \"#configEditorPage\" ).trigger('create');\n\t\t loadBarsMenu();\n\n\t\t}\n\t});\n}", "function pagesMenu()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a map of banished monsters keyed by what banished them
function getBanishedMonsters() { var banishes = (0, _utils.chunk)((0, _property.get)("banishedMonsters").split(":"), 3); var result = new Map(); var _iterator = _createForOfIteratorHelper(banishes), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var _step$value = _slicedToA...
[ "function getBanishedMonsters() {\n var banishes = utils_1.chunk(property_1.get(\"banishedMonsters\").split(\":\"), 3);\n var result = new Map();\n\n for (var _i = 0, banishes_1 = banishes; _i < banishes_1.length; _i++) {\n var _a = banishes_1[_i],\n foe = _a[0],\n banisher = _a[1];\n if (foe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HIDE DIV BASED IN VAL
function cloak(val) { $(val).hide(); }
[ "hide (value) {\r\n this._hide();\r\n return 1;\r\n }", "hideEasterEgg(value) {\n document.getElementById(value).style.display = \"none\";\n }", "function show_hide(div, to_show_hide = 'hide'){\n\n //if show_hide = 'hide'; then hide the html division else show it\n to_show_hide == 'hide'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
zoto_sets_view Displays a 'lightbox' of set items.
function zoto_set_view(options){ options = options || {}; options.el_class = 'album_view'; options.max_items = 60; options.small_item_class = zoto_set_view_item; options.empty_data_set_str = 'There were no sets found.'; this.$uber(options); }
[ "showSets() {\n let ic = this.icn3d,\n me = ic.icn3dui\n if (!me.bNode) {\n me.htmlCls.dialogCls.openDlg('dl_definedsets', 'Select sets')\n $('#' + ic.pre + 'dl_setsmenu').show()\n $('#' + ic.pre + 'dl_setoperations').show()\n\n $('#' + ic.pre + '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turn the dropdownTemplate into a jQuery object and fill in the variables.
function _build (tpl, view) { var // Template for the dropdown template = tpl, // Holder of the dropdowns options options = [], $dk ; template = template.replace('{{ id }}', view.id); template = template.replace('{{ label }}', view.label); template = template.replac...
[ "function _build (tpl, view) {\n\t\t// Template for the dropdown\n\t\tvar template = tpl;\n\n\t\t// Holder of the dropdowns options\n\t\tvar options = [];\n\t\tvar $dk;\n\n\t\ttemplate = template.replace('{{ id }}', view.id);\n\t\ttemplate = template.replace('{{ label }}', view.label);\n\t\ttemplate = template.repl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is our function checkWays, which just counts the number of True in a boolean array (like the array representing open paths)
checkWays(boolList){ let paths = 0; for(let i = 0; i< boolList.length; i++){ if (boolList[i]){ paths += 1; } } return paths; }
[ "function countTrue(arr) {\n\t let i=0, nbr=0;\n while(i<arr.length){\n if(arr[i] == true) nbr++;\n i++;\n }\n return nbr;\n}", "function countSheeps(arrayOfSheep) {\n var count = 0;\n for (var i=0; i<arrayOfSheep.length; i++) {\n if (arrayOfSheep[i] == true) {\n count = coun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check whether there is a marked entry if not, it's a noop else the real getMetaData is performed
function getMetaData0() { var cid = activeCollectionId(); var dia = getLastMarkedEntry(cid); if (! dia) { statusError('no marked image/collection found'); return ; } $('#ShowMetaDataButton').click(); }
[ "handleLoadedMetadata() {\r\n //empty\r\n }", "getMetaData() {\n errors.throwNotImplemented(\"getting the metadata for the collection\");\n }", "getSodaMetaDataCache() {\n errors.throwNotImplemented(\"getting the SODA metadata cache flag\");\n }", "hasMeta () {\r\n return (this.meta != nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds address values to object and converts to it json
function addAddressAsJson() { var address = {}; // fk ie id? // fk zipcode? address.street = document.getElementById('street'); address.addressIfo = document.getElementById('description'); return JSON.stringify(address); }
[ "addAddress(addressObj)\n {\n this.address.push(addressObj);\n }", "function Create_Address(json) {\n if (!check_status(json)) // If the json file's status is not ok, then return\n return 0;\n address['country'] = google_getCountry(json);\n address['province'] = google_getProvince(jso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to convert the samples to a wav file format
function toWav(samples) { const numChannels = 1; const bitsPerSample = 16; const blockAlign = numChannels * bitsPerSample / 8; const byteRate = sampleRate * blockAlign; const data = interleave(samples); const wav = [ 'RIFF', pad(4 + (8 + 24 + 8 + data.length)), // file length 'WAVE', // fmt ...
[ "function buffer2wav (buffer) {\n\n\t/* define a few helper functios */\n\n\t// dump binary data\n\tfunction xxd (buffer) {\n\t\tfor (var i=0; i<buffer.length; i+=8) {\n\t\t\tvar line = '';\n\t\t\tfor (var j=i; j<Math.min(i+8, buffer.length); j+=1) {\n\t\t\t\tvar n = buffer[j];\n\t\t\t\t// to big-endian (?)\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
appends multiple intervalls in the object format
appendMultipleIntervalls(intervallArray) { this.data.intervalls.push.apply(this.data.intervalls, intervallArray) return this.data.intervalls; }
[ "appendShapes(shapes){\n for (let s in shapes){\n this.appendShape(shapes[s]);\n }\n }", "append(...elements) {\n this.elements = this.elements.concat(flatten(elements));\n }", "addLinkedObjects(...objects){\n this.linkedObjects = this.linkedObjects.concat(objects);\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
search for available printers availble on the network or directly attached (e.g. USB)
searchPrinters(callback) { /** * the printers object, that will be returned * structure * @type {} * @structure: * * { * network: [ * { * uri: "dnssd://Brother%20HL-5270DN%20series._pdl-datastream._tcp.local./?bidi"...
[ "function getPrinters(){\n var printer_list = printer.getPrinters();\n return printer_list;\n}", "async findPrinters() {\n\n // clear the current shell window and print app message\n windowText(\" ncups \");\n\n // check, if printers had already been searched\n if (this.printers.length > 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
code TODO: formlarios_para_publicarCtrl | controller_by_user controller by user
function controller_by_user(){ try { } catch(e){ console.log("%cerror: %cPage: `formlarios_para_publicar` and field: `Custom Controller`","color:blue;font-size:18px","color:red;font-size:18px"); console.dir(e); } }
[ "function controller_by_user(){\n\t\ttry {\n\t\t\t\n//debug: all data\n//console.log(data_listass);\n$ionicConfig.backButton.text(\"\");\n\t\t\t\n\t\t} catch(e){\n\t\t\tconsole.log(\"%cerror: %cPage: `listas_de_precios` and field: `Custom Controller`\",\"color:blue;font-size:18px\",\"color:red;font-size:18px\");\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
day offset > cell offset
function dayOffsetToCellOffset(dayOffset) { var day0 = t.visStart.getDay(); // first date's day of week dayOffset += day0; // normalize dayOffset to beginning-of-week return Math.floor(dayOffset / 7) * cellsPerWeek // # of cells from full weeks + dayToCellMap[ // # of cells from partial last week (dayOffse...
[ "function dayOffsetToCellOffset(dayOffset) {\n var day0 = t.visStart.getDay(); // first date's day of week\n dayOffset += day0; // normalize dayOffset to beginning-of-week\n return Math.floor(dayOffset / 7) * cellsPerWeek // # of cells from full weeks\n + dayToCellMap[ // # of cells from parti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used for submitting Gift Card fields
function submitGiftCard(formButton){ /* Dave's Code converted to jQuery. * Not sure why we need it */ var origURL = $("input[name='URL']").val(); $("input[name='URL']").val("AjaxGiftCardDisplayView"); var origFwd = $("input[name='fwd']").val(); $("input[name='fwd']").val("1"); var origErrorV...
[ "function submitFlashCard() {\n var inputFieldQuestion = document.getElementById(\"newfcQuestion\").value;\n var inputFieldAnswer = document.getElementById(\"newfcAnswer\").value;\n var inputFieldCatergory = selectedCatergory()\n var createNewFlashCard= createFlashCard(inputFieldQuestion, inputFieldAnsw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to create a sprint, executes if there is at least 1 story selected within the backlog container.
createSprint() { if (this.state.selectedStories.length > 0) { let sprintNumber; if (this.props.currentUser.team.sprints.length === 0) { sprintNumber = 1; } else { sprintNumber = parseInt( this.props.currentUser.team.sprints[ this.props.currentUse...
[ "async createSprint(uuid, projectId, sprintData = this.generateSprintPresset(7)) {\n const newSprint = new Sprint(sprintData);\n\n const q = this.getAdminsQuery(projectId, uuid);\n const op = {\n activeSprint: newSprint._id,\n $push: { sprints: newSprint },\n };\n // success if nModified >0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called after establish remote mounts to Jde has been processed
function performPostEstablishRemoteMounts( err, data ) { if ( err ) { // Unable to reconnect to Jde at the moment so pause and retry shortly log.w( '' ); log.w( 'Unable to re-establish remote mounts to Jde will pause and retry' ); log.w( '' ); setTimeout( performPolledProcess, pollInterval ); ...
[ "function performPostEstablishRemoteMounts( err, data ) {\n\n if ( err ) {\n\n // Unable to reconnect to Jde at the moment so pause and retry shortly\n log.warn( '' );\n log.warn( 'Unable to re-establish remote mounts to Jde will pause and retry' );\n log.warn( '' );\n setTimeout( performPolledProce...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Created By: Jared Nichols Date: 12192016 Purpose: This preflow action initializes the GQTypes and GQCategory property values if the values have not already been set. User Story: US595, 596.
function preFlowAction$CollectGQInformation() { /* retrieve data */ var locationAddress = pega.ui.ClientCache.find('pyWorkPage.BCU.SelectedUnitPage.LocationAddress'); var gqType = locationAddress.get('GQTypes') ? locationAddress.get('GQTypes').getValue(): ""; var gqCategory = locationAddress.get('GQCategory') ?...
[ "function postFlowAction$CollectGQInformation() {\n /* retrieve data */\n try\n {\n var locationAddress = pega.ui.ClientCache.find('pyWorkPage.BCU.SelectedUnitPage.LocationAddress');\n var workPage = pega.ui.ClientCache.find('pyWorkPage');\n var gqCategory = locationAddress.get('GQCategory') ? locationA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the visualization with a new estimation.
function updateEstimation(est){ if(linechart !== undefined){ linechart.setValues(est); } }
[ "function updateAdjustedEstimate() {\n // Recalculate the estimate data\n $scope.selectedEstimate = $scope.truckCost * (1 + $scope.markupIncrements[$scope.selectedIndex]);\n }", "updateDemographicChart() {\n const population = this.model.getAllPopulation();\n this.demographicsChart.receiveUpdat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[IE] Force keeping focus because IE sometimes forgets to fire focus on main editable when blurring nested editable.
function onEditableBlur() { var active = CKEDITOR.document.getActive(), editor = this.editor, editable = editor.editable(); // If focus stays within editor override blur and set currentActive because it should be // automatically changed to editable on editable#focus but it is not fired. if ( ( editable....
[ "_updateFocus() {\n\t\tif ( this.isFocused ) {\n\t\t\tconst editable = this.selection.editableElement;\n\n\t\t\tif ( editable ) {\n\t\t\t\tthis.domConverter.focus( editable );\n\t\t\t}\n\t\t}\n\t}", "function onEditableFocus() {\n\t\t// Gecko does not support 'DOMFocusIn' event on which we unlock selection\n\t\t/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reloads all of the language strings
reload() { for (const str of this.strings.values()) str.reload(); }
[ "function loadLangs() \n{\n\tif (jsonObject.phraseArray.length)\n\t{\n\t\tchrome.storage.sync.get({\n\t\t\tfrom: 'en',\n\t\t\tto: 'es',\n\t\t}, function(items) {\n\t\t\tjsonObject.fromLang = items.from;\n\t\t\tjsonObject.toLang = items.to;\n\t\t\tgetTranslation();\n\t\t});\n\t}\n}", "function loadLang() {\n tx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
download zipped obj and mtl for new model
async function downloadObjZip(mtlContent, objContent) { // define what we want in the ZIP const obj = { name: fileName + '.obj', lastModified: new Date(), input: objContent }; const mtl = { name: fileName + '.mtl', lastModified: new Date(), input: mtlContent }; // get the ZIP stream in a Blob const blob = await...
[ "async function createByZip() {\n debug('zip mode');\n await download(zipUrl, target, { extract: true });\n }", "function downloadModel (req, res, next) {\n let filename = req.params.fileId;\n if (!fs.existsSync('./upload/' + filename + '.zip')) {\n // console.log(filename);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show the editor (back of the card).
show() { this.card.style.transform = "rotateY(180deg)"; this.textarea.style.color = this.screen.getForegroundColor(); this.textarea.style.backgroundColor = this.screen.getBackgroundColor(); this.textarea.focus(); this.editing = true; }
[ "_displayEditor() {\n this.editor.display();\n this.terminal.hide();\n }", "showEditor() {\n this.removeClass(RENDERED_CLASS);\n this.inputArea.showEditor();\n }", "showEditor() {}", "function showEditor() {\n // create a new editor instance\n editor.set(json)\n \n $conta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refresh display without overviewed bubble
function refreshDisplayNoOver() { p.getBubbleDrawer().clear(); drawScales(); p.getBubbleDrawer().drawDate(year.current); drawBubbles(); drawBubblesNames(); p.getBubbleDrawer().display(); }
[ "function reloadDisplay(){\r\n //initSVG();\r\n dataHolder.addDisplay(my.that.getPos(), that);\r\n resetVisuals();\r\n my.update();\r\n }", "updateDisplay() {\n \n }", "function refreshDisplay(){\n env.disp.render() ;\n}", "function displayRefresh() {\r\n g.clear(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Translates the workingTime configs into TimeAxisinclude rules, applies them and then refreshes the header and redraws the events
applyWorkingTime(timeAxis) { const me = this, config = me._workingTime; if (config) { let hour = null; // Only use valid values if ( config.fromHour >= 0 && config.fromHour < 24 && config.toHour > config.fromHour && config.toHour <= 24 && config.t...
[ "applyWorkingTime(timeAxis) {\n const me = this,\n config = me._workingTime;\n\n if (config) {\n let hour = null;\n // Only use valid values\n if (config.fromHour >= 0 && config.fromHour < 24 && config.toHour > config.fromHour && config.toHour <= 24 && confi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changing the rules and ranking view by pressing the button
function handleChangeOfView() { if (section.buttonDisplay === RULES) { section.buttonDisplay = RANK; replaceContent( scoreTable, gameWrapper, modeRules, buttonsWrapper, buttonRulesRanking, 'id-badge', ); } else { section.buttonDisplay = RUL...
[ "function changeViewType(){\n if(rModel == undefined){\n return;\n }\n var viewType = document.getElementsByName(\"view_type\");\n if(viewType[0].checked){\n rModel.setViewType(\"perspective\");\n }else{\n rModel.setViewType(\"ortho\");\n }\n}", "function onClickRules () {\n\t\tthis.state.start('ru...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when user's script exceed statements limit
function ExceededStatementsLimit(limit) { this.name = 'ExceededStatementsLimit'; this.message = "Script exceeded maximum statements limit of " + limit + " calls per run."; this.stack = (new Error()).stack; initError(this); }
[ "function checkExecutionTime()\n{\n\tif(Date.now() - comienzoScript > maxExecutionTime) throw new Error(`Tiempo de ejecucion superado. ${Date.now() - comienzoScript}ms transcurridos.`);\n}", "function is_highest_statement_number(n) {\r\n\t// declares the highest statement number for the 20-GATE compiler.\t\r\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns `true` if the `mtime` of the 2 stat objects are equal
function isNotModified (prev, curr) { return +prev.mtime == +curr.mtime; }
[ "function compairFileSync(a, b) {\r\n const astat = _fs.statSync(a);\r\n const bstat = _fs.statSync(b);\r\n if (astat.mtime.getTime() > bstat.mtime.getTime())\r\n return true;\r\n return false;\r\n}", "function newer(source, dest) {\n try {\n var sTime = fs.statSync(source).mtime;\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getAggregatedTimeline returns all events from all timeline rooms being followed.
async getAggregatedTimeline() { let info = { timeline: [], from: null, }; if (!this.accessToken) { console.error("No access token"); return info; } const filterJson = JSON.stringify({ room: { timeline: { ...
[ "async function getAllMatchEvents(match_id){\n const eventCalender = [];\n const events = await DButils.execQuery(`SELECT * FROM dbo.Events where MatchId='${match_id}'`);\n for(const event of events){\n // turn all event to json\n let time = await match_utils.geTimeFromDateTime(event.event_ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store restaurants reviews offline in idb.
static storeOffline(review) { self.idb.open(dbName, dbVersion).then(function (db) { const tx = db.transaction(reviewStore, "readwrite"); const json = JSON.stringify(review); tx.objectStore(reviewStore).put(json, btoa(json)); return tx.complete; }); }
[ "static saveOfflineReview(review) {\n this.openRestaurantsDB().then(function (db) {\n let tx = db.transaction('offline-reviews', 'readwrite');\n let offlineReviewsStore = tx.objectStore('offline-reviews');\n\n offlineReviewsStore.put(review).then( review => {\n console.log(\"Saved offline r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deserializes "content" of this editor so it can be loaded in.
function deSerializeContent(content) { const contentState = convertFromRaw(content.contentState); let editorState = EditorState.createWithContent(contentState); // Note that the "moveSelectionToEnd" is required to fix errors // that put the cursor in the front instead of at the end when clicked on. editorStat...
[ "function serializeContent(editorState) {\n return {\n contentState: convertToRaw(editorState.getCurrentContent())\n };\n}", "get decodedContent() {\n return decode(this._content)\n }", "get content() {\n return this._content;\n }", "getContent () {\n let content = editor.getValue();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render topojson of SF Airbnb neighborhoods Converted from KML for John Blanchard
function build (json) { // render neighborhoods on map svg.append('g').selectAll('path') .data(topojson.feature(json, json.objects.neighborhoods).features) .enter().append('path') .attr('class', 'neighborhood') .attr('id', function (d) { return slugify(d.properties.name); }) ...
[ "getGeoJSONLayersNeighborhoods() {\n\n if (!this.props.geoDataNeighborhoods)\n return null\n\n const mouseOver = (evt) => {\n evt.target.setStyle({\n opacity : 1,\n fillOpacity : 0.8\n })\n }\n\n const mouseOut = (evt) => {\n evt.target.setStyle({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implementation object for WebInput.NET which contains set of required methods for custom editor interface. Format: CustomEditorName_Editor()
function WebInputNET_Editor() { // #Start required interface implementation // Fired on WebGrid's initialization // Put codes to initialize custom editor's properties and create necessary objects here this.OnInitialize = function() { }; // Initialize the WebInput only once this._Initialize = function() { ...
[ "function BaseEditor() {}", "function BaseEditor() { }", "function Editor() {}", "function WebEditBoxImpl () {\n this._domId = `EditBoxId_${++_domCount}`;\n this._placeholderStyleSheet = null;\n this._elem = null;\n this._isTextArea = false;\n this._editing = false;\n\n // matrix\n this._...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
channel(pattern, [buffer]) => creates a proxy channel for store actions
function actionChannel(pattern$1,buffer$1){if(true){check(pattern$1,_redux_saga_is__WEBPACK_IMPORTED_MODULE_2__["pattern"],'actionChannel(pattern,...): argument pattern is not valid');if(arguments.length>1){check(buffer$1,_redux_saga_is__WEBPACK_IMPORTED_MODULE_2__["notUndef"],'actionChannel(pattern, buffer): argument ...
[ "function actionChannel(pattern, buffer) {\n\t if (process.env.NODE_ENV === 'development') {\n\t check(pattern, is.notUndef, 'actionChannel(pattern,...): argument pattern is undefined');\n\n\t if (arguments.length > 1) {\n\t check(buffer, is.notUndef, 'actionChannel(pattern, buffer): argument buffer is ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Expands stated initial fields into a base element. Returns reflection instances of initial field contents these are expanded now
expand(baseElement, initialField, parentSectionReflection) { var _a; /** in section, no element changes, content expanded into same element * in element, new element will be created and contents expanded into them */ const fields = initialField.content, reflections = []; ...
[ "expandNestedPopulate(entityName, parts) {\n const meta = this.metadata.find(entityName);\n const field = parts.shift();\n const prop = meta.properties[field];\n const ret = { field };\n if (parts.length > 0) {\n ret.children = [this.expandNestedPopulate(prop.type, part...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wraps selected text with a prefix and suffix, while maintaining the selection.
wrapText (start, end, prefix, suffix) { let replace = this.text.slice(start, end); let edit = { start, end, insert: prefix + replace + suffix, replace, preSelection: this.selection, postSelection: { start: start + prefix.length, end: end + prefix.length, ...
[ "function wrap(el, startTag, endTag) {\n var selectedText = el.val().slice(\n el.prop(\"selectionStart\"),\n el.prop(\"selectionEnd\")\n );\n\n if (!selectedText) return; // We don't need to wrap anything if no text is selected\n\n var nextText = wrapText(\n el.val(),\n el.prop(\"selectionStart\"),\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set header to force download
function setHeaders(res, path) { res.setHeader('Content-Disposition', contentDisposition(path)) }
[ "function setDownloadsHeaders(res, contentPath) {\n res.setHeader('Content-Disposition', contentDisposition(contentPath));\n}", "function setHeaders(res, path) {\n res.setHeader('Content-Disposition', contentDisposition(path));\n}", "function setHeaders(res, path) {\n console.log('serve file:'+path);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate a server kernelspec model to a client side model.
function validateSpecModel(data) { var spec = data.spec; if (!spec) { throw new Error('Invalid kernel spec'); } validateProperty(data, 'name', 'string'); validateProperty(data, 'resources', 'object'); validateProperty(spec, 'language', 'string'); validateProperty(spec, 'display_name'...
[ "function validateModel(model) {\n validateProperty(model, 'id', 'string');\n validateProperty(model, 'path', 'string');\n validateProperty(model, 'type', 'string');\n validateProperty(model, 'name', 'string');\n validateProperty(model, 'kernel', 'object');\n validate_1.validateModel(model.kernel)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when the distance or text part of the route instruction is clicked, triggers zooming to that part of the route
function handleClickRouteInstr(e) { theInterface.emit('ui:zoomToRouteInstruction', e.currentTarget.id); }
[ "function zoomToRoute() {\n\t\t\tvar layer = this.theMap.getLayersByName(this.ROUTE_LINES)[0];\n\t\t\tvar dataExtent = layer.getDataExtent();\n\t\t\tif (dataExtent) {\n\t\t\t\tthis.theMap.zoomToExtent(dataExtent);\n\t\t\t}\n\t\t}", "function zoomToFeature() {\n self.triggerZoom();\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close all dropdown menus
function closeMenus() { for (var j = 0; j < dropdowns.length; j++) { dropdowns[j] .getElementsByClassName('dropdown-toggle')[0] .classList.remove('dropdown-open'); dropdowns[j].classList.remove('open'); } }
[ "function ouiCloseAllDropdowns() {\n\n var DROPDOWN_TOGGLE = '[data-oui-dropdown-toggle]';\n\n $(DROPDOWN).removeClass(ACTIVE_CLASS);\n $(DROPDOWN_TOGGLE).removeClass(ACTIVE_CLASS);\n }", "function closeMenus() {\n\t\tfor (var j = 0; j < dropdowns.length; j++) {\n\t\t\tdropdowns[j].getElementsByClassNam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set ccm component index
function setIndex() { // has component index? if ( component.index ) { /** * name and version number of ccm component * @type {Array} */ var array = component.index.split( '-' ); // add name of ccm component component.name = arr...
[ "function setIndex() {\n\n // has component index?\n if ( component.index ) {\n\n /**\n * name and version number of ccm component\n * @type {Array}\n */\n var array = component.index.split( '-' );\n\n // add name of ccm component\n com...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a random customer number for customers
function customermaker() { var x = Math.floor((Math.random() * 9999999) + 1); document.getElementById("customerID").innerHTML.value = x; }
[ "function getNumberOfCustomers() {\n return Math.floor(Math.random()*32);\n}", "function getRandomCustomer(minCust, maxCust) {\n return Math.floor(Math.random() * (maxCust - minCust+1) + minCust);\n}", "function randomCustomers(minCustomers, maxCustomers) {\n let number = Math.floor(Math.random() * (maxCus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Propriedade Nome do Doador
get nomedoador() { return this._nomedoador }
[ "nombreCompleto(){\n return `idPersona:${Persona.contadorPersonas},` + ' ' + this._nombre + ' ' + this._apellido + ' ' + ` Años:${this._edad}, `;\n }", "getBiografia(){\n //(super) voy invocar el metodo de la clase Padre(Persona)\n return super.getBiografia() + `Puesto: ${this.puesto}, Sa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Events for list items on hover
function listItemOnHover(listItem) { listItem.addEventListener('mouseover', () => { listItem.style.color = 'gray'; }); listItem.addEventListener('mouseleave', () => { listItem.style.color = 'black'; }); }
[ "onListItemHover() {\n // reset the state's hovered property upon invocation to the opposite of what it currently is\n this.setState({\n hovered: !this.state.hovered\n });\n }", "function di_qds_onmouseover_li(obj_li) {\n try {\n di_jq(obj_li).addClass('di_gui_label_hover');\n }\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sign In Checks if username and pw is matching with local storage
function signInStorage() { var createUsername = localStorage.getItem('createUsername'); var createPw = localStorage.getItem('createPw'); var username = document.getElementById('username'); var pw = document.getElementById('pw'); if (username.value == createUsername && pw.value == createPw)...
[ "function checkCredentials () {\n var storage = window.localStorage;\n username = storage.getItem(\"username\");\n password = storage.getItem(\"password\");\n\n if (username === null || password === null) {\n showLogin();\n }\n}", "function checkLogined() {\n if (localStorage.username ===...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to Multiply two values.
function mulValues(firstValue, secondValue) { count++; var result = 0; result = firstValue * secondValue; return result; }
[ "function multiplcation (a,b) {return a*b}", "multiply(first_number,second_number){\n this.update_current_calculation_result(first_number * second_number);\n return this.current_calculation_result;\n }", "function multiply(a, b) {\n var product = (a * b);\n return product;\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
used with nginclude, replace origial one with children element note: transclude is false
function includeReplace() { var directive = { require: 'ngInclude', restrict: 'A', link: link }; return directive; function link(scope, el) { el.replaceWith(el.children()); } }
[ "function includeReplace() {\n\treturn {\n require: 'ngInclude',\n restrict: 'A', /* optional */\n link: function (scope, el, attrs) {\n el.replaceWith(el.children());\n }\n };\n}", "function includeContent(includeLink, content) {\n GWLog(\"includeContent\", \"transclu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reset context: + optin's + add proposal + deposit vote tokens + vote + execute proposal NOTE: contract calls are not involved here
function resetCtx () { // set up context setUpCtx(); // optIn's ctx.optInToDAOApp(ctx.proposalLsig.address()); ctx.optInToDAOApp(ctx.voterA.address); ctx.optInToDAOApp(ctx.voterB.address); ctx.syncAccounts(); // add proposal ctx.addProposal(); // deposit & register yes votes (...
[ "async EndProposal(ctx, id, result) {\n //update the ongoing proposal to the next one based on creation date\n let ongoingprop = await ctx.stub.getState('ongoingProposal');\n await ctx.stub.putState('ongoingProposal', Buffer.from(JSON.stringify(parseInt(ongoingprop) + 1)));\n // Update t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
xGetElementsByClassName, Copyright 20022007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL
function xGetElementsByClassName(c,p,t,f) { var r = new Array(); var re = new RegExp("(^|\\s)"+c+"(\\s|$)"); // var e = p.getElementsByTagName(t); var e = xGetElementsByTagName(t,p); // See xml comments. for (var i = 0; i < e.length; ++i) { if (re.test(e[i].className)) { r[r.length] = e[i]; ...
[ "function defineGetElementsByClassNameIE() {\n if (document.getElementsByClassName == undefined) {\n document.getElementsByClassName = function (cl) {\n var retnode = [];\n var myclass = new RegExp('\\\\b' + cl + '\\\\b');\n var elem = this.getElementsByTagName('*');\n\n for (var i = 0; i < ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert Origami resource to MongoDB resource
_convertTo(resource) { if (resource instanceof Array) { return resource.map(r => this._convertTo(r)); } const r = resource; if (resource.id) r._id = resource.id; delete r.id; return resource; }
[ "toMongoDB() {\n this.items.forEach(resource => {\n resource.toMongoDB();\n });\n }", "async function processResource(resource) {\n let tags = await db.query('SELECT * FROM tags')\n resource.type = ['singular', 'instanced'][resource.type]\n if (resource...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getPoints(): gets raw data coordinates and transforms them to google LatLng objects Inputs: null Returns: returningArray (Array)
getPoints() { let valueArray = this.getPointsRaw() let returningArray = [] valueArray.forEach((coordinate) => { returningArray.push(new google.maps.LatLng(coordinate[0],coordinate[1])) }) return returningArray }
[ "function _convertData(data) {\n var pts = [];\n for (var i = 0; i < data.length; i++) {\n pts[i] = new google.maps.LatLng(data[i].lat, data[i].lng);\n }\n return pts;\n }", "getResolvedPoints (coordinates) {\n let returningArray = []\n coord...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the children of the gridGroup and discards the gridGroup itself
function removeGrid() { for (var i = 0; i<= gridGroup.children.length-1; i++) { gridGroup.children[i].remove(); } gridGroup.remove(); }
[ "function removeGridChilds() {\n while (sketchContainer.firstChild) {\n sketchContainer.removeChild(sketchContainer.lastChild);\n }\n}", "function removeExistingGrid() {\n while (parent.firstChild) {\n parent.removeChild(parent.firstChild);\n }\n}", "removeAllChildren () {\n\t\tlet kids = this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the CSS class name associated with the alias by a previous call to registerFontClassAlias. If no CSS class has been associated, returns the alias unmodified.
classNameForFontAlias(alias) { return this._fontCssClassesByAlias.get(alias) || alias; }
[ "registerFontClassAlias(alias, className = alias) {\n this._fontCssClassesByAlias.set(alias, className);\n return this;\n }", "function getClassAliasIfNeeded(node){if(resolver.getNodeCheckFlags(node)&16777216/* ClassWithConstructorReference */){enableSubstitutionForClassAliases();var classAlias=t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
icheck Directive for custom checkbox icheck
function icheck($timeout) { return { restrict: 'A', require: 'ngModel', link: function ($scope, element, $attrs, ngModel) { return $timeout(function () { var value; value = $attrs['value']; $scope.$w...
[ "function handleiCheck() {\n\n if (!$().iCheck) return;\n $(':checkbox:not(.js-switch, .switch-input, .switch-iphone, .onoffswitch-checkbox, .ios-checkbox, .md-checkbox), :radio:not(.md-radio)').each(function() {\n\n var checkboxClass = $(this).attr('data-checkbox') ? $(this).attr('data-checkbox') : '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a throttler not bouncer. /This function code is update 1030628. Only wait === 0 argument is tested so far. / /Useful for resize event /Input: wait optional, how much to wait till call / the most recent functioncurry, / if falsy, then never wait and never curry. / if falsy, never throttles: does executes immedia...
function throttle( fun, wait ) { throttleDebCount++; var timeout = null; var timeStart = null; var arg; return function( arg_, doCallNow, doCancel, do_bounce ) { arg = arg_; //updates arg at every call var time = Date.now(); time...
[ "throttle(func, wait, options) {\n if (this._isDisposed) {\n return this._noop;\n }\n let waitMS = wait || 0;\n let leading = true;\n let trailing = true;\n let lastExecuteTime = 0;\n let lastResult;\n // tslint:d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function prints the pixel data
function printpixeldata() { var imagedata; var canvas = document.createElement("canvas"); var ctx = canvas.getcontext("2d"); var img = new Image(); img.src ="file:///C:/Users/mahrajag.ORADEV/Desktop/D3/DragResize/MagBarChart.png"; img.width = w; img.hei...
[ "function printPixel(nameOfImage, xpos, ypos){\nvar somePxl = new SimpleImage(nameOfImage).getPixel(xpos,ypos);\n print(\"red is \",somePxl.getRed());\n print(\"green is \",somePxl.getGreen());\n print(\"blue is \",somePxl.getBlue());\n\n}", "function printPixel(nameImage, xpos, ypos) {\n var img = n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add navigation listeners after component mounts
componentDidMount(){ addNavigationListeners() }
[ "subscribe() {\n window.addEventListener('vaadin-router-go', this.__navigationEventHandler);\n }", "subscribe() {\n window.addEventListener(\"vaadin-router-go\", this.__navigationEventHandler);\n }", "subscribe() {\n window.addEventListener('vaadin-router-go', this.__navigationEventHandler);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Casts between derived classes, performing a runtime typecheck and raising an exception if the cast fails. Allows casting to implemented interfaces, too.
function giCast(from_, to_) { var desc = from_.toString(); var clsName = null; for (var _i = 0, _a = desc.split(" "); _i < _a.length; _i++) { var k = _a[_i]; if (k.substring(0, 7) == "GIName:") { clsName = k.substring(7); break; } } var toName = to_.na...
[ "function cast(obj, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconstructor) {\n if ('_delegate' in obj) {\n // Unwrap Compat types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n obj = obj._delegate;\n }\n if (!(obj instanceof constructor)) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
in the constructor we provide SharedCompanyDataService for service and FormBuilder for form validation
function CreateCompanyComponent(_sharedDataService, _formBuilder) { this._sharedDataService = _sharedDataService; this._formBuilder = _formBuilder; this.companyAdd = new _Common_Company__WEBPACK_IMPORTED_MODULE_1__["Company"](0, "", "", ""); this.companyAdded = new _Common_Company__WEBPA...
[ "function UpdateCompanyComponent(_sharedDataService, _router, _route, _formBuilder) {\n this._sharedDataService = _sharedDataService;\n this._router = _router;\n this._route = _route;\n this._formBuilder = _formBuilder;\n this.companyUpdate = new _Common_Company__WEBPACK_IMPORTED_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the provider name from a callback path for access_token strategy
function getProviderToken(pathname) { var items = pathname.split("/"); var index = items.indexOf("token"); if (index > 0) { return items[index - 1]; } }
[ "function getProvider(pathname) {\n var items = pathname.split(\"/\");\n var index = items.indexOf(\"callback\");\n if (index > 0) {\n return items[index - 1];\n }\n }", "getUrlForProvider(provider, options) {\n const urlParams = [`provider=${encodeURIComponent(provider)}`];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chapter Common Achievements Load
function C999_Common_Achievements_Load() { LeaveIcon = ""; LeaveScreen = ""; C999_Common_Achievements_PrepareAchievements(); LoadInteractions(); StopTimer(7.6666667 * 60 * 60 * 1000); }
[ "function loadAll() {\n\t\t\tvar qlaa = \"select ExtraJSON from AccountAchievements\"\n\t\t\tqlaa += \" where AccountPermaId = @AccountPermaId\"\n\t\t\tqlaa += \" and AchievementId = @AchievementId and AwardedDate is not null\"\n\t\t\tpool.request()\n\t\t\t\t.input(\"AccountPermaId\", sql.Int, targetPermaId)\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rotate crop box when image is rotated
function crop_rotate_left(id) { // {x1: c.y1, y1: 1-c.x2, x2: c.y2, y3: 1-c.x1 } var x1, y1, x2, y2, c = ImageStore[id].crop; x1 = c.y1; y1 = 1 - c.x2; x2 = c.y2; y2 = 1 - c.x1; ImageStore[id].crop = {'x1': x1, 'y1': y1, 'x2': x2, 'y2': y2}; }
[ "function rotatePreview(amount)\n{\n $(\"#portrait_crop\").cropper('rotate', amount);\n}", "function crop_rotate_right(id)\n\t{\n\t\tvar x1, y1, x2, y2, c = ImageStore[id].crop;\n\t\t//\t{x1: 1-c.y2, y1: c.x1,\t x2: 1-c.y1, y2: c.x2}\n\t\tx1 = 1 - c.y2;\n\t\ty1 = c.x1;\n\t\tx2 = 1 - c.y1;\n\t\ty2 = c.x2;\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Post a message to the message handler to process in the future.
function postMessage(handler, msg) { getDispatcher(handler).postMessage(handler, msg); }
[ "function postMessage(handler, msg) {\n getDispatcher(handler).postMessage(msg);\n }", "function postMessage(handler, msg) {\n\t getDispatcher(handler).postMessage(handler, msg);\n\t}", "function postMessage(handler, msg) {\r\n\t MessageLoop.postMessage(handler, msg);\r\n\t}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pop marker, wayPoints, and address and validate if markers is empty
function validatePopMarker() { vm.markers.pop(); vm.wayPoints.pop(); vm.addresses.pop(); if (vm.markers.length === 0) { vm.origin = ''; vm.destination = ''; } vm.isLoading = false; }
[ "function popMarker() {\n if (vm.markers.length > 0) {\n var id = vm.markers[vm.markers.length - 1].id;\n removeMarker(id).finally(validatePopMarker);\n }\n }", "function clearMarkGPS() {\r\n if (markerGPS) {\r\n try {\r\n for (i in m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
const a = prompt('One of the last seen films?', ''), b = prompt('The mark of that film?', ''), c = prompt('One of the last seen films?', ''), d = prompt('The mark of that film?', ''); personalMovieDB.movies[a] = b; personalMovieDB.movies[c] = d; console.log(personalMovieDB); 1 avtomatizirovali ziklom
function rememberMyFilms() { for (let i = 0; i < 2; i++) { const a = prompt('One of the last seen films?', ''), b = prompt('The mark of that film?', ''); //null eto cancel. polizovateli ne najal knopku cancel a.lenght - kol-vo simvolov if (a != null && b != null && a != '' &&...
[ "function myFunction() {\n console.log(movieTitleinput.value, genreInput.value, directorInput.value);\n\n const movie = {\n title: movieTitleinput.value,\n genre: genreInput.value,\n director: directorInput.value,\n\n }\n\n movieDatabase.push(movie)\n console.log(movieDatabase)\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when there is a modeArg and the mode allow common mode arg CONVENTION: reserve uppercased letters for common mode arg
function commonModeArg( str , modeArg ) { for ( let [ , k , v ] of modeArg.matchAll( COMMON_MODE_ARG_FORMAT_REGEX ) ) { if ( k === 'L' ) { let width = unicode.width( str ) ; v = + v || 1 ; if ( width > v ) { str = unicode.truncateWidth( str , v - 1 ).trim() + '…' ; width = unicode.width( str ) ; ...
[ "function defineMode(name, mode) {\n\t\t if (arguments.length > 2)\n\t\t { mode.dependencies = Array.prototype.slice.call(arguments, 2); }\n\t\t modes[name] = mode;\n\t\t }", "function defineMode(name, mode) {\n if (arguments.length > 2)\n { mode.dependencies = Array.prototype.slice.call(argumen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the number of destination cities
static numberOfCities() { return destinationCities.length; }
[ "function calculateAgentNumberOfVisitedCity() {\n\tvar Ndata = data2.length;\n\t\n\t// Get number of agents form first data first element\n\tvar Nagent = data3[0][0].length;\n\t\n\t// Create array based on agent not repetion\n\tvar agentData = [];\n\t\n\tfor(var i = 0; i < Ndata; i++) {\n\t\t\n\t\tfor(var a = 0; a ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if one object is within a specified range of another NOTE: use Phaser.Point, Phaser.Sprite, or Actor
checkInRange(obj1, obj2, range) { return this.getDistance(obj1, obj2) <= range; }
[ "function inRange(thing1, thing2, range){\n return (Math.abs(thing1.x-thing2.x)<range) && (Math.abs(thing1.y-thing2.y)<range);\n}", "function inRange(objA, objB) {\n let dx = Math.abs(objA.x - objB.x);\n let dy = Math.abs(objA.y - objB.y);\n let total = dx + dy;\n \n if(total < 1) {\n return true;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compact an item in the layout.
function compactItem(compareWith /*: Layout*/ , l /*: LayoutItem*/ , verticalCompact /*: boolean*/ ) /*: LayoutItem*/ { if (verticalCompact) { // Move the element up as far as it can go without colliding. while (l.y > 0 && !getFirstCollision(compareWith, l)) { l.y--; } } // Move it down, and keep ...
[ "function compactItem(compareWith\n/*: Layout*/\n, l\n/*: LayoutItem*/\n, compactType\n/*: CompactType*/\n, cols\n/*: number*/\n, fullLayout\n/*: Layout*/\n)\n/*: LayoutItem*/\n{\n var compactV = compactType === \"vertical\";\n var compactH = compactType === \"horizontal\";\n\n if (compactV) {\n // Bottom 'y'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show: Scene 4 Hides Scene 3 Scene 4 should be from 20162020 showing monthly data
function setScene4() { xScales.domain(xTrump); yScales.domain(yMonth); d3.selectAll(".slide-info") .attr("class", "slide-info inactive") d3.selectAll("#slide4-1") .attr("class", "slide-info") d3.selectAll(".scene3") .transition() .duration(800) .style("opac...
[ "function hide_months() \n {\n var direction = vis.selectAll(\".months\").remove();\n }", "removeMonthOverview() {\n this.items.selectAll('.item-block-month').selectAll('.item-block-rect')\n .transition()\n .duration(this.settings.transition_duration)\n .ease(d3.easeLinear)\n .style(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find node in tree
function findNodeInTree(nodeInfo, node) { if(nodeInfo.node === node) { return nodeInfo; } for(var i=0; i<nodeInfo.childrenInfo.length; i++) { var info = findNodeInTree(nodeInfo.childrenInfo[i], node) if(info) { return info; } ...
[ "findNode(refNodeValue) {}", "find(node) {\n const recurse = n => {\n if (!n) return undefined;\n if (n.equals(node)) return n;\n return recurse(n.getNext());\n };\n return recurse(this.head);\n }", "function findNodeWithPath(path) {\n var foundNode;\n $sco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Take all of the user's attributes from the API response and copy them into a new dictionary.
function parseUser(user) { let newUser = {}; for(let k in user.data){ newUser[k] = user.data[k]; } return newUser; }
[ "processResponse(response) {\n response._items.forEach((user) => { this.userdata[user._id] = user; });\n return response;\n }", "function parseUserData(result) {\n console.log('common : parseUserdata '+result);\n\n var addresses = {};\n can.each(result['addresses'], function(address, index){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creating new atom via prompt
static create() { let name, muts, tag, attr cl(`Creating new atom. "Ctrl+c" to exit`.gray); rl.question(`Name » `.green, atomName => { name = atomName; rl.question(`Mutates » `.green, atomMutate => { muts = atomMutate.split(' '); rl.question(`Tag » `.green, atomTag => { tag = atomTag; ...
[ "function createIntern() {\n inquirer.prompt([\n {\n type: 'input',\n name: 'internName',\n message: 'What is the intern\\'s name?'\n // add validator ('You must enter xyz')\n },\n {\n type: 'input',\n name: 'internId',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates SocialActorInfo request body
createSocialActorInfoRequestBody(actorInfo) { return jsS({ "actor": Object.assign(metadata("SP.Social.SocialActorInfo"), { Id: null, }, actorInfo), }); }
[ "copyActorDetails(actorFromAPI) {\n let newActor = {};\n newActor.name = actorFromAPI.title;\n newActor.link = baseURL + \"name/\" + actorFromAPI.id;\n return newActor;\n }", "function requestInfo(callback) {\n var req = opensocial.newDataRequest();\n req.add(req.newFetchPersonReq...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ populate_list_from_xml() / take the xml arg and populate a select / list with options.
function populate_list_from_xml(xml, list_id){ var list = document.getElementById(list_id); list.options.length = 0; create_xml_doc(xml); var objects = xmlDoc.getElementsByTagName("object"); for(var i=0; i < objects.length; i++){ // note that objects[i].childNodes[0] // gives us the <id> node. the way the DOM ...
[ "function get_customer_cpe_fill_listbox (){\r\n $.post(\"/php/get_customer_cpe.php\").done(function(data){\r\n\t //alert(data);\r\n\t //Then analyse the xml, fill the customer listbox\r\n\t var xmlDoc = $.parseXML(data);\r\n\t $(xmlDoc).find(\"customer\").each( function () {\r\n\t \r\n\t\t va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the 'diseaseObj' state used to save data upon modal form submission Also update the gdmassociated disease object in the database
updateDiseaseObj(diseaseObj) { this.setState({diseaseObj: diseaseObj}, () => { let gdm = this.props.gdm; this.getRestData('/gdm/' + gdm.uuid).then(gdmObj => { let disease = gdmObj && gdmObj.disease; this.getRestData('/diseases/' + disease....
[ "updateDiseaseObj(diseaseObj) {\n this.setState({ diseaseObj: diseaseObj });\n }", "updateDiseaseObj(diseaseObj) {\n this.setState({diseaseObj: diseaseObj});\n }", "function updateDisease(diseaseReferenceKey) {\n appLogger.log(JSON.stringify($scope.disease));\n $scope.disease.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
2718 / Function: MV_SetVolume Sets the volume of digitized sound playback.
function MV_SetVolume(volume) { volume = Math.max(0, volume); volume = Math.min(volume, MV_MaxTotalVolume); MV_TotalVolume = volume; }
[ "setVolume(newVolume) {\r\n this.sound.setVolume(newVolume);\r\n }", "setAudioVolume(target, volume) {\n target = target === undefined ? 'speaker' : target;\n volume = volume === undefined ? 10 : volume;\n return this.apiCall('/sony/audio', 'setAudioVolume', '1.0', {target: target, volume: volume.toS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compiles given jsocs object producing a PropertyRuleSet object which is then used to validate the given value.
function validate(value, jsocs) { return compileJSOCSProperty(jsocs).validate(value); }
[ "function compile(jsocs) {\n\treturn compileJSOCSProperty(jsocs);\n}", "function PropertyRuleSet(name, id){\n this.name = name; //all properties must have a name, even if it's 'jsocs' and doesn't refer to an actual property\n this.id = id || null; //TODO - ensure it always start with '_'\n this.description = \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function : setBodyBackgroundColorWithTemp A function that sets the body background color with the temp parameter.
function setBodyBackgroundColorWithTemp ( temp ) { var color = "#cccccc"; if ( temp <= 3 ) color = "#a0c0c7"; else if ( temp <= 6 ) color = "#6ea9b6"; else if ( temp <= 9 ) color = "#4396a9"; else if ( temp <= 11 ) color = "#00acb8"; else if ( temp <= 21 ) color = "#75bd24"; else if ( temp <= 25 ) co...
[ "function updateBodyBackgroundColor() {\n const bodyEl = document.querySelector(\"body\");\n const randomColor = getRandomColor();\n bodyEl.style[\"background-color\"] = `${randomColor}`;\n}", "function updateBackgroundColor(color){\n bodyTag.style.backgroundColor = color;\n}", "function setBodyBackground...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the active shortcode snippet
setSnippet(snippet) { this.activeShortcode = snippet.split(' ')[0].replace('[', ''); this.activeSnippet = snippet; }
[ "function updateActiveSnippet() {\n let snippet = model.getSelectedSnippet();\n let row = model.getSnippetRow();\n\n $('#snippets-table tbody')\n .find('tr.selected')\n .removeClass('selected');\n\n $(row.node()).addClass('selected');\n let code = $('#snippet-frame')\n .find('cod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for allowing to enter only alphabet
function allowAlphabet() { if (!SignUp.name.value.match(/^[a-zA-Z]+$/) && SignUp.name.value !="") { SignUp.name.value=""; SignUp.name.focus(); alert("Prosze uzywać tylko liter"); } }
[ "function allowOnlyAlphabets(element){\r\n var content=element.value;\r\n var regex = /^[a-zA-Z]*$/;\r\n\r\n if (regex.test(content)){\r\n \r\n return true;\r\n } else {\r\n\r\n return false;\r\n }\r\n\r\n}", "function alp1(ele){\r\n\tvar val = ele.value;\r\n\tvar len = val.length;\r\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates an array of all work locations
function locationizer(work_obj) { var locationArray = []; for (var i = 0; i < work.jobs.length; i++) { var newLocation = work_obj.jobs[i].location; locationArray.push(newLocation); } return locationArray; }
[ "function locationizer(workObjt) {\n\tvar locations = [];\n\tfor (var job in workObjt.jobs) {\n\t\tlocations.push(workObjt.jobs[job].location);\n\t}\n\treturn locations;\n}", "function locationizer(work_obj) {\n var locArray = [];\n for (job in work_obj.jobs) {\n var newLocation = work_obj.jobs[job]....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mcarthur Grassland Fire Danger Index Mk5 takes into account fuel load
function MK5_GFDI(w,C,T,RH,U) { // compute moisture content (MC) var MC = (((97.7+(4.06*RH))/(T+6))-(0.00854*RH)+(3000/C)-30); // compute GFDI depending on MC if(MC<18.8) { return ((3.35*w)*(Math.exp((-0.0897*MC))+(0.0403*U))); } else { return ((0.299*w)*(Math.exp((-1.686*MC))+(0.040...
[ "getClbManagedSpeed(_cduPageEconRequest) {\n let flapsHandleIndex = Simplane.getFlapsHandleIndex();\n let flapLimitSpeed = Simplane.getFlapsLimitSpeed(this.aircraft, flapsHandleIndex);\n let alt = Simplane.getAltitude();\n let speedTrans = 10000;\n let speed = flapLimitSpeed - 5;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========================================================== SECCION DE FUNCIONES DE ANIMACION ========================================================== Animacion para la intro (Uso anime.js)
function animateIntro() { // Declarando las constantes para seleccion en el dom los elementos (La forma especifica de declarar es por la libreria, se declara con selectores de CSS) // Primera fila const boxTop = '.box-top .box'; // Segunda fila const boxMiddle = '.box-middle .box'; // Tercera fila const ...
[ "function introAnimation(){\n introTL\n .fromTo(heroImage, {opacity: 0, x: 20, y: -10, scale: 1.4}, {duration: 1, x: 0, y: 0, ease: Power4.easeInOut, opacity:1, scale: 1.3})\n .to(day, .9, {ease: Power4.easeInOut, y: 0}, \"sync-=.9\")\n .to(group1, .9, {y: -15, ease: Power4.easeInOut}, \"sync-=.9\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Patches a function on Element to fail an assertion if we use a namespaced name on it. We should use the namespaceaware versions instead.
function failTestsOnNamespacedElementOrAttributeNames() { const patchElementNamespaceFunction = (name) => { // eslint-disable-next-line no-restricted-syntax const real = Element.prototype[name]; /** @this {Element} @suppress {lintChecks} */ // eslint-disable-next-line no-restricted-syntax Element....
[ "_transformNamespacedFbtElement(node) {\n const {t} = this;\n\n switch (node.type) {\n case 'JSXElement':\n return this._toFbtNamespacedCall(node);\n case 'JSXText':\n return t.stringLiteral(normalizeSpaces(node.value));\n case 'JSXExpressionContainer':\n return t.stringLit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Purpose: It will show the master of all the commission types. Selected master will be displayed in the field passed as parameter. Parameter: objTextBox The field which will display the selected value. objDescription The field which will display the description.
function showCommissionTypes(objTextBox, objDescription) { objCommissionTypeInvokerTextBox = objTextBox; objCommissionTypeInvokerLabel = objDescription; openModalDialog('../popup/cm_commission_type_search_listing.htm',screen.width-50,'400'); return; }
[ "function showDesignations(objTextBox, objLabel)\r\n{\r\n objDesignationInvokerTextBox = objTextBox;\r\n objDesignationInvokerLabel = objLabel;\r\n openModalDialog('../popup/cm_designation_search_listing.htm',screen.width-50,'400');\r\n return;\r\n}", "function showChannelTypes(objTextBox, objLabel)\r\n{\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }