query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Returns primes between `from` to `to` based on the previous primes found so far. Exclude `from`. | function findPrimesBetween(from, to, prevPrimes) {
/**
For any number k between from and to, A[k-from] = index of k in the array A.
**/
const
len = to - from + 1,
A = Array(len).fill(true);
/**
Cross off multiples present between `from` to `to` for primes found previously
**/
for(let i=0... | [
"function markAsMultiples(A, from, to, prime) {\n /**\n Start from the smallest multiple present in the range\n **/\n const quo = Math.ceil((from+1)/prime);\n for(let i = quo * prime; i <= to; i += prime) {\n A[i-from] = false;\n }\n}",
"function findPrimesLessThanOrEqualTo(n) {\n /**\n No primes l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get keyboard value for given port (negated masks allowed) For example, port FEFE (11111110...) is for left half bottom row, and port 7FFE (01111111...) is for right half bottom row. If we are asked for port 7EFE (01111110...) we should return a combination of both halves Since keys are active low, we use an AND instead... | getKeyboardValueForPort(port)
{
// initial value: no keys pressed
let val = 0xFF;
// traverse all values in port array
for (let i = 0; i < this.kbports.length; i++)
{
// port to be tested
let testport = this.kbports[i];
if ((~(testport | p... | [
"readKeyboard(addr, clock) {\n addr -= BEGIN_ADDR;\n let b = 0;\n // Dequeue if necessary.\n if (clock > this.keyProcessMinClock) {\n const keyWasPressed = this.processKeyQueue();\n if (keyWasPressed) {\n this.keyProcessMinClock = clock + KEY_DELAY_CL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NAVBAR FOR USE ON ALL MAIN PAGES (specify path to page) | function navbar(path){
navbarhead();
navbarhome();
var ctr = 0;
while (ctr < (path.length - 1)) {
navbarnav(path[ctr].uri, path[ctr].str);
ctr++;
}
navbarend(path[(path.length - 1)].str);
} | [
"function navbarsub(path, loc){\r\r\n\tnavbarhead();\r\r\n\tnavbarhome();\r\r\n\tnavbariter(path);\r\r\n\tnavbarend(loc);\r\r\n}",
"function navbarinfo(path, loc){\r\r\n\tnavbarhead();\r\r\n\tnavbarhome();\r\r\n\tnavbariter(path);\r\r\n\tnavbarend(loc);\r\r\n}",
"function renderNav() {\n var page = 'page... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the replacement string / For loop is simple but quick for small strings | buildReplacement(character, length) {
let replacement = '';
for (let i = 0; i < length; i++) {
replacement += character;
}
return replacement;
} | [
"function buildString() {\n var outString = arguments[0];\n for(var i = 1; i < arguments.length; i++) {\n outString = outString.replace(new RegExp(\"\\\\$\\\\[\" + i + \"\\\\]\", \"g\"), arguments[i]);\n }\n return outString;\n }",
"function _replacement() {\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads from body starting at startPosition until it finds a nonwhitespace or commented character, then returns the position of that character for lexing. | function positionAfterWhitespace(body, startPosition) {
var bodyLength = body.length;
var position = startPosition;
while (position < bodyLength) {
var code = charCodeAt.call(body, position);
// Skip Ignored
if (
// BOM
code === 0xFEFF ||
// White Space
code === 0x0009 || // tab
co... | [
"getNextToken_() {\n const character = this.cssText[this.offset];\n let token;\n this.currentToken_ = null;\n if (this.offset >= this.cssText.length) {\n return null;\n }\n else if (common_1.matcher.whitespace.test(character)) {\n token = this.tokenize... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
resets the grid by removing all HTML from the mainDiv element with ID='canvas'. Useful for making sure the grid doesn't break. | function clearGrid() {
const mainDiv = document.getElementById('canvas');
mainDiv.innerHTML = '';
} | [
"function clearCanvas() {\n elements.gridCanvas.innerHTML = '';\n }",
"function removeGrid() {\n const container = document.querySelector('#sketch-container');\n while (container.firstChild) {\n container.removeChild(container.lastChild);\n }\n\n }",
"function clearGrid() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a CSSfriendly media type. | mediaTypeCss(media, data) {
const type = this.mediaType(media, data);
return type ? type.id.replace(/^.*media\.type/, '').toLowerCase() : '';
} | [
"function findMediaType( url ){\n var regexResult = __urlRegex.exec( url ),\n // if the regex didn't return anything we know it's an HTML5 source\n mediaType = \"object\",\n flashVersion;\n if ( regexResult ) {\n\n mediaType = regexResult[ 1 ];\n // our regex only ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Close hub connection forcefully, to reinitialize it | async closeHub(reason)
{
if (this.timeoutId) {
clearTimeout(this.timeoutId);
this.timeoutId = null;
}
if (this.yapi) {
this.log('hub', reason || ('Disconnecting ' + this.netname));
try {
await this.yapi.KillAPI();
... | [
"closeConnection() {\n driver.close();\n }",
"function wsCloseConnection(){\n\twebSocket.close();\n}",
"function onConnectionClose() {\n\tif (shutdownInProgress && 0 === (httpServer.connections + httpsServer.connections))\n\t\tshutdownNext()\n}",
"close()\n\t{\n\n\t\tthis._closed = true;\n\n\t\t// C... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
>>webforms input features and input types go directly onto the ret object, bypassing the tests loop. Hold this guy to execute in a moment. | function webforms() {
/*>>input*/
// Run through HTML5's new input attributes to see if the UA understands any.
// We're using f which is the <input> element created early on
// Mike Taylr has created a comprehensive resource for testing these attributes
// when applied to all ... | [
"function storeFormValsTemporarily()\n{\n var myForm = arguments[0];\n var formElementValues = convertFormElements(myForm);\n pageControl.setConvertedFormElements(formElementValues);\n}",
"function ModelFormHooks(model) {\n this.returnVal = null;\n var outer = this;\n \n this.callback = funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO support general functions set a new col based on func and cols | async add_new_col(new_col, cols) {
this.df = this.df.map(row => {
var val = 0
cols.forEach(c => {
if (!isNaN(row[c])) val += Number(row[c])
});
row[new_col] = val
return row
})
} | [
"function setcol() {\n if (iscol)\n unselectBase()\n iscol = true;\n }",
"SetColumn() {}",
"function setColumns() {\n\n }",
"set_col(col, type) {\n this.df = this.df.map(x => {\n switch (type) {\n case \"num\":\n x[col] = Numbe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
bidirectionally links two entries of the LRU linked list | function link(nextEntry,prevEntry){if(nextEntry!=prevEntry){if(nextEntry)nextEntry.p=prevEntry;//p stands for previous, 'prev' didn't minify
if(prevEntry)prevEntry.n=nextEntry;//n stands for next, 'next' didn't minify
}} | [
"addAfter(key, data) {\n if (this.head == null) return;\n\n let currentNode = this.head;\n while (currentNode != null && currentNode.data != key) {\n currentNode = currentNode.next;\n }\n\n if (currentNode) {\n let tempNode = currentNode.next;\n currentNode.next = new Node(data);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Custom type guard for Parameter. Returns true if node is instance of Parameter. Returns false otherwise. Also returns false for super interfaces of Parameter. | function isParameter(node) {
return node.kind() == "Parameter" && node.RAMLVersion() == "RAML08";
} | [
"function isParam( paramName, paramValue ) {\r\n\r\n // When comparing, using the coersive equals since we may be comparing\r\n // parsed value against non-parsed values.\r\n if (\r\n params.hasOwnProperty( paramName ) &&\r\n ( p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get private key from a telephone number | async function getPrivateKeyFromNumber(phoneNumber) {
var query = 'SELECT PrivateKey FROM Token_Holder WHERE PhoneNumber = ' + phoneNumber;
// Do this chaining thing
return await singleQueryDatabase(query)
.then( row => key = row.PrivateKey )
.catch( error => console.log(error));
} | [
"getPrivKey() {\n var output = PrivKeyAsn1.encode({\n d: this.key.priv.toString(10),\n }, \"der\")\n return output.toString('hex')\n }",
"generatePrivateKey() {\n // Generates 64 hexadecimal values then concatenates all 64 values\n let r = [];\n for (let i =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
line_items is an array meaning we cannot assign item.line_items[0] = value | set line_items(value) {
this._data.line_items = value;
} | [
"function aggregateScopeLineItemCollection(lineItems, collection) {\n if(angular.isArray(lineItems)) {\n angular.forEach(lineItems, function(item) {\n collection.push(item);\n });\n } e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the true spawnInterval by multiplying it by the respective difficulty's multiplier | function getSpawnInterval() {
return SPAWN_INTERVAL / (
difficulty == "easy" ? EASY_MULTIPLIER : (
difficulty == "medium" ? MEDIUM_MULTIPLIER : (
difficulty == "hard" ? HARD_MULTIPLIER : EASY_MULTIPLIER
)));
} | [
"get_respawn_time ()\n {\n let num_nearby = loot.players_in_cells[this.cell.x][this.cell.y].length;\n const adjacent_cells = loot.cell.GetAdjacentCells(this.cell.x, this.cell.y);\n\n // Get number of players near the lootbox\n for (let i = 0; i < adjacent_cells.length; i++)\n {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A single virtual memory region (also called a memory map). | function VMRegion(startAddress, sizeInBytes, protectionFlags,
mappedFile, byteStats) {
this.startAddress = startAddress;
this.sizeInBytes = sizeInBytes;
this.protectionFlags = protectionFlags;
this.mappedFile = mappedFile || '';
this.byteStats = byteStats || {};
} | [
"mmap(length)\n {\n var msg = `Memory::mmap(${length})`;\n // First page is reserved for JS allocation\n if ((this.m_JS_data_segment + this.m_C_allocated_bytes + length) > this.m_C_data_segment)\n {\n //TODO: this.m_memory.grow\n return -1;\n }\n this.m_C_allocated_bytes += length;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
enable marbles when it's this player's turn | function enableMarbles() {
gameObject.BroadcastMessage("enableMarble");
} | [
"function shieldControl() {\r\n if (buffShield[whichPlayer] === true) {\r\n document.getElementById(`shield-${whichPlayer}`).disabled = true;\r\n document\r\n .getElementById(`shield-${whichPlayer}`)\r\n .classList.add(\"inactiveBuff\"); //make icon clear\r\n\r\n shieldCount[whichPlayer]++;\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set the color of the check mark to the color associated with the current mood | function colorCheckMark()
{
document.getElementById("mood-logged-checkmark").style["fill"] = moodColorsList[currentMood].color;
} | [
"function setDrawingColor(event) {\n sketchController.color = this.value;\n}",
"function changeColor(color) {\n gMeme.currText.color = color\n}",
"setColor(clutterColor) {\n this._horizLeftHair.background_color = clutterColor;\n this._horizRightHair.background_color = clutterColor;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display a single bookmark | function displayBookmark(myHeading,myURL){
var mainBookmarksDisplay = document.getElementById("bookmarks");
var bookmark = document.createElement('div');
var bookmarkText = document.createElement('a');
bookmarkText.innerHTML = myHeading;
bookmarkText.setAttribute('name', myHeading);
bookmarkText.setAtt... | [
"function showBookmarkPopup()\n{\n\t// if LMSFinish signal is sent then do not check bookmark\n\tif( afterLmsFinish )\n\t\treturn;\n\t\t\n\tvar screenBookmark = doLMSGetValue('cmi.core.lesson_location');\n\t\n\tif( screenBookmark.length == 0 )\n\t\treturn;\n\t\n\tvar screenBookmarkParts = getLocalTracker( currentLe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A generic dfs function that runs a dfs traversal at a given node and applies the function fn on each node while passing the object params to fn | static dfs(currentNode,fn,params)
{
if(!currentNode)return;
fn(currentNode,params);
this.dfs(currentNode.left,fn,params);
this.dfs(currentNode.right,fn,params);
} | [
"function dfsAlgorithm() {\r\n const startingPointNode = setDFSAlgorithm(eventStates)\r\n // Set timer to 1s for Animation Frames (in seconds)\r\n runDFSAlgorithm(startingPointNode, eventStates, 1)\r\n visitedNodesAnimation(eventStates, \"DFS\")\r\n // paintVisitedNodes(eventStates, 1) //Timer set to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Flatten out an array, either recursively (by default), or up to `depth`. Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively. | function flatten(array, depth) {
return flatten$1(array, depth, false);
} | [
"function flatten () {\n var flattened = [];\n slice.call(arguments, 0).forEach(function (arg) {\n if (arg != null) {\n if (Array.isArray(arg)) {\n flattened.push.apply(flattened, flatten.apply(this, arg));\n } else if (typeof arg == \"object\") {\n Object.keys(arg).forEach(function (ke... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates the amount of money spent on the currently displayed day | function getDaySpent(){
var date = sessionStorage.getItem("setDate")
var data = JSON.parse(localStorage.getItem(date))
var sumAmount = 0.0
if(data != null){
for(transaction of data['transactions']){
sumAmount += parseFloat(transaction['amount'])
}
}
... | [
"calTotalCharged(){\n this._totalCharged = this._costPerHour * this._hoursParked;\n }",
"function updateCostPerDay() {\n var listTotal = getTotal();\n var costPerDay = listTotal / Number(amountOfDays.value);\n\n var todosHTML = \"\";\n\n todosHTML += `For your ${Number(amountOfDays.value)} day trip,`;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configures a button for using an inpage provider (metamask) | function configureMetamaskButton() {
var metamaskButton = document.getElementById('metamask-button');
if (metamaskButton) {
metamaskButton.style.fontFamily = '-apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, \'Helvetica Neue\', sans-serif';
metamaskButton.style.fontWeight = 'bold';
metam... | [
"static set toolbarButton(value) {}",
"showButtonPageDescription(text){\n\t\tthis.buttonPageDescription.setInfoText(text);\n\t\tthis.buttonPageDescription.updatesHimself();\n\t\tthis.buttonPageDescription.showInfoText();\n\t}",
"function setImagePage(){\r\n setPage('image-page');\r\n }",
"function addRepo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a launch constraint for AWS Service Catalog. For more information, see CreateConstraint in the AWS Service Catalog Developer Guide. Documentation: | function LaunchRoleConstraint(props) {
return __assign({ Type: 'AWS::ServiceCatalog::LaunchRoleConstraint' }, props);
} | [
"function LaunchTemplateConstraint(props) {\n return __assign({ Type: 'AWS::ServiceCatalog::LaunchTemplateConstraint' }, props);\n }",
"function createJobsForConstraint(constraint, index) {\n logger.debug(\"creating new jobs for: \" + constraint + \", index: \" + index);\n var dateUtil = o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this grid contains the list of autoProc of the dataCollection | function AutoProcGrid(args) {
/** Events * */
this.onRowClicked = new Event(this);
var contextPath = "";
this.title = "Autoprocessing Summary (click on an entry for more details)";
this.contextPath = "";
if (args != null) {
if (args.height != null) {
this.height = args.height;
}
if (args.... | [
"function fnReloadGrid(){\n $ibPtLabelPrintGrid.paragonGridReload();\n }",
"function fnReloadGrid() {\n $boxGrid.paragonGridReload();\n }",
"function CallBack_ShowColumSubType(data) {\r\n grid_columnsubtypes.SetDatasource(data);\r\n}",
"showGrid(){\n this.Grid = true;\n th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
places seeds in pod | function placeSeedsInPod( flower ) {
if ( !flower.hasSeeds ) {
for ( var i=0; i<flower.zygoteGenotypes.length; i++ ) {
createSeed( flower, flower.zygoteGenotypes[i] );
}
flower.hasSeeds = true;
}
} | [
"function seedPlayerData(){\n\tconsole.info('seeding player data');\n \tconst seedData = [];\n \tfor (let i=1; i<=10; i++) {\n \tseedData.push({\n \t\tfirstName: faker.name.firstName(),\n \tlastName: faker.name.lastName(),\n \t\tstatus: faker.lorem.word(),\n \t\tpreferredPosition: faker.lorem... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes any click event registered on the button. | function removeButtonEvent() {
if (buttonEvent != null) {
button.removeEventListener("click", buttonEvent, true);
buttonEvent = null;
}
} | [
"function _removeEvents() {\n BUTTON.removeEventListener('click', open, false);\n MODAL_CLOSE.forEach((item) => item.removeEventListener('click', close, false));\n document.removeEventListener('keydown', _bindKeyPress, false);\n }",
"function removeClickHandlers() {\n $(\".containerWrapper\").off(\"c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get users by club id of currentUser | function getUsersByClub(){
return $clubService.getUsers(vm.currentUser.club).then((response) => {
vm.users = response.users;
initializeNgTable(vm.users);
})
.catch((err) => console.log(err));
} | [
"function getUsers(role) {\n return (req,res) => {\n process.nextTick(() => {\n let roleOption = {};\n if(role)\n roleOption = {role: role};\n\n let query = User.find(roleOption).where('club').equals(req.params.id).select('_id name role location age');\n query.exec((err,users) => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In order to center and scale images correctly, we need their actual width and height. However, this information loads asynchronously, so the width and height adjustments may need to happen after we have completed setting up images. Therefore, call this method before creating an element with the given src. It will creat... | function loadImage(src, scale) {
if (imgDimBySrc[src]) {
return;
} // Create placeholder, it will be updated when image is loaded.
imgDimBySrc[src] = {
width: 0,
height: 0
};
var image = new Image();
image.src = src;
image.onload = function () {
// IE11 workaround ... | [
"static prepareImageElement(imageSource){if(imageSource instanceof HTMLImageElement){return imageSource;}if(typeof imageSource==='string'){return BrowserCodeReader$1.getMediaElement(imageSource,'img');}if(typeof imageSource==='undefined'){const imageElement=document.createElement('img');imageElement.width=200;image... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mutation Functions // builds params for either add or update mutations | function buildMutationParams(table, mutationType) {
let query = `const ${mutationType}${table.type}Mutation = gql\`${enter}${tab}mutation(`;
let firstLoop = true;
for (const fieldId in table.fields) {
// if there's an unique id and creating an update mutation, then take in ID
if (fieldId === '0' ... | [
"function transactionsUpdateBuilder(values, filterConfig = { filter: \"\" }) {\n // values should not be undefined, and it should be an object with at least one entry\n if (!values || Object.keys(values).length === 0) {\n return;\n }\n // build up the part of the query that sets each field to be updated, e.g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if any parts in the reservation data has been removed in the progress data | function checkReserveParts(){
for(var part in reservationsJSONarr){
if(!(part in progressData)){
//handle the mismatch
reservationsJSONarr[part].removed = historyIndex;
}
}
//saveReservations();
} | [
"function resetReservations(){\n \n reservationsJSONarr = {};\n \n for(var part in progressData){\n var segments = progressData[part].segments;\n \n newReservePart(part, segments);\n }\n //\"part\" that holds data for whole segments\n newReservePart(\"allsegm\", segments);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get constraints data, especially primary key info | function callbackCon(constraints) {
keyFieldIndexes = [];
for (var k = 0; k < constraints.length; k += 1) {
var constraint = constraints[k],
typ = constraint[1],
columns = constraint[7];
if (typ === 'p') {
... | [
"async getPrimaryKeys() {\n var self = this\n\n var primaryKeys = []\n // loop over and find the lines starting with CONSTRAINT\n self.rawSql.split('\\n').forEach(function (rawLine, index) {\n var line = self.sanitizeLine(rawLine)\n\n if (line.startsWith('CONSTRAINT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get new choices in each scene | function createChoices(scene) {
const container = document.getElementById("choices-container");
container.innerText = "";
for (let i = 0; i < scene.choices.length; i++) {
const choice = scene.choices[i];
const nextScene = scene.nextScene[i];
const button = createButton(choice, nextScene);
cont... | [
"static updateChoices() {\n\t\t// Get rid of the choices that are there already\n\t\tthis.resetChoices();\n\t\t// Add each choice\n\t\tstoryData.story.scene.choices.forEach(function(choice) {\n\t\t\t// DEBUG: show choice text and internal name\n\t\t\tconsole.log(\n\t\t\t\t`%c${choice.text}\\n%c(${choice.name}) \\u2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
createFailFountain() this function creates the particle object and the fountain that will use it | function createFailFountain() {
failParticle = {
size: [cardSize/10,cardSize/8],
sizePercent: [0.99],
angle: [80,100],
speed: [1],
lifetime: [85],
color: ["#7e7ebf","#b9baff","#a8a8ff", "#b5c9db", "#99d5c7"],
rate: [300,150],
limit: [40],
dxy: [cardSize/windowWidth/2.5,cardSize/win... | [
"function runFailFountain(vector){\n push();\n failFountain.newCoordinates(vector);\n failFountain.Draw();\n failFountain.Create();\n failFountain.Step();\n pop();\n}",
"function resetFailFountain(){\n runFail = false;\n failFountain.reset(failParticle);\n coordinates = [];\n}",
"function resetSuccessF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loadFam(conn, item) Load an family subtree in item into the database connection. param: conn an open database connection param: item and family subtree from the parsegedcom object tree | function loadFam(conn, item) {
if (DEBUG) {
console.log("-----------------\n" + JSON.stringify(item, null, 2));
}
if (VERBOSE) {
var t = item.tree;
for (i in t) {
var tag = t[i]['tag'];
if (typeof stats[tag] === 'undefined') {
stats[tag] = 1;... | [
"function loadIndi(conn, item) {\n\n if (DEBUG) {\n console.log(JSON.stringify(item, null, 2));\n }\n\n if (VERBOSE) {\n var t = item.tree;\n for (i in t) {\n var tag = t[i]['tag'];\n if (typeof stats[tag] === 'undefined') {\n stats[tag] = 1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Script data escaped state | [SCRIPT_DATA_ESCAPED_STATE](cp) {
if (cp === $.HYPHEN_MINUS) {
this.state = SCRIPT_DATA_ESCAPED_DASH_STATE;
this._emitChars('-');
} else if (cp === $.LESS_THAN_SIGN) {
this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE;
} else if (cp === $.NULL) {
... | [
"encodeSpecials() {\n const value = this.value;\n const regex = /(\\'|\"|\\\\x00|\\\\\\\\(?![\\\\\\\\NGETHLnlr]))/g;\n return value.replace(regex, '\\\\\\\\$0');\n }",
"appendByte(value) {\n this.script = this.script + this.raw(value);\n }",
"function verbatim( contents )\n{\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
display functions display player lives | displayLifeCount() {
$('.life-count-txt').text(this.lives);
} | [
"updatePanel() {\n document.getElementById(\"score\").innerText = this.score\n document.getElementById(\"lives\").innerText = '💖'.repeat(this.lives)\n }",
"function displayScoreWinsLoses() {\n\n\t\t// Display random game number\n\t\t$(\"#score\").text(randomGameNumber);\n\n\t\t// Load Crystals\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given an employee and a list of employees, return the employees who report to the same manager | function findCoworkersFor(employee, employeesArr) {
let coworkers = [];
let manager = employee.managerId;
employeesArr.forEach(employeeObj => {
if (employeeObj.managerId === manager && employeeObj.name !== employee.name) {
coworkers.push(employeeObj)
}
})
return coworkers;
} | [
"function findManagerFor(employee, employeesArr) {\n let manager = employee.managerId;\n if (!manager) {\n return null;\n } else {\n for (let i = 0; i < employeesArr.length; i++) {\n if (manager === employeesArr[i].id) {\n return employeesArr[i];\n }\n }\n }\n}",
"function findManage... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API bool ColorButton(const char desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0,0)); // display a colored square/button, hover for details, return true when pressed. | function ColorButton(desc_id, col, flags = 0, size = ImVec2.ZERO) {
return bind.ColorButton(desc_id, col, flags, size);
} | [
"function Button(label, size = ImVec2.ZERO) {\r\n return bind.Button(label, size);\r\n }",
"function drawButton(btn) {\n // Move text down 1 pixel and lighten background colour on mouse hover\n var textOffset;\n if (btn.state === 1) {\n btn.instances.current.background[3] = 0.8;\n textOffset = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create an FFT object of order |order|. This will compute forward and inverse FFTs of length 2^|order|. | function FFT(order) {
if (order <= 1) {
throw new this.FFTException(order);
}
this.order = order;
this.N = 1 << order;
this.halfN = 1 << (order - 1);
// Internal variables needed for computing each stage of the FFT.
this.pairsInGroup = 0;
this.numberOfGroups = 0;
this.distance = 0;
this.notSwi... | [
"function FFT() {\n\n var _n = 0, // order\n _bitrev = null, // bit reversal table\n _cstb = null; // sin/cos table\n var _tre, _tim;\n\n this.init = function (n) {\n if (n !== 0 && (n & (n - 1)) === 0) {\n _n = n;\n _setVariables();\n _mak... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Button for setting colorize flag | function colorizeButton() {
document.getElementById("colorizeBtn").addEventListener("click", function () {
colorMode == "Colorize" ? colorMode = "Normal" : colorMode = "Colorize";
});
} | [
"_colorUpdate() {\n if(this.value){\n this.updateStyles({\n '--l2t-paper-color-indicator-icon': this.value,\n '--l2t-paper-color-indicator-icon-display': 'block',\n });\n } else {\n this.updateStyles({\n '--l2t-paper-color-indicator-icon': 'transparent',\n '--l2t-pap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Code Wars 2: Grasshopper Personalized Message (Result: successful) / Create a function that gives a personalized greeting. This function takes two parameters: name and owner. Use conditionals to return the proper message: case return name equals owner 'Hello boss' otherwise 'Hello guest' | function greet (name, owner){
if(name === owner){
return `Hello boss`
} else {
return `Hello guest`
}
} | [
"function greeter (name) {\n return \"hoi \" + name + \"!\";\n}",
"function greeting(name){\n return \"Welcome \" + name\n}",
"function greet(name) {\n return \"Hello \" + name + \"!\";\n}",
"function scuberGreetingForFeet(feet){\nif ( feet <= 400 ) {\n return ('This one is on me!');\n}\nelse if ( feet ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end getCommunityFunnelMap / Returns the metric "data mappings" part of a visualisation's configuration | function getMainDataMap() {
return {
fans: {
metric: 'fans',
getter: commonGetters.getChannelsSeparatelyGetter('breakdownValues')
},
fansValue: {
metric: 'fans',
getter: commonGetters.getOnlyFromChannelsGetter('totalValue')
},
fansChangeValue: {
metric: 'fans',
... | [
"getWorlMapWithColors() {\n\t\t\treturn Object.keys(this.getWorldMapData).reduce((acc, key) => {\n\t\t\t\tacc[key] = this.getWorldMapData[key];\n\t\t\t\tacc[key].color = this.getColor(acc[key].value);\n\t\t\t\treturn acc;\n\t\t\t}, {});\n\t\t}",
"function show_country_map(ndx, countriesJson) {\n\n //Data dimen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw arrows between layer i and j with ni and nj number of neurons | function draw_connections(i, j, ni, nj, rad, arch) {
for (let ii = 1; ii <= ni; ii++) {
for (let jj = 1; jj <= nj; jj++) {
let begin = neuron_pos(i, ii, arch);
let end = neuron_pos(j, jj, arch);
let r = p5.Vector.sub(end, begin);
r.mult(rad / r.mag());
begin.add(... | [
"function draw_nn(arch){\n let n = arch.length;\n let rad = 25;\n \n // Draw neurons\n let hor_dist = width / (n+1)\n for (let i = 0; i < n; i++){\n draw_layer(arch[i], (i+1) * hor_dist, 2*rad); \n }\n \n // Draw weights\n for (let i = 0; i < n-1; i++){\n draw_connections(i, i+1, arch[i], arch[i+1],... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates contactCode, contact and links customer with contact | function createContact(custCode,so,callback){
// Create contactCode
var genCode=new Request("DECLARE @docCode NVARCHAR(30);EXEC [dbo].GenerateDocumentCode @Transaction='CustomerContact', @DocumentCode=@docCode output;SELECT @docCode;",function(err,rowCount,docRows){
var contactCode=docRows[0][0].value;
// Gene... | [
"function createContact() {\n var contacts = new Appworks.AWContacts();\n\n // Gather properties from your form\n var name = document.getElementById(\"contact-name\").value;\n var number = document.getElementById(\"contact-number\").value;\n\n // Create a new contacts object\n var contact = new Contact();\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an `Ono` instance for a specifc error type. | function Ono(ErrorConstructor, options) {
options = normalize_1.normalizeOptions(options);
function ono(...args) {
let { originalError, props, message } = normalize_1.normalizeArgs(args, options);
// Create a new error of the specified type
let newError = new ErrorConstructor(message);
... | [
"static makeTimeoutError() {\n const timeoutErr = new TypeError(HttpClient.TIMEOUT_ERROR_CODE);\n timeoutErr.code = HttpClient.TIMEOUT_ERROR_CODE;\n return timeoutErr;\n }",
"function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(er... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exposes the writeropening action allowing target to be dynamically set | openWriter(to) {
//reset writer
if (this._openWriter || this._hiddenWriter) this._removeWriter();
//set target to 'to'
this._showWriter(this.groups.auto, this.user, this.handleUpload, this.handleSubmit, to);
} | [
"openWriterRef(id) {\n\n\t\t//make sure writer is open\n\t\tthis.openWriter();\n\n\t\t//now since it's open, we append the content (presumably an id)\n\t\tthis.$body.value += this.$body.value ? `\\n(post: ${id})\\n` : `(post: ${id})\\n`;\n\t}",
"_showWriter(groups, user, handleUpload, handleSubmit, to = '') {\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes in an parameter for the selected element's id. This function is meant for the Data Center Circles on the World Heat Map. Sets the sessionStorage variable for the datacenter to the id parameter, then it navigates the user to the Data Center Heat Map. | function setDatacenter(id) {
sessionStorage["datacen"] = id;
sessionStorage["changed"] = true;
} | [
"function setFarm(id) {\n\tsessionStorage[\"farm\"] = id;\n\tsessionStorage[\"network\"] = $(\"#\" + id).parent().attr('id');\n\tsessionStorage[\"changed\"] = true;\n\twindow.location.href = \"../Home/PercentData\";\n}",
"function setNetwork(id) {\n\tsessionStorage[\"network\"] = id;\n\tsessionStorage[\"farm\"] =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Watches the "Edit Rows" setting to enable/disable sorting. | function watchEditRowsSetting(services) {
var $scope = services.$scope;
$scope.$watch("editRows", function (newValue) {
$scope.rowsSortableOptions.disabled = !newValue;
});
} | [
"function dxGridDebOrderLines_OnEditingStart(e) {\r\n editingIndex = e.component.getRowIndexByKey(e.key);\r\n var grid = $(\"#dxGridDebtorOrderLine\").dxDataGrid('instance');\r\n manageDebCellVisibility(grid);\r\n}",
"function dxGridDebOfferLines_OnEditingStart(e) {\r\n editingIndex = e.component.getR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Input Folder ID of folder with child test cases Returns an array of child test cases | function getChildTestCases(testCaseFolderId) {
return new Promise((resolve, reject) => {
let url = baseUrl + "/testfolder/" + testCaseFolderId + '/Descendants' + '?pagesize=200';
let results = []
get(url);
function get(url) {
axios.get(url, headers).then((response) => {
results.push(response.data.Qu... | [
"async getFolderChildren(params) {\n const folderId = params.parentId;\n const response = await ApiMiddleware.getData(\n ANCHOR.CONTRACT_FOLDERS + `/${folderId}`\n );\n\n if (!response.body.files) {\n return [];\n }\n\n const elements = [];\n response.body.files.map(item => {\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
5. Create a function called getMovie Your function should take one parameter, the index of the movie you want to get If the index is valid (meaning that it's less than the number of items in the array), it should return the name of the movie at that index in the array movieQueue If the index is not valid (meaning that ... | function getMovie(getMovie) {
if (getMovie < movieQueue.length) {
return movieQueue[getMovie];
}
else {
return ("not a valid index");
}
} | [
"function changeMovie(index , movie){\n movieQueue[index]=movie;\n return movie;\n \n}",
"function listMovies(){\n for (var i = 0; i < movieQueue.length; i++) {\n return \"Here are the current movies: \"+ movieQueue[0]+\",\" +\" \"+ movieQueue[1]+\",\"+\" \"+movieQueue[2]+\", \";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Only streamers matching input will be displayed | displayFilter(streamer) {
const { streamers, input } = this.props;
const regex = new RegExp(input, 'gi');
//If the streamer has been deleted and reducer_status has not been run again,
//ignore the streamer
if (!streamers[streamer]) return;
if (streamers[streamer].game) {
return streamers[s... | [
"function showCorrectStreamers() {\n var search = $('input').val();\n var re = new RegExp('^' + search, 'i');\n var status = $('.notch').parent().attr('id');\n for (var i = 0; i < streamers.length; i++) {\n var $streamer = $('#' + streamers[i]);\n if ($streamer.hasClass(status)) {\n $st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This one doesn't use the above helper function because it wants to test \r\n in order and `skip` doesn't support ordering and we only want to skip one newline. It's simple to implement. | function skipNewline(text, index, opts) {
const backwards = opts && opts.backwards;
if (index === false) {
return false;
}
const atIndex = text.charAt(index);
if (backwards) {
if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
return index - 2;
}
if (
atIndex === "\n" ||
... | [
"function skipNewline(text,index,opts){var backwards=opts&&opts.backwards;if(index===false){return false;}var atIndex=text.charAt(index);if(backwards){if(text.charAt(index-1)===\"\\r\"&&atIndex===\"\\n\"){return index-2;}if(atIndex===\"\\n\"||atIndex===\"\\r\"||atIndex===\"\\u2028\"||atIndex===\"\\u2029\"){return i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete the specified sample | function API_deleteSample( req, res ) {
let sampleTag = req.params.tag;
samplingFacade.deleteSample( sampleTag )
.then( (statusCode) => {
periodicSocialPostingTimersHandler.deleteTimer( sampleTag );
res.sendStatus( statusCode );
})
.catch( (errCode) => {
... | [
"initiateSampleRemoval() {\n for ( let i = 0; i < this.skaterSamples.length; i++ ) {\n if ( !this.skaterSamples.get( i ).removeInitiated ) {\n this.skaterSamples.get( i ).initiateRemove();\n }\n }\n }",
"delete(){\n\t\tif (removeFromReferenceCount(this.index) === 0){\n\t\t\tthi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper method for validating review objects. | static isValidReview(review) {
// {
// "restaurant_id": <restaurant_id>,
// "name": <reviewer_name>,
// "rating": <rating>,
// "comments": <comment_text>
// }
let isValid = true;
if (
!review ||
!Number.isInteger(Number(review.restaurant_id)) ||
... | [
"function checkReview(){\n\tchrome.storage.sync.get(['reviewed','reviewDateDays'], function(r) {\n\t\tif(r.reviewed != true && (r.reviewDateDays !== undefined )){\n\t\t\t//there is a valid date\n\t\t\tvar currDaysNum = convertDateToDays(new Date());\n\t\t\tvar daysBetween = (currDaysNum - r.reviewDateDays);\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UC7F Check if any Part Time Wage is present | function isAnyPartTimeWage(dailyWage){
return dailyWage.includes("80");
} | [
"function isAllFullTimeWage(dailyWage){\n return dailyWage.includes(\"160\");\n }",
"function findFullTimeWage(dailyWage){\n return dailyWage.includes(\"160\");\n }",
"function findFullTimeWage(dailyWage){\n return dailyWage.includes(\"160\");\n}",
"isPartialWorkset () {\n return (Md... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterate over all element and if elements have common score, take only first one remove rest | function removeDuplicates(arr) {
let u = {}, a = [];
for (let i = 0, l = arr.length; i < l; ++i) {
//console.log(u.hasOwnProperty(arr[i].score));
if (u.hasOwnProperty(arr[i].score)) {
continue;
}
a.push(arr[i]);
u[arr[i].score] = 1;
}
//console.log(a.length);
//console.log("%c " + JSON.stringi... | [
"function getMatch() {\n var bestMatch = {\n scoreDifference:40,\n playerIndex:0\n };\n \n //Sum Recently Added User Score Array\n var recentScore = sumArray(friendsData[friendsData.length - 1].scores);\n\n //Compare userScore to other player scores\n for (var i=0; i<friendsData.length-1; i++ ) {\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name : isAllFieldsOptional Return type : Boolean Input Parameter(s) : None Purpose : To check whether the filed is optional or mandatory. History Header : Version Date Developer Name Added By : 1.0 01th June, 2013 Pradep Yadav | function isAllFieldsOptional() {
for(var index in billerCredElements) {
if(billerCredElements[index].required) {
return false;
}
}
return true;
} | [
"checkRequiredFieldsFilled()\n {\n var bool = true;\n var requiredFields = this.state.textfields.filter(obj => obj.key.required === true)\n \n requiredFields.forEach(function(element) {\n if(element.value === '')\n {\n alert('Error, please fill out all required body parameters.');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name : placeReturnDate() Parameters : none Processes : Places return data input field and label if trip is round trip. Return Value: None. | function placeReturnDate() {
var selectedElements = document.querySelectorAll(".removeReturnDate"); // Queries all elements with .removeReturnDate class and stores a node list object in selected Elements.
selectedElements.forEach(element => { // Each element gets style inherit from parent node which is displa... | [
"function returnDateHandler() {\n\thandlePastDate();\t\t\t\t\t\t\t\t\t\t\t\t// Handle past dates if needed.\n\tdateInverter();\t\t\t\t\t\t\t\t\t\t\t\t\t// Invert dates if needed.\n}",
"function handlePastDate() {\n\tvar departureDate = document.getElementById(\"departureDate\");\t\t\t\t\t// Gets and stores depart... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
findAndSetSuntime() Given what day, and whether Sunrise or Sunset, set the date objects time to sunrise or sunset on that day. Requries d to already be instantiated Date() , and geolocation has run successfully | function findAndSetSuntimeOnDate(whatDay, bSunRise, d) {
var thatDaysSunInfo = new SunriseSunset( whatDay.getFullYear(), whatDay.getMonth()+1, whatDay.getDate(), my.data.latitude, my.data.longitude );
var rawTime;
if ( bSunRise ) {
rawTime = thatDaysSunInfo.sunriseLocalHours( -( wh... | [
"function setSunTimes(whatDay) { // sets global sunrise/set times, returns html with same\n my.data.sunrisetoday = new Date(whatDay);\n my.data.sunsettoday = new Date(whatDay);\n\n var tomoro = new Date(whatDay);\n tomoro.setDate(tomoro.getDate() + 1); // add a day\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dispatcher Helpers Rollback listener adds a `rollback` event listener to the bunch of stores. | function __rollbackListener(stores) {
function __listener() {
for (var i in stores) {
stores[i].listener.emit('__rollback');
}
}
/* If any of them fires `rollback` event, all of the stores
will be emitted to be rolled back with `__rollback` event. */
for (var j in stores) {
sto... | [
"addListeners(e){\r\n this.onToCartClick(e);\r\n this.onFromCartClick(e);\r\n }",
"function rollbackSyncSession() {\n function rollbackSuccessCallback() {\n kony.print(\"All recent changes rollbacked successfully\");\n }\n\n function rollbackFailCallback(res) {\n kony.print... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=== || ADD DEPARTMENT || === | function addDepartment() {
inquirer.prompt(prompt.insertDepartment).then(function (answer) {
var query = "INSERT INTO department (name) VALUES ( ? )";
connection.query(query, answer.department, function (err, res) {
if (err) throw err;
console.log(
`You have added this department: ${answer.department.toU... | [
"function addDepartment() {\n\tinquirer.prompt(prompt.insertDepartment).then(function (answer) {\n\t\tvar query = \"INSERT INTO department (name) VALUES ( ? )\";\n\t\tconnection.query(query, answer.department, function (err, res) {\n\t\t\tif (err) throw err;\n\t\t\tconsole.log(\n\t\t\t\t`You have added this departm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Activate the photo with the given index | selectPhoto(index) {
if (!this.photos || this.photos.length === 0) return;
if (index < 0) index = 0;
else if (index > this.photos.length - 1) index = this.photos.length - 1;
this.selectedPhotoIndex = index;
this.photos[index].active = true;
this.activePhoto = this.photos[index];
} | [
"function switchBackground() {\n owner = publicPhotos[index].owner;\n photoURL = mapUrlLink(publicPhotos[index]);\n setBackground();\n }",
"function selectActiveForIndex(index){\n\tlet elm = document.getElementsByClassName('item-active')[inde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds a CredentialsProvider depending on the type of the credentials passed in. | function makeCredentialsProvider(credentials) {
if (!credentials) {
return new EmptyCredentialsProvider();
}
switch (credentials.type) {
case 'gapi':
return new FirstPartyCredentialsProvider(credentials.client, credentials.sessionIndex || '0');
case 'provider':
... | [
"function chooseAuthProviderByType(opts){\n \n const user = getUser();\n const redirectUrl = opts.redirectUrl;\n const type = opts.type;\n\n const defaultAuth = new Virtru.Client.AuthProviders.GoogleAuthProvider(user, redirectUrl, environment);\n\n switch(type){\n case 'google':\n return defaultAuth\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function called displayCities that console.logs all the values in the citiesLivedIn array: | function displayCities() {
var cityArray = instructorData.additionalData.moreDetails.citiesLivedIn;
for (var i = 0; i < cityArray.length; i++) {
console.log(cityArray[i]);
}
} | [
"function showInitialCities() {\n Object.keys(INITIALCITIES).forEach(function(cityName) {\n displayTeleportCity(cityName);\n });\n }",
"function show_city_traderoutes()\n{\n if (active_city == null || active_city['trade'] == null) return;\n\n var msg = \"\";\n for (var i = 0; i < active_city['trade... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change stack graphs height | changeStackHeight(event) {
this.stackHeight = Number(event.target.value);
stackGraphCtr.setHeight(this.stackHeight);
} | [
"function set_stack_height() {\n $(\".stack\").css(\"height\", $(\".content\").outerHeight() - 2);\n}",
"changeMainHeight(event) {\r\n this.mainHeight = Number(event.target.value);\r\n mainGraphCtr.graph.setHeight(this.mainHeight);\r\n }",
"function fixBarChartHeight() {\n $(\".bar-char... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A doubleclick resets a node to its default rendered position: | function doubleClickNode(event, n) {
n.move = [0, 0];
applyNodeMove(n.index);
rememberNodeMove(n);
reLayoutDiagram();
return null;
} | [
"function markLastClickedNode() {\n if(lastMarkedNode !== null){\n $(lastMarkedNode).removeClass(\"lastClickedNode\");\n }\n $(markedNode).addClass(\"lastClickedNode\");\n lastMarkedNode = markedNode;\n}",
"function jsDblClick() {\n if (!clicked) {\n clicked = true;\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Discount API Private Generic function to calculate volume discounts, for eaxmple 3 for price of 2; or 5 for price of 3 | function volumeDiscount(quantity, volumeBuying, volumePaying) {
//calcualte the modulus and then th divisior
return Math.floor(quantity / volumeBuying) * volumePaying + (quantity % volumeBuying);
} | [
"calcDiscount() {\n if (this.discount != 0 || this.discount != null) {\n this.discPrice = (1 - this.discount / 100) * this.totalPrice;\n }\n }",
"function get_item_prices(rarity_counts, price_dice) {\n// !!!\n}",
"calDiscount(){\n this._discount = this._totalCharged * (10/100) ;\n }",
"a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return this user's auth items. Building the auth item tree is computationally expensive, so compute once and cache. | function getUserAuthItems(user) {
if (Meteor.isServer || !cachingEnabled) {
// Don't use cache on the server, since we don't have cache invalidation.
// Will cause issues on the client, since users access checks will be using cached values.
return buildValidAuthItems(user.authItems);
}
//... | [
"async getUserList () {\n return await this.Config.userStore.getUserList();\n }",
"function getListItems() {\n let isLoggedIn = localStorage.getItem(\"isLoggedIn\")\n let username = localStorage.getItem(\"username\")\n\n if (isLoggedIn && username) {\n console.log(\"getting list of items\")\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function for all event handling on treemap | function treemapEvents() {
// Remove any event listeners from previous interval
$('.treemapNode').unbind();
// Attach on click event listeners
$('.treemapNode').on("click", function(d) {
let selectedTreemapNode = treemapData.filter(function(child, index) {
if (d.target.id == child.id) {
retur... | [
"function handleMapMouseEvent(evt) \n{\n\t//output.text = \"evt.target: \"+evt.target+\", evt.type: \"+evt.type;\n\t\n\tif(evt.type == \"click\")\n\t{\n\t\tvar x = evt.stageX - evt.target.x;\n\t\tvar y = evt.stageY - evt.target.y;\n\t\t\n\t\tvar row = Math.floor(y/24);\n\t\tvar column = Math.floor(x/24);\n\t\t\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unlifts the DevTools store to act like the app's store. | function unliftStore(liftedStore, reducer) {
var lastDefinedState = undefined;
return _extends({}, liftedStore, {
devToolsStore: liftedStore,
dispatch: function dispatch(action) {
liftedStore.dispatch(liftAction(action));
return action;
},
getState: function getState() {
v... | [
"componentWillUnmount() {\n GoogleBooksStore.removeChangeListener(this.__onChange);\n }",
"removeMouseInteractions() {\t\t\t\n\t\tthis.ctx.canvas.removeEventListener(\"click\", this.towerStoreClick);\n\t\t\n\t\tthis.ctx.canvas.removeEventListener(\"mousemove\", this.towerStoreMove);\t\t\n\t}",
"componentWil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show only the specified top level div | function showOnly(id) {
$(".top-level-div").hide();
$("#" + id).show();
gadgets.window.adjustHeight();
} | [
"function showParent($node) {\n // just show only one superior level\n var $temp = $node.closest('table').closest('tr').siblings().removeClass('hidden');\n // just show only one line\n $temp.eq(2).children().slice(1, -1).addClass('hidden');\n // show parent node with animation\n var parent = $temp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Used to create an empty directive. This is used to track flagdirectives whose children may have functionality based on them. Example: `mdnoink` will potentially be used by all child directives. | function attrNoDirective () {
return { controller: angular.noop };
} | [
"createBlankNode(suggestedName) {\n let name, index;\n // Generate a name based on the suggested name\n if (suggestedName) {\n name = suggestedName = `_:${suggestedName}`, index = 1;\n while (this._ids[name])\n name = suggestedName + index++;\n }\n // Generate a generic blank node na... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add this permission to map | addPermission(permission, region = 'default') {
if (!permission.id) {
return;
}
this.authorizedMap[permission.id] = this.authorizedMap[permission.id] || {};
// set default values
permission.geographies = permission.geographies || [];
permission.organizations = permission.organizations || [... | [
"static add(permission){\n\t\tlet kparams = {};\n\t\tkparams.permission = permission;\n\t\treturn new kaltura.RequestBuilder('permission', 'add', kparams);\n\t}",
"fill(permissions) {\n permissions.map((permission) => {\n this.add(permission.name);\n });\n }",
"addPermissionToRole (roleId, action, i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This will represent the balls as objects. / x and y coordinates: the horizontal and vertical coordinates where the ball starts on the screen. This can range between 0 (top left hand corner) to the width and height of the browser viewport (bottom right hand corner). horizontal and vertical velocity (velX and velY): each... | function Ball(x, y, velX, velY, color, size) {
this.x = x;
this.y = y;
this.velX = velX;
this.velY = velY;
this.color = color;
this.size = size;
} | [
"function addBall(){\n let size = random(50,70);\n let ball = new Ball(\n random(0 + size, width - size),\n random(0 + size, height - size),\n random(-15,15) * globalSpeed,\n random(-15,15) * globalSpeed,\n 'rgb(' + random(0,333) + ',' + random(0,220) + ',' + random(0,360) +')',\n size\n );\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Response to the client finalizing a hot seat player's answer. Will reveal the outcome of the answer to the show host, but only the show host. | hotSeatFinalAnswer(socket, data) {
this.currentSocketEvent = 'hotSeatFinalAnswer';
Logger.logInfo(this.currentSocketEvent);
this.serverState.setHotSeatStepDialog(undefined);
this.serverState.hotSeatQuestion.revealCorrectChoiceForShowHost();
this.playMusic(Audio.FinalAnswerSources[this.serverState.h... | [
"showHostRevealHotSeatQuestionVictory_Continuation() {\n this.serverState.setCelebrationBanner({\n header: '',\n text: MONEY_STRINGS[this.serverState.hotSeatQuestionIndex]\n });\n this.serverState.resetHotSeatQuestion();\n\n // If the hot seat player won the million, the next option should be ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log("this is dealercards "+dealercards); this function give us random card | function randCard() {
randomCard = deck[Math.floor(Math.random() * deck.length)];
value=randomCard.charAt(0);
dealercards.push(randomCard);
return totalvalue.push(value);
} | [
"function getDealerCards() {\n for (i = 0; i < 2; i++) {\n const rndIdx = Math.floor(Math.random() * tempDeck.length);\n dealerHand.push(tempDeck.splice(rndIdx, 1)[0]);\n }\n renderDeckInContainer(dealerHand, dealerContainer);\n dealerScore.innerHTML = `dealer has: ${doTheDealerMath()}`;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[new] Globalize( locale|cldr ) | function Globalize( locale ) {
if ( !( this instanceof Globalize ) ) {
return new Globalize( locale );
}
validateParameterPresence( locale, "locale" );
validateParameterTypeLocale( locale, "locale" );
this.cldr = alwaysCldr( locale );
validateLikelySubtags( this.cldr );
} | [
"function getLocale () {\n return locale\n}",
"function googleLanguages() {\n return {\n 'Afrikaans (Suid-Afrika)': 'af-ZA',\n 'Bahasa Indonesia (Indonesia)': 'id-ID',\n 'Bahasa Melayu (Malaysia)': 'ms-MY',\n 'Català (Espanya)': 'ca-ES',\n 'Čeština (Česká republika)': 'cs-CZ',\n 'Dansk (Danmar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the custom validity for the field. | updateCustomValidity () {
if (!this.validity || this.isHeadless || !isCallable(this.el.setCustomValidity)) return;
this.el.setCustomValidity(this.flags.valid ? '' : (this.validator.errors.firstById(this.id) || ''));
} | [
"function setInputValidityStatus () {\n if (dependantsInputNamesAndValidators.length > 0) {\n dependantsInputNamesAndValidators.map(function (dependantItem) {\n if (scopeForm[dependantItem.inputName]) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function creates a promise that will initiate the actions to be taken after the file export configs have been created | function afterFileExportConfigsCreated() {
return Q.Promise(function(resolve, reject) {
getConfigsPreStatus()
.then(function(res) {return startFileExportConfigs()})
.then(
function () { return Q().delay(5000); } // wait some time - initial wait for 1 second
)
.then(
function () { return Q().delay(viewM... | [
"function startFileExportConfigs() {\t\n\treturn Q.Promise(function(resolve, reject) {\n\t\tviewModel.statusMessage(\"start File Export configs\");\n\t\tlistPromisesRequests = [];\n\t\tfor( var i = 0; i < configsCreatedFileExportModules.length; i++ ) {\n\t\t\tconfigID = configsCreatedFileExportModules[i].id;\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hides the field for posting comments if a recipe page is currently viewed. | function hidePostCommentField(){
$("#type-field").empty();
} | [
"function disableReplying()\n{\n $('#comments-container').find('.commenting-field.main').hide();\n $('#comments-container').find('.action.reply').hide();\n}",
"function IsHidden(){\n\treturn !_showGizmo;\n}//IsHidden",
"function bypassCommentBlock(){\n\tisCommenting=true; // set flag true if leave pg was ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
transform coinMCap API data | function transformCoinMCapData(coinMCapData) {
// create new array with IDs
const coinMCapDataIds = Object.keys(coinMCapData.data);
// 1. create parent property "coinData" 2. map() coinMCapDataIds and select needed data from original object by mapped ID 3. pipe the result of map() through sort() to sort list by c... | [
"async details(cashAddr) {\n // Get raw data from Blockbook.\n const bbData = await bchjs.Blockbook.balance(cashAddr);\n // console.log(`Blockbook original data: ${JSON.stringify(bbData,null,2)}`)\n\n const newData = {};\n\n // Manipulate data to match Insight API format.\n newData.balanceSat = Nu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create function that randomly pulls a fact and image combo on page load | function randomize() {
var index = random(collection.length);
var src = collection[index].picture;
var fact = collection[index].fact;
$("#fact-img").attr("src", src);
$("#fact-text").html(fact);
} | [
"function randomImage() {\n\t// plugs in to the local storage\n\tvar gender = localStorage.getItem('charGender');\n\tvar race = localStorage.getItem('charRace');\n\tvar classDisplay = localStorage.getItem('charClass');\n\t// display which plugs into var results\n\tvar currentpicture;\n\t// sets the image equal to t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO API DOC FOR process_rendering_result_headers(arg_rendering_result_headers=[]/, arg_credentials/) | process_rendering_result_headers(arg_rendering_result_headers=[]/*, arg_credentials*/)
{
this.debug('process_rendering_result_headers:rendering headers', arg_rendering_result_headers)
// TODO
// arg_rendering_result_headers.forEach(
// (header)=>{
// const has_header = false // TODO
// // const e ... | [
"process_rendering_result_styles_tags(arg_dom_element, arg_rendering_result_styles_tags=[]/*, arg_credentials*/)\n\t{\n\t\tthis.debug('process_rendering_result_styles_tags:rendering body_styles_tags', arg_rendering_result_styles_tags)\n\t\t\n\t\targ_rendering_result_styles_tags.forEach(\n\t\t\t(tag)=>{\n\t\t\t\tthi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
recursively add all rooms to the grid: | function growMap(grid, seedRooms, counter = 1, maxRooms = dungeonOptions.MAX_ROOMS) {
if(counter + seedRooms.length >= maxRooms || seedRooms.length === 0) {
return grid;
}
grid = createRoomsFromSeed(grid, seedRooms.pop());
seedRooms.push(...grid.placedRooms);
counte... | [
"function makeRoom(){\n var newRoom = new Room(size());\n newRoom.populate();\n for (var j=0; j<newRoom.contents.length; j++){\n var furn = newRoom.contents[j];\n furn.populate();\n };\n return newRoom;\n}",
"function showRooms(rooms) {\n var counter = 1;\n\n for (var room in rooms) {\n crea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns card with same id or null if not found | function getCardByID(id) {
//return variable, assigned as null to return null if no card found
let r = null;
//for each card
cards.forEach(card => {
//if card id is equal to id input
if (card.cardID === id)
//assign card to return variable
r = card;
});
re... | [
"function getCard(id, callback) {\n \n let card = new Card();\n \n // Validation error\n if ( !id ) {\n callback(new Error(messages.card.error.id), null);\n return;\n }\n \n rest.card.get(id).then(response => {\n card.init(response);\n callback(null, card);\n }, error => {\n callback(error, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Redirects an incoming connection to the correct lobby | function redirectConnection(socket, next)
{
console.log('Redirecting a connection to ' + socket.nsp.name);
// Namespace regex
const re = /^\/(?<name>.+)/
// Get the namespace name
const nsp_name = socket.nsp.name;
// Try to parse the lobby name
const found = nsp_name.match(re);
const ... | [
"function openLobby(){\n\n\tlet update = {};\n\tupdate.method = 'openLobby';\n\tsocket.emit('player-update', update);\n}",
"function hangUp(){\r\n socket.emit(\"end\", ID, self);\r\n fetch(\"/end\", {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json'\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Restore the tab state for an element, if it was saved. | function restoreElementTabState(el) {
// Only modify elements we've already handled, in case anything was dynamically added since we saved state.
if (el.hasAttribute(TAB_DATA_HANDLED)) {
if (el.hasAttribute(TAB_DATA)) {
el.setAttribute('tabindex', el.getAttribute(TAB_DATA));
el.removeAttribute(... | [
"function backfillHistoryState() {\n var newState = null;\n jQuery('li.active > [data-tab-history]').each(function () {\n var $activeTabElement = jQuery(this);\n var selector = getTabSelector($activeTabElement);\n\n if (selector) {\n var tabGroup = getTabGroup($activeTabElement);\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add class on state === true | static addClass(state, className) {
if(state) {
return `${className}`
} else {
return ''
}
} | [
"function changeState(elem) {\n if (elem.classList.contains('active')) {\n elem.classList.remove('active');\n } else if (!elem.classList.contains('active')) {\n elem.classList.add('active');\n }\n}",
"static reflectClass() {\n if (this.classList.contains('complete') !== this.complete) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the meat of all of JST it is what takes a list of arguments to a jst element (e.g. jst.$div(...)) and converts it into something that represents a tree of nodes. The passed in params can be a list of lists (will be flattened), an object (converted to attributes), strings, numbers, booleans (coverted to textnode... | _processParams(params, isUpdate) {
params = utils._flatten.apply(this, params);
if (typeof params === "undefined") {
params = [];
}
for (let param of params) {
let type = typeof param;
if (param === null) {
// Do nothing
}
else if (type === "number" || type === "s... | [
"function buildTree(P, arg, path)\n{\n if (!path)\n path = \"/\";\n report(\"buildTree \"+arg);\n if (Number.isInteger(arg)) {\n report(\"atomic case \"+arg);\n var tree = getTree(P, {n: arg});\n tree.name = path+\"A\";\n return tree;\n }\n else {\n report(\"list ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete a li item on click ADD CLASS DELETE (DISPLAY: NONE) | function deleteListItem(){
make_li.classList.add("delete")
} | [
"function deleteListItem(){\n\tthis.parentNode.remove();\n}",
"function deleteListItem()\n{\n\t// Selects button's parent node, the li\n\tvar liItem = event.target.parentNode;\n\t// Selects the li's parent node, the ul\n\tvar liParent = liItem.parentNode;\n\t// Removed the ul's child node, the li\n\tliParent.remo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the Wheat with 3 bushels | init() {
this.quantity = 3;
this.sick = false;
} | [
"init() {\n const squaresCopy = this.board.squares.slice(0);\n this.board.placePlayers(this.players, squaresCopy);\n this.board.placeWeapons(this.weapons, squaresCopy);\n this.board.placeWalls(this.nbOfWalls, squaresCopy);\n }",
"function init_model () {\n setup_board ();\n s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toggle visibility of buttons | toggleButtons() {
document.getElementById("newPinboard").style.visibility = "hidden";
document.getElementById("newPostIt").style.visibility = "visible";
} | [
"toggleButtonHide(hideButtons)\n {\n for (var x=0;x<hideButtons.length;x++)\n {\n this.buttons[hideButtons[x]].classList.toggle(\"hidden\");\n }\n }",
"function updateButtons() {\n if (currentSlideIndex < slides.length - 1) {\n nextBtn.style.visibility = \"visible\"\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the active job that has robot as its default robot OR null if none. | static active_job_with_robot(robot){
for(let a_job of Job.all_jobs()){
if (a_job.is_active()){
if(a_job.robot === robot) {
return a_job
}
}
}
return null
} | [
"static active_jobs_using_robot(robot){\n let result = []\n let active_jobs = this.active_jobs()\n for(let job_instance of adctive_jobs){\n if(job_instance.robot === robot) { result.push(job_instance) }\n else {\n let instr = job_instance.do_list[job_instanc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
produces depth / html element tree | function depth(x) {
var txt = '';
for (var i=0, max = x.length; i < max; i++){
var name = x[i].tagName;
var dashes = $(name).parents().length;
txt += '-'.repeat(dashes) + name + '\n';
console.log('-'.repeat(dashes), name);
}
return txt;
} | [
"function getDepth(element, depth)\n{\n\t// Initliazing our output to just be an empty string at first\n\tvar output = \"\";\n\n\t// Retrieving all the children of the element we are looking at\n\tvar children = element.childNodes;\n\n\t// If we are looking at the HTML element, we will treat it as a special case\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Encodes the latitude in the standard NMEA format "ddmm.mmmmmm". | function encodeLatitude(latitude) {
if (latitude === undefined) {
return ",";
}
var hemisphere;
if (latitude < 0) {
hemisphere = "S";
latitude = -latitude;
}
else {
hemisphere = "N";
}
// get integer degrees
var d = Math.floor(latitude);
// latitud... | [
"function encodeLongitude(longitude) {\n if (longitude === undefined) {\n return \",\";\n }\n var hemisphere;\n if (longitude < 0) {\n hemisphere = \"W\";\n longitude = -longitude;\n }\n else {\n hemisphere = \"E\";\n }\n // get integer degrees\n var d = Math.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CODING CHALLENGE 427 In music, cadences act as punctuation in musical phrases, and help to mark the end of phrases. Cadences are the two chords at the end of a phrase. The different cadences are as follows: V followed by I is a Perfect Cadence IV followed by I is a Plagal Cadence V followed by Any chord other than I is... | function findCadence(chords) {
if (chords[chords.length - 2] === "V" && chords[chords.length - 1] === "I") {
return "perfect";
} else if (chords[chords.length - 2] === "IV" && chords[chords.length - 1] === "I") {
return "plagal";
} else if (chords[chords.length - 2] === "V" && chords[chords.length - 1] !== "I") ... | [
"function GetConcordanceTrans(word, captionArray) {\n console.log(captionArray);\n //take the captionArray and put in one string\n var allCaptions = \"\";\n var textWindow = 60;\n \n captionArray.forEach(function (caption) {\n allCaptions += caption[\"sentence\"] + \" \";\n });\n\n //now search of the ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParseroid_clause. | visitOid_clause(ctx) {
return this.visitChildren(ctx);
} | [
"visitId_expression(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"visitOid_index_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function parse_IntExpr(){\n\tdocument.getElementById(\"tree\").value += \"PARSER: parse_IntExpr()\" + '\\n';\n\tCSTREE.addNode('IntExpr', 'branch');\n\n\t\n\tvar temp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Based on selected domains, show/hide the selection options. | function setOptions(domains) {
$("#edit-field-domain-source option").each(function(index, obj) {
if (jQuery.inArray(obj.value, domains) == -1 && obj.value != '_none') {
// If the current selection is removed, reset the selection to _none.
if ($("#edit-field-domain-source").val(... | [
"function getDomains() {\n var domains = new Array();\n $(\"#edit-field-domain-access :checked\").each(function(index, obj) {\n domains.push(obj.value);\n });\n setOptions(domains);\n }",
"function handleDomainSelection(e) {\r\n\r\n\t$(\".nodeWord\").css(\"color\", \"\");... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prepend prefix defined by API model to endpoint that's already constructed. This feature does not apply to operations using endpoint discovery and can be disabled. | function populateHostPrefix(request) {
var enabled = request.service.config.hostPrefixEnabled;
if (!enabled) return request;
var operationModel = request.service.api.operations[request.operation];
//don't marshal host prefix when operation has endpoint discovery traits
if (hasEndpointDiscover(request)) retur... | [
"getAndIncrementEndpoint() {\n const endpoint = this.currEndpoint % this.maxEndpoints;\n const endpointString = endpoint > 0 ? `${endpoint - 1}` : '';\n this.currEndpoint += 1;\n return `${this.rootEndpoint}${endpointString}`;\n }",
"function kubernetesApiPrefix() {\n return UrlHelpers.join(ap... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |