query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Returns true if the 2 queen placements are valid.
function validityCheck(q1 , q2 ){ //Not in same position let pos_check = q1.x == q2.x && q1.y == q2.y ? true:false; //Not in same row let row_check = q1.x == q2.x ? true:false; //row_check = false; UNCOMMENT FOR LESS STRICTLY RESULT //Not in same col let col_check = q2.y == q1.y ? true:fa...
[ "function isValidMoveQueen(fromRow, fromCol, toRow, toCol)\r\n\t{\r\n\t\tif (isValidMoveRook(fromRow, fromCol, toRow, toCol) || isValidMoveBishop(fromRow, fromCol, toRow, toCol))\r\n\t\t\treturn true;\r\n\r\n\t\tif (errMsg.search(\"jump\") == -1)\r\n\t\t\terrMsg = \"Queens cannot move like that.\";\r\n\t\telse\r\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adding and deleting competitions
function addCompetition() { var nextId = actCompetitionId++; var table = document.createElement("table"); table.className = "inputTable"; table.id = nextId; table.border = "0"; table.cellPadding = "5"; table.cellSpacing = "0"; table.width = "100%"; var thead = document.createElement("thead"); var row = ...
[ "onRemoveCompetition(e) {\n\t\tvar compId = e.currentTarget.id.replace(\"remove-\", \"\"),\n\t\t\tcomp = factory.All[compId];\n\t\tuserModel.Competitions.remove(comp);\n\t\tthis.forceUpdate();\n\t}", "function createNewCompetition() {\n if (competitions.length <= 0) {\n dom.class_competitions.innerHTML ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the username of the board owner using the given board id
function getBoardOwner(boardId) { if(boards[boardId]) { return boards[boardId]; } else { return ""; } }
[ "getUsername(id) {\n if (this.connections[id] === undefined) {\n // TODO: handle nonexistant id\n return \"\";\n }\n return this.connections[id].username;\n }", "userName(socketid){\n\t\tvar username = this.playerList.find(function(player){return player.socketid === s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
called when Kite flies through Item
function handleKiteThroughItem() { score++; score++; const worldSize = config.world.worldSize; const slices = config.world.slices; const meshSlices = config.world.meshSlices; // the Item should appear where the semi-transparent Item was item.position.copy(nextItem.position); item.rotati...
[ "itemClick() {\n\n // these if statements feel a little dirty but i will use them lol\n\n if (!this.scene.scene.isActive('tradescene')) {\n // if not clicked in trade scene:\n }\n\n // set special use cases for certain items (for example, can only use energy drink when on plan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds and returns all children of collection
getAllChildren() { const children = this.jq.wrapper.find(this.jq.child) return children }
[ "getChildren () {\n let children = [];\n for (let id in this.children) {\n if (this.children.hasOwnProperty(id)) {\n children.push(this.children[id]);\n }\n }\n return children;\n }", "getChildren() {\n return this._children;\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
startBoard picks a random number of squares to be "alive" and the places the alive squares randomly on the board
function startBoard(){ var baseRandom = Math.floor((Math.random() * (boardHeight * 4)) + 1); for (i = 0; i <baseRandom; i++){ var choiceRandom1 = Math.floor((Math.random() * ((boardHeight*boardHeight) - 1)) + 1); var holdcell = ($('#row' + choiceRandom1)); holdcell.addClass("alive"); } }
[ "function startBoard() {\n resetBoard();\n getNewCards();\n shuffleBoard();\n loadBoardElemets();\n updateCounters();\n startTimer();\n}", "function initiateBoard(){\n\tblankx=wid-1;\n\tblanky=height-1;\n\tfor(i=0;i<=numTiles;i++) position[i]=i;\n}", "function makeBoard() {\n var tmp = -1\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepare dev configuration prepare config create dev server
constructor() { // extract from devServerConfig const { port, host, protocol, appName } = this.devServerConfig; // prepare urls const urls = prepareUrls(protocol, host, port); // prepare webpack compiler & webpack dev server const compiler = createCompiler(webpack, this.webpackConfig, appName...
[ "_initDevConfig () {\n for (let name in this.config.entry) {\n if (!this.config.entry.hasOwnProperty(name)) continue\n let entry = this.config.entry[name]\n\n this.config.entry[name] = [\n `webpack-dev-server/client?${this.options.webpackUrl}`,\n 'webpack/hot/dev-server',\n pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the h2 text with the current hex color
function updateTextUI(index) { const activeDiv = colorDivs[index]; console.log('lol', activeDiv); const currentBgColor = activeDiv.style.backgroundColor; const color = chroma(currentBgColor).hex(); const textHex = activeDiv.querySelector('h2'); textHex.innerText = color; }
[ "function updateColorText() {\n for (let i = 0; i < palette.length; i++) {\n var temp = palette[i].style.backgroundColor;\n temp = temp.match(re);\n const color = rgb2hex(\n temp[0].toString(),\n temp[1].toString(),\n temp[2].toString()\n );\n palette[i].querySelector(\"#color\").inne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the add time frame match the current time
function isTimeFramesMatchCurrentTime(displayTimeFrame) { var today = new Date(); var isFrameMatch; //get start and end date var startDate = new Date(displayTimeFrame.startDate); var endDate = new Date(displayTimeFrame.endDate); //check if the add time frame match current date isFrameMatch...
[ "function checkTimer() {\n\treturn timerEndTime < frameCount;\n}", "checkTime() {\n\t\tif (this.currentTime >= 99) {\n\t\t\treturn true;\n\t\t}\n\t}", "function checkTimeFrames() {\n\n var start = new Date(settings.start),\n end = new Date(settings.stop),\n delta = (end - start) / (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to sort based on number of plays in reverse order.
function comparePlaysReverse(a,b) { if (a.numberOfPlays < b.numberOfPlays) return 1; if (a.numberOfPlays > b.numberOfPlays) return -1; return 0; }
[ "function sortTrackCount()\n{\n\ttracks.sort( function(a,b) { if (a.playCount < b.playCount) return -1; else return 1; } );\n\tclearTable();\n\tfillTracksTable();\n}", "function sortArtistCount()\n{\n\tartists.sort( function(a,b) { if (a.playCount < b.playCount) return -1; else return 1; } );\n\tclearTable();\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates the shelf object
function Shelf(name){ this.shelfName = name; this.books = []; }
[ "function Shelf() {\r\n this.id = 0;\r\n this.capacity = LIB_BOOK_PER_SHELF_CAP;\r\n this.books = [];\r\n //this.dimensions = {w: 1, l: 1, h: 1}; //in\r\n }", "function Shelf() {\r\n\tthis.items = {};\r\n}", "renderShelf() {\n this.shelfItems.push(new ui.ShelfItem(\"coi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Waits for a requestAnimationFrame callback in the next refresh driver tick.
function waitForNextFrame() { const timeAtStart = document.timeline.currentTime; return new Promise(resolve => { (function handleFrame() { if (timeAtStart === document.timeline.currentTime) { window.requestAnimationFrame(handleFrame); } else { resolve(); } }()); }); }
[ "function onRequestAnimationFrame(cb) {\n if (vrDisplay && vrDisplay.isPresenting) {\n submitNextFrame = true;\n return vrDisplay.requestAnimationFrame(cb);\n } else {\n return windowRaf(cb);\n }\n }", "function requestAnimationFrame() {\n // cross-browser requestAnimationFrame\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
What the name of the varying vert position attribute found in vertex shader Name must match or shaders will be used incorrectly
setVertexPositionName(name) { this.setReady(false); this.glShaderPosAttrName = name; }
[ "function vertexShaderOther()\n{\n return [\"varying vec3 color;\",\n \"varying vec2 uvCoordinates;\",\n \"uniform mat4 customPointMatrix;\",\n \"uniform mat4 customNormalMatrix;\",\n \"uniform vec3 customColor;\",\n \"void main() {\",\n \"uvCoordinates = uv;\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Demande au serveur la liste de toutes les longueurs contenue dans la database Insere les longueurs dans la liste "longueurs" liee a la Vue mvOptions
function getAllLongueurs(){ let xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { let returnValues = JSON.parse(this.responseText); for(let i = 0; i<returnValues.length ; i++){ longueurs.push(returnValues[i]); }...
[ "function LongList(ChampDonnees,ChampVu,nomobj,filepath) {\t\r\n\tthis.nomChampDonnees = ChampDonnees;\r\n\tthis.objChampDonnees = MM_findObj(ChampDonnees);\r\n\tthis.ValeurInitiale = MM_findObj(ChampDonnees).value;\r\n\tthis.AjouterValeur = false;\r\n\tthis.AjouterTailleMini = 0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! moment.js locale configuration ! locale : breton (br) ! author : JeanBaptiste Le Duigou :
function hd(i,ee,te){return i+" "+function kd(i,ee){return 2===ee?function ld(i){var ee={m:"v",b:"v",d:"z"};return void 0===ee[i.charAt(0)]?i:ee[i.charAt(0)]+i.substring(1)} //! moment.js locale configuration //! locale : bosnian (bs) //! author : Nedim Cholich : https://github.com/frontyard //! based on (hr) translati...
[ "function b(e,t,n){return e+\" \"+function(e,t){return 2===t?function(e){var t={m:\"v\",b:\"v\",d:\"z\"};return void 0===t[e.charAt(0)]?e:t[e.charAt(0)]+e.substring(1)}(e):e}({mm:\"munutenn\",MM:\"miz\",dd:\"devezh\"}[n],e)}//! moment.js locale configuration", "function za(e,t,o){return\"m\"===o?t?\"хвилина\":\"х...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if y = DateTime, copy it. Otherwise, create a new one from year, month, date.
function copy ( y, m, d ) { if ( y instanceof Date ) { d = y.getDate(); m = y.getMonth(); y = y.getFullYear(); } return new Date(y,m,d,0,0,0,0); }
[ "static copy(date) {\n return new MyDate(date.properties[\"year\"], date.properties[\"month\"], date.properties[\"day\"]);\n }", "clone() {\n const that = this,\n date = new JQX.Utilities.DateTime(that.dateData);\n\n that.copyTimeZone(date);\n that.copySmallTimePartValues...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the quicklaunch navigation nodes for the current context
get quicklaunch() { return new NavigationNodes(this, "quicklaunch"); }
[ "get quicklaunch() {\n return tag.configure(NavigationNodes(this, \"quicklaunch\"), \"n.quicklaunch\");\n }", "function getCustomNavigations( currentScreenKey, actionName ) {\n var customNavigations = new Array();\n return customNavigations;\n}", "function getNavItems() {\n var navIt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When user clicks on Void button then it redirects to Settlement suitelet to void the Settlement.
function voidSettlement(settlementId, postingPeriodId){ try{ //checking postingperiod status var postingPeriodURL = url.resolveScript({ scriptId: 'customscript_itpm_getaccntngprd_status', deploymentId: 'customdeploy_itpm_getaccntngprd_status', params:{popid:postingPeriodId}, returnEx...
[ "function buttonPress(button)\n{\n\tvar logTitle='buttonPress';\n\tvar context = nlapiGetContext().getEnvironment();\n var url = '';\n\t// URL will change depending on the environment.\n if (context == 'SANDBOX') \n\t{\n \turl = NS_SBX_URL;\n } \n\telse if (context == 'PRODUCTION')\n\t{\n \turl = NS_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send the offer to the remote peer using the signaling server after set caller local description should send offer to callee through server
function sendOfferToCallee() { sendToServer({ type: 'offer', offer: caller_peer_connect.localDescription }); // console.log('reciveCallerOffer();'); // console.log(JSON.stringify(caller_peer_connect.localDescription)); // reciveCallerOffer(caller_peer_connect.localDescription); }
[ "function sendOfferSignal() {\n peerConnection.createOffer(function(offer) {\n sendSignal(offer);\n peerConnection.setLocalDescription(offer);\n }, function(error) {\n alert(\"Error creating an offer\");\n });\n}", "function onOfferFulfilled(description) {\n rtcPeerConnection.setL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send textarea message to all clients
function sendTextarea(text) { io.sockets.emit('textArea', text); }
[ "_onTextSend() {\n\n if (!this._textarea.value) {\n this._textarea.focus();\n return;\n }\n\n this.emit(APP_EVENTS.AUTHED_USER_NEW_MESSAGE, {\n text: this._textarea.value.trim(),\n time: new Date(),\n })\n }", "function FillText() {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maintain a dictionary for the value of each 'currency:issuer' pair, denominated in XRP. Fetch the data from RippleCharts, and refresh it whenever any nonXRP balances change. When exchangeRates changes, update the aggregate value, and the list of available value metrics, and also check for negative balances to see if th...
function updateExchangeRates() { var currencies = []; var hasNegative = false; for (var cur in $scope.balances) {if ($scope.balances.hasOwnProperty(cur)){ var components = $scope.balances[cur].components; for (var issuer in components) {if (components.hasOwnProperty(issuer)){ ...
[ "function updateExchangeRates() {\n var currencies = [];\n var hasNegative = false;\n for (var cur in $scope.balances) {if ($scope.balances.hasOwnProperty(cur)){\n var components = $scope.balances[cur].components;\n for (var issuer in components) {if (components.hasOwnProperty(issuer)){...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes an item and tries to make a string out of it. Returns null if the item doesn't represent a valid string; otherwise returns a string. If item is a CHAR, the string simply contains that character. If it's a LIST, it tries to concatenate together all the CHARs in that list, failing and returning null if it encounter...
function makeString(item) { let s = ""; switch (item.type) { case ResType.CHAR: s = item.content; break; case ResType.LIST: for (let chr of item.content) { if (chr.type == ResType.CHAR) s += chr.content; else return null; } break; default...
[ "function tryMakeString(fnName, ctx, item) {\n let str = makeString(item);\n if (str === null) {\n ctx.complain(fnName, \"item was not a valid string:\\n\" + item.display());\n return null;\n }\n\n return str;\n}", "function isStr(item) {\r\n\t\treturn typeof item === 'string';\r\n\t}", "function getT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
is zIntervals of five maps are all same
function isAllzIntervalsEqual() { var j = 0; var isAllSameIntervals = true; for (var i=1; i<app.m; i++) { var mapN = "map" + i; if (!intervalsEqual(app[mapN].zIntervals, app.map0.zIntervals)) { isAllSameIntervals = false; j = i; break; } } if (!isAllSameIntervals) { //console.log('mapX zIntervals ...
[ "function isAllBoundsEqual_withoutINC() {\n\tvar bounds = [];\n\tfor (var i=0; i<app.m; i++) {\n\t\tvar mapN = \"map\" + i;\n\t\tif (app[mapN].item.startsWith('INC')) continue;\n\t\tbounds.push(app[mapN].map.getBounds());\n\t}\n\tvar j = 0;\n\tvar isAllSameBounds = true;\n\tfor (var i=1; i<bounds.length; i++) {\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An Event Listener must be used since there are no OnWidth It updates the state, so there is a rerendering with the correct nbCardsPerLine
updateDimensions() { // A card has a min-width of 600px this.setState({nbCardsPerLine: Math.ceil(getWidth()/600)}); }
[ "updateCardWidths_() {\n for (let i = 0, card; card = this.cards_[i]; i++) {\n card.style.width = this.cardWidth_ + 'px';\n }\n }", "updateCardWidth() {\n const cards = document.querySelectorAll('.card');\n const width = this.gridView ? '375px' : '100%';\n Array.from(cards).forEac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if a is one of the boolean values, true or false.
function isBoolean(a) { return typeof a == 'boolean'; }
[ "function boolean (data) {\n return data === false || data === true;\n }", "function _boolean(data) {\n return data === false || data === true;\n }", "function boolean(data) {\n return data === false || data === true;\n }", "function _boolean(data) {\n return data === false || data === true;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isLoggedIn is a function which checks whether the user is logged in or not, by calling isAuthenticated from store. It redirects user to login page if not.
function isLoggedIn() { if (!store.getters.isAuthenticated) { this.$router.push("/"); return; } }
[ "isLoggedIn() {\n if (user) {\n return true\n } else {\n return false\n }\n }", "function isLoggedIn() {\n if (sessionStorage.getItem('username') != null) {\n return;\n }\n else {\n window.location.assign(\"login.html\");\n }\n}", "function isLoggedIn(co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
= Description Measures the characters encoded in length bytes of the string or, if no length is specified, the entire string up to the null character, '0', which terminates it. The return value totals the width of all the characters in coordinate units; it's the length of the baseline required to draw the string. = Par...
stringSize(_string, _length, _elemId, _wrap, _customStyle) { if (!_customStyle) { _customStyle = {}; } if (this.isString(_customStyle)) { console.warn('HView#stringSize: use style objects instead of css text!'); _customStyle = {}; } if (_length || _length === 0) { _string = _...
[ "stringWidth(_string, _length, _elemId, _customStyle) {\n return this.stringSize(_string, _length, _elemId, false, _customStyle)[0];\n }", "stringSize(_string, _length, _elemId, _wrap, _customStyle) {\n if (!_customStyle) {\n _customStyle = {};\n }\n if (this.isString(_customStyle)) {\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
input: 3x3 array of arrays (matrix, mat) output: a new matrix, the transpose of the original rules: do not change the input matrix algorithm: Initialize a new array of arrays (newMat), all elements 0 loop through mat rows (i), for each row, loop through columns (j) newMat[j][i] = mat[i][j] return newMat
function transpose(mat) { var newMat = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; for (let i = 0; i < 3; i += 1) { for (let j = 0; j < 3; j += 1) { newMat[j][i] = mat[i][j]; } } return newMat; }
[ "function transpose(mat) {\n if (mat.length === 0) return [];\n var newMat = Array(mat[0].length).fill();\n newMat.forEach((_, idx) => newMat[idx] = Array(mat.length).fill(0));\n\n for (let i = 0; i < mat.length; i += 1) {\n for (let j = 0; j < mat[0].length; j += 1) {\n newMat[j][i] = mat[i][j];\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch a value from a register onto the stack
fetch(register) { this.stack.push(this.fetchValue(register)); }
[ "fetchValue(register) {\n return this[_opcodes.Register[register]];\n }", "fetch(register) {\n let value = this.fetchValue(register);\n this.stack.push(value);\n }", "fetch(register) {\n this.stack.push(this.fetchValue(register));\n }", "fetchValue(register) {\n return this[Regis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scales a scale is used to map from data values to aesthetic values.
function Scale () {}
[ "SetScale(double, double) {\n\n }", "scale() {\n this.p.scale(this._scaleFactor);\n }", "setScale(scale) {\n this._scale = scale;\n this._updateBounds();\n }", "function scale(scale) {\n return \"scale(\" + scale + \")\";\n }", "updateScale(dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set sub menu horizontal position
function setSubMenuPosition() { $( '.sub-menu ul' ).each( function() { var sub_id = $( this ).attr( 'id' ).slice( 9 ); var parent = ''; $( '.main-menu li' ).each( function() { var main_id = $( this ).attr( 'id' ).slice( 10 ); if ( main_id == sub_id ) { parent = $( this ); re...
[ "function setMenuHorizontalPositions(){\n var shopLinkLeftOffset = $shopLink.offset().left,\n collectionsLinkLeftOffset = $collectionsLink.offset().left;\n\n $availableOnlineSubMenu.css('left', shopLinkLeftOffset);\n $exclusiveSubMenu.css('left', collectionsLinkLeftOffset);\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Standardizes the column definitions E.g., if the user passes a string for a column def, fill out the defaults
function standardizeCols(columns) { /** * Gets the default column name */ function getDefaultFormatter(colName) { return function(o) { return o[colName]; }; } /** * Gets the default column sorter */ function getDefaultSorter(colName) { return function(a, b, dir){ var firstRec = dir == '...
[ "static setColumnDefaults(columns, defaultColumnWidth) {\n return columns.map(column => {\n column.label =\n column.label !== undefined ? column.label : humanize(column.dataKey);\n column.width = column.width || defaultColumnWidth;\n return column;\n });\n }", "_applyDefaults() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the note exists in the localStorage
function checkNotes() { let noteContent = localStorage.getItem("note"); if (noteContent) { console.log("Note Exists"); document.getElementById("notes").innerHTML = noteContent; } else { document.getElementById("notes").placeholder = "Whenever you're ready..."; } }
[ "function checkForNote(id) {\n\treturn (localStorage.getItem(id) ? true : false); // Returns true if a note with given ID exists in storage\n}", "function checkStorageItem() {\n return localStorage.getItem(localBook) !== null;\n}", "function checkLocalStorage(){\n if(window.localStorage === null){\n elem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
changes image map cursors to specified style
function changeMapCursors(cursorStyle) { $('#bgwrapper map area').each(function() { this.style.cursor = cursorStyle; }); }
[ "function setCursorStyle(style) {\n $el.removeClass('crosshair grabbable grabbing ns-resize ew-resize nesw-resize nwse-resize');\n\n if (style) $el.addClass(style);\n }", "function setCursorStyle(obj,stl)\r\n\t{\r\n\t\tobj.style.cursor=stl;\r\n\t}", "function switchCursorStyle(command)\n\t\t\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set area of innerCanvas
function innerCanvasArea() { var total = parseInt(innerCanvas.style.width) * 2; return total; }
[ "drawOutside() {\n this.canvas.drawRect({\n strokeStyle: 'black',\n fillStyle: '#646262',\n strokeWidth: 5,\n fromCenter: false,\n x: 0, y: 0,\n width: this.width * config.PIXELS,\n height: this.height * config.PIXELS\n });\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prompts the user for a new name, and the does a rename (ie move)
function promptRename(sourceHref, callback) { log("promptRename", sourceHref); var currentName = getFileName(sourceHref); var newName = prompt("Please enter a new name for " + currentName, currentName); if( newName ) { newName = newName.trim(); if( newName.length > 0 && currentName...
[ "function promptRename(sourceHref, callback) {\n log(\"promptRename\", sourceHref);\n var currentName = getFileName(sourceHref);\n var newName = prompt(\"Please enter a new name for \" + currentName, currentName);\n if (newName) {\n newName = newName.trim();\n if (newName.length > 0 && cur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks to see if there is already an existing answer in answers array, if so removes
avoidDuplicates(p, q) { var i = this.state.answerIndexes.length; while (i--) { if ( (this.state.answerIndexes[i].page === p && this.state.answerIndexes[i].qIndex === q) || this.state.answerIndexes[i].page === undefined ) { this.state.answerIndexes.splice(i, ...
[ "function clearAnswers(){\n answerArray = [];\n}", "function removeAnswer(){\n\tquestion_arr[sequenceCountNum].answer.splice(edit.answerNum, 1);\n\t$(edit.xmlFile).find('item').eq(sequenceCountNum).find('answers answer').eq(edit.answerNum).remove();\n\t\n\tedit.answerNum = 0;\n\tloadEditQuestion(true);\n}", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a mesh like this one, translated by the given amounts
translated(dx, dy, dz) { let vertices = this.vertices.map( ([x, y, z]) => [x + dx, y + dy, z + dz]); return new Mesh(vertices, this.faces, this.faceNormals, this.vertexNormals, false); }
[ "MakeModel () {\n \n\t for(let i = 0; i < this.levelOfDetail; i++)\n\t {\n\t for(let j = 0; j < this.levelOfDetail; j++)\n\t {\n\t let I1 = 2 * this.size * i / this.levelOfDetail - 1;\n\t let I2 = 2 * this.size * (i + 1) / this.levelOfDeta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validates errors on all the fieldsets records if the Form has errors in $('formElem').data()
function validateSteps(){ var FormErrors = false; for (var i = 1; i <= fieldsetCount; ++i) { var error = validateStep(i); if(error == -1) FormErrors = true; } $('#formElem').data('errors',FormErrors); }
[ "function validateSteps(){\r\n var FormErrors = false;\r\n for(var i = 1; i < fieldsetCount; ++i){\r\n var error = validateStep(i);\r\n if(error == -1) FormErrors = true;\r\n }\r\n $('#formElem').data('errors',FormErrors);\r\n }", "function validateSteps(){\r\n\t\tvar FormErrors = false;\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the singleton instance of the GRoot object
static get inst() { if (_inst == null) _inst = new GRoot(); return _inst; }
[ "getInstance() {\n if (!instance) instance = init();\n\n return instance;\n }", "getInstance() {\n if (!instance) {\n instance = init();\n }\n return instance;\n }", "getInstance() {\n if (!instance) {\n instance = init();\n }\n\n return instance;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hideComposer: hide the composer (splash) window
function hideComposer(evt, nosave) { var es = evt ? (evt.target || evt.srcElement) : null; if (!es || !es.getAttribute || !es.getAttribute("class") || (es.nodeName != 'A' && es.getAttribute("class").search(/label/) == -1)) { if (!nosave) { saveDraft() } document.getElementBy...
[ "function hide () {\n if (isVisible()) {\n var hideFinishCb = function () {\n WinJS.Utilities.addClass(splashElement, 'hidden');\n splashElement.style.opacity = 1;\n enableUserInteraction();\n exitFullScreen();\n };\n\n // Color reversion before fa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function that takes two strings and returns the index positions in the first string that match the second string This will be used to evalaute user guesses
function matchingLetters(str, guess) { var indices = []; for (var i = 0; i < str.length; i++) { if (str[i] === guess) { indices.push(i); } } return indices; }
[ "function DifferenceIndex(s1, s2){\r\n var index = 0;\r\n var shortestLength = (s1.length < s2.length) ? s1.length: s2.length;\r\n for(i = 0; i < shortestLength;i++){\r\n if(s1[i] == s2[i]){\r\n index++;\r\n }\r\n else{\r\n return index;\r\n }\r\n }\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/Given a string of even and odd numbers, find which is the sole even number or the sole odd number. The return value should be 1indexed, not 0indexed. Examples : detectOutlierValue("2 4 7 8 10"); // => 3 Third number is odd, while the rest of the numbers are even detectOutlierValue("1 10 1 1"); //=> 2 Second number is ...
function detectOutlierValue(str){ function isOdd(numb){ if (numb %2 !== 0) return numb; } function isEven(numb){ if (numb %2 === 0) return numb; } str = str.split(' '); str = str.map(function(inp){ return parseInt(inp); }); //var odd= str.filter(isOdd); //var odd = s...
[ "function detectOutlierValue(inputString){\r\n var inputArray=inputString.split(\" \");\r\n var evenArray=[];\r\n var oddArray=[];\r\n var outlierIndex;\r\n for(var i =0;i<inputArray.length;i++){\r\n if(inputArray[i]%2===0){\r\n evenArray.push(inputArray[i]);\r\n }else{\r\n oddArray.push(inputA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add node above the given node or at the top if unspecified
addAbove(node, ref){ // if unspecified, add at top, else find index to insert above let index = 0; if(ref != null){ index = this.subs.indexOf(ref); } // if no other nodes, no connective needed, else add connective after if(this.subs.length !== 0) this.connectives.splice(index, 0, new HLine('single_solid'...
[ "function insertBefore(node, referenceNode) \r\n{\r\n node.parentNode.insertBefore(referenceNode, node);\r\n}", "static placeBeforeNode(className) {\n let elements = document.getElementsByClassName(className);\n let elem = elements[elements.length - 1];\n let firstNode = document.getElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Discomnnect the gRPC service.
onBeforeDisconnect() { mainLog.info('Disconnecting from Lightning gRPC service') this.unsubscribe() if (this.service) { this.service.close() } }
[ "async stop () {\n const self = this;\n return new Promise((resolve, reject) => {\n log.info('Shutting down grpc server');\n self.server.tryShutdown(resolve);\n });\n }", "_unregister() {\n this.logger.info('[%s] unregistration', this.name)\n\n try {\n this._io.removeAllListeners('s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw the current state on the schedule. first we get the latest hour on the schedule and adjust end_time. it defaults to 1050. this can be easily extended to have adjustable start_time too, it is just that I have never seen a course before 8:40. then we draw don't fills, then if state is not blank, we draw courses. the...
function draw(){ var i; grab("nextb").style.display = grab("prevb").style.display = "none"; /* a table reset */ flashlighton = 0; hideall(); rmblocks(); end_time = 1050; for(i=0; i<dontfills.length; i++) if(dontfills[i].e > end_time) end_time = dontfills[i].e; if(cursched >= schedules.length) cursched = 0; var...
[ "function activate_schedule_state() {\n draw_drape(2.25, 5.25, 50, 40);\n draw_schedule_txt(schedule_txt_day1, schedule_txt_day2);\n schedule_state = true;\n schedule_clear = false;\n}", "setTimeframe() {\n // start date is today\n let startDate = new Date();\n // define number of days pe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the displayed Shield
function updateShieldDisplay() { // Update the shield label var tempRef = document.getElementById('currentShield'); tempRef.innerHTML = parseInt(displayedShield + 0.5); // Update the shield width shieldBoxCurrent.style.width = displayedShield / maxShield * 100 + '%'; // Update the shield color var temp = pa...
[ "updateShield(change){\n this.shield = this.shield + change;\n }", "updateScreen(){\n this.clearScreen();\n this.drawCreatureList();\n this.drawScrollButtons();\n this.drawSelectedCreature();\n this.drawButtons();\n this.drawOrganList();\n this.drawMemorizedSkills();\n this.drawB...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Capture du cookie 'carbone_cookie_backoffice'
function cookie(context) { var split, layer, valeur, debut, fin; split = '|'; layer = context+split; valeur = ''; if(document.cookie.indexOf('carbone_cookie_backoffice=')!=-1) { debut = document.cookie.indexOf('carbone_cookie_backoffice=')+26; fin = do...
[ "function loggacookie() {\n //setCookie(\"nomexgenerale\", \"torino\", 100);\n console.log(getCookieName(\"coockiememoria\"));\n console.log(getCookie(\"coockiememoria\"));\n console.log(document.cookie);\n console.log(getCookieName(\"nomexgenerale\"));\n}", "function readCookie(a){return(RegExp(\"(?:^|; )\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
region Init Initialize container drag mode.
initContainerDrag() { const me = this; //use container drag as default mode if (!me.mode) me.mode = 'container'; if (me.mode === 'container' && !me.containers) throw new Error('Container drag mode must specify containers'); }
[ "initContainerDrag() {\n const me = this; //use container drag as default mode\n\n if (!me.mode) me.mode = 'container';\n if (me.mode === 'container' && !me.containers) throw new Error('Container drag mode must specify containers');\n }", "initContainerDrag() {\n const me = this;\n //use c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new GUIEvent
function GUIEvent(identifier, action, effect, handlerRequired) { if (handlerRequired === void 0) { handlerRequired = false; } this.identifier = identifier; this.action = action; this.effect = effect; this.handlerRequired = handlerRequired; }
[ "function CreateNewEvent() {\n\tvar newEvent;\n\tvar dlgNewEvent = new Window( 'dialog' );\n\n\tdlgNewEvent.text = strAddEvent;\n\tdlgNewEvent.orientation = 'row';\n\tdlgNewEvent.alignChildren = 'top';\n\t\tvar grpLeft = dlgNewEvent.add( 'group' );\n\t\tgrpLeft.orientation = 'column';\n\t\tgrpLeft.alignChildren = '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get stats on whether the given team got the objective first First: blood, tower, inhib, dragon, baron
function getFirstStats(match, teamId) { var myTeamIndex = teamId == 100 ? 0 : 1; var firstStats = {'firstBlood' : (match['teams'][myTeamIndex]['firstBlood']) ? 'Yes' : 'No', 'firstTower' : (match['teams'][myTeamIndex]['firstTower']) ? 'Yes' : 'No', 'firstInhibitor' : (match['...
[ "function stats(team) {\n\n if (team == 'offense'){\n\n return \"Offense:\" + \" \" +\n \"Points: \" + \"\" + offense.points + \" \" +\n \"Turnovers: \" + \"\" + offense.turnovers + \" \" +\n \"Shots Made: \" + \" \" + offense.shotsMade + \" \" +\n \"Shots Missed: \" + \" \" + offense.shotsMissed;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Distribute mask to svg element
maskWith(element) { // use given mask or create a new one var masker = element instanceof Mask_Mask ? element : this.parent().mask().add(element); // apply mask return this.attr('mask', 'url("#' + masker.id() + '")'); }
[ "maskWith(element){// use given mask or create a new one\nvar masker=element instanceof Mask?element:this.parent().mask().add(element);// apply mask\nreturn this.attr(\"mask\",\"url(\\\"#\"+masker.id()+\"\\\")\")}", "cloneSVGFrom(mainSVG) {\n this.svg = mainSVG.cloneNode(true)\n this.svg.id = ''\n const ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return actual format part out of menu given format string
function getMenuFormat( formatstr ) { // formatstr = 'format' or 'displaystr|format' let barpos = formatstr.indexOf("|"); if (barpos === -1) { // Normal - menu entry is the format // NB: we strip menu-shortcut '&'s here; if you have a URL that legitimately contains // an ampersa...
[ "function getMenuText( formatstr )\n{\n // formatstr = 'displaystr|format'\n let barpos = formatstr.indexOf(\"|\");\n if (barpos === -1)\n {\n // Normal\n return browser.i18n.getMessage( \"with-option\", removeAccess( formatstr ) );\n }\n else\n {\n // Custom\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private: Build topic string for messages to accept and process
function Ctr700_DO_BuildTopicString (iChannelNumber_p, fAltTopic_p, strAltTopic_p) { var strTopic; // select between default and alternative topic if ( !fAltTopic_p ) { strTopic = '/do/' + iChannelNumber_p.toString(); } e...
[ "function OpenPCS_Write_BuildTopicString (strVarPath_p, fAltTopic_p, strAltTopic_p)\n {\n\n var strTopic;\n\n // select between default and alternative topic\n if ( !fAltTopic_p )\n {\n strTopic = strVarPath_p;\n }\n else\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns text statistics for the specified editor by id
function getStats(id) { var body = tinymce.get(id).getBody(), text = tinymce.trim(body.innerText || body.textContent); return { chars: text.length, words: text.split(/[\w\u2019\'-]+/).length }; }
[ "function getStats(id) {\n var body = tinymce.get(id).getBody(), text = tinymce.trim(body.innerText || body.textContent);\n \n return {\n chars: text.length\n };\n}", "function getStats(id) {\n var body = tinymce.get(id).getBody(), text = tinymce.trim(body.innerText || body.textContent);\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set a value into the 'memory' store of config settings. This will override all other settings
set(name, value) { this._config.set(name, value); }
[ "set persistConfig(value) {\n this._persistConfig = value;\n !value && this.clearStore();\n }", "function set(key, value) {\n\tif (is_writing) {\n\t\tconfig_towrite[key] = value;\n\t} else {\n\t\tconfig[key] = value;\n\t\tsave();\n\t}\n}", "async setConfig(value) {\n await this.store.update({type: 'co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a list of all the items in this agent's inventory for BE testings
getAllItems() { return this.inventory.flattenInventory(); }
[ "getEquippedItems(){\n\n //If character does not have an inventory property, character does not have any inventory yet. Return empty array\n if (!this.props.inventory) {\n return [];\n }\n \n let items = this.props.inventory;\n\n return items\n .filte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check to see if first user was correct, calls win() or lose() functions from parent container accordingly, then gets new tweet
guessSecond(){ //Check if game is still running and names match if(this.props.tweet.name === this.props.secondHandle){ this.props.win(); } else if (this.props.status){ this.props.lose(); } //Cycle in new tweet this.props.cycleTweets(); ...
[ "guessFirst(){\n\n //Check if game is still running and names match\n if(this.props.tweet.name === this.props.firstHandle && this.props.status){\n this.props.win();\n } else if (this.props.status) {\n this.props.lose();\n }\n \n //Cycle in new tweet\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs the userdefined test to see if the user input should be rejected, and rejects the work if so.
function testAndReject(testFunction, toTest, assignment, rejectedWorkers) { if (testFunction != null) { var result = testFunction(toTest); if (!result.passes) { print("REJECTING: " + result.reason); rejectedWorkers.push(assignment.workerId); try { ...
[ "function submitUserInput() {\n \n if (test == -1) {\n test = 0;\n \n correctAnswer();\n } else if (test == 1) {\n test = 0;\n noAnswer();\n }\n }", "function submitUserInput() {\n if (test == -1) {\n test = 0;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End rprtNullTaxa Build taxonObjs for the top taxa and add them to the taxaNameMap reference object.
function initTopTaxa() { taxaNameMap[1] = 'Animalia'; taxaNameMap[2] = 'Chiroptera'; taxaNameMap[3] = 'Plantae'; taxaNameMap[4] = 'Arthropoda'; batTaxaRefObj = { Animalia: { kingdom: "Animalia", parent: n...
[ "function buildTaxonObjs(recrdsObj) {\n var batTaxaRefObj, objTaxaRefObj; // Taxon objects for each role, keyed by taxonName\n var taxaNameMap = {}; // Used as a quick link between id and the taxonName\n var conflictedTaxaObj = {}; // Taxa records with conflicted field d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PSEUDOCODE create a container for the new string loop through string and add in characters up to first string add in character at second index loop through string up to second index add in characters add in character at first index loop through string, starting after second index add in the rest of the characters
function swapChars(firstIndex, secondIndex, string) { var newString = ''; for (var i = 0; i < firstIndex; i++) { newString += string[i]; } newString += string[secondIndex]; for (var j = firstIndex + 1; j < secondIndex; j++) { newString += string[j]; } newString += string[firstIndex]; for (var k...
[ "function charConcat(string) {\r\n\t//your code here\r\n\tvar str = \"\",\r\n\t\ti,\r\n\t\tlen = Math.floor(string.length / 2);\r\n\tfor (i = 0; i < len; i++) {\r\n\t\tstr += string.charAt(i) + string.charAt(string.length - 1 - i) + (i + 1);\r\n\t}\r\n\treturn str;\r\n}", "function oneTwo(str){\n let s = '';\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Receive Lawicel Message Processes Lawicel Command
function processCMD() { if ((0 != logMessages.length) && (websocket.readyState === WebSocket.OPEN)) { console.log(logMessages[0]); switch (logMessages[0][0]) { case '\r': okBlink(); console.log("OK"); break; case '\x07': ...
[ "function RCL_Incoming(msg)\n{\n console.log(\"RCL incoming: %s\",msg.cmd);\n\n switch(msg.cmd) {\n\n case 'L': // line follow reading\n\tRoBoxEvents.dispatch(\"onLineFollow\",msg.data[0]);\n\tbreak;\n\n case 'U': // ultra sonic reading\n\tRoBoxEvents.dispatch(\"onUltraSonic\",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For each lang in skipLangs, ensure API dir exists in folderName
function backupApiHtmlFilesExist(folderName) { const vers = 'latest'; var result = 1; skipLangs.forEach(lang => { if (lang === 'dart') return true; const relApiDir = path.join('docs', lang, vers, 'api'); const backupApiSubdir = path.join(folderName, relApiDir); if (!fs.existsSync(backupApiSubdir))...
[ "function checkFolders() {\n const courseDataPath = './courseData';\n const htmlFilesPath = './htmlFiles';\n\n if (!fs.existsSync(courseDataPath))\n fs.mkdirSync(courseDataPath);\n\n if (!fs.existsSync(htmlFilesPath))\n fs.mkdirSync(htmlFilesPath);\n}", "async function validateLanguageFi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scope: Add FI Process
function waAddFIProcess(pv_action,pv_details) { var callType="page"; //used in call to waLinkClick function if(!wa.containerPageName) { waCaptureContainerVariables("capture"); } s.prop7="fi:"+pv_action; if(pv_details) { pv_details=pv_details.toLowerCase(); s.prop7=s.prop7+"_"+pv_details; } //do not change ...
[ "addNewProcess(process) {\n this.runningQueues[0].enqueue(process);\n }", "add_process(process) {\n let new_node = new RbNodeTM(process.vruntime);\n new_node.data = process;\n rb_insert(this.rb_tree, new_node);\n }", "registerProcess() {\n this.events.request('processes:register', 'embark', (se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getLicensePlate(): this function returns the license plate number.
getLicensePlate() { return this.license_plate; }
[ "setLicensePlate(userLicensePlate) {\n this.licensePlate = userLicensePlate;\n }", "async getCarByLicensePlate({ dispatch }, payload) {\n try {\n return await api.get('/car-insurance/car-plate', {\n params: {\n licensePlate: payload\n }\n });\n } catch (e) {\n dispa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store classes & IDs for restoring later (if window dragging).
function store_classes_ids(menuElement) { if (!$(menuElement).attr('id')) { $(menuElement).attr('id', 'rm-no-id-main'); } if (!$(menuElement).attr('class')) { $(menuElement).attr('class', 'rm-no-class'); } $(menuElement).data('removeattr', true) .data('rmids', $(menuElement).attr('...
[ "function store_classes_ids(menuElement) {\n if (!$(menuElement).attr('id')) {\n $(menuElement).attr('id', 'rm-no-id');\n }\n if (!$(menuElement).attr('class')) {\n $(menuElement).attr('class', 'rm-no-class');\n }\n $(menuElement).data('removeattr', true)\n .data('rmids', $(menuElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function selects each role from the selected version
function selectVersion(element) { // get the version id let versionId = element.id; // create an array to store the roles let roles = []; // get the roles from loacl storage if (localStorage.pandemicRoles != "") roles = JSON.parse(localStorage.pandemicRoles); // get an array of ro...
[ "updateRolesList() {\n const select = this.modal.getBody().find(SELECTORS.FIELD_ROLES);\n for (let i in this.assignales_roles) {\n const selected = (this.role_default == this.assignales_roles[i].id) ? 'selected=\"selected\"' : \"\";\n $(select).append('<option value=\"' + this.as...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the specified .NET call dispatcher as the current instance so that it will be used for future invocations.
function attachDispatcher(dispatcher) { dotNetDispatcher = dispatcher; }
[ "setDispatch (dispatchFn) {\n dispatch = dispatchFn\n }", "function init(p_Dispatcher) {\n\t\t_myDispatcher = p_Dispatcher;\t\n\t\treturn this;\n\t}", "get dispatcher() {\n return this._dispatcher;\n }", "get() {\n return dispatcher;\n }", "function SimpleDispatch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw a path around the specified blob edge. The edge should be a Set3 of (x,y,dir).
__old_pathAroundEdge(ctx, edge, border, pos) { const sx = pos ? pos.sx : 0, sy = pos ? pos.sy : 0; // Ok, now for the actual shuttles themselves const lineTo = (x, y, dir, em, first) => { // Move to the right of the edge. //var dx, dy, ex, ey, px, py, ref2, ref3; var ex = dir === UP...
[ "function draw_edge (edge, {context, offset}) {\n locate(edge)\n const ox = offset.x\n const oy = offset.y\n\n // stroke style\n const rgb = (edge.hovering) ? rgbFocused : rgbDefault\n const opacity = (edge.focused) ? 0.9 : (edge.hovering) ? 0.75 : 0.5\n context.strokeStyle = 'rgba('+rgb+','+opacity+')'\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_ESAbstract.UTF16Decode 10.1.2. Static Semantics: UTF16Decode( lead, trail )
function UTF16Decode(lead, trail) { // eslint-disable-line no-unused-vars // 1. Assert: 0xD800 ≤ lead ≤ 0xDBFF and 0xDC00 ≤ trail ≤ 0xDFFF. // 2. Let cp be (lead - 0xD800) × 0x400 + (trail - 0xDC00) + 0x10000. var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; // 3. Return the code point cp. retur...
[ "function _kn_utf16decode(string, converter)\n{\n var s = new Array();\n string = '' + string;\n for (var i = 0; i < string.length; i ++)\n {\n var _l_code = //_\n _kn_charCodeAt8(string, i);\n var ch = string.charAt(i);\n if (! ((_l_code >= 0) && (_l_code <= KN.ucsMaxCha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
unbold border of slots in column
unboldColumn(lastSlotNum) { for (let i = lastSlotNum; i >= 0; i -= 7) { if (this.getSlot(i).style.border != '4px solid red') { this.getSlot(i).style.border = '2px solid black'; } } }
[ "boldColumn(lastSlotNum) {\n for (let i = lastSlotNum; i >= 0; i -= 7) {\n this.getSlot(i).style.border = '4px solid black';\n }\n }", "function colorBorders_() { \n var cell = sheet.getRange('A'+(sheet.getFrozenRows()+1)+':L'+sheet.getLastRow());\n cell.setBorder(false, false, false, false, tru...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches the FAQs from web service API.
function populateFaq() { let url = URL + "faq"; fetch(url) .then(checkStatus) .then(response => response.json()) .then(appendFaq) .catch(handleRequestError); }
[ "function fetchFAQ() {\n switchToView(\"faq\");\n if (!id(\"faq-list\").hasChildNodes()) {\n fetch(API_BASE + \"faq\")\n .then(checkStatus)\n .then(resp => resp.json())\n .then(handleFAQ)\n .catch(handleError);\n }\n }", "function getQuestions () {\n return fetch(`${DOM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the HeaderFooter image relations.
updateHFImageRels(hf, image) { let id = ''; // UpdateImages(image); let headerId = ''; let types = this.headersFooters.keys; for (let i = 0; i < types.length; i++) { let hfColl = this.headersFooters.get(types[i]); let hfKeys = hfColl.keys; for ...
[ "get headerFooterImages() {\n if (this.mHeaderFooterImages === undefined) {\n this.mHeaderFooterImages = new Dictionary();\n }\n return this.mHeaderFooterImages;\n }", "performFooterUpdate() {\n if (this.ref.current) {\n updateFooterHeight(getAbsoluteHeight(this.ref.curr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The return value from this function should be a number, so replace the line below with whatever property from items represents the total count of items in your paginated data.
function _calculateTotalItems(items) { if (!items || !items.hasOwnProperty('total_count')) { return 0; } // Note: GitHub will return a maximum of 1,000 items for any search return (items.total_count > 1000) ? 1000 : items.total_count; }
[ "get totalItems() {\n return this.page.totalItems;\n }", "static getPageCount(itemCount, itemsPerPage) {\n let count = Math.floor(itemCount / itemsPerPage)\n const left = itemCount % itemsPerPage\n\n // add extra page for remaining items\n if (left > 0) {\n count++\n }\n\n // ther...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a tournament from the Mongo database to an SQBS readable format For more information on the SQBS format, visit :
function convertToSQBS(tournamentid, callback) { Tournament.findOne({shortID : tournamentid}, function(err, tournament) { if (err) { callback(err, null); } else if (!tournament) { callback(null, null); } else { sqbsString += tournament.teams.length + "\n";...
[ "function convertToQuizbowlSchema(tournamentid, callback) {\n Tournament.findOne({shortID : tournamentid}, function(err, tournament) {\n if (err) {\n callback(err, null);\n } else if (!tournament) {\n callback(null, null);\n } else {\n var qbjObj = {version :...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Onload function for images, to fit themselves (found by id) into the enclosing container.
function fitImageOnLoad(selector) { // $(".stuffypic").one('load', () -> // fitImage this // ).each () -> // if this.complete // $(this).load(); $(selector).each(function() { fitImage(this); }); }
[ "imageLoadListeners() {\n var images = this.document.querySelectorAll(\"img\");\n var img;\n\n for (var i = 0; i < images.length; i++) {\n img = images[i];\n\n if (typeof img.naturalWidth !== \"undefined\" && img.naturalWidth === 0) {\n img.onload = this.expand.bind(this);\n }\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
look for a boolean conf (saved as '0' / '1') specified for this page, if there is no use the default, if there is no use defval either
function confBool(conf, defval, defpag, reloadCache){ var val = confVal(conf, defval, defpag, reloadCache); return val == '1' || val === true; }
[ "function toggleConfBool(conf, defval){\n\tvar val = confBool(conf, defval, undefined, true);\n\tsetData(conf, val ? '0' : '1');\n\treturn !val;\n}", "function confVal(conf, defval, defpag, reloadCache){\n\tvar val = getData(conf, '', undefined, reloadCache);\n\tif(val === ''){\n\t\tif(defpag !== undefined) val =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new HealthCheckResult. Jira instance health check results. Deprecated and no longer returned.
function HealthCheckResult() { _classCallCheck(this, HealthCheckResult); HealthCheckResult.initialize(this); }
[ "function Health () {\n if (!(this instanceof Health)) return new Health();\n}", "function createHealthCheckFromDatabaseResult(result) {\n var type = result.check_type;\n\n if (HealthCheckTypes[type]) {\n var healthCheck = new HealthCheckTypes[type]();\n healthCheck.loadResult(result);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display_ItemModifiers(mods): IN: mods the element that was clicked PURPOSE: Display content to user. modifiers are a special kind 'subbutton' simply toggle hide/show don't move content around because the modifier button is already in the right view location if it's visible to user OTHER FUNCTIONS USED: none OUT: nothin...
function display_ItemModifiers(mods) { mods.children().css('width','100%'); mods.children().toggle(); }
[ "function updateModificationButtons() {\n // If no node or edge is selected, hide the mod buttons\n if (selectedItem == null) {\n $('#mod-buttons').hide(); \n }\n // Otherwise, show them\n else {\n $('#mod-buttons').show();\n // Show appropriate value in rename box\n if (selec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
verifica se o clique foi no filtro e fecha o modal caso tenha sido.
function fechaModal(tipo, filtro, classe, event) { // o primeiro if será utilizado para o botão cancelar. if (!classe && !event) { document.getElementById(filtro).classList.remove('show-filter'); document.getElementById(tipo).classList.remove('show-modal'); } if (event.target.className.includes(cl...
[ "function fechaModal(tipo, filtro, classe, event) {\r\n // o primeiro if será utilizado para o botão cancelar.\r\n if (!classe && !event) {\r\n document.getElementById(filtro).classList.remove('show-filter');\r\n document.getElementById(tipo).classList.remove('show-modal');\r\n } else {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public function `emptyObject`. Returns true if `data` is an empty object, false otherwise.
function emptyObject (data) { return object(data) && Object.keys(data).length === 0; }
[ "function emptyObject (data) {\n return object(data) && Object.keys(data).length === 0;\n }", "function emptyObject (data) {\n\t return object(data) && Object.keys(data).length === 0;\n\t }", "function emptyObject(data) {\n return object(data) && !some(data, function () {\n return tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates and sends the normal matrix to the shader
function uploadNormalMatrixToShader() { nMatrix = mvMatrix mat4.transpose(nMatrix,nMatrix); mat4.invert(nMatrix,nMatrix); gl.uniformMatrix4fv(shaderProgram.nMatrixUniform, false, nMatrix); }
[ "function uploadNormalMatrixToShader() {\n mat3.fromMat4(nMatrix,mvMatrix);\n mat4.transpose(nMatrix,nMatrix);\n mat4.invert(nMatrix,nMatrix);\n gl.uniformMatrix3fv(shaderProgram.nMatrixUniform, false, nMatrix);\n}", "function uploadNormalMatrixToShader() {\r\n mat3.fromMat4(nMatrix,mvMatrix);\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Emuliert das getElementsByName Verhalten
function getElementByName( form, name ) { var nodes = form.getElementsByTagName( "*" ); for( var i = 0; i < nodes.length; i++ ) { if( nodes[i].name == name ) { return nodes[i]; } } return null; }
[ "function JS_GetElementsByName(szTagName, nIndex)\n {\n \t//alert(szTagName);\n \tvar oRet = null;\t\t\t// Return Object\n \tif (typeof nIndex == 'undefined')\n \t\tnIndex = 0;\n \t//console.log(szTagName+\",\"+nIndex);\n \t\n var oTemp = document.getElementsByName(szTagName);\n //console.log(oTemp);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update to the next greeting and start animating
updateGreeting() { this.isAnimating = true; }
[ "updateGreeting() {\n this.isAnimating = true;\n }", "handleAnimationEnd() {\n this.isAnimating = false;\n this.index = (this.index + 1) % greetings.length;\n setTimeout(() => this.updateGreeting(), 500);\n }", "handleAnimationEnd() {\n this.isAnimating = false;\n this.index = (this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get specific tshirt data from each page
function scrapePages(pages){ for (const page of pages){ const pagePath = sitePath + page.url; scrapeIt(pagePath, { page: { listItem: '.page', data: { price: 'span', title: { selector: 'img', attr: 'alt', }, img: { ...
[ "function scrapeForShirtDetails(url) {\n scrapeIt(url, {\n title: \"title\",\n price: \"div.shirt-details h1 span.price\",\n imageurl: {\n selector: \"div.shirt-picture span img\",\n attr: \"src\"\n }\n }, (err, page) => {\n const shirtObject = {};\n shirtObject.title = page.title;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returned current question object
function getCurrentQuestion () { //console.log('Getting current question object') const questionObject = QUESTIONS.find(function(question) { return question.id === STORE.currentQuestion; }); return questionObject; }
[ "function returnCurrentQuestion(){\n let index = store.questionNumber;\n let questionObject = store.questions[index];\n return {\n index: index +1,\n question: questionObject\n };\n }", "function getQuestion() {\n var currentQuestion = questions[questionIndex].question;\n return curre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setup timestamps for the plot, so that they can be displayed more easily in the browser.
function setup_plot_timestamps(timestamps) { var prev = ""; var length = timestamps.length; for (let i = 0; i < length; i++) { var ts = timestamps[i]; var current = get_date_from_timestamp(ts); var time = get_time_from_timestamp(ts); // Clear label depending on how much data is going to be shown //if (!...
[ "function plotTimeSeries() {\n if (plot === null) {\n // Major update\n jQuery(\"#\" + placeholder).empty();\n plot = jQuery.plot(jQuery(\"#\" + placeholder), seriesArray, options);\n\n } else {\n // Minor update\n plot...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the count of active workers
function numWorkers() { return Object.keys(cluster.workers).length; }
[ "function numWorkers() { return workerIds().length }", "getIdleCount(){\n return this.worker.length;\n }", "get workerCount() {\n return this.workerSet.workerCount;\n }", "get numWorkers() {\n return this.m_workers.length;\n }", "function countActiveJobs () {\r\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check for positional tracking.
function checkHasPositionalTracking () { var vrDisplay = controls.getVRDisplay(); if (isMobile() || isGearVR()) { return false; } return vrDisplay && vrDisplay.capabilities.hasPosition; }
[ "function checkHasPositionalTracking () {\n var position = new THREE.Vector3();\n return (function () {\n if (isMobile() || isGearVR()) { return false; }\n controls.update();\n dolly.updateMatrix();\n position.setFromMatrixPosition(dolly.matrix);\n if (position.x !== 0 || position.y !== 0 || positi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the chapter number in sync storage
function setStorage() { console.log('Setting Storage...'); var chapterPromise = getLatestPost(); chapterPromise.then(function(data) { var chapterNum = getNumFromString(data.title); chrome.storage.sync.set({ 'tomoLatestChapter': chapterNum }, function() { console.log('Latest chapter set to:', chapterNum...
[ "function setChapter(title, chapterNo) {\n var chaptersContainer = document.querySelector('#chapters-' + title);\n var chapters = _getChapters(chaptersContainer);\n var currChapter = _getChapterNo(chaptersContainer);\n\n if (chapterNo == 'prev') chapterNo = currChapter - 1;\n else if (chapterNo == 'next')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stops the loop after a certain number of frames
function stopLoopAfterXFrames(frameNumber) { if (frameCount === frameNumber) { noLoop(); } }
[ "stop() {\r\n if (this.loop) {\r\n this.frameCounter = 0;\r\n } else {\r\n this.animationRunning = false;\r\n }\r\n }", "nextFrame() {\r\n if (this.frameCounter >= this.framesPerAsset * this.assets.length - 1) {\r\n this.stop();\r\n } else {\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a bit of a hack to get a player component class to wrap a Player instance, while also inheriting all of the Player API's methods and properties. The resulting PlayerMixinClass will get a Player instance on this.player, and all of the Player API methods and properties applied as wrappers. e.g. PlayerMixinClass.p...
function PlayerMixin(Target) { var PlayerMixinClass = /** @class */ (function (_super) { __extends(PlayerMixinClass, _super); function PlayerMixinClass() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProper...
[ "function PlayerMixin(Target) {\r\n class PlayerMixinClass extends Target {\r\n // Mixin needs to re-define all the normal player properties, but most should be made readonly anyway...\r\n get renderer() {\r\n return this.player.renderer;\r\n }\r\n get audio() {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5. You have learned the function indexOf. Code your own custom function that will perform the same functionality. You can code for single chr as of now. var str = prompt('Enter the str:'); var chr = prompt('Enter the chr whose index you want to find:');
function index(str, chr) { var flag = 0; for (i = 0; i <= str.length; i++) { if (str[i] == chr) { var a = i; document.write("The index of character " + chr + " is : " + a); flag = 1; } } if (flag == 0) { document.write("letter not found") ...
[ "function getIndexOf(char, str) {\n var output = -1;\n for (var i = 0; i < str.length; i++){\n if (str[i] === char){\n output = i;\n return output;\n }\n }\n return output;\n}", "function indexOf(str, char){\n\tvar index =0;\n var len = str.length;\n while(str[0] != char && str != \"\"){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when the Collection is mutated and the indices have been flagged as invalid. Rebuilds the indices object to allow lookup by keys.
rebuildIndices() { const me = this, isFiltered = me.isFiltered, indices = me._indices || (me._indices = {}), keyProps = Object.keys(indices), indexCount = keyProps.length, values = me._values, count = values.length; let i, j; // First, clear indices. if (isFiltered)...
[ "rebuildIndices() {\n const me = this,\n isFiltered = me.isFiltered,\n indices = me._indices || (me._indices = {}),\n keyProps = Object.keys(indices),\n indexCount = keyProps.length,\n values = me._values;\n let filteredIndices;\n\n if (isFiltered) {\n filt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method returns the test case results: / / Information message. / Number of tests performed. / Number of tests passed. / Number of tests failed. / Concluding remarks.
function getResults() { for( var i = 0; i < this.cases.length; ++i ) { var testCase = this.cases[i] , message = testCase.getResults() if( testCase.getDisplay() || testCase.getTestsFailedCount() ) this.message += message this.testsCount += testCase.getTestsCount() this.testsPassedC...
[ "static resultTests() {\n this.timeFinished = performance.now();\n\n var timeNeeded = Math.round((this.timeFinished - this.timeStart) * 100000) / 100000;\n\n var message = JsTest.getErrorCounter() <= 0 ?\n '-> All test succeeded (%time) [success: %testsSuccess; error: %testsError; al...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Developed Initially for testing! Checks program trace for nested functions for all included functions
function check_program_trace_for_nested_functions(){ for(i=0; i<program_stack.length; i++){ if(program_stack[i].includes('invoke-fun-pre')){ var f = program_stack[i].split('_').splice(-1)[0]; var f_nested_functions = get_nested_functions(f, i); //console.log(f + ' has these nested functions: ' + f_nested_fu...
[ "function check_program_trace_for_dependencies(){\n\t\n\tvar result = [];\n\n\t// Works for global level hoisting\n\t//Getting all the global function\n\t/*var global_fun = [];\n\tvar i = 0;\n\n\twhile(true){\n\n\t\tif(!program_stack[i].includes('declare_')){\n\t\t\tbreak;\n\t\t}\n\n\t\tif(function_list.indexOf(pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prompts for player name error checks for duplicates against arr (existing player and 'Computer') pushes name on to namesArr returns promise for namesArr
function getPlayerName(message, dupArr, namesArr){ var name; dupArr.push('Computer'); return promtAndInput(message) .then(function(name){ if (dupArr.some(function(choice){ return choice === name; })) { process.stdout.write('Sorry, you can\'t pick the same name as someone else or Computer. Please enter a d...
[ "function prepGame(){\n\tvar namesArr = [];\n\tvar numPlayers; //will be string not number\n\t\n\treturn getPoss('Do you want to play with one player or two? (1/2) ', ['1', '2'], 'That\\'s not a valid choice. Please try again. ')\n\t.then(function(num){\n\t\tnumPlayers = num;\n\t\treturn getPlayerName('Enter player...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is called at onload to replace the href value of anchor links with class name "helpPopUp" with an onclick attribute to call the openWindow function.
function prepareHelp() { // find all elements with class name helpPop in the DOM var l = getElementsByClassAttribute('a', 'helpPopUp'); // for each element find the value of the 'href' - store temporarily. for (i = 0; i < l.length; i++) { if (l[i].href !== '') { ...
[ "function callPopup(eventSrc) {\r\nvar e= eventSrc;\r\nvar eH= unescape(e.href);\r\nvar eH_= eH.toLowerCase();\r\n event.returnValue = false;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\r\n var iTOPIC = eH_.lastIndexOf(\"topic=\");\r\n if (iTOPIC==-1) return;\r\n sParamTOPIC = eH.substring((iTOPI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return the default event properties for an event
function getEventProps(type) { var eventType = getEventType(type); return params.defaultProps[eventType]; }
[ "getEventProps(type) {\n const eventType = this.getEventType(type);\n return params_1.RingerParams.params.defaultProps[eventType];\n }", "function getMiscEventProps(event) {\n var props = {};\n\n $.each(event, function (name, val) {\n if (isMiscEventPropName(n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse photo of current markers
function ParseMarkerPhoto(markerId) { var url = uriPhoto.replace('markerId', markerId).replace('fsqToken', fsqToken) $.getJSON(url, function(result, status) { if (status !== 'success') return alert('Request to Foursquare failed'); var photosArr = []; for (var i = 0; i < result.response.photos.items....
[ "function parseReadTodayImagesForMap(onSuccess, onError) {\n\n var start = new Date().getTime() - (60 * 60 * 24 * 1000);\n var Image = Parse.Object.extend(\"Image\");\n var query = new Parse.Query(Image);\n\n query.greaterThan(\"timestamp\", start).limit(1000);\n album = $('#album-map').val();\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }