query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Move controls up in sequence
function moveControlsUp() { var selectedRows = mygrid.getCheckedRows(0); if(selectedRows!=null) { var selectedRowIndices = selectedRows.split(','); for(i=0;i<selectedRowIndices.length;i++) { mygrid.moveRowUp(selectedRowIndices[i]); } } updateCon...
[ "function up() {\n moveFocus(-1);\n }", "function up() {\n\t\t\tmoveFocus(-1);\n\t\t}", "function up() {\r\n\t\t\tmoveFocus(-1);\r\n\t\t}", "function repositionControls() {\n\t\tif(that.opt.responsive && nextBtn && prevBtn) {\n\t\t\tvar btnTop = (getHeight() / 2) - (nextBtn.offsetHeight / 2);\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the Pick List of Org Groups filtered out of the devices list (only OG's with a device will be shown) With help from
function ogPicker(){ var data = getDeviceData(); var str = JSON.stringify(data); //strip out the LocationGroupId Items var gidList = data.Devices.map(function(el) { return el.LocationGroupId; //filter the devices on OG's }); //get the list of atomic values var gidAtomic = {}; gidList.forEach( fun...
[ "function updateSelectableGroups() {\n var groupname = $groupSearchGroupName.val().toLowerCase();\n var name = $groupSearchName.val().toLowerCase();\n var source = $groupSearchSource.val().toLowerCase();\n var tag = canonicalizeTag($groupSearchTag.val());\n\n // reset filters\n selectableGroups = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the scroll height of the component based on an estimated average DOM item height and the total number of items.
updateScrollerSize_() { if (this.$.selector.items.length !== 0) { const estScrollHeight = this.items.length * this.domItemAverageHeight_(); this.$.items.style.height = estScrollHeight + 'px'; } }
[ "updateHeight_() {\n const estScrollHeight = this.items.length > 0 ?\n this.items.length * this.domItemAverageHeight_() :\n 0;\n this.$.container.style.height = estScrollHeight + 'px';\n }", "setHeight () {\n if (!this.props.list.length || !this.refs.item0) {\n return;\n }\n\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
randum number generator input: takes param limit to set random max, default is 1000 output: 'TimeInSecondsRandNum' invoke with: cdc_rand_num(50); or cdc_rand_num();
function cdc_rand_num(limit){ if (!limit) {limit = 1000}; var sNum = Math.floor(Math.random()*limit)+1; var sTime = (new Date).getTime(); var rNum = sTime+"-"+sNum; return rNum; }
[ "function randNumGen (limit) {\n var randNum = Math.floor((Math.random() * limit) + 1);\n return randNum;\n}", "function getRandNumber(limit){\n\treturn Math.floor(Math.random()*limit);\n}", "function randomNumberGenerator(upperLimit){\n return (Math.floor(Math.random()*upperLimit));\n}", "function r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a static match popup, locked in place, that only closes manually
function lockMatchPopup(match) { // Show match popup, and clone it showMatchPopup(match); // Create new popup & separate it from old var newPopup = $("#edgePopup").clone(); var newPopupId = 'edgePopupLocked' + popupGlobalCount; newPopup.attr({'id' : newPopupId}); newPopup.css('z-index', 10...
[ "function newMatchPopup(){\n $ionicPopup.confirm({\n title: '<b>New Match</b>',\n template: '<p class=\"text-center\">Another rider\\'s trip matches one of yours</p>',\n buttons: [\n {\n text: 'Close',\n type: 'button-default'\n },\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make sure add button always is the last
function check_add_last(list) { if(list.children('.list__add').is(":last-child")) { return; } else { list.children().last().insertBefore(list.children('.list__add')); } }
[ "function addAddButton(){\n $this.after('<a class=\"add-element\" href=\"#\"><span>'+ o.addText +'</span></a>');\n\n $(container).next('.add-element').bind('click', function(event){\n event.preventDefault();\n if(_canAddClone()){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes a task row for the archive
function makeArchivelistRow(id, task) { // get necessary data from the DOM const spoonTypes = $("body").data("spoonTypes"); const displayMode = $("body").data("displayMode"); const spoonEmojis = $("body").data("spoonEmoji"); // make a new row let newRow = makeTableRow("task"); // create and append the dif...
[ "function addTaskRow(table, task) {\n\t/** Create a delete button */\n\tfunction delbutn(id) {\n\t\treturn $(\"<button id='del_\" + id\n\t\t\t\t\t\t+ \"' title='Delete this archiving task.'>Del</button>\")\n\t\t\t.button({\n\t\t\t\ticons : {\n\t\t\t\t\tprimary : \"ui-icon-trash\"\n\t\t\t\t},\n\t\t\t\ttext : false\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a 3x3 block and a sudoku, returns true if it's a legal block
function isCorrectBlock(block,sudoku) { var rightSequence = new Array(1,2,3,4,5,6,7,8,9); var blockTemp= new Array(); for (var i=0; i<=8; i++) { blockTemp[i] = sudoku[Math.floor(block/3)*27+i%3+9*Math.floor(i/3)+3*(block%3)]; } blockTemp.sort(); return blockTemp.join() == rightSequence.join(); }
[ "function isPossibleBlock(number, block, sudoku) {\n for (var i = 0; i <= 8; i++) {\n if (\n sudoku[\n Math.floor(block / 3) * 27 +\n (i % 3) +\n 9 * Math.floor(i / 3) +\n 3 * (block % 3)\n ] == number\n ) {\n return false;\n }\n }\n return true;\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start the program on the brick
function runOnBrick() { if (!GUISTATE_C.isRobotConnected()) { MSG.displayMessage("POPUP_ROBOT_NOT_CONNECTED", "POPUP", ""); return; } else if (GUISTATE_C.robotState === 'busy' && GUISTATE_C.getConnection() === 'token') { MSG.displayMessage("POPUP_ROBOT_BUSY", "POPUP",...
[ "function launch() {}", "function runOnBrick() {\n if (userState.robotState === '' || userState.robotState === 'disconnected') {\n MSG.displayMessage(\"POPUP_ROBOT_NOT_CONNECTED\", \"POPUP\", \"\");\n return;\n } else if (userState.robotState === 'busy') {\n MSG.disp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the hover color for the text RGB of B type.
set HoverB(value) { this._hoverTextB = value; }
[ "get hoverTextColor() {\n return brushToString(this.i.b0);\n }", "get hoverTextColor() {\n return brushToString(this.i.s8);\n }", "get hoverTextColor() {\n return brushToString(this.i.db);\n }", "get hoverTextColor() {\n return brushToString(this.i.ds);\n }", "set Hov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate Purchase Orders by replicating from table
function replicatePurchaseOrders() { var body = ''; var maxPoId = ''; try { var conn = $.hdb.getConnection(); var query = 'SELECT MAX("PURCHASEORDERID") AS MAXID FROM "sap.hana.democontent.epmNext.data::PO.Header"'; var rs = conn.executeQuery(query); for(var i = 0; i < rs.len...
[ "function povoateTable(){\n if (all_orders != []) {\n all_orders.forEach(_order => {\n appendOrder(_order);\n });\n }\n}", "function prepOrder() {\r\n\tlet d = new Date();\r\n\tlet myDate = (d.getDate() < 10 ? '0' : '') + d.getDate();\r\n\tlet myMonth = (d.getMonth() < 10 ? '0' : '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add custom operations to the menu's operations list
_handleCustomOperations() { const that = this; that._filterOperationDescriptions = that._defaultFilterOperationDescriptions; for (let i = 0; i < that.customOperations.length; i++) { const operation = that.customOperations[i]; that._filterOperationDescriptions.push({ ...
[ "_handleCustomOperations() {\n const that = this;\n\n that._filterOperationDescriptions = that._defaultFilterOperationDescriptions.slice(0);\n\n for (let i = 0; i < that.customOperations.length; i++) {\n const operation = that.customOperations[i];\n\n that._filterOperation...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a string representation of this morph, with the amount value represented restricted to four fractional digits.
asText4() { return this._makeText(`${this.amount.toFixed(4)}`); }
[ "transform(value) {\n return value.toFixed(4);\n }", "getFormatedAmount() {\n const entity = this.props.entity;\n return currency(entity.wire_threshold.min, entity.wire_threshold.type, 'suffix');\n }", "displayAmount(amount){\n var parts = amount.toString().split(\".\");\n parts[0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fills the textarea with content from the localstorage at page load When the popup is on focus
function fillTextarea(){ Storage.get('text', function(items){ if(items.text && !chrome.runtime.lastError){ var val = items.text.trim(); if(val !== ''){ //this makes the textarea focus on the first line ...
[ "function fillTextarea(){\r\n\r\n Storage.get('text', function(items){\r\n if(items.text && !chrome.runtime.lastError){\r\n var val = items.text.trim();\r\n\r\n if(val !== ''){\r\n //this makes the textarea focus on the first lin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrieve all of the figure elements within the section element using the id of carousel. Return the resulting array as the result of this function.
function getFigures() { return document.getElementById('carousel').getElementsByTagName('figure'); }
[ "function allSlides() {\n return document.querySelectorAll('#wrapper .slide');\n}", "getSliderImages(id)\n {\n for (let [key, value] of this.articleSliders.entries())\n {\n if(value.id === id)\n {\n return value.images;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
listeners for select dropdowns; call fns in songfilter.js
function viewSelectFilterHandlers() { $(document).on('change', '#artist-select', function() { filter.filterArtist( $('#artist-select').val() ); }); $(document).on('change', '#album-select', function() { filter.filterAlbum( $('#album-select').val() ); }); }
[ "function _changeListener(){\r\n\t//update drug filters\r\n\t_filterByDropDown();\r\n\r\n}", "function setListenerToSelects() {\n $(\"#formEditSong select[name='artists[]']\").on('change', function() {\n updateSelectAlbums()\n });\n}", "function addDropDownSelectListeners() {\n\n\t$('#select_landow...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Application 3 Simple Crap Game (Dice game based on luck)
function crap() { var bet=document.getElementById('dice').value; var dice1 = Math.floor(Math.random() * 6) + 1; var dice2 = Math.floor(Math.random() * 6) + 1; var total=dice1+dice2; document.images[2].src="img/dice_" + dice1 + ".gif"; document.images[3].src="img/dice_" + dice2 + ".gif"; if (total==7 || to...
[ "function playCraps(){\n //game started\n console.log(\"Craps game initated\");\n // dice rolling function giving you six sides of adice or numbers 1-6 on die1\n var die1 = Math.ceil(Math.random()*6);\n // dice rolling function giving you six sides of adice or numbers 1-6 on die2\n var die2 = Math.ce...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by LUFileParserentityListBody.
exitEntityListBody(ctx) { }
[ "exitNewEntityListbody(ctx) {\n\t}", "exitEntityDefinition(ctx) {\n\t}", "exitEntityDeclaration(ctx) {\n\t}", "exitNewEntityLine(ctx) {\n\t}", "exitNewEntityDefinition(ctx) {\n\t}", "exitType_body_elements(ctx) {\n\t}", "exitNestedEntityMapping(ctx) {\n\t}", "visitNewEntityListbody(ctx) {\n\t return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method resets players headers by removing active css class and setting default css class
resetPlayersHeader() { for (let player of this.players) { player.playerHTMLHeader.className = 'players'; } }
[ "function resetHeaders() {\n $headers.forEach(header => header.classList.remove('card-active'));\n}", "function changePlayerHeader () {\n\tif (playerNetflix.classList.contains('your-turn') === true) {\n\t\tdocument.querySelector('.netflix').style.fontSize = '60px';\n\t\tdocument.querySelector('.netflix').style...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a flattened version of the test suite, setting the URL of each test on the fly.
async function get_tests(file_name, prefix) { const process_doc_tests = (doc_test) => { const base = `${file_name.split('/').slice(0, -1).join('/')}/`; doc_test.tests.forEach((section_tests) => { section_tests.tests.forEach((test) => { test.url = (test['media-type'] && te...
[ "function buildSuite( tests ) {\n\t\t\tvar suite, i, j,\n\t\t\t\tlvlOneCount = 0,\n\t\t\t\tlvlOneId = null,\n\t\t\t\tisTestCase = true,\n\t\t\t\tprocessedTests = {},\n\t\t\t\t// Those members are \"special\" - not tests functions or suites.\n\t\t\t\tspecialMembers = {};\n\n\t\t\tfor ( i in tests ) {\n\t\t\t\tif ( t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check for an ack response
async waitAck() { // Read the ack byte let ack = await this.readWait(1); // If not an ack, read to eol for an error message if (ack[0] != 6) { let err = await this.readToEOL(); throw new Error(`No ack - ${err}`); } }
[ "function isACK(msg)\n{\n return msg == ACK_HEADER;\n}", "ackResponse(ack) {\n const toTag = ack.toTag;\n if (!toTag) {\n throw new Error(\"To tag undefined.\");\n }\n const id = \"z9hG4bK\" + Math.floor(Math.random() * 10000000);\n ack.setViaHeader(id, this.transp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds pp constraints between the given hairs and object spheres
addHairObjectCollision(obj_pearls, hairs) { for (let i = 0; i < obj_pearls.length; i++) { for (let j = 0; j < hairs.length; j++) { let parts = hairs[j].verlet_parts; for (let k = 1; k < parts.length; k++) { this.add(new PearlPearlConstraint(obj_pearls[i], parts[k])); } ...
[ "function addConstraint(lp, u, v) {\n var r = repeat(lp.n, 0);\n r[u] = 1;\n r[v] = -1;\n lp.A.push(r);\n lp.b.push(-lp.mincost);\n}", "addConstraints(constraints)\n {\n for(let key in constraints) {\n let constraint = constraints[key];\n this.addConstraint(key, constraint);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `S3KeyFilterProperty`
function CfnFunction_S3KeyFilterPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); errors.collect(cdk.propertyValidator('rules', cdk.requiredValidator)(properties.rules)); errors.collect(cdk.property...
[ "function CfnBucket_S3KeyFilterPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('rules', cdk.requiredValidator)(properties.rules));\n errors.collect(cdk...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
open video gallery iphone
function showIphoneGallery() { disableScreenLock(true); $.uploadProg.setMessage('Upload Progress.'); $.uploadProg.setValue(0); $.labelUpload.setText('No selected vedeo !'); Ti.Media.openPhotoGallery({ allowEditing: true, mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO], success:function(event) { disabl...
[ "function seeVideo() {\n console.log(details.video)\n window.open(`media/${details.video}`).focus();\n }", "function open_video(url){\n\tvideo_to_open = url;\n\tgoToVideo();\n}", "function seeVideo() {\n console.log(currentOrder.video)\n window.open(`media/${currentOrder.video}`)....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PostCss Postprocessing of CSS files on /assets/css directory to assets/css
function postCss() { var options = [ $.autoprefixer({browsers: ['last 3 version']}), $.cssnano({ discardUnused: { keyframes: false }, discardComments: { removeAll: true }, reduceIdents: { keyf...
[ "function css() {\n var postcssPlugins = [\n // import CSS files using @import\n plugin.easyImport(),\n // PostCSS plugin converts modern CSS to polyfills\n // based on browser support in .browserslistrc \n plugin.cssPresentEnv({ stage: 1 }),\n // re-order declartions based on property\n plugi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize a shape of a particular type (CUBE/L/INVERTEDL/PLUS/STICK/LEFTZ/RIGHTZ) and any nonzero color. Color of zero is used internally to represent a block which should NOT be displayed.
function Shape(type, color) { var arr = []; if (type == CUBE) { // Form a matrix of the form 1 1 // 1 1 arr.push([]); arr[0].push(new Array(2)); arr[0][0] = color; arr[0][1] = color; arr.push([]); arr[1].push(new Array(2)); ...
[ "function initShapeType() {\n setShapeType(\"None\")\n}", "function L_Shape(center) {\n // ZURE KODEA HEMEN: L_Shape programatzeko hartu adibide gisa I_Shape klaseko kodea\n var coords = [new Point(center.x - 1, center.y),\n new Point(center.x , center.y),\n new Point...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method: versionBoilerplateTestWpRoot Parent: version the root (WordPress) file. Parameters: (string) inputPath Path to wpdtrtpluginboilerplate/ (string) outputPath Path to wpdtrtpluginboilerplate/ output directory (object) packageBoilerplate A reference to the package.json file Returns: (array) src files Output: ./test...
function versionBoilerplateTestWpRoot( inputPath, outputPath, packageBoilerplate ) { const files = `${inputPath}tests/generated-plugin/wpdtrt-test.php`; const { version } = packageBoilerplate; const re1 = new RegExp( /(\* Version:\s+)([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/ ); const...
[ "function versionGeneratedPluginWpRoot(\n inputPath,\n outputPath,\n packageRoot\n ) {\n const { name, version } = packageRoot;\n const files = `${inputPath}${name}.php`;\n const re1 = new RegExp(\n /(\\* Version:\\s+)([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3})/\n );\n const re2 = new RegEx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
func to process the rules file
function processRules(allText) { var allTextLines = allText.split(/\r\n|\n/); var headers = allTextLines[0].split(','); for (var i=1; i<allTextLines.length; i++) { var data = allTextLines[i].split(','); if (data.length == headers.length) { var ruleMap = new Map(); fo...
[ "function processDetectionRules(rules, ctx, cb) {\n // filename property of detection rules can be a function\n var processedRules = []\n var f = []\n rules.forEach(function(rule) {\n if (rule.filename && typeof(rule.filename) == 'function') {\n f.push(function(cb) {\n rule.filename(ctx, function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes sur that the map is refreshed and positioned correctly
function refreshMapPosition() { //alert("on Map"); roeMapCarbon.resize(); roeMapCarbon.reposition(); }
[ "function refreshMapPosition() {\n //alert(\"on Map\");\n roeMapTNit.resize();\n roeMapTNit.reposition();\n }", "function updateMap() {\n //Anything else should be handled by pre and postdraw functions\n ms.draw();\n }", "function onRefresh(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolves the componentFactory for the given component, waits for asynchronous initializers and bootstraps the component. Requires a platform the be created first.
function coreLoadAndBootstrap(injector, componentType) { var appRef = injector.get(ApplicationRef); return appRef.run(function () { var componentResolver = injector.get(component_resolver_1.ComponentResolver); return async_1.PromiseWrapper.all([componentResolver.resolveComponent(componentType), ...
[ "function coreLoadAndBootstrap(injector, componentType) {\n var appRef = injector.get(ApplicationRef);\n return appRef.run(function () {\n var componentResolver = injector.get(ComponentResolver);\n return PromiseWrapper\n .all([componentResolver.resolveComponent(co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create toggleCheckedOutStatus method to reverse isCheckout's value to original.
toggleCheckedOutStatus() { this._isCheckedOut = !this._isCheckedOut; }
[ "toggleCheckOutStatus() {\n //negate the value saved to a boolean.\n // using the getter \n this.isCheckedOut = !this.isCheckedOut;\n }", "toggleCheckOutStatus() {\n this._isCheckedOut = !this._isCheckedOut;\n }", "toggleCheckOutStatus() {\n this._isCheckedOut = !this._isCheck...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set layout on screen load ? Comment it if you don't want to sync layout with local db setLayout(currentLocalStorageLayout);
function setLayout(currentLocalStorageLayout) { var navLinkStyle = $('.nav-link-style'), currentLayout = getCurrentLayout(), mainMenu = $('.main-menu'), navbar = $('.header-navbar'), // Witch to local storage layout if we have else current layout switchToLayout = currentLocalStor...
[ "loadLayout(savedLayout) {\n this.setLayout(DockLayout.loadLayoutData(savedLayout, this.props, this._ref.offsetWidth, this._ref.offsetHeight));\n }", "function setLayout(layout) {\n dashboardService.populateCustomLayouts(userId, currentActiveTab, layout, dashboardName);\n makeActive(currentActiveT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads the Node fs promises API. Needed because on Node 10.17 and below, fs.promises is experimental, and therefore not marked as enumerable. That means when TypeScript compiles an `import('fs')`, its helper doesn't spot the promises declaration and therefore on Node <10.17 you get an error as fs.promises is undefined i...
async function importFSModule() { if (!environment_js_1.isNode) { throw new Error('Cannot load the fs module API outside of Node.'); } const fs = await Promise.resolve().then(() => __importStar(require('fs'))); if (fs.promises) { return fs; } return fs.default; }
[ "function promisify(fn) {\n return function(...args) {\n return new Promise((resolve, reject) => {\n fs(...args, function(err, data) {\n if(err) reject(err);\n resolve(data);\n });\n })\n }\n}", "function priomisifyFs(path){\n //new Promise is an API already given\n\n //names...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes the reward balance in ETH of the operator of a pool.
computeRewardBalanceOfOperator(poolId) { const self = this; assert_1.assert.isString('poolId', poolId); const functionSignature = 'computeRewardBalanceOfOperator(bytes32)'; return { callAsync(callData = {}, defaultBlock) { return __awaiter(this, void 0, void 0...
[ "function btcReward() {\n requestify.get('https://blockchain.info/q/bcperblock')\n .then(function(response) {\n answer.reward = response.getBody();\n // answer.reward = Number(answer.reward) / 100000000;\n answer.reward = Number(answer.reward);\n btcDollar();\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fromArray :: Array > Game
function fromArray(arr) { var game = {}; iterateArray(arr, function fromArrayIterator(cell) { var newCell = createCell(getX(cell), getY(cell), true); game[cellId(newCell)] = newCell; }); return game; }
[ "function newGame() {\n togloom(arr)\n}", "static from (value) {\n let arr = new MyArray();\n for (let i = 0; i < value.length; i++) {\n arr.pushTo(value[i]);\n }\n return arr;\n }", "fromArray(array) {\n const isMultidimensional = Object(_util_TypeCheck__...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get shape for densely packed RGBA texture.
function getDenseTexShape(shape) { var size = util.sizeFromShape(shape); var texelsNeeded = Math.ceil(size / 4); return util.sizeToSquarishShape(texelsNeeded); }
[ "get textureShape() {}", "get ASTC_RGBA_4x4() {}", "get RGBAHalf() {}", "function getDenseTexShape(shape) {\n var size = tf.util.sizeFromShape(shape);\n var texelsNeeded = Math.ceil(size / 4);\n return tf.util.sizeToSquarishShape(texelsNeeded);\n}", "get ASTC_RGBA_6x6() {}", "get ASTC_RGBA_8x8() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion para mostrar todas las tareas
function mostrarTodasTareas(arrayTareas) { ul.innerHTML = ''; for (tarea of arrayTareas) { mostrarTarea(tarea); } eventoBotones(); }
[ "function consultarTareas() {\r\n const settings = {\r\n method: 'GET',\r\n headers: {\r\n authorization: token\r\n }\r\n };\r\n console.log(\"Consultando mis tareas\");\r\n fetch(urlTareas, settings)\r\n .then(response => response.json())\r\n .then(tareas => {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[android] request enable of bluetooth from user
requestEnable() { BluetoothSerial.requestEnable() .then(res => { if (res) { this.setState({ isEnabled: true }); SplashScreen.hide(); if (!this.state.connected) { this.discoverUnpaired(); ...
[ "requestEnable() {\n BluetoothSerial.requestEnable()\n .then((res) => this.setState({isEnabled: true}))\n .catch((err) => ToastAndroid.show(err.message, ToastAndroid.SHORT))\n }", "requestEnable () {\n BluetoothSerial.requestEnable()\n .then((res) => this.setState...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render the board accoring to state of cells in STATE
renderBoard() { const renderedBoard = []; for(let i = 0; i < this.props.totalRows; i++) { const renderedRow = []; for(let j = 0; j < this.props.totalColumns; j++) { const coordinates = `${i}-${j}` renderedRow.push(<td key={j}><Cell key={coordinates...
[ "function drawBoard(state) {\n console.log(\" 1 2 3\");\n\n state.forEach(function(row, index) {\n console.log(\" ~~~~~~~~~~~~~\");\n console.log((index + 1) + \" | \" + row.join(\" | \"));\n });\n}", "function render() {\n board.forEach(function(move, index) {\n if (move === 1) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
12 Compute Sum Between
function computeSumBetween(num1, num2) { var rangeArray = []; var sumResult = 0; if (num1 < num2) { for (var i = num1; i < num2; i++) { rangeArray.push(i); } for (var i = 0; i < rangeArray.length; i++) { sumResult += rangeArray[i]; } return sumResult; } else { return 0; ...
[ "function teenSum(a, b){\n if (a >= 13 && a <= 19 || b >= 13 && b <= 19)\n return 19;\n else\n return a + b;\n}", "function sumBetween(start, end) {\n //Write your code here\n}", "function sumRange(a,b){\nif (a+b>50 && a+b<80){\n return 65\n}else{\n return 80\n}\n}", "function computeSu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the focus on the buttonicon. If the trigger is focus, it toggles the menu visibility.
focusOnButton() { this.allowBlur(); this.template.querySelector('lightning-button-icon').focus(); if ( this._triggers === 'focus' && !this.popoverVisible && !this._disabled ) { this.toggleMenuVisibility(); } }
[ "function focusOpenButton() {\n setupOpenIconNode.focus();\n }", "@api\n focus() {\n this.focusOnButton();\n }", "onFocusButton() {\n setTimeout(() => {\n if (this.toggleButton.current) {\n this.toggleButton.current.focus();\n }\n }, 0);\n }", "focus() {\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert icons to sorted array
function sortIcons(icons) { const sortedIcons = []; Object.keys(icons) .sort((a, b) => a.localeCompare(b)) .forEach((name) => { sortedIcons.push(icons[name]); }); return sortedIcons; }
[ "function sortIcons() {\n if ($scope.searchIcon == \"\") {\n $scope.allIcons = $scope.saveIcons;\n return;\n }\n\n if ($scope.searchIcon.length < 3) {\n return;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dummy request from locationsService. Will wait 2 seconds before returning data. Expand LocationsService class to get data from a server in the future.
getLocations() { this.locationsService = locations_service_1.LocationsService.getLocationsSlowly() .then(locations => this.unmodifiedLocations = locations); }
[ "async getLocations () {\n if (!API_URL || !API_KEY) {\n console.error('Missing API_URL or API_KEY');\n throw new BadGatewayError();\n }\n\n // We could do some proper request mapping here but\n const response = await rp(`${API_URL}?key=${API_KEY}&location=${this.currentLocation.latitude},${th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get bio return: A String object representing the bio the User created.
get bio() { return this._bio || User.defaults.bio; }
[ "get bio() {\n return this._data.bio;\n }", "getUserBio(state) {\n return state.userBio;\n }", "getBio() {\n return `${this.firstName} ${this.lastName} is a(n) ${this.position}.`\n }", "function bioInfo(bio) {\n const userTitle = document.querySelector('.user-title');\n const tit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the number of bytes the given Javascript string takes if encoded as a UTF16 byte array, EXCLUDING the null terminator byte.
function lengthBytesUTF16(str) { return str.length*2; }
[ "function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);}// Returns the number of bytes the given Javascript string takes if encoded as a UTF8 byte array, EXCLUDING the null terminator byte.", "function utf8sizeof(string) {\n /* JavaScript uses UCS-2, not ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
My name is Guy and my age is 25. destructuring in a function with default param function accepts an object if object doesn't have the key 'name', name is set to 'Garry'
function say({ age, name = 'Garry' }) { console.log(`My name is ${name} and my age is ${age}.`); }
[ "function dogBreeder(name = 'Steve',age = 0){ \n if(typeof name === 'number'){\n age = name;\n name = 'Steve';\n }\n\n return {name,age};\n}", "function destru({name,planet, star = \"sol\"}= personObj){\n console.log(\"declare a varibale within destructuring\", name , planet, star);\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a randomly chosen verb from the dictionary.
static getRandomVerb() { return new Verb(VERBS[Math.floor(Math.random() * selectedDifficulty)]); }
[ "chooseRandomVerb() {\n const verbList = this.props.getVerbList();\n\n // Choose a random verb from the whole database if the verb list is empty\n if (verbList.length <= 0) {\n let randomKey = Lefff[verbs[verbs.length * Math.random() << 0]];\n\n // Prevent selecting verbs ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Obtem o total dos precos dos skus em forma de uma string em formato PTBR.
function GerenciadorAcessorios_GetPrecoTotalAsString() { var totalFloat = this.getPrecoTotal(); var totalString = "" + totalFloat; // faz um split pela virgula. var totalSplited = totalString.split("."); var inteiroString = "0"; if (totalSplited.length > 0) { inteiroString = total...
[ "function getPrice() {\n if (result.Prijs.Koopprijs && !result.Prijs.Huurprijs) {\n return '<strong>€ ' + numberWithPeriods(result.Prijs.Koopprijs) + ' <abbr title=\"Kosten Koper\">k.k.</abbr></strong>';\n } else {\n return '<strong>€ ' + numberWit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the last token location
get lastTokenLocation() { return this.state.lastTokenLocation; }
[ "getLastToken() {\r\n const lastToken = this.compilerNode.getLastToken(this._sourceFile.compilerNode);\r\n if (lastToken == null)\r\n throw new errors.NotImplementedError(\"Not implemented scenario where the last token does not exist.\");\r\n return this._getNodeFromCompilerNode(last...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get time value for a point event.
function getPointTime(point, startTime, duration, timeMappingOptions, propMetrics, useSeriesExtremes) { var time = getParamValWithDefault({ point: point, time: 0 }, propMetrics, useSeriesExtremes, timeMappingOptions, 0, { min: 0, ...
[ "function getTime() {\r\n return loc.x;\r\n }", "get(time) {\n const event = this._timeline.get(time);\n\n if (event) {\n return event.value;\n } else {\n return this._initialValue;\n }\n }", "function eventTime(e) {\n // In gecko, synthetic events seem to be in microseconds ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find all calendars for a specified level in the folder hierarchy This method returns all the calendars of the current folder and all parent folders
getFolderCalendars(folderId, sort, page, pageSize) { const params = new Array(); if (folderId != null) { params.push(`folderId=${folderId}`); } if (sort != null) { params.push(`sort=${sort}`); } if (page != null) { params.push(`page=${p...
[ "async getCalendars() {\n const resp = await Q.nfcall(gcal.calendarList.list, {\n auth: this.oauth.client\n });\n const data = resp[0];\n return data.items;\n }", "function listCalendars(){\n let request = gapi.client.calendar.calendarList.list();\n\n request.execute(function(resp)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by LUFileParserregexEntityIdentifier.
exitRegexEntityIdentifier(ctx) { }
[ "exitNestedExpressionAtom(ctx) {\n\t}", "exitParse(ctx) {\n\t}", "exitNewRegexDefinition(ctx) {\n\t}", "exitId_expression(ctx) {\n\t}", "exitModel_expression_element(ctx) {\n\t}", "exitBinaryExpressionAtom(ctx) {\n\t}", "exitRelationalExpression(ctx) {\n\t}", "exitUnaryExpressionAtom(ctx) {\n\t}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles keydown events throughout the menu for proper menu use.
handleKeydown() { super.handleKeydown(); this.dom.menu.addEventListener("keydown", event => { this.currentEvent = "keyboard"; const key = keyPress(event); if (key === "Tab") { // Hitting Tab: // - Moves focus out of the menu. if (this.elements.rootMenu.focusState !==...
[ "handleKeydown() {\n super.handleKeydown();\n\n this.dom.menu.addEventListener(\"keydown\", event => {\n this.currentEvent = \"keyboard\";\n\n const key = keyPress(event);\n\n // Prevent default event actions if we're handling the keyup event.\n if (this.focusState === \"self\") {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy file stream function. Returns an Observable.
function copyStream(source, target) { return Rx.Observable.create(function (observable) { fs.copy(source, target, function (err) { if (err) { return observable.error(err); } observable.next(); observable.complete(); }) }); }
[ "copyFile(from, to) {\n fs.createReadStream(from).pipe(fs.createWriteStream(to));\n }", "function copyResource() {\n return src(paths.resources)\n .pipe(dest(paths.dist));\n}", "function copyFile(src, dest) {\r\n let readStream = fs.createReadStream(src);\r\n readStream.once('error', (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We distribute some number of candies, to a row of n = num_people people in the following way: We then give 1 candy to the first person, 2 candies to the second person, and so on until we give n candies to the last person. Then, we go back to the start of the row, giving n + 1 candies to the first person, n + 2 candies ...
function solution_1 (candies, num_people) { const output = Array(num_people).fill(0); let i = 0; // tracks which person you are giving candy to let n = 1; // tracks the current number of candies being given out (if no shortage) while (candies...
[ "function distributeCandies(candies, num_people) {\n let arr = new Array(num_people).fill(0)\n let current = 1\n\n while(candies) {\n for (let i = 0; i < num_people; i++) {\n arr[i] += current\n candies -= current\n if (candies <= 0) {\n arr[i] += candies\n return arr\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validates if at least one bend is selected in any storage unit
function validateSelectedBands(){ //const storage_names = Object.keys(storage_selection); count = 0; for(name in storage_selection){ select = storage_selection[name]; count += select.selectedOptions.length; console.log('storage_name',name,'select',select,'selected_b...
[ "function existBases () {\n var listaPuntosRuta = document.getElementById(\"listaPuntosRuta\");\n \n var size = listaPuntosRuta.options.length;\n \n var baseSalidaOpt = listaPuntosRuta.options[0].value;\n var baseLlegadaOpt = listaPuntosRuta.options[size-1].value;\n\n if (baseSalidaOpt.split(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6. Use the Instructors array and find all that teach JavaScript, then sort them alphabetically
function alphaInstructors (arr){ var jsInstructors = arr.filter(function(instructor){ return instructor['teaches'] === 'JavaScript'; }).map(function(instructor){ return instructor.firstname; }) return jsInstructors.sort(); }
[ "function instructorsTeach () {\n var instructorsJS = [];\n\n for ( var i = 0; i < instructors.length; i++) {\n if (instructors[i].teaches === 'JavaScript') {\n instructorsJS.push(instructors[i].firstname.toUpperCase());\n }\n }\n return instructorsJS.sort();\n}", "function findInstructor() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Destroys the weather card
destroyWeatherCard() { this.parent.removeChild(this.card); console.log("removed"); }
[ "function destroy() {\n Board.endBoard();\n}", "function destroy() {\n body.removeChild($smartBanner);\n body.removeChild($placeholder);\n $smartBanner = $smartBannerWrap = $placeholder = null;\n }", "close() {\n this.card.close();\n }", "destroy() {\n if (!this._lottie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE This function is responsible for updating the DOM with the current cheese count
function update() { document.getElementById('cheese-Count').innerText = cheese.toString(); drawPerClickStat(); }
[ "function refreshCounter() {\n $(\".seatsAmount\").text($(\".seatSelected\").length); \n }", "function refreshCounter() {\n $(\".seatsAmount\").text($(\".seatSelected\").length); \n\n }", "function updateCounter() {\n $('#cart-counter').first().text($('.cart-item').length);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detects if the current device is an iPhone.
function DetectIphone() { if (uagent.search(deviceIphone) > -1) { //The iPod touch says it's an iPhone! So let's disambiguate. if (uagent.search(deviceIpod) > -1) return false; else return true; } else return false; }
[ "function isIphone() {\n \t\treturn !!navigator.userAgent.match(/iPhone/i);\n\t}", "function checkIfIOSApp() {\n return app.device.iphone && iscordova;\n}", "function DetectIphoneOrIpod()\n{\n //We repeat the searches here because some iPods \n // may report themselves as an iPhone, which is ok.\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
upload data to webGL, add free buffer data
upload(){ this._compile(); let buffer = new Float32Array(this._bufferData); exports.gl.bindBuffer(exports.gl.ARRAY_BUFFER, this._vbo); exports.gl.bufferData(exports.gl.ARRAY_BUFFER, buffer, exports.gl.STATIC_DRAW); exports.gl.bindBuffer(exports.gl.ARRAY_BUFF...
[ "upload(){\n this._compile();\n\n let buffer = new Float32Array(this._bufferData);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this._vbo);\n gl.bufferData(gl.ARRAY_BUFFER, buffer, gl.STATIC_DRAW);\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\n \n this._bufferData = null;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Service call functions for get or update or create Invoice details
function getInvoice(id) { // var obj = {clinicId: id}; // var dataObj = $.param(obj); var serviceCall = commonService.GetAll(url+'invoices/get?clinicId='+id+'&type='+'list'); var deferred = $q.defer(); serviceCall .success(function(data)...
[ "function invoicePurchaseOrder(req, res){\n // Only admins should be allowed to perform this operation\n lConst = lConst || this.serviceManager.get(\"lic\").lib.Const;\n if( ! ( ( req.user.role === lConst.role.admin ) || ( req.user.role === lConst.role.reseller ) ) ) {\n this.requestUtil.errorRespon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display bottom float menu
function floatMenuBottom(){ var $footer = $("#footer"); var $block = $("#float-menu-bottom"); var $body = $block.find(".float-menu-body"); var $button = $block.find(".float-menu-toggle"); var maxBottomPanelOpacity = getMaxBottomPanelOpacity(); $todo = $(".todo-container"); va...
[ "function menuBottom(){\r\n\t\tmenu_bottom=$(\".avoid_jump\").offset().top;\r\n\t\tcurrent_menu_height=($(\".menu\").outerHeight());\r\n\t\t$(\".avoid_jump\").css({\"height\":current_menu_height+\"px\"});\r\n\t}", "function showBottomContent (menu){\r\n if(menu==dojo.byId('selectedViewMenu').value)return;\r\n m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get default competition membershipproduct tab details
function getDefaultCompFeesMembershipProductTabAction(hasRegistration, yearRefId) { return { type: ApiConstants.API_GET_DEFAULT_COMPETITION_FEES_MEMBERSHIP_PRODUCT_LOAD, hasRegistration, yearRefId, }; }
[ "async getDefaultCompFeesMembershipProduct() {\n let orgItem = await getOrganisationData();\n let organisationUniqueKey = orgItem ? orgItem.organisationUniqueKey : 1;\n var url = `/api/competitionfee/membershipdetails?organisationUniqueKey=${organisationUniqueKey}`;\n return Method.dataGet(url, token);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setupOverlay() initiate animation attributes
function setupOverlay() { objHeight = height + height / 2; // outside of the screen objInPosition = false; objMoveAway = false; }
[ "init () {\n this.createOverlay()\n\n this.overlay.addEventListener('mousemove', event => {\n this.animate(this.getOffset(event).x, this.getOffset(event).y)\n })\n }", "function OverlayEffect() {\n }", "constructor() {\n //this.overlay = overlay;\n }", "enterOverlayMode() {}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ListModel / createListModel() Creates a new instance of a ListModel, applying the configuration properties (if any). The config parameter may contain the following properties: items (array of objects) the model objects
function createListModel(config) { var model = Object.create(ListModel); var idx; var item; apply(config, model); model = makeEventSource(model); //provide default empty items array if //nothing was specified in the config model.items = model.items || []; model.buildIndex(); ...
[ "function createListItemModel(config){\n\tvar listItemModel = Object.create(ListItem);\n\tapply(config, listItemModel);\n\tlistItemModel.updateTotalPrice();\n\treturn makeEventSource(listItemModel);\n}", "function ListModel(items) {\n\tthis.items = items;\n\tthis.selectedindex = -1;\n\n\tthis.itemAdded = new Even...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check allow number only (except ESC, ENTER, ...)
function checkAllowNumber(e) { var code = (e.which) ? e.which : e.keyCode; if ((code < 48 || code > 57) && code != 8 && code != 13 && code != 27 && code != 0 && code != 46 && (code < 37 || code > 40)) { return false; } return true; }
[ "function checkAllowNumber(e) {\r\n var code = (e.which) ? e.which : e.keyCode; \r\n if ((code < 48 || code > 57) && code != 8 && code != 13 && code != 27 && code != 0 && code != 46 && (code < 37 || code > 40)) {\r\n return false;\r\n }\r\n return true;\r\n}", "function onlyAllowNumber(event...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Snap the offset to the screen width (page width).
function snapOffset(offset) { var value = offset + 1; return value - (value % maxScreenX); }
[ "function snapOffset(offset) {\n return pageWidth * Math.round(offset / pageWidth)\n }", "function snapCurrentOffset() {\n // flutter.log(\"snapCurrentOffset\");\n if (isScrollModeEnabled()) {\n return;\n }\n var currentOffset = window.scrollX;\n // Adds half a page to make sure we don't snap to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Connect to mongo, with retry logic
async connectMongo(connectionString, retries) { let err let retry = 0; let mongoHost = URL.parse(connectionString).host; while(true) { console.log(`### Connection attempt ${retry+1} to MongoDB server ${mongoHost}`) if(!this.db) { await this.MongoClient.connect(connectionString) ...
[ "async _connectToMongo() {\n\t\tconst collectionCacheKey = this._buildMongoCollectionCacheKey();\n\t\tif (this.mongoClient) {\n\t\t\t// we're already connected\n\t\t\treturn;\n\t\t}\n\t\telse if (collectionCacheKey && mongoConnections[collectionCacheKey]) {\n\t\t\tthis.logger.log('using cached mongo connection');\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get stats based on our lane opponent, used to compare teamId is the opponent's team ID
function getLaneOpponentStats(match, pobj, teamId) { //kills, deaths, assists, kda, damage to champs, ward stats, kill contribution percentage var stats = getPlayerStats(pobj); //kills, deaths, assists, kda, total cs var damage = getChampionDamageDealt(pobj); //damage dealt as a number var totalDamage = getTot...
[ "static async getTeamStats(teamId) {\n let response = await axios.get(`${BASE_URL}/api/teams/${teamId}`, {\n withCredentials: true,\n });\n const stats = response.data.teams[0].teamStats[0].splits[0].stat;\n teamName = response.data.teams[0].name;\n const newStat = new Stat(stats);\n return n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions \\ return the jokes.json file
function getJokes() { return $.getJSON('jokes.json'); }
[ "function getJsonFile() {\n fs.readFile(jsonFile, \"utf8\", function (error, response) {\n if (error) {\n console.log(error);\n }\n notes = JSON.parse(response)\n writeJsonFile();\n });\n }", "function getJason() {\n fs.readFile(ja...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computed style of horizontal scrolling wrapper. This computed property adds some left margin the wrapper that matches fixed column width.
@computed( 'hasFixedColumn', 'bodyColumns.firstObject.width', 'allColumnWidths', '_width' ) get horizontalScrollWrapperStyle() { let columns = this.get('bodyColumns'); let visibility = this.get('_width') < this.get('allColumnWidths') ? 'visibility' : 'hidden'; let left; if (get(columns...
[ "scrollHorizontal(){\n\t\tvar rows;\n\n\t\tif(this.active){\n\t\t\tclearTimeout(this.scrollEndTimer);\n\n\t\t\t//layout all rows after scroll is complete\n\t\t\tthis.scrollEndTimer = setTimeout(() => {\n\t\t\t\tthis.layout();\n\t\t\t}, 100);\n\n\t\t\trows = this.table.rowManager.getVisibleRows();\n\n\t\t\tthis.calc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shows the table options dialog.
showTableOptionsDialog() { if (this.tableOptionsDialogModule && !this.isReadOnlyMode && this.viewer) { this.tableOptionsDialogModule.show(); } }
[ "showTableDialog() {\n if (this.tableDialogModule && !this.isReadOnlyMode && this.viewer) {\n this.tableDialogModule.show();\n }\n }", "showTablePropertiesDialog() {\n if (this.tablePropertiesDialogModule && !this.isReadOnlyMode && this.viewer) {\n this.tablePropertie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
multiply 15 minutes for every indgredients > 3
calcTime () { const numberOfIngredients = this.ingredients.length; const period = Math.ceil( numberOfIngredients / 3 ) this.time = period * 15; }
[ "calcTime() {\n const numIng = this.ingredients.length;\n const periods = Math.ceil(numIng / 3);\n this.time = periods * 15;\n }", "calcTime(){\n //Assuming that we need 15 min for each 3 ingredients \n const numIng = this.ingredients.length;\n const periods = Math.ceil(numIng/3);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create RxDocument from the docsarray
function createRxDocuments(rxCollection, docsJSON) { return docsJSON.map(function (json) { return createRxDocument(rxCollection, json); }); }
[ "getDocuments (dataArray) {\n let documents = []\n if (Array.isArray(dataArray)) {\n dataArray.forEach((data) => {\n documents.push(this.getDocumentObject(data))\n })\n }\n return documents\n }", "_buildDocument() {\n if (this.dataPoints.length < 1) {\n return null;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
finish step1 steps2 update obj.image's avatarURL which is comming through child component
updateImageUrl(downloadURL, fileN) { const { images } = this.state.obj images[fileN].avatarURL = downloadURL //url and index number are receiving from child and setState here this.setState({ images }) }
[ "handleUpdateAvatar() {\n if (\n \n this.state.avatar !== ''\n ) {\n \n fetch(myGet + '/' + this.state.user.id, {\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculates marging from avaliable space
function calculateMarginFromFreeSpace(boxHeightInPrecent,contentMaxHeight) { var allAviHeight = gameContainer.offsetHeight; var boxHeight = allAviHeight * boxHeightInPrecent; var contentHeight = boxHeight * contentMaxHeight; var freeSpace = boxHeight - contentHeight; return Math....
[ "function calcPhysicalMem()\n{\n\tvar os = require('os');\n\n\tvar totalm = (os.totalmem() / 1024 / 1024).toFixed(2);\n\tvar freem = (os.freemem() / 1024 / 1024).toFixed(2) ;\n\tvar usedm = (totalm - freem);\n\n\n\tmetrics[\"phys_mem_used\"].value = usedm;\n\tmetrics[\"phys_mem_free\"].value = freem;\n\tmetrics[\"p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Note: hydration is DOMspecific But we have to place it in core due to tight coupling with core splitting it out creates a ton of unnecessary complexity. Hydration also depends on some renderer internal logic which needs to be passed in via arguments.
function createHydrationFunctions(rendererInternals) { const { mt: mountComponent , p: patch , o: { patchProp , nextSibling , parentNode , remove , insert , createComment } } = rendererInternals; const hydrate = (vnode, container)=>{ if (!container.hasChildNodes()) { warn(`Attempting to hy...
[ "function createHydrationFunctions(rendererInternals){const{mt:mountComponent,p:patch,o:{patchProp,createText,nextSibling,parentNode,remove,insert,createComment}}=rendererInternals;const hydrate=(vnode,container)=>{if(!container.hasChildNodes()){warn$1(`Attempting to hydrate existing markup but container is empty. ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Increments the number of tests per browser and per type of test.
incTestsByBrowserByState(state, browser, suite) { state = this.standardTestState(state); setdefault(this._testsCountPerBrowserPerState, browser, {}); setdefault(this._testsCountPerBrowserPerState[browser], state, 0); setdefault(this._testsCountPerSuitePerState, suite, {}); setdefault(this._testsCoun...
[ "function incTestNumber(){\n\tvar testNum = sessionStorage.testNum;\n\tif (testNum === undefined){\n\t\ttestNum = 0;\n\t}\n\tsessionStorage.testNum = parseInt(testNum) + 1;\n}", "get numTests() {\n\t\t\tfunction reduce(numTests, test) {\n\t\t\t\treturn test.tests ? test.tests.reduce(reduce, numTests) : numTests +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates the changes collection if it doesn't already exist, and returns the collection in the callback
function loadCollection(name, options, callback){ var self = this; self.db.collectionNames(self.changeCollectionPrefix+self.collectionName, function (err, names) { var found = false; for(var i=0;i<names.length;i++){ if(self.datbaseName+'.'+self.changeCollectionPrefix+self.collectionName){ foun...
[ "function syncToChanges() {\n return $q.when(\n db.changes({\n live: true,\n since: 'now',\n include_docs: true\n })\n .on('change', function(change) {\n if (change.deleted) {\n // change.id has the deleted id\n onDeleted(change.id);\n } else { ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Purpose: To find the top 5 newest job postings on themuse.com based on category param (in): intent: given by Alexa, allows code to access parts of the intent request param (in): session: given by Alexa, allows code to access parts of the session in the Lambda request param (out): request: allows the user to change the ...
function CategoryIntentFunction (intent, session, response) { var category = intent.slots.category.value if (category === undefined || category === null || category === '' || category === '{}') { var noSlot = 'I am sorry, I did not get a category. Please say: Alexa, ask fan muse jobs to tell me jobs that are i...
[ "function getTopCategoryPublisher(req, res) {\n var inputcategory = req.params.categoryName;\n console.log(\"in publisher\" + inputcategory);\n inputcategory = inputcategory.replace(\"\\'\", \"\\'\\'\");\n connection.then((con) => {\n const sql = `WITH BookPub AS \n (SELECT Books.isbn, Books.publisher FRO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill Behavior Drop Down adds all behaviors from the catLadyBehaviors array as options in the html dropdown
function fillBehaviorDropDown () { for (var i = 0; i < catLadyBehaviors.length; i++) { var description = catLadyBehaviors[i].description; var points = catLadyBehaviors[i].pointValue; var option = '<option value="' + i +'">' + description + '</option>'; $('#new...
[ "function populateDropdowns() {\n}", "function displayNewBehavior (behavior) {\n\n $('.behavior-list').append(behavior.getListItem());\n\n }", "function setCharacteristicOptions() {\r\n const options = ['Affiliation', 'Motive', 'Method', 'Result'];\r\n characteristicDropdown = document.getElementById(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Destroys the mask stack.
destroy() { super.destroy(); this.stencilMaskStack = null; }
[ "destroy()\n {\n super.destroy(this);\n\n this.maskStack = null;\n }", "destroy() {\n this.renderer = null, this.maskStack = null;\n }", "removeMask() {\n this._out.mask = null;\n this._mask = null;\n }", "function destroy() {\n\t\t\tvar stackKey;\n\n\t\t\t// Remove the events\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the function that will close the new window when the mouse is moved off the link
function close_window() { newwindow.close(); }
[ "function close_window() \n{\nnew_window.close();\n}", "function mouseLeave(event) {\r\n\r\n lastMousePosition.inWindow = false;\r\n}", "function itemMouseOut(e){\n\t\te.target.closePopup();\n\t}", "function closeQuickLinkMenuOnClickOutSide() {\n\tvar mouse_is_inside = false;\n\t$('#menusupfooter').hover(f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Match currentWord to wordInput
function matchWords() { if (wordInput.value === currentWord.innerHTML) return true; else return false; }
[ "function matchWords() {\n if(wordInput.value === currentWord.innerHTML) {\n return true;\n } else {\n return false;\n }\n }", "function matchWord() {\n\tif (wordInput.value === currentWord.innerHTML) {\n\t\tmessage.innerHTML = \"Typed in \" + (currentLevel - time) / 10 + \" secs!\";\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill the diagonal SRN number of SRN x SRN matrices
function fillDiagonal(solutionGrid) { for (let i = 0; i<9; i=i+3) // for diagonal box, start coordinates->i==j fillBox(solutionGrid, i, i); }
[ "fillDiagonal() {\n \n for (let i = 0; i < this.N; i = i + this.SRN) {\n // for diagonal box, start coordinates->i==j \n this.fillBox(i, i);\n }\n }", "function fillDiagonal() {\n let num;\n for (let i = 0; i < N; i++) { //fill the diagonl\n do {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to generate a random apikey consisting of 32 characters
function getNewApikey() { let newApikey = ""; let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (let i = 0; i < 32; i++) { newApikey += alphabet.charAt(Math.floor(Math.random() * alphabet.length)); } return newApikey; }
[ "function getNewApikey() {\n let newApikey = \"\";\n let alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n \n for (let i = 0; i < 32; i++) {\n newApikey += alphabet.charAt(Math.floor(Math.random() * alphabet.length));\n }\n\n return newApikey;\n}", "function getNewApikey() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the console and all of its relevant variables.
function doInitialize() { // Initialize variables _promptSymbol = prompt; _hostAndPrompt = user + prompt; _containerId = container; _self = this; // Initialize the conosle and place it inside its container. var term = $("<textarea class=\"console\" spellcheck=\"false\">"); ...
[ "function initConsole() {\r\n if (typeof console != \"undefined\") {\r\n if (typeof console.log != 'undefined') {\r\n console.olog = console.log;\r\n } else {\r\n console.olog = function() {\r\n };\r\n }\r\n }\r\n\r\n console.log = function(message) {\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to create img items for Carousel
function createItem(img){ componentList.push( { original: img["sourcejpg"], thumbnail: img["sourcejpg"] } ) }
[ "function Carousel(listeProduit) {\n\n let elt = document.getElementById('carousel');\n\n var inner = document.createElement(\"div\");\n inner.setAttribute(\"class\", \"carousel-inner\");\n\n var active = document.createElement(\"div\");\n active.setAttribute(\"class\", \"carousel-item active\");\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
default config for a save and close button group: save and close
get saveCloseButtonGroup() { return { type: "button-group", subtype: "save-close-button-group", buttons: [this.saveButton], }; }
[ "function saveCloseButtons() {\n var saveClose = angular.element('.actionButtonHolder');\n var saveCloseTemplate = kendo.template($('#saveCloseTemplate').html());\n var saveCloseHtml = saveCloseTemplate({});\n saveClose.append(saveCloseHtml);\n $('#saveButton').bind('cli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates placeholder style for each of the browsers supported by officeuifabricreact.
function getPlaceholderStyles(styles) { return { selectors: { '::placeholder': styles, ':-ms-input-placeholder': styles, '::-ms-input-placeholder': styles // Edge } }; }
[ "createThemeOverrides() {\n const themeHeader = document.createElement(\"h2\");\n themeHeader.textContent = \"Event Theme Overrides: \";\n themeHeader.style.fontFamily = \"Rubik\";\n\n this.themeOverrideContainer.replaceChildren(\n themeHeader,\n this.createColorPicker(\n \"Background C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Connect to a given url and port
function socket_connect(url, port) { "use strict"; if (java_socket_bridge_ready_flag) { if (get_java_socket_bridge().connect(url, port) !== true) { is_connected_flag = false; throw new Error("Could not connect"); } else { is_connected_flag = true; } } else { on_socket_error("Java Socket Bridge canno...
[ "function socket_connect(url, port){\n\tif(java_socket_bridge_ready_flag){\n\t\treturn get_java_socket_bridge().connect(url, port);\n\t}\n\telse{\n\t\ton_socket_error(\"Java Socket Bridge cannot connect until the applet has loaded\");\n\t}\n}", "connectToPort(port) {\n this.formatter.info(`[INFO] Attemptin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
It is just firing two rays from origin with angles: angle1 and angle2 and find the intersection points from those two rays with the segment, and those two points and the point of interest will be the triangle
function getTrianglePoints(origin, angle1, angle2, segment) { const p1 = origin; const p2 = Point(origin.x + Math.cos(angle1), origin.y + Math.sin(angle1)); const p3 = Point(segment.p1.x, segment.p1.y); const p4 = Point(segment.p2.x, segment.p2.y); const tBeginPoint = lineIntersection(p3, p4, p1,...
[ "function triangleTriangleIntersection(t1v0, t1v1, t1v2,\r\n t2v0, t2v1, t2v2)\r\n{\r\n if (!triangleSpansPlane(t1v0, t1v1, t1v2, new Plane(t2v0, t2v1, t2v2)) ||\r\n !triangleSpansPlane(t2v0, t2v1, t2v2, new Plane(t1v0, t1v1, t1v2)))\r\n {\r\n return false;\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
output swf object,return string
function swf(w,h,p){ var pm=$.extend({path:'',wmode:'opaque',quality:'high'},p||{}),rswf; if($.browser.msie){ rswf='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cabversion=6,0,0,0" width="' + w + '" height="' + h + '">\n'...
[ "function flash(src,fid,width,height,mode){\n document.write(\"<object classid=\\\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\\\" codebase=\\\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\\\" width=\" + width + \" height=\" + height + \" id=\" + fid + \"><param name=wmode val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sendRegistrationForm fuction feturns redirect to registration form with calculated fresh token
function sendRegistrationForm(newToken, response) { console.log(">>> send registration !!! "); var redirectLocation = "/registration.html?token=" + newToken; response.writeHead(301, "Moved Permanently", {"Location": redirectLocation}); response.end(""); }
[ "function sendTokenToForm(form){\n\tvar user = firebase.auth().currentUser;\t\t \n user.getToken(/* forceRefresh */ true).then(function(idToken) {\n\t\t \taddHidden(form, 'token', idToken);\n\t\t \tform.submit();\n\t\t}).catch(function(error) {\n\t\t\taddHidden(form, 'error', error.code);\n\t \tform.subm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: canApplyServerBehavior DESCRIPTION: ARGUMENTS: RETURNS:
function RecordsetColumnMenu_canApplyServerBehavior(sbObj) { var retVal = true; return retVal; }
[ "function canApplyServerBehavior() {\r\n \r\n var retVal = true;\r\n \r\n return retVal;\r\n}", "function canApplyServerBehavior(sbObj)\r\n{\r\n var success = true;\r\n return success;\r\n}", "function ConnectionMenu_canApplyServerBehavior(sbObj) \r\n{\r\n var retVal = true;\r\n \r\n return retVal;\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
determine whether or not a game object is occupying the specified location
isLocationOccupiedByGameObject(xy, getDistanceBetweenPointsFunc) { let gameObjectsListsToCheck = [[{ x: 0, y: 0 }], this.treesSmall, this.treesLarge, this.treesBare, this.rocks, this.jumps, this.stumps, this.lift.liftTowers, this.slalom.gates, [this.logo, { x: this.logo.x + 75, y: this.logo.y }]]; for (let gameO...
[ "inWorld() {\n return util.inBound(this.x, constants.WORLD_MIN, constants.WORLD_MAX) && util.inBound(this.y, constants.WORLD_MIN, constants.WORLD_MAX);\n }", "function isOccupied(xPos, yPos){\n\n //Check if it's a black block\n if(xPos % 2 === 0 && yPos % 2 === 0){\n return true;\n }\n\n //Chec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When calling a route, the first parameter is reserved for options. This will set one of those options. This will allow for better management of global variables
registerOption(key, value) { this.routeOptions[key] = value; }
[ "onNavigateToOptionRoute(option) {\n if (this.config.route) {\n let route = this.config.route.slice();\n route = String(route).replace(/:value/g, '' + option.value).replace(/:name/g, option.name);\n this.srv.router.navigateByUrl(route).then(data => {\n })\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Eats a multiline token of the form NL;....NL;
function eatMultiline(state) { var prev = 59, pos = state.position + 1, c; while (pos < state.length) { c = state.data.charCodeAt(pos); if (c === 59 && (prev === 10 || prev === 13)) { state.position = pos + 1; // get rid of ...
[ "newlineToken(offset) {\n this.suppressSemicolons();\n if (this.tag() !== 'TERMINATOR') { this.token('TERMINATOR', '\\n', offset, 0); }\n return this;\n }", "newlineToken(offset) {\n this.suppressSemicolons();\n if (this.tag() !== 'TERMINATOR') {\n this.token('TERMINATOR', '\\n', offset...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to either render a list of groups, or if there are none, direct the user to the page to create an group first
function renderGroupList(data) { if (!data.length) { window.location.href = "/concerts"; console.log(data); } $(".hidden").removeClass("hidden"); var rowsToAdd = []; for (var i = 0; i < data.length; i++) { rowsToAdd.push(createGroupRow(data[i])); } group...
[ "function getGroups(){\n GROUPDB.getGroups(function(list){\n if(list!=null){\n //print initialpage\n self.showStartpage();\n for(var i=0;i<list.length;i++){\n self.addGroup(list[i]);\n self.debugLog(\"add group \"+list[i].getGroupname());\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }