query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
/ Inline CSS replacement for backgrounds | function inlineBG() {
// Common Inline CSS
$(".single-page-header, .intro-banner").each(function() {
var attrImageBG = $(this).attr('data-background-image');
if(attrImageBG !== undefined) {
$(this).append('<div class="background-image-container"></div>');
... | [
"function inlineBG() {\n\n\t\t// Common Inline CSS\n\t\t$(\".single-page-header, .intro-banner\").each(function() {\n\t\t\tvar attrImageBG = $(this).attr('data-background-image');\n\n\t if(attrImageBG !== undefined) {\n\t \t$(this).append('<div class=\"background-image-container\"></div>');\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
define qForm saveFields(); prototype | function _qForm_saveFields(){
var expires = new Date(_c_dToday.getTime() + (_c_iExpiresIn * 86400000));
var strPackage = _createCookiePackage(this.getFields());
_setCookie("qForm_" + this._name + "_" + _c_strName, strPackage, expires);
} | [
"function _qForm_saveOnSubmit(){\n\t// grab the current onSubmit() method and append the saveFields() method to it\n\tvar fn = _functionToString(this.onSubmit, \"this.saveFields();\");\n\tthis.onSubmit = new Function(fn);\n}",
"saveFieldValues() {\n this.values = this.getFieldValues();\n }",
"triggerS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mounts a partition if not mounted or just resolves if already mounted | static mount(partition) {
return new Promise((resolve, reject) => {
if (partition.mounted) {
// would be nice to also pass the mountpoint
// but promise handlers don't support multi-arg
return resolve(false /*wasMounted*/);
}
p... | [
"function mountDrive() {\n msg('Evaluating whether to mount drive', 'blue');\n\n const mountReturn = execSync('mount').toString();\n\n if(mountReturn.includes(MOUNTPOINT)) {\n return msg(`${MOUNTPOINT} is already mounted!`, 'blue');\n }\n\n pipe([\n `printf \"%s\" \"${mountphrase}\"`,\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`mirrorTo` is preferred than just `mirror` | mirrorTo(target, ...routes) {
return RSVP.all(
routes.map(route => mirrorTo.call(this, target, route)))
} | [
"mirror(val) {\n this._mirror = val;\n return this;\n }",
"mirror() {\n this.flip = -1 * this.flip;\n return this.draw();\n }",
"mirror() {\n const bitMatrix = this.bitMatrix;\n for (let x = 0, width = bitMatrix.getWidth(); x < width; x++) {\n for (let y = x + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a diff of rows to be updated or inserted when performing a many to many `attach` | function syncDiff(original, incoming) {
const diff = Object.keys(incoming).reduce((result, incomingRowId) => {
const originalRow = original[incomingRowId];
const incomingRow = incoming[incomingRowId];
/**
* When there isn't any matching row, we need to insert
* the upcoming... | [
"_generateChangelogFromDiff(entities) {\n const relationshipsChangelogs = [];\n const savedChangelogs = [];\n // Compare entity changes and create changelogs\n entities.forEach(loaded => {\n const entity = {...loaded.definition};\n const entityName = entity.name || loaded.name;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Puts all available refs for a particular game in a list | async function getAllAvailableReferees(gameid, callback) {
let availableReferees = [];
let dbReferees = await db.Referees.findAll({});
let gameToAssign = await db.Games.findOne({
where: { id: gameid }
});
let gameMomentString = moment(gameToAssign.gameTime).format("YYYYMMDD");
for (let i = 0; i < dbRe... | [
"async function getGamesWithOpenings(callback) {\n let availGamesArray = [];\n let dbGames = await db.Games.findAll({});\n for (let i = 0; i < dbGames.length; i++) {\n let game = dbGames[i];\n let refInGames = await game.getReferees();\n let numOfRefInGames = refInGames.length;\n if (numOfRefInGames ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a SPAN node with the given text content and class. | function createStyledNode(textContent, className) {
let newNode = doc.createElement("span");
newNode.classList.add(className);
newNode.textContent = textContent;
return newNode;
} | [
"function createSpan(spanElem, classes, spanText) {\n\n classes.forEach(function (value, index, array) {\n spanElem.classList.add(value);\n });\n\n spanElem.firstChild\n .appendChild(document.createTextNode(spanText));\n\n spanElem.setAttribute('data-rs-value', span... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset the last id of stamp | function resetLastId() {
lastId = 0;
} | [
"function resetLastId() {\n lastId = 0;\n}",
"function resetLastId() {\n\t lastId = 0;\n\t}",
"resetToNew() {\n this.id = cryptohat(53, 0);\n this.time = new Date().getTime();\n this.part = 0;\n this.isNew = true;\n }",
"function resetIdCounter() {\n idCounter = 0\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Apply the prefix num and clear it | function applyPrefixNum () {
const pn = State.prefixNum
State.prefixNum = ''
return pn
} | [
"removeLastDigitFromNumberOne() {\n if (this.__term.numberOne === \"\") {\n this.__voidCount += 1;\n this.__alertWindow.publishEnterTheVoidAlert(this.__voidCount);\n } else {\n this.__term.numberOne = this.__term.numberOne.slice(0, this.__term.numberOne.length-1);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute an element's left and top offset relative to an ancestor. | function getOffset(element, ancestor) {
var left = 0,
top = 0,
originalElement = element;
while (element != ancestor) {
if (element === null) {
console.log(originalElement);
console.log(ancestor);
}
left += element.offsetLeft;
top += element.offsetTop;
... | [
"function simple_offset(el) {\n var l, t;\n l = t = 0;\n if (el.offsetParent) {\n do {\n l += el.offsetLeft;\n t += el.offsetTop;\n } while (el = el.offsetParent);\n }\n return { left: l, top: t };\n}",
"function getOffsetFromAncestor(node, // @param: Node:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pad left with c up to length characters | static padLeft(str, c, length) {
while (str.length < length) {
str = c.toString() + str;
}
return str;
} | [
"function padLeft(str, c, length) {\n while (str.length < length) {\n str = c.toString() + str\n }\n return str\n}",
"padLeft(str, c, length) {\r\n while (str.length < length) {\r\n str = c.toString() + str\r\n }\r\n return str\r\n }",
"function lpad(c, str) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
group the array of persons by chosen criteria | function groupBy(arr, criteria) {
var groups = [];
for (var index = 0; index < arr.length; index++) {
var person = arr[index];
var personKeys = Object.keys(person);
if(personKeys.indexOf(criteria) === -1) {
console.log('The people have no such property as criteria you have en... | [
"function groupPersons(persons, prop) {\n var groupedPersons = {},\n i;\n for (i = 0; i < persons.length; i++) {\n if (groupedPersons[persons[i][prop]]) {\n groupedPersons[persons[i][prop]].push(persons[i]);\n } else {\n groupedPersons[persons[i][prop]] = new Array(p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns object from entries of an array | function fromListToObject(arr) {
obj={}
//obj=Object.fromEntries(arr) we can use this as well
for(var i of arr)
{
obj[i[0]]=i[1]
}
return obj
} | [
"function objectify(arr) {\n let obj = {};\n arr.map((entry, i) => { obj[i] = entry });\n return obj;\n}",
"function fromListToObject(array) {\n var obj = {};\n for (var i = 0; i < array.length; i++) {\n var key = array[i][0];\n var value = array[i][1];\n obj[key] = value;\n }\n\n return obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the existing format record based on given file format id | function getExistingFormatRecord(fileFormatId) {
var existingFormat = null;
if (fileFormatId) {
try {
existingFormat = nlapiLoadRecord('customrecord_2663_payment_file_format', fileFormatId);
}
catch(ex) {
nlapiLogExecution('error... | [
"_getById(id) {\n this._init();\n for (let file of this._files) {\n let match = file.match(/-(\\d+)\\./);\n if (match && match[1] == id) {\n return this._parse(file);\n }\n }\n return false;\n }",
"function getFile(id){\n\t\t\tfor(var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function will be able to draw chromosomes for any organism | function drawChromosomes(gffData) {
correctGff(gffData);
var length = gffData.length;
var chr=1;
var chromosome = gffData[0][0];
for (var i=0; i< length; i++) {
var current = gffData[i][0];
if (chromosome !== current) {
chromosome = current;
chr++;
} else {
chromosome = current;
}
}
console.log... | [
"function initDrawChromosomes() {\n var taxid, i, chrs, bandsArray,\n ideo = this,\n taxids = ideo.config.taxids;\n\n for (i = 0; i < taxids.length; i++) {\n taxid = taxids[i];\n chrs = ideo.config.chromosomes[taxid];\n\n bandsArray = ideo.bandsArray[taxid];\n\n if (!ideo.config.showNonNuclearCh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns reference to the vertical FireMeshLine at array offset idx | vertLine (idx) { return this._vert[idx] } | [
"vertLineAt (x) { return this._vert[this.vertIdxAt(x)] }",
"horzLine (idx) { return this._horz[idx] }",
"lineAt (y) { return this._hlines[this.idxAt(y)] }",
"idxAt (y) {\n const idx = (y - this._top) / this._hstep\n return Math.round(Math.max(0, Math.min(this._hlines.length - 1, idx)))\n }",
"horzLin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test installing a theme | function testInstallTheme() {
// Go to theme url and perform install
controller.open(persisted.theme.url);
controller.waitForPageLoad();
var installLink = new elementslib.ID(controller.tabs.activeTab, "addon");
var md = new modalDialog.modalDialog(addonsManager.controller.window);
md.start(addons.handleIn... | [
"function testInstallTheme() {\n persisted.nextTest = \"testThemeIsInstalled\";\n\n // Go to theme url and perform install\n controller.open(THEME[0].url);\n controller.waitForPageLoad();\n\n var installLink = findElement.ID(controller.tabs.activeTab, \"addon\");\n var md = new modalDialog.modalDialog(addonsM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a tasklist inside of a specific project. | async addTasklist(input = { projectId: '0' }) {
return await this.request({
name: 'tasklist.add',
args: [input.projectId],
params: {
'todo-item': input['todo-item']
}
});
} | [
"function createListTasks(tasks) {\n const listTasks = document.getElementById(\"list-tasks\");\n for (const task of tasks) {\n const taskNode = createTaskNode(task);\n listTasks.appendChild(taskNode);\n }\n}",
"create(context, {\n\t\t\tname\n\t\t}) {\n\t\t\tconsole.log(name)\n\n\t\t\t\tret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Let service know that the user wants to attack the target | attackTarget(attack) {
_gameService.attackTarget(attack)
draw()
} | [
"attack(target) {\n if (target.living) {\n target.takeDamage(this.damage);\n this.scene.events.emit('Message', `${this.type} attacks ${target.type} for ${this.damage} damage`);\n }\n }",
"attack() {}",
"onSpecialAttack(src, weapon, targets) { }",
"function AttackSelected() {\n Orion.Attack... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show the interstitial ad | function showInterstitial(){
if(AdMob) AdMob.showInterstitial();
} | [
"showInterstitialAd() {\n\n FacebookAds.InterstitialAdManager.showAd(\"513432372363654_568836403489917\")\n .then(didClick => {})\n .catch(error => {})\n }",
"function showInterstitial(){\n removeEventListener();\n if (timeoutInstance != null) clearTimeout(tim... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mirror implementation of the `classProp()` instruction (found in `instructions/styling.ts`). | function classProp(className, value) {
_stylingProp(className, value, true);
} | [
"function makeModifyClassName(t) {\n const concat = (a, b) => t.binaryExpression('+', a, b)\n const and = (a, b) => t.logicalExpression('&&', a, b)\n const or = (a, b) => t.logicalExpression('||', a, b)\n\n const joinSpreads = spreads => spreads.reduce((acc, curr) => or(acc, curr))\n\n return (path, cssPropCal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates the block strength based on the defender's defense value | function blockStrength(defender) {
return Math.floor(defender.defense) - Math.floor((randomNum(6) * 0.1 * defender.defense));
} | [
"calculateDefenseStats(){\r\n\t\tthis.physicalDefense = this.strength + this.physicalArmor\r\n\t\tthis.magicDefense = this.intelligence + this.magicArmor\r\n\t}",
"getstrengtheffect() {\n var totalstrength = 0;\n for (var buff in this.listofbuffs) {\n totalstrength += this.listofbuffs[buff].getstrengthe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a subset of the data, around the time specified. | function getSliceAroundTime(data, time, before, after) {
var from = moment(time).subtract(before, 'seconds');
var to = moment(time).add(after, 'seconds');
return getSliceBetweenTimes(data, from, to);
} | [
"function getSliceBetweenTimes(data, from, to) {\n \n var fromIdx = _.sortedIndex(data, {t: from}, function(d) { return d.t; });\n var toIdx = _.sortedIndex(data, {t: to}, function(d) { return d.t; }); \n\n return data.slice(fromIdx, toIdx+1);\n }",
"function OntheHour() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the minX, maxX, minY, maxY to surround a data group | function getBounds(group) {
var minX = pv.min(group, function(d) { return d.x || 0 }); // or 0 in case falsy value in data
var maxX = pv.max(group, function(d) { return d.x || 0 });
var minY = pv.min(group, function(d) { return d.y || 0 });
var maxY = pv.max(group, function(d) { return d.y || 0 });
return { m... | [
"function normalizeXY( _group ){\n\tvar minX = null;\n\tvar minY = null;\n\t\n\t_group.getChildren().each( function( child, n ){\n\t\tif( minX = null || minX > child.x() ){\n\t\t\tminX = child.x()\n\t\t}\n\t\tif( minY = null || minY > child.y() ){\n\t\t\tminY = child.y()\n\t\t}\n\t});\n\n\tif( minX < 0 )\n\t\t_grou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class: Grid Object representing the grid on which the plot is drawn. The grid in this context is the area bounded by the axes, the area which will contain the series. Note, the series are drawn on their own canvas. The Grid object cannot be instantiated directly, but is created by the Plot oject. Grid properties can be... | function Grid() {
$.jqplot.ElemContainer.call(this);
// Group: Properties
// prop: drawGridlines
// wether to draw the gridlines on the plot.
this.drawGridlines = true;
// prop: gridLineColor
// color of the grid lines.
this.gridLineColor = '#cccc... | [
"function Grid() {\n $.jqplot.ElemContainer.call(this);\n // Group: Properties\n \n // prop: drawGridlines\n // wether to draw the gridlines on the plot.\n this.drawGridlines = true;\n // prop: background\n // css spec for the background color.\n this.b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the F2D stream once the metadata and manifest files are fetched | function doStreamF2D_Continued(loadContext, manifest, metadata) {
var _this = loadContext.worker;
var url = loadContext.url;
// Collect asset urls that to be send to main thread for mobile usage.
var assets = [];
var f2dSize = 0;
var altSize = 0;
if (manifest ... | [
"function doStreamF2D(loadContext) {\n\n var _this = loadContext.worker;\n\n _this.postMessage({progress:0.01}); //Tell the main thread we are alive\n\n //Get the metadata and manifest first.\n var metadata;\n var manifest;\n var doneFiles = 0;\n\n var accumulatedStream = new Uint8Array(65536);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Places marker at home location. | function setHomeMarker() {
if (homeMarker != null) {
homeMarker.setMap(null);
}
if (home != null) {
homeMarker = new google.maps.Marker({
position: home,
icon: 'icons/home.svg',
map: map,
title: 'Home',
});
map.setCenter(home);
map.setZoom(7);
}
} | [
"function setHomeMarker() {\n\t\tif (typeof homeMarker !== 'undefined') homeMarker.setMap(null);\n\t\tlet position = new google.maps.LatLng({lat: parseFloat(lat), lng: parseFloat(lng)});\n\t\thomeMarker = new google.maps.Marker({\n\t\t\tmap: map,\n\t\t\tposition: position,\n\t\t\tvisible: false\n\t\t});\n\t\thomeMa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the editor's `state` prop, without touching any of the other props. | updateState(state) {
this.updateStateInner(state, this._props);
} | [
"updateEditorState(editorState) {\r\n this.setState({ editorState });\r\n }",
"forceUpdateState(props = this.props) {\n // Convert incoming to somethign draft-js friendly\n const content = convertContentFrom(props.value, props.type);\n\n // Generate new date\n const updatedEditorState = Ed... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
go to add menu page. | async gotoAddMenuPage(testController) {
await testController.click('#add-menu-food-page');
} | [
"function openMessagePages_addMenuItem() {\n const ui = SpreadsheetApp.getUi();\n ui.createAddonMenu()\n .addItem('Open Message Pages', 'openMessagePages')\n .addToUi();\n}",
"function navToAddCap() {\n location.href = 'Admin.php?page=AddCap';\n}",
"function goToMenu()\n{\n\twindow.location = \"menu.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
4 fee price (1 price/range)/range keeps fees lower at the edges | function calculateAdjustedTradingFee(tradingFee, price, range) {
return tradingFee.times(4).times(price).times(ONE.minus(price.dividedBy(range))).dividedBy(range);
} | [
"function brFee(amount, ptax) {\n amount = amount * ptax;\n var fee = 22;\n if (amount > 235 && amount <= 355) {\n fee = 30;\n } else if (amount > 355 && amount <= 465) {\n fee = 34;\n } else if (amount > 465 && amount <= 580) {\n fee = 38;\n } else if (amount > 580 && amount ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
def is_a_square(one, two, three, four, threshold=0.0): """ Given four points determine if those points form a square It's up to you how to define how square the points must be to qualify as a square >>> is_square((0, 1), (1, 1), (1, 0), (0, 0)) True >>> is_square((0, 0), (1, 1), (0, 1), (1, 0)) True >>> is_square((0.1,... | function isSquare(one, two, three, four, threshold=0.0) {
let l = [];
l.push(distance(one, two));
l.push(distance(one, three));
l.push(distance(one, four));
l.push(distance(two, three));
l.push(distance(two, four));
l.push(distance(three, four));
console.log(l)
l = l.sort((a, b) => {
return a-b;... | [
"function isInsideSquare(a,b,c,d,p) {\n\tif (triangleArea(a,b,p) > 0 || triangleArea(b,c,p) > 0 || triangleArea(c,d,p) > 0 || triangleArea(d,a,p) > 0) {\n\t\treturn false;\n\t}\n\telse {\n return true;\n }\n}",
"function isSquare (width, length) {\nif (length === width){\n console.log(`${true}, this rectangl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create one of the basic objects. The modelData holds the data for an IFS using the structure from basicobjectsIFS.js. This function creates VBOs to hold the coordinates, normal vectors, and indices from the IFS, and it loads the data into those buffers. The function creates a new object whose properties are the identif... | function createModel(modelData, xtraTranslate) {
var model = {};
model.coordsBuffer = gl.createBuffer();
model.normalBuffer = gl.createBuffer();
model.indexBuffer = gl.createBuffer();
model.count = modelData.indices.length;
if (xtraTranslate)
model.xtraTranslate = xtraTranslate;
else... | [
"function createModel(modelData, xtraTranslate) {\r\n var model = {};\r\n model.coordsBuffer = gl.createBuffer();\r\n model.normalBuffer = gl.createBuffer();\r\n model.indexBuffer = gl.createBuffer();\r\n model.count = modelData.indices.length;\r\n if (xtraTranslate)\r\n model.xtraTranslate... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render the product search UI. | render() {
const divClass = 'wc-products-list-card__search-wrapper';
return (
<div className={ divClass + ( this.state.dropdownOpen ? ' ' + divClass + '--with-results' : '' ) } ref={ this.setWrapperRef }>
<div className="wc-products-list-card__input-wrapper">
<Dashicon icon="search" />
<input type... | [
"function renderProductGrid() {\n logger.trace('render start search index');\n\n // render UI based on model state\n var total = currentSearch.getTotal(),\n count = currentSearch.getCount(),\n productGrid,\n query = currentSearch.getQuery(),\n scrollToResults = false;\n var p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function check major minor | function checkMajorMinor(duration) {
if (duration > major_minor_duration * 60) {
return "major";
} else {
return "minor";
}
} | [
"function validateMajor(major){ \n if(major != \"none\") \n return true;\n else\n return false;\n }",
"function minor(value) {\n\tconsole.log(\"how did this even happen?!\")\n}",
"function getMinorVersion(v) {\n return (!isEmpty(v) ? (!hasDot(v) ? v.match(/\\.(\\d*... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the default implementation to generate a filename for the recorded responses. It will create a sha1 hash of the request URL and optionally, the body of the request if the `hashFullRequest` config is set to true. This function can be overidden in config with the responseFilenameCallback setting. | function defaultMockFilename(config, req) {
var reqData = prismUtils.filterUrl(config, req.url);
// include request body in hash
if (config.hashFullRequest(config, req)) {
reqData = req.body + reqData;
}
var shasum = crypto.createHash('sha1');
shasum.update(reqData);
return shasum.dig... | [
"_generateRandomFilename() {\n // create pseudo random bytes\n const bytes = randomBytes(32);\n\n // create the md5 hash of the random bytes\n const checksum = createHash('MD5').update(bytes).digest('hex');\n\n // return as filename the hash with the output extension\n return checksum ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A little summary the result of an async function is always a Promise p. That Promise is created when starting the exection of the async function The body is executed. Execution may finish permanently via return ro throw. Or it may finish temporarily via await; in which case execution will usually continue later on. The... | async function downloadContent(urls) {
// wrong syntax!!!
return urls.map(url => {
// This does not work, because await is syntactically illegal inside normal arrow functions
const content = await httpGet(url);
return content;
});
// what if we use an async arrow funciton
return urls.map(async (ur... | [
"async function downloadContent(urls) {\n // the following line is the same usage with line 49 -- Handling multiple asynchronous results sequentially:\n return await Promise.all( urls.map( url => httpGet(url) ) )\n}",
"async function downloadImages(imagesToDownload, downloadLocation) {\n // Using a for in lo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
So this is gonna sort OpenList as per lowest weights and retun name, weight | function sortOpenList(): int[]{
var retVar = new int[3];
for (var a : int = 0; a < (OpenNodes.Length); a++){
for(var b : int = a + 1 ; b < (OpenNodes.Length); b++){
if(OpenNodesWeight[a] > OpenNodesWeight[b]){
var temp = OpenNodesWeight[b];
OpenNodesWeight[b] = OpenNodesWeight[a];
OpenNo... | [
"function SortByWeight(a, b)\n{\n if (a.Weight < b.Weight) return -1;\n else if (a.Weight > b.Weight) return 1;\n else return 0;\n}",
"sortFunction(a, b) {\n if (a[0].Weight === b[0].Weight) {\n return 0;\n } else {\n return (a[0].Weight < b[0].Weight) ? -1 : 1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add and create Fighters | function createFighters(fighters) {
const fighterElements = fighters.map(fighter => createFighter(fighter));
const element = createElement({ tagName: 'div', className: 'fighters' });
element.append(...fighterElements);
return element;
} | [
"function Fighters(\n name,\n nickname,\n image,\n rank,\n win,\n lost,\n draw,\n create,\n lastEdit,\n id\n ) {\n this.name = name;\n this.nickname = nickname;\n this.image = image;\n this.rank = rank;\n this.win = win;\n this.lost = lost;\n this.draw = draw;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to open the modal / This function has to change the display property with value none to display: block. | function openModal () {
//chnge the display value to block
modal.style.display = 'block';
} | [
"function openModal()\n {\n modal.style.display = 'block';\n }",
"function openModal(){\r\n modal.style.display = 'block';\r\n }",
"function openModal() { \n\tmodalexport.style.display = 'block';\n}",
"function openModal() {\n\tmodalmegan.style.display = 'block';\n}",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if it's a method call. If so then create a stack entry and save the self pointer on the stack. | compileMethodCallSelfPointer(opts) {
if ((opts.selfPointerStackOffset !== false) || !this.getMakeMethodCall(opts.identifier)) {
return;
}
// It's a method call...
this._scope.incStackOffset();
// Save the self pointer of the object on the stack.
// This value is passed to CompileCall.compile from the compileProcCall me... | [
"function createCurrentCallObject() {\n\n}",
"pushOntoCallStack(msg) {\n const callStackEntry = callStackEntryFromString(msg);\n callStackEntry.setMarked(this.isStepOverNextCall());\n this.setStepOverNextCall(false);\n var callStack = this.getCallStack();\n callStack.unshift(callStackEntry);\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: newFunction DESCRIPTION: Calls the NewFunction command. ARGUMENTS: none RETURNS: nothing | function newFunction() {
var rsName = _RecordsetName.getValue();
var funcName = 'get' + rsName.substr(0, 1).toUpperCase() + rsName.substr(1,rsName.length-1);
var ret = dwscripts.callCommand('CreateNewCFCFunction.htm',funcName);
if (ret) {
_cffunction__tag.initializeUI();
_cffunction__tag.listControl.setIndex(... | [
"function newFunction(){\n\t\talert(\"New Function Declaration\");\n\t}",
"function createFunction() {\n\n // create function only when form is valid\n if (ctrl.functionFromTemplateForm.$valid && !lodash.isNil(ctrl.selectedTemplate)) {\n ctrl.toggleSplashScreen({value: true});... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the block is at the bottom of the board. returns true if there's at the bottom; false if there's not | _checkBottomColision() {
let block = false;
let absPos;
for (let row = 3; row >= 0; row--) {
if (block) return false; // ==== se han comprobado todos los bloques de abajo ====>>>
for (let col = 0; col < 4; col++) {
if (this[row][col] === 0) continue;
... | [
"checkIfReachBottom(block) {\n // Iterate all cells to see if they are at the bottom or there's an existing cell beneath\n for (let i = 0; i < 4; i++) {\n if (block.path[i][0] == this.fieldHeight - 1 || \n this.gameField[block.path[i][0] + 1][block.path[i][1]] == 1) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NO HASH, CLEAR THE SUBTITLE | function clearh2() {
document.getElementById('pageTitle').innerHTML = " ";
} | [
"function clearTitle() {\n $('title').html(\"Blacksmith\");\n}",
"function clearTitle()\n{\n\tctxTitle.clearRect(0, 0, canvasTitle.width, canvasTitle.height);\n}",
"function hideSubtitle(elem) {\n elem.html('');\n }",
"function clearTitleAndArtist() {\n\tif(!document.all && document.getElementById) {\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
From the list of projected points, select those at the given indices and return them as a new array. | selectPoints(points, indices) {
return points.slice(indices[0], indices[1]);
} | [
"selectPointTrigger(selectedIndices){\n const data = this.data\n\n // define selectedPoints\n let selectedPoints = []\n\n for (let i in selectedIndices) selectedPoints.push(data[i])\n\n // dispatch POINT SELECT event\n this.dispatch[EVENTS.POINT.SELECT](selectedPoints, selectedIndices)\n }",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
javascript strings are immutable, this fn does "str[i] = new_val" | function _str_replace_at(i, new_val, str) {
return str.substr(0, i) + new_val + str.substr(i + 1);
} | [
"function caml_string_set (s, i, c) {\n if (i >>> 0 >= s.l) caml_string_bound_error();\n return caml_string_unsafe_set (s, i, c);\n}",
"function caml_string_unsafe_set (s, i, c) {\n return caml_bytes_unsafe_set(s,i,c);\n}",
"function caml_string_unsafe_set (s, i, c) {\n // The OCaml compiler uses Char.uns... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called at midnight to tell us to redraw datespecific widgets. Do NOT call this for normal refresh, since it also calls scheduleMidnightRefresh. | function refreshUIBits() {
try {
getMinimonth().refreshDisplay();
// refresh the current view, if it has ever been shown
var cView = currentView();
if (cView.initialized) {
cView.goToDay(cView.selectedDay);
}
if (!TodayPane.showsToday()) {
To... | [
"function refreshUIBits() {\n try {\n getMinimonth().refreshDisplay();\n\n // refresh the current view, if it has ever been shown\n var cView = currentView();\n if (cView.initialized) {\n cView.goToDay(cView.selectedDay);\n }\n\n if (!TodayPane.showsToday()) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Automatically parses all request parameters and puts them into the `params` property of the request object. This is the union of all GET (query string) and POST (content) parameters, such that all POST parameters with the same name take precedence. Valid options include the following: maxLength The maximum length (in b... | function makeParams(app, options) {
options = options || {};
var maxLength = options.maxLength;
var uploadPrefix = options.uploadPrefix;
function paramsApp(request) {
if (request.params) {
return request.call(app); // Don't overwrite existing params.
}
request.params = {};
merge(request.... | [
"applyDefaultRequestParams(params = {}) {\n return Object.assign(params, { params: this.defaultRequestParams });\n }",
"function parseOptions(req, options) {\n if (options.query) {\n req.qs = options.query\n }\n if (options.body) {\n req.json = options.body\n }\n if (options.hasOwnProperty('e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Separates the classes and style objects. Any classes that are preregistered args are auto expanded into objects. | function extractStyleParts() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var classes = [];
var objects = [];
var stylesheet = _Stylesheet__WEBPACK_IMPORTED_MODULE_0__["Stylesheet"].getInstance();
function _processArgs(argsList) {
... | [
"function extractStyleParts() {\n\t var args = [];\n\t for (var _i = 0; _i < arguments.length; _i++) {\n\t args[_i] = arguments[_i];\n\t }\n\t var classes = [];\n\t var objects = [];\n\t var stylesheet = Stylesheet_1.Stylesheet.getInstance();\n\t function _processArgs(argsList) {\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=====================================================================\ void chooseName(block, type) \===================================================================== | function chooseName(block, type) {
// Fetch name
// .replace(/\W/g, ''); || .replace(/[^a-z0-9 ]/gi, '');
let name = prompt('Type name of element:');
if (name) {
name = name.replace(/\W/g, '');
}
while (valDex[type[2]].has(name) || workspace.getVariableMap().getVariable(type[2] + '_' + name)) {
name = prompt(... | [
"function changeBlockName(block, li, input, label) {\r\n label.textContent = document.getElementById('drag_elem_name').textContent =\r\n block.dataset.namediv = li.children[0].textContent = input.value;\r\n}",
"static selectChoiceByName(name) {\n for (let j = 0; j < novelData.novel.currentScene.choices.len... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
another bonus: a random linked list is good, but being able to make one from specific data easily would also be nice. give me a function, generateSLLFromArray, that creates a singly linked list with values from an array input [8, 1, 1, 1, 6] > (displayed) 8 1 1 1 6 | function generateSLLFromArray(input) {
var new_nodelist = new SinglyLinkedList();
for( var i = 0 ; i < input.length; i++ ){
new_nodelist.addToBack(input[i])
}
return new_nodelist
} | [
"function generateSLLFromArray(input) {\n var new_nodelist = new SinglyLinkedList();\n for (var i = 0; i < input.length; i++) {\n new_nodelist.addToBack(input[i])\n }\n return new_nodelist\n}",
"function generateNewList(length, min_value, max_value) {\n var generated_sll = new SinglyLinkedLi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
======================================================= Draw the X icon that closes the video popup ======================================================= | function drawX()
{
exitWid = that.add('button', {
id: 'exitButton',
image: 'VideoExit',
alpha: 0.7,
depth: that.depth + 1,
click: close
},{
wid: bg,
at: 'center',
my: 'center',
ofs: closeOfsX + ' ' + closeOfsY
});
} | [
"function drawX()\n\t{\n\t\texitWid = that.add('button', {\n\t\t\tid: 'exitButton',\n\t\t\timage: 'VideoExit',\n\t\t\talpha: 0.7,\n\t\t\tdepth: that.depth + 1,\n\t\t\tclick: close\n\t\t},{\n\t\t\twid: vidWid,\n\t\t\tat: 'top right',\n\t\t\tmy: 'center',\n\t\t\tofs: '0'\n\t\t});\n\t}",
"function asciiXClick() {\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to build Rule Expression for given IAlarm and AlarmState. | static fromAlarm(alarm, alarmState) {
try {
jsiiDeprecationWarnings.aws_cdk_lib_aws_cloudwatch_IAlarm(alarm);
jsiiDeprecationWarnings.aws_cdk_lib_aws_cloudwatch_AlarmState(alarmState);
}
catch (error) {
if (process.env.JSII_DEBUG !== "1" && error.name === "Dep... | [
"generateRuleLogic() {\n let state = this.state\n let existingRuleLogic = state['businessRuleProperties']['ruleComponents']['ruleLogic'][0]\n // If a rule logic is not present\n if (existingRuleLogic == \"\") {\n // No rule logic is present\n // Concatenate each fil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return longest username in data | function get_longest(data)
{
var longest = 0;
for(var item in data) {
if(data[item].username.length > longest)
longest = data[item].username.length;
}
return longest;
} | [
"function playerWithLongestName() {\n const players = allPlayers();\n let longestNamePlayer = \"\";\n\n for (let player in players) {\n if (player.length > longestNamePlayer.length) {\n longestNamePlayer = player;\n }\n }\n\n return longestNamePlayer;\n}",
"function playerWithLongestName() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when client submits a new topic | function submitTopic(response, request) {
if (request.method != "POST") {
// POST requests are the only thing that should be accepted in this function!
// Assume they're looking for a file instead.
return getAsset(response, request);
}
console.log("Request handler 'topics/submit' was called.");
var jsonStr... | [
"handleSubmitTopic (topic) {\n this.handleStateChange('formActive', false)\n this.handleStateChange('topicName', '')\n this.props.addTopic(topic)\n }",
"function saveTopic(event){\n var data = $('#inputDiv :input').serialize();\n var url = window.location.origin.replace(/[0-9]{4}/, '4000') + '/top... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the user input from the DOM as a number (in seconds) | function getSecondsFromInput() {
var secondsAmount = Number(userInput.value);
if (secondsAmount <= 0) {
return;
}
return Number(userInput.value);
} | [
"function getInterval(inputElem)\n{\n var interval = inputElem.value;\n if (!interval.match(/^\\d+$/ig) && (interval != \"\"))\n {\n toggleOverlay(\"Please input a positive integer\");\n return -1;\n }\n return parseInt(interval)*1000 || 0; //in seconds\n}",
"function getInput() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a service instance associated with this app (creating it on demand), identified by the passed instanceIdentifier. NOTE: Currently storage and functions are the only ones that are leveraging this functionality. They invoke it by calling: ```javascript firebase.app().storage('STORAGE BUCKET ID') ``` The service na... | _getService(name, instanceIdentifier = _firebase_app__WEBPACK_IMPORTED_MODULE_2__._DEFAULT_ENTRY_NAME) {
var _a;
this._delegate.checkDestroyed();
// Initialize instance if InstatiationMode is `EXPLICIT`.
const provider = this._delegate.container.getProvider(name);
if (!provi... | [
"_getService(name, instanceIdentifier = modularAPIs._DEFAULT_ENTRY_NAME) {\n var _a;\n\n this._delegate.checkDestroyed(); // Initialize instance if InstatiationMode is `EXPLICIT`.\n\n\n const provider = this._delegate.container.getProvider(name);\n\n if (!provider.isInitialized() && ((_a = provider.getC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Notify subscribers that options are available | function SourcePathAdapter$_signalOptionsReady() {
// if (this._disposed) {
// return;
// }
// Delete backing fields so that options can be recalculated (and loaded)
delete this._options;
// Get the `Dep` object for the options property
var optionsPropertyDep = this.__ob__.getPropertyDep('o... | [
"_emitOptionsUpdated() {\n this.listeners[optionsUpdatedEvent].notify(listener => {\n listener();\n });\n }",
"onFnaOptionsChanged(options) {}",
"notifySubscribers() {\n subscribers.forEach(function(onChange) {\n onChange();\n });\n }",
"function OnOptions()\n{\n\t// sh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pretends to be a connectionmodel providing every function call required in NativeClientconnect, but returns topology and connection params of our choice | function mockedConnectionModel(topologyDescription, connectionOptions) {
const _topologyDescription =
topologyDescription || mockedTopologyDescription();
const _connectionOptions = connectionOptions || {
url:
'mongodb://127.0.0.1:27018/data-service?readPreference=primary&ssl=false',
options: {
... | [
"GetTopology() {}",
"_computeConnections() {\n let sysPathnames = this.sysPathnamesList;\n let throwLbl = 'ModelData._computeConnections: ';\n\n for (let conn of this.conns) {\n // Process sources\n let srcObj = this.nodePaths[conn.src];\n\n if (!srcObj) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that gets no list from Firebase | function getNoList() {
var userId = firebase.auth().currentUser.uid;
var rootRef = firebase.database().ref();
var userRef = rootRef.child('users');
var currNoListRef = userRef.child(userId);
currNoListRef.on('value', function(snapshot) {
// Stores no list from Firebase
var noLis... | [
"async function getAdjudicacionesFirebase() {\n\n var ref = db.ref(\"Adjudicaciones\");\n adjus = await ref.once(\"value\");\n adjusJSON = adjus.val();\n\n var i = 0;\n for (p in adjusJSON) {\n if (!adjudicacionesFirebase.includes(adjusJSON[p].nog)) {\n adjudicacionesFirebase.push(a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists all the users within the bound layer. (uid=,)?ou=users,o=teleport | function listUsers(req, res, next) {
assert([ 2, 3 ].indexOf(keys(req.rdns).length) !== null);
assert('teleport' === req.rdns.o);
assert('users' === req.rdns.ou);
var layer = req.bindLayer;
assert(layer);
// If searching for a specific user
var uid = req.rdns.uid;
if ( uid ) {
req.filter = new ldap.AndFil... | [
"function loadusers_rp(cb) {\n axios.get(cfg.url+\"user/all\", axopt).then((resp) => {\n var d = resp.data;\n var users = d.content;\n users = users.filter((u) => { return u.accountType == 'LDAP'; });\n debug && console.log(\"LDAP-Users:\", users);\n return cb(null, users);\n }).catch((ex) => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hook up the charset, encoding, charstrings and private dict offsets. we need to do this iteratively because setting their values may change the sizeOf for the top dict, and thus the offsets after the top dict. Hurray. | function fixTopDictIndexOffsets(baseSize, topDictIndex, charset, encoding, charStringIndex, privateDict) {
var ch_off, en_off, cs_off, pd_off, o_ch_off, o_en_off, o_cs_off, o_pd_off, base, pd_size = privateDict.sizeOf();
// "old" values
o_ch_off = o_en_off = o_cs_off = o_pd_off = -1;
// "current" values
ch_of... | [
"function parseCFFPrivateDict(data, start, size, strings) {\r\n\t const dict = parseCFFDict(data, start, size);\r\n\t return interpretDict(dict, PRIVATE_DICT_META, strings);\r\n\t}",
"function parseCFFPrivateDict(data, start, size, strings) {\n\t var dict = parseCFFDict(data, start, size);\n\t return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check which radio buttons and checkboxes are clicked for products, enzymes and substrates push name of product, substrate, enzyme to checkedProdsEnzsSubsNames push type to checkedProdsEnzsSubs | function onRadioChange(){
countProducts = 0;
countSubstrates = 0;
checkedSubsNames = [];
checkedProdsNames = [];
checkedEnzsNames = []
for(var i = 0; i < substrates.length; i++){
if(substrates[i].checked){
countSubstrates++;
checkedSubsNames.push(substrates[i].value);
}
}
for(var j ... | [
"function populateListProductChoices(slct1) {\r\n var s1 = [];\r\n if (document.getElementById(\"v\").checked) {\r\n s1.push(\"Vegetarian\");\r\n }\r\n if (document.getElementById(\"g\").checked) {\r\n s1.push(\"GlutenFree\");\r\n }\r\n if (document.getElementById(\"o\").checked) {\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Private functions (used internally by the public functions) ///////////////////////////////////////////////////////////////////////////// Does all the steps to pair or unpair two people, based on the values of `shouldBePaired` and `shouldBeTowTruck` | function pairOrUnpair(shouldBePaired, shouldBeTowTruck) {
var context = getContext();
var newValue = shouldBePaired ? context.value + 1 : context.value - 1;
var newValueSafe = Math.max(0, newValue);
context.cell.setValue(newValueSafe);
setBorder(context.cell, shouldBePaired);
setNote(context.cell, shouldB... | [
"function towTruckPair() {\n pairOrUnpair(true, true);\n}",
"function createMatchupWithPairdownsHelper(originalDark, originalLight, keepLightPlayer, wasOriginallyPairDown, playersToSkip, currentRound, possibleOpponents, darkPile, lightPile) {\n\n var player = originalDark;\n if (keepLightPlayer) {\n p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the right indent for selected paragraphs. | set rightIndent(value) {
if (value === this.rightIndentIn) {
return;
}
this.rightIndentIn = value;
this.notifyPropertyChanged('rightIndent');
} | [
"function indentSelection() {\n // TODO: Should use feature detection\n if (Prototype.Browser.Gecko) {\n var selection, range, node, blockquote;\n\n selection = window.getSelection();\n range = selection.getRangeAt(0);\n node = selection.getNode();\n\n if (range.collapsed) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clicks the textarea element. | async click() {
await $(this.rootElement)
.$('textarea')
.click();
} | [
"function clickComment(){\n\n\tthis.parentElement.parentElement.parentElement.getElementsByTagName(\"textarea\")[5].focus()\n\t\n}",
"function selectTextarea() {\n\t$('.exporter').on('click focus','#exportcode',function() {\n\t\tthis.focus();\n\t\tthis.select();\n\t});\n}",
"function editor_tools_focus_textarea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: todoDeleteMultipleVendInfo Parameter: Description: To remove all checked vendor information row from database | function todoDeleteMultipleVendInfo() {
var vendInfoTable = document.getElementById('vend-info-modify-table');
var data = [];
/*Collect add rows and tranfer to an array*/
for (var i = vendInfoTable.rows.length - 1; i > 0; i--) {
if (vendInfoTable.rows[i].cells[0].children[0].checked) {
... | [
"function deleteSelectedObjectsFromTable(){\n\t\t$(\".productDeleteCheckbox\").each(function(){\n\t\t\tif($(this).is(\":checked\")){\n\t\t\t\t$(this).closest(\".productTableRow\").remove();\n\t\t\t}\n\t\t});\n\t}",
"function deleteselectedvendors(index) {\n for (let i = 0; i < vendorArray.length; i++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Proxies all the items in iterable indexed by path iterable: any iterable path: an array of string or numeric keys, applied recursively Example: wrap(querySelectorAll('li'), ['childNodes', 2, 'style', 'color']) represents li.childNodes[2].style.color for each li on the page. | function wrap(iterable, path) {
if (typeof path == 'undefined')
path = [];
let ff = function() {};
ff.iterable = iterable;
ff.path = path;
return new Proxy(ff, proxyHandler)
} | [
"function wrap_all() {\r\n // Iterate over list of arguments.\r\n for (var arg of arguments) {\r\n // If arg is an array or a node list wrap each node within it,\r\n // otherwise treat arg as a single node.\r\n if (Array.isArray(arg) || arg instanceof NodeList) {\r\n for (var node of arg) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get informations about the order of one cluster [PRODUCTION] [See on api.ovh.com]( | GetInformationsAboutTheOrderOfOneCluster() {
let url = `/cluster/hadoop/orderInformations`;
return this.client.request('GET', url);
} | [
"function getInfoConfigCluster(){\n return sendWS({\n action : `cluster/info`\n })\n .then(messageData => messageData.clusterInfo);\n}",
"function getOrderInfo() {\n dataservice.getOrder(vm.orderID).then(function (response) {\n vm.orderInfo = response.result;\n });\n }",
"enterCluste... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Scroll to the location where alert messages will be displayed | function scrollToMessages() {
var jqElem = jQuery('#myOrdersMsg');
if (jqElem[0]) $timeout(function(){ jqElem[0].scrollIntoView(true); });
} | [
"function scrollToMensajeFinal () {\n\tvar totalContratos = $(\".firmaDigital canvas:visible\").length;\n\t$('.alertify-buttons .alertify-button-ok').on('click',\tfunction() {\n\t\tif(totalContratos == 0){\n\t\t\t$.scrollTo($(\".mensajeFinal\").offset().top-150) ;\n\t\t\t\n\t\t}\n\t});\n\t\n}",
"function scrollTo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
END document ready / ===============[ A. Debugging / Archived ]======================= A.1 Delete All SVC Data If something goes wrong and we have too many entries in the database we need a way to delete them to improve performance. Usage: setTimeout(deleteAllSVCData, 10 1000); | function deleteAllSVCData() {
if (CurrentUser === undefined || CurrentUser === null) {
// Restrict access to logged in users only.
return;
}
dbRef.remove().then(function () {
console.log("Removed All SVC Data from firebase");
}).catch(function (error) {
console.log("Failed to remove SVC Data. ... | [
"function deleteAllDatadbfs(callback) {\n console.log(\"inside deleteAllDatadbfs\");\n Model.Datadbf.destroy({ \n truncate: true \n }).then(function() {\n callback(null);\n });\n}",
"function clearAllDBTableData() {\n /**\n * Clears all rows in each table in the database -this AJA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a plank is broken, this emits the information to the server. | function emitPlankBreak(plank){
//emits the plank to the server and to break it
socket.emit("break window", {plank: plank});
} | [
"function emitPlankRepair(plank){\n\t//emits the plank to the server and to fix it\n\tsocket.emit(\"fix plank\", {plank:plank})\n}",
"handleServerBroken() {\n this.debug(`Server sent an end event back(to pool idx ${this.idx})`)\n this.broken = true\n this.pool.emitter.emit(\"release\", this.idx)\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addSighting called from EnterSighting | async function addSighting({
registration,
spotdate,
spottime,
location,
notes,
}) {
async function postSpotting() {
let sightingInfo = {
userid: user.email,
registration: registration,
spotdate: spotdate,
spottime: spottime,
location_field: locati... | [
"function handleSightingTransitions() {\n /**\n * Return true if the currently-displayed sighting is the last in its\n * slideshow\n */\n function onLastSighting(organismID) {\n const currentOrganism = $(`.wildlife-result[data-organism-id=\"${organismID}\"]`);\n const currentSighting... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Kaltura Upload video service | function uploadVideoService(res,fileData){
console.log("upload service invoked");
var entry = new kaltura.vo.KalturaMediaEntry();
entry.name = 'Media entry using AngularJs & NodeJS';
entry.mediaType = kaltura.kc.enums.KalturaMediaType.VIDEO;
client.media.add(function(entry){
//console.log("meida response "+ent... | [
"async upload(file, metadata = { uploader: this.credentials.username }, options = {}) {\n const { \n // don't calculate length if set to true\n useChunkedTransfer = false, contentType: optMimeType, filename: optFilename } = options;\n // prepare payload\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Purpose : This function accepts a array of fields. It checks if any of the field of the passed field(s) are empty or not If atleast one field is nonempty then it returns false else if all the field values are empty then it returns true. This function is useful to pass all the fields of the search criteria of a form and... | function chmIsAllEmpty(arrFields,msg)
{
// set this flag to true if you want this function to validate
var bValidate = true;
var len = arrFields.length;
var iIndex = 0;
if(!bValidate)
{
return false;
}
for(iIndex = 0; iIndex < len; iIndex++)
{
... | [
"function fieldsAreEmpty(vals, requiredFields, touch) {\n // start with assumption that all fields are filled out\n let fieldIsEmpty = false;\n\n const touchIsFunction = typeof touch === \"function\";\n\n // go through each required field\n requiredFields.forEach(field => {\n // if the field i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads a given GLTF scene file exported from Cinema4D. Animations and LinkObjects are set up and added to an AnimationMixer for playback. Returns a promise which resolves when both the scene and animation setups are complete. | load( src, xrefPath, texPath ) {
return new Promise( ( resolve, reject ) => {
this.loader = new C4DExportLoader();
this.loader.load( src, xrefPath, texPath ).then( response => {
this.scene = response.scene;
this.animClips = response.animations;
this.linkObjects = response.linkObjects;
thi... | [
"function LoaderScene(nextScene) {\n var loader;\n\n this.load = function (assetLoader, done, failed) {\n assetLoader.load(\"/assets/batches/loader.json\")\n .then(function (batch) {\n loader = new GameEntity(batch.loader);\n done();\n }, failed);\n };\n\n this.setup... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when PCI form is submitted and confirmed, slidein the widget | function onPCIFormSubmittedSlideOut(submittedData) {
logger.debug("onPCIFormSubmitted", "");
if (submittedData && submittedData.frame) {
//addInfoMessageToChatMessages(lpCWTagConst.lpMsg_PCIFormSubmitted);
// slide in and clear the form
$(jqe(lpChatID_lpChatSlideOutContainer)).empty();
... | [
"function submitForm(){\r\n if($('#donate_form').valid()) {\r\n $('#donate_form').fadeOut('slow').hide();\r\n $('#sidebar-box').fadeOut('slow').hide();\r\n $('#loading').show();\r\n var params = '';\r\n if( $('input[name=\"autorepeat\"]').is(':checked') ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to hide all items that do not match selected skill | function skillToggle(skillID,targetClass) {
// create an event listener for each skillID
document.getElementById(skillID).addEventListener('click', function() {
// reset all elements to visible before applying filter
// check if easter egg is visible, if not, reset all entries visible
if ... | [
"function hideSkillStatus() {\n\n $('.skill-status').toggle();\n }",
"hideSpellContextItems() {\n if (this.spellContextItems.length > 0) {\n for (let i = 0; i < this.spellContextItems.length; i++) {\n let item = document.getElementById(this.viewer.owner.e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the data in instance.templates variable | constructor (){
this.templates = this.loadData((err, data) => {
if(err){
console.log("Data not loaded: \n " + err)
}
else{
this.templates = data
}
})
} | [
"function loadTemplates() {\n plugin.loadTemplates(self.settings().templates, true);\n }",
"function loadTemplateData(){\r\n\t\r\n\tfor(var i = 0; i < Object.keys(templates).length; i++){\r\n\t\tvar groupName = Object.keys(templates)[i];\r\n\t\tvar group = templates[groupName];\r\n\t\tvar templateNames ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endregion region function ConvertToLocalTime(dateObject, style, locale) Convert a full date object to extract only the local time component See | function ConvertToLocalTime(dateObject, style, locale) {
// debugger;
// If the caller didn't specify the style, use the "short" time format 1:30 pm
if (!style) {
style = "short";
}
// If the caller didn't specify the regional locale, use the web browser default locale
if (!locale) {
... | [
"function tycheesDateTime_convertUTCDateToLocalDate(date) {\n\tvar localDate = new Date(date.getTime());\n var offset = date.getTimezoneOffset() / 60;\n var hours = date.getHours();\n\n localDate.setHours(hours - offset);\n\n return localDate; \n}",
"function convertTimesToLocal() {\n var element... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetches an individual csv file from the server | async fetchCsv(type, fileName) {
return new Promise((resolve, reject) => {
Meteor.call('fetchCsvFile', type, fileName, function(error, result) {
if(error) {
console.log(`Error fetching csv file in the client! Error message: ${error.message}`);
}
resolve(result);
... | [
"function getcsv() {\n var url = BASEURL + '/surveys/' + SURVEYID + '/csv';\n request.get({url: url}, function(error, response, body) {\n if (handleError(error, response, body)) return;\n console.log(body);\n });\n}",
"function getCSV(filename) {\n var xhttp;\n xhttp = new XMLHttpRequest();\n xh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for filling the first data table with the averages of the selected school(s) total scores | function showMeanTotalScoreGrid() {
var htmlList = "";
var ctrl = "satMeanGrid";
//Build a HTML table on the fly dynamically and initialize it as a jQuery data table
htmlList += "<table width= 100% style= 'margin-top:12px:width:100%' class='row-border table-striped table-hover' id = 'table-" + ctrl + "... | [
"function showMeanEngScoreGrid() {\n var htmlList = \"\";\n var ctrl = \"satMeanGridEng\";\n\n //Build a HTML table on the fly dynamically and initialize it as a jQuery data table\n htmlList += \"<table width= 100% style= 'margin-top:12px:width:100%' class='row-border table-striped table-hover' id = 'ta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
i.e. tab is in a window of type "normal", not "popup", "panel", "app", or "devtools" We don't mute tabs in other types of windows because they are generally trusted and there is no UI control for unmuting them. | function isTabInNormalWindow(tab) {
const windowId = tab.windowId;
assert(Number.isInteger(windowId));
return windowIdToType[windowId] === "normal";
} | [
"function muteTabs()\n{\n// adapted from https://github.com/danhp/mute-tab-chrome/blob/master/src/background.js\n chrome.windows.getAll({populate: true},\n\t\t\t function(windowList) {\n\t\t\t windowList.forEach(function(window) {\n\t\t\t\t window.tabs.forEach(function(tab) {\n\t\t\t\t\t\tif (tab.audible ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get images in reverse order added | reversedImages () {
return this.images.slice().reverse();
} | [
"function backwardImg(){\n\n var tempImg = imageArray.pop();\n imageArray.unshift(tempImg);\n }",
"rearrangeImages() {\n if (!this.images || !this.images.length) return;\n const oldImages = this.images.concat(),\n rowLen = oldImages.length,\n colLen = oldImages[0].length... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcion precargar para el gif | precargar(){
this.gif = this.app.createImg('./Recursos/Balon.gif');
this.gif.size(95, 95);
} | [
"function displayGif() {\n var imageSrc = pokemon[round].gifFile;\n document.getElementById(\"silImage\").innerHTML = '<img src=' + imageSrc + '>';\n }",
"async function descargarMiGifo(nuevoGif) {\n\n let a = document.createElement('a');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Classifies a request into the categories measured by the extension: "notOnArchive" requests where the URL bar isn't on archive.org "waybackMachineMetaRequest" .archive.org requests where != web "archiveRequest" requests for archived captures of resources/pages "archiveEscape" escapes "unclassifiedRequest" something wen... | function classifyRequest(requestDetails, tab) {
if (!getHostnameFromUrl(tab.url).endsWith('archive.org')) {
return 'notOnArchive';
}
let url = requestDetails.url;
if (!isArchiveRequest(requestDetails) && isToArchiveDotOrg(requestDetails)) {
return 'waybackMachineMetaRequest';
} else if (isArchiveRequ... | [
"function onBeforeSendHeaders(requestDetails) {\n if (typeof requestDetails.tabId !== 'number' || requestDetails.tabId < 0) {\n console.log('tabid is', requestDetails.tabId);\n console.log(requestDetails.url);\n\n } else {\n chrome.tabs.get(requestDetails.tabId, function(tab) {\n let requestType = c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
current timestamp of the current render time current server time subtracted by delay | function currentServerTime() {
return firstServerTimestamp + (Date.now() - gameStart) - RENDER_DELAY;
} | [
"static currentTimeMillis() {\n return Date.now();\n }",
"getMilliseconds() {\n let currentMilliseconds = window.performance.now();\n return currentMilliseconds - this.startMilliseconds;\n }",
"function now() {\r\n return window.performance.now();\r\n}",
"_tick() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function that for given `view.Position`, returns a `view.Position` that is after all `view.UIElement`s that are after given position. For example: foo^bar For position ^, a position before "bar" will be returned. | function positionAfterUiElements( viewPosition ) {
return viewPosition.getLastMatchingPosition( value => value.item.is( 'uiElement' ) );
} | [
"childAfter(pos) {\n let { index, offset } = this.content.findIndex(pos);\n return { node: this.content.maybeChild(index), index, offset };\n }",
"moveBottomRight(position) {\n return this.native.moveBottomRight(position.native);\n }",
"function getInlineElementAfter(root, position) {\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
APPROACH 2: using a stick approach. we define a stick of length k and move it along the linked list once the end of the stick the end of the linked list, we know the beginning of the stick is where k is TIME: O(n) SPACE: O(1) constant | function kthToLastNode(k, head) {
if (k === 0) {
throw new Error;
}
// create a stick where the start of the stick is at the end and the end of the stick is at start + k
let startOfStick = head;
let endOfStick = head;
for (let i = 0; i < k; i++) {
endOfStick = endOfStick.next;
if (endOfSti... | [
"function removeKthLast(listNode, k) {\n let fastPointer = listNode;\n let runner = listNode;\n\n while(k > 0) {\n fastPointer = fastPointer.next;\n k--;\n }\n\n while(fastPointer.next !== null) {\n runner = runner.next;\n fastPointer = fastPointer.next;\n }\n\n // delete the required node by poi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shortcut Creates the splitter object. A splitter consists of a handle and an element left and right to it. When the handle is dragged the element left to it gets wider and the element right to it smaller, or the other way round. | function Splitter() {
this.LastX = 0;
this.OrigX = null; // default width of LeftEl
this.EventRef1 = null;// Stores reference for event removal in EndDrag method
this.LeftEl = null; // element left of resize handle
this.RightEl = null; // element right of resize handle
this.Open = true; // LeftPane open/clos... | [
"handleSplitterDragStart_() {\n // Use the computed width style as the base so that we can ignore what\n // box sizing the element has. Add the difference between offset and\n // client widths to account for any scrollbars.\n const targetElement = this.getResizeTarget_();\n const doc = targetElement.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get room by that name, creating if nonexistent This uses a programming pattern often called a "registry" users of this class only need to .get to find a room; they don't need to know about the ROOMS variable that holds the rooms. To them, the Room class manages all of this stuff for them. | static get(roomName) {
if (!ROOMS.has(roomName)) {
ROOMS.set(roomName, new Room(roomName));
}
return ROOMS.get(roomName);
} | [
"function getRoom(name=\"default\") {\n\tif (!rooms[name]) {\n\t\trooms[name] = {\n\t\t\tname: name,\n\t\t\tclients: {},\n\t\t}\n\t}\n\treturn rooms[name]\n}",
"getRoom(roomName) {\n // x => is a callback function that will return the room whose name is the same as roomName\n const room = this.rooms.find(x ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculates average word length | function averageWordLength (words) {
var totalLength = words.join("").length;
return (totalLength / words.length).toFixed(2);
} | [
"function averageWordLength() {\n var reducer = words2.reduce((acc, cv) => acc + cv.length, 0);\n return reducer / words2.length;\n}",
"function averageWordLength()\n{\n return words2.reduce((acc, elem, index)=> {\n var sum = acc*(index);\n sum += elem.length;\n acc = sum/(index+1);\n return acc;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to show all possible columns so the user can check or uncheck which columns he wants to see in the benchmark table | function showColumns(){
$('#columns').empty();
for (var i = 0; i < columns.length; i++){
var col = $('<input type="checkbox" value="'+columns[i].dbname+'" />')
.change(function(){
if ($(this).attr('checked')){
data.columns.push($(this).val());
var newcols = [];
for (var j = 0; j < co... | [
"function show_all_columns(table) {\n var data_table = table.dataTable();\n var total_col_count = data_table.fnSettings().aoColumns.length;\n\n for (var col_index = 0; col_index < total_col_count; col_index++) {\n data_table.fnSetColumnVis(col_index, true);\n }\n}",
"function columns_options() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hover over an element by given selector Note: Uses moveToObject method that is currently deprecated | function hover(selector) {
Reporter_1.Reporter.debug(`Hover over an element ${selector}`);
isVisible(selector);
tryBlock(() => browser.moveToObject(selector), `Failed to hover over ${selector}`);
} | [
"function hover(selector) {\n Reporter_1.Reporter.debug(`Move to an element '${selector}'`);\n waitForDisplayed(selector);\n tryBlock(() => $(selector).moveTo(), `Failed to hover over '${selector}')`);\n }",
"hoverOverProductListingCard() {\n this\n .waitForElementVisible('@product... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define the local version of the entity the client has. This is used to enable conditional requests. Depending on the request type, the value set here could be reflected in the XIfModifiedSince or XIfUnmodifiedSince headers. This attribute is not honoured on every request. See the documentation in the client API to lear... | set locallyModifiedVersion(value) {
// Will eventually become a header, so coerce to string.
this._locallyModifiedVersion = "" + value;
} | [
"get isCurrentVersion() {\n return this.originalResponse.isCurrentVersion;\n }",
"getServerVersion() {\n let rqst = this.newPublicRequest('GET', '/', null, '');\n return this._wrapWithPromise(rqst);\n }",
"get versionId() {\n return this.originalResponse.versionId;\n }",
"get client... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set animation input value (for instance frame value), This value affect all child elements in this scene graph (recursively). | setCurrentAnimationValue(inputName: string, inputValue: number|Vector2|Vector3|Vector4|Quaternion) {
if ((this: any)._setDirtyToAnimatedElement != null) {
(this: any)._setDirtyToAnimatedElement(inputName);
}
this._currentAnimationInputValues[inputName] = inputValue;
} | [
"setCurrentAnimationValue(inputName , inputValue ) {\n if ((this )._setDirtyToAnimatedElement != null) {\n (this )._setDirtyToAnimatedElement(inputName);\n }\n this._currentAnimationInputValues[inputName] = inputValue;\n }",
"setAni... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a promise to get the mappings for tools | function getToolMappingPromise(){
var defer = q.defer();
sync.callSyncServer('/unipoole-service/service-synch/contentMappings/'+groupSiteId,
'POST',
toolIds,
response,
function(responseData, data, mappingsResponse){
var response = JSON.parse(responseData);
toolMappings=response.mappings;
... | [
"function getHandleMappingPromise(){\n\t\t// If there is no tool data, we don't need to do anything\n\t\t// Also if there is no content mapping\n\t\tif(currentToolData == null || toolMappings == null || toolMappings[currentToolId] == null){\n\t\t\tnewToolData = null;\n\t\t\treturn q.when([]);\n\t\t}\n\t\t\n\t\t\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the time since the game began as a formatted string | function get_time() {
let d = new Date();
if (start_time != 0) {
d.setTime(Date.now() - start_time);
} else {
d.setTime(0);
}
return d.getMinutes().toString().padStart(2,"0") + ":" + d.getSeconds().toString().padStart(2,"0");
} | [
"function logTimeWhenGameStarts() {\n startTime = new Date();\n console.log(startTime);\n}",
"function time() { return (new Date()).toLocaleTimeString(); }",
"function getStartTime() {\n const timeGameStarted = performance.now();\n return timeGameStarted;\n}",
"function timeText() {\n let t = timeTaken... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if a variable is a valid object with named properties passed in the 'arrows' option. The object must have a property named 'next' and one either named 'prev' or 'previous'. The value of both of these must be a jQuery object. | function isArrowControlObject(input)
{
if (typeof input !== 'object') {
return false;
}
if (!input.hasOwnProperty('next') || !(input.next instanceof jQuery)) {
return false;
}
if (!input.hasOwnProperty('previous') || !(input.previous instanceof jQuery)) {
if (!input.hasOwnPropert... | [
"function check_arrows() {\n // if it's up is the pipeline_root the up arrow should be hidden.\n if ( this.node.up.id == 'pipeline_root' ) {\n getObject(this.id + '_arrow_up').style.display = 'none';\n getObject(this.id + '_arrow_up_disabled').style.display = 'inline';\n } else {\n get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Button inherits Tag Button does the following: render a MDL style button Arbitrary settings: item.type < automatically assigned item.id < automatically assigned item.needQuestion < False | function Button(parent_id, item = {}) {
item.type = item.type || "button";
item.id = item.id || "{0}_{1}".format(item.type, __BUTTON++);
item.needQuestion = false;
Tag.call(this, parent_id, item);
//MDL style
this.addon = ""
this.buttonStyle = item.buttonStyle || "raise";
switch (this.b... | [
"function Alib_Ui_Button(content, options, type)\r\n{\r\n // button or anchor\r\n if (type == 'link')\r\n type = 'a';\r\n\r\n if (type == 'span')\r\n type = 'span';\r\n \r\n if (!type)\r\n type = 'button';\r\n\t/**\r\n\t * The button dom element\r\n\t *\r\n\t * @private\r\n\t * @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function used to clear TSV data sets | function emptyDataSets(){
seriesDMATsv = '';
seriesWMATsv = '';
seriesMMATsv = '';
seriesTsv = 'metric\tdate\tclose\n';
} | [
"function emptyDatasets() {\n for (var dim in datasets) {\n delete datasets[dim];\n }\n }",
"function clearTables() {\n\ttables = [];\n\twaitList = [];\n\tdata = true;\n}",
"function clearData() {\n starts = [];\n stops = [];\n lats = [];\n lons = [];\n deltas = [];\n localStorage.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |