query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Timeout Noty Notification in the topright corner of screen
function timeouttrNoty(){ new Noty({ text: 'Timeout Notification', layout: 'topRight', timeout: 3000 }).show(); }
[ "function OnMessageTimeOut(id) {\n\n\tif (id == DVDMSGTIMER) {\n\t\tMessage.Text = \"\";\n\t\tMessageFull.Text = \"\";\n if (g_LTRReading)\n {\n xCoord = TitleFull.TextWidth;\n }\n else\n {\n xCoord = g_ConWidth - TitleFull.TextWidth - MessageFull.TextWidth -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fold a handler value with z
function Fold(f, z, c, to) { this.f = f; this.z = z; this.c = c; this.to = to; this.resolver = failIfRejected; this.receiver = this; }
[ "function map3 (xss, f) {\n var k = 0;\n var output = a();\n const length = getWithDefault(xss, \"length\", 0);\n while (k < length) {\n let lookbehind = access(xss, k-1);\n let currentval = access(xss, k);\n let lookahead = access(xss, k+1);\n output.pushObject(f(lookbehind, currentval, lookahead))...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Defining a function that unsubscribes from a specified channel. channelName is required
function UnsubscribeFromChannel (channelName) { if(channelName == null || channelName == '' || deviceToken == null || deviceToken == '') { alert('Channel name or device token is null or empty !'); return; } // Unsubscribes the device from the 'test' channel Cloud.PushNotifications.unsubscribeToken({ ...
[ "unsubscribe (channel) {\n\t\tthis.pubnub.unsubscribe({\n\t\t\tchannels: [channel]\n\t\t});\n\t\tthis._stopListening(channel);\n\t}", "function unregister(uaid, data, cb) {\n\n async.waterfall([\n function(cb) {\n store.get('channel/' + data.channelID, cb);\n },\n function(channel, cb) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A DFA state represents a set of possible ATN configurations. As Aho, Sethi, Ullman p. 117 says "The DFA uses its state to keep track of all possible states the ATN can be in after reading each input symbol. That is to say, after reading input a1a2..an, the DFA is in a state that represents the subset T of the states of...
function DFAState(stateNumber, configs) { if (stateNumber === null) { stateNumber = -1; } if (configs === null) { configs = new ATNConfigSet(); } this.stateNumber = stateNumber; this.configs = configs; // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1) // {@link Token//EOF} maps to {...
[ "function DFAState(stateNumber, configs) {\n if (stateNumber === null) {\n stateNumber = -1;\n }\n if (configs === null) {\n configs = new ATNConfigSet();\n }\n this.stateNumber = stateNumber;\n this.configs = configs;\n // {@code edges[symbol]} points to target of symbol. Shift u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compatibility function, since pre0.5.0 functions don't have node.kind returns undefined if you don't put in a function node
function functionKind(node) { if (node.nodeType !== "FunctionDefinition") { return undefined; } if (node.kind !== undefined) { //if we're dealing with 0.5.x, we can just read node.kind return node.kind; } //otherwise, we need this little shim ...
[ "static getType(val) {\n\n if (val instanceof Node) {\n return \"NODE\";\n }\n\n if (typeof(val) === \"string\") {\n return \"STRING\";\n }\n\n if (val instanceof _Node_main_js__WEBPACK_IMPORTED_MODULE_2__.default) {\n return \"YNGWIE\";\n }\n\n return undefined;\n\n }", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Added an initialize function which is essentially the code from the S constructor. Now, the S constructor calls this and a new method named setValue calls it as well. The setValue function allows constructors for modules that extend string.js to set the initial value of an object without knowing the internal workings o...
function initialize (object, s) { if (s !== null && s !== undefined) { if (typeof s === 'string') object.s = s; else object.s = s.toString(); } else { object.s = s; //null or undefined } object.orig = s; //original object, currently only used by toCSV() and toBoolean()...
[ "constructor(value) {\n if (typeof(value) === \"string\") {\n this._value = value; // Arbitrary STRING value that can be stored by this node\n this._parent = undefined; // Parent of this node\n this._first = undefined; // First child of this node\n this._last = undefined; // Last ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a new observable property to the instance of Group. The given setter defines how to update the property.
function define(name, set) { assert(!self[name]); var p = Property({ subscribed: loadInfo, get: function () { return loadInfo().then(function () { ...
[ "set(propObj, value) {\n propObj[this.id] = value;\n return propObj;\n }", "addProperty(property, value) {\n this.properties.set(property, value);\n }", "function attachToGlobal(property, getter) {\n const global_ = typeof globalThis !== 'undefined' ? globalThis :\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to start the game by clearing the wrapper, creating and appending the buttons and all the cards to the DOM
function startGame() { createButtons(); createCards(); displayCards(); }
[ "function startGame() {\n removeWelcomePage();\n createGamePage();\n createCards();\n}", "function startGame() {\n getDifficulty();\n startTimer();\n addCards();\n $(\"refresh\").addEventListener(\"click\", addCards);\n toggleGame();\n currSetCount = 0;\n $(\"se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configure minor WebGLRenderer parameters
configureWebGLRenderer() { if (this.WebGLRenderer !== undefined) { /* Configures THREE.WebGLRenderer according to this.nature.WebGLRendererParameters */ if (this.nature.WebGLRendererParameters) { if (this.nature.WebGLRendererParameters.clearColor) this...
[ "resizeWebGLRenderer() {\n if (this.WebGLRendererCanvas && this.WebGLRendererCanvas.classList.contains('hidden')) this.WebGLRendererCanvas.classList.remove('hidden');\n let resolutionFactor = 1.0;\n /* Cheks if this.nature.WebGLRendererParameters.resolutionFactor if defined */\n if (this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an array of canvas pixel data, give us the average colour as an [r, g, b]
function averageColour (pixels) { var red = 0 var green = 0 var blue = 0 // Each pixel is actually 4 cells in the array for (var i = 0; i < pixels.length; i += 4) { red += pixels[i] green += pixels[i + 1] blue += pixels[i + 2] } return [ Math.round(red / (i ...
[ "getAverageImageColor(image) {\n let ctx = document.createElement('canvas').getContext('2d');\n\n ctx.canvas.width = CANVAS_WIDTH;\n ctx.canvas.height = CANVAS_WIDTH * image.height/image.width;\n\n // ctx.canvas.height = ctx.canvas.width * (image.height/image.width);\n ctx.drawIma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to empty the notes fields
function emptyNotes() { title.val(""); text.val(""); }
[ "function clearNotes() {\n clear: localStorage.clear();\n}", "function clearFields(fields) {\n\tfields.forEach(element => {\n\t\telement.value = \"\";\n\t});\n\tfields[0].focus();\n}", "function resetFields() {\n\n fields.forEach(field => {\n field.innerHTML = \"\";\n });\n\n}", "function clea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: extUtils.replaceParamsInExprStr DESCRIPTION: Replaces parameter instances with the paramObject Javascript reference. When the script is evaluated, the references will resolve to the correct values from the paramObject. ARGUMENTS: theExprStr string expression to replace params in paramObj server behavior param...
function extUtils_replaceParamsInExprStr(theExprStr, paramObj, directiveStack, levelToLoopParams, isPartOfDir) { if (typeof theExprStr == "string" && theExprStr.length && theExprStr.indexOf(extUtils.STR_DELIM_PARAM_BEGIN) != -1) { for (var param in paramObj) { ...
[ "function extUtils_replaceValuesInString(theStr, updatePatterns, paramObj)\n{\n var retVal = '';\n\n if (typeof theStr == \"string\" && theStr.length)\n {\n retVal = theStr;\n for (var i=0; i < updatePatterns.length; i++)\n {\n if (updatePatterns[i].pattern) //if there is a pattern\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create_date computed: true, optional: false, required: false
get createDate() { return this.getStringAttribute('create_date'); }
[ "function validateCreated(cb_err) {\n if (typeof this.created !== 'undefined') {\n if (!validator.isDate(this.created)) {\n cb_err();\n }\n }\n }", "function createDate() {\n theDate = new Date();\n }", "function assem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===generateUserImages=== Desc: generates the users images.
generateUserImages(imageArr) { const toReturn = imageArr.map((curImage) => <img className={AdminPageStyles.reviewTemplateImageBorder} src={curImage} alt="" key ={curImage} onClick={() => { this.setState({ displayCurUserImage: true }); this.setState({ currentUserImage: curIma...
[ "async function generateImages() {\n clear();\n console.log(chalk.magentaBright(figlet.textSync('profile-scraper'))+\"\\n\");\n throbber.start(\"Starting...\");\n for (let index = 1; index < 26; index++) {\n const fileName = `agent-profile-${(index + \"\").padStart(3, \"0\")}.jpg`;\n await...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
serializeProperty serializes properties deeply. This understands how to wait on any unresolved promises, as appropriate, in addition to translating certain "special" values so that they are ready to go on the wire.
function serializeProperty(ctx, prop, dependentResources, opts) { return __awaiter(this, void 0, void 0, function* () { // IMPORTANT: // IMPORTANT: Keep this in sync with serializePropertiesSync in invoke.ts // IMPORTANT: if (prop === undefined || prop === null || ...
[ "function serializeResourceProperties(label, props, opts) {\n return __awaiter(this, void 0, void 0, function* () {\n return serializeFilteredProperties(label, props, (key) => key !== \"id\" && key !== \"urn\", opts);\n });\n}", "function serializeFilteredProperties(label, props, acceptKey, opts) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return column type accirding to type
function getColumnType(type) { switch (type) { case 'integer': return 'number'; case 'datetime': return 'date'; default: return type; } }
[ "set_col(col, type) {\n this.df = this.df.map(x => {\n switch (type) {\n case \"num\":\n x[col] = Number(x[col]);\n break;\n case \"date\":\n x[col] = new Date(x[col]);\n break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================================// firePhazer() ================================// puts a new phazer object out into the world (in the appropriate array of course) and play thelaser blasting sound. updates the amount of charge left in current laser "clip"
firePhazer() { if (this.chargeEmpty === false) { let newPhazer = new Phazers(); player.updateCharge(); phazers.push(newPhazer); laserBlast.play(); } //if the player tries to fire the phaser while charge is empty, play the empty battery sound else { lowCharge.playMode('until...
[ "shoot() {\n var targetX = this.sceneManager.Zerlin.x;\n var targetY = this.sceneManager.Zerlin.boundingbox.y + this.sceneManager.Zerlin.boundingbox.height / 2;\n var randTargetX = targetX + (this.sceneManager.Zerlin.boundingbox.width * (Math.random() - .5));\n var randTargetY = targetY + (this.sceneMan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to randomize exit position at the beginning of each level
function randomizeExit(){ targetx = Math.floor(Math.random() * (width/2))+width/2-1;//picks random position for exit on the further half of the level targety = Math.floor(Math.random() * (height/2))+height/2-1; if(map[targetx][targety]=="."){//if desired ending is a wall, check the four adjacent directions until y...
[ "function generate_level() {\r\n startposx = randomNbr(1, 12)\r\n startposy = randomNbr(1, 11)\r\n let endposx = randomNbr(startposx + 1, 13)\r\n let endposy = randomNbr(1, 11)\r\n let posX_table = [startposx, endposx]\r\n let posY_table = [startposy, endposy]\r\n\r\n //save new position for x,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that finds rated TRV parameters according to IEC 62271100 2010 and IEEE C37.0112011
function find_rated_TRV_parameters1(){ var Tx = document.getElementById('TRV_K_id').value var Tt = document.getElementById('TRV_Rated_short_circuit_id').value var Percentage = Tx/Tt*100 //Percentage of short-circuit current on rated short-circuit if (Percentage>100){ errorbar.innerHTML = "<p class=error_b...
[ "function compute_TRV_parameters() {\n\t\n if (document.getElementById('TRV_envelope_id').value == \"Customized\") {\n\n var Uc = document.getElementById('TRV_Uc_id').value\n var U1 = document.getElementById('TRV_U1_id').value\n var RRRV1 = document.getElementById('TRV_RRRV1_id').value\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds a grid named 'name' in function 'fO' and returns its dynamic size
function findGridGetDynSize(fO, name) { for (var i = 0; i < fO.allGrids.length; i++) { if (fO.allGrids[i].caption == name) { return fO.allGrids[i].data[0]; } } }
[ "function allocAnyDynamicGrid(mO, fO, sO) {\r\n\r\n var out_id = 0; // grid id of output grid\r\n\r\n var gId = sO.allGridIds[out_id];\r\n var gO = fO.allGrids[gId];\r\n\r\n // if this step doesn't have a new out grid OR the out grid does not\r\n // have any dynamic sizes, then no...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loginSelection a function to press the button to log the user into their spotify
function loginSelection(button_id) { /* get the button, and change the color to show selection */ let selected_button = document.getElementById(button_id); selected_button.style.background = "black"; selected_button.style.color = "#cfe8fa"; /* on successful login, should changed to successfu...
[ "onLogin() {}", "clickLoginButton() {\n this.loginButton.waitForDisplayed()\n this.loginButton.click()\n }", "function onLogin( evt )\n{\n\tconsole.log(\"Logged In!\");\n\tsfs.send( new SFS2X.Requests.System.JoinRoomRequest(roomid));\n}", "static login() {\n const doc = navigationDocument....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return all players currently connected to server.
function getAllPlayers() { var players = []; Object.keys(io.sockets.connected).forEach(function(socketId) { var player = io.sockets.connected[socketId].player; if (player) { players.push(player); } }); return players; }
[ "listSockets() {\n var list = this.players.map(player => player.socketID);\n list.push(this.hostID);\n return list;\n }", "getConnects() {\n var result = [];\n for (var i = 0; i < this.connectionList.length; i++) {\n result.push(this.connectionList[i]);\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isBinary :: Function > Boolean
function isBinary(f) { return f.length >= 2; }
[ "function validate_binary(input) {\n var len = input.length;\n var i;\n for(i=0;i<len;i++) {\n\tif(input.charAt(i) != \"0\" && input.charAt(i) != \"1\") {\n\t break;\n\t}\n }\n if (i<len) {\n\treturn 0;\n }\n return 1;\n}", "function isBin(string) {\r\n\tfor (i=0; i<string.length; i++)\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by KotlinParservarianceAnnotation.
exitVarianceAnnotation(ctx) { }
[ "exitAnnotationTypeMemberDeclaration(ctx) {\n\t}", "exitUnannTypeVariable(ctx) {\n\t}", "enterVarianceAnnotation(ctx) {\n\t}", "exitUnannArrayType(ctx) {\n\t}", "exitMultiVariableDeclaration(ctx) {\n\t}", "exitTypeParameterModifier(ctx) {\n\t}", "exitParenthesizedType(ctx) {\n\t}", "exitUnannReference...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by Java9ParserlabeledStatement.
exitLabeledStatement(ctx) { }
[ "visitExit_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "exitStatementWithoutTrailingSubstatement(ctx) {\n\t}", "exitLabeledStatementNoShortIf(ctx) {\n\t}", "exitBlockLevelExpression(ctx) {\n\t}", "exitBasicForStatement(ctx) {\n\t}", "exitOrdinaryCompilation(ctx) {\n\t}", "exitMultiVaria...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserxmltype_column_properties.
visitXmltype_column_properties(ctx) { return this.visitChildren(ctx); }
[ "visitXmltype_table(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitObject_type_col_properties(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitSqlj_object_type_attr(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitXml_table_column(ctx) {\n\t return this.visitChildren(ctx);\n\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the current state of the app excluding tmp variables and the projects
getCurrentAppState() { const currentState = {}; for (let key in this.LS_DEFAULTS) { const isNoTmpField = (this.TMP_FIELDS.indexOf(key) === -1); const isNoOnDemand = (this.ON_DEMAND_LS_FIELDS.indexOf(key) === -1); const isNotProjects = (key !== this.PROJECTS_KEY); if (this.LS_...
[ "static getStatePath() {\n const {isSpec, mainWindow, configDirPath} = this.getLoadSettings();\n if (isSpec) {\n return 'spec-saved-state.json';\n } else if (mainWindow) {\n return path.join(configDirPath, 'main-window-state.json');\n }\n return null;\n }", "function getStateFilePath() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a coords i , j object array
function createCoordsArray() { var coords = []; for (var i = 0; i < gBoard.length; i++) { for (var j = 0; j < gBoard[0].length; j++) { var coord = {i, j}; coords.push(coord); } } return coords; }
[ "function createPosition(){\n position = [];\n // push the x and y position values to an array of position objects\n for (var i = 0; i < rangee; i++){\n for (var j = 0; j < column; j++){\n position.push(new Position(pX[j],pY[i]));\n }\n }\n}", "_mapToOccupancyArray(coords, size, direction) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function returns the value true, if the title says it's about to redirect in an amount of minutes smaller than we set earlier.
function stopBeforeRedirect() { var minutes = parseInt($('title').text()); if (minutes < stopBefore) { console.log('Approaching redirect! Stop the game so we don\'t get redirected while loosing.'); stopGame(); return true; } return false; }
[ "function userAddedToBagWithinLast20MinutesBeforeLinkshareReferralArrival() {\n for (var i = 0; i < splitCookieArray.length; i++) {\n if (splitCookieArray[i].indexOf('lastAddToBagEventTimestamp') >= 0) {\n userLastAddedToBagTimestamp = parseInt(splitCookieArray[i].split('=')[1]);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is special handling for the Pocket audio file. Synthesizes a speech file for an array of text chunks. resolves: The name of the new local audio file
synthesizeSpeechFile(parts, voiceType) { return new Promise(resolve => { let audio_file = uuidgen.generate(); let promArray = []; for (var i = 0; i < parts.length; i++) { promArray.push(this.getPollyChunk(parts[i], i, audio_file, voiceType)); } Promise.all(promArray) ....
[ "processPocketAudio(introFile, articleFile, article_id, locale) {\n return new Promise(resolve => {\n polly_tts\n .concatAudio([introFile, articleFile], uuidgen.generate())\n .then(function(audio_file) {\n return polly_tts.uploadFile(audio_file);\n })\n .then(function(au...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save UI Requirements to JSON table.
function saveUItoRequirements( ){ rdata= jsonCaseObject['Requirements']['Requirement']; rlen = Object.keys(rdata).length; console.log("Number of Requirements = " + rlen ); console.log(rdata); for (var s=0; s<Object.keys(rdata).length; s++ ) { console.log("Requirements before save "+rdata[s]); rdata[s] = ka...
[ "function exerciseToJSON() {\n //get data from form\n const routineName = routineNameRef.current.value\n const numberOfRounds = numberOfRoundsRef.current.value\n const restBetweenRounds = restBetweenRoundsRef.current.value\n\n //put data into a JSON\n routineJSON.RoutineName = routineName\n rou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal compiletimeonly representation of a `DragRef`. Used to avoid circular import issues between the `DragRef` and the `DropListRef`.
function DragRefInternal() { }
[ "function generateDynamicDataRef(sourceName,bindingName,dropObject)\n{\n var retVal = \"\";\n\n var sbObjs = dwscripts.getServerBehaviorsByTitle(sourceName);\n if (sbObjs && sbObjs.length)\n {\n var paramObj = new Object();\n paramObj.bindingName = bindingName;\n retVal = extPart.getInsertString(\"\", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds the index of the parent injector, with a view offset if applicable. Used to set the parent injector initially. Returns a combination of number of `ViewData` we have to go up and index in that `Viewdata`
function getParentInjectorLocation(tNode, view) { if (tNode.parent && tNode.parent.injectorIndex !== -1) { return tNode.parent.injectorIndex; // ViewOffset is 0 } // For most cases, the parent injector index can be found on the host node (e.g. for component // or container), so this loop will be...
[ "function getInsertionIndex() {\n var _select3 = select('core/block-editor'),\n getBlockIndex = _select3.getBlockIndex,\n getBlockSelectionEnd = _select3.getBlockSelectionEnd,\n getBlockOrder = _select3.getBlockOrder;\n\n var clientId = ownProps.clientId,\n destinationRootClientId ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saving the diff result can be helpful to not only keep track that the submission has been successfully submitted, but also to see how IDs potentially have been rewritten.
function saveDiffResultAndUpdateDataJson(submissionsDir, diffResult, changesetId) { var diffResultFileName = 'diffResult-' + changesetId + '.xml'; fs.writeFile(submissionsDir + '/' + diffResultFileName, diffResult, function (err) { // do nothing }); updateDataJson(submissionsDir, changesetId, di...
[ "function __saveResults(bSubmit){\n \n var activityBodyObjectRef = $(__constants.DOM_SEL_ACTIVITY_BODY).attr(__constants.ADAPTOR_INSTANCE_IDENTIFIER); \n /*Getting answer in JSON format*/\n var answerJSON = __getAnswersJSON(false);\n\n if(bSubmit===true) {/*Hard Submit*/\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function:sortPageObjArrayByButtonOrder (a, b) Purpose:Array sort function. 'a' and 'b' are assumed to be single page SEObjects, sorts by button order with 1 buttons being at the back.
function sortPageObjArrayByButtonOrder (a, b) { var agBOrder = a.pageObjArray[a.pageList[1]][gBUTTON_ORDER]; var bgBOrder = b.pageObjArray[b.pageList[1]][gBUTTON_ORDER]; if (agBOrder == bgBOrder) return 0; else if (bgBOrder < 0) return -1; else if (agBOrder < 0) return 1; return (agBOrder - bgBOrder); }
[ "function sortByButtonOrder (pageObjs)\n{\n\tvar sortedList = new Array ();\n\tfor (var n = 0; n < pageObjs.pageList.length; n++)\n\t{\n\t\tvar pos = parseInt (pageObjs.pageObjArray[pageObjs.pageList[n]][gBUTTON_ORDER]);\n\t\tif (pos >= 0)\n\t\t\tsortedList [pos] = pageObjs.pageList[n];\n\t}\n\t// get rid of [0] si...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This checks current time against hours 9am to 5pm and color codes timeblocks appropriately
function checkTime() { $.each(hourArr, function (i, value) { // If it is the current hour, time block will turn red if (moment().isSame(moment().hour(9 + i))) { $("#text" + i).addClass("present"); // If it is a future hour, it will turn green } else if (moment().isBef...
[ "function colorizor() {\n var timeOfDay = moment().hour();\n var timeSlots = [9, 10, 11, 12, 13, 14, 15, 16, 17];\n\n $.each(timeSlots, function (index, slot) {\n\n var hrNum = slot < 13 ? slot : slot - 12;\n\n if ((timeOfDay > slot)) {\n $('#hour-' + hrNum)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
simply send an empty page and exit the process if necessary
function emptyPage(response, exit) { response.writeHead(200, html); response.end(''); if (exit) { process.nextTick(process.exit.bind(process, 0)); } }
[ "function handleResponse(){\n\tif((request.status == 200)&&(request.readyState == 4))\n\t\treDirect(\"usr_home.html\");\n//\telse\n//\t\talert(\"There was an error with the application, please restart the app. Error: \"+request.status);\n}", "function exit() {\n\tsetTimeout(function() {\n\t\tphantom.exit();\n\t},...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the flexgrow number of the widget
function setGrow(widget, value, fit = true) { widget.node.style.flexGrow = value === null ? '' : value.toString(); if (fit && widget.parent) { widget.parent.fit(); } }
[ "grow()\n {\n let box = this.createSnakeBox();\n this.placeBoxAtEnd(box);\n this.boxes.push(box);\n }", "function setShrink(widget, value, fit = true) {\r\n widget.node.style.flexShrink = value === null ? '' : value.toString();\r\n if (fit && widget.parent) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates the signing key used to calculate the signature for AWS Signature Version 4 based on:
async function getSigningKey(crypto, key, dateStamp, region, serviceName) { const kDate = await sign(crypto, `AWS4${key}`, dateStamp); const kRegion = await sign(crypto, kDate, region); const kService = await sign(crypto, kRegion, serviceName); const kSigning = await sign(crypto, kService, 'aws4_request...
[ "ComputeKeyIdentifier() {\n\n }", "function DISABLEgenerate_encryption_key_4() {\n console.debug(\"navigate-collection.js: generate_encryption_key_4.begin\");\n\n // get default private key\n\n var signing_key_jwk;\n var encryption_key_jwk;\n\n var signing_key_obj;\n var encryption_key_obj;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Getter for background color based on themeoptions
get backgroundColor() { let backgroundColor = 0xffffff; if (Store.getState()) { const tp = Store.getState().theme.options.type; if (tp === "dark") { backgroundColor = 0; } } return backgroundColor; }
[ "get_background_color(){\n \tconsole.log(\"returning color based on: \" + this.props.priority)\n\n \tswitch (this.props.priority){\n \t\tcase \"low\":\n \t\t\treturn \"#ffffe6\"\n \t\tcase \"medium\":\n \t\t\treturn \"#fff8eb\"\n \t\tcase \"high\":\n \t\t\treturn \"#ffebeb\"\n \t\tdefault...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
globals $, console, document, Humdrum, TodoItem The todos model.
function TodoStore() { "use strict"; var DBNAME = 'todos', storage = Humdrum.Storage.create(), noop = function() {}; storage.create(DBNAME); /** * Creates a new todo model * * @param {string} [title] The title of the task * @param {function} [callback] The callback to...
[ "constructor(){\n\t\tthis.todoList = [];\n\t}", "function TodoListConstroller () {}", "function myTodo(todo) {\n console.log(todo.title + ' : ' + todo.text);\n}", "function createTodo() {\n // get the string value of input todo\n var newTodo = $('#newTodo').val();\n\n pushToTodos(newTo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
insert course to the college in database
static async insertCourseToCollege(collegeCode,courseCode,totalSeats){ await pool.query('INSERT INTO has VALUES(?,?,?,?)',[collegeCode,courseCode,totalSeats,totalSeats]); }
[ "PutCourses(courses)\n {\n this.dbClient.insertDocument(courses);\n }", "static async addCourse(courseName,courseTag,courseDescription){\n const courseCode=await adminDB.nextCourseCode();\n await pool.query('INSERT INTO course VALUES(?,?,?,?)',[courseCode,courseName,courseTag,courseDesc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes in indexed1 progression & chord to return
getChord(progression, chord) { let p = this.progressions[progression - 1] if (p) { let c = p.chords[chord - 1] if (c) { return c } else { console.log("SongPart.getChord()- Tried to get unavailable chord.") } } else {...
[ "function getBasicChord(chord) {\n\tchordNotes = [1, 5, 8, 10];\n\treturn chordNotes.map(rel => getIntervalNote(chord + chordData.baseOctave, rel));\n}", "function getChord() {\n //get all playing keys\n var keys = document.querySelectorAll(\".key.playing\");\n\n //if less than 2 keys there is no chord, return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The blink function makes the button given as input blink for the time given as input. time is given as milliseconds.
function blink(button, time){ button.active = true; $timeout(function(){ button.active = false; }, time) }
[ "function blink(elem, times, speed)\r\n{\r\nif (times > 0 || times < 0) {\r\n if ($(elem).hasClass(\"blink\"))\r\n $(elem).removeClass(\"blink\");\r\n else\r\n $(elem).addClass(\"blink\");\r\n }\r\n\r\n clearTimeout(function() { blink(elem, times, speed); });\r\n\r\n if (times > 0 || times < 0) {\r\n se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is a middleware function takes in a user and all projects returns projects owned by the req.user only unless the user is admin, then all get returned
function scopedProjects(user, projects) { if (user.role === ROLE.ADMIN) return projects; return projects.filter((project) => project.userId === user.id); }
[ "function currentUserCanViewProject(){\n if (fwPluginUrl.isHomePage){\n return true;\n }\n\n var userProjects = fwPluginUrl.currentUserProjectIDs;\n\n for (var i = 0; i < userProjects.length; i++){\n if (userProjects[i] == fwPluginUrl.currentPageID){\n return true;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LazyLoader wrapper to support options get and set, and backing field
function wrapLazyLoader(loader) { return function () { if (options.get) { _value = options.get.call(target); } if (!_value && loader) { var result = loader(name); // ensu...
[ "function Lazy(create) {\n this.value = create\n this.get = this.init\n}", "setIsLoaded(flag){\n\t\t\tisLoaded = flag;\n\t\t}", "loadOptions() {\n browser.storage.local.get(\"options\").then(res => {\n if (Object.getOwnPropertyNames(res).length != 0) {\n this.options = res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a sting with numbers replaced with thier subscript counterparts
function subscript(str) { str = str.replace(/0/g, "₀"); str = str.replace(/1/g, "₁"); str = str.replace(/2/g, "₂"); str = str.replace(/3/g, "₃"); str = str.replace(/4/g, "₄"); str = str.replace(/5/g, "₅"); str = str.replace(/6/g, "₆"); ...
[ "function replaceN() {\n numbers[numbers.indexOf(12)] = 1221;\n numbers[numbers.indexOf(18)] = 1881;\n}", "getPositionStringForIndex (index) {\n let { row, column } = this.getCoordinates(index)\n const number = Math.abs(row - 7) + 1\n const letter = String.fromCharCode(97 + column)\n return `${lette...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rotate the board function
function rotateBoard(){ ui.rotateBoard(); }
[ "function rotate() {\n // Transpose\n const len = gameBoard.length;\n for (let i = 0; i < len; i++) {\n for (let k = i; k < len; k++) {\n const temp = gameBoard[i][k];\n gameBoard[i][k] = gameBoard[k][i];\n gameBoard[k][i] = temp;\n }\n }\n\n // Flip hor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a new ``bytes`` type for %%v%%.
static bytes(v) { return new Typed(_gaurd, "bytes", v); }
[ "static bytes8(v) { return b(v, 8); }", "static bytes9(v) { return b(v, 9); }", "static bytes25(v) { return b(v, 25); }", "static bytes23(v) { return b(v, 23); }", "static bytes1(v) { return b(v, 1); }", "static bytes10(v) { return b(v, 10); }", "static bytes22(v) { return b(v, 22); }", "static bytes5...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Based on the link data try to find a summary (items which are not present in other listings).
linkSummaryUnique(inputKey,inputPage){ var cacheData = this.cacheData var outputInternalLinks = Array() var outputExternalLinks = Array() for (var cacheKey in cacheData){ if (cacheKey != inputKey){ var linkSummaryData = this.linkSummary(cacheKey,cacheData[cacheKey]) outputInternalLinks = outputI...
[ "function linkSanityData(data){\n\tvar linkStat='';\n\tvar linkSanityStat='';\t\n\tvar mydata = data;\n\tif(globalInfoType ==\"XML\"){\n\t\tvar parser = new DOMParser();\n\t\tvar xmlDoc = parser.parseFromString( mydata , \"text/xml\" );\n\t\tvar row = xmlDoc.getElementsByTagName('MAINCONFIG');\n\t\tvar uptable = xm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update all of the document scores
function update_document_scores() { for (article in file_entity_map) { var entity_sum = 0; var article_score = 0; for (cur_entity in file_entity_map[article]) { unformatted_entity = unformat_name(cur_entity); // article_score += (file_entity_map[article][cur_entity] * entity_weight_map[unformatted_entity])...
[ "function updateScore() {\n\n}", "updateScore() {\n this.serverComm.updateScore(this.userId, this);\n }", "set score(newScore) {\r\n score = newScore;\r\n _scoreChanged();\r\n }", "function updateScore() {\n humanScoreSpan.innerHTML = humanScore;\n computerScoreSpan.innerHTML = computer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
write a function called logNumber that prints to the console the variable num passed as an argument. If the variable is not passed (undefined) print 0 instead
function logNumber(num = 0) { console.log(num); }
[ "getDisplayNumber(number) {\n\n let displayNumber = '';\n\n if (number % 3 === 0) { // multiple of 3\n displayNumber += 'Fizz';\n }\n\n if (number % 5 === 0) { // multiple of 5\n displayNumber += 'Buzz';\n }\n\n // If displayNumber has a value, return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the first of the specified cases which passes the filter
function getFirstFilteredCase(iCases) { if (!iCases) return null; if (!filterFn) return iCases.firstObject(); var i, tCase, count = iCases.get('length'); for (i = 0; i < count; ++i) { tCase = iCases.objectAt(i); if (filterFn(iContext, { _case_: tCase, _id_: tCase.get...
[ "function bestSuggestions(data, filter){\n return data.filter(function (a) {\n return a.startsWith(filter);\n });\n }", "function firstMatch(array,regex) {\n return array.filter(RegExp.prototype.test.bind(regex))[0];\n}", "function COND() {\n for (var _len5 = arguments.length, ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selects a value if there's a toggle that corresponds to it.
_selectValue(value) { const correspondingOption = this._buttonToggles.find(toggle => { return toggle.value != null && toggle.value === value; }); if (correspondingOption) { correspondingOption.checked = true; this._selectionModel.select(correspondingOption); ...
[ "function updateElementValue(el) {\n const isAllSelected = el.children.find(child => !child.value);\n let res = 1;\n if (isAllSelected) {\n res = 0;\n }\n el.value = res;\n}", "function ontoggle() {\n selected = !selected;\n logic.ontoggle(selected);\n }", "function lowHig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsercolumn_definition.
visitColumn_definition(ctx) { return this.visitChildren(ctx); }
[ "visitVirtual_column_definition(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitColumn_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAdd_column_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitParen_column_list(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "vi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
two dino's don't collide
collidesWith(other) { return !(this.isDino && other.isDino); }
[ "collision(dino){\n if (!this.img||!dino.img) return false; \n if(!((this.y>(dino.y+dino.h))||(!this.left&&((this.x>=dino.x+dino.w-25)||(this.x<=dino.x+25)))||(this.left&&((this.x<=dino.x+25)||(this.x>=dino.x+dino.w-25))))){\n if(dino.shield) {\n setTimeout(()=>{dino.shield=false},500); \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sanitize radio, dropdown and checkbox fields
function sanitizeMultipleChoice(field) { var props = field.props; if (props && props.fieldOptions && props.fieldOptions.definition) { var definition = props.fieldOptions.definition; if (definition.options) { for (var i = 0; i < definition.optio...
[ "function sanitizeDefault(field) {\n self.unsafeFormFields.forEach(function (prop) {\n field.props[prop] = _.escape(field.props[prop]);\n });\n }", "function _sanitize(value) {\n\t\t\treturn (\"\" + value).replace(/[^a-zA-Z0-9_]/g, \"\").replace(/^_+/, \"\");\n\t\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AJAX for posting a new employees
function create_employee() { $.ajax({ url: "/employees/create_post/", // target the endpoint type: "POST", data: {name: $('#employee-name').val(), job_title: $('#employee-job-title').val(), years_experience: $('#employee-years-experience').val(), department: $('#employee-department').val()}, ...
[ "function addNewEmployee() {\n let newEmployee = new Employee($('#firstName').val(), $('#lastName').val(),\n $('#empID').val(), $('#jobTitle').val(), $('#annualSalary').val());\n newCompany.addEmployees(newEmployee);\n // console.log(newCompany.employees);\n $('#employeeData').append(newEmployee.toHTML());\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The `placeOrder()` function accepts one argument, a credit card number. + If no argument is received, the function should print out `Sorry, we don't have a credit card on file for you.`. + If a card number is received, the function should print out `Your total cost is $71, which will be charged to the card 83296759.` (...
function placeOrder(cardNumber) { if(arguments.length === 0){ console.log(`Sorry, we don't have a credit card on file for you.`) } else { console.log(`Your total cost is $${total()}, which will be charged to the card ${cardNumber}.`) } cart.splice(0,cart.length); }
[ "placeSellOrder() {\n let price = this.calculatePrice('sell');\n let amount = this.calculateAmount();\n let balance = this.balances.getBalance(this.quote)\n if(balance < amount) {\n console.log(`insufficient ${this.quote} balance, cannot place order (balance: ${balance}, order...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set correct size for the editing area
function airsliderSetSlidesEditingAreaSizes() { var width = parseInt($('.air-admin #air-slider-settings .air-slider-settings-list #air-slider-startWidth').val()); var height = parseInt($('.air-admin #air-slider-settings .air-slider-settings-list #air-slider-startHeight').val());...
[ "function f_refectSpEditWidthHeight(){\n var w = $('#sp-taginfo-width');\n var h = $('#sp-taginfo-height');\n // set .spEdit css\n fdoc.find('.spEdit').css('width',w.val()+'px').css('height',h.val()+'px');\n }", "changeSize() {\n // Calculate the distance between the mo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a promise that resolves the next time the given keypath is published. If you want the return value of request(), you want this instead. We do it this way so that the first time something comes in you get it, whether you were the one who asked for it that time or not. Does not actually fire a request.
waitFor(keypath) { // Set up a promise for when the result comes in return new Promise((resolve, reject) => { this.once(keypath, (value) => { resolve(value) }) }) }
[ "async request(keypath) {\n \n if (this.isCachedInMemory(keypath)) {\n // We have it in memory so skip the stack and publish the value\n let value = this.getFromMemory(keypath)\n // Publish for anyone waiting on it\n this.publishKeypath(keypath, value)\n // Return it (we are async so th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates Parameters Object to be used with the Observer Stream Read POST request
function getParameters(stream_id, stream_version, username, start_date, end_date) { return { auth_token : auth_token, observer_id : observerId, stream_id : stream_id, stream_version : stream_version, username : username, start_date : start_date, end_date : end_date, num_to_re...
[ "get params() {\n return this._parsed.params || {};\n }", "function SBParticipant_getParameters()\n{\n return this.parameters;\n}", "function getParametersFromFilters () {\n var parameters = {};\n parameters.disp = 'T';\n\n for (var i = 0; i < filterIds.length; i++) {\n var value = getFilterV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check that the inner strip off the limits position, and reposition it if there is a need
function checkAndRepositionInnerStrip(){ if(isStripMovingEnabled() == false) return(false); var pos = t.getInnerStripPos(); var posFixed = t.fixInnerStripLimits(pos); if(pos != posFixed) t.positionInnerStrip(posFixed, true); }
[ "function containPan() {\n setPanLimit();\n if (projections.mercator.translate()[1] >= tmax) projections.mercator.translate([width / 2, tmax]);\n else if (projections.mercator.translate()[1] <= tmin) projections.mercator.translate([width / 2, tmin]);\n }", "function getThumbnailStripBegPos(pos)\r\n{\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the smallest element of a list of integers (or `default` (=`0`) for the empty list)
function minimum(xs, default0) /* (xs : list<int>, default : ?int) -> int */ { var _default_22229 = (default0 !== undefined) ? default0 : 0; return (xs == null) ? _default_22229 : foldl(xs.tail, xs.head, min); }
[ "findSmallestInt(args) {\n/*return Math.min() static function, which returns the lowest-valued\nnumber passed into it; with a parameter of restparameter cause\nwere putting in a parameter of our function ((args)after) and not a \nspecific number */\n\treturn Math.min(...args)\n\t}", "function head_2(xs, default0)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Increase or decrease the rotation direction check for max first
function rotateDirection(isClockwise) { if (isClockwise === false) { if (_direction === 0) { _direction = _directionMax; } else { _direction--; } } else if (isClockwise) { if (_direction === _directionMax) { _direction = 0; } else { ...
[ "function incAngle(increment) {\n setAngle(Math.min(Math.max(angle + increment, config.angle_min), config.angle_max), true);\n }", "rotarDerecha(mueble){\n mueble.rotation.y -= this.ANGULO;\n\n var res = this.colisionaParedes(mueble);\n if(res[0]){\n mueble.rotation.y += this.ANGUL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create markers for each result with information called from sql database
function createMarkers(result) { // console.log(result); for (var i=0; i < result.length; i++) { var latLng = new google.maps.LatLng (result[i].lot_latitude, result[i].lot_longitude); var marker = new google.maps.Marker({ position: myLatlng, title: result [i].lot_name, cu...
[ "function createMarkers(div) {\n div.each(function() {\n j.push({\n type: 'Feature',\n \"geometry\": {\n \"type\": \"Point\",\n // of note: for some reason that lat/long need to be reversed here such that it is long/lat\n \"coordinates\": [this['dataset']['long'], t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the last amt of days as an array of Date objects in (YYYY, MM, DD) in decending order
function getLastDays(amt){ var week = []; var today = new Date(); for(var i = 0; i < amt ; i++){ week.push(new Date(today.getFullYear(),today.getMonth(),today.getDate()-i)); } return week; }
[ "function getPreviousDates (){ \n\tvar dd = new Date();\n\tvar datStr = new Array();\n\tfor (i = 1; i < 4; i++){\n\t\tvar ddiff = new Date();\n\t\tddiff.setDate(dd.getDate()-i);\n\t\tvar shift_date = ddiff.getUTCDate();\n\t\t//zero pad date\n\t\tif (shift_date < 10){\n\t\t\tvar dateS = \"0\"+String(shift_date);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On mobile devices only the selected nav link is visible. This function ensures that the other links are 'invisible' to screen readers also On non mobile devices, all the nav links should be 'visible' to screen readers.
function setAriaHiddenForNonVisibleSiteWideNavLinks (mobileDevicesMediaQuery) { const cssSelector = '.site-wide-nav__menu-list-element:not(.site-wide-nav__menu-list-element--selected)'; if (mobileDevicesMediaQuery.matches) { window.ppj.setAriaHiddenAttribute(cssSelector, false); } else { win...
[ "function hideNavOnScrollMobile() {\n nav.style.top = window.pageYOffset > 200 ? \"-6em\" : \"2em\";\n}", "function navNarrowMenuDisplay() {\n // Get the target element ID.\n $('[data-show-target]').click(function(event) {\n\n // The \"trigger\" element that was selected.\n var triggerElement = event.tar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes Application Environment and Routes the Request Initializes globals required by the application environment and routes the request using the event model. This requires most of the core libraries. Once the application environment has been initialized, the 'ready' event is triggered and request routing begins....
function app_init() { global = lib('globals'); server = lib('server'); app = lib('application'); sys = app.sys = lib('system'); req = app.req = lib('request'); res = app.res = lib('response'); req.router = lib('router'); app.model = lib('model'); app.util = lib('util'); res.clear(); tri...
[ "_initialize() {\n if ( this._initialized ) {\n return;\n }\n\n this._log(2, `Initializing Routes...`);\n\n //Add routing information to crossroads\n // todo: handle internal only routes\n // An internal only route can be used to keep track of UI state\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task 3 Find a minium value of all the elements in the array
function findMinimumValue(array) { }
[ "function indexed_minimumm_calculator(arr, n){\n\tlet least;\n\tfor(i = 0; i < n; i++){\n\t\tleast = Math.min(...arr);\n\t\tleast_index = arr.indexOf(least);\n\t\tarr.splice(least_index, 1);\n\t}\n\treturn least\n}", "min() {\n const values = this.$checkAndCleanValues(this.values, \"min\");\n let smallestVa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6 Acronym Write a function acronym that takes an array of words as argument and returns the acronym of the words. Use the reduce method to do this.
function acronym(words) { return words.reduce(function (acc, currentVal) { return acc + currentVal.slice(0,1) }, '') }
[ "function acronym(phrase) {\n let acr = phrase\n .split(\" \")\n .reduce((a, b) => a + b.charAt(0).toUpperCase(), \"\");\n return acr;\n}", "function tooManyWords(){\n\t\n\tanswer = prompt(\"Please enter a phrase...\");\n\t\n\tif (answer == null || typeof answer == undefined) {\n\t return;\n\t}\n\t // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
"this.props.profile_id !== prevProps.profile_id" makes component rerender when navigating from someone's profile to own profile without it previous profile's user's posts are displayed in own profile
componentDidUpdate(prevProps) { if (this.props.profile_id !== prevProps.profile_id || this.props.savedPosts !== prevProps.savedPosts) { this.props.loadPostSlider(this.props.profile_id, this.props.savedPosts) } }
[ "renderUserFavoriteMoveForProfile(profile) {\n let users = this.props.users\n let movies = this.props.movies\n return <li\n key={profile.id}>{`${users[profile.userID].name}\\'s favorite movie is \"${movies[profile.favoriteMovieID].name}.\"`}</li>\n }", "componentDidUpdate(prevPr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handles the clicked gpx file and recalculates route
function handleRecalcGpx(e) { var thisTarget = e.currentTarget; var parentTarget = $(thisTarget).parent(); var granularity = $(parentTarget.children()[4]).find(":selected").val(); var iterator = thisTarget.getAttribute('data'); var gpxFile = fileInput[iterator]; theInterf...
[ "function handleImportRouteRemove(e) {\n //if the file is removed from the view, we do NOT remove the waypoints from the list, etc.\n //just remove the erorr message if visible\n showImportRouteError(false);\n }", "function handleClickRouteInstr(e) {\n theInterface.emit('ui:zoomToRo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stop checking progress of a component installation
function stop_install_monitor(div_id){ install.updater.stop(); }
[ "cancel() {\n switch (this.state) {\n case AddonManager.STATE_AVAILABLE:\n case AddonManager.STATE_DOWNLOADED:\n logger.debug(\"Cancelling download of \" + this.sourceURI.spec);\n this.state = AddonManager.STATE_CANCELLED;\n XPIInstall.installs.delete(this);\n this._callInstallListeners...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse the inner nodes of the path, if they exist then assemble a query URL and request those images from Wikipedia
function getInnerImages() { var inner = response.path.slice(1, -1); var numPages = inner.length; var innerNodes = []; inner.forEach(function(node) { innerNodes.push(node.title); }); var pagesParams; if (numPages > 1) { pagesParams = innerNodes.join('|'); } else { pagesPar...
[ "function query() {\n var pagesParams = CODES.node1.title + '|' + CODES.node2.title;\n var queryURL = makeQueryURL(150, 2, pagesParams);\n $.when(\n $.getJSON(\n queryURL,\n function(data) {\n var htmlSnippets = addQueryInfo(data);\n Object.keys(ht...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a path, get the path to the next sibling node.
next(path) { if (path.length === 0) { throw new Error("Cannot get the next path of a root path [".concat(path, "], because it has no next index.")); } var last = path[path.length - 1]; return path.slice(0, -1).concat(last + 1); }
[ "next(path) {\n if (path.length === 0) {\n throw new Error(\"Cannot get the next path of a root path [\".concat(path, \"], because it has no next index.\"));\n }\n\n var last = path[path.length - 1];\n return path.slice(0, -1).concat(last + 1);\n }", "get nextPath() { return this.nex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calc final damage value
function calcFinalDamageValue () { modifiedDV = parseInt(document.getElementById("modifiedDV").value); numOfRounds = parseInt(document.getElementById("numOfRounds").value); document.getElementById("finalDV").value = modifiedDV + (numOfRounds - 1); calcDefenderDamageTaken(); }
[ "function calcDefenderDamageTaken () {\n finalDV = parseInt(document.getElementById(\"finalDV\").value);\n modifiedDefendersArmor = parseInt(document.getElementById(\"modifiedDefendersArmor\").value);\n var damageCalc = (modifiedDefendersArmor - finalDV) * -1;\n if(_.isNaN(damageCalc) || damageCalc <= 0){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
buildMenu the callback functions take an xsl stylesheet in the first parameter and the xml document in the second
function buildMenu(xslDoc, xmlDoc) { var xsltProcessor, resultDocument ; xsltProcessor = new XSLTProcessor(); xsltProcessor.importStylesheet(xslDoc); resultDocument = xsltProcessor.transformToFragment(xmlDoc, document); // 'slide up, clear, and append' $("#content").slideUp("slow", function() { // slide the c...
[ "function buildContent(xslDoc, xmlDoc, sectionVal) {\n\tvar xsltProcessor, resultDocument ;\n\txsltProcessor = new XSLTProcessor();\n\txsltProcessor.importStylesheet(xslDoc);\n\txsltProcessor.setParameter(null,\"sectionVal\",sectionVal); \t\t\n\tresultDocument = xsltProcessor.transformToFragment(xmlDoc, document);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return true if the given doc matches the supplied selector
function matchesSelector(doc, selector) { /* istanbul ignore if */ if (typeof selector !== 'object') { // match the CouchDB error message throw 'Selector error: expected a JSON object'; } selector = massageSelector(selector); var row = { 'doc': doc }; var rowsMatched = filterInMemoryFields([...
[ "matches (selector) {\r\n const el = this.node;\r\n return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector || el.oMatchesSelector).call(el, selector)\r\n }", "function code_matches_doc(docs, code) {\n return docs.name === null || docs.name =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a random entry from the list of possible surprise toys
function getRandomElement() { let element = surprises[Math.floor(Math.random() * surprises.length)]; return element; }
[ "function randomAnimal(){\n\tvar animals = ['pig', 'cow', 'sheep', 'chicken'];\n\tvar num = Math.floor(Math.random() * animals.length);\n\tvar pick = animals[num];\n\treturn pick;\n}", "function getRace(){\n\tvar races = ['human', 'elf', 'half-elf', 'drow', 'half-orc', 'tiefling', 'gnome',\n\t'dwarf', 'dragonborn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes a d3 selected SVG element and makes a histogram where each bar of the histogram has multiple sub quantities xData is an array yData is an 2D array with length equal to xData but each element is an array of size equal to the number of sub quantities WARNING: yData is assumed to be nonnegative
function plotMultiHistogram( svg, margin, xData, yData, xScale, yScale, heightScale, barColorArray) { // Object to be returned which will have an update function histogram = {}; var height = svg.attr("height"); var width = svg.attr("width"); if ( yData.length !== xData.length ) { ...
[ "function drawHistogram(svgElem, binData) {\n d3.select(\"svg\").call(drag).transition();\n svgElem.selectAll(\"rect\")\n .data(binData)\n .enter()\n .append(\"rect\")\n .attr(\"class\", \"bar\")\n .attr(\"x\", 10)\n .attr(\"transform\", function(d) {\n return \"translate(\" + x(d.x0) + \",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Restyle the canvas after resizing it. This is necessary to ensure proper text measurement.
_restyleCanvas() { this._canvas.getContext('2d').font = "".concat(BubbleStyle.FONT_SIZE, "px ").concat(BubbleStyle.FONT, ", sans-serif"); }
[ "function resizeCanvas() {\n var height = currentBlock.getHeight();\n\n // use the canvas view's dimensions as a starting point; factor out any\n // initial scroll height from the view\n canvas.width = canvasView.clientWidth;\n canvas.height = canvasView.clientHeight/2 * height;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setClip: Set the width and height of the rectangle that clips the crosshairs at their intersection
setClip(size) { if (size) { // Take a chunk out of the crosshairs where it intersects the // mouse. this._clipSize = size; this.reCenter(); } else { // Restore the missing chunk. this._clipSize = [0, 0]; this.reCenter();...
[ "setCrosshairsClip(clip) {\n if (!this._crossHairs)\n return;\n\n // Setting no clipping on crosshairs means a zero sized clip rectangle.\n this._crossHairs.setClip(clip ? CROSSHAIRS_CLIP_SIZE : [0, 0]);\n }", "getCrosshairsClip() {\n if (this._crossHairs) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
convert rgb color in hexa color
function rgb2hexa(str) { colors=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(str); hexa = "#"; for (i=1; i<colors.length; i++) { color = colors[i]; if (color>255) color=255; hexacolor = parseInt(color, 10).toString(16).toLowerCase(); hexacolor = (hexacolor.length == 1) ? '0' ...
[ "hex2rgb(hex) {\n var h=hex.replace('#', '');\n h = h.match(new RegExp('(.{'+h.length/3+'})', 'g'));\n\n for(var i=0; i<h.length; i++)\n h[i] = parseInt(h[i].length==1? h[i]+h[i]:h[i], 16);\n\n return 'rgb('+h.join(',')+')';\n }", "function rgbToHtml(r, g, b) {\n var ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pickup sends creep c to pick up energy e
function pickup(c, e) { /* Try to pick up the energy */ var ret = c.pickup(e); switch (ret) { /* Not quite close enough */ case ERR_NOT_IN_RANGE: var mr = c.moveTo(e); switch (mr) { de...
[ "depositEnergy() {\n var avoidArea = this.getAvoidedArea();\n\n // If there are no empty deposits, and the spawn is at maximum capacity, give the energy to construction (builders)\n if (this.depositManager.getEmptyDeposits().length == 0 && this.depositManager.getSpawnDeposit().energy == this.de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Combining the generation of C, R and B arrays into a single call
function generateCheckArrays(){ R = board generateC() generateB() }
[ "function generateC(){\n let CRow = []\n C = []\n for(let x = 0; x < 9; x++){\n for(let y = 0; y < 9; y++){\n CRow.push(R[y][x])\n }\n C.push(CRow)\n CRow = []\n }\n}", "function createCongruencyArray(batchSize, blockLetter){\n // calc how mnay congruent/incongruent trials are needed\n let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cycle scroll gallery init
function initCycleCarousel() { jQuery('.slider').scrollAbsoluteGallery({ mask: '.mask', slider: '.slideset', slides: '.slide', btnPrev: 'a.btn-prev', btnNext: 'a.btn-next', pagerLinks: '.pagination li', stretchSlideToMask: true, pauseOnHover: true, maskAutoSize: true, autoRotation: true, switchTi...
[ "function init_galleryslider(){\n var $owl = $(\".slider-thumbnail\");\n $owl.imagesLoaded( function(){\n $owl.owlCarousel({\n autoPlay : 3000,\n slideSpeed : 600,\n stopOnHover : true,\n items : 4,\n itemsDesktop : [1199,4],\n itemsDesk...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Metodo para agregar una banda, el new BAND nos indicara que recibiremos una banda, es el por defecto
addBand( band = new Band() ){ this.bands.push(band) }
[ "addBand(band = new Band()) {\n this.bands.push(band);\n }", "function AugmentBroadband ( Inb, Ibb, F, exposBB, exposNB, fwBB, fwNB, outname ) {\n // setup CONSTANTS\n let k1 = exposNB/exposBB;\n let k3 = k1*fwNB/fwBB;\n\n // equations that mix narrowband into the broadband channel\n let BkgnE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LazyLoader // class to handle loading images
function LazyLoader( img, flickity ) { this.img = img; this.flickity = flickity; this.load(); }
[ "function lazyLoadImages(){\n\t\tvar wrappers = document.querySelector('#image_container');\n\t\tvar imgLoad = imagesLoaded( wrappers );\n\t\tfunction onAlways( instance ) {\n\t\t\t//This should only happen once all of the images have finished being loaded\n\t\t\tconsole.log(\"All images loaded\");\n\t\t\tcollage()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hashing used to create id corresponding to display name
function hash_code ( display_name ) { var d = new Date().getTime(); d += display_name; if (window.performance && typeof window.performance.now === "function") { d += performance.now(); //use high-precision timer if available } var hash = 0, i, chr, len; len = d.length; if ( len === 0 ) return hash; ...
[ "get hashId()\n\t{\n\t\t//this.id;\n\t\t//this.recurrenceId;\n\t\t//this.calendar;\n\t\treturn this._calEvent.hashId;\n\n/*\t\t this._hashId = [encodeURIComponent(this.id),\n\t\t\tthis.recurrenceId ? this.recurrenceId.getInTimezone(exchGlobalFunctions.ecUTC()).icalString : \"\",\n\t\t\tthis.calendar ? encodeURIComp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter for the bundling parameters / Set the weight factor for each edge.
setWeight(factor) { this.weightFactor = factor; this.edges.forEach(edge => { edge.weight = Math.pow(edge.dist, factor); this.weight[edge.target][edge.source] = edge['weight'] this.weight[edge.source][edge.target] = edge['weight'] }); }
[ "setWeight(factor) {\n this.weightFactor = factor;\n\n this.edges.forEach(edge => {\n edge.weight = Math.pow(edge.dist, factor);\n\n this.weight[edge.target][edge.source] = edge['weight']\n this.weight[edge.source][edge.target] = edge['weight']\n });\n }", "setBundlingSt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Swap in a fresh buffer, returning the old one.
swapBuffer() { const tmp = this.buf; this.buf = ''; return tmp; }
[ "restoreBuffer(old) {\n this.buf = old;\n }", "function swap (a, b) {\n var c = rep_data.data [a];\n rep_data.data [a] = rep_data.data [b];\n rep_data.data [b] = c;\n}", "function clone (buffer) {\r\n return copy(buffer, shallow(buffer));\r\n}", "swap() {\n const { top, stack } = this;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that update the shoppingCar
updateShoppingCar(state, update) { for (var i = 0; i < state.shoppingCar.length; i++) { if (state.shoppingCar[i].item.id_item == update.id) { state.shoppingCar[i] = update.item; } if (state.shoppingCar[i].quantity == 0) { state.shoppingCar.splice(i, 1) } }...
[ "async price_update() {}", "function updateCart() {\n\tsaveFormChanges();\n\trenderCart();\n}", "function updateShoppingCarts() {\r\n\r\n\t\t\t\t\t\tconsole.log(\"updateShoppingCarts\");\r\n\r\n\t\t\t\t\t\tinekonApi.getShoppingCarts().then(function(result) {\r\n\t\t\t\t\t\t\t$scope.shoppingCarts = result.data.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
'var result= await Configuration_CreateCluster(params);'
function Configuration_CreateCluster(cluster, remark, useHttp) { return api(Configuration_CreateClusterUrl, { cluster: cluster, remark: remark }, useHttp).sync(); }
[ "async cluster(data) {\n const task = new Promise((resolve, reject) => {\n var process = spawn('python', [this.path, 'cluster']);\n process.stdin.write(JSON.stringify(data) + '\\n');\n let lines = [];\n let currentChunk = '';\n process.stdout.on('data', function (data) {\n current...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a string, return a string made of the first 2 characters (if present), however include first char only if it is 'o' and include the second only if it is 'z', so "ozymandias" yields "oz".
function startOz(str) { var result = ""; if (str.length > 1 && (str.charAt(0) == 'o')) { result = result + str.charAt(0); } if (str.length > 2 && (str.charAt(1) == 'z')) { result = result + str.charAt(1); } return result; }
[ "function front22(str) {\n if (str.length >= 2) {\n var first2 = str.slice(0, 2);\n return first2 + str + first2;\n }\n else {\n return str;\n }\n}", "function find_middle_letters(string){\n return string.length % 2 ? string.substr(string.length / 2, 1) : string.substr((string....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the container if it does not exist
async function createContainer() { const { container } = await client.database(databaseId).containers.createIfNotExists({ id: containerId, partitionKey }, { offerThroughput: 400 }); console.log(`Created container:\n${config.container.id}\n`); }
[ "createContainerOpenstack(options, callback) {\n let opt = {\n name: options.containerName\n };\n\n if (options.containerCdn) {\n opt.metadata = {\n type: 'public'\n }\n }\n\n this.client.createContainer(opt, callback);\n }", "c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns if the given string stands for a passing grade
function isPassingGrade(str) { return [ "jeles", "excellent", "jó", "good", "közepes", "satisfactory", "elégséges", "pass", "kiválóan megfelelt", "excellent", "megfelelt", "average", ].some(function (item) { return str.toLowerCase().indexOf(item) !== -1; }); }
[ "function isFailingGrade(str) {\n return [\n \"elégtelen\",\n \"fail\",\n \"nem felelt meg\",\n \"unsatisfactory\",\n \"nem jelent meg\",\n \"did not attend\",\n \"nem vizsgázott\",\n \"did not attend\",\n ].some(function (item) {\n return str.toLowerCase().indexOf(item) !== -1;\n });\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Warning dialog for inconsistent data on Summary page
function showSummaryWarningDialogue() { showDialog({ title: 'WARNING: Inconsistent data', text: 'Elements on this page need correcting: \nThe aggregated category weights must TOTAL 100 \nProblem groups highlighted in red.'.split('\n').join('<br>'), negative: { title: 'Continue' ...
[ "function showImpactAssessmentWarningDialogue() {\n showDialog({\n title: 'WARNING: Inconsistent data',\n text: 'Elements on this page need correcting: \\nRows of risk weights should NOT EXCEED 100 for each area\\nProblem groups highlighted in red'.split('\\n').join('<br>'),\n negative: {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets information about the analyze
async info(analysisID) { const result = await this.doRequest({ path: `/analysis/${analysisID}`, method: "GET", }); return result; }
[ "function getAnalysisType(){\n let settings = fs.readFileSync(path.resolve(__dirname, '../../../settings.json'));\n return JSON.parse(settings);\n}", "function getStats() {\n var statFile = fs.readFileSync('/proc/stat', 'utf8');\n var arr = statFile.split(os.EOL);\n var stats = arr[0].s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
js/physics/cellrange.js A rectangular range of cells in a grid.
function CellRange() { this.p0 = new Vec2d(); this.p1 = new Vec2d(); this.reset(); }
[ "function Range() {\n\tthis.minCells = 2 // Can operate on a minimum of 2 cells\n\tthis.maxCells = 4 // Can operate on a maximum of 4 cells\n\tthis.symbol = 'range'\n}", "_calcRangeOnField(range, isRangeAbs, hasSideAttack) {\n // flip side\n if (this.playerID == 1) range = ((range & 0x3fe00)>>9) | ((range &...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }