query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
makes move for bot with the best move calculated from negamax function | function bot_move() {
/**
* pass player(second parameter) as 1 if player 1 is bot and -1 if player 2 is bot
* to have minimax function find solution correctly.
*/
var player_param = (player1.type === 'bot') ? 1 : -1;
var best_move = negamax(0, player_param, -max_value... | [
"function negamax(board, depth, isMax) {\n\n //we evaluate if the current state is a winning one\n var score = evaluate(board);\n //if yes, than the value returned is the current max. the best value we can achieve is 10, meaning the AI won the game at that move.\n if (score != 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the company that owns the team for which the post is being created only needed for analytics so we only do this for inbound emails | async getCompany () {
if ((!this.forInboundEmail && !this.forCommentEngine && !this.forSlack) || !this.team) {
// only needed for inbound email, for tracking
// or if no team, which can happen for replies to teamless code errors
return;
}
this.company = await this.data.companies.getById(this.team.get('co... | [
"function getCompany() {\n if ( props.docMode && props.docMode==='true') {\n return \"\";\n } else {\n return location.state.company;\n }\n }",
"determineCompanyName () {\n\t\t// if the user previously set a company name, just use that\n\t\tif (this.user.get('companyN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Security check takes an input string and returns a boolean value which indicates whether the string is secure. A string is secure only if it contains at least one uppercase letter, lowercase letter, number and symbol. | function securityCheck(input) {
var uppercase = false;
var lowercase = false;
var number = false;
var symbol = false;
for (var i = 0; i < input.length; i++) {
if (/[A-Z]/.test(input.charAt(i))) {
uppercase = true;
}
if (/[a-z]/.test(input.charAt(i))) {
... | [
"function isSanitized(inputString) {\n\tif(!inputString || typeof inputString !== 'string' || inputString.length === 0 || !/^[a-z0-9]+$/i.test(inputString))\n\t\treturn false;\n\treturn true;\n}",
"function isSecure (value) {\n\t\treturn symbols.includes(value.toString());\n\t}",
"isSufficientlySecurePassword(p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Author : Poonam Gokani Desc : Function to send updated password information to student Date : 24/07/2017 | function sendUpdateResetPasswordMail(student,api_url){
var FROM_ADDRESS = 'support@Certspring.com';
var TO_ADDRESS = student.student_active_email;
var SUBJECT = 'Certspring Student account password changed';
var DATE =moment().format('MM/DD/YYYY');
var html = "Dear "+ student.student_first_name+" "+ student.... | [
"function updatePassword() {\n if (\n !userInfo.oldPassword ||\n !userInfo.newPassword ||\n !userInfo.confirmPassword\n ) {\n Toast.showToast(\"请输入原密码和新密码!\");\n } else {\n if (userInfo.newPassword !== userInfo.confirmPassword) {\n Toast.showToast(\"两次输入新密码不一致!\");\n } ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Defines a GraphQL fetcher using the fetch API. | function graphQLFetcher(endpoint, headers = null) {
return function(graphQLParams) {
return fetch(endpoint, {
method: 'post',
headers: headers ? createHeaders(headers) : { 'Content-Type': 'application/json' },
body: JSON.stringify(graphQLParams),
credentials: 'include',
}).then(respons... | [
"function graphQLFetcher(endpoint) {\n return function(graphQLParams) {\n return fetch(endpoint, {\n method: 'post',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(graphQLParams),\n credentials: 'include',\n }).then(function (response) {\n return response.j... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
carrega a proxima fase do jogo | function proximaFase(fase){
switch(faseAtual){
case 0:
maze = fase_1;
break;
case 1:
maze = fase_2;
break;
case 2:
maze = fase_3;
break;
case 3:
maze = fase_4;
break;
case 4:
maze = fase_5;
break;
case 5:
maze = fase_6;
break;
case 6:
maze = fas... | [
"function prox(){\n //varrer os inputs e armazenar em object\n console.log('bt proximo clicado');\n}",
"function cheseaux() {\n setPosition(46.779043, 6.659222, 448);\n }",
"function FimJogo(){\n\t\tswitch(_vitoria){\n\t\t\tcase 1:AnunciarVitoria(1);p1.Vencer();break;\n\t\t\tcase 2:AnunciarVitoria... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
MemberTypesDefinition : = MemberTypes MemberTypes : `|`? NamedType MemberTypes | NamedType | function parseMemberTypesDefinition(lexer) {
var types = [];
if (skip(lexer, _lexer.TokenKind.EQUALS)) {
// Optional leading pipe
skip(lexer, _lexer.TokenKind.PIPE);
do {
types.push(parseNamedType(lexer));
} while (skip(lexer, _lexer.TokenKind.PIPE));
}
return types;
} | [
"function parseMemberTypesDefinition(lexer) {\n var types = [];\n if (skip(lexer, _lexer.TokenKind.EQUALS)) {\n // Optional leading pipe\n skip(lexer, _lexer.TokenKind.PIPE);\n do {\n types.push(parseNamedType(lexer));\n } while (skip(lexer, _lexer.TokenKind.PIPE));\n }\n return types;\n}",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
'project update' command implementation. Updates project in the current directory. If the current directory does not contain Project Config, a user is informed and the operation is stopped. If the Device Group with the id, saved in Project File, does not exist anymore, a user is informed and the operation is stopped. P... | update(options) {
this._checkProjectConfig().
then(() => this._initDeviceGroup(options)).
then(() => this._updateDeviceGroup(options)).
then(() => this._processSourceFiles(options)).
then(() => this._saveProjectConfig()).
then(() => this._info()).
... | [
"async updateProject (context) {\n try {\n const project = await this.joinProject(context)\n return project\n } catch (err) {\n throw err\n }\n }",
"updateProjectTemplate(projectTemplateId, organizationId, options) {\n return this.sendOperationRequest({ projectTemplateId, organizat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
we can't use toEqual() because TaffyDB adds its own stuff to the array it returns. instead, we make sure arrays a and b are the same length, and that each object in array b has all the properties of the corresponding object in array a used for getMembers and prune tests. | function compareObjectArrays(a, b) {
expect(a.length).toEqual(b.length);
for (var i = 0, l = a.length; i < l; i++) {
for (var prop in a[i]) {
if ( hasOwnProp.call(a[i], prop) ) {
expect(b[i][prop]).toBeDefined();
expect(a[i][prop]).toE... | [
"function compareObjectArrays(a, b) {\n expect(a.length).toEqual(b.length);\n\n for (let i = 0, l = a.length; i < l; i++) {\n for (const prop in a[i]) {\n if ( hasOwnProp.call(a[i], prop) ) {\n expect(b[i][prop]).toBeDefined();\n expect(a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get user name and avatar | async function getname() {
let modified_url2 = url_info + handle_name;
const jsondata2 = await fetch(modified_url2);
const jsdata2 = await jsondata2.json();
let name = jsdata2.result[0].firstName || "user";
let user = document.querySelector(".user");
let user_avatar = document.querySelector(".... | [
"get avatar() {}",
"function getAvatar () {\n User.getAvatar(vm.username)\n .then(function (avatar) {\n vm.avatar = avatar[0].profile_photo;\n });\n }",
"function renderAvatar(user) {\n let name = user.nickname || user.username;\n $('#welcome').html('welcome  ' + na... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a callSignal function. | function makeCallSignal(signals, opts) {
return function (address, signalName, arg) {
if (opts.verbose) {
console.log('Called signal ' + signalName + ' at [' + address.join(', ') + '].');
}
signals.get(address).data.signals[signalName].call(arg);
};
} | [
"signal(signalID, fn) {\n this._signals[signalID] = fn;\n return this;\n }",
"function createSignalFromFunction(node, fn, extraApi = {}) {\n fn[SIGNAL] = node;\n // Copy properties from `extraApi` to `fn` to complete the desired API of the `Signal`.\n return Object.assign(fn, extraApi);\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a map of arguments where the value is the corresponding npm strings | function getNpmInstallStringMappings(save, saveDev, saveExact, force) {
return new Map().set('save', save && !saveDev ? '--save' : undefined).set('saveDev', saveDev ? '--save-dev' : undefined).set('saveExact', saveExact ? '--save-exact' : undefined).set('force', force ? '--force' : undefined);
} | [
"convertSystemArgs() {\n return minimist(system.args, {\n alias: this.aliases\n });\n }",
"function processArgs() {\n return require('optimist')\n .usage('Launch Real Time Analytics Server\\nUsage: $0') \n .describe('c', 'Number of CPUs')\n .alias('c', 'cpu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
imports contacts successfully, but creating a contact list viewer was not within the scope of this project should we continue developing this prject next semester, this will be completed | async function importContact() {
const { data } = await Contacts.getContactsAsync({
});
if (data.length > 0) {
const contact = data[0];
console.log(data);
}
} | [
"function loadContactsOffline() {\n localData.allDocs({\n include_docs: true,\n attachments: true\n }).then(function (result) {\n console.log(result);\n console.log(result.rows.length);\n if(result.rows.length == 0){\n loadRemoteDat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
download file from drive using Powershell | function downloadFileFromDrive(url, file_name) {
var file_id = url.split('/')[5];
var download_url = 'https://drive.google.com/uc?export=download&id=' + file_id;
try {
runCMD("wget '" + download_url + "' -OutFile " + file_name);
return true;
} catch (error) {}
return false;
} | [
"static downlaodFile(url) {\n const file_name = url.split('/').pop();\n request(url)\n .pipe(fs.createWriteStream('./downloaded/' + file_name))\n .on('close', function () {\n return { path: '/downloaded/'+ file_name, downloaded: true }\n });\n }",
"function downloadFile(fileId) {\n\t/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `DeploymentStyleProperty` | function CfnDeploymentGroup_DeploymentStylePropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, bu... | [
"function containsAllowedProps(properties) {\n if (properties === null || (typeof properties === 'undefined' ? 'undefined' : _typeof(properties)) !== 'object') {\n return false;\n }\n return Object.entries(properties).some(function (property) {\n var key = property[0];\n var value = pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Edit a todo item's due date by selecting the ID and send in the new importance | function editTodoImportance(importance, id){
var count = readCount();
var listArr = readTodosArray();
var listLength = listArr.length;
for(index = 0; index < listLength; index++){
if(listArr[index][ID] == id){
listArr[index][IMPORTANCE] = importance;
writeTodosArray(count, listArr);
return 0;
}
}
... | [
"function editTodoDue(due, id){\n\tvar count = readCount();\n\tvar listArr = readTodosArray();\n\tvar listLength = listArr.length;\n\n\tfor(index = 0; index < listLength; index++){\n\t\tif(listArr[index][ID] == id){\n\t\t\tlistArr[index][DUE] = due;\n\t\t\twriteTodosArray(count, listArr);\n\t\t\treturn 0;\n\t\t}\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
componentWillMount() Clear projects state | componentWillUnmount() {
this.props.clearProjects()
} | [
"componentWillUnmount() {\n this._isMounted = false;\n const { parametersSaved } = this.state;\n\n if (!parametersSaved) {\n let project = JSON.parse(JSON.stringify(this.props.project));\n const { parameters, selected: { foldIndex } } = this.state;\n\n project.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Module object definition. Every module should have an "enabled" property and an "enable" function. Instantiates an instance of the CitySdk FEMA object. | function FEMAModule() {
this.enabled = false;
this.iso8601reg = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-... | [
"function Module(){}",
"function AN_Module( base_config ){\n\n //Base options for every module\n var skeleton_config = {\n active: true,\n run: function(){}\n };\n\n //Extend the skeleton config with the module's base configuration options\n var config = extend({},skeleton_config,base... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Webpack Configuration for single compiler mode. | getSingleWebpackConfig(file) {
const {
type,
slug,
hasReact,
hasSass,
hasLess,
hasFlow,
bannerConfig,
alias,
optimizeSplitChunks,
outputPath,
appName,
errorOverlay,
externals,
useBabelConfig
} = this.projectConfig;
const {
... | [
"getWebpackConfig() {\n // Now it can be a single compiler, or multicompiler\n // In any case, figure it out, create the compiler options\n // and return the stuff.\n // If the configuration is for multiple compiler mode\n // Then return an array of config.\n if (this.isMultiCompiler()) {\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method returns a string with all the parameters which are needed by the auxilliary URLs the click handlers, for example. This should be an exhaustive list of parameters; any extra will just be ignored. | function getClickHandlerQueryStringParameters(layerSpec) {
var year = layerSpec.year;
var cartogramFlag = DomFacade.getFlagForCartogramCheckbox();
var polyYear, shapeType, fieldName, tableName;
if(DomFacade.isCartogramCheckboxChecked()) {
polyYear = layerSpec.cartogramPolyYear;
fieldName = layerSpec.fie... | [
"get params(){\n\tif ( isUndefined(this._params) || isEmptyObject(this._params) )\n\t return \"\";\n\tlet params = \"\";\n\tObject.keys(this._params).forEach( (key) => { params += `${key}=${this._params[key]}&`; });\n\treturn params.substring(0, params.length - 1);\n }",
"function collect_parameters(paramet... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Win condition helper (Count Up/Left) | function countUpLeft(x,y){
for(let i = y; i > 0; i--){
for(let j = x; j > 0; j--){
if(boardArray[x + y * columns] == boardArray[(j - 1) + (i - 1) * columns]){
winConditionCount++;
} else {
return;
}
if(i - 1 > 0){
i--;
} else {
return;
}
}
}
} | [
"function countWins(){\n\n if(self.grid.winner === \"x\"){\n self.grid.xCounter++;\n self.grid.winMessage = \"x wins!\";\n }\n\n else if(self.grid.winner === \"o\"){\n self.grid.oCounter++;\n self.grid.winMessage = \"o wins... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
populates the playbar at the bottom of the page with device list, play button, etc | function populatePlayBar() {
populateDevices();
//add playbutton
let $button = $("<button>", {
type: "button",
text: "start playlist mix",
class: "playback-button"
});
//attach listener at element creation
$button.on("click", function () {
handleStartButton();
... | [
"function updateSideBar(){\r\n count = 1;\r\n //update playlist titles\r\n for(i = playListStack.length; i > 0; i--){\r\n $(\"#playlist\"+count).text(playListStack[i-1].name);\r\n Playtrack = playListStack[i-1].url;\r\n Playtitle =playListStack[i-1].name;\r\n $(\"#playlist\"+count).data({ url... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FolderDisplayListener Decide whether to display the filter bar toggle button whenever a folder display is made active. makeActive is what triggers the display of account central so this is the perfect spot to do so. | onMakeActive(aFolderDisplay) {
let tab = aFolderDisplay._tabInfo;
this._updateToggle(tab);
// The case in that previous aFolderDisplay is showing a normal folder is
// handled by onLoadingFolder. Here we handle the case where previous
// aFolderDisplay shows an account folder instead (this cannot be... | [
"function onFilterFolderClick(aFolder) {\n\tif (!aFolder || aFolder == gCurrentFolder)\n\t\treturn;\n\n\t// Save the current filters to disk before switching because\n\t// the dialog may be closed and we'll lose current filters.\n\tgCurrentFilterList.saveToDefaultFile();\n\n\tselectFolder(aFolder);\n}",
"onSearch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the first num paths callback(err, row) | function getPaths(num, callback){
var count = 0;
db.each("SELECT path from paths", function(err, row){
count++;
if(count < num){
callback(err, row);
}
});
} | [
"getNextPathIndex() {\n \t\tvar coordinates = this.Mover.getMapCoordinates();\n \t\tvar index = this.getPathIndex();\n \t\tvar c;\n \t\tdo {\n \t\t\tindex = index + 1 < this.path.length ? index + 1 : 0;\n \t\t\tc = this.path[index];\n var pos = this.Mover.parsePosition(c);\n \t\t} while (pos.x == coor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function takes a cell as a jQuery object as argument and returns its row number as a number | function getRowNumber(cellObj) {
var rowNumAsString = cellObj[0].prop("classList")[1];
var rowNumber = rowNumAsString.replace(/[^0-9]/gi, "");
return parseInt(rowNumber);
} | [
"function getRowNum(cell) {\n const number = cell.parentNode.dataset.number\n\n return (number ? parseInt(number, 10) : 0)\n }",
"function getNumber($cell) {\n return $cell.prevAll('.board-cell').length;\n}",
"function getRow(cell)\n {\n let result = -1;\n if(cell !== undefined)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sign into the Salesforce service Suggestion: use salesforce oauth with forcetk.js(as SDK) | function oauthSalesforce(loginUrl, clientId) {
var redirectUri = 'http://localhost/callback';
var getAuthorizeUrl = function (loginUrl, clientId, redirectUri) {
return loginUrl+'services/oauth2/authorize?display=touch'+
'&response_type=token&client_id='+escape(clientId)+
'&r... | [
"login(settings) {\n check(settings, Match.ObjectIncluding({\n // TODO need to update to use the OAuth2 flow\n // this will let us get a refresh token instead of relying on session ids (which can expire)\n user: String,\n password: String,\n token: String, // security token\n login... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a data object, generates a waterfall of the songs inside. The order of the columns (L>R) is as follows: valence, liveness, accousticness, energy, danceability. INPUT: data (Object) svg (Object) height (Number) width (Number) traits (Array) OUTPUT: Nothing returned but should draw a waterfall on svg | function drawWaterfall(svg, data, height, width, traits) {
const songs = data.songs;
const x = scaleLinear()
.domain([0, 1])
.range([0, width]);
const songNames = scaleBand()
.domain(songs.map(d => d.name))
.range([0, height])
.padding(0.1);
// append the rectangles for the bar chart
svg... | [
"function prepareData(values, thresh, wrapThresh) {\n\n var level = 1;\n var levels = [];\n var wrapGap = 0.75;\n var inside = true;\n // var yAdjust = threshold - y.invert(strokeWidth*2);\n //ISAAC CAN YOU CHECK THIS PART?\n\n // var barCount = 0;\n // var yA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build Basic component ui for access token not empty | accessTokenUI(accessToken){
return `<p style='font-size: 14px;'>My access token: ${accessToken}</p>`
} | [
"function newOAuth() {\n document.getElementById('oauthButton').style.display='none'\n document.getElementById('oauthText').style.display='inline'\n document.getElementById('token').style.display='inline'\n}",
"static build(token) {\n if (token && token.startsWith(this.BEARER_PREFIX)) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the descriptors for all AVDs which are possible to make given the SDKs which were downloaded | function getAVDDescriptors(sdkPath) {
let deferred = q.defer();
// `glob` package always prefers patterns to use `/`
glob('system-images/*/*/*', { cwd: sdkPath }, (err, files) => {
if (err) {
deferred.reject(err);
}
else {
deferred.resolve(files.map((file) => ... | [
"function getVideoCaptureDevices() {\n return new Promise((resolve, reject) => {\n readdir('/dev', (err, data) => {\n if (err) {\n return reject(err);\n }\n const videoDevices = data.filter(device => {\n return device.startsWith('video');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check the strategy id belongs to app | async appStrategyRequired(ctx, next) {
const { service: { mysql } } = ctx;
const strategyId = ctx.query.strategyId;
const appId = ctx.query.appId;
const strategy = await mysql.getStrategyById(strategyId);
if (strategy.app_id === +appId) {
await next();
} else {
ctx.bo... | [
"async appAgentRequired(ctx, next) {\n const { service: { agentmanager } } = ctx;\n const appId = ctx.query.appId || ctx.request.body.appId;\n const agentId = ctx.query.agentId || ctx.request.body.agentId;\n const agents = await agentmanager.getInstances(appId);\n if (agents.some(agent => a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Queries all interaction transactions and replays a contract to its latest state. If height is provided, will replay only to that block height. | function readContract(arweave, contractId, height, returnValidity) {
return __awaiter(this, void 0, void 0, function* () {
if (!height) {
const networkInfo = yield arweave.network.getInfo();
height = networkInfo.height;
}
if (contractId in cache) {
if (hei... | [
"function readContract(arweave, contractId, height, returnValidity) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!height) {\n const networkInfo = yield arweave.network.getInfo();\n height = networkInfo.height;\n }\n const loadPromise = contract_load_1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find the parallaxWrapper that is currently in view (if any) | function getParallaxSectionInView() {
let posTop = $(window).scrollTop();
let windowHeight = $(window).height();
for (let i=0; i<parallaxWrappers.length; i++) {
let wrapperTop = $(parallaxWrappers[i]).offset().top; // Y where the section begins
let wrapperBottom = $(parallaxWrappers[i]).offset().top + p... | [
"function parallax(){\n $(window).scroll(function (event) {\n\n var scroll = $(window).scrollTop();\n // Do something\n var $window = $(window);\n var window_height = $window.height();\n var window_top_position = $window.scrollTop();\n var window_bottom_position = (window_top_position... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set active horizontal and vertical tabs highlighted in cc page | function setActiveCCTabs(VerticalTab,HorizontalTabInfoID)
{
if ( HorizontalTabInfoID == 23 )
VerticalTab = 0;
/*
Added this condition for expire interest check.
*/
if ( HorizontalTabInfoID == 22 )
VerticalTab = 0;
$("#VerticalTab"+VerticalTab).addClass("active").addClass("jsButton-disabled");
$("#Horizonta... | [
"function highlightTabs() {\n for (let el of document.getElementsByClassName('tab'))\n\t\tel.classList.remove('activeTab')\n\n for (let pane of Tracker.panes)\n pane.activeTab.element.classList.add('activeTab')\n}",
"function highlightActiveTab() {\n $(\"#a-unix\").addClass(\"button-active\");\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcoes iguais que chamam apenas LeArmasArmadurasEscudos com parametros corretos. | function _LeArmas() {
_LeArmasArmadurasEscudos(gEntradas.armas, Dom('div-equipamentos-armas'));
} | [
"function enviarDadosQuatroParametros(codigoRegistro, descricaoRegistro, codigoAuxiliar, tipoConsulta){\n opener.recuperarDadosQuatroParametros(codigoRegistro, descricaoRegistro, codigoAuxiliar,tipoConsulta);\n self.close();\n}",
"function irTransferencias() {\n // Eliminar la clase Activa de los enlaces y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RaphaelLineCharts is graph renderer for line chart. | function RaphaelLineChart() {
_classCallCheck(this, RaphaelLineChart);
/**
* selected legend index
* @type {?number}
*/
var _this = _possibleConstructorReturn(this, _RaphaelLineBase.call(this));
_this.selectedLegendIndex = null;
/**
... | [
"function SVGLineChart() {\r\n }",
"function linechart() {\n function createChart(el_id, options) {\n options.element = el_id;\n var r = new Morris.Line(options);\n return r;\n }\n\n return {\n restrict: 'E',\n scope: {\n options: '='\n },\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shifts cache from directional history cache. Should be called on `popstate` with the previous state id and container contents. direction "forward" or "back" String id State ID Number value DOM Element to cache Returns nothing. | function cachePop(direction, id, value) {
var pushStack, popStack
cacheMapping[id] = value
if (direction === 'forward') {
pushStack = cacheBackStack
popStack = cacheForwardStack
} else {
pushStack = cacheForwardStack
popStack = cacheBackSt... | [
"function cachePop(direction, id, value) {\n var pushStack, popStack\n cacheMapping[id] = value\n\n if (direction === 'forward') {\n pushStack = cacheBackStack\n popStack = cacheForwardStack\n } else {\n pushStack = cacheForwardStack\n popStack = cacheBackStack\n }\n\n pushStack.push(id)\n id =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method to handle the state object passed in the settings. It will check if the state need to be saved, restored, etc... | handleState(state, settings) {
var _a2;
const finalStateSettings = Object.assign(Object.assign({ id: this.node.id }, (_a2 = this.settings.state) !== null && _a2 !== void 0 ? _a2 : {}), settings !== null && settings !== void 0 ? settings : {});
Object.defineProperty(state, "preventSave", {
enumerable: ... | [
"loadstate() {\n if (this.ispersistable) {\n this.state = JSON.parse(localStorage.getItem(this.savekey));\n if (!this.state) {\n this.state = this.grindstate();\n }\n } else if (!this.state) {\n this.state = this.grindstate();\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Distribute sites around the node evenly | function computeSitePositions(node){
if(node._private.data.sites) {
var siteLength = node._private.data.sites.length;
for (var i = 0; i < siteLength; i++) {
var site = node._private.data.sites[i];
var paddingCoef = 0.9 ;
var centerX = ... | [
"generateNewSites(){\n\t\tthis.sites = this.generateBeeHivePoints(new paper.Size(Math.floor(Math.sqrt(this.totalNumberOfCells)), Math.ceil(Math.sqrt(this.totalNumberOfCells))), true)\n\t}",
"generateSites() {\n let sampler = poissonDiscSampler( 800, 800, 150 );\n\n let sample;\n\n while( (sample = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a sprint for this plan by sprint number | sprint (sprintNumber) {
return CapacityPlanSprints.findOne({ optionId: this._id, sprintNumber: sprintNumber })
} | [
"function getSprint() {\n SprintService.perform().get({id: sprintId}).$promise\n .then(function (sprint) {\n $scope.sprint = sprint;\n $log.debug(\"Fetched sprint\", sprint);\n\n getProject(sprint);\n getTasks(spri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The GroupManager is a singleton object which uses SSDP to search for discoverable Sonos groups on the local LAN. | function GroupManager() {
const os = require('os'),
self = this;
/**
* @private
*/
self._players = {};
/**
* @private
*/
self._ssdpClient = new Client({
logLevel: 'DEBUG',
reuseAddr: (os.platform() !== 'win32') // reuseAddr does not work as expected on Windows
});
/**
* @priv... | [
"function Group(groupId) {\n\tthis.groupId = groupId;\n\tthis.count = 0;\n\tthis.socketClientMap = {};\n}",
"function udp_srvgroups(bufUsed, rinfo, mgr) {\n ///???????????????????\n}",
"getGroups() {\n return httpService(`${config.dbApiUrl}/groups`, 'GET');\n }",
"_initDeviceGroup(options, isInfo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fundRequests function allows user to see and manage different fund requests | function fundRequests() {
if (user.fundRequests.length === 0) {
console.log("No-one has sent fund request to you, returning to menu.");
} else {
console.log("\nFUND REQUESTS");
console.log("-----------------------------");
console.log(user.name + ", (ID: " + user.id + ")");
... | [
"request_funds() {\n const fundForm = document.querySelector(\"#fund-form\");\n fundForm.addEventListener(\"submit\", function (e) {\n e.preventDefault();\n\n // get fund request form info\n const userName = fundForm[\"user-name\"].value;\n const userEmail = fundForm[\"user-ema... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var addedTotal = add(num1, num2 ) const addTotal = add(5, 5); console.log(addTotal) this is the subtract function | function subtract(num1, num2) {
var subtractTotal = num1 - num2;
return subtractTotal;
} | [
"function subtract(num) {\n total -= num;\n}",
"function subtract(number1, number2)\n{return(number1 - number2)}",
"function subtract(a,b){\n return a - b\n }",
"function subtraction(num1,num2){\n console.log (num1 - num2);\n}",
"function subtract(number1, number2){\n return number1 - number2\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
grabBoard This will return the board from localstorage. | function grabBoard(boardID) {
// Grab the cells for the particular board
var boards = JSON.parse(localStorage['labBoards']);
// Now find the right board
var board = null;
for (var i = 0; i < boards.length; i++) {
if (boards[i].id == boardID) {
// We found it!
board =... | [
"function grab_board() {\n // Create an array to hold the board\n var current_board = [];\n // Loop over each tile and append its value to the current board array\n $('.tile').each(function(index, element) {\n current_board[index] = $(element).text();\n });\n // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hash := (tasks:Object>) => Continuable> | function hash(tasks) {
return function continuable(callback) {
var keys = Object.keys(tasks)
var count = 0
var result = {}
if (keys.length === 0) {
return callback(null, result)
}
keys.forEach(function (key) {
tasks[key](function (err, value)... | [
"function hashObjectTask(filePath, write) {\n const commands = ['hash-object', filePath];\n if (write) {\n commands.push('-w');\n }\n return task_1.straightThroughStringTask(commands, true);\n}",
"function TaskList() {\n this.tasks = {}\n this.currentId = 0\n}",
"task(name, description, act... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the given node. If the broser supports querySelector it will use it, else, it will use selectSingleNode. | function findNode(node)
{
if(m_xmlDOM.documentElement.querySelector)
value = m_xmlDOM.documentElement.querySelector(node);
else
value = LumisPortalUtil.selectSingleNode(node.replace(">","/"), m_xmlDOM.documentElement);
return value;
} | [
"static Node(pNode, selector) {\n\t\treturn pNode.querySelectorAll(selector).item(0) || null;\n\t}",
"function getDOMNode(selector) {\n var node = document.querySelectorAll(selector)[0];\n return node;\n}",
"function _getDOMNode(selector) {\n\t\t\tlet $el = null;\n\t\t\tif (typeof selector === 'string') {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a disabled item to the menu. | AddDisabledItem() {} | [
"_initDisabledItem() {\n jQuery.contextMenu({\n selector: '#contextMenuDisabledItem',\n animation: {duration: 0},\n callback: function (key, options) {\n console.log('clicked: ' + key);\n },\n items: {\n copy: {name: 'Copy', className: 'cs-duplicate'},\n archive: {na... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an instance of ExampleFormComponent. | function ExampleFormComponent() {
var _this = _super.call(this) || this;
_this.email = "";
_this.password = "";
_this.rememberMe = false;
if (typeof _this.data === 'string') {
_this.data = JSON.parse(_this.data);
}
_this.data = (_this.data) ? _this.dat... | [
"function createForm() {\n var form = createNewElement('form', 'test__form', '.wrapper', '0');\n \n return form;\n}",
"getApplicationFormComponent() {\n return ApplicationForm\n }",
"createForm() {\n const form = document.createElement('form');\n form.classList.toggle('app-form');\n\n cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make a function named `isFalsy(input)`, remember that values other than false behave like false | function isFalsy(input){
return 0;
} | [
"function isFalsy(input){\n\n}",
"function isFalsy(input){\n if (input === false)\n return true;\n else\n return false;\n}",
"function isFalsy(input) {\n return input == false;\n}",
"function isFalsy() {\n\n }",
"function isFalsy(input) {\n return (input === (undefined || null |... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Your team just built wall partitions to create mini offices for startups. This office campus is represented by a 2D array of 1s (floor spaces) and 0s (walls). Each point on this array is a one foot by one foot square. You need to calculate the number of offices. A single office is bordered by walls and is constructed b... | function numOffices(grid) {
let result = 0;
for (let x = 0; x < grid[0].length; x++) {
if (grid[0][x] === 1 && grid[0][x - 1] !== 1) {
result = result + 1;
}
}
for (let y = 1; y < grid.length; y++) {
for (let x = 0; x < grid[0].length; x++) {
if (grid[y][x] === 1 && grid[y][x - 1] !... | [
"function totalCells(){\n return GRID.length * GRID[0].length;\n}",
"function countOccupied(grid) {\n return grid.flat().filter(c => c === '#').length;\n}",
"function numIslands2(grid) {\n\n\tlet islandCount = 0; \n\n\tfor(let x = 0; x < grid.length; x++) {\n\t\tfor(let y = 0; y < grid[x].length; y++) {\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if we can go deeper (result is inline node and path remains) | function checkIfWeCanGoDeeper () {
return trieRemainderPath.length > 0 && !isExternalLink(currentNode)
} | [
"checkIfTree() {\n for (const i in this.parentReference) {\n if (this.parentReference[i].length > 1) {\n this.isTree = false;\n return;\n }\n }\n\n this.isTree = true;\n }",
"isNotVisited(node,path){\n for(let i=0;i<path.length;i++){\n if(path[i]... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ROUND ME TO RIGHT VALUE // | function roundme(val) {
return val;
} | [
"runden() {\n return Math.round(this.value * 20) / 20;\n }",
"get right(): number {\n const width = this._width;\n const x = this._x;\n\n if (width < 0) {\n return x;\n }\n\n return x + width;\n }",
"function round(a){return Math.floor(a);}",
"function roundToEven(val) {\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
destroy a summy user async function | async function DestroyDummyUser(user) {
return user.destroy({ force: true });
} | [
"deleteUser(req, res) {\n const { user } = req;\n user.destroy()\n .then(() => this.logout(req, res))\n .catch(err => errorHandler(req, res, err));\n }",
"removeUser(state) {\n state.authUser = null;\n }",
"async function delete_user(name){\n try {\n let n = user.destroy( {where: {name}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
retorna a entrada selecionada | function entrada_selecionada() {
return entradas[parseInt(document.getElementById("ins").value)];
} | [
"seleccion(){\n switch (this.tipo) {\n case 'C':\n this.getCompras();\n break;\n case 'O':\n this.getOfertas();\n break;\n case 'F':\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create new function that runs the commands function using similar arguments which will be set below | function runCommand (argOne, argTwo) {
commands(argOne, argTwo);
} | [
"function runCommands() {\n if (command === \"my-tweets\") {\n twitterFunction();\n } else if (command === \"spotify-this-song\") {\n spotifyFunction(argText);\n } else if (command === \"movie-this\") {\n omdbFunction(argText);\n } else {\n console.log(\"Invalid function name... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a workaround for The GeoJSON standard does not support Circle types, so Leaflet treats circles as points. This workaround adds a 'point_type' attribute to the the feature's properties with value 'Circle', and adds the radius, so at least the feature properties include the circle details. This is still valid Geo... | function updateCircleFeaturesToIncludeTypeAndRadius() {
var circleToGeoJSON = L.Circle.prototype.toGeoJSON;
L.Circle.include({
toGeoJSON: function () {
var feature = circleToGeoJSON.call(this);
feature.properties = {
point_type: ALA.MapCons... | [
"function geojsonCircleMarker(data, type) {\n return L.geoJson(data, {\n pointToLayer: function(feature, latlng) {\n return L.circleMarker(latlng, {\n radius: 3,\n fillColor: getColor(type),\n color: \"#000\",\n weight: 1,\n opacity: 1,\n fillOpacity: 0.8\n })... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Schedules sending all keys waiting to be sent to the backup, if not already scheduled. Retries if necessary. | async scheduleKeyBackupSend(maxDelay = 10000) {
if (this.sendingBackups) return;
this.sendingBackups = true;
try {
// wait between 0 and `maxDelay` seconds, to avoid backup
// requests from different clients hitting the server all at
// the same time when a new key is sent
const del... | [
"async scheduleAllGroupSessionsForBackup() {\n await this.flagAllGroupSessionsForBackup(); // Schedule keys to upload in the background as soon as possible.\n\n this.scheduleKeyBackupSend(0\n /* maxDelay */\n );\n }",
"StartJobScheduleBackup(){\n this.GetDbConfig(\"BackupScheduler\").then((rep... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cleanup user/tenant by token utility local function [NOTE] This process can be time consuming when subkey list is too many. In that case, there is a possibility that the consistency of the subkey will be lost. If a new token is added to the subkey list during processing with this function, that token subkey will be ove... | function rawCleanupUserToken(callback)
{
var dkcobj = k2hr3.getK2hdkc(true, false); // use permanent object(need to clean)
if(!apiutil.isSafeEntity(dkcobj)){
callback(false);
return;
}
var keys = r3keys();
var subkeylist = dkcobj.getSubkeys(keys.TOKEN_USER_TOP_KEY, true); // get subkeys unde... | [
"function rawCleanupRoleToken(callback)\n{\n\tvar\tdkcobj\t\t\t= k2hr3.getK2hdkc(true, false);\t\t\t\t\t\t\t\t\t\t// use permanent object(need to clean)\n\tif(!apiutil.isSafeEntity(dkcobj)){\n\t\tcallback(false);\n\t\treturn;\n\t}\n\n\tvar\tkeys\t\t\t= r3keys();\n\tvar\tsubkeylist\t\t= dkcobj.getSubkeys(keys.TOKEN_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
append first artist to the DOM | function appendExploreArtist1(contents) {
let htmlTemplate = "";
for (let content of contents) {
htmlTemplate += /*html*/ `
<article>
<img src="${getFeaturedImageUrl(content)}">
<div>
<h1>${content.title.rendered}</h1>
<p>${content.excerpt.rendered}<p>
<h3>S... | [
"function displayArtists(artists) {\n\n var menu = document.getElementById('show_artists'); //list of artists\n for(var i = 0; i < artists.length; i++) {\n if(artists[i].images[0]) {\n var artist = results.artists.items[i];\n var tmpl = document.getElementById('artist-template').c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functionality: Opens up the Computer Science B.S. curriculum when the Curriculum Chart is selected | function csBSCurriculum() {
WebBrowser.openBrowserAsync(
'https://undergrad.soe.ucsc.edu/sites/default/files/curriculum-charts/2018-07/CS_BS_18-19.pdf'
);
} | [
"function jump() {\n\tcurrentYear = parseInt(selectYear.value);\n\tcurrentMonth = parseInt(selectMonth.value);\n\tshowCalendar(currentMonth, currentYear)\n}",
"function CursePreferenceSubscreenCursesRun() {\r\n if (CursePreferenceErrors.length == 0)\r\n DrawButton(1815, 75, 90, 90, \"\", \"White\", \"Icons/Ex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
COMMENTS LIST MODE SELECTION | function injectCommentsListModeSelector() {
if (document.querySelector("#content > .comment-thread") == null) return;
let commentsListModeSelectorHTML = "<div id='comments-list-mode-selector'>"
+ `<button type='button' class='expanded' title='Expanded comments view' tabindex='-1'></button>`
+ `<button type='butto... | [
"function injectCommentsListModeSelector() {\n\tGWLog(\"injectCommentsListModeSelector\");\n\tif (query(\"#content > .comment-thread\") == null) return;\n\n\tlet commentsListModeSelectorHTML = \"<div id='comments-list-mode-selector'>\"\n\t+ `<button type='button' class='expanded' title='Expanded comments view' tabi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
store data in a twodimensional array and create temperature by Math.random(), temperature from 10 ~ 40 | function createTemp() {
var rows = 5;
for (var i = 0; i < rows; i++) {
this.dataStore[i] = [];
if (i != 4) { // first 4 weeks, 7 days a week
for(var column = 0; column < 7; column++) {
var temp = (Math.floor(Math.random() * 31)) + 10;
... | [
"function addRandomTemperature(data_set){\n data_set.forEach(function(element) {\n element.Temperature = Math.floor(Math.random() * (30 - (-10) + 1)) + (-10);\n }, this);\n return data_set;\n\n}",
"function createRandomData(){\n\tvar result = [];\n\tfor (var i=0; i<DIMENSION; i++){\n\t\tresult[i] ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds Body Class for Mobile Side Navbar | function BodyToggleClass(n){
if(n === true){
$body.toggleClass('mob-side-navbar-in');
} else {
$body.removeClass('mob-side-navbar-in');
}
} | [
"function navbarMobile() {\n var x = document.getElementById(\"navbar\");\n if (x.className === \"navbar\") {\n x.className = \"navbar mobileNavBar\";\n } else {\n x.className = \"navbar\";\n }\n}",
"function setupBodyClasses() {\n\t\tvar windowWidth = $(window).width();\n\t\tvar bodyCla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We will usually want to delete the run name and lane number before returning the FPR record to the user | function maybeRemoveRunInfo (keepRunInfo, fpr) {
if (keepRunInfo === true) {
return fpr;
} else {
delete fpr.run;
delete fpr.lane;
delete fpr.library;
return fpr;
}
} | [
"deleteRun(run, e) {\n /*\n * Ask the user for confirmation to delete the run.\n */\n if (confirm(\"Are you sure you want to delete this run?\")) {\n /* If the user confirms, send the request to the server. */\n $.get(\"/api/delete_run/\" + run._id[\"$oid\"], func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the version of a package command (input) the package manager command: npm or bower packageName (input) the package name return value promise for package version number | function getPackageVersion(command,packageName) {
let sep;
if (command == "npm") {
sep = "@";
} else if (command == "bower") {
sep = "#";
} else {
return Promise.reject("Unsupported package command");
}
if (!packageName) {
return Promise.reject("Package name not specified");
}
return new Promise(funct... | [
"function getVersion(cmd) {\n try {\n return child_process.execSync(cmd).toString().split('\\n')[0];\n } catch (e) {\n // let the function return undefined\n }\n}",
"function version (param, cb) {\n exec('npm -v', function (err, res) {\n if (err) cb(err)\n cb(null, semver.satisfies(res, param), re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Kill functionality. Call game_object.kill() to kill the game_object. Will search the list for the game_object by id, and remove it from the list. O(n) operation | function kill_child(game_object)
{
if (game_object.parent.id != self.id)
return;
var index = -1;
for (var i = 0; i < self.child_arr.length; i++)
if (game_object.id == self.child_arr[i].id)
index = i;
if (index < 0)
return;
self.child_arr.splice(index, 1);
game_object.kill();
} | [
"function kill(object){\n\t\tif (typeof(object) === 'string'){\n\t\t\tobject = document.getElementById(object);\n\t\t}\n\t\tif (object.nodeName === undefined){\n\t\t\tif (object.length === undefined){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar i = object.length;\n\t\t\twhile (i--){\n\t\t\t\tkill(object[i]);\n\t\t\t}\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: todoStoreModifyEdit Parameter: Description: To transfer and show table row information to storage modal dialog | function todoStoreModifyEdit(event) {
todoOpenStoreModal();
var row = event.parentNode.parentNode;
document.getElementById('store-modal-input-bookid').value = row.cells[1].innerHTML;
document.getElementById('store-modal-input-repoid').value = row.cells[5].innerHTML;
document.getElementById('store-mo... | [
"handleEdit(event) {\n const id = event.detail.id;\n const file = this._tableData.find((row) => row.Id === id);\n\n if (!file) return;\n\n const modal = this.template.querySelector(`[data-id=\"edit\"]`);\n this.recordToEdit = { ...file };\n modal.show();\n }",
"function edit(transectionID) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show/hide navigation arrows and bookmark | function showArrows() {
if (document.body.scrollTop > 200 || document.documentElement.scrollTop > 200) {
var currentScrollPos = window.pageYOffset;
if (prevScrollpos > currentScrollPos) {
bookmark.style.opacity = '1';
topArrow.style.opacity = '1';
downArrow.style.... | [
"function showHideNavigationArrows() {\n if(pageNumber === 1) {\n // hide up arrow\n $('.arrowup').addClass('hide');\n }\n else {\n // show up arrow\n $('.arrowup').removeClass('hide');\n $('.arrows').removeClass('hide');\n }\n if(pageNumber === maxPages) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
HELPER: h_getRobbed function:player looses between 10%90% of the money in his pockets & 10% health | function h_getRobbed()
{
var robberyFactor = h_getRandomInt(10,90); // calculate the percentage player will loose while being robbed
// calculate money stolen
var stolen = Math.round(cash / 100 * robberyFactor);
cash = cash - stolen;
var n = noty({text: '<p><i class="fa fa-qq"></i> Robbery</p>You got robbed... | [
"gambler(cash, Goal, Times) {\n var wins = 0;\n var loss = 0;\n for (var i = 0; i < Times; i++) {\n //compute\n while (cash > 0 && cash < Goal) {\n\n\n\n if (Math.random() < 0.5) {\n //win add 1\n cash++;\n Times--;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Decompose a set of ranges into nonoverlapping ranges | function decomposeRanges(ranges) {
let results = [];
let endpoints = [];
// Extract range starts/ends
// and sort in ascending order
ranges.forEach((r) => {
endpoints.push(r[0]);
endpoints.push(r[1]);
});
endpoints = [...new Set(endpoints)];
endpoints.sort((a, b) => a - b);
// Keep track of ... | [
"subtractRanges(ranges) {\r\n let idx1 = 0;\r\n const newRanges = this.ranges.filter((r) => {\r\n let idx = ranges.ranges.indexOf(r, idx1);\r\n if (idx != -1) {\r\n idx1 = idx; // take advantage of the fact the ranges are sorted\r\n return false; // ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A function which prints str after n seconds. | function printTimeout(str, n) {
setTimeout(function () {
console.log(str)
}, n * 1000);
} | [
"function printTimeout(str, n) { \n setTimeout(function(){console.log(str);}, n*1000)\n}",
"function count10Secs(millisecs){\r\n\tsetTimeout(function(){\r\n\t\tdocument.getElementById(\"message\").innerText= \"\"+(10-Number(millisecs)/1000);\r\n\t},millisecs);\r\n}",
"function createAFunction(delay, stringTo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Routines taken from other parts of the Acme utilities. / Squash bytes down to ints. | function squashBytesToInts(inBytes, inOff, outInts, outOff, intLen) {
for ( var i = 0; i < intLen; ++i)
outInts[outOff + i] = ((inBytes[inOff + i * 4] & 0xff) << 24)
| ((inBytes[inOff + i * 4 + 1] & 0xff) << 16)
| ((inBytes[inOff + i * 4 + 2] & 0xff) << 8)
... | [
"function ba2int(x) {\n assert(x.length <= 8, 'Cannot convert bytearray larger than 8 bytes');\n var retval = 0;\n for (var i = 0; i < x.length; i++) {\n retval |= x[x.length - 1 - i] << 8 * i;\n }\n return retval;\n}",
"function bytesToQuads (num: int32): int32 {\n return num >> 2;\n}",
"function toIn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pH Linear Curve 1 raw range: 1600 to 1800 mV Panel ID: TER19260110 | function pHLin1 (pHRaw) {
var pHLinConverted1;
if (pHRaw <= 0 || pHRaw >= 3300) {
pHLinConverted1 = null;
} else if (pHRaw < 1600) {
pHLinConverted1 = 4;
} else if (pHRaw > 1800) {
pHLinConverted1 = 10;
} else {
pHLinConverted1 = (pH6Raw - 1391.42)/39.58;
... | [
"function linearCurve() {\n //ToneJS standard value for envelope curve\n const curveLen = 128;\n const curve = new Array(curveLen);\n for (var i = curveLen; i--; ) {\n curve[i] = i / (curveLen - 1);\n }\n return curve;\n}",
"function updateHRV(RR_Histogram,HR_Histogram,RR_s,Freqs,Pxx){\n\n //---RR... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get index of this instrumentID on sharesChart array object. | getIndexShare(id){
// let index = -1;
for (let i = 0 ; i < this.sharesChart.length; i++ )
if (this.sharesChart[i].instrumentID === id)
return i;
return -1;
} | [
"getIndexShare(id) {\n for (let i = 0; i < this.listShare.length; i++)\n if (this.listShare[i].Id === id) {\n // console.log(\"Index \",i);\n return i;\n }\n return -1;\n }",
"function getIndex() {\n return internal.index;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Patch the given method of instance so that the callback is executed once, before the actual method is called the first time. | function beforeFirstCall(instance, method, callback) {
instance[method] = function() {
delete instance[method];
callback.apply(this, arguments);
return this[method].apply(this, arguments);
};
} | [
"function beforeFirstCall(instance, method, callback) {\n\t instance[method] = function() {\n\t delete instance[method];\n\t callback.apply(this, arguments);\n\t return this[method].apply(this, arguments);\n\t };\n\t}",
"function before (obj, method, fn) {\n var old = obj[method]\n \n obj[method... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the given range (caused by an event drop/resize or a selection) is allowed to exist according to the constraint/overlap settings. `event` is not required if checking a selection. | function isRangeAllowed(range, constraint, overlap, event) {
var constraintEvents;
var anyContainment;
var peerEvents;
var i, peerEvent;
var peerOverlap;
// normalize. fyi, we're normalizing in too many places :(
range = $.extend({}, range); // copy all properties in case there are misc non-date properti... | [
"function isRangeAllowed(range, constraint, overlap, event) {\n var constraintEvents;\n var anyContainment;\n var peerEvents;\n var i, peerEvent;\n var peerOverlap;\n\n // normalize. fyi, we're normalizing in too many places :(\n range = $... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
renders lifebox to canvas | function renderLifeBox() {
for (let col = 0; col < grid.length; col++) {
for (let row = 0; row < grid[col].length; row++) {
const cell = grid[col][row];
ctx.current.beginPath();
ctx.current.rect(col * resolution, row * resolution, resolution, resolutio... | [
"function DISPLAY_renderAllBoxes() {\t\n\t// ctx.clearRect(-500,-500,1000,1000);\n\tctx.beginPath();\n\n\t// DISPLAY_BackLeft(0,[0,0,0,0,0,0,0,0,0]);\n\t// DISPLAY_BackRight(0,[0,0,0,0,0,0,0,0,0]);\n\t\n\t\n\t// DISPLAY_MiddleLeft(0,[0,0,0,0,0,0,0,0,0]);\n\t// DISPLAY_MiddleRight(0,[0,0,0,0,0,0,0,0,0]);\n\t\n\t\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function gets the modified numerators lcm / denominator numerator and maps an array. It gets the index of highest or lowest number and returns that same index of the original array. | function minMax(type, array) {
const denominators = array.map(a => a[1]);
const lcm = Math.lcm(denominators);
const numerators = array.map(a => lcm / a[1] * a[0]);
const index = numerators.indexOf((
type == 0?
Math.min(...numerators) :
Math.max(...numerators)
))
ret... | [
"function lcm_array(array){\n\t\tlcm=array[0];\n\t\tfor (var i = 1; i < array.length; i++) {\n\t\t\tlcm=lcm_two_number(lcm,array[i]);\n\t\t};\n\n\t\treturn lcm;\n}",
"function maxMin(arr) {\n var maxIdx = arr.length-1\n var minIdx = 0\n // store any element that is greater than the maximum element in the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load repo's milestones from endpoint | function loadMilestones() {
fetch( `https://api.github.com/repos/${user.value}/${this.value}/milestones?state=all&per_page=50&direction=desc` )
.then( ( response ) => 200 !== response.status ? [] : response.json() )
.then( ( data ) => {
milestones = [...data];
milestone.inner... | [
"function fetchMilestones({owner, repository}){\n return this.getData({path:`/repos/${owner}/${repository}/milestones`})\n .then(response => {\n return response.data;\n });\n}",
"function MilestoneLoad(){}",
"destiny2_GetPublicMilestones() {\n this.options.method = 'GET';\n this.option... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
On every 2 second, refresh global variables. | function sched_refresh_global() {
setTimeout(function() {
client.get('refresh_interval', function(err, reply) {
refreshInterval = reply;
});
client.lrange('op-qps', 0, -1, function(err, ops) {
qpsOps = ops;
});
client.lrange('op-bps', 0, -1, function(err, ops) {
... | [
"function refreshFrequently(){\n window.setInterval(function(){\n getDevicesData()\n }, 180000);\n}",
"function oneSecondCountdownToRefresh() {\n intervalId = setInterval(refresh, 1000);\n}",
"function periodicUpdate() {\n $scope.elapsedSeconds += updateSeconds;\n storyStats = {};\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate pixel grid using simplex noise | function generatePixels(){
let oldPixelPos = null;
if(pixels){
oldPixelPos = pixels.position;
pixels.removeChildren();
}
pixels = new Group();
let simplex = new SimplexNoise();
let values = [];
for(let x = 0; x<6; x++){
for(let y = 0; y<6; y++){
... | [
"function simplexPixels() {\r\n let simplex = new SimplexNoise();\r\n let values = [];\r\n\r\n for (let x = 0; x < squareSizeInPixels; x++) {\r\n for (let y = 0; y < squareSizeInPixels; y++) {\r\n values.push(simplex.noise2D(x / 10, y / 10));\r\n }\r\n }\r\n\r\n //scale noise to complete range\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A single cell on the board that is used in the Board component. This has no state just three props: coords: which are the yx coordinates of the cell in the matrix flipCellsAroundMe: a function rec'd from the board which flips this cell and the cells around it isLit: boolean, is this cell lit? This handles clicks by cal... | function Cell({ coord, flipCellsAroundMe, isLit }) {
const litClass = `${isLit ? "Cell-lit" : ""}`;
const handleFlip = () => flipCellsAroundMe(coord);
return <td className={`Cell ${litClass}`} onClick={handleFlip} role="button" />;
} | [
"function Cell({ coord, flipCellsAroundMe, isLit }) {\n const classes = `Cell ${isLit ? \"Cell-lit\" : \"\"}`;\n return <td className={classes} onClick={() => flipCellsAroundMe(coord)} />;\n}",
"function Cell({ flipCellsAroundMe, isLit=false, id }) {\n \n const classes = `Cell ${isLit ? \"Cell-lit\" : \"\"}`;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears the typing timer | function clearTypingTimer()
{
// Clear timer handle
if (typingTimer) {
clearTimeout(typingTimer);
typingTimer = null;
}
} | [
"function clearTypingBuffer()\n\t{\n\t\t// Clear timer\n\t\tclearTypingTimer();\n\n\t\t// Clear buffer\n\t\ttypingBuffer.length = 0;\n\t}",
"function timer(){\n typingTimer = false;\n}",
"function clearTypingBuffer(event)\n\t{\n\t\t// Clear timer\n\t\tclearTypingTimer();\n\n\t\t// Clear buffer\n\t\ttypingBuffe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
change the selected algorithm | function selectAlgorithm(name) {
unselectAllChildButtons("algorithm-select-container")
document.getElementsByName(name)[0].classList.toggle('selected');
algorithm = name;
updateHeadingAndComplexity();
if (isSortingStarted) {
resetBars();
}
} | [
"setCurrAlgorithm() {\n this.algorithm = this.chooser.getCurrAlgorithm();\n }",
"function setAlgorithm(algorithm) {\n\tsetAttributeUndoable(\n\t\tgetSetting(), \"SolutionAlgorithm\",\n\t\talgorithm);\n\n}",
"function changeAlgorithm(code) {\n if (sortingAlgo != code) {\n generateBlocks();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dispatches and clears the queue. For each property change in the queue, it fires the `'[propName]changed'` event with `oldValue` and new `value` in `event.detail` payload. It also executes node's `[propName]Changed(payload)` change handler function if it is defined. | dispatch() {
if (this._dispatchInProgress === true) return;
if (!this.__node.__isConnected) return;
this._dispatchInProgress = true;
const node = this.__node;
let changed = false;
while (this.__array.length) {
const j = this.__array.length - 2;
const prop = this.__array[j];
c... | [
"dispatch() {\n if (this._dispatchInProgress === true) return;\n if (!this.__node.__connected) return;\n this._dispatchInProgress = true;\n\n const node = this.__node;\n let changed = false;\n\n while (this.__changes.length) {\n const j = this.__changes.length - 2;\n const prop = this.__... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=============== TO CHECK LONGITUDE =============== | function longCheck() {
var lonLog = document.querySelector(".longitude");
var lon = response.lon;
console.log(lon);
lonLog.innerHTML += lon;
} | [
"async checkDataLocation(long, lat) {\n const locationStr = [long, lat];\n if (checkIfInputsCorrect(locationStr)) {\n var location = [];\n for (var j = 0; j < locationStr.length; j++) {\n location.push(parseFloat(locationStr[j]));\n }\n const ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to check whether the object is defined or not | function defined(obj) {
return typeof obj !== 'undefined';
} | [
"function defined(obj) {\n return typeof obj !== 'undefined';\n }",
"function isDef(obj) {\n return typeof obj !== 'undefined';\n }",
"function $defined(obj){\r\n return (obj != undefined);\r\n }",
"function defined(o) { return ty... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new typed symbol. | static create(name) {
return new TypedSymbol(name);
} | [
"function SymbolType(symbol) {\n Type.call(this, TYPE_ENUM.SYMBOL, false);\n this.symbol = symbol;\n}",
"function Symbol() {\n}",
"function create_symbol( label, kind, special )\n{\n\tvar exists;\n\n\tif( ( exists = find_symbol( label, kind, special ) ) > -1 )\n\t\treturn symbols[ exists ].id;\n\n\tvar sym = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Represents all of the user's layouts. | function Layouts($storage) {
this.$storage = $storage;
// $storage.version = null;
var version = $storage.version;
if (version) {
console.log("welcome back");
if (version != 1) {
console.log("Unexpected storage version." + version);
... | [
"function deviceLayouts() {\n app.getView().render('util/devicelayouts');\n}",
"function setLayout() {\n\tplayerLocation(USERCONFIG.player);\n\tuserlistLocation(USERCONFIG.userlist);\n\tqueueLocation(USERCONFIG.queue);\n\tqueueSize(USERCONFIG.qsize);\n\tmainLocation(USERCONFIG.main);\n\tmotdLocation(USERCONFIG... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
min() should return an EmptySortedList exception if there are no elements in the list should return the min (lowest) value in the list | min() {
if(this.items.length > 0)
return this.items[0]
else
throw new Error('EmptySortedList')
} | [
"function minimum(xs){\r\n if(!xs.length)\r\n return errorEmptyList(\"minimum\");\r\n \r\n var inst = getInstance(Ord, typeOf(head(xs)));\r\n\r\n return foldl1(inst.min, xs);\r\n}",
"function minimum(l){\r\n var min = l[0];\r\n for(var i = 1; i <= l.length; i++){\r\n if(l[i] < min){\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method for delete the log object based on ID in the JSON array | deleteLog(id) {
LoggerService.deleteLog(id).then((res) => {
this.setState({ logs: this.state.logs.filter((log) => log.id !== id) })
})
} | [
"function deleteItem(_id)\n\t{\n\t\t//setLogs(logs.filter((item) => item._id !== id))\n\t\tipcRenderer.send('logs:delete', _id)\n\t\tshowAlert('Log Removed !')\n\t}",
"function deleteActivityLog(obj, id) {\n $(obj).closest(\"li\").remove();\n $.post(\n '/opengraph/deleteActivity',\n {\n id: id\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=====================================================================\ void loadWorkspace(toolbox) \===================================================================== | async function loadWorkspace(toolbox) {
const xhr = new XMLHttpRequest();
xhr.onload = function() {
if (this.readyState === 4 && this.status === 200) {
const options = {
toolbox : this.response,
collapse : true,
comments : true,
disable : true,
maxBlocks : Infinity,
trashcan : true,
... | [
"function loadWorkspace() {\n\t// Intro\n\t$(\"#overlay div\").html(\"Loading Workspace...\");\n\tdisplayOverlay();\n\n\t// clear workspace\n\t$(\"#workspace\").html(\"\");\n\tjsPlumb.reset();\n\n\tdataToWorkspace(localStorage.getItem(\"savedata\"));\n\t$(\"#overlay\").fadeOut(1000, \"easeInOutExpo\");\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Multiplies a vector with a scalar. | function multiplyVect(vector, scalar) {
return [ scalar * vector[0],
scalar * vector[1],
scalar * vector[2]
];
} | [
"multiply(scalar) {\n return new Vector(this.x * scalar, this.y * scalar);\n }",
"function scalarMultiplyVector(s, v) {\n\tvar c = new Array(v.length);\n\tfor (var i = 0; i < v.length; i++) {\n\t\tc[i] = s * v[i];\n\t}\n\treturn c;\n}",
"multiply(scalar)\n {\n return new Vector(this.x * scalar, th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an integer, N, perform the following conditional actions: If N is odd, print Weird If N is even and in the inclusive range of 2 to 5, print Not Weird If N is even and in the inclusive range of 6 to 20, print Weird If N is even and greater than , print Not Weird Complete the stub code provided in your editor to pr... | function main() {
var N = parseInt(readLine());
if (N % 2 === 0) {
if (2 <= N && N <= 5) {
console.log('Not Weird');
}
else if (6 <= N && N <= 20) {
console.log('Weird');
}
else if (N > 20) {
console.log('Not Weird');
}
... | [
"function checkIfWeird(num) {\n if (num >= 1 && num <= 100) { // is between 1 and 100\n if (num % 2 === 0) { // is even\n if (num >= 2 && num <= 5) { // and between 2 and 5 \n return 'Not Weird';\n } else if (num >= 6 && num <= 20) { // and between 6 and 20\n return 'Weird';\n } els... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
workaround for Opera in MDI mode, must calc the "real" availWidth. | function getAvailWidth()
{
var myWidth=screen.availWidth;
if(self.screenX && self.screenLeft && (self.screenX != self.screenLeft) )
{
myWidth = myWidth - self.screenLeft + self.screenX;
}
return myWidth;
} | [
"function xWidth(e,w)\r\n{\r\n if(!(e=xGetElementById(e))) return 0;\r\n if (xNum(w)) {\r\n if (w<0) w = 0;\r\n else w=Math.round(w);\r\n }\r\n else w=-1;\r\n var css=xDef(e.style);\r\n if (e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {\r\n w = xClientWidth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shorthand for getting the component labels. | get labels() {
var _this$props$get2;
const value = (_this$props$get2 = this.props.get('labels')) === null || _this$props$get2 === void 0 ? void 0 : _this$props$get2.value;
if (!value) return [];
return value;
} | [
"get labels() {\n if (this.elementInternals) {\n return Object.freeze(Array.from(this.elementInternals.labels));\n } else if (this.proxy instanceof HTMLElement && this.proxy.ownerDocument && this.id) {\n // Labels associated by wrapping the element: <label><custom-element></custom-element></... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a file to the list of recent documents which is persistent Only 10 unique nonduplicate files are kept meaning each entry will be a different file, the samefile will remain in the same slot They are added to the top, oldest at the bottom They are accessible via CommandOrControl+Shift+ | addRecentDocument(path) {
let recentDocs = this.app.store.get('recentDocs', []);
recentDocs.unshift(path);
recentDocs = _.uniq(recentDocs);
if (recentDocs.length > 10)
recentDocs.length = 10;
this.app.store.set('recentDocs', recentDocs);
} | [
"addFile(file) {\n this.files.push(file)\n this.numFiles++;\n \n // Sort file order when new files are added to the directory after the first run\n if(this.firstRun === false) {\n this.files.sort((a, b) => {\n a = a.recordingXmlVals.title;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load assets with uuids | _loadResUuids(uuids, progressCallback, completeCallback, urls) {
if (uuids.length > 0) {
const self = this;
const res = uuids.map(uuid => {
return {
type: 'uuid',
uuid
};
});
this.load(res, progressCall... | [
"function loadAssets(){\n loader\n .add([\n 'img/raindrop.png',\n 'img/rad_gradient.png',\n 'img/sun_ray.png',\n 'img/touch_gradient.png',\n 'img/cloud.png',\n 'img/snow.png',\n 'img/snow2.png'\n ])\n .on('progress', loadProgressHandler)\n .load(getScripts); //after c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets or sets the ComboBox text field. | get textField() {
return this.i.jv;
} | [
"function TextField_getValue()\r\n{\r\n return (this.textControl.value)?this.textControl.value:\"\";\r\n}",
"get editorTextField() {\n return this.i.js;\n }",
"getText() {\n return this._editor ? this._editor.getText() : this._value;\n }",
"get text() {\n return this.instance.g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The function alerts the response xml, but is not outputted on the html page properly /see console or alert for the formatted response XML | function successFunction(res) {
responsexml = res.responseText;
result.innerHTML = responsexml;
console.log(responsexml);
alert(responsexml);
} | [
"function mostraMsg(xml) {\n\tif (xml.responseText != '') {\n\t\talert(xml.responseText);\n\t}\n}",
"getAllXML(req, res) {\n return res.status(200).send({\n success: 'true',\n message: 'XML payload retrieved successfully',\n XMLPayload: xmlResponse,\n });\n }",
"function failedxml(){\n $(\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset saved revision history from DocumentProperties and saved who did that ToDo: Allow clear history only for EPAM team only | function resetStoreData(){
var resetarray = [];
if (isAdmin()) {
resetarray.push({
"sheet": "System",
"cell": "event",
"timestamp": new Date().valueOf(),
"date": Utilities.formatDate(new Date(), "GMT+04", "dd MMM, HH:mm"),
"author": getOwnName(),
"email": Session.getEffective... | [
"function resetHistory() {\n\tdoc.activeHistoryState = doc.historyStates[history];\n}",
"function setHistory() {\n\tapp.purge (PurgeTarget.HISTORYCACHES);\n\thistory = doc.historyStates.length-1;\n}",
"function setRollbackDocuments() {\n\trbDocuments = swDocuments.slice(0);\n}",
"resetDocs() {\n logger... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |