query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
TODO: Reduce redundancy between sameStructure and mustBeSameStructureInternal | function mustBeSameStructureInternal(left, right, message, path) {
function complain(problem) {
assert.fail(
details`${q(message)}: ${q(problem)} at ${q(
pathStr(path),
)}: (${left}) vs (${right})`,
);
}
const leftStyle = passStyleOf(left);
const rightStyle = passStyleOf(right);
i... | [
"function verifyStructure() {\n var component, key;\n parameters.structure.integrity = true;\n \n for (key in parameters.structure.components) {\n component = parameters.structure.components[key];\n if (component.integrity !== true) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function To handle DialogFlow FulFillment | function commonHandler(agent) {
console.log(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::");
console.log(":::::::::: " + new Date() + " ::::::::::");
console.log(":::::::::: DialogFlow FulFillment Called ::::::::::");
console.log("::::::::::::::::::::::::... | [
"function EnumCB_RefusalReason_POST() { \n \n /*Get pages */\n var questFlags = pega.ui.ClientCache.find(\"pyWorkPage.QuestFlags\");\n var responsePage = pega.ui.ClientCache.find(\"pyWorkPage.Respondent.Response\")\n var refusalReasonPG = pega.ui.ClientCache.find(\"pyWorkPage.Respondent.RefusalReason\");\n \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates the employer's statement for a single employee and informs the employee via the chosen communication channel(s) | function generateEmployeeStatement(employee, config, folder, logs, worker) {
if (employee["Full name"] == "") {
return logError(logs, employee, "Employee has no name!");
} else if (employee["Slack ID"] == "") {
return logError(logs, employee, "Employee has no Slack id!");
}
employee["Shift start"] = sh... | [
"function sendEmployee() {\n inquirer.prompt([\n {\n name: \"addOrUpdate\",\n message: \"Would you like to add a new employee or edit an existing employee's info?\",\n type: \"list\",\n choices: [\"Add New Employee\", \"Edit Employee\", \"Back\"]\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
deleting all symbols in their specific array so symbols won't be drawn in the update function then drawing the bg anew | function deletePicture() {
symbols = [];
drawBG();
} | [
"function undraw() {\n current.forEach(index => {\n squares[currentPosition + index].classList.remove('tetromino');\n squares[currentPosition + index].style.backgroundColor = ''\n })\n }",
"function undraw() {\n current.forEach(index => {\n squares[currentPosition + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Counts number of results with a value for a certain property (e.g. number of results with 'java' as a 'language' would be countUniqueValues(results, 'language', 'java') | countUniqueValues(array, property, value) {
let count = 0;
for (const object of array) {
if (object) {
if (object[property] === value) {
count++;
} else if ((object[property] === null || object[property] === undefined) && value === 'None') {
count++;
}
}
... | [
"countItems(value, property, itemArray) {\n var countArray = itemArray.filter(function (item) {\n return item[property] == value;\n });\n return countArray.length;\n }",
"getPropCount(messages, prop, val) {\n let count = messages.reduce(function(total, msg) {\n return !!msg[prop] === val ?... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a recursive function that draws the prime factorization tree for the input number n. | function primeFactors(n, p, x, y, prev) {
if (n <= 1) {
graph.addNode(x, y, n.toString(), radius);
}
while (n > 1) {
// base case
if (n == p) {
let leaf = graph.addNode(x, y, n.toString(), radius, radius);
leaf.nodeEllipse.style... | [
"function primeFactors(n){\n var out = ''; factor = 2; factorCount = 0; unfactored = n;\n while(factor <= Math.sqrt(unfactored)){\n \t\n \twhile(unfactored % factor == 0){\n \t\tfactorCount++;\n \t\tunfactored /= factor;\n \t}\n \t\n \tif(factorCount == 1){\n \t\tout += '(' + factor + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ attempt to balance HTML tags in the html string / by removing any unmatched opening or closing tags / IMPORTANT: we assume HTML has already been / sanitized and is safe/sane before balancing! / / adapted from CODESNIPPET: A8591DBAD1D311DE947CBA5556D89593 | function balanceTags(html) {
if (html == "")
return "";
var re = /<\/?\w+[^>]*(\s|$|>)/g;
// convert everything to lower case; this makes
// our case insensitive comparisons easier
var tags = html.toLowerCase().match(re);
// no HTML tags present? nothing to... | [
"function balanceTags(html) {\n if (html === \"\")\n return \"\";\n var re = /<\\/?\\w+[^>]*(\\s|$|>)/g;\n // convert everything to lower case; this makes\n // our case insensitive comparisons easier\n var tags = html.toLowerCase().match(re);\n // no HTML tags pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
It holds the word that we are indexing, as well as the line number and the line in which the word appears as well. For words that appear more than once, the lines and the line numbers are kept in parallel array.s Default WordIndex constructor. | function WordIndex(word, lineNum, line) {
this.word = word;
this.lineNums = [lineNum];
this.lines = [line];
} | [
"getWordIndex() {\n return parseInt(this.args[3], 10);\n }",
"async _makeIndex(contentText) {\n const index = {};\n const words = await this._wordsLow(contentText);\n words.forEach((pair) => {\n const [word, offset] = pair;\n const wordInfo = index[word] || [0, offset];\n wordInf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a string that is postfixed to a warning about an invalid type. For example, "undefined" or "of type array" | function getPostfixForTypeWarning(value) {
var type = getPreciseType(value);
switch (type) {
case "array":
case "object":
return "an " + type;
case "boolean":
case "date":
case "regexp":
return ... | [
"function getPostfixForTypeWarning(value){var type=getPreciseType(value);switch(type){case\"array\":case\"object\":return\"an \"+type;case\"boolean\":case\"date\":case\"regexp\":return\"a \"+type;default:return type}}",
"function getPostfixForTypeWarning(value) {\n\t\t\t\t\t\tvar type = getPreciseType(value);\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: Translate Enter key press to mouse click | function handleEnterPressed() {
window.event.cancelBubble=true;
if (window.event.keyCode==13) event.srcElement.click();
} | [
"keyPress(event) {\n if (event.key === \"Enter\") {\n this.click();\n }\n }",
"function EsckeyToMouse(){\n\tvar kCode = event.keyCode;\n\tvar obj = event.srcElement;\n\tif(kCode==commonReturnKeyCode && retBtn){\n\t\ttry{\t\t\n\t\tretBtn.click();\n\t\t}catch(e){\n\t\t\t//alert('keyToMou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve metadata for a specified key for a specified set of targets and merge results. | getAllAndMerge(metadataKey, targets) {
const metadataCollection = this.getAll(metadataKey, targets);
return metadataCollection.reduce((a, b) => {
if (Array.isArray(a)) {
return a.concat(b);
}
if (shared_utils_1.isObject(a) && shared_utils_1.isObject(b)... | [
"getAllAndMerge(metadataKey, targets) {\n const metadataCollection = this.getAll(metadataKey, targets).filter(item => item !== undefined);\n if (shared_utils_1.isEmpty(metadataCollection)) {\n return metadataCollection;\n }\n return metadataCollection.reduce((a, b) => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_pathCountForPoint Description: Returns number of paths connected to a point | function _pathCountForPoint(p_index) {
var count = 0;
for (var p = 0; p < self.paths.length; p++) {
if (self.paths[p].p1_index == p_index || self.paths[p].p2_index == p_index) {
count++;
}
}
return count;
} | [
"function countSelectedPathPoints(path){\r\n var i = 0;\r\n var count = 0;\r\n\r\n for (i=0; i<path.pathPoints.length; i++) {\r\n if (path.pathPoints[i].selected == PathPointSelection.ANCHORPOINT) {\r\n count++\r\n }\r\n }\r\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the number of scalable components for the line chart. | get scalableComponentsCount() {
var scalableComponentIdentifiers = this.scalableHeightComponentIdentifiers;
var scalableComponentsCount = scalableComponentIdentifiers.dimension.length + scalableComponentIdentifiers.margin.length;
return scalableComponentsCount;
} | [
"function getLineshapeCnt(){\n var lineshapeCnt = 0;\n canvas.getObjects().forEach(function(obj) {\n if(obj.type === \"Lineshape\") {\n lineshapeCnt++;\n }\n });\n return lineshapeCnt;\n}",
"function totalLines() {\n\tvar nline=0;\n\tfor(var i=0; i<plots.length; i++) nline += plots[i].params.length... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
toResultDom :: a x String > Dom Take an object and a success message, and return a DOM object that displays either error or success appropriately. | function toResultDom(v,successMsg) {
if(v.error) return P({className:'error'},v.error); else return P({className:'feedback-success'},successMsg);
} | [
"function renderResult () {\n $('#results').empty()\n $('#results').append($('<h2>').text('Validation Result'))\n var transforms = {\n status: {\n '<>': 'div',\n html: [\n {\n '<>': 'div',\n class: function (obj, index) { return 'alert ' + ((obj.valid > 0) ? 'alert-success' ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtains a setting for a guild | async get(guild, key, defValue) {
let guildObj = await this.getGuild(guild);
if(key === undefined) {
return guildObj.settings;
} else {
if(guildObj.settings[key] === undefined) {
return defValue;
}
return guildObj.settings[key];
}
} | [
"function guild() {\n return moltres.guilds.get(config.guild_id);\n}",
"async fetchGuildConfig() {\n\t\t\tconst data = await GuildSchema.findOne({ guildID: this.id });\n\t\t\tthis.settings = data;\n\t\t}",
"get guild() {\r\n return this.client.guilds.get(this.guildID);\r\n }",
"getSettings(guild) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allow ironlist to access its APIs from debounced callbacks without warns | _debounceRender(cb,asyncModule){super._debounceRender(()=>this._accessIronListAPI(cb),asyncModule)} | [
"_debounceRender(cb,asyncModule){super._debounceRender(()=>this._accessIronListAPI(cb),asyncModule);}",
"_debounceRender(cb, asyncModule) {\n super._debounceRender(() => this._accessIronListAPI(cb), asyncModule);\n }",
"get debounce() { return this._debounce; }",
"function delayed () {\n /* If ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
output info message on rootLoger | function info(msg){
rootLogger.info(msg)
} | [
"function showInfo() {Config.LogLevel = LogLevels.INFO;}",
"info() {\n var msg = util.format.apply(msg, arguments);\n this.log.info(this.namePrefix + msg);\n }",
"info(message) {\n\t\tif (this.logLevel > 2) return;\n\t\tconsole.log(`${this.prefix} ${'INFO:'.blue} ${message}`);\n\t}",
"info(message) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1. Create 2 test variables. The first test case to test the difference b/w the 1st element and the 2nd element. The second test case to test the quotient of the 2nd element divided by the 1st element. 2. Create 2 boolean testers and set them to true. These will allow us to test all of the s in the array, as opposed to ... | function ArithGeoII(arr) {
var difference = arr[1] - arr[0];
var ratio = arr[1] / arr[0];
var aTester = true;
var gTester = true;
for (var i = 0; i < arr.length - 1; i++){ // Need to make sure you cut out of the for-loop one step early (hence the arr.length - 1) because we are adding 1 to i in our e... | [
"function ArithGeo(arr) { \n //find constant multiple\n var geoNumber = arr[1] / arr[0];\n //find difference\n var arithNumber = arr[1] - arr[0];\n var gCount = 0;\n var aCount = 0;\n //loop through second to second to last number in array\n for(var i = 1; i < arr.length - 1; i++){\n //if number at i+1 d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads the argument with the specified name from the process arguments. | function readArgument(name, required = false) {
if (runningAsModule) {
if (!options || typeof options !== "object")
throw new Error("Options object must be passed to this function.");
return options[name];
}
const processArgs = process.argv;
const ... | [
"function GetArgument(name)\r\n {\r\n name = \"/\" + name + \"=\";\r\n for(var each = new Enumerator(WScript.Arguments); !each.atEnd(); each.moveNext())\r\n {\r\n var item = \"\"+each.item();\r\n var start = item.search(new RegExp(name, \"i\"));\r\n if(start >= 0)\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Init Testimonials Carousel shortcode | function initTestimonialsCarousel(){
"use strict";
if($j('.testimonials_c_carousel').length){
$j('.testimonials_c_carousel').each(function(){
var interval = 5000;
var $this = $j(this);
if(typeof $this.data('auto-rotate-slides') !== 'undefined' && $this.data('auto-rotat... | [
"function initTestimonialsSlider()\r\n\t{\r\n\t\tif($('.testimonials_slider').length)\r\n\t\t{\r\n\t\t\tvar testimonialsSlider = $('.testimonials_slider');\r\n\t\t\ttestimonialsSlider.owlCarousel(\r\n\t\t\t{\r\n\t\t\t\titems:3,\r\n\t\t\t\tloop:true,\r\n\t\t\t\tautoplay:true,\r\n\t\t\t\tnav:false,\r\n\t\t\t\tdots:fa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send photo request 'nudge' to a match | function reqPhoto(row) {
var matchid = matchId(row);
var div = document.getElementById('thumb' + matchid);
if (!(div instanceof HTMLDivElement)) return;
//div.style.fontSize = '10px';
div.textContent = 'Requesting...';
var _self = this;
_self.photoReqRow = row;
httpRequest(REQ_PHOTO_URL + matchi... | [
"function sendPhoto(img, id) {\n var url\n var data\n\n if (id == -1) {\n url = 'https://team5-nomadher-api.herokuapp.com/api/post_photo_id'\n data = {\n \"user_id\": user_id,\n \"photo_id_uri\": 'data:image/png;base64,' + img,\n }\n } else {\n url = 'https://team5-nomadher-api.herokuapp.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function put names of the sheet in the select tag in Answers.hmtl | function comboBox()
{
var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var numFiles = activeSpreadsheet.getNumSheets();
var respuesta= "";
for(var i=0; i< numFiles ;i++) //fila
{
var sheet = activeSpreadsheet.getSheets()[i];
respuesta= respuesta + sheet.getSheetName() + "-";
}
return... | [
"function populateSheetList() {\n console.log('Populating workSheet list.');\n document.getElementById('divWorksheetSelector').style.display = \"flex\";\n\n let options = \"\";\n let t = 0;\n for (ws of tableau.extensions.dashboardContent.dashboard.worksheets) {\n console.log(\"Sheet Name: \"+... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class: news Description:news Page Class member variables :[bool] m_isCampusClosed Author :Alex Comments :none | function news() {
// member varables
this.m_isCampusClosed = false;
} | [
"function RallyNewsDetailPage(){\n\tif (!(this instanceof arguments.callee)) throw new Error(\"Constructor called as a function\");\n\tthis.name = 'NewsDetail';\n}",
"function indexPage() {\n\t// member varables\n\tthis.m_isCampusClosed = false;\n}",
"constructor(title, author, published, pages) {\n //pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get values from all cells | getCellsValue() {
let rowData = [];
for(let ref in this.refs) {
if(ref != "checkbox") {
let cellValue = this.refs[ref].getCellValue();
rowData.push(cellValue);
}
}
return rowData;
} | [
"function getAllValues(sheet) {\n // Define the range where we'll get the answers from\n const firstColumn = sheet.getFrozenColumns() + 1;\n const firstRow = sheet.getFrozenRows() + 1;\n const lastColumn = sheet.getLastColumn();\n const lastRow = sheet.getLastRow();\n const range = sheet.getRange(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compute the xcoordinates of the intersection points of the two parabolas given by (px,py,ly) and (qx,qy,ly). px,py,qx,qy define two points P and Q and ly defines a horizontal line. We require ly qy, otherwise they have only one intersection in ((px+qx)/2, py). | function intersection_points(px, py, qx, qy, ly) {
if (py == qy)
return [(px+qx)/2];
let cp = px*px + py*py - ly*ly;
let cq = qx*qx + qy*qy - ly*ly;
let pl = py - ly;
let ql = qy - ly;
let P = 2 * (qx*pl - px*ql) / (qy - py);
let Q = (cp*ql - cq*pl) / (qy - py);
let sol1 = -P/2 - Math.sqrt(sq(P/2) ... | [
"function computeIntersections(px,py,lx,ly)\n{\n\n console.log(\"px \", px, \" py \",py,\" lx \", lx,\" ly \", ly)\n\n var X=Array();\n \n var A=ly[1]-ly[0];\t //A=y2-y1\n\tvar B=lx[0]-lx[1];\t //B=x1-x2\n\tvar C=lx[0]*(ly[0]-ly[1]) + \n ly[0]*(lx[1]-lx[0]);\t//C=x1*(y1-y2)+y1*(x2-x1)\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts this document instance to a runnable document instance. Involves creating VMRunner objects for each code block. | async toRunnable(options = {}) {
const runners = await this.createVMRunners(options)
this.state.set('runners', runners)
return this
} | [
"function Runner() {\n return _super.call(this, 'Runner') || this;\n }",
"generate() {\n // Update current editor, line, cursor position\n this.updateContext();\n // Check if documenter should run\n if (!this.shouldRun()) {\n return;\n }\n // Resolve ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
3 need predict function, takes xvals and returns y tensor | function predict(x) {
const xs = tf.tensor1d(x);
// y = mx + b
const ys = xs.mul(m).add(b);
return ys;
} | [
"function predict(x_vals) {\n // xs is a plain array and needs to converted into a tensor\n const tfxs = tf.tensor1d(x_vals);\n // formula for a line\n // y = mx + b or y = slope x + yIntercept\n const ys = tfxs.mul(m).add(b);\n return ys;\n}",
"function predict(x) {\n const xs = tf.tenso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function shows your password in the text area | function showPassword(displayPassword) {
document.getElementById("password").textContent = displayPassword;
} | [
"function displayPassword(showPassword) {\n document.getElementById(\"password\").textContent = showPassword;\n}",
"function renderPassword(password) {\n\n let text = document.querySelector(\"#password\");\n text.value = password;\n}",
"function showPassword() {\n\tvar x = document.getElementById(\"passw... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_angleToWidth Calculates the sector width from the angle and a radius E: width, radius S: angle in degrees | _angleToWidth(angle, radius) {
let angRadianos = angle * Math.PI / 180.0;
return Math.sqrt(2 * radius * radius - 2 * radius * radius * Math.cos(angRadianos));
} | [
"_angleToWidth(angle, radius) {\n return 2 * radius * Math.sin(angle * Math.PI / 360.0);\n }",
"async _angleToWidth(angle, radius) {\n let angRadianos = angle * Math.PI / 180.0;\n return Math.sqrt(2 * radius * radius - 2 * radius * radius * Math.cos(angRadianos));\n }",
"function _angleToWi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Try random grid positions until an empty one is found, then mark it as filled and return a position object | function assignNewPosition() {
var pos = {};
do {
pos.x = Math.floor(Math.random() * gridW);
pos.y = Math.floor(Math.random() * gridH);
} while (filledPositions[pos.x][pos.y]);
filledPositions[pos.x][pos.y] = true;
pos.x=pos.x*40+30+Math.floor(Math.random()*26-13);
pos.y=pos.y*40+30+Math.floor(Math.random... | [
"getEmptyPosition() {\n let cnt = Constants.MAX_ITERATIONS_LIMIT;\n\n while (cnt--) {\n let pos = {\n x: Utilities.getRandomFloat(-1, 1),\n y: Utilities.getRandomFloat(-1, 1),\n radius: Constants.PLAYER_INITIAL_RADIUS\n };\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the high score display based on the current game mode | function updateHighScore() {
if (isIdleMode) {
highScoreElement.textContent = `Idle High Score: ${highScoreIdle}`;
} else {
highScoreElement.textContent = `Speedrun High Score: ${highScoreSpeedrun}`;
}
} | [
"displayHighScore() {\n document.getElementById('highScoreDisplay').innerHTML = \"High Score: \" + gameOptions.highScore.toLocaleString();\n }",
"function showHighScore() {\n if (highScore < gameRound) {\n highScore = gameRound;\n $('#highScore').text(highScore)\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a config param and turns it into a string. Fails if doesn't exist. | function getString(name) {
const value = "" + get(name)
console.assert(value.trim() != "", "Empty config param " + name)
return value
} | [
"function getConfigParam(paramName) {\n var configParams = jq(document).data(\"ConfigParameters\");\n if (configParams) {\n return configParams[paramName];\n }\n return \"\";\n}",
"function getparameter (param) // string\n{\n if (typeof (param) === 'undefined' || param === null) { return ''... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add prefect status to currently shown student | function addPrefect(student, currentHouse) {
student.isPrefect = true;
prefects[currentHouse].push(student);
console.log(prefects);
displayStudentModal(student);
} | [
"function displayStudentModalPrefect() {\n if (student.isPrefect === true) {\n clone.querySelector(\".prefect\").textContent = \"Revoke prefect\";\n modalCredentials.querySelector(\"p:nth-child(6)\").textContent = `Prefect status: ${student.firstName} is prefect!`;\n } else {\n modalCredentials... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function called when we got a response from server where the VirtualImage from was submited | function onVirtualImageFormSubmitComplete()
{
//TODO: Check if the call ended successfully
if(viFormSubmited)
{
//Cleaning things
var viForm = document.getElementById("viForm");
viForm.reset();
viForm.action = "";
var viFormIframe = document.getElementById("viFormIframe");
viFormIframe.src... | [
"function processRemoteImage(imgUrl) {\n var subscriptionKey = subKey.key;\n console.log(\"subscriptionKey : \" + subscriptionKey);\n\n var landmark;\n var description;\n\n\n // You must use the same Azure region in your REST API method as you used to\n // get your subscription keys. For example, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
so I went and wrote a function to prove it was at least accurate. Basically, JS implicitly converts types to booleans in certain situations. The ones that convert to true are called truthy and the ones that convert to false are called falsy. My function, truthiness() converts values to booleans implicitly and returns t... | function truthiness(value) {
if (value) {
console.log( true );
}else {
console.log( false );
}
} | [
"function truthy(thing) {\n return !!thing;\n}",
"static boolToTrueFalse(value) {\n if (value === undefined) return undefined;\n if (value === null) return undefined;\n return value ? 'true' : 'false';\n }",
"function isTruthy() {\n \n}",
"function isTruthy(input) {\n return i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End: Instance variables Begin private instance methods formatter for the text on the items (only used when showCounts is switched on) oItemDataModel: current data for the item as described in the comment for PATH_TO_ITEMS returns the text to be used for the item | function formatItemTextForMultipleView(oItemDataModel) {
var sFormatedValue;
if (!oItemDataModel) {
return "";
}
if (oItemDataModel.state === "error") {
return oTemplateUtils.oCommonUtils.getText("SEG_BUTTON_ERROR", oItemDataModel.text); // originally the text was for segmented button only but... | [
"function itemToString (item) {\n if (item) {\n return `${item.name} x ${item.count}`\n } else {\n return '(nothing)'\n }}",
"getTreeviewItemsText() {\n return this.selector('#' + this.id + '.e-filemanager .e-splitter .e-treevie... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates that all transformers referred in the model exist | function makeSureAllTransformersExist(part, path) {
if (_.has(part, 'transform')) {
_.each(part.transform, val => {
if (_.isArray(val)) {
if (!_.has(appLib.appModelHelpers.Transformers, val[0])) {
errors.push(`Transformer "${val[0]}" doesn't exist in ${path.join('.')}`)... | [
"function makeSureAllTransformersExist(part, path, errors) {\n if (_.has(part, 'transform')) {\n _.each(part.transform, (val) => {\n if (_.isArray(val)) {\n if (!_.has(appLib.appModelHelpers.Transformers, val[0])) {\n errors.push(`Transformer \"${val[0]}\" doesn't exist in ${path.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
USEUNIT AssertClass USEUNIT CommonMethod USEUNIT DeviceTopologyPage USEUNIT GeneralPage USEUNIT ConfigEditorPage USEUNIT ConfigEditor_Methods USEUNIT ConfigEditor_FaultRecordingPage USEUNIT ConfigEditor_FinishPage USEUNIT DFR_Methods USEUNIT PDPPage USEUNIT ConfigEditor_TimeManagementPage USEUNIT ConfigEditor_Comms_Net... | function CAM_727()
{
try
{
Log.Message("Started TC:- Test to check the GUI(Text/Editbox) of iQ+ for Maximum DFR record length")
var DataSheetName = Project.ConfigPath +"TestData\\MaxDFR.xlsx"
//Step1.: Check if iQ-Plus is running or not.
AssertClass.IsTrue(CommonMethod.IsExist("iQ-Plus"),"Check... | [
"function CAM_690()\n{\n try\n {\n Log.Message(\"Started TC:- Test to check that minimum and maximum limit for DFR record length with non-Transco licenses \")\n var DataSheetName = Project.ConfigPath +\"TestData\\\\MaxDFR.xlsx\"\n \n //Step1.: Check if iQ-Plus is running or not.\n AssertClass.I... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the XHR object and sends the request. | create() {
const opts = pick$1(
this.opts,
"agent",
"enablesXDR",
"pfx",
"key",
"passphrase",
"cert",
"ca",
"ciphers",
"rejectUnauthorized"
);
opts.xdomain = !!this.opts.xd;
opts.xscheme = !!this.opts.xs;
cons... | [
"function xhrRequest() {\n var readyState = function() {\n // Only run if the request is complete\n if (xhr.readyState !== 4) {\n return;\n }\n\n if (xhr.status >= 200 && xhr.status < 300) {\n options.success(xhr);\n } else {\n options.error(xhr);\n }\n };\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Body Request Handling Function | function bodyRequest(body){
/* Process Request Modified from CS 290 Lecture
http://eecs.oregonstate.edu/ecampus-video/CS290/core-content/hello-node/express-forms.html */
var qParams = [];
for (var p in body){ /* Loop through request body */
qParams.push({'name':p,'value':body[p]})
}
return qParams; /* Add... | [
"exRequestBody(request, response) {\n const params = request.body;\n console.log(params);\n return response.json({\n titulo: \"Exemplo Request Body\",\n parametros: params\n });\n }",
"buildRequestBody(obj) {\n // here we can controll the body of the var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify whether a value is alphanumeric with symbols or not | verifyAlphaNumericWithSymbols(value) {
let regex = /^[a-zA-Z0-9 _./|!@#$%^&*()=+\\\-]*$/g;
return regex.test(value);
} | [
"alphanumeric(value) {\n if (/^[a-záàâãéèêíïóôõöúçñ \\d]+$/i.test(value)) {\n return false;\n }\n\n return messages.ALPHANUMERIC_ERROR;\n }",
"function isAlphanumeric(value) {\n\tvar alphanumericReg = /[a-z0-9]+/g;\n\tif (value.search(alphanumericReg) != -1) {\n\t\treturn true;\n\t}\n\tre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new ChallengeBasedAuthenticationPolicy factory. | function challengeBasedAuthenticationPolicy(credential) {
const tokenCache = new coreHttp.ExpiringAccessTokenCache();
const challengeCache = new AuthenticationChallengeCache();
return {
create: (nextPolicy, options) => {
return new ChallengeBasedAuthenticationPolicy(nextPolicy, options, ... | [
"function challengeBasedAuthenticationPolicy(credential) {\n return {\n create: function (nextPolicy, options) {\n return new ChallengeBasedAuthenticationPolicy(nextPolicy, options, credential);\n }\n };\n}",
"function ChallengeBasedAuthenticationPolicy(nextPolicy, options, credenti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs Kmeans on histogram from seeds to create clusters (step 3). | clusterColors_() {
if (!this.seeds_.length) {
throw Error("Please select seeds before clustering");
}
const clusterIndices = arrayUtils.repeat(0, PaletteExtractor.HISTOGRAM_SIZE_);
let newSeeds = [];
this.seedWeights_ = [];
let optimumReached = false;
let i = 0;
while (!optimumRea... | [
"function cluster() {\n const options = {\n k: slider.value(),\n maxIter: 100,\n threshold: 0.9,\n };\n // Using the ml5.js library to calculate kmeans;\n kmeans = ml5.kmeans(data, options, clustersCalculated);\n}",
"function runKMeans(data, numberOfClusters, visualizer, blackboar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render all house rules | renderHouseRules () {
return _.map(this.props.listing.house_rules, (val, key) => {
if (val) {
if (key === 'checkIn') {
return <li key={key}>{`Check-in at ${val}`}</li>
} else if (key === 'checkOut') {
return <li key={key}>{`Check-out by ${val}`}</li>
} else if (key ... | [
"function displayRules() {\n\treset();\n\tversion = 'extended';\n\tgameState = 'rules';\n\tsetVersion();\n\tsetGameElements();\n}",
"function render () {\n\t\t\twaiting = false;\n\t\t\tvar css = \"\\n\";\n\t\t\tfor (var sel in ruleset) {\n\t\t\t\tcss += sel + \" {\\n\";\n\t\t\t\tselRules = ruleset[sel];\n\t\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the word is valid or not based on the wordlist.json provided TODO This could probably be faster with a trie, I'm employing the most basic search. It could even be better with some sort of alphabetical binary search | function isValidWord(word) {
console.log(word);
if (words.wordlist.indexOf(word) >= 0) return true;
return false;
} | [
"search(word){\n if (this.is_word(word) === false) {\n return false\n }\n \n let currentNode = this.root;\n\n for (let char=0; char < word.length; char++){\n let char_index = this.char_to_index(word[char])\n if (!currentNode.children[char_index]){\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts a view into a container. This adds the view to the container's array of active views in the correct position. It also adds the view's elements to the DOM if the container isn't a root node of another view (in that case, the view's elements will be added when the container's parent view is added later). | function insertView(lView,lContainer,parentView,index,containerIndex){var views=lContainer[VIEWS];if(index>0){// This is a new view, we need to add it to the children.
views[index-1][NEXT]=lView;}if(index<views.length){lView[NEXT]=views[index];views.splice(index,0,lView);}else{views.push(lView);lView[NEXT]=null;}// Dyn... | [
"function insertView(container, viewNode, index) {\n var state = container.data;\n var views = state[VIEWS];\n var lView = viewNode.data;\n if (index > 0) {\n // This is a new view, we need to add it to the children.\n views[index - 1].data[NEXT] = lView;\n }\n if (index < views.leng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that hides button categories | function hideCategories() {
$(".categories").hide()
} | [
"function unhideCategories() {\n document.getElementById('quiz-category-title').style.display = 'none';\n let categoryButtons = document.getElementsByClassName('category-button');\n for (btn of categoryButtons) {\n btn.style.display = 'inline-block';\n }\n}",
"function hideCategoryButton() {\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extract the coverage data from the given cover profile & apply them on the files in the open editors. | function applyCodeCoverageToAllEditors(coverProfilePath, dir) {
const v = new Promise((resolve, reject) => {
try {
const showCounts = config_1.getGoConfig().get('coverShowCounts');
const coveragePath = new Map(); // <filename> from the cover profile to the coverage data.
... | [
"function applyCodeCoverage(editor) {\n if (!editor || editor.document.languageId !== 'go' || editor.document.fileName.endsWith('_test.go')) {\n return;\n }\n let doc = editor.document.fileName;\n if (path.isAbsolute(doc)) {\n doc = pathUtils_1.fixDriveCasingInWindows(doc);\n }\n con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Score by the influence of each node | function score_by_influence(nodes, edges, social) {
let scores = [];
let anchor = social.getAnchor();
let anchor_id = null;
let connections = null;
if (anchor) {
anchor_id = get_id(anchor);
connections = social.getConnections();
}
for (let i in nodes) {
let node = nodes[i];
let score = ... | [
"function _score ( node )\n\t{\n\t\treturn node.f;\n\t}",
"function getallNodesScore(nodes) {\r\n let allNodesScore = 0;\r\n\r\n nodes.forEach((node) => {\r\n allNodesScore += getNodeScore(node);\r\n });\r\n\r\n return allNodesScore;\r\n }",
"function getNodeScore(node)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
target_sheet columns: ca: 7 motion: 18 TODO: I want to pass an argument (column) to this function. e.g. splitCol(18) for motions | function splitCol() {
var col = 18; // EDIT to change split target
var sheet = SpreadsheetApp.getActiveSheet();
var row_start = 2; // Edit as required
var row_end = 9; // Edit as required
var separator = "CHAR(10)";
for (i = row_start; i < row_end + 1; i++) {
// ca_data = sheet.getRange(i, ca_col);
... | [
"function splitMotions(row_start, row_end, sheet){\n splitCol(18, row_start, row_end, sheet);\n}",
"function splitCol(col, row_start, row_end, sheet) {\n var separator = \"CHAR(10)\";\n for (i = row_start; i < row_end + 1; i++) {\n // ca_data = sheet.getRange(i, ca_col);\n cell2 = sheet.getRange(i, col +... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Writes player choices on UI and post the result | function writeResult(player1Choice, player2Choice, winner) {
//Sets the choices images
player1ChoiceImage.src = rockPaperScissors.getGameSymbolsMode() == 1 ? "assets/img/"+player1Choice+"-hand.png" :
"assets/img/"+player1Choice+"-symbol.png";
player2ChoiceImage.src = rockPaperS... | [
"function playerChoiceUpdate() {\n callStackReporter('playerChoiceUpdate()');\n\n RPSapp.pubNub.publish({\n channel : \"RPSchannel\",\n message : {\n user: RPSapp.thisUserID,\n choiceUpdate: RPSapp.playerChoice,\n bodyMsg: \"The challenger \" + RPSapp.thisUserID + \" chose \" + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
only incrememnt though the colors of the specified candidate if the state isn't this candidates color, start at solid | incrementCandidateColor(candidate, setPopularVote) {
if(this.disabled) {
return;
}
// if changing color set to solor
if(this.candidate !== candidate) {
this.colorValue = 0;
}
// otherwise increment
else {
this.colorValue += 1;
}
// keep the color value within bounds
if(this.candidate === ... | [
"function setCandidateColor(){\n\t\tcandidates\n\t\t.transition()\n\t\t.duration(500)\n\t\t.style(\"fill\", function(d){\n\t\t\tif(showPartyColors)\treturn getColor(d.party);\n\t\t\treturn getColor(d.segment)\n\t\t});\n\t}",
"static colorTile(props, state) {\n let number = props.number;\n let selectedNumber... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
update array, leave last destination at first index | function updateDest(arr){
now = new Date().getTime;
console.log(arr[1][1]);
if(arr[1][1] < now){
arr.shift();
}
} | [
"shiftItems(index){\n for( let i = index; i < this.lenght - 1; i ++){\n this.data[i] = this.data[i+1];\n }\n }",
"shiftItems(index){\n for(let i = index; i < this.length - 1; i++){\n this.data[i] = this.data[i+1];\n }\n delete this.data[this.length - 1];... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the plural category for a given value. "=value" when the case exists, the plural category otherwise | function getPluralCategory(value,cases,ngLocalization,locale){var key="="+value;if(cases.indexOf(key)>-1){return key;}key=ngLocalization.getPluralCategory(value,locale);if(cases.indexOf(key)>-1){return key;}if(cases.indexOf('other')>-1){return'other';}throw new Error("No plural message found for value \""+value+"\"");} | [
"function getPluralCategory(value, cases, ngLocalization, locale) {\n var key = \"=\".concat(value);\n\n if (cases.indexOf(key) > -1) {\n return key;\n }\n\n key = ngLocalization.getPluralCategory(value, locale);\n\n if (cases.indexOf(key) > -1) {\n return key;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate an update to the base GraphBrainz schema. | function generateSchema() {
// Get the instance of `graphql` that `graphbrainz` sees.
const graphql = require(resolveFrom(
require.resolve('graphbrainz'),
'graphql'
))
const extendedSchema = createSchema(graphBrainzSchema, {
extensions: ['graphbrainz/extensions/cover-art-archive'],
})
return s... | [
"function baseSchema() {\n\n}",
"updateSchema(schema) {\n // to avoid cyclic reference error, use flatted string.\n const schemaFlatted = (0, _flatted.stringify)(schema);\n this.run((0, _http.POST)(this.ws_url + '/schema/', schemaFlatted, 'text/plain')).then(data => {\n console.log(\"collab server's... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete post in firestore & image in storage | async function deletePost() {
try {
history.push('/home');
// delete image in storage
const imageRef = storage.ref(`images/${post.image.imageName}`);
await imageRef.delete();
// delete post in firestore
await postRef.delete();
toast.success('Tweet deleted successfully', ... | [
"delMsg(id, msgImg) {\r\n if (msgImg) {\r\n //Del Img in Storage\r\n var storageRef = storage.ref();\r\n var imgRef = storageRef.child(\"chatPictures/\" + id);\r\n imgRef\r\n .de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Combine two lists of matches by applying mergeMatch to the cartesian product of two lists of matches. Each list represents matches found in one child of a node. | function combineChildMatches(list1, list2) {
var res = [];
if (list1.length === 0 || list2.length === 0) {
return res;
}
var merged;
for (var i1 = 0; i1 < list1.length; i1++) {
for (var i2 = 0; i2 < list2.length; i2++) {
merged = mergeMatch(list1[i1], list2[i2]);
if (me... | [
"function combineChildMatches (list1, list2) {\n const res = []\n\n if (list1.length === 0 || list2.length === 0) {\n return res\n }\n\n let merged\n for (let i1 = 0; i1 < list1.length; i1++) {\n for (let i2 = 0; i2 < list2.length; i2++) {\n merged = mergeMatch(list1[i1], list2[i2])\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ejemplo, name = "profile" => return "newProfileParamBuilder" | function createBuilderName(name) {
var firstChar = name[0].toUpperCase();
return "new" + firstChar + name.slice(1) + "ParamBuilder";
} | [
"CreateProfile(string, string, GUID, IScanProfile) {\n\n }",
"GetProfiles(string, string) {\n\n }",
"function defaultParameter(name=\"sam\") {\n \n return name;\n}",
"function create (profile) {\n return new ProfileInfo(profile)\n}",
"function profileRequest (type, profileName) {\n retur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets job as runningJob property of ResultCollector | setRunningJob(context) {
const job = context.data;
if (this.runningJob === null || (this.runningJob.executionId !== job.payload.executionId)) {
this.runningJob = _.pick(job.payload, ['executionId', 'testSuiteId', 'testId']);
this.runningJob.currentIndex = 0;
this.runningJob.active = true;
... | [
"jobStarted() {\n ++this.running;\n this.log.trace('RateLimiter:jobStarted => running: ', this.running || '0');\n ++this.processedJobs;\n }",
"isJobRunning(){\n return getFilterJobStatus(this._id);\n }",
"constructor(currentJob) {\n this.currentJob = currentJob;\n }",
"function Cluster... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When tiling stops, we want to find the dragHandler and reshow it | onTilingStop() {
let dragHandle = document.querySelector('.fsbl-drag-handle.hidden');
if (dragHandle) {
dragHandle.classList.remove('hidden');
}
} | [
"onTilingStart() {\n\t\tlet dragHandle = document.querySelector('.fsbl-drag-handle');\n\t\tif (dragHandle) {\n\t\t\tdragHandle.classList.add('hidden');\n\t\t}\n\t}",
"function flightsDragEndHandler(ev) {\n dragEventCounter--;\n if (dragEventCounter === 0) {\n $(\".drop_box\").hide();\n $(\".in... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Challenge Six Highest popularity counter | function highestCount(numbersArray) {
let higherPopularity = 0;
let higher = highestFinder(numbersArray);
for (let index = 0; index < numbersArray.length; index += 1) {
if (numbersArray[index] === higher) {
higherPopularity += 1;
}
}
return higherPopularity;
} | [
"function updateMostPopular() {\n let clicksArr = [];\n // Generate an array containing key - value pairs of array stats\n for (let key in stats) clicksArr.push([key, stats[key]]);\n // Sort clicksArr by amount of clicks\n clicksArr.sort((a, b) => b[1] - a[1]);\n // Set mostPopularCourses to be the names of t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate age at (toDate) (iso format) from birth date | function getAge (birth, toDate) {
// with LARGESTDATE as today
if (!birth) { return "" }
birth = new Date(birth);
let today = (toDate === LARGESTDATE) ? new Date() : new Date(toDate),
ayear = today.getFullYear(),
amonth = today.getMonth(),
adate = today.getDate(),
byear = birth.getFullYear(),
... | [
"function getAge(dateofbirth) {\n let diff = new Date() - dateofbirth;\n if (!isNaN(diff)) return diff / 31557600000;\n else return 0;\n }",
"getAge(dob) {\n return moment().diff(dob, 'years', false);\n }",
"function getAge (dateOfBirth) {\n const ageMS = Date.now() - Date.parse(dateOfBir... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a frequency dictionary of array's items (key) and occurences (value). | function getFrequencyDict(arr) {
var dictionary = {};
arr.forEach((item) => {
if (dictionary[item] === undefined) {
dictionary[item] = 1;
} else {
dictionary[item] = dictionary[item] + 1;
}
});
return dictionary;
} | [
"function createFrequencyCounter(array) {\n let freqs = new Map();\n \n for (let val of array) {\n let valCount = freqs.get(val) || 0;\n freqs.set(val, valCount + 1);\n }\n \n return freqs;\n }",
"function frequencies(arr) {\n\tlet freq = {}\n\tfor (const el of arr)\n\t\tfreq[el] = freq.h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets an offset in a larger frustum. This is useful for multiwindow or multimonitor/multimachine setups. For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this ++++ | A | B | C | ++++ | D | E | F | ++++ then for each monitor you would call it like this const w = 1920; ... | setViewOffset( fullWidth, fullHeight, x, y, width, height ) {
this.aspect = fullWidth / fullHeight;
if ( this.view === null ) {
this.view = {
enabled: true,
fullWidth: 1,
fullHeight: 1,
offsetX: 0,
offsetY: 0,
width: 1,
height: 1
};
}
this.view.enabled = true;
this.view.... | [
"function setCameraOffset() {\n const fullWidth = w;\n const fullHeight = h + h * Math.abs(cameraVerticalOffset);\n const width = w;\n const height = h;\n const x = 0;\n const y = h * cameraVerticalOffset;\n /*\n fullWidth — full width of multiview setup\n fullHeight — f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funksjon som tar imot en URL og parser hvis dokumentet er i JSONformat. Returnerer null hvis readyState ikke er 4 og status ikke er 200. Ellers pusher den parset JSON inn i den globale variabelen globalEntries | function requestURL(url, callback) {
var urlEntries = {};
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
urlEntries = JSON.parse(xhr.responseText).entries;
console.log(urlEntries);
globalEntries.... | [
"function JSONRequestDuringLoad(url, parseResponse, onReadyWithData){\n var index = parsedResponses.length; //Index for the new request\n parsedResponses.push(null); //Put in null initially\n readyWithDataCallbacks.push(onReadyWithData);//Store callback for window event listener\n getJSONData(url, funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set jplayer song name and url | function setSong(name, inter, songUrl, title) {
$(name).jPlayer({
ready: function(event) {
$(this).jPlayer("setMedia", {
title: title,
mp3: songUrl
});
},
swfPath: "js",
cssSelectorAncestor: inter,
supplied: "mp3",
wmode: "window",
smoothPlayBar: true,
keyEnabled: true,
us... | [
"function setPlayingSong(song) {\n //Update GUI\n var player = get(\"player\");\n player.src = song.file;\n if(song.link === \"\") {\n\t\tget(\"artist\").innerHTML = song.artist;\n\t} else {\n\t\tvar a = document.createElement(\"a\");\n\t\ta.setAttribute(\"href\", song.link);\n\t\ta.innerHTML = song.art... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method will calculate the sum of values that need to be moved. | sumOfMovables()
{
let sum = 0;
for(let a of this.getValues())
{
sum+=a;
}
return sum;
} | [
"get movingSum() {\r\n if (this.i.b == null) {\r\n return null;\r\n }\r\n return this.i.b.externalObject;\r\n }",
"function move(index){\n var item = all_items[index];\n \n if (item.location == \"house\"){\n if(total_weight + item.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
validate the config if appkey is null | function validateConfig() {
var config;
try {
config = require("./hsc-wx-sdk.config")
} catch (e) {
throw '请把mtj-wx-sdk.config.js文件拷贝到utils目录中'
}
if (config && config.appKey) {
data.key = config.appKey;
setStorage(storageKeys.appId, data.key);
console.log("mtj-wx-sdk.config.js文件中的appKey字段已... | [
"function validateConfig() {\n //If the Config File was not created because it does not exist\n if(!config) {\n throw new Error('The config file is missing, Please create a config file.');\n }\n if(!config.app.version && !config.app.code) {\n throw new Error('Missing version id and share code.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
getTableHeight gets height of the table. Calculates the height of the table if a row is expanded. | getTableHeight(tableData, openIndex, openHeight) {
return (
(tableData.length + 1) * 30 +
(openIndex || openIndex === 0 ? openHeight : 0)
);
} | [
"getTableHeight(tableData, selectedIndex, openHeight) {\n openHeight = openHeight ? openHeight : 0; // selectable but not expandable\n return (\n (tableData.length + 1) * 30 +\n (selectedIndex || selectedIndex === 0 ? openHeight : 0)\n );\n }",
"getTotalRowsHeight() {\n return this.table ? ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
timeBox Heading/////////////////////////////////////// uses picker to shoose which heading to display | function timerHeadDis () {
if (picker == 1) {
$('.timeType h2').html("SESSION")
}
else {
$('.timeType h2').html("BREAK")
}
} | [
"function setTimeText() {\n\t$.label.font = {\n\t\tfontFamily : \"helvetica\",\n\t\tfontSize : (15 / 160) * Alloy.Globals.height,\n\t};\n\tif ( alarm instanceof Alarm) {\n\t\t$.time.text = alarm.time.format(\"H:mm\");\n\t\t$.time.font = {\n\t\t\tfontFamily : \"HelveticaNeue-Thin\",\n\t\t\tfontSize : (50 / 160) * Al... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sauve l'etat du 1er sommaire de la page dans un cookie si on quitte la page, et le remet quand on revient pour SPIP < 2.0, il faut le plugin jquery.cookie.js | function cs_sommaire_cookie() {
if(typeof jQuery.cookie!='function') return;
var replie = jQuery.cookie('cs_commaire');
jQuery.cookie('cs_commaire', null);
if (Number(replie))
jQuery(sommaire_sel).eq(0).addClass('cs_sommaire_replie')
.next().toggleClass('cs_sommaire_invisible');
jQuery(window).bind('un... | [
"function schreibCookie() {\n var neuerKeks = 'TWDSpoiler=';\n for (Eigenschaft in TWD)\n { neuerKeks += Eigenschaft + \":\" + TWD[Eigenschaft] + \"&\"; }\n var jetzt = new Date();\n var verfall = new Date(jetzt.getTime() + 1000*60*60*24*365); // 1 Jahr Cookiezeit\n neuerKeks += \"; expires=\" + fixed... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Capture the original offsets for the target element. This needs to be called whenever the page size changes or when the page is first scrolled. For some reason, calling this before the page is first scrolled causes the element to become fixed too late. | function resetScroll() {
// Set the element to it original positioning.
target.trigger('preUnfixed.ScrollToFixed');
setUnfixed();
target.trigger('unfixed.ScrollToFixed');
// Reset the last offset used to determine if the page has moved
// h... | [
"function resetScroll() {\n\t\t\t// Set the element to it original positioning.\n\t\t\ttarget.trigger('preUnfixed.ScrollToFixed');\n\t\t\tsetUnfixed();\n\t\t\ttarget.trigger('unfixed.ScrollToFixed');\n\n\t\t\t// Reset the last offset used to determine if the page has moved\n\t\t\t// horizontally.\n\t\t\tlastOffsetL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unrenders the current view and reflects this change in the Header. Unregsiters the `currentView`, but does not remove from viewByType hash. | function clearView() {
header.deactivateButton(currentView.type);
currentView.removeElement();
currentView = t.view = null;
} | [
"function clearView() {\n\t\theader.deactivateButton(currentView.type);\n\t\tcurrentView.removeElement();\n\t\tcurrentView = t.view = null;\n\t}",
"remove(){\n this.removeViews(Object.keys(this.views));\n this.el.innerHTML = null;\n this.layouts[this.layout].isRendered = false;\n this.layout = null;\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
"hide" event handler that sets a Panel instance's "width" configuration property back to its original value before "setWidthToOffsetWidth" was called. | function restoreOriginalWidth(p_sType, p_aArgs, p_oObject) {
var sOriginalWidth = p_oObject[0],
sNewWidth = p_oObject[1],
oConfig = this.cfg,
sCurrentWidth = oConfig.getProperty("width");
if (sCurrentWidth == sNewWidth) {
oConfig.se... | [
"function restoreOriginalWidth(p_sType, p_aArgs, p_oObject) {\n\n var sOriginalWidth = p_oObject[0],\n sNewWidth = p_oObject[1],\n oConfig = this.cfg,\n sCurrentWidth = oConfig.getProperty(\"width\");\n\n if (sCurrentWidth == sNewWidth) {\n oConfig.setProper... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
callback for the click on targetOrigin | function onTargetOriginClick() {
console.log("Clicked onTargetOriginClick");
// update the UI
w3.toggleClass('#targetOrigin', 'w3-red');
w3.removeClass('#targetChildren', 'w3-red');
w3.removeClass('#targetWomen', 'w3-red');
w3.removeClass('#targetLGTBIQ', 'w3-red');
// toggle this filter and disable the o... | [
"function targetOrigin() {\n return messageEvent.origin === 'null'\n ? options.targetOrigin\n : messageEvent.origin;\n }",
"function handleOriginSelect(e) {\n props.setOrigin(e.target.value);\n }",
"function facebookDestinationClickHandler(e){\n\n _photoDestination = '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extends selection to line start. | extendToLineStart() {
if (isNullOrUndefined(this.start)) {
return;
}
this.end.moveToLineStartInternal(this, true);
this.upDownSelectionLength = this.end.location.x;
this.fireSelectionChanged(true);
} | [
"moveToLineStart() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n this.updateBackwardSelection();\n this.start.moveToLineStartInternal(this, false);\n this.end.setPositionInternal(this.start);\n this.upDownSelectionLength = this.start.location.x;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get service by uri. | async get(uri) {
await this.makeFresh();
return this.serviceMap.get(uri);
} | [
"getService(name) {\n if (this.services.has(name)) {\n return this.services.get(name);\n } else {\n throw Error('Requested service not found.');\n }\n }",
"service(name) {\n if (!this._serviceMap) return\n\n let found = this._serviceMap[name]\n logServiceConfig('lookup service',... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If user started a search by this entries type. Just check state property. | isSearching() {
const entriesType = this.getEntriesType();
return this.props.state.entries[entriesType].isSearching || false;
} | [
"checkTopStoriesSearchTerm(searchTerm){ debugger;\n return !this.state.results[searchTerm];\n }",
"function checkQuery() {\n var typedQuery = controls.$searchQuery.val();\n if (typedQuery !== query) {\n query = typedQuery;\n navigating = true;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns Runner instances from data.js | function Runner(data) {
this.dataActivityId = data.dataActivityId;
this.athleteRank = data.athleteRank;
this.athleteName = data.athleteName;
this.athleteGender = data.athleteGender;
this.athleteAge = data.athleteAge;
this.finishTime = data.finishTime;
this.finishPace = data.finishPace;
this.athleteActiv... | [
"function getRunners(callback) {\n return client.hgetall('wf_runners', function (err, runners) {\n var theRunners = {};\n if (err) {\n log.error({err: err});\n return callback(new wf.BackendInternalError(err));\n }\n Object.keys(runner... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loadTags Gets tags from API and calls to have them rendered | function loadTags() {
let tags = new wp.api.collections.Tags()
tags.fetch().done( () => {
console.log(tags);
//clearCategories();
tags.each( tag => loadTag( tag.attributes ) );
});
} | [
"function renderTags () {\n fetch(\"http://localhost:3001/api/tags/all\", {\n headers : {\n 'Authorization' : 'Bearer ' + token\n }\n }).then(res => {\n return res.json()\n }).then(data => {\n setTags(data)\n })\n }",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add an ingoing docking (required) point to this course. Docking points are used to connect KC links and courses. | addIngoingDockingPoint(kcData) {
let point = new DockingPoint(this, getInputPoint,
{x:0,y:this.height + this.dockPointsReq.length*this.thickness+this.thickness/2},kcData);
this.dockPointsReq.push(point);
return point;
} | [
"setIngoingDockingPoint(dockingPoint) {\n this.inPoint = dockingPoint;\n }",
"function addToDock() {}",
"async addToDock () {\n await atom.workspace.open(await this.getInstance(), {\n activateItem: atom.config.get(`${PLUGIN_NAME}.dock.isActive`),\n activatePane: atom.config.get(`${PLUGIN_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function to make an 'atomic' readmode, defined using Javascript rather than Res. | function atomicReadmode(readF, openF = nop, closeF = nop, name = "") {
let rm = new ResReadmode();
rm.read = readF;
rm.open = seq(preOpen.bind(rm), openF.bind(rm));
rm.close = seq(preClose.bind(rm), closeF.bind(rm));
return rm.makeItem(name);
} | [
"function ResReadmode(readCode = \"\", openCode = \"\", closeCode = \"\") {\n this.openCode = openCode;\n this.openBlock = function() { return new ResBlock(this.openCode); }\n this.readCode = readCode;\n this.readBlock = function() { return new ResBlock(this.readCode); }\n this.closeCode = closeCode;\n th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add browser animation module to app.module. | function addAnimationRootConfig(options) {
return (host) => {
const workspace = config_1.getWorkspace(host);
const project = schematics_2.getProjectFromWorkspace(workspace, options.project);
schematics_3.addModuleImportToRootModule(host, 'BrowserAnimationsModule', '@angular/platform-browser/... | [
"function addAnimationsModule(options) {\n return (host) => {\n const workspace = config_1.getWorkspace(host);\n const project = schematics_2.getProjectFromWorkspace(workspace, options.project);\n const appModulePath = ng_ast_utils_1.getAppModulePath(host, schematics_2.getProjectMainFile(pro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns a sorted array of binding objects | getMenuBindings() {
let bind = [];
// sort by weight
for (let cmd in this.bindings) {
if (typeof this.bindings[cmd].menu !== 'undefined') {
bind[this.bindings[cmd].menu.weight - 1] = this.bindings[cmd];
}
}
return bind;
} | [
"getSortArray() {\n const sortable = []; // {\"1\": 10, \"49\": 5}\n for (const key in this.numberPool) \n sortable.push([Number(key), this.numberPool[key]]);\n \n sortable.sort((a, b) => b[1] - a[1]); // Descending\n return sortable;\n }",
"sort() {\n this.con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to erase the last entry/operand in the array | function clearLastEntry () {
inputArray.splice(inputArray.length-1,1);
console.log('Entry Cleared: ' + inputArray);
operand = '';
number = '';
} | [
"function destructivelyRemoveElementFromEndOfArray(array) {\n return array.pop();\n}",
"function destructivelyRemoveElementFromEndOfArray(arr) {\n arr.pop();\n return arr;\n}",
"delete() {\r\n this.currentOperand_ = this.currentOperand_.slice(0, -1);\r\n }",
"removeLastElement() {\n /* istanbul i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the region for any valid Flipnote Studio or Flipnote Studio 3D user ID | function getFsidRegion(fsid) {
if (isPpmFsid(fsid))
return getPpmFsidRegion(fsid);
else if (isKwzFsid(fsid))
return getKwzFsidRegion(fsid);
return exports.FlipnoteRegion.UNKNOWN;
} | [
"function getFsidRegion(fsid) {\r\n if (isPpmFsid(fsid))\r\n return getPpmFsidRegion(fsid);\r\n else if (isKwzFsid(fsid))\r\n return getKwzFsidRegion(fsid);\r\n return FlipnoteRegion.UNKNOWN;\r\n}",
"function findRegion(id){\r\n if(id<=151){return 'Kanto';}\r\n if(id<=251){return 'Johto';... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Force the UTC flags to be true if the source date date is UTC, as they will be overwritten later. | function cloneDateByFlag(d, clone) {
if (_utc(d) && !isDefined(optFromUTC)) {
optFromUTC = true;
}
if (_utc(d) && !isDefined(optSetUTC)) {
optSetUTC = true;
}
if (clone) {
d = new Date(d.getTime());
}
return d;
} | [
"toUTCDate() {\r\n return this.config.timezone === 'UTC'\r\n ? this._baseDate\r\n : new Date(this._baseDate.getTime() + this._baseDate.getTimezoneOffset() * MS_A_MINUTE)\r\n }",
"function maybePretendUtc(date: Date): Date {\n /* eslint-disable operator-linebreak */\n /* esl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
udpate the ingrid hold with the clearshelf cached response info. | function handle_clear_cache_resp(resp) {
if (!angular.isArray(resp)) resp = [resp];
angular.forEach(resp, function(info) {
if (info.action) {
var grid_item = holds.filter(function(item) {
return item.hold.id() == info.hold_details.id
})[0];... | [
"function refresh() {\n if (refreshes++ >= opts.keepalives) {\n return next(new LockError('Lock keepalive timeout'));\n }\n\n client.set([name, value, \"PX\", opts.timeout],\n function(err) {\n if (err) {\n next(new RedisError(err));\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if an IP is a private address according to This will handle IPv4mapped IPv6 addresses correctly but return false for all other IPv6 addresses. | function ipIsPrivateV4Address(ip = "") {
// Handle IPv4-mapped IPv6 addresses like ::ffff:192.168.0.1
if (ip.startsWith("::ffff:")) {
ip = ip.substr(7); // Strip ::ffff: prefix
}
const octets = ip.split(".").map(o => parseInt(o, 10));
return octets[0] === 10 // 10.0.0.0 - 10.255.255.255
... | [
"function isIPV6Private(ipAddr)\r\n{\r\n //Expand shorten IPv6 addresses to full length\r\n ipAddr = expandIPV6(ipAddr);\r\n //Split into array of fields\r\n var substrIP = ipAddr.split(\":\");\r\n //Join the fields into one string \r\n ipAddr = substrIP.join(\"\").toUpperCase();\r\n //For each IPv6 locally ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ASISTENCIAS API obtiene todas las asistenciass | function getAsistencias(req, res, next){
db.any("SELECT * FROM asistencias")
.then(function(data){
res.status(200)
.json({
status: 'success',
data: data,
message: 'Retrived list'
})
})
.catch(function(err){
return next(err);
})
} | [
"function getEncuestas() {\n\t\t\tvar ids = [];\n\t\t\t$scope.aplicaciones.forEach(function(aplicacion) {\n\t\t\t\tids.push(aplicacion.encuesta_id);\n\t\t\t});\n\n\t\t\tEncuestasFactory.getEncuestas(ids)\n\t\t\t.then(function(response) {\n\t\t\t\t$scope.encuestas = response;\n\t\t\t});\n\t\t}",
"static getAcompan... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add's display none propery to svg with definitions | function transformSvg(svg, cb) {
svg.attr({ style: 'display:none' });
cb(null);
} | [
"_hideShapes() {\n this.getElement(\"ellipse\").setAttribute(\"hidden\", true);\n this.getElement(\"polygon\").setAttribute(\"hidden\", true);\n this.getElement(\"rect\").setAttribute(\"hidden\", true);\n this.getElement(\"markers\").setAttribute(\"d\", \"\");\n }",
"function transformSvg (svg, cb) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a bucket object that represents an attempt to change state. it is resolved if the attempt is successful, otherwise the callback can be retried until it is. | function Attempt(state, callback, deferred) {
this.state = state;
this.callback = callback;
this.deferred = deferred;
callback(state);
} | [
"function thennable (ref, cb, ec, cn) {\n // Promises can be rejected with other promises, which should pass through\n if (state == 2) {\n return cn()\n }\n if ((typeof val == 'object' || typeof val == 'function') && typeof ref == 'function') {\n try {\n\n // cnt protects ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Highlight the row of text corresponding to the current video frame. Checks if the current time of the video lies within the start and end times of the text | function reviewText(){
$('#transcript tr').each(function(){
if($(this).attr('endtime')>=formatTime(video.currentTime) && $(this).attr('starttime')<=formatTime(video.currentTime) )
$(this).css('background-color','lightblue');
else
$(this).css('background-color','white');
});
} | [
"function highlightText() {\n //Get current video time\n var highlightTime = video.currentTime;\n\n //Highlight span in sync with the current time\n function Highlight(n) {\n // Removed highlight from text\n for (var i = 0; i < text.length; i++) {\n text[i].classList.remove(\"highlighted\");\n }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
8. Write a function that takes two parameters, firstName and lastName, and returns a full name (the full name should be the first and the last name separated by a space). | function getFullName(firstName, lastName) {
return firstName + ' ' + lastName;
} | [
"function getFullName(firstName, lastName) {\n return firstName + ' ' + lastName;\n}",
"function fullName(firstName, lastName) {\n return firstName + lastName;\n}",
"function getFullName(firstName, lastName){\n return firstName+\" \"+ lastName\n }",
"function fullName(first, last){\n return first + ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is called from video_renderer_update in video_sdl2.c when a screenshot has been requested. The simpler way of doing this is to just call toBlob on the main emulator canvas. However, by default that doesn't work with a WebGL context. You can specifc preserveDrawingBuffer when createing the WebGL context, however th... | function capture_frame(bptr, bw, bh, sx, sy, sw, sh, ww, wh) {
if (capturingScreenshot) {
capturingScreenshot = false;
let pixels = new Uint8ClampedArray(HEAPU8.subarray(bptr, bptr + bw*bh*4));
//console.log(`(${bw}x${bh}):(${sx},${sy}) ${sw}x${sh} => ${ww}x${wh}`);
// Flip endianness and convert AR... | [
"function screenShot(win,blobHandler,opts) {\n\t\tif(!win) {\n\t\t\tx.err(\"no window for screenshot\");\n\t\t\treturn null;\n\t\t}\n\t\tlet format = BLOB;\n\t\tlet mimetype = x.getParam(\"sc.image.mimetype\");\n\t\tlet ratio = 0.5; // does not take any effect\n\t\tlet sound = x.getParam(\"sc.sound\");\n\t\tlet fil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the current ClaimResponse resource from the bundle loaded | getClaimResponse(claimResponseBundle = undefined) {
if (claimResponseBundle) return claimResponseBundle.entry[0].resource;
return this.state.claimResponseBundle
? this.state.claimResponseBundle.entry[0].resource
: null;
} | [
"getClaimResponse() {\n return this.state.claimResponseBundle.entry[0].resource;\n }",
"getClaim() {\n return this.props.claimBundle.entry[0].resource;\n }",
"static get __resourceType() {\n\t\treturn 'ClaimResponse';\n\t}",
"getBundle() {\n if (this.get('bundle')) {\n return Promise.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PARAMS: required string table_id (e.g. "table"); optional string merge_cell_class (e.g. "merge_cells"); | function table_merger(table_id,merge_cell_class)
{
//Configuration
//cell class to be merged
this.cell_class = merge_cell_class === undefined ? 'selected' : merge_cell_class;
if(table_id === undefined)
console.error("bad input");
else
this.table_id = table_id;
//merge selec... | [
"function mergeCellTable(task_id){\n var container = '.task-' + task_id + ' .task_' + task_id + '_progess_dates'\n $(container).each(function(index){\n if(index == 0) {\n var length = $(container).length\n $(this).attr('colspan', length);\n } else {\n $(this).remove();\n }\n });\n}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a yvalue, return the Date where it falls on the yaxis. | function getDateFromY(value) {
return yScale.invert(value);
} | [
"function y(d) { return d.yVar; }",
"function yY(d) {\n\t\t\treturn yScale(d[1]);\n\t\t}",
"function yValue(d, i) {\n return yScale(i);\n }",
"function yScale (data, yvalue) {\n var yLinearScale = d3.scaleLinear()\n .domain(d3.extent(data, data => data[yvalue]))\n .range([char... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets check button to incorrect state | function setCheckButtonToIncorrect() {
_myDispatcher.dispatch("iteration.checkbutton", {"state":"incorrect"});
} | [
"function setCheckButtonToCorrect() {\n\t\t_myDispatcher.dispatch(\"iteration.checkbutton\", {\"state\":\"correct\"});\t\n\t}",
"function setCheckButtonToInactive() {\n\t\t_myDispatcher.dispatch(\"iteration.checkbutton\", {\"state\":\"inactive\"});\n\t}",
"function dothecheck()\r\n\t\t{\r\n\t\tif(makeButton.che... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Button animation and visibility related / / Display travelBar if currentPage is travel, or if pageType is travel | function toggleTravelBar() {
var $travelBar = $('#travelBar');
if (currentPage == 'travel' || pageType == 'travel') {
$travelBar.css({'display': 'block'}).animate({opacity: 1}, textDelay);
}
else {
$travelBar.animate({opacity: 0}, textDelay);
setTimeout(function() { $travelBar.css({'disp... | [
"function navArrowVisibility(){\n // console.log('in navArrowVisibility');\n if(currentStep != stepIDs[stepIDs.length-1]){\n $('#projectTitleBar .fa-angle-right').css('visibility', 'visible');\n // console.log('making right nav visible');\n }else{\n $('#projectTitleBa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |