query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Sorts through the questions and returns whether a question has the same id and uid as the parameters. | function questionPresent(uid,id){
let found = false
questions.forEach(function (question){
if (question.id === id && question.uid === uid){
found = true;
}
})
return found;
} | [
"function checkProvidedAnswer(question, answer){\n var checked = false\n if(answer.answerId == question.providedAnswer){\n checked = true\n }\n return checked\n }",
"function allAreAnswered(questions){\n if(questions.status===1){\n return true\n }\n}",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Collapse or Expands all services to show requirements. Changing the text content and the image icon when clicked. | function switchExpand(){
// Variables. Get expand button and image
let desc = document.getElementsByClassName("multi-collapse");
let btn = document.getElementById("expandButton");
let expand = document.getElementsByClassName("expand");
// console.log(btn.textContent);
// Changing text context o... | [
"function updateUI() {\n if (isSmall) {\n view.ui.add(expandLegend, 'top-right');\n view.ui.remove(legend);\n view.ui.components = [\"attribution\"];\n } else {\n view.ui.add(legend, 'top-right');\n view.ui.remove(expandLegend);\n view.ui.components = [\"attributi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change a loop to a 'foreach' loop | function changeLoopToForeach() {
var sO = CurStepObj;
if (sO.activeParentExpr.isLoopStmt() &&
(sO.activeChildPos <= 0)) {
sO.activeParentExpr.str = 'foreach';
sO.activeParentExpr.type = ExprType.Foreach;
sO.activeParentExpr.deleted = DeletedState.None;
} else {
... | [
"each(visitor, context) {\n return this.items.forEach(visitor, context);\n }",
"function each( a, f ){\n\t\tfor( var i = 0 ; i < a.length ; i ++ ){\n\t\t\tf(a[i])\n\t\t}\n\t}",
"function for_each(){\n var param_len = arguments[0].length;\n var proc = arguments[0];\n while(!is_empty_list(argum... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes family member from a specific family. | async function deleteFamilyMember(current, email) {
let sql = `DELETE FROM family WHERE email = ? AND name = ?`;
await db.query(sql, [email, current]);
} | [
"function deleteMemberFromAppData(e, memberName) {\n\n let indexinAppData =0;\n appData.members.forEach((member, index)=> {\n if(member.name === memberName){\n indexinAppData = index;\n }\n })\n appData.members.splice(indexinAppData,1);\n}",
"async destroy({ params, request, response }) {\n cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
AssetExists returns true when asset with given ID exists in world state. | async _AssetExists(ctx, id) {
const assetJSON = await ctx.stub.getState(id);
return assetJSON && assetJSON.length > 0;
} | [
"idAlreadyExistsInBundle(id) {\n for (let e of this.entry) {\n let resource = e.resource;\n if (resource['id'] === id)\n return true;\n }\n return false;\n }",
"function pixelIDExist(id) {\n for (var i = 0; i < pixelIDMap.length; i++) {\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
task 1.3 update task by id (BODY CAN INCLUDE description & done) | function updateTaskById(id, { description, done }) {
const task = getTaskById(id);
if (done !== undefined) {
task.done = !!done;
}
if (description) {
task.description = description;
}
return task; //注:这里的思路与拆分前的有差异,这里是直接更改原task的属性,拆分前的版本是新建task再替换。
} | [
"update(_task) {\n const { id, task, date, process } = _task\n let sql = `UPDATE tasks\n SET task = ?,\n date = ?,\n process = ?\n WHERE id = ?`;\n return this.dao.run(sql, [task, date, process, id])\n }",
"function task_update_todoist(task_name, p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fills in the input box w/the first match (assumed to be the best match) q: the term entered sValue: the first matching result | function autoFill(q, sValue){
// autofill in the complete box w/the first match as long as the user hasn't entered in more data
// if the last user key pressed was backspace, don't autofill
if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
... | [
"searchOnChange(event) {\n const search = event.target.value.toLowerCase();\n\n const searchResults = names.filter( (val, index) => val.name.toLowerCase().startsWith(search) );\n const totalResults = searchResults.length;\n\n if (totalResults >= 1 && totalResults < names.length) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the routes for this addon. Routes are defined in `config/routes.js`. The file should export a function that defines routes. See the Routing guide for details on how to define routes. | loadRoutes() {
this._routes = this.loadConfigFile('routes') || function() {};
} | [
"function getRoutes(folderName, file) {\n fs.readdirSync(folderName).forEach(function(file) {\n\n var fullName = path.join(folderName, file);\n var stat = fs.lstatSync(fullName);\n\n if (stat.isDirectory()) {\n getRoutes(fullName);\n } else if (file.toLowerCase().indexOf('.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when component mounts, activate axiosCall | componentDidMount() {
this.axiosCall();
} | [
"componentDidMount() {\n this.callAPI();\n}",
"componentDidMount() {\n this.getUserApi();\n }",
"componentWillMount () {\n // we store the interceptors to remove them in componentWillUnmount\n this.reqInterceptors = axios.interceptors.request.use(req => {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: _fnScrollingWidthAdjust Purpose: Adjust a table's width to take account of scrolling Returns: Inputs: object:oSettings dataTables settings object node:n table node | function _fnScrollingWidthAdjust ( oSettings, n )
{
if ( oSettings.oScroll.sX === "" && oSettings.oScroll.sY !== "" )
{
/* When y-scrolling only, we want to remove the width of the scroll bar so the table
* + scroll bar will fit into the area avaialble.
*/
var iOrigWidth = $(n).width();
n.... | [
"updateWidth() {\n if (this.setupComplete) {\n let width = this.headerData.getWidth();\n this.width = '' + width;\n this.widthVal = width;\n $(`#rbro_el_table${this.id}`).css('width', (this.widthVal + 1) + 'px');\n }\n }",
"function i2uiShrinkScrollable... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resolve indirect symbol values to their final definitions. | indirectsym()
{
let changed;
do
{
changed = 0;
for (let sym = 0; sym < this.symbols.length; ++sym)
{
if (this.symbols[sym].value === null)
continue;
const cp = this.symbols[sym].value;
const [ ind ] = this.findsym(cp, 0);
if (ind === -1 || ind === sym ||
cp[0] != '\0' ||
... | [
"static async resolveNames(domain, types, value, resolveName) {\n // Make a copy to isolate it from the object passed in\n domain = Object.assign({}, domain);\n // Allow passing null to ignore value\n for (const key in domain) {\n if (domain[key] == null) {\n de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
move floats function starts here | function moveFloats() {
for (let index = 0; index < floatsArray.length; index++) {
const x = floatsArray[index].floatposition % width
if (floatsArray[index].direction === 'left') {
if (x > 0) {
floatsArray[index].floatposition = floatsArray[index].floatposition - 1 //* changes the val... | [
"function moveForward(){\n this.xLoc = this.xLoc + this.speed * ((Math.floor(Math.cos(this.direction*Math.PI/180)) + 0.5) * 2);\n this.yLoc = this.yLoc + this.speed * ((Math.floor(Math.sin(this.direction*Math.PI/180)) + 0.5) * 2);\n this.endX = this.xLoc + bugLength * Math.cos(this.direction*Math.PI/180);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Navigation shortcuts, such as Drawer, Folder, TabBar, must have child shortcuts. Use it as a fallback for navigation screen if shortcuts (children) are missing. | function ShortcutChildrenRequired(props) {
const { WrappedComponent, shortcut, isRootScreen } = props;
// Folder screen may not be root screen and if it has no children
// we present error as there is no content.
const fallbackScreen = isRootScreen ? <NoScreens /> : <NoContent title={shortcut.title} />;
ret... | [
"function listStaticShortcuts() {\n\n\tif (!appShortcuts) {\n\t\treturn alert('This device does not support Force Touch');\n\t}\n\n\tlog.args('Ti.UI.iOS.ApplicationShortcuts.listStaticShortcuts', appShortcuts.listStaticShortcuts());\n}",
"_keyboardShortcuts() {\n browser.commands.onCommand.addListener((com... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the training ended for this model | onTrainingEnded(event) {
if (event.context.modelName == this.props.modelName) {
this.setState({
training: false
})
this.loadRetrainedModel()
}
} | [
"onTrainingStarted(event) {\n\n if (event.context.modelName == this.props.modelName) {\n this.setState({\n training: true\n })\n }\n }",
"function workoutFinished(){\n\n }",
"gameEnd() {\n\t\tthis.gameDataList.push(this.curGameData);\n\t\tthis.curGameData =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disable the report date period | function disableReportDatePeriod(){
toggleErrorMessage("#account_created_period_error_text", true, "");
disableField("#selectRange1Value");
//Clear create account period
resetSelect("#selectRange1Value");
//Reset datePicker
enableField("#date-picker-start");
enableField("#date-picker-end");
} | [
"function disableReportDateRangeFields(){\n\ttoggleErrorMessage(\"#account_created_range_error_text\", true, \"\");\n\t\n\tenableField(\"#selectRange1Value\");\n\t\n\t//Reset datepicker\n\tresetDatePicker(\"#date-picker-start\");\n\tresetDatePicker(\"#date-picker-end\");\n\t\n\t//Disable datepicker\n\tdisableField(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a vertical Basic Buffer Geometry (BGB) in a form of a rectangle. The BGB is a made up of two lines (one on the left and the other on the right) of the input line. | function getverticalBGB(startCoordinate, endCoordinate){
let startE = start[0];
let startN = start[1];
let endE = end[0];
let endN = end[1];
let rightLine = [ [startE + BD, startN], [ endE + BD, endN] ];
let leftLine = [ [startE - BD, startN], [ endE - BD, endN] ];
return [topLine, bottomLine];
} | [
"function getHorizontalBGB(LNode, RNode){\n let LX = LNode[0]; //LX is for easting value or x value of the left node\n let LY= LNode[1]; //LY us for northing value or y value of the left node\n let RX = RNode[0]; //RX is for easting value or x value of the right node\n let RY =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FETCH (POST) TO PERSIST NEW OBSERVATION TO DATABASE addMarkerToDatabase function called in ShowNewObservationForm function sends a post request to backend to create new observation instance from newObservation object and persist it in the database | addMarkerToDatabase(newObservation, map) {
let configObj = {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
},
body: JSON.stringify(newObservation)
};
fetch(this.baseURL... | [
"postNewInterest(newInterestToSave) {\n // We want to return this fetch request so that at the point it is called, we can take advantage of the asynchronous nature of promises to wait for this to be done before getting the latest data and rerendering the DOM.\n return fetch(\"http://localhost:8088/interes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
new click action for randomizing saturation and lightness of the pixel pool | function buttonrandomcolorclick() {
function get_random_color() {
var h = rand(1, 360);
var s = rand(0, 100);
var l = rand(10, 90);
return 'hsl(' + h + ',' + s + '%,' + l + '%)';
}
for (var i = 0, max = px.$swatchpixels.length; i < max; i++) {
px.$swatchpixels[i].style.backgroundColor = get_random_color();... | [
"function mouseClicked() {\n var size = random(10, 40);\n drawMondrianblue(mouseX, mouseY, size);\n}",
"function setPixelColor(event) {\n if (event.type === 'click') {\n event.target.style.backgroundColor = 'red';\n } else if (mousingDown) {\n event.target.sty... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Safely install SIGINT listener. NOTE: this will only work on OSX and Linux. | function _safely_install_sigint_listener() {
const listeners = process.listeners(SIGINT);
const existingListeners = [];
for (let i = 0, length = listeners.length; i < length; i++) {
const lstnr = listeners[i];
/* istanbul ignore else */
if (lstnr.name === '_tmp$sigint_listener') {
existingListe... | [
"function setupTerminationHandlers(){\n // Process on exit and signals.\n process.on('exit', function() { terminator(); });\n\n // Removed 'SIGPIPE' from the list - bugz 852598.\n ['SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT',\n 'SIGBUS', 'SIGFPE', 'SIGUSR1', 'S... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the main header based on settings data in local store. | loadMainHeader() {
// Get site name and description from store
const siteName = model.getPostBySlug('site-name', 'settings'),
siteDescription = model.getPostBySlug('site-description', 'settings');
view.updateSiteName(siteName.content);
view.updateSiteDescription(siteDescription.conte... | [
"function setMainHeaders(kapitel, gruppe, klasse) {\r\n\tsetKapitel(kapitel);\r\n\tsetGruppe(gruppe);\r\n\tsetKlasse(klasse);\r\n}",
"initLoad(){\n //Load Main config file\n var sectionData = '';\n\n if(typeof(this.section) == 'object'){\n var ObjKeys = Object.keys(this.section);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
open a modal dialog for new flights | function addNewFlight() {
vm.newForm = 'n';
//var result = modalPopupFactory.openTemplate('md', { flightEdit: false, flight: {}, gates: vm.domain.gates, flights: vm.domain.flights }, ROOT + 'app/flight/flight.html', 'flight');
modalPopupFactory.openTemplate('md', { flightEdit: false,... | [
"function display_form(){\r\n $('#staticBackdrop').modal('show');\r\n}",
"function setupCreateNewPathwayButton() {\n var newItem;\n $(\"div[name='createNewPathway']\").click(function(){\n if ( newItem == undefined )\n newItem = \n\t\tcreateDialog(\"div.createPathway\", \n\t\t\t\t{positi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if two sets of coordinates are adjacent. | function isAdjacent(x1, y1, x2, y2) {
var dx = Math.abs(x1 - x2);
var dy = Math.abs(y1 - y2);
return (dx + dy === 1);
} | [
"function areAdjacent(squareOne, squareTwo) { \n if (squareOne.x < squareTwo.x + 2 &&\n squareOne.x > squareTwo.x - 2 &&\n squareOne.y < squareTwo.y + 2 &&\n squareOne.y > squareTwo.y - 2) {\n return true;\n } else {\n return false;\n }\n}",
"adjacent(xVertex, yVertex) {\n let adjacentExi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adding given job to the database | function addJobToDB(job){
return new Promise(function (resolve, reject) {
eRequest.patch({
headers: {'content-type': 'application/json'},
url: buildFirebaseURL(job.name),
body: job
}, function (error, response, body) {
res.s... | [
"function addJob(jobid, userid, status, desc)\n{\n globalJobList.push({ \"Ownerid\" : userid,\n \"SubmitAddr\" : \"-\",\n \"Desc\" : desc,\n \"Taskid\" : jobid,\n \"Status\" : status,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This middleware modifies the input on S3 CreateBucket requests. If the LocationConstraint has not been set, this middleware will set a LocationConstraint to match the configured region. The CreateBucketConfiguration will be removed entirely on requests to the useast1 region. | function locationConstraintMiddleware(options) {
var _this = this;
return function (next) { return function (args) { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(_this, void 0, void 0, function () {
var CreateBucketConfiguration, region;
return Object(tslib__WEBPACK_IMPORTED_MO... | [
"function createBucket(bucketName, _callback){\n\n storage\n .createBucket(bucketName, {\n location: 'us-central1',\n storageClass: 'Regional',\n })\n .then(results => {\n console.log(`Bucket ${bucketName} created`);\n _callback(bucketName);\n })\n\n .catch(err => {\n consol... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
called by animation scheduler if Waveform.widgets.dirty === true | drawWidgets() {
Waveform.widgets.dirty = false
const drawn = []
for( let key in Waveform.widgets ) {
if( key === 'dirty' || key === 'findByObj' ) continue
const widget = Waveform.widgets[ key ]
if( widget === undefined || widget === null ) continue
// ensure that a widget does n... | [
"dirty() {\n this.signal();\n }",
"_checkIfDirty(){\n if (this._isDirty === true){\n this._isDirty = false;\n this._refresh();\n }\n }",
"_updateDirtyDomComponents() {\n // An item is marked dirty when:\n // - the item is not yet rendered\n // - ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clamp the given date between min and max dates. | clampDate(date, min, max) {
if (min && this.compareDate(date, min) < 0) {
return min;
}
if (max && this.compareDate(date, max) > 0) {
return max;
}
return date;
} | [
"function setSliderMinMaxDates(range) {\n $scope.layoutEndTimeMS = range.max;\n $scope.layoutStartTimeMS = range.min;\n $scope.currentDate = range.min;\n $scope.layoutCurTimeMS = range.min;\n }",
"function clamp(xmin, xmax, x) {\n\treturn Math.min(xmax, Math.max(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Legacy support for HC < 6 to make 'scatter' series in a 3D chart route to the real 'scatter3d' series type. (8407) | function onAddSeries(e) {
if (this.is3d()) {
if (e.options.type === 'scatter') {
e.options.type = 'scatter3d';
}
}
} | [
"function onAfterInit() {\n var options = this.options;\n if (this.is3d()) {\n (options.series || []).forEach(function (s) {\n var type = (s.type ||\n options.chart.type ||\n options.chart.defaultSeriesType);\n if (type ===... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Discription: return an array of cases with random amounts enclosed in each. | static populateCases() {
let casesArray = [];
let amounts = [
0.01,
1,
5,
10,
25,
50,
75,
100,
200,
300,
400,
500,
750,
1000,
5000,
10000,
25000,
50000,
75000,
100000,
200000,
300... | [
"function generate_RandArray(max, min, no_bars=4){\n let lab_array = [];\n for (let i = 0; i<no_bars; i++){\n let rand_val = (Math.random()*(max-min))+min;\n lab_array.push(rand_val);\n }\n return lab_array;\n }",
"function create_du... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wavetable is a table of names for nonstandard waveforms. The table maps names to objects that have wave: and freq: properties. The wave: property is a PeriodicWave to use for the oscillator. The freq: property, if present, is a map from higher frequencies to more PeriodicWave objects; when a frequency higher than the g... | function makeWavetable(ac) {
return (function(wavedata) {
function makePeriodicWave(data) {
var n = data.real.length,
real = new Float32Array(n),
imag = new Float32Array(n),
j;
for (j = 0; j < n; ++j) {
real[j] = data.real[j];
imag[j] = data.imag[j];
... | [
"function SpectrumToWaves(notePowers){\n\n // This function takes in notePowers, which attributes to each note to a given 'power'. \n\n // For each octave these powers are normalize. \n var normedOctaves = []; \n // Looping through the octaves: \n for( let i = 0; i < notePowers.length; i++){\n var proms = n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pagingDir = +1: page to the rigth pagingDir = 1: page to the left | function nextPage(pagingDir: number) {
let totalPages = bagsize / pagesize
if (totalPages > (page + 1 * pagingDir) && 0 <= (page + 1 * pagingDir)) {
page = page + 1 * pagingDir;
}
} | [
"function initPaging() {\n vm.pageLinks = [\n {text: \"Prev\", val: vm.pageIndex - 1},\n {text: \"Next\", val: vm.pageIndex + 1}\n ];\n vm.prevPageLink = {text: \"Prev\", val: vm.pageIndex - 1};\n vm.nextPageLink = {text: \"Next\", val: vm.pageIndex + 1};\n }",
"turnPage(direc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup the grid pagingation navigation buttons | function setupPagingNavigationButtons(p_name, p_tpages, p_page) {
var l_next_obj = jQuery('#' + p_name + '_Pager_center').find('td[id="next_' + p_name + '_Pager"]');
var l_first_obj = jQuery('#' + p_name + '_Pager_center').find('td[id="first_' + p_name + '_Pager"]');
var l_last_obj =... | [
"function initPaging() {\n vm.pageLinks = [\n {text: \"Prev\", val: vm.pageIndex - 1},\n {text: \"Next\", val: vm.pageIndex + 1}\n ];\n vm.prevPageLink = {text: \"Prev\", val: vm.pageIndex - 1};\n vm.nextPageLink = {text: \"Next\", val: vm.pageIndex + 1};\n }",
"function refre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to print the formatted search results (includes number of results, full name and birthdate) | function printSearchResults (result) {
console.log(`Found ${result.rowCount} by the name ${searchName}`);
for (let i = 0; i < result.rowCount; i ++) {
console.log(`- ${i + 1}: ${result.rows[i].first_name} ${result.rows[i].last_name}, born ${returnDateStr(result.rows[i].birthdate)}`)
}
} | [
"function printSurnameIndex()\n{\n\tif (Dwr.search.Ndx >= 0)\n\t{\n\t\tvar html = '';\n\t\tif (N(Dwr.search.Ndx, 'persons').length == 0)\n\t\t{\n\t\t\thtml += '<p>' + _('No matching surname.') + '</p>';\n\t\t}\n\t\telse if (N(Dwr.search.Ndx, 'persons').length == 1)\n\t\t{\n\t\t\twindow.location.replace(indiHref(N(D... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
vbScript Year function: Year(date) | function Year(dt) {
if (isNull(dt)) { return null; }
var regex=new RegExp('-','g');
try {
dt=dt.replace(regex,'/'); //try/catch skips full date text of javascript
} catch(e) {}
var dat=new Date(dt);
return dat.getFullYear();
} | [
"function GetYearFromRawDateFunc(date) {\n var date = new Date(date);\n return date.getFullYear();\n }",
"function setYear() {\n\n // GET THE NEW YEAR VALUE\n var year = tDoc.calControl.year.value;\n\n // IF IT'S A FOUR-DIGIT YEAR THEN CHANGE THE CALENDAR\n if (isFourDigitYear(year))... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return NEW array with [Youngest Age, Oldest Age, Age difference btw Oldest & youngest] Pseudocode: // Step one, create a new array to put in numbers we've found var ageDiffArr = []; // Find Youngest age (using Math.min and spread operator) let youngest = Math.min(...ages); // and push into ageDiff / new array ageDiffAr... | function differenceInAges(ages) {
// Your code goes here
// Step one, create a new array to put in numbers we've found
var ageDiffArr = [];
// Find Youngest age (using Math.min and spread operator)
let youngest = Math.min(...ages);
// and push into ageDiff / new array
ageDiffArr.push(young... | [
"function findDiff(arr) {\n var max = Math.max(...arr)\n var min = Math.min(...arr)\n return max - min;\n }",
"function byAge(arr){\nreturn arr.sort((a, b) => a.age - b.age)\n}",
"function getDateForAccruedAges(expectedAge: number, ...participants: Participant[]): moment {\n checkExpected... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the candidate positions used for the elections simulation | function getCandidatePositions() {
return candidatePositions;
} // getCandidatePositions | [
"getPlayerPositions() {\n\t\treturn {\n\t\t\tplayer1: this.paddle1Y,\n\t\t\tplayer2: this.paddle2Y\n\t\t}\n\t}",
"function getCandidatePosition(anIndex) {\n return candidatePositions[anIndex];\n } // getCandidatePosition",
"function getNumCandidates() {\n return numCandidates;\n } // getNumCandida... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get template data. Transform from tableName, tableComment, columns, ddl, nameCase, groupCase | _data() {
return {
nameCases: this.nameCase,
groupCases: this.groupCase,
tableName: this.tableName,
tableComment: this.tableComment,
entityClass: _string.upperFirst(_string.camelCase(this.tableName)),
entityClassCamelCase: _string.camelCase(this.tableName),
...this._mapper(... | [
"visitCreate_table(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"_create_table_template(self, cont_id, height_px)\r\n\t{\r\n\t\tconsole.log(\"_create_table_template/\");\r\n\t\t\r\n\t\tvar tableCont = document.getElementById(cont_id);\r\n\r\n\t\tvar dchartTableDivEl = document.createElement(\"div\"); \r\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render the dispatch day count chart | function renderDayCountChart() {
//Day keys
days = [];
//Count values
counts = [];
//Split the day_counts into keys and values for the line chart
for (var day in day_counts) {
days.push(day);
counts.push(day_counts[day]);
}
var ctx = document.getElementById('dispatchDay... | [
"function drawCategoryChart() {\n\t\n\tvar entertainmentnum = 0\n\tvar productivitynum = 0\n\tvar othernum = 0\n\tvar shoppingnum = 0\n\tvar data\n\tif(!useDateRangeSwitch)\n\t\tdata = listSiteData(globsiteData)\n\telse \n\t\tdata = listSiteData(dateRangeData)\n\n\tfor (i=1; i<data.length; i++){\n\t\ttemp = String(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a simple object containing the tab head and body elements. | function TabDom(h, b) {
this.head = h;
this.body = b;
} | [
"get horseProfile_TabsHeader() {return browser.element(\"\");}",
"function WMEAutoUR_Create_TabbedUI() {\n\tWMEAutoUR_TabbedUI = {};\n\t/**\n\t *@since version 0.11.0\n\t */\n\tWMEAutoUR_TabbedUI.init = function() {\n // See if the div is already created //\n\t\tvar urParentDIV = null;\n\t\tif ($(\"#WME_Au... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serialize the val hash to query parameters and return it. Use the namePrefix to prefix all param names (for recursion) | function toQueryString(val, namePrefix) {
/*jshint eqnull:true */
var splitChar = Backbone.Router.arrayValueSplit;
function encodeSplit(val) { return String(val).replace(splitChar, encodeURIComponent(splitChar)); }
if (!val) {
return '';
}
namePrefix = nameP... | [
"function uriSerialize(obj, prefix) {\n\t\tvar str = [];\n\t\tfor(var p in obj) {\n\t\t\tvar k = prefix ? prefix + \"[\" + p + \"]\" : p, v = obj[p];\n\t\t\tstr.push(typeof v == \"object\" ?\n\t\t\t\turiSerialize(v, k) :\n\t \t\tencodeURIComponent(k) + \"=\" + encodeURIComponent(v));\n\t\t}\n\t\treturn str.joi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the sum of the array of string integers numList. | function sumStringInts(numList) {
return numList.reduce(function(m, n) { return parseInt(m) + parseInt(n); });
} | [
"function sumOfSums(inputArray) {\n let listOfNums = inputArray;\n let outputArray = [];\n let arrayOfNums = String(listOfNums).split(',');\n \n // iterate through arrayOfNums and accumulatively add the current number to the previous number\n for (let index = 1; index <= arrayOfNums.length; index += 1) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
39.Write a function called pickBy which accepts an object and a callback function. The function should return a new object consisting of keys and values where the value returns something truthy when passed into the callback. | function pickBy(obj, cb){
let result = {};
for (let key in obj){
if(cb(obj[key])) result[key]=obj[key];
}
return result;
} | [
"function objFilter(obj, callback) {\n const newObj = {};\n for (const key in obj) {\n if (callback(key) === obj[key]) {\n newObj[key] = obj[key];\n }\n }\n return newObj;\n}",
"function keyBy(arr, fn){\n var result = {};\n arr.forEach(function(v){\n result[fn(v)] = v;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the text direction of the document ('ltr', 'rtl', or 'auto'). | function setTextDirection(direction) {
document.body.setAttribute('dir', direction);
} | [
"get textDirection() {\n return this.viewState.defaultTextDirection\n }",
"_isRtl() {\n return this._dir && this._dir.value === 'rtl';\n }",
"function setDirection(){\n // set arrow\n let direction = document.getElementById('windDegrees');\n\n // may not have degree data, so reset every... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
runAngularTrigger function that gets around scope issues with chrome extensions. adds the script that needs to be run to trigger an angular trigger on the page. then removes the code. | function runAngularTrigger(css, trigger) {
var code = "angular.element('" + css + "').triggerHandler('" + trigger + "');";
createTag(find('body'), 'script', 'angular', '', code).nodeType='text/javascript';
remove('#angular');
} | [
"function trigger() {\n $el.data(\"pat-inject-autoloaded\", true);\n inject.onTrigger.apply($el[0], []);\n return true;\n }",
"function onWindowLoad(e){\r\n\tvar appcontent = window.document.getElementById(\"appcontent\"); // browser only\r\n\tif(appconten... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove label collector function on axis remove/update. | function onAxisDestroy() {
if (this.chart &&
this.chart.labelCollectors) {
var index = (this.labelCollector ?
this.chart.labelCollectors.indexOf(this.labelCollector) :
-1);
if (index >= 0) {
this.chart.labelCollectors.splice(ind... | [
"function hoverOutState(){\n\td3.select(\".infolabel\").remove(); //remove info label\n}",
"function hideLabel() { \n marker.set(\"labelVisible\", false); \n }",
"function clearScatterPlot(){\r\n svg.selectAll(\".axis\").remove();\r\n svg.selectAll('.dot').remove();\r\n svg.select... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Capture video stream of tab, will pass stream back to sendResponse() | function captureTabVideo(senderTab) {
console.log("captureTabVideo");
// Sanity check, can only record one at a time
if (videoConnection)
{
console.log('ERROR: video stream already exists, cannot capture two at a time!');
}
var settings, width, height;
settings = {};
// Ge... | [
"function Capture() {\n setInterval(function () {\n webcam.capture(function () {\n var frame = webcam.frameRaw();\n io.emit('streamCam', \"data:image/png;base64,\" + Buffer(frame).toString('base64'));\n });\n }, 200);\n }",
"function stopVideoCa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Middleware for decoding a token. | function getDecodedToken(req, res, next) {
req.decodedToken = verifyJwt(req, next);
return next();
} | [
"function authMiddleware(next){\n return function(msg, replier){\n var params = JSON.parse(msg);\n tokenAuthentication(params.token, function(valid){\n if (!valid) {\n return replier(JSON.stringify({ok: false, error: \"invalid_auth\"}));\n } else {\n next(msg, replier);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset position, direction, speed, and new random rotation start point | reset(){
this.x=1280 + (Math.floor(Math.random()*10)+1)*75;//Start off screen and a multiple of 75 pixels apart, to give different start points
this.y=60 + (Math.floor(Math.random()*10)*44);//Space out in 44 pixel intervals (I can't remember what fraction of the screen height this is)
this.direction=Math.floor(Ma... | [
"resetPosition(){\n this.speed = 0;\n this.deltaT = 0;\n this.rotation = 0;\n this.position[0] = this.startingPos[0];\n this.position[1] = this.startingPos[1];\n this.position[2] = this.startingPos[2];\n }",
"reset(){\n this.setSpeed();\n this.setStartPos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
e.g. , , vfor, or when the children is provided by user with handwritten render functions / JSX. In such cases a full normalization is needed to cater to all possible types of children values. | function normalizeChildren(children){return isPrimitive(children)?[createTextVNode(children)]:Array.isArray(children)?normalizeArrayChildren(children):undefined;} | [
"render() {\n return Children.only(this.props.children);\n }",
"function mountChildren(children, parentDOM, parentElement) {\n if (children && typeof children.map === 'function') {\n children.map(function (child) {\n if (child && child.props) {\n child.props.parent = getDetailsForChild(parentE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hideNoTaskHeader method looks for pending task count and hide/shows header based on that | function hideNoTaskHeader(){
if(!pendingTaskCount){
$('.pending-task-view .task-left').removeClass('hide');
} else{
$('.pending-task-view .task-left').addClass('hide');
}
} | [
"function checkIfnoTasks(){\n let noListItemsMessage = document.getElementById(\"no-tasks-msg\");\n noListItemsMessage.style.display = (tasks === 0) ? \"block\" : \"none\";\n}",
"function tasksZero() {\n let noTasksMsg = document.createElement('span');\n noTasksMsg.className = \"no-tasks-m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set navigation dots to an active state as the user scrolls | function redrawDotNav() {
var scrollPosition = $(document).scrollTop();
$('nav#primary a').removeClass('active');
$('#main-nav li').removeClass('current_page_item');
if (scrollPosition < (section2Top - menuBarHeight)) {
$('nav#primary... | [
"function activateNavDots(name,sectionIndex){if(options.navigation&&$(SECTION_NAV_SEL)[0]!=null){removeClass($(ACTIVE_SEL,$(SECTION_NAV_SEL)[0]),ACTIVE);if(name){addClass($('a[href=\"#'+name+'\"]',$(SECTION_NAV_SEL)[0]),ACTIVE);}else{addClass($('a',$('li',$(SECTION_NAV_SEL)[0])[sectionIndex]),ACTIVE);}}}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
I delete the given movie, owned by the given user. Returns a Promise. | deleteMovie( userId, id ) {
var promise = new Promise(
( resolve, reject ) => {
var movies = this._paramMovies( userId );
var matchingIndex = movies.findIndex(
( item ) => {
return( item.id === id );
}
);
if ( matchingIndex === -1 ) {
throw( new Error( "Not Found" ) );
... | [
"function deleteActor (actor) {\n console.log('deleteActor()')\n return new Promise((resolve, reject) => {\n actorDB.get(actor.identifier, (ko, ok) => {\n if (ko) {\n log(ko)\n reject(ko.reason)\n } else {\n actorDB.destroy(actor.identi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
board string change to board Array, next replace old elemenet a newNumber by splice and change array to string by join('' witout commas) | hadleTileChange(id, newNumber) {
let boardArray = (this.state.board).split('');
boardArray.splice(id, 1, newNumber);
boardArray = boardArray.join('');
this.setState({
board: boardArray
});
} | [
"removePieceAt(row, col){\n //if arg0 is a string, then parse algebraic to indeces\n if(typeof row === 'string'){\n [row,col] = this.algerbraicToIndeces(row);\n }\n // else if it is not a string or number, then it is an array of nums\n else if(typeof row !== 'number'){\n [row,col] = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
I toggle the testing state for the given commit in production. | function toggleTestingInProduction( commit ) {
var nextTesting = _.cycle( [ "inactive", "active" ], commit.production.testing );
var nextStatus = commit.production.status;
// If the testing got reset, move the status back to a pending state.
if ( nextTesting === "inactive" ) {
nextStatus = "pending";
}... | [
"function toggleStatusInProduction( commit ) {\n\n\t\tvar nextTesting = \"active\";\n\t\tvar nextStatus = _.cycle( [ \"pending\", \"pass\", \"fail\" ], commit.production.status );\n\n\t\tdeploymentService\n\t\t\t.updateCommitInProduction( deploymentID, commit.hash, nextTesting, nextStatus )\n\t\t\t.then(\n\t\t\t\tf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
prend une liste d'ID HTML id_contenus et les rens invisibles sur la page puis rend visible l'ID id_contenu_a_afficher (s'il existe) | function masque_affiche_contenus(id_contenus, id_contenu_a_afficher) {
console.debug(
`CALL masque_affiche_contenus([${id_contenus}],${id_contenu_a_afficher})`
);
id_contenus.map(function(idc) {
document.getElementById(idc).style.display = "none";
});
if (id_contenu_a_afficher !== undefined)
docum... | [
"function afficherDetailRecette(id) {\n for(i = 0; i < listeRecettes.length; i++) {\n if(id == (listeRecettes[i].id)) {\n document.getElementById(\"bodyRecette\").innerHTML = \"<div class=\\\"divConnexion\\\"><div class=\\\"carteRecette\\\"><div class=\\\"boiteDeroulante\\\"><div class=\\\"head... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
1 create folders 2 create package.json 3 create config 4 create logger 5 create server 6 create models 7 create routes 8 create app | function generate(opts){
let models = opts.models;
let appName = opts.appname;
let routes = opts.models.map(model => model.name);
console.log("Starting to Create CRUD API Boilerplate...");
console.log("Creating Server Folders...");
fileCreator.createServerTree(appName);
console.log("Crea... | [
"async function startExpressApp() {\n const express = require(\"express\");\n const app = express();\n const path = require('path');\n\n const { landingPageCors } = require('@/middlewares/cors');\n app.use(landingPageCors);\n \n const bodyParser = require(\"body-parser\");\n app.use(bodyParser.json());\n \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
$http DELETE function, id = TodoListEntryId | function deleteToDos(id) {
var defer = $q.defer();
$http({
method: 'DELETE',
url: 'http://localhost:50341/api/ToDoListEntries/' + id
}).then(function(response) {
if (typeof response.data === 'object') {
def... | [
"deleteById(id) {\n return this.del(this.getBaseUrl() + '/' + id);\n }",
"function deleteTodo(id) {\n //action\n return {\n type: \"DELETE_TODO\",\n id\n };\n}",
"deleteTodo() {\n\t let todo = this.get('todo');\n\t this.sendAction('deleteTodo', todo);\n\t }",
"function deleteTask... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes index of a section Calculates the starting and ending point of its arc Returns a random point between them | function getPoint(index) {
let min = (wheel.numOfSections - index - 1) * wheel.arc + 0.005;
let max = (wheel.numOfSections - index) * wheel.arc - 0.005;
return random(min, max);
} | [
"function getNextAttractor() {\n let lastpoint = this.getLastAttractor();\n let endpoint = getRandomEndpoint.apply(this);\n let midpoint = getMidpoint(lastpoint, endpoint);\n\n this.addAttractor(midpoint);\n\n return midpoint;\n}",
"function generateArcPoints(length, elevation, sx, sy, hdg, curvature, latera... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
That function is executed when the conference is joined | function onConferenceJoined() {
console.log('conference joined!');
isJoined = true;
for (let i = 0; i < localTracks.length; i++) {
room.addTrack(localTracks[i]);
}
} | [
"function onConferenceJoined() {\n //console.log('INFO (audience.js): Conference joined in silence!');\n $('#mainBtn').attr('disabled', false);\n /*room.sendTextMessage(details.nickName+\" joined the room..\");*/\n $.toast({\n text: 'You have joined the room as an audience.',\n icon: 'succ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the local items | getLocalItems(cb = null) {
const items = _localItems.get(this)
if (items && cb) {
cb(items)
}
return items
} | [
"function getAllItems(){\n\n}",
"loadAvailableItems() {\n // Load the available items and parses the data\n var tempList = lf.getAvailableItems();\n tempList.then((value) => {\n // Get the items, their ids, and data\n var items = value.items;\n var ids = value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds all the observable accessors defined on the target, including its prototype chain. | getAccessors(target) {
let accessors = accessorLookup.get(target);
if (accessors === void 0) {
let currentTarget = Reflect.getPrototypeOf(target);
while (accessors === void 0 && currentTarget !== null) {
accessors = accessorLookup.get(currentTarget);
... | [
"function getAllRelationsForTargetInternal(target) {\n if (!target) {\n throw TypeError;\n }\n let targerKey = typeof target === 'function' ? target.prototype : target;\n if (_relationsCache[targerKey.constructor.name]) {\n return _relationsCache[targerKey.constructor.name];\n }\n //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
after pushing the start new game button in settings, the function change to game screen and start game. | function startNewGame(){
toggleNewGameSettings();
newGame();
} | [
"function setStartScreen() {\n score = 0;\n showScreen('start-screen');\n document.getElementById('start-btns').addEventListener('click', function (event) {\n if (!event.target.className.includes('btn')) return; //makes sure event is only fired if a button is clicked\n let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The name of the currency for the main country using this locale (e.g. USD for the locale enUS). The name will be `null` if the main country cannot be determined. | function getLocaleCurrencyName(locale) {
var data = findLocaleData(locale);
return data[16 /* CurrencyName */] || null;
} | [
"static getCurrencyName(code) {\n let currencyName = this.getPhrase(code, \"CurrencyCode\");\n if (currencyName != \"\" && currencyName.length > 0)\n return currencyName;\n else\n return code;\n }",
"function get_currency_name(str) {\n return str.replace(` (${get_c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw a sprite image with the "name". Scale the img proportionally to fit the width | function drawSprite(spriteName, x, y, width) {
var spriteLoc = spriteLocMap[spriteName];
var scale = width / spriteLoc.width;
ctx.drawImage(spriteImg,
spriteLoc.pixelsLeft,
spriteLoc.pixelsTop,
spriteLoc.width,
sprite... | [
"drawSkier() {\n var skierAssetName = this.getSkierAsset();\n var skierImage = vars.loadedAssets[skierAssetName];\n var x = (vars.gameWidth - skierImage.width) / 2;\n var y = (vars.gameHeight - skierImage.height) / 2;\n ctx.drawImage(skierImage, x, y, skierImage.width, skierImage.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loadAvailableItems Loads the known item names and their corresponding ids from the database. | loadAvailableItems() {
// Load the available items and parses the data
var tempList = lf.getAvailableItems();
tempList.then((value) => {
// Get the items, their ids, and data
var items = value.items;
var ids = value.ids;
var genNames = value.genNam... | [
"function loadShuffledItems() {\n\tloadItemLabels();\n \tshuffledItems = shuffle(itemLabels);\n}",
"handleLoaded(itemName) {\n this.toLoad = this.toLoad.filter(item => item !== itemName);\n\n if (this.toLoad.length === 0) {\n this.callbacks.onLoaded();\n }\n }",
"function ENSURE_ACTIVE_ITEMS(_re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get count of gender in a dict | function getCount(list, gender) {
var count = 0; // Var to store gender count
if (list) { // If list exists, loop through entries
for (var i=0; i<list.length-1; i++) {
if (list[i]['gender'] === gender) { cou... | [
"function getCount(list, gender) {\n let count = 0; // let to store gender count\n if (list) { // If list exists, loop through entries\n for (let i=0; i<list.length-1; i++) {\n if (list[i]['gender'] === gend... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns POTENTIAL_MATCHES short strings, using the input characters a lot. | function regexShortStringsWith(frequentChars) {
var matches = [];
for (var i = 0; i < POTENTIAL_MATCHES; ++i) {
var s = "";
while (rnd(3)) {
s += rnd(4) ? Random.index(frequentChars) : String.fromCharCode(regexCharCode());
}
matches.push(s);
}
return matches;
} | [
"function solve(s) {\n\tlet result = \"\";\n\tlet regex = /[aeiou]/;\n\tlet consonants = s\n\t\t.split(\"\")\n\t\t.filter(char => {\n\t\t\treturn !regex.test(char);\n\t\t})\n\t\t.sort((a, b) => {\n\t\t\treturn a.charCodeAt(0) - b.charCodeAt(0);\n\t\t});\n\tlet vowels = s\n\t\t.split(\"\")\n\t\t.filter(char => {\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a path from a variable length list of curve primtiives | static create(...curves) {
const result = new Path();
for (const curve of curves) {
result.children.push(curve);
}
return result;
} | [
"function Path(spec, colorfunction) {\n\tvar points = spec.split(',')\n\tthis.colorfunction = colorfunction\n\tthis.path = new Array(points.length)\n\tthis.path[0] = this.translate(points[0])\n\tthis.start = this.end = null\n\t\n\tfor(var i = 1; i < points.length; i++) {\n\t\tthis.path[i] = this.step(points[i], thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
code starts from here / "fetchData" function to fetch price updates Retrieved data is stored in "rawData" | function fetchData() {
client.subscribe("/fx/prices", function (data) { //subscribing for updates
rawData.push(JSON.parse(data.body)); //storing retrived data
});
} | [
"async price_update() {}",
"async fetchCoinPrice() {\n await fetch(\"https://api.coingecko.com/api/v3/simple/price?ids=\" + this.getCoinID() + \"&vs_currencies=usd\")\n .then((response) => response.json())\n .then((json) => {\n this.coinPrice = json[this.getCoinID()][\"usd\"];\n })\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the selected currency to the matching string and switches the widget to match. | function setSelectedCurrency(currency) {
selectedCurrency = currency;
var currencyOpt = document.getElementById(currency);
if (currencyOpt) {
currencyOpt.selected = "selected";
}
} | [
"function setCurrencyList(currency, defval) {\r\n var obj = {}\r\n for (var key in currency) {\r\n obj[currency[key]] = null\r\n }\r\n $('#ddcurrlist').material_chip({\r\n placeholder: \"Enter Currency Pair\",\r\n data: defval,\r\n autocompleteLimit: 5,\r\n autocompleteOptions: {\r\n data: o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Produce an array of twoelement arrays [x,y] for each segment of values. | function segments(values) {
var segments = [], i = 0, n = values.length
while (++i < n) segments.push([[i - 1, values[i - 1]], [i, values[i]]]);
return segments;
} | [
"function flattenPoints(input) {\n let res = new Array(input.length * 2);\n for (let i = 0; i < input.length; i++) {\n res[i * 2] = input[i].x;\n res[i * 2 + 1] = input[i].y;\n }\n return res;\n}",
"function splitIntoSegments(pathCoordinates, valueData) {\n\t var segments = [];\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves the proxy rules into the DB | function saveproxyRule() {
var rules = {};
var co = 0;
$("#proxy_rules_list .proxy_rule_boxes").each(function() {
var url = stripHTMLTags($(this).find('.url').text());
var proxy_type = stripHTMLTags($(this).find('.proxy_type').prop("selectedIndex"));
var proxy_location = stripHTMLTags($(this).find('.proxy_loc... | [
"async function setRules(){\n const data = {\n add: rules\n }\n const response = await needle('post', rulesURL, data, {\n headers:{\n 'content-type': 'application/json',\n Authorization: `Bearer ${process.env.TWITTER_BEARER_TOKEN}`\n }\n });\n return respons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GETDISTRACTORS: gives three distractors for the perceptual fluency task | function getDistractors() {
var match = true;
if (onPFtaskA) {
for (var i=0; i<3; i++) {
while (match) {
distractors[i] = pfTaskAtargets[Math.floor(Math.random()*16)];
match = false;
if (distractors[i]==pfTaskAtargets[ind]) {
match = true;
} else {
... | [
"function makePerceptualFluencyTrials() {\n\n var pfA = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,\n 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,\n 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];\n var pfB = pfA;\n pfA = shuffleArray(pfA);\n pfB = shuffleArray(pfB);\n var r = Math.floor(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hide District and Assembly Constituency for certain Initiative values BAD LOGIC | function handleDistrictAndAssembly(country, initiative, $form) {
var pattern1 = new RegExp("voter", "i");
var pattern2 = new RegExp("election", "i");
if (country != 'India') {
$($form).find(".district_dropdown_div").css("visibility", "hidden").end()
.find(".district_dropdown").removeClass("required-fiel... | [
"function disableConfidence( id ) {\n $(id).find(\"select.confidence\").each( function(i) {\n if(i != 0) { $(this).addClass(\"vis-hide\") }; \n });\n}",
"function hide_important_elements(){\n\tdocument.getElementById('segment_middle_part').style.display\t= \"none\";\n\tdocument.getElementById('groupe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name : matchDualFieldValue Return type : boolean Input Parameter(s) : elementId Purpose : To validate the dual/replica form fields of biller and personal information section against the regular expressions sent by API. History Header : Version Date Developer Name Added By : 1.0 30th July, 2013 Pradeep Yadav | function matchDualFieldValue(elementId) {
var dualFieldId = 'replicaof' + elementId;
var mainFieldValue = $('#element' + elementId).val().trim();
var replicaFieldValue = $('#' + dualFieldId).val().trim();
/* Checkng if the replica field have the value in it */
if (replicaFieldValue) {
/* Removi... | [
"function validateDualField(elementId) {\n var dualFieldId = 'replicaof' + elementId;\n var replicaFieldValue = $('#' + dualFieldId).val().trim();\n /* Checkng if the replica field have the value in it */\n if (replicaFieldValue) {\n /* Checking if the dual field matched with original field */\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clear the localStorage and set as blank array | clearDataFromLocalStorage() {
localStorage.db = [];
} | [
"vaciarLocalStorage() {\n localStorage.clear();\n }",
"function clearLeaderboard() {\n leaderboardArr = [];\n localStorage.clear();\n displayLeaderboard();\n}",
"function clear(){\n localStorage.clear();\n highScores=[];\n highScoreParent.innerHTML=\"\";\n }",
"function clear() {\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get fan in Harbor Breeze Hub from remote id. | function getFanByRemoteId(remoteId) {
if (!(remoteId in router.hbhub.fans)) {
return null;
}
return router.hbhub.fans[remoteId];
} | [
"getById(id) {\n return HubSite(this, `GetById?hubSiteId='${id}'`);\n }",
"static get(id){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\treturn new kaltura.RequestBuilder('livechannel', 'get', kparams);\n\t}",
"function getBeerById(req, res) {\n brewerydbModel\n .getBeerById(req.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Event handlers for adding a library in settings. | function addLibraryClicks () {
var addButton = document.getElementById('add');
var libraryName = document.getElementById('name-input');
var libraryPath = document.getElementById('library-path-input');
addButton.addEventListener('click', function () {
var data = JSON.stringify({
name: libraryName.value... | [
"createLibrary(event) {\n const controller = event.data.controller;\n InputDialog.type = 'createLibrary';\n const dialog = new InputDialog((input) => {\n if (null == controller.createLibrary(input)) {\n InfoDialog.showDialog('A library' +\n ' with th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IMGUI_API void SetWindowFontScale(float scale); // perwindow font scale. Adjust IO.FontGlobalScale if you want to scale all windows | function SetWindowFontScale(scale) { bind.SetWindowFontScale(scale); } | [
"useFontScaling(scale) {\n this.element.value = this.fontSizeScale.indexOf(scale);\n document.documentElement.style.fontSize = scale * this.baseSize + 'px';\n this.update(this.element.value);\n }",
"function _changeTextScale ( values, handle ) {\n\t\tchangeScale.call( this, values, handle );\n\t}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
To display the correct background colour for the recommendation pop up by media type | function selectBackgroundColor() {
if (props.mediaType == "Article") {
return styles.articleBackgroundColor
}
else if (props.mediaType == "Book") {
return styles.bookBackgroundColor
}
else if (props.mediaType == "Movie") {
return styles.movieBackgroundColor
}
else if ... | [
"function selectColor() {\n if (props.mediaType == \"Article\") {\n return styles.articleColor\n }\n else if (props.mediaType == \"Book\") {\n return styles.bookColor\n }\n else if (props.mediaType == \"Movie\") {\n return styles.movieColor\n }\n else if (props.mediaType ==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the datetime value of the specified Property from a [[Thing]]. If the Property is not present or its value is not of type datetime, returns null. If the Property has multiple datetime values, returns one of its values. | function getDatetime(thing, property) {
internal_throwIfNotThing(thing);
const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.dateTime);
if (literalString === null) {
return null;
}
return deserializeDatetime(literalString);
} | [
"function parsePropertyValue (node) {\n var $node = $(node);\n\n if ($node.is('meta')) {\n return resolveAttribute($node, 'content');\n } else if ($node.is('audio,embed,iframe,img,source,track,video')) {\n return resolveUrlAttribute($node, 'src');\n } else if ($node.is('a,area,link')) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method responsible for displaying the correct translation of the 'Welcome Message' section based on the language | renderWelcomeMessage(language) {
switch(language) {
case 'en':
this.setState({welcomeMessage: 'Welcome message from STORMRIDER'});
break;
case 'is':
this.setState({welcomeMessage: 'Bulbulbul asfgwthyt sadasd STORMRIDER'});
b... | [
"showWelcomeMessage(welcomeMessageMode) {\n Instabug.showWelcomeMessageWithMode(welcomeMessageMode);\n }",
"function helloWorld(language) {\r\n if (language === 'fr') {\r\n return 'Bonjour tout le monde';\r\n }\r\n else if (language === 'es') {\r\n return 'Hola, Mundo';\r\n }\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checking molecule intersection assigning gap as distance minus radius assigning check to gap less than or equal to 0 and if its true or false | isIntersecting(_molecule) {
//creates new vector without affecting the other vectors weve created
let resultantV = p5.Vector.sub(this.position, _molecule.position);
//distance is length of resultant
let distance = resultantV.mag();
let gap = distance - this.radius - _molecule.radius;
let check =... | [
"function checkSurroundingArea(icosphere, centerTile, radius) {\n\tvar queue = new Queue();\n\tvar visited = [];\n\tfor (var size = icosphere.tiles.length-1; size >= 0; size--) visited[size] = false;\n\tvar land = [];\n\tfor (var size = icosphere.tiles.length-1; size >= 0; size--) land[size] = false;\n\tvar distanc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end placeDetail function Calls placeSearch API with lat & lng & return place id used for placeDetail | function placeSearch(lat, lng) {
var query = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + lat + "," + lng + "&radius=50000&type=park&keyword=kyak&key=AIzaSyDAhGg64lKOYPK-6jEMFKqQlc2TSTHTI2M";
$.ajax({
url: query,
method: "GET"
}).done(function(response) {
console.log(res... | [
"function searchPlace(){\n var search = new google.maps.places.PlacesService(map);\n var request = {\n keyword: [searchType],\n location: map.getCenter(),\n rankBy: google.maps.places.RankBy.DISTANCE\n }\n search.nearbySearch(request, function(data, status){\n if(status == google.maps.places.PlacesS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts objArray of emotion data into CSV format Input: times = obj array of times, integers emotions = obj array of obj arrays of emotion data, floats ie: [[10.2,11.2,12.2],[10.2,11.2,12.2],[10.2,11.2,12.2]] Output: Str object, CSV format | function convertToCSV(times, emotions, key) {
//log('#logs', "dataArr:"+ itemsFormatted);
var array = typeof emotions != 'object' ? JSON.parse(emotions) : emotions;
var str = '';
//NOTE: Fix: NOT COLLECTING ENGAGEMENT
for (var i = 0; i < emotions.length; i++) {
var line = '';
for (index in... | [
"formatMotionData(obj){\n var orientationX = {label:'orientationX',values:[]},\n orientationY = {label:'orientationY',values:[]},\n orientationZ = {label:'orientationZ',values:[]},\n accelerationX = {label:'accelerationX',values:[]},\n accelerationY = {label:'accelerationY',values:[]}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks whether the user's pointer is close to the edges of either the viewport or the drop list and starts the autoscroll sequence. | _startScrollingIfNecessary(pointerX, pointerY) {
if (this.autoScrollDisabled) {
return;
}
let scrollNode;
let verticalScrollDirection = 0 /* AutoScrollVerticalDirection.NONE */;
let horizontalScrollDirection = 0 /* AutoScrollHorizontalDirection.NONE */;
// Che... | [
"startAutoScroll() {\n this.selectNextSibling();\n this.setAutoScroll();\n }",
"scrollToMousePos() {\n let [xMouse, yMouse] = global.get_pointer();\n\n if (xMouse != this.xMouse || yMouse != this.yMouse) {\n this.xMouse = xMouse;\n this.yMouse = yMouse;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test : var a = [ [ 0, 2 ], [ 4, 2 ] ]; var b = [ [ 1, 0 ], [ 5, 0 ] ]; console.log(lineLineIntersection(...a, ...b)); var a = [ [ 0, 2 ], [ 4, 2 ] ]; var b = [ [ 1, 0 ], [ 5, 4 ] ]; console.log(lineLineIntersection(...a, ...b)); var a1 = [ 0, 2 ]; var a2 = [ 4, 2 ]; var b1 = [ 1, 0 ]; var b2 = [ 5, 4 ]; console.log(lin... | function segmentSegmentIntersection( [ x1, y1 ], [ x2, y2 ], [ x3, y3 ], [ x4, y4 ] ) {
return lineLineIntersection( [ x1, y1 ], [ x2, y2 ], [ x3, y3 ], [ x4, y4 ], true, true);
} | [
"function segmentIntersection(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2) {\n var d = (ax2 - ax1) * (by2 - by1) - (ay2 - ay1) * (bx2 - bx1);\n if (d === 0) {\n // The lines are parallel.\n return null;\n }\n var ua = ((bx2 - bx1) * (ay1 - by1) - (ax1 - bx1) * (by2 - by1)) / d;\n var ub = ((... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to sort two array by their sort field, which is an array of comparable things (numbers or strings) starting with the most signficant. | function arraySorter(a, b) {
var retval = _.chain(_.zip(a.sort, b.sort)).map(function (x) {
var aval = x[0];
var bval = x[1];
if (aval === null || bval === null) {
return 0;
} else if (typeof(aval) === "number") {
return aval - bval;
} else {
... | [
"function sortStock(a, b) {\n if (parseInt(a[0]) > parseInt(b[0])) return 1;\n else return -1;\n}",
"function sortArrays(x, y)\n{\n\tfor (let xInd = 0; xInd < x.length; xInd++)\n\t{\n\t\tif (x[xInd] > y[0])\tswap(x, xInd, y)\n\t\ty.sort((left, right) => {\n\t\t\tif (left < right) return -1\n\t\t\telse if (l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
keycode_to_midinote() it turns a keycode to a MIDI note based on this reference layout: 1 2 3 4 5 6 7 8 9 0 = Q W E R T Y U I O P [ ] A S D F G H J K L ; ' \ Z X C V B N M , . | function keycode_to_midinote(keycode) {
// get row/col vals from the keymap
var key = synth.keymap[keycode];
if ( isNil(key) ) {
// return false if there is no note assigned to this key
return false;
} else {
var [row, col] = key;
return (row * synth.isomorphicMapping.vertical) + (col * synth.i... | [
"function keyToNote(key)\n{\n var l = key.length-1;\n var rawKey = key.substr(0, l);\n var octave = parseInt(key[l]);\n return (octave*12)+keyNoteMap[rawKey];\n}",
"function playNote(keycode) {\n //dont trigger if key is already pressed\n if (!keysPressed.includes(keycode)) {\n //push keycode to ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggles the visibility of all layers of a certain type by changing their opacity to either 1.0 or 0.0. This way, here will not be any interference with a possibly available layer selection. | toggleLayersByType(layerType) {
//Iterate over all tile layers
this.allLayers
//Filter for layers of the given type
.filter(layer => layer instanceof layerType)
.forEach(layer => {
//Invert opacity
... | [
"function togglePreviewLayers(display) {\n // Preserve inline formatting of opacity sliders & output labels in LayerDiv\n var display_inline = (display == 'block') ? 'inline' : 'none';\n var layerDiv = getElement('LayerDiv');\n var layers = layerDiv.getElementsByTagName('label');\n var sliders = layerDiv.getEl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An upload progress event. | function HttpUploadProgressEvent() { } | [
"function onProgress(e) {\n if (video.buffered.length > 0)\n {\n var end = video.buffered.end(0),\n start = video.buffered.start(0);\n load_bar.setAttribute(\"width\", Math.ceil((end - start) / video.duration * 100).toString());\n }\n}",
"function notifyUploadDone(numberOfFiles, error) {\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returnable account is a POJO that is returned to interacting applications. For instance, in EOSIO blockchains a name is required, however in Ethereum blockchains only a publicKey/address is required. | returnableAccount(account){} | [
"function Account(props) {\n return __assign({ Type: 'AWS::ApiGateway::Account' }, props);\n }",
"getAccount(actor) {\n const getAccount = new queries.GetAccount(actor);\n return getAccount.execute(this.publicKey);\n }",
"async currentAccount() {\n const accounts = await th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
funcion para ocultar los datos de un dia y volver a mostrar la tabla donde se encuentra la semana | function mostrarOcultar()
{
var dia=document.getElementById("dia");
var semana=document.getElementById("semana");
// ocultamos el div donde se encuentran los datos del dia
dia.className="oculta";
// dejamos el div vacio
dia.innerHTML="";
// volvemos a asignar estilos a la tabla donde se encuentran lo... | [
"function llenar_tabla_vistas_observaciones() {\n $(\"#modal_vista_observaciones\").show()\n $(\"#tabla_vistas_observaciones tr\").remove()\n\n var cuestionario, pregunta, indice_cues, indice_preg = 1;\n $.each(datos_mostrar, function (index, item) {\n //*********aqui se va a ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DSGVO stuff / Cookie optout wrapper for $.cookie function Passes cookies through to $.cookie function, but only if user has not opted out or if cookie is not blacklisted via cookiebanner.cookies.optout | function setCookieSafely(title, value, options) {
if (window.cookiebanner && window.cookiebanner.optedOut && window.cookiebanner.optoutCookies && window.cookiebanner.optoutCookies.length) {
var blacklist = window.cookiebanner.optoutCookies.split(',');
for (var i = 0; i < blacklist.length; i++) {
if (title === $... | [
"function optionsCookie(req, res, next) {\r\n \r\n function isString(v) {return typeof v == 'string'}\r\n\r\n if(isString(req.query.sort) && req.query.sort != req.cookies.sort) {\r\n res.cookie('sort', req.query.sort, {httpOnly: false}) \r\n }\r\n\r\n if(isString(req.query.sort) && req.query.order != req.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List the billing.CreditCard objects [PRODUCTION] [See on api.ovh.com]( | ListOfCreditCards() {
let url = `/me/paymentMean/creditCard`;
return this.client.request('GET', url);
} | [
"function getCreditCards(){\n\tif(paymentScreenProps.windowType==\"Modal\" && !isUserLoggedIn()){\n\t\treturn false;\n\t}\n\ttogglePaymentAndIFrameBlock(false);\n\t\n\t\t$('#cancelButton').attr(\"disabled\", true);\n\t\t$.ajax({\n \t\t\ttype: \"POST\",\n \t\t\turl: \"/listCreditCards.do?operation=retrieveCreditCard... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ALGO: map the array of strings with the count for the char return the minimum count | function minimuNumberOfApperances(char, arrayOfStrings) {
return Math.min(...arrayOfStrings.map(string => (string.match(new RegExp(char,'g')) || []).length));
} | [
"function solve(arr){ \n let alpha = \"abcdefghijklmnopqrstuvwxyz\";\n return arr.map(a => a.split(\"\").filter((b,i) => b.toLowerCase() === alpha[i]).length )\n}",
"function getMinPartition(s, i=0, j=s.length-1)\n{\n let ans = Number.MAX_VALUE\n let count = 0\n\n if (isPalindrome(s.substring(i, j + 1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
unlink email with default strategy | unlinkEmail(email, code, password, callback) {
password = AccountsEx._hashPassword(password);
callback = ensureCallback(callback);
return AccountsEx._unlinkEmail({type: 'default', email, code, password}, callback);
} | [
"_unlinkEmail(options, callback) {\n Meteor.call(prefix + '_unlinkEmail', options, ensureCallback(callback));\n }",
"deleteEmail() {\n\n \n switch (this.view) {\n\n // move item to trash\n case \"inbox\":\n this.$set(this.selectedEma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
divShowOnly(divHideList,divId) Hide all divs in divHideList and Show divId | function divShowOnly(divHideList,divId) {
//console.log('divShow('+divHideList+','+divId+')');
if ( document.getElementById(divId) ) {
var divHideArray = divHideList.split(",");
for(var i=0; i<divHideArray.length; i++){
divHide(divHideArray[i]);
}
divShow(divId);
} else {
console.warn('document.getElem... | [
"function divShowOnlyInline(divHideList,divId) {\n //console.log('divShow('+divHideList+','+divId+')');\n\tif ( document.getElementById(divId) ) {\n\t\tvar divHideArray = divHideList.split(\",\");\n\t\tfor(var i=0; i<divHideArray.length; i++){\n\t\t\tdivHide(divHideArray[i]);\n\t\t}\n\t\tdivShowInline(divId);\n\t}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deploy A Data Source To An Environment | function deploy(params, cb) {
params.resourcePath = config.addURIParams(constants.FORMS_BASE_PATH + "/data_sources/:id/deploy", params);
params.method = "POST";
params.data = params.dataSource;
mbaasRequest.admin(params, cb);
} | [
"function datasourceForConfig(args)\n{\n\tvar bename;\n\n\tmod_assertplus.object(args);\n\tmod_assertplus.object(args.dsconfig);\n\tmod_assertplus.object(args.log);\n\n\tbename = args.dsconfig.ds_backend;\n\n\tif (bename == 'manta')\n\t\treturn (mod_datasource_manta.createDatasource(args));\n\tif (bename == 'file')... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the number of bounding spheres in the bounding spheres array that are actually being used. | SetBoundingSphereCount() {} | [
"SetBoundingDistances() {}",
"set boundingBoxMode(value) {}",
"function addSpheres() {\n // Visible grid sphere\n const gridSphere = createSphereOfQuadsWireframe(gridRadius, 36, 18, \"#2e2e2e\", true, true);\n gridSphere.name = 'gridSphere';\n scene.add(gridSphere);\n // Clickable inverted sphere... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Listener for player state changes. Calls getTime every second. | function onPlayerStateChange(event) {
if (event.data === YT.PlayerState.PLAYING) {
getTime();
} else if (event.data === YT.PlayerState.ENDED || event.data === YT.PlayerState.PAUSED){
clearInterval(getTime);
}
} | [
"function onTimeUpdate(e) {\n var newTime = Math.floor(video.currentTime);\n if (newTime != timeInt) {\n timeInt = newTime;\n time_str = toTimeString(timeInt);\n updateTimeBar();\n }\n}",
"function setCurrentTime() {\n\t\tvar total = player.currentTime;\n\t\tcurrentTimeElement.innerHTML = timeFormat(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |