query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
puts a given object into a given grid cell and cleans up after itself | function putObjInCell( obj, i, j ) {
var tempI = obj.i;
var tempJ = obj.j;
obj.i = i;
obj.j = j;
grid[i][j].occupiedBy = obj;
obj.x = grid[i][j].x;
obj.y = grid[i][j].y;
grid[tempI][tempJ].occupiedBy = null;
} | [
"function replaceWithCell(object) {\r\n\tcell[object[0]][object[1]] = cellObject.cell;\r\n}",
"putAt(obj, x, y) {\n this.checkBounds(x, y);\n this.cells[y * this.width + x] = obj;\n }",
"function updateCell(sim, object, x, y) {\n var curCell = object.cell;\n var realCell = sim.coordinateToCell(x, y);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function loggedInCheck with parameters req, res and next condition if req.session.user log string 'Logged in check: ' and req.session log string "user is logged in sending to next" next() else res redirect to '/' | function loggedInCheck(req, res, next) {
if (req.session.user) {
// logged in!
console.log('Logged in check: ', req.session);
console.log('user is logged in sending to next');
next();
} else {
res.redirect('/');
}
} | [
"function isLoggedIn(req, res, next) {\n // if (req.isAuthenticated())\n console.log(\"In log in check\");\n console.log(req.user);\n return next();\n\n res.redirect('/');\n}",
"function checkLogin (req, res, next) {\n if (userService.findUserById(req.session.userID)) {\n res.redirect(\"/urls\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
transformAttrs: add weextype attrs for precompiledTags. image.resize: transform to directive weexresize. | function transformAttrs (data, tag) {
let { attrs, directives } = data
if (!attrs) {
attrs = data.attrs = {}
}
attrs['weex-type'] = tag
if (tag === 'image') {
const { src, resize } = attrs
if (src) {
attrs['data-img-src'] = src
}
if (resize) {
if (!directives) {
directi... | [
"function transformAttrs(data, tag) {\n var attrs = data.attrs;\n var directives = data.directives;\n if (!attrs) {\n attrs = data.attrs = {};\n }\n attrs['weex-type'] = tag;\n if (tag === 'image') {\n var src = attrs.src;\n var resize = attrs.resize;\n if (src) {\n attr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates random array of 20 value 14 | function generateRandomArray(){
var randomArray = [];
for(var i = 0; i < 20; i++){
randomArray.push(Math.floor(Math.random() * 4) + 1);
}
return randomArray;
} | [
"function generaArray () {\r\n var array = []\r\n\r\n for (var count = 0; count < 10; count++ ) {\r\n var numeroCasuale = Math.floor(Math.random() * 9) + 1;\r\n array.push(numeroCasuale);\r\n}\r\n return array.join(\"\")\r\n}",
"function genEcg(){\n\tvar data = [];\n for (i = 1; i <= 100; i++) {\n v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Splits a commit message into type, category and message | function processCommit(commitMessage) {
const commitDetails = commitMessage.split(":");
// Split Meta Information
const metadata = commitDetails[0];
let type = "";
let category = "";
if (metadata.includes("(") && metadata.includes(")")) {
type = metadata.split("(")[0];
category = metadata.split("("... | [
"function processCommit(commitMessage) {\n const commitDetails = commitMessage.split(':')\n\n // Split Meta Information\n const metadata = commitDetails[0]\n let type = \"\"\n let category = \"\"\n if (metadata.includes('(') && metadata.includes(')')) {\n type = metadata.split('(')[0]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assign static styling values to a host element. NOTE: This instruction is meant to used from `hostBindings` function only. | function elementHostAttrs(directive,attrs){var tNode=getPreviousOrParentTNode();if(!tNode.stylingTemplate){tNode.stylingTemplate=initializeStaticContext(attrs);}patchContextWithStaticAttrs(tNode.stylingTemplate,attrs,directive);} | [
"setInitialValues(){\n // Get computed styles to get the initial :host{} variable values\n let computedStyles = window.getComputedStyle( this.template.host, null );\n\n if( this.defaultAccentColor ){\n this._styleObj.accentColor = this.defaultAccentColor;\n this._hostStyle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the IoMap Handler It should know: the connections. address of the source UUID + port name address of the target UUID + port name relevant source & target connection settings. Connection settings can overlap with port settings. Connection settings take precedence over port settings, althought this is not set in ... | function IoMapHandler() {
this.CHI = new CHI();
// todo: create maps from each of these and wrap them in a connections map
// so all there wil be is this.connections.
// connections.byTarget, connections.bySource etc.
this.targetMap = {};
this.connections = {};
this.sourceMap = {};
thi... | [
"function IoMapHandler() {\n this.CHI = new CHI();\n // todo: create maps from each of these and wrap them in a connections map\n // so all there wil be is this.connections.\n // connections.byTarget, connections.bySource etc.\n this.targetMap = {};\n this.connections = {};\n this.sourceMap = {};\n this.syn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if every element of the array passes the test implemented by th provided function. False otherwise. callback takes a single value and returns a truthy value if it passes the test. It returns falsey otherwise. | every(callback) {
for (const ele of this.arr) {
if (!callback(ele)) {
return false;
}
}
return true;
} | [
"function myEvery(callback, array)\r\n{\r\n for(let i = 0; i < array.length; i++) \r\n {\r\n if (!callback(array[i]))\r\n return false;\r\n }\r\n\r\n return true;\r\n}",
"function every(array, callback) {\n for (let i = 0; i < array.length; i++) {\n const value = callback(array[i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::Serverless::Function.BucketSAMPT` resource | function cfnFunctionBucketSAMPTPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnFunction_BucketSAMPTPropertyValidator(properties).assertSuccess();
return {
BucketName: cdk.stringToCloudFormation(properties.bucketName),
};
} | [
"function cfnFunctionSecretArnSAMPTPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnFunction_SecretArnSAMPTPropertyValidator(properties).assertSuccess();\n return {\n SecretArn: cdk.stringToCloudFormation(properties.secretArn),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removes Android green when called | function removeGreen (className) {
if(className === 'why-android-wrapper') {
document.getElementsByClassName(className)[0].children[0].style.cssText = '';
document.getElementsByClassName(className)[0].children[1].style.cssText = '';
} else {
document.getElementsByClassName(className)[0].children[0].chil... | [
"function stopFastForward(){\n greenLight = false;\n }",
"onGreenFlag() {\n this.clearEffects();\n }",
"function led_turn_off_all() {\n tj.turnOffRGBLed();\n}",
"function checkOffscreenBlue() {\n if (isOffscreen(circle1)) {\n state = `ignored`;\n }\n }",
"__onDeviceDisconnect () {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapper for importKey. Safari does not support importing of ASN.1 types spki and pkcs8. Try the import first, but if it fails with one of these formats, try again using JWK format. Applies to WebCryptoVersion.V2014_01/2 only. | function importKey(format, data, algorithm, extractable, usage) {
return Promise.resolve()
.then(function(){
return cryptoSubtle.importKey(format, data, algorithm, extractable, usage);
})
.catch(function(e) {
if (format !== 'spki' && format !== 'pkcs8') {
... | [
"function importJWK(jwk) {\n // needed for Edge 13.10586.0 (Windows 10 0.0.0) todo: file issue to see whether this is a bug in edge!\n // https://connect.microsoft.com/IE/feedbackdetail/view/2242108/webcryptoapi-importing-jwk-with-use-field-fails\n var effective_jwk = omit(jwk, 'use'); // had added {key_op... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility function for signing connection Will be used with function based authentication method (self sufficient authentication requires Secret Key) | function signSubscription () {
var to_sign = args.sid + ':' + args.channel + '.' + args.resource +
':ttl=' + args.ttl + ':read=' + args.read +
':write=' + args.write
if (self.bbt.userinfo.userid) {
to_sign = to_sign + ':userid=' + self.bbt.userinfo.userid
}
va... | [
"function signMethod(params){\n params.api_key = api_key;\n if(session_key) params.sk = session_key;\n var secret = '76a99e642cff2787b92cf8965828e0c6';\n var keys = [], str = '';\n for (var key in params) {\n if (params.hasOwnProperty(key)) {\n keys.push(key);\n }\n }\n keys.so... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
docCat is the doc object category chosen otherDocCat is the doc object category not chosen chosenCat is the category object chosen, corresponds with docCat | function checkCategory(docCat, otherDocCat, chosenCat) { //can add as parameter: "notChosenCat"
console.log("in checkCategory");
//debugger;
if (chosenCat && GAME.CURRENTCARD.category.name == chosenCat.name) {
//header feedback
//$("#feedback").text("☺ Correct!").show();
//show final term (i.e. "el ma... | [
"function getDocCategories() {\n if (utils.isEmptyObj(masterData.getMasterData())) {\n var request = masterData.fetchMasterData();\n $q.all([request]).then(function (values) {\n self.documentCategories = values[0].documents_cat;\n self.d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Example query to get all species with nested entity lookup. | async function example_query_get_all_species_with_nested_entity_lookup(queryResolver) {
const query = {
get: {
species: { // Query for "species" entity.
// No arguments gets all entities.
resolve: {
homeworld: { // Resolves the homeworld of ... | [
"async function example_query_get_all_species_with_nested_entity_lookup(queryResolver) {\n\n const query = {\n get: {\n planet: { // Query for \"planet\" entity.\n \n // No arguments gets all entities.\n\n resolve: {\n species: { // G... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When stop action is triggered by clicking a survey question option, give notice before ending survey | function triggerStopAction(ob) {
$('#stopActionPrompt').dialog({ bgiframe: true, modal: true, width: (isMobileDevice ? $('body').width() : 550),
close: function(){
var obname = ob.prop('name');
var varname = ''
// Undo last response if closing and returning to survey
if (obname.substring(0,8) == '... | [
"function stop_answered(){}",
"function stopSurveyManually() {\n\tvar r = confirm(\"Are you sure you want to manually stop the survey right now?\");\n\t// Flag to see if the OK button has been clicked and reload the page after running the stop command for the survey\n\tvar flagSet = false;\n\tif (r == true) {\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Schedules an operation such as start,stop or restart on a WebAppServer TODO : this has to be reimplemented, as not used today | function scheduleOperationOnWebAppServerInstance(webAppServerInstance, operationName)
{
var history = null;
if (webAppServerInstance == null){
throw "WebAppServerInstance \"" + webAppServerInstanceName + "\" was not found.";
}
var availabilityBefore = webAppServerInstance.getCurrentAvailability();
var conf... | [
"registerCrons(){\n if(cronValidator.isValidCron(this.config.start)){\n cron.schedule(this.config.start, () => {\n let now = new Date;\n let currTime = now.getHours().toString().padStart(2, '0') + ':' + now.getMinutes().toString().padStart(2, '0');\n this.startFXServer(`Schedu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a new article to any element you want, with any header and text you want. | function addArticle(element, header, text, pagePath) {
const newArticle = document.createElement('article');
const newHeader = document.createElement('h1');
const newHeaderText = document.createTextNode(header);
newHeader.appendChild(newHeaderText);
const newParagraph = document.createElement('p... | [
"function addArticle (articleData){\n // Create Basic HTML elements for article\n const articleBody = document.createElement('div' );\n const articleTitle = document.createElement('h2' );\n const articleDate = document.createElement('p' );\n const articleToggle = document.createElement('span');\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removes all stop words, or insignificant words of meaning | function remove_stops(phrase) {
for(var num in stopwords) phrase = phrase.replace(stopwords[num], " ");
return phrase;
} | [
"function _removeStopWords() {\n var fileData = fs.readFileSync(this._options.stopWordFile, 'utf8').toLowerCase();\n var stopwords = JSON.parse(fileData);\n for (var i = stopwords.length - 1; i >= 0; i--) {\n var regex = new RegExp(\"( |^)\" + stopwords[i].replace(/([.*+?^=!:${}()|[\\]\\/\\\\])/g, \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create all channels needed for game to run | #createChannels() {
let permissionOverwrites = createOverrideFromlist(this.players, this.guild);
this.guild.channels.create(`10 Mans Game ${this.snowflake}`, {
type: "category",
position: app.config.parameters.hoist_offset,
reason: "10 Mans game has started",
... | [
"createChannel() {\n\t\tfor (let level = 1; level < this.props.appbaseField.length; level += 1) {\n\t\t\tconst react = this.getReact(level);\n\t\t\t// create a channel and listen the changes\n\t\t\tthis.channelObj[level] = manager.create(this.context.appbaseRef, this.context.type, react);\n\t\t\tthis.channelId[leve... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Chooses an encryption mode from a list of given options. Chooses the most preferred option. | function chooseEncryptionMode(options) {
const option = options.find((option) => exports.SUPPORTED_ENCRYPTION_MODES.includes(option));
if (!option) {
throw new Error(`No compatible encryption modes. Available include: ${options.join(', ')}`);
}
return option;
} | [
"function setEncryptionMode(mode) {\r\n var modes = [\r\n \"aes-128-xts\",\r\n \"aes-256-xts\",\r\n \"aes-128-ecb\",\r\n \"sm4-128-ecb\",\r\n \"none\",\r\n ];\r\n var n = modes.includes(mode);\r\n if (n) {\r\n savedEncryptionMode = mode;\r\n }\r\n}",
"function applyMode(mode, options) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new todo list with the specified title and add it to the list of todo lists. Returns a Promise that resolves to `true` on success, `false` if the todo list already exists. | async createTodoList(title) {
const ADD_TODOLIST = `
INSERT INTO todolists(title, username) VALUES ($1, $2)`;
try {
let result = await dbQuery(ADD_TODOLIST, title, this.username);
return result.rowCount > 0;
} catch (error) {
if (this.isUniqueConstraintViolation(error)) return false;... | [
"createTodoList(title) {\n this._todoLists.push({\n title,\n id: nextId(),\n todos: [],\n });\n\n return true;\n }",
"addNewList(title) {\n let newList = {\n id: nextId(),\n title,\n todos: []\n }\n \n this._todoLists.push(newList);\n return true;\n }",
"c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clone entries to a new destination | function duplicate(entries, parent) {
return entries.map(entry => {
if (entry.type === "folder") {
var newEntry = new Folder({
name: entry.name,
path: (parent.path + "/" + entry.name).toLowerCase()
}, true);
if (entry.contents.length) {
... | [
"function copyEntries(source, target) {\n source.forEach(function (value, key) {\n target.set(key, value);\n });\n }",
"function cloneEntry(entry) {\n\t\tvar clone = {};\n\t\tfor(var key in entry) {\n\t\t\tclone[key] = entry[key];\n\t\t}\n\t\treturn clone;\n\t}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`extractWav` decode wav based on `file` and `label` location, extract the file using MFCC. Return JSON of extracted sample as `data` and `label`. | function extractWav(file, label) {
// decode wav.
let sample;
sample = wav.decode(fs.readFileSync(process.cwd() + '/data/collect/' + label + '/' + file)).channelData[0];
// framing and windowing the sample.
let preSample;
if (preEmphasis !== 0) {
preSample = new Float32Array(sample.length);
for (i ... | [
"function extractAndConvert(filePath) {\n const preEmphasis = 0;\n const sampleRate = 16000;\n const frameSize = 25 / 1000 * sampleRate; // 400\n const frameShift = 10 / 1000 * sampleRate; // 160\n const window = '';\n const fftSize = 512; // based on the next power of 2 from 400 -> 512.\n const lowFreq = 30... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log('afinn.words: ', afinn.words); console.log(get_text_score('ab . adsf. afds QWEvd 3dsd ? 2eeds')); | function get_text_score(text) {
var punctuationless = text.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g, " ");
// S(text).stripPunctuation().s; //My string full of punct
var words = punctuationless.toLowerCase().split(' ');
var sum = 0;
// var unknown_words = [];
_.each(words, function(word) {
if (word in afinn.wor... | [
"function score(text){\n\n //for text, interpret any non letter character besides hyphen as the end of a word\n //javascript split to parse accordingly\n let words_article = text.split(\" \");\n\n //make set of words in webpage\n let set_article = new Set(words_article);\n\n //text from bias txt file: interpr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CarTurn represents a turn that the car is required to make ATTRIBUTES until : number by : number | function CarTurn(until, by){
this.until = until;
this.by = by;
} | [
"set turn(value) { \n this._turn = value;\n }",
"function turnCar(cur, top, turnSpeed) {\n //Cannot use single tenary line as must not change if carAngle = wheelAngle\n carAngle < wheelAngle ? carAngle += (cur / top) * turnSpeed : carAngle;\n carAngle > wheelAngle ? carAngle -= (cur / top) * turnSpee... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the image sheets used by class | setSheets (sheets) {
sheets = sheets || defaults.sheets;
[this.withEnvironment(), this.withImage()].forEach(/**EmojiConvertor*/converter => {
converter.img_sets.apple.sheet = sheets.apple;
converter.img_sets.google.sheet = sheets.google;
converter.img_sets.twitt... | [
"function setCharSheetIcons()\r\n{\r\n\t//go through each image with class \"charSheetImg\" and set its bg\r\n\t$(\".charSheetImg\").each(function(){\r\n\t\tif(this.id != \"\")\t$(this).css(\"background-image\",\"url('/wow-icons/_images/51x51/\"+this.id+\".jpg')\");\r\n\t\telse\t\t\t\t$(this).attr(\"src\",\"images/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Looks for combinations that use the least number of total vials | function findCombosWithLeastVialsUsed(vialCombos) {
let leastUsed = vialCombos[0];
for (let i = 1; i < vialCombos.length; i++) {
if (vialCombos[i].vialsUsed < leastUsed.vialsUsed) {
leastUsed = vialCombos[i];
}
}
return vialCombos.filter((vial) => {
return vial.vialsUsed === leastUsed.vialsUs... | [
"function findCombosWithLeastTypesOfVialsUsed(vialCombos) {\n let leastUsedCombo = vialCombos[0];\n let leastUsedAmount;\n\n if (leastUsedCombo['sizes']) {\n leastUsedAmount = leastUsedCombo['sizes'].length;\n } else {\n leastUsedAmount = 1;\n }\n\n for (let i = 1; i < vialCombos.length; i++) {\n let... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test Albums V1 API side | testAlbums() {
this.albumTest.startAllTests();
} | [
"async getAlbums(){\n const token = await GoogleSignin.getTokens();\n await this.getDbUserData();\n data = {\n URI: 'https://photoslibrary.googleapis.com/v1/albums?excludeNonAppCreatedData=true',\n method: 'GET',\n headers: {\n 'Authorization': 'B... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loop through and render each category's docs If the document is active: render doc section list markup Assemble the final doc list markup | function getDocs(categoryIndex) {
let docsList = []
ToC[categoryIndex].docs.map((d,i) => {
docsList.push(Doc(state, ToC, categoryIndex, i))
})
return `
<div id="docs">
${docsList.join('')}
</div>
`
} | [
"function loadDocsByCategory (catnameparam, maindocobj) {\n var returnstring = \"\";\n\n var cats = maindocobj.categories;\n var catobj; //object referring to the specific category\n var i;\n for (i = 0; i < cats.length; i += 1) {\n if (cats[i].catname === catnameparam) {catobj = cats[i]; brea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clear all letter highlighting | function unhighlightAll() {
for (var row=0; row<cipher[which].length; row++) {
for (var col=0; col<cipher[which][row].length; col++) {
u(row+"_"+col);
}
}
} | [
"function clearHighlights() {\n $('.highlightWord').each(function () {\n $(this).removeClass('highlightWord');\n });\n}",
"clearHighlight() {\n\t\tthis.setHtml()\n\n\t\tthis.updateRootHtml()\n\t}",
"function clearAll() {\n if (activeHighlight && activeHighlight.applied) {\n active... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs a new AuditRecordBean. An audit record. | constructor() {
AuditRecordBean.initialize(this);
} | [
"function AuditRecordBean() {\n _classCallCheck(this, AuditRecordBean);\n\n AuditRecordBean.initialize(this);\n }",
"function HistoryRecord() {\n _classCallCheck(this, HistoryRecord);\n\n HistoryRecord.initialize(this);\n }",
"function BeanRecord$(data/*:Model*/) {\n this.super$1W0I(data);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is just so that we don't run out of memory while recording a lot of spans. At some point we just stop and flush out the start of the trace tree (i.e.the first n spans with the smallest start_timestamp). | add(span) {
if (this.spans.length > this._maxlen) {
span.spanRecorder = undefined;
} else {
this.spans.push(span);
}
} | [
"_addToBuffer(span) {\n this._finishedSpans.push(span);\n this._maybeStartTimer();\n if (this._finishedSpans.length > this._bufferSize) {\n this._flush();\n }\n }",
"getTransactionTraces(start, end, batchSize=100000){\n\t\tthis.assertConnected();\n\n\t\t//TODO: If an erro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wrapper for jumper.render(). Returns a promise when complete. | render(block) {
return new Promise(resolve => {
jumper.render(block)
resolve()
})
} | [
"function render(view, context) {\n return new Promise(function(resolve, reject) {\n nunjucks.render(view, context, function(err, result) {\n if (err) {\n reject(err);\n } else {\n resolve(result);\n }\n });\n });\n}",
"function render() {\n renderResources();\n renderProgre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify if NGSIv2 id value has NGSILD id syntax requirements. Entry: Param with NGSIv2 id value. Return: Array with two possible elements (type and id). | function UrnPattern(ocbId) {
//If entity ID has ":" an error will occur.
//var re = /urn:ngsi-ld:(.+):(.+)/
//return ocbId.replace(re, '$1#$2').split('#')
//If entity ID has ":" an error will not occur, but if entity type has ":" an error will occur.
var pattern = /\s*:\s*/;
var ocbIdList = ocbId.split(pa... | [
"function validateIds(ids) {\n /* create id table depending on netjson_el */\n var table = {};\n for(var x in netjson_el.node) {\n try {\n table[netjson_el.node[x].__data__.id] = true;\n }\n catch(err) {\n // parent node <g>, just pass it\n }\n }\n\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Countdown is how much time there is between each frame. | getCountdown() {
return this.frameRate * (11 - this.level);
} | [
"function countdown() {\n // timeRemaining is incremented down\n timeRemaining --;\n\n // If time runs out, runs gameOver()\n if (timeRemaining <= 0) {\n gameOver();\n }\n\n // Updates the timer element\n timer.text(timeRemaining);\n }",
"frameCount()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If we have one added skill we have one column otherwise we have two columns | columnsOfAddedSkils() {
return this.lengthOfAllAddedSkills == 1 ? 1 : 2;
} | [
"function createColumn(start, stop){\n\n\tlet storeInfo = \"\";\n\t\n\tstoreInfo = storeInfo + '<div class=\"col-3\" id=\"skills_row\">';\n\t\n\tfor(let i=start; i < stop; i++){\n\t\tstoreInfo = storeInfo + '<div class=\"skill_box\">' +\n\t\t\t'<div data-hidden=\"' + hiddens[i] + '\" data-title=\"' + titles[i] + '\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies internal CSS class names for the template attribute, so that styles can use the class name instead of compound ampstorygridlayer[template="..."] selectors, since the latter increases CSS specificity and can prevent users from being able to override styles. | applyTemplateClassName_() {
if (this.element.hasAttribute(TEMPLATE_ATTRIBUTE_NAME)) {
const templateName = this.element.getAttribute(TEMPLATE_ATTRIBUTE_NAME);
const templateClassName = GRID_LAYER_TEMPLATE_CLASS_NAMES[templateName];
this.element.classList.add(templateClassName);
}
} | [
"addStyleClass(template, el) {\r\n this.clear(el);\r\n if (template) {\r\n this.currentTemplate = template;\r\n (el !== null && el !== void 0 ? el : this.host).classList.add(this.currentTemplate);\r\n this.cd.markForCheck();\r\n }\r\n }",
"function changeTe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
OBJECT Gene ( ARRAY deck [INTEGER index] = OBJECT Card ) | function Gene(deck)
{
this.deck = deck;
this.placeCount = PlayOneGame(deck);
} | [
"generateDeck() {\n const deck = [];\n for (const suitidx in SUITS){\n for (const index in FACEVALUES){\n deck.push(new Card(SUITS[suitidx], VALUES[index], FACEVALUES[index]));\n }\n }\n return deck;\n }",
"function make_deck(rawDeck) {\n var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function :handleColourItemClick Called on a custom menu item click. Updates the 'colour' of a client in DB with a number between 0 and 5, representing 6 differnet colour options | function handleColourItemClick() {
var dynamicData = {},
newColour = 0,
$clientRow = {};
newColour = $(this).attr("data-action");
$clientRow = $(".clicked-client").closest("tr");
dynamicData["id"] = $clientRow.attr("data-id");
dynamicData["colour"] = newColour;
$clientRow.attr("d... | [
"function colorChange(e) {\r\n let itemIdx = rndNum(options.length);\r\n const item = document.querySelector(\"#item-\" + itemIdx);\r\n item.style.backgroundColor = \"yellow\";\r\n item.style.border = \"thick double #008080\";\r\n}",
"function onColourPressed(in_value) \n{\n\t// Play the click sound.\n\tplayS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Service Get Service data tenant: tenant name servicename: service name | getServiceData(tenant, servicename, callback)
{
if(!r3IsSafeTypedEntity(callback, 'function')){
console.error('callback parameter is wrong.');
return;
}
let _callback = callback;
let _error;
if(r3IsEmptyStringObject(tenant, 'name') || r3IsEmptyString(servicename, true)){
_error = new Error('tenant('... | [
"getServiceData(tenant, servicename, callback)\n\t{\n\t\tif(!r3IsSafeTypedEntity(callback, 'function')){\n\t\t\tconsole.error('callback parameter is wrong.');\n\t\t\treturn;\n\t\t}\n\t\tlet\t_callback\t= callback;\n\t\tlet\t_error\t\t= null;\n\t\tif(r3IsEmptyStringObject(tenant, 'name') || r3IsEmptyString(servicena... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render claim button when a new item is added. | renderClaimButton(item) {
return (
<div>
<div>
<button type="button" className="btn btn-default" data-toggle="modal" data-target={"#myModal"+item._id}>Claim</button>
</div>
{this.renderQuantityModal(item)}
</div>
)
} | [
"_appendNewItemButton() {\n const that = this,\n addNewItemButton = document.createElement('smart-button');\n\n addNewItemButton.innerHTML = '+';\n addNewItemButton.animation = that.animation;\n addNewItemButton.disabled = that.disabled;\n addNewItemButton.unfocusable =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for stopPipeline / Signal the stop of a pipeline and all of its steps that not have completed yet. | stopPipeline(incomingOptions, cb) {
const Bitbucket = require('./dist');
let apiInstance = new Bitbucket.PipelinesApi(); // String | The account // String | The repository // String | The UUID of the pipeline.
/*let username = "username_example";*/ /*let repoSlug = "repoSlug_example";*/ /*let pipelineUuid ... | [
"abort() {\n // todo: Test\n // todo: Make abort return a Promise. We can wait to see if state has aborted, then return true when it has.\n if(this.__aborted){\n this._log(1, \"Already aborted...\");\n return;\n }\n\n // Step 1.\n // If the current unr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs the discover API call for the supplied Thing, and returns any associated Greengrass groups/cores/connection info. | discover(thing_name) {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
this.connection_manager.acquire()
.then((connection) => {
const request = new aws_crt_1.http.HttpRequest('GET', `/greengrass/discover/thing/${thing_name}`, ne... | [
"async discover() {\n const config = this.config;\n if (!config.discovery) return; // no discovery set.\n let discoveredNodes = [],\n nodeMap = {}; // for uniqueness\n\n function parseItem(item) {\n if (typeof item === 'object' && item && item.ip) {\n item = `${item.ip}:${item.port || c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
run the test, this overrides the normal run of GetPostsTest | run (callback) {
// we need them sorted for pagination to make sense, expectedPosts is what we'll
// be comparing the results to
this.expectedPosts.sort((a, b) => {
return a.id.localeCompare(b.id);
});
// figure out the number of pages we expect
this.numPages = Math.floor(this.postOptions.numPosts / this... | [
"function _runTest() {\n\t\t\t_allTests[_testOptions.test.name](\n\t\t\t\t_testOptions.test, {log: _log, error: _error});\n\t\t}",
"function run() {\n var func_name;\n\n for (tst in TestCase) {\n func_name = tst.toString();\n if (func_name.indexOf('test_') > -1) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gera os atributos do personagem usando as tabelas do modo. | function _GeraAtributos(modo, submodo) {
var valores = null;
if (modo == 'elite') {
valores = [ 15, 14, 13, 12, 10, 8 ];
} else {
valores = [ 13, 12, 11, 10, 9, 8 ];
}
if (gPersonagem.classes.length == 0) {
// Nunca deve acontecer.
Mensagem('Personagem sem classe');
return;
}
var prim... | [
"function _AtualizaModificadoresAtributos() {\n // busca a raca e seus modificadores.\n var modificadores_raca = tabelas_raca[gPersonagem.raca].atributos;\n\n // Busca cada elemento das estatisticas e atualiza modificadores.\n var atributos = [\n 'forca', 'destreza', 'constituicao', 'inteligencia', 'sabedo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a complete child for a given server snap after applying all user writes or null if there is no complete child for this ChildKey. | function writeTreeCalcCompleteChild(writeTree, treePath, childKey, existingServerSnap) {
var path = pathChild(treePath, childKey);
var shadowingNode = compoundWriteGetCompleteNode(writeTree.visibleWrites, path);
if (shadowingNode != null) {
return shadowingNode;
}
else {
if (existing... | [
"function writeTreeCalcCompleteChild(writeTree, treePath, childKey, existingServerSnap) {\r\n const path = pathChild(treePath, childKey);\r\n const shadowingNode = compoundWriteGetCompleteNode(writeTree.visibleWrites, path);\r\n if (shadowingNode != null) {\r\n return shadowingNode;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the driver's name | getDriverName() {
console.log(`the driver's name is ${this.driver.getDriverName()}`)
return this.driver.getDriverName()
} | [
"function getDriverName() {\n var parts = __dirname.replace(/\\\\/g, '/').split('/');\n return parts[parts.length - 1].split('.')[0];\n}",
"get name() {\n this.boot();\n return this.driver.name;\n }",
"get driverName() {\n return this.constructor.name.toLowerCase();\n }",
"getDriver... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read the temperature ten times, printing both the Celsius and equivalent Fahrenheit temperature, waiting one second between readings | function temp_sensor() {
var celsius = temp.value();
var fahrenheit = celsius * 9.0/5.0 + 32.0;
console.log(celsius + " degrees Celsius, or " +
Math.round(fahrenheit) + " degrees Fahrenheit");
deviceClient.publish("status","json",'{"d" : { "temperature" : '+ celsius +'}}')... | [
"function readTemperature() {\n var temp = state.enclosureTemp = sensor.readF(state.enclosureProbeId, 4, readProbeCallback);\n if (state.fermenterProbeId != null) {\n temp = state.fermentationTemp = sensor.readF(state.fermenterProbeId, 4, readProbeCallback);\n }\n}",
"async function measureTemperature() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to set 'mineMap' with mines data | function setMines() {
for (let i = 0; i < numberOfMines; i++) {
mineMap[getRandom()] = 1;
}
} | [
"setMapAndSpawns(map, spawns){\n\t\tthis.map = new Map(null, map, spawns);\n\t}",
"function setMinesInTheModel() {\r\n var minesAvailable = gLevel.MINES;\r\n var mineX = generateRandomCoordinate(gLevel.SIZE);\r\n var mineY = generateRandomCoordinate(gLevel.SIZE);\r\n while (minesAvailable > 0) {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rendering volume graph from sale data. | function renderVolumeGraph() {
if (graphInterval > 0) {
timeLeft -= 1000;
} else {
clearInterval(graphInterval);
}
var dataSet = [];
var clientRequest = "clientId=" + "-1";
var ajax = $.ajax({
type : "GET",
url : "http://localhost:8080/sale",
data : clientRequest,
dataType : "json",
success : func... | [
"function addVolumeGraph(id,coin,unit,x,y_volume,start,end, min, max, first){\n volumes = [];\n for(i = 0 ; i < x.length ; i++){\n if(x[i] >= start && x[i] <= end){\n volumes.push([x[i], y_volume[i]]);\n }\n }\n volumes.sort();\n title = coin + \" Charts\";\n y_axis = \"Vo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
object for applications, including their runtime logic and their file icons that reside on the desktop / [ all common attributes of a application object] x = x position of application icon y = y position of application icon w = width of application window h = height of application window win_x = x position of applicati... | constructor(x,y,pic,w,h,win_x, win_y){
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.icon = loadImage(pic);
this.win = createGraphics(w, h); // the window is made by using p5 createGraphics(); needs image() to display it
this.win_x = win_x;
this.win_y = win_y;
this.drag = fal... | [
"get desktop_windows () {\n return new IconData(0xe30c,{fontFamily:'MaterialIcons'})\n }",
"function setDesktopIcons(){\t}",
"function getWindowIcon(_name) {\n\t\tif (_name === 'Horseboard') {\n\t\t\treturn imagePath.board_horse_focus;\n\t\t} else if (_name === 'Salesboard') {\n\t\t\treturn imagePath.board_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End of: /OpenForum/Giraffe/Core/radialcolor.js ==============================================================================================================// ==============================================================================================================// / Source: /OpenForum/Giraffe/Core/gradientcolor... | function GradientColor(canvas,color1,color2,x1,y1,x2,y2) {
/**#@+
* @memberOf RadialColor
*/
this.canvas = canvas.canvasContext;
this.colorStop = new Array();
this.colorStop[0] = [0,color1,x1,y1];
this.colorStop[1] = [1,color2,x2,y2];
this.getColor = function() {
gradient = this.canvas.createLinearGradien... | [
"static createRadialGrad(colors) {\n return Color._gradientFunc('rad', colors);\n }",
"function colorgrad() {\n var args = Array.prototype.slice.call(arguments)\n , arraymath = require('./arraymath')\n , spec\n , cstep\n , c1 = args[0]\n , c2 = null\n , rgb1\n , rgb2\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Imports the one file given by fileLocation | function importFile(fileLocation) {
projectItems = project.rootFolder.items;
var driveFolder;
if (projectItems.length == 0) {
driveFolder = project.items.addFolder('Google Drive Downloads');
}
// Scans each project item and adds the Google Drive Downloads folder if it doe... | [
"function importFromFile() {\n var file = dialog.showOpenDialog({\n \"title\": i18n.__(\"Import from file\"),\n \"filters\": [{\n \"name\": 'PHP files',\n \"extensions\": ['php', 'phtml', 'tpl', 'ctp']\n }],\n });\n\n if (file) {\n fs.readFile(file[0], \"utf8\", importReady);\n }\n}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
mapAsync := (Continuable, lambda: (A, Callback)) => Continuable | function mapAsync(source, lambda) {
return function continuable(callback) {
source(function continuation(err, value) {
if (err) {
return callback(err)
}
lambda(value, callback)
})
}
} | [
"function mapAsync(source, lambda) {\n bind(source, function(value) {\n return function continuable(callback) {\n lambda(value, callback)\n }\n })\n}",
"map(func) {\n let ret = new AsyncRef(func(this._value));\n let thiz = this;\n (function select() {\n thiz._callbacks... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new offset rect full of NaN's. | function makeOffsetRect() {
return { top: NaN, left: NaN, width: NaN, height: NaN };
} | [
"function cloneOffsetRect(rect) {\n return {\n top: rect.top,\n left: rect.left,\n width: rect.width,\n height: rect.height\n };\n}",
"function createRect() {\n return { top: NaN, left: NaN, width: NaN, height: NaN };\n}",
"_adjustBounds(bounds, offset) {\n // Prevent i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert a callstack to a multiline text string in standard C exception printout format | function callStackToText (callStack)
{
callStackLines = callStack.map(function(callStackEntry) {
// Example: at MyClass.MyMethod(type args) in c:\\project\\source.cs:line 27\n
return " at " + callStackEntry['function'] + " in " + callStackEntry['file'] + ":line " + callStackEntry['line'] + "\n";
});
ca... | [
"function CallStack_toString()\n{\n\tvar s = new String();\n\tfor( var i = 1; i <= this.mStack.length; ++i )\n\t{\n\t\tif( s.length != 0 )\n\t\t\ts += \"\\n\";\n\t\ts += i.toString() + \": \" + this.mStack[i-1];\n\t}\n\treturn s;\n}",
"function PrepareExceptionStacktraceForOutput (e) {\n\tvar txt = e.stack ? e.st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validation Rules UOM be <= length limit defined in global | static validateUOMExceedsLength(pageClientAPI, dict) {
//New short text length must be <= global maximum
let error = false;
let message;
let max = libCom.getAppParam(pageClientAPI, 'PART', 'UOMLength');
if (libThis.evalIsTextItem(pageClientAPI, dict)) {
if (... | [
"static validateUOMExceedsLength(pageClientAPI, dict) {\n\n //New short text length must be <= global maximum\n let error = false;\n let message;\n let max = libCom.getAppParam(pageClientAPI, 'PART', 'UOMLength');\n\n if (libThis.evalIsTextItem(pageClientAPI, dict)) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets list of faculties | async function getFacultiesList() {
try {
const snapshot = await majorsRef.child('faculties').once('value');
const val = snapshot.val();
const list = Object.keys(val).map((key) => ({
key,
name: val[key]
}));
return { err: null, list };
} catch (err) {
return { err, list: null };
... | [
"static async faculties() {\n\t\treturn await models.Faculty.findAll({\n\t\t\torder: [['title', 'ASC']]\n\t\t})\n\t}",
"async function getFacultiesList() {\n try {\n const snapshot = await majorsRef.child('faculties').once('value');\n const val = snapshot.val();\n const list = Object.keys(val).map((key)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Unlike the other versions, we expect the value to be in the form of two arrays where value[0] << 32 + value[1] would result in the value that we want. | function wgint64(value, endian, buffer, offset)
{
if (endian == 'big') {
wgint32(value[0], endian, buffer, offset);
wgint32(value[1], endian, buffer, offset+4);
} else {
wgint32(value[0], endian, buffer, offset+4);
wgint32(value[1], endian, buffer, offset);
}
} | [
"function arrayPacking(a) {\n\treturn parseInt(a.reverse().map(el => {\n\t\tif (el.toString(2).length === 8) {\n\t\t\treturn el.toString(2);\n\t\t} else {\n\t\t\tconst dif = 8 - el.toString(2).length;\n\t\t\treturn \"0\".repeat(dif) + el.toString(2);\n\t\t}\n\t}).join(\"\"), 2);\n\n\t//a.reduceRight((pre, val) => ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes a trail from a user's list of trails. | function removeTrailFromUser(trail){
// Find the trail to remove.
var uniqueId = trail.unique_id;
var currentUser = vm.currentUser;
for(i = 0; i < currentUser.trails.length; i++){
if(currentUser.trails[i].unique_id == uniqueId){
var re... | [
"removeTrail (name) {\n\t\tlet trailRemoved = false;\n\t\tfor (let i = 0; i < this.trails.length; i++) {\n\t\t\tif (this.trails[i].trailName === name) {\n\t\t\t\tthis.trails.splice(i, 1);\n\t\t\t\ttrailRemoved = true;\n\t\t\t}\n\t\t}\n\t\treturn trailRemoved;\n\t}",
"function hideTrail() {\n currentTrail.forEa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uses the conclusions table to create or set a conclusion | setConclusion(conclusion) {
return this.findConclusion({ where: { path: conclusion.path } })
.then((dbConclusion) => {
if (dbConclusion) {
return dbConclusion.update(conclusion);
}
else {
return this.db.Conclusion.create(conclusion);
}
});
} | [
"findAllConclusions(query) {\n return this.sync.then((db) => db.Conclusion.findAll(query));\n }",
"findConclusion(query) {\n return this.sync.then((db) => db.Conclusion.findOne(query));\n }",
"function loadConditionalInclusionDependency() {\n Results.get($scope.conditionalInclusionDependency.params, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
After clearing the electron app path, copies a fresh skeleton. | async make() {
try {
this.log.verbose(`clearing ${this.$.env.paths.electronApp.rootName}`);
await this.clear();
} catch (e) {
this.log.error(
`error while removing ${this.$.env.paths.electronApp.root}: `, e
);
process.exit(1);
... | [
"copySkeletonApp() {\n this.log.verbose('copying skeleton app');\n try {\n shell.cp(\n '-rf',\n join(this.$.env.paths.meteorDesktop.skeleton, '*'),\n this.$.env.paths.electronApp.appRoot + path.sep\n );\n } catch (e) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create setter for ball velocity in the Y direction | set ballVelocityY(value){
this._ballVelocityY = value;
} | [
"get ballVelocityY(){\n return this._ballVelocityY;\n }",
"setBallVel() {\r\n this.audio.play();\r\n if (this.click === 0) {\r\n this.ball.vy = Math.min(this.canvas.height * 0.015, 9);\r\n this.click++;\r\n }\r\n else\r\n this.ball.vy = Math.m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers a function used to determine what prefixes to use on a permessage basis. Returns a string or an array of strings that should be recognized as prefixes for the message, or `undefined` to specify that the default prefix should be used. If the `allowMention` client option is set, mentions will work regardless of... | prefixes(func) {
if (this.prefixFunction) {
process.emitWarning('Client.prefixes called multiple times');
}
this.prefixFunction = func;
return this;
} | [
"registerPrefixes() {\n let prefixes = [];\n\n _.each(app.bot.commands, command => {\n if (prefixes.indexOf(command.prefix) === -1) {\n prefixes.push(command.prefix);\n }\n });\n\n app.bot.commandPrefixes = prefixes;\n }",
"function onPrefixFound... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
take out self memberof from file path. | _$memberof() {
super._$memberof();
this._value.memberof = this._pathResolver.filePath;
} | [
"['@_memberof']() {\n super['@_memberof']();\n if (this._value.memberof) return;\n this._value.memberof = this._pathResolver.filePath;\n }",
"function memberPath (path) {\n return path.match(R.NODE_MEMBERS)[0]\n}",
"findOnPath(path, f) {\r\n return this.findOnPath_(path, newEmptyPath(), f)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the cooldown animation for each skill button | function skillsCooldownAnimation(index) {
let c = skills[index].coolDown/1000;
skills[index].HTMLelement.innerHTML = c + "s";
skills[index].HTMLelement.style.fontSize = "2vw";
skills[index].HTMLelement.style.color = "#EC6F28";
let int = setInterval(() => {
c--;
skills[index].HTMLelement.innerHTML = c ... | [
"updateCooldowns(){\n let i = this._abilities.length;\n while (i--) {\n let ability = this._abilities[i];\n if (ability.cooldown && ability.time) {\n ability.time--; \n } \n }\n }",
"function GoOnCooldown() {\n\tonCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to change the style of polygons | function updateStyle(){
var polystroke = new ol.style.Stroke ({
color : $('#bg').val(),
width: $('#size').val()
});
var polystyle = new ol.style.Fill ({
color: $('#color').val()
});
var style = new ol.style.Style({
fill: polystyle,
stroke: polys... | [
"function polygonStyle() {\n return {\n fillColor: \"#ffa500\",\n color: \"#b84700\",\n weight: 0.8,\n opacity: 0.2,\n fillOpacity: 0.5\n }\n}",
"getPolygonStyle() {\n return {\n weight: 0.5,\n opacity: 0.8,\n color: \"black\",\n fillColor: \"rgba(25... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Colorizes and concatenates all network warnings. Returns text and textWidth. | function getNetworkWarnings()
{
// Remove outdated messages
for (let guid in g_NetworkWarnings)
if (Date.now() > g_NetworkWarnings[guid].added + g_NetworkWarningTimeout ||
guid != "server" && !g_PlayerAssignments[guid])
delete g_NetworkWarnings[guid];
// Show local messages first
let guids = Object.keys... | [
"function lengthWarning() {\r\n if (quote.length >= 140) {\r\n\r\n var string = quote.length.toString()\r\n string = string.fontcolor(\"red\");\r\n $(\"#CharacterCount\").html(string + ' Characters');\r\n\r\n };\r\n if (quote.length <= 140) {\r\n\r\n $(\"#CharacterCount\").html(quote.le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Defines a CodeStar Notification rule which triggers when an approval rule is overridden. | notifyOnApprovalRuleOverridden(id, target, options) {
return this.notifyOn(id, target, {
...options,
events: [RepositoryNotificationEvents.APPROVAL_RULE_OVERRIDDEN],
});
} | [
"notifyOnApprovalStatusChanged(id, target, options) {\n return this.notifyOn(id, target, {\n ...options,\n events: [RepositoryNotificationEvents.APPROVAL_STATUS_CHANGED],\n });\n }",
"bindAsNotificationRuleTarget(_scope) {\n // SNS topic need to grant codestar-notific... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Listener Function Updating Food Nickname | function updateNickname(newNick) {
$("#foodNickname").text(newNick.nickname);
} | [
"function updatePlayerNickname(nickname) {\n console.log(\"Changing nickname...\");\n currentPlayer.nickname = nickname;\n socket.emit(\"updatePlayerName\", {\n \"id\": currentPlayer.id,\n \"name\": nickname\n });\n }",
"function updateNicknameField(event){\n\t\tlastNickname = even... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine a 'default nomenclatural code' for this Phyx file. There are two ways to do this: 1. If the Phyx file has a 'defaultNomenclaturalCodeIRI' property, we use that. 2. Otherwise, we check to see if every phyloref in this file has the same nomenclatural code. If so, we can use that code. If not, i.e. if any of the... | get defaultNomenCode() {
if (has(this.phyx, 'defaultNomenclaturalCodeIRI')) return this.phyx.defaultNomenclaturalCodeIRI;
const nomenCodes = (this.phyx.phylorefs || [])
.map(phyloref => new PhylorefWrapper(phyloref).defaultNomenCode);
const uniqNomenCodes = uniq(nomenCodes);
if (uniqNomenCodes.len... | [
"get defaultNomenCode() {\n // Check to see if we have a single nomenclatural code to use.\n if (this.uniqNomenCodes.length === 1) return this.uniqNomenCodes[0];\n\n // If one or more of our specifiers have no nomenclatural code (e.g. if\n // they are specimens), they will show up as owlterms.UNKNOWN_CO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test get request count | function test_getRequestCount() {
assert.isNumber(hfapi.getRequestCount(), 'Total request count should be a number.');
} | [
"function requestCount() {\n let body = {\n type: \"count\",\n args: {\n table: \"request\"\n }\n };\n\n requestOptions.body = JSON.stringify(body);\n fetch(process.env.DATA_WEBHOOK_URL, requestOptions)\n .then(response => {\n return response.json();\n })\n .then(result => {\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the attribute of all of the events | _setAll(attr, value) {
this._forEach(event => {
event[attr] = value;
});
} | [
"_setAll(attr, value) {\n this._forEach(event => {\n event[attr] = value;\n });\n }",
"setEvents(events) {\n this.reset();\n this.events = events;\n for (const event of events) {\n this.updateListeners({\n type: 'event',\n value: { event: e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
triggered when a stream is clicked on | click (stream) {
if (this.current) {
this.current.state = null;
this.player.stop();
}
if (stream == this.current) {
this.current = null;
} else {
this.current = stream;
this.current.state = 'buffering';
// console.log('this.current.uid'+th... | [
"function doStreamClick()\n{\n\tvar map = null;\n\tvar list = null;\n\tvar tabs = null;\n\t\n\t// Debug\n\tconsole.log( 'Stream.' );\n\t\n\t// Already viewing this tab\n\tif( this.className.indexOf( 'selected' ) >= 0 )\n\t{\n\t\tconsole.log( 'Already active.' );\n\t\treturn;\n\t}\n\t\n\t// Switch visual indicator\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the sort direction cycle to use given the provided parameters of order and clear. | function getSortDirectionCycle(start, disableClear) {
let sortOrder = ['asc', 'desc'];
if (start == 'desc') {
sortOrder.reverse();
}
if (!disableClear) {
sortOrder.push('');
}
return sortOrder;
} | [
"function getSortDirectionCycle(start, disableClear) {\n var sortOrder = ['asc', 'desc'];\n\n if (start == 'desc') {\n sortOrder.reverse();\n }\n\n if (!disableClear) {\n sortOrder.push('');\n }\n\n return sortOrder;\n }",
"toggleOrder() {\n let ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
deep clone the given HTML node, removing teh unique id field | static cloneNode(el) {
const node = el.cloneNode(true);
node.removeAttribute('id');
return node;
} | [
"function cloneNodeWithoutIds(elementId) {\n var clone = document.getElementById(elementId).cloneNode(true);\n var descendants = clone.getElementsByTagName(\"*\");\n for (var i = 0; i < descendants.length; i++) {\n var element = descendants[i];\n element.removeAttribute(\"id\");\n }\n\n return clone;\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
remove all expired tickets | function removeExpiredTickets() {
var now;
var removed;
logger.silly('run "remove obsolete tickets"');
now = new Date().getTime();
removed = _.remove(tickets, function (ticket) {
return ticket.validUntil < now;
});
if (removed.length) {
logger.verbose(removed.length + ' t... | [
"removeExpiredTokens() {\n Object.keys(this.cache).forEach((t) => {\n if (!this.tokenIsValid(this.cache[t])) {\n this.removeToken(t);\n }\n });\n }",
"function cleanUpExpiredTokens() {\n\tvar now = Date.now()/1000;\n\tfor (var webstrateId in accessTokens) {\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds "dead" colored graphic. | function addGraphicsDead() {
if (graphicsDead) { graphicsDead.kill(); }
graphicsDead = drawRect(
RECT_DEAD_X,
RECT_DEAD_Y,
RECT_DEAD_W,
RECT_DEAD_H,
RECT_DEAD_COLOR,
);
groupDead.add(graphicsDead);
} | [
"function dead() {\r\n\t\tctx.clearRect(0, 0, cw, ch);\r\n\t\tctx.fillStyle = \"white\";\r\n\t\tctx.font = ch*2/15 + \"px Lucida Console\";\r\n\t\tctx.fillText(\"You are Dead!\", cw/6, ch/2, cw*2/3);\r\n\t\tctx.font = ch*1/25 + \"px Lucida Console\";\r\n\t\tctx.fillStyle = \"#ccc\";\r\n\t\tctx.fillText(\"History Hi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================================================================ Asynced function that waits for the ajaxrequest to finish before returning the topTracks array form the response. This because slightly longer timespand for parsing the jsonojbect. ============================================================== | async function getTopTracks(bandSearched) {
console.log("getTopTracks");
await $.ajax({
type : 'POST',
url : 'http://ws.audioscrobbler.com/2.0/',
data : 'method=artist.gettoptracks&' +
'artist='+bandSearched+'&' +
'api_key=57ee3318536b23ee81d6b27e3... | [
"function fetchTracks() {\n $.ajax({\n type: \"GET\",\n url: \"http://api.musixmatch.com/ws/1.1/track.search\",\n data: {\n apikey: \"af8763b8168a8ce43b3f473c4832754e\",\n q_artist: $(\"input\").val(),\n page_size: 4,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define a function to filter releases. | function filterRelease(release) {
// Filter out prereleases.
return release.prerelease === true;
} | [
"function filter() {}",
"function filterRelease(release) {\n // Filter out prereleases.\n return release.prerelease === false;\n }",
"filterPrereleaseVersions(versions)\n {\n return versions;\n }",
"function CustomFilter() {}",
"function filterNewReleases() {\n\tvar newReleases = [\n\t\t{\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Class configuration return the icons & label related to this control | static get definition() {
return {
icon: '',
i18n: {
default: 'Image'
}
};
} | [
"getIcon() {\r\n return this.THEME_CLASS[this.severity][0];\r\n }",
"get iconSize(){ return this.__label.text; }",
"function IconOptions() {}",
"static GetIconsForTargetGroup() {}",
"function IconOptions() { }",
"get class_ () {\n return new IconData(0xe86e,{fontFamily:'MaterialIcons'})\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
stock currently above prior day open | function aboveOpenF(stock, stockAwayPctF) {
if (stock.popn > stock.last) {
return true;
}
} | [
"stockPrevious(stockSymbol) {\n return this.request(`/stock/${stockSymbol}/previous`);\n }",
"function openingTick(index,ensureInSource){var date=dateFromTick(index);var marketOpen=market.getOpen(date)||defaultOpen(date);var tick=tickFromDate(marketOpen);if(!ensureInSource)return tick;// value may be ou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generates numbers [lb... ub1] | function NumberRangeGenerator(lb, ub){
this.lb = lb
this.ub = ub
} | [
"generateRange(floor, ceil) {\n return Array.from({ length: ceil - floor }, (_v, k) => k + floor);\n }",
"function generateNumbers(start, end){\n let values = [];\n\n for(let i=start; i<=end;i++){\n values.push(i);\n } \n return values;\n}",
"function gml_Script_maza_irandom_range( ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
use a promise to wait for each function to finish before calling the next transform all 3 contacts sequentially | async function transformAllContactInfo(){
smoothScrollToEle(document.getElementById('container-contact'));
return new Promise(function(resolve, reject) {
resolve(emailTransform());
}).then(function(result) {
//console.log(result);
return phoneTransform();
}).then(function(result)... | [
"function processContacts() {\n var channelNames = [];\n var contacts = [];\n\n return fetchBuddiesFromHost()\n // save newly parsed buddies to db\n .then(function (buddies) {\n return contactMappingManager.batchDatabaseOpperation(contactMappingManager.saveBuddy, buddies);\n })\n .then(function (result) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a method that returns the current CSS class of the sort Options | getSortByClass(sortByOption) {
if (this.state.sortBy === sortByOption) {
return 'active';
} else {
return '';
}
} | [
"sortClass(){\n return {\n 'sort-btn': true,\n 'sort-asc icon-down': this.column.sort === 'asc',\n 'sort-desc icon-up': this.column.sort === 'desc'\n };\n }",
"getSortByClass(sortByOption) {\n if (sortByOption === this.state.sortBy) {\n return 'active';\n }\n return '';\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ind is the location to play, n is the value return new board with location played | play(ind, n) {
var o = this.copy();
o.board[ind] = n;
o.update(ind);
NEIGHS[ind].forEach(neigh => { o.update(neigh); });
o.calcScore();
return o;
} | [
"function openPlayDiag(n,board) {\n if (n==1) {\n for (let i=0; i<board.length; i++) {if (board[i][i]=='') return [i,i];}\n }\n else {\n for (let j=board.length-1,i=0; i<board.length; j--,i++) {if (board[i][j]=='') return [i,j];}\n }\n return '';\n}",
"function initiateBoard(){\n\tbla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves stored configuration from localStorage, convert to object | function getOptions() {
var options = JSON.parse(localStorage.getItem("options"));
//console.log("read options from storage as object");
//console.log("options.ip: " + options.ip);
//console.log("options.accel: " + options.accel);
return options || {};
} | [
"function loadConfig() {\n const configAsString = localStorage.getItem(\"readerConfig\");\n try {\n const config = JSON.parse(configAsString);\n return config;\n } catch (e) {\n return {};\n }\n}",
"static load() { return JSON.parse(window.localStorage.getItem('settings')) || {}; }",
"function read... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Queries backend for physicians. Chooses appropriate HTTP route and query atring based on sorting controls & query text. This will populate physician's specialties on separate requests (physician query is lazy) | function queryPhysicians (pageDirection) {
scope.querying = true
var newPage = 0
if (typeof pageDirection === 'number') {
newPage = scope.page + pageDirection
newPage = Math.min(newPage, scope.totalPages - 1)
newPage = Math.max(0, newPage)
}
... | [
"async getAllPhysicians(req, res) {\n let data = await this.db.physician.select.all().catch(this.throwError);\n this.sendResponse(res, this.HttpStatus.OK, true, data, \"Success retrieving all physicians\");\n }",
"function querySpecialties (pageDirection) {\n scope.querying = true\n var n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets an array of all friends' facebook ids user: guy to look up https: shttp object from require callback: called with list when request is done | function getFriendIDs(user, https, callback) {
var options = {
host: 'graph.facebook.com',
port: 443,
path: '/me/friends?&access_token=' + user.access_token
};
https.get(options, function(response) {
if (response.statusCode != 200) {
console.error("https status code " + response.statusCode)... | [
"function getFriends(next) {\n\ttwitter.get('friends/ids', { screen_name: config.screen_name, count: 100 }, function(err, data) {\n\n\t\t// If we have the IDs, we can look up user information\n\t\tif (!err && data) {\n\t\t\treturn lookupUsers(data.ids, next);\n\t\t}\n\n\t\t// Otherwise, return with error\n\t\t// el... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the AWS resource type. | getResourceType() {
return super.getAsNullableString("resource_type");
} | [
"static get RESOURCE_TYPE() {\n return (RESOURCE_TYPE);\n }",
"function getResourceType(type) {\n // destructure resource name\n var typeName = type, typeArgument = '';\n if (isParameterizedTypeFormat(type)) {\n typeName = getParameterizedTypeName(type); //e.g. `AWS::S3::Bucket`\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funtion to build a pie, displayint data in "datapie" at a place in the HTLM form (placepie) | function buildPieChart(datapie, placepie) {
//Create data for the pie
var data = [{
values: datapie,
labels: ['Neutral', 'Negative', 'Positive'],
type: 'pie'
}];
//Create layout for the pie
var layout = {
height: 400,
width: 500
};
... | [
"function render_pieGezelschap() {\n var plotPie = hgiPie().mapping(['name','value']);\n d3.select('#pieGezelschap').datum(data_gezelschap).call(plotPie);\n}",
"function render_pieGezelschap() {\n var plotPie = hgiPie().mapping(['name', 'value']);\n d3.select('#pieGezelschap').datum(data_gezelschap).call(plot... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: createServerBehaviorObj DESCRIPTION: This function is called from UltraDev when pasting a ServerBehavior. If you plan to implement copyServerBehavior and pasteServerBehavior for your SB, you must implement this function to return an empty instance of the ServerBehavior object or of your subclass of ServerBeha... | function createServerBehaviorObj()
{
return new SBRecordsetPHP();
} | [
"function pasteServerBehavior(ssRec) {\r\n\tvar smName = dw.getDocumentDOM().serverModel.getServerName();\r\n\tvar domCommand;\r\n\tvar isPasteAllowed = true;\r\n\r\n\tfor (var j=0; j<MM.rsTypes.length; j++) {\r\n\t\tif (MM.rsTypes[j].serverModel == smName) {\r\n\t\t\tdomCommand = dw.getDocumentDOM(dw.getConfigurat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Date libraries are able to parse dates such as 20230231 into an actual Date object: Jan 31 2023 Given a date string (internal ISO format) and dateFormat, test to see if the date is valid byt first parsing the given date for the year, month, and day then compare the values of the created Date object to see if it matches | function isValidDate(dateString, dateFormat) {
const date = new Date(dateString);
if (isNaN(date)) {
return false;
}
const dateRegex = getDateFormatRegex(dateFormat);
const validRegex = new RegExp(dateRegex).test(dateString);
if (validRegex) {
const { year, month, day } = getYearMonthDay(dateString, dateRege... | [
"validateDate(dateString) {\n const dateArr = dateString.split('/');\n const month = parseInt(dateArr[0]);\n const day = parseInt(dateArr[1]);\n const year = parseInt(dateArr[2]);\n const dateObj = new Date(dateString);\n if (dateArr.length === 3 && 1 <= month && month <= 12 && 1 <= day && day <= ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update post data with `data`. This is a "partial update" it's fine if data doesn't contain all the fields; this only changes provided ones. Return data for changed post. | static async update(post_id, data) {
let { query, values } = sqlForPartialUpdate(
"posts",
data,
"post_id",
post_id
);
const result = await db.query(query, values);
const post = result.rows[0];
if (!post) {
let notFoun... | [
"static async update(id, data) {\n let { query, values } = sqlForPartialUpdate(\"posts\", data, \"id\", id);\n const result = await db.query(query, values);\n const post = result.rows[0];\n if (!post) {\n throw new ExpressError(`No post found with id ${id}`, 404);\n }\n Post.deserialize(post)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Two Position Switch 2 Extends mxShape. | function mxShapeElectricalTwoPositionSwitch2(bounds, fill, stroke, strokewidth)
{
mxShape.call(this);
this.bounds = bounds;
this.fill = fill;
this.stroke = stroke;
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
} | [
"function mxShapeElectricalPushbuttonTwoCircuitSwitch2(bounds, fill, stroke, strokewidth)\n{\n\tmxShape.call(this);\n\tthis.bounds = bounds;\n\tthis.fill = fill;\n\tthis.stroke = stroke;\n\tthis.strokewidth = (strokewidth != null) ? strokewidth : 1;\n}",
"function mxShapeElectricalThreePositionSwitch2(bounds, fil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add a Export Excel button to the DOM and trigger export if clicked | function addExportLink() {
var $js_btn = $('a.js-export, a.js-export-json'); // Export JSON link
$('.trelloexport').remove();
bTrelloExporterLoaded = false;
if ($('form').find('.trelloexport').length) return;
if ($js_btn.length) $excel_btn = $('<a>')
.attr({
class: 'trelloexpo... | [
"onExportClick() {\n this.scheduleObj.exportToExcel();\n }",
"make_export_button() {\n\t\tconst purse = this\n\t\tconst self = make_export_element(true)\n\t\tconst file_name = 'data.json'\n\t\tself.addEventListener('export', function (ev) {\n\t\t\tconsole.debug('exporting', purse.data, 'as', file_name) \n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fetches all of the testplan results from TestRail | function fetchPlanResults() {
// Request URL for test plans
var planAPI = testRailURL + "/index.php?/api/v2/get_plans/" + projectID + "&milestone_id=" + milestoneID;
var params = setTestRailHeaders();
// Proxy the request through the container server
gadgets.io.makeRequest(planAPI, handlePlanResponse, params... | [
"function fetchPlanResults() {\n // Request URL for test plans\n var planAPI = testRailURL + \"/index.php?/api/v2/get_plans/\" + projectList[plIndex][0];\n var params = setTestRailHeaders();\n\n // Proxy the request through the container server\n gadgets.io.makeRequest(planAPI, handlePlanResponse, params);\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The schema for a Tiled game, adding in configurable map sizes. | get schema() {
return this.makeSchema({
// HACK: super should work. but schema is undefined on it
// tslint:disable-next-line:no-any
...(super.schema || this.schema),
mapWidth: {
default: 32,
min: 2,
... | [
"function genTileStyles() {\n var width =\n { window: $(window).width()\n , board: board.width()\n }\n var tilePadding = width.window >= bp ? 10 : 6\n var tileSize = Math.floor(width.board / gridSize - tilePadding) + 'px'\n Object.keys(tileStyles).map(function(prop) {\n tileStyles[pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a SmoothMovement. A SmoothMovement produces integer position values representing movement towards a target position, with a maximum acceleration or deceleration of one distance unit per time unit squared. The parameters are: position the initial position target the target position velocity the initial velocity.... | function SmoothMovement(position, target, velocity){
// initialise the position, target, and velocity
position = Math.round(position);
target = Math.round(target);
velocity = (velocity ? Math.round(velocity) : 0);
/* Updates the position and velocity of this SmoothMovement and returns the
* new... | [
"function SmoothMovement(position, target){\n position.x = Math.round(position.x);\n position.y = Math.round(position.y);\n target.x = Math.round(target.x);\n target.y = Math.round(target.y);\n // initialise the position, target, velocity, and animation interval\n this.position = (positio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a statement initializing local variables for event handlers. | genInitEventLocals() {
var res = [`${this.getLocalName(CONTEXT_INDEX)} = ${this.getFieldName(CONTEXT_INDEX)}`];
this._sanitizedEventNames.forEach((names, eb) => {
for (var i = 0; i < names.length; ++i) {
if (i !== CONTEXT_INDEX) {
res.push(`${this.get... | [
"genInitLocals() {\r\n var declarations = [];\r\n var assignments = [];\r\n for (var i = 0, iLen = this.getFieldCount(); i < iLen; ++i) {\r\n if (i == CONTEXT_INDEX) {\r\n declarations.push(`${this.getLocalName(i)} = ${this.getFieldName(i)}`);\r\n }\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |