query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
FUNCTIONS ========================================================== This runQuery function expects two parameters (the number of articles to show and the final URL to download data from) | function runQuery(numArticles, queryURL){
// Then run a request to the Gardian(UK) API with the movie specified
//request(queryURLBase, function (error, response, body) {
$.ajax({url: queryURL, method: "GET"})
.done(function(gardianNews) {
// If the request is successful (i.e. if the response status cod... | [
"function runQuery(numArticles, queryURL){\n\n\t// The AJAX function uses the URL and Gets the JSON data associated with it. The data then gets stored in the variable called: \"NYTData\"\n\t$.ajax({url: queryURL, method: \"GET\"}) \n\t\t.then(function(NYTData) {\n //log the result to console to prove we are ge... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check for the keypress of "Enter" and submit subscription | function enter_subscription(evt, page, msg_div) {
if (window.event) evt = window.event;
if (evt.keyCode == 13) {
//Keypress was "Enter", submit
// and short-circuit the keypress event
submit_subscription(page, msg_div);
return false;
} else {
//Otherwise, return true, do not short-circuit
retur... | [
"enterKeyDownHandler(e) {\n if(e.key === 'Enter'){\n this.submit();\n }\n }",
"_onKeyDown(e) {\n if (e.keyCode === 13) {\n this._submit();\n }\n }",
"function enterSubmit() {\n\tif (event.keyCode == 13) {\n\t\tchatTextSubmit();\n\t}\n}",
"function checkEnter(e){\n if(e.keyCode === 13)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
retrieve GIPS status from a given session | async function getGipsStatus(session) {
debug('getGipsStatus called');
const gipsStatus = await getGlobalStatus(session.identityId);
debug('getGipsStatus called', gipsStatus);
return gipsStatus;
} | [
"function get_status() {\n //TODO\n\n }",
"function get_status() {\n VK.Auth.getLoginStatus(function (val) {\n if (val.session === null) {\n switch_buttons(false);\n } else {\n get_user_info(val).then(set_user_info).then(vk_cont());\n }\n });\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetch the degreeRequirement object for this student | static degreeRequirement() {
return this.hasOne(DegreeRequirement);
} | [
"getDegreeCourse() {\n return this.degree_course;\n }",
"static async getStudentStatus (id) {\n const student = await models.Student.findByPk(id);\n\n if (student === null) {\n return { requirementsStatus: 'Student not found' };\n }\n\n const degree = await models.DegreeRequirement.findOne({\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
transfort exists and not exists expressions | function transformExistsNotExists(expressionTable, alias, className){
for(var key in expressionTable){
// var visited = 0;
if(key == "ExistsFunc" || key == "NotExistsFunc"){
var prefix = "";
var existsExpr = "ExistsExpr";
if(key == "NotExistsFunc") {
prefix = "not";
existsExpr = "NotExistsExpr";
... | [
"exists() { return false; }",
"whereNotExists(callback) {\n return this._not(true).whereExists(callback);\n }",
"exists(value) {\n\n }",
"whereNotExists(value) {\n const whereClauses = this.getRecentStackItem();\n whereClauses.push({\n method: 'whereNotExists',\n arg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates content in winner modal including restart button and space for winner message | fillWinnerModal (text) {
const div = document.createElement('div');
const p = document.createElement('p');
p.setAttribute('id', 'winnerP');
p.innerText = text;
const btn = document.createElement('button');
btn.innerText = "Play Again?";
btn.setAttribute('class', ... | [
"function winnerPopUp () {\n\tlet starshtml = document.querySelector('.stars').innerHTML;\n\tlet moveshtml = document.querySelector('.moves');\n\tlet timerhtml = document.querySelector('.timer');\n\tdocument.querySelector('.m-stars').innerHTML = starshtml;\n\tdocument.querySelector('.m-moves').innerHTML = moveshtml... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method takes an array of action types that can influence a component's state, an object with reducers with the same names as the action types and a reference to the component on which we want to set the state propery. | setReducers(actionTypes, reducers, component) {
actionTypes.forEach(actionType => {
if (reducers[actionType]) {
this.dispatcher.addEventListener(actionType, e => {
const action = e.detail;
component.state = reducers[actionType](component.state, action);
});
} else {
... | [
"setActionTypes(actionTypes){this._actionTypes=actionTypes;return this;}",
"coreDispatch(action) {\n const newState = this.useReducers(action, this.state);\n\n if (!this.equalStates(newState, this.state)) {\n this.state = newState;\n this.trigger('change', this.state);\n }\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TypedObjectArray.redimension(newArrayType) Method that "repackages" the data from this array into a new typed object whose type is `newArrayType`. Once you strip away all the outer array dimensions, the type of `this` array and `newArrayType` must share the same innermost element type. Moreover, those stripped away dim... | function TypedObjectArrayRedimension(newArrayType) {
if (!IsObject(this) || !ObjectIsTypedObject(this))
ThrowTypeError(JSMSG_TYPEDOBJECT_BAD_ARGS);
if (!IsObject(newArrayType) || !ObjectIsTypeDescr(newArrayType))
ThrowTypeError(JSMSG_TYPEDOBJECT_BAD_ARGS);
// Peel away the outermost array layers from th... | [
"extendArrayOfTypedArrays (array, elements, deltaSize) {\n array.typedArray =\n this.extendTypedArray(array.typedArray, (deltaSize * elements))\n for (let i = array.length, len = i + deltaSize; i < len; i++) {\n const start = i * elements\n const end = start + elements\n array[i] = array.t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called upon exiting state | exit() {
this.exit();
} | [
"function ExitState() {\n runState = false;\n currentState.Exit();\n}",
"function GameState_Exiting () {\n}",
"function exit() {\n\twantsToExit = true;\n}",
"function exit() {\n\t\trunner.exit();\n\t}",
"exit() {\n // inform observers about control destroy\n this.fireAxisUpdate()\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function that accesses that global customerName variable, and uppercases it. | function upperCaseCustomerName() {
customerName = customerName.toUpperCase();
} | [
"function upperCaseCustomerName() {\n customerName = customerName.toUpperCase()\n return customerName\n}",
"function upperCaseCustomerName() {\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase\n customerName = customerName.toUpperCase();\n}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fetch and sync contacts | function fetchcontact(){
navigator.contactsPhoneNumbers.list(function(contacts){
//alert("Contacts found : "+contacts.length);
var contactArray = [];
for(var i = 0; i < contacts.length; i++){
// alert("Display name : "+contacts[i].displayName);
for(var j = 0; j < contacts[i].phoneNumbers... | [
"function syncContacts() {\n getPOCsFromAS()\n matchEmails()\n}",
"function pullContacts () {\n // Fetch contacts from server\n const url = \"/contacts\";\n fetch(url)\n .then(response => console.log(response))\n .catch((reject) => {\n console.log('reject', reject);\n });\n\n // Merge (rewrite... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Destroys a View attached to this container at the specified `index`. If `index` is not specified, the last View in the container will be removed. TODO(i): rename to destroy | remove(index = -1) {
if (index == -1)
index = this.length - 1;
this.viewManager.destroyViewInContainer(this.element, index);
// view is intentionally not returned to the client.
} | [
"_detachView(index) {\n return this._viewContainerRef.detach(index);\n }",
"function removeView(index) {\n\t\t\t\tvar id, bindId, parentElem, prevNode, nextNode, nodesToRemove,\n\t\t\t\t\tviewToRemove = views[index];\n\n\t\t\t\tif (viewToRemove && viewToRemove.link) {\n\t\t\t\t\tid = viewToRemove._.id;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
output an incident report to the specified output channel | function reportIncident(member, info, channel) {
// if the channel is null, immediately exit
if (!channel) {
console.log('No output channel specified for output');
return;
}
// pick a phrase (any phrase)
const phrase = getPhrase(member);
const embed = new Discord.RichEmbed()
.setColor('#FF0000'... | [
"function outputChannelName(channel) {\n // do the dom manipulation by getting the ID\n}",
"function ChannelReport(channel, connection) {\n\tthis.channel = channel;\n\tthis.connection = connection;\n}",
"function printIncident(incident) {\n sdk.log(`\\t${incident.title}`)\n sdk.log(`\\t\\tStatus: ${inciden... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Design Document OnChange Event Handler | function handler_designDocumentOnChange() {
let designDoc = $("#couchdb_designDocument").val();
getCouchdbViews(designDoc, DOM_fillCouchdbViews);
} | [
"onChange() {\n if (document.contains(this.getNode())) {\n this.update();\n return;\n }\n this.render();\n }",
"function didChangeTextDocument (change) {\n\tlint(change.document);\n}",
"function HandleDOM_Change () {\n\t\t} //end HandleDom_change()",
"function onC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When Mouse is released we change startContainer's display to none in order to hide it | function mouseUp(){
document.getElementById('startContainer').style.display = 'none';
} | [
"function mouseStopped(){\n cursor.style.display = \"none\";\n }",
"function showStartContainer() {\n const start = document.getElementById(\"start\");\n $(\"div.start-container\").show();\n start.classList.toggle(\"active\");\n $(\"div.start-container\").css(\"z-index\", \"10000\");\n $(\"div.st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if interval outside another interval Accepts two intervals and checks whether other interval is in the past or future intervalOutside([1, 4], [5,15]) returns true | function intervalOutside(firstInterval, secondInterval) {
const future = firstInterval[0] > secondInterval[1] && firstInterval[1] > secondInterval[1];
const past = firstInterval[0] < secondInterval[0] && firstInterval[1] < secondInterval[0];
return future || past;
} | [
"function isInInterval(toCheck, lower, upper) {\n return (toCheck >= lower) && (toCheck <= upper);\n}",
"function isBetween(vals, range ) {\n vals.forEach( (val, index) => {\n if ( val<range[0] || val>range[1]) {\n throw `val ${val} is outside the bounds [${range[0]} , ${range[1]}]`\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TASK Write a function called calculateScore to calculate the hotels score: 1 point for each 100 rooms they have 3 points for a pool 2 points for a gym Call this method from 'ratings' to get the score, on which to base the ratings. Properties available in each hotel are: name string totalRooms number bookedRooms number ... | function calculateScore(hotelToScore) {
//console.log("calculateScore has been called with " + hotelToScore.name);
var score = 0;
var roomScore = hotelToScore.totalRooms / 100;
var hasGym = hotelToScore.hasGym;
var hasSwimmingPool = hotelToScore.hasSwimmingPool;
var arrayHotelsWithPoolsAndGyms = [];
//console.lo... | [
"function Hotel(name, location, couplesMax, groupsMax, couplesPrice, groupsPrice, discount) {\n // set object variables\n this.name = name;\n this.location = location;\n this.couplesMax = couplesMax;\n this.groupsMax = groupsMax;\n this.couplesPrice = couplesPrice;\n this.groupsPrice = groupsPr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a random tile coordinate | getRandomTileCoordinate() {
// get random tile coords
const x = Math.round(Math.random() * this.xTiles);
const y = Math.round(Math.random() * this.yTiles);
return { x, y }
} | [
"getRandomTileCoordinate() {\n // get random tile coords\n const x = Math.round(Math.random() * this.xTiles);\n const y = Math.round(Math.random() * this.yTiles);\n\n return { x, y }\n }",
"getRandomPixelCoordinate() {\n // get random pixel coords\n const x = Math.round(Math.random() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show Selection in Small Game Profile | function showSelection() {
navigationBrowse(memSelection);
} | [
"function showAvatarSelection() {\n // document.getElementById('instructions').style.display = 'none';\n // document.getElementById('avatarSelectionId').style.display = 'block';\n // document.getElementById('gameDifficultyId').style.display = 'none';\n // document.getElementById('summaryOfSelection').st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset rating to 3 stars, and clear mismatches. | function resetRating() {
mismatches = 0;
rating = 3;
ratingLabel.innerHTML = "";
for (let i = 3; i > 0; i--) {
const i = document.createElement('i');
i.classList.add('fa', 'fa-star');
ratingLabel.appendChild(i);
}
} | [
"function setRating() {\n // make sure rating doesn't go below 1 star\n if (mismatches > 7) return;\n\n // decrease rating every 3 mismatches\n if ( (mismatches % 3) === 0 ) {\n rating--;\n ratingLabel.removeChild(ratingLabel.lastElementChild);\n }\n}",
"function resetStarRating()\n{\n // Code will on... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
5 Array: NthtoLast: Return the element that is Nfromarray'send. Given ([5,2,3,6,4,9,7],3), return 4. If the array is too short, return null. | function nthToLast(arr, n){
if (arr.length < 3){
return null;
}
else{
return arr.length-n
}
} | [
"function nthToLast(arr) {\n if(arr[1] <= arr[0].length) {\n return arr[0][arr[0].length - arr[1]]\n } else {\n return null\n }\n}",
"function Nthtolast(arr, y){ // pass it an array and the index number we will return\n if (arr.length < y){ //if the length is shorter than the index value... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enables the plugin functionality for this Handsontable instance. | enablePlugin() {
if (this.enabled) {
return;
}
if (isUndefined(this.hot.getSettings().observeChanges)) {
this.enableObserveChangesPlugin();
}
this.addHook('afterTrimRow', () => this.sortByPresetSortStates());
this.addHook('afterUntrimRow', () => this.sortByPresetSortStates());
... | [
"enablePlugin() {\n if (this.enabled) {\n return;\n }\n\n const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];\n\n if (isObject(pluginSettings)) {\n this.#settings = pluginSettings;\n\n if (isUndefined(pluginSettings.copyPasteEnabled)) {\n pluginSettings.copyPasteEnabled = tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rendering simulation element to the screen | render()
{
let ctx = Simulation.context();
let canvas = Simulation.canvas();
ctx.clearRect(0, 0, canvas.width, canvas.height);
// -- Render simulation elements --
// Cheese
this.cheese.render(ctx);
// Population
this.population.render(ctx);
... | [
"_render() {\n\t\tthis._stats.begin();\n\t\tthis._renderer.render(this.stage);\n\t\tthis._stats.end();\n\t}",
"render() {\n\t\tif (!this.component_.element) {\n\t\t\tthis.component_.element = document.createElement('div');\n\t\t}\n\t\tthis.emit('rendered', !this.isRendered_);\n\t}",
"render() {\n thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Continuously tries to open a WebSocket to the pywebsocket server. | function tryOpeningWebSocket() {
if (!gWebSocketOpened) {
console.log('Once again trying to open web socket');
openWebSocket();
setTimeout(function() { tryOpeningWebSocket(); }, 1000);
}
} | [
"function openWebSocket() {\n\n var wsuri = \"wss://\" + window.location.hostname + \"/ws?client_id=\" + Date.now();\n\n websocket = new WebSocket(wsuri);\n\n websocket.onopen = function(evt) { onOpen(evt) };\n websocket.onclose = function(evt) { onClose(evt) };\n websocket.onmessage = function(evt) { onMessag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates the Table's custom header row. | _createCustomHeaderRow() {
const that = this,
headerRow = that.headerRow;
if (!headerRow) {
return;
}
const potentialHTMLTemplate = document.getElementById(headerRow);
if (potentialHTMLTemplate && potentialHTMLTemplate instanceof HTMLTemplateE... | [
"function createHeaderRow() {\n\n var trEl = document.createElement('tr');\n createElAndAppend('th', 'Products', trEl);\n createElAndAppend('th', 'Total # Clicks', trEl);\n createElAndAppend('th', 'Total # Appearances', trEl);\n createElAndAppend('th', 'Clicked Percentage', trEl);\n\n resultsTable.appendChild... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets all event in the schedule of the username's account in this._username, storing them to prepare for output | getFullSchedule(){
let schedule = this._accountManager.viewSignedUpEvents(this._username);
this._numCurrent = 1;
this._numExpired = 1;
let current = Object.keys(schedule[0]);
let expired = Object.keys(schedule[1]);
for (let i = 0; i < current.length; i++){
c... | [
"getCurrentSchedule(username){\n let schedule = this._accountManager.viewSignedUpEvents(username)[0];\n\n let output = \"\";\n for (const [key, value] of Object.entries(schedule)){\n output += \"[\" + key + \"] \" + value[2] + \"<br>\";\n output += \"from \" + value[0].toL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove `id` from its inverse record with id `inverseId`. If the inverse relationship is a belongsTo, this means just setting it to null, if the inverse relationship is a hasMany, then remove that id from its array of ids. | _removeFromInverse(id, resourceIdentifier, inversePayloads) {
var inversePayload = inversePayloads.get(resourceIdentifier.type, resourceIdentifier.id);
var data = inversePayload && inversePayload.data;
if (!data) {
return;
}
if (Array.isArray(data)) {
inversePayload.data = data.filter(... | [
"_removeFromInverse(id, resourceIdentifier, inversePayloads) {\n var inversePayload = inversePayloads.get(resourceIdentifier.type, resourceIdentifier.id);\n var data = inversePayload && inversePayload.data;\n var partialData = inversePayload && inversePayload._partialData;\n\n if (!data && !part... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the simulation displays in the summary overlay | function loadSummaryDisplays() {
// Create and display summary content
var sumDiv = document.createElement("div");
sumDiv.setAttribute("id", "summaryContainer");
document.getElementById("mainContent").appendChild(sumDiv);
// Summary title
sumDiv.innerHTML += "<div class='summaryControls'><butto... | [
"function loadSimulation() {\n //hiding visualisation\n gameBtn.style.display = \"none\";\n gamePopup.style.display = \"none\";\n playground.style.display = \"none\";\n //showing simulation\n btn.style.display = \"block\";\n simulatorArea.style.display = \"block\";\n}",
"function loadSimulation() {\r\n //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verifies the object is a call object. | function unstable_isCall(object) {
return (
typeof object === "object" &&
object !== null &&
object.type === REACT_CALL_TYPE
);
} | [
"function canCall(obj, name) {\n return !!(obj[name + '_canCall___'] || obj[name + '_grantCall___']);\n }",
"function canCall(obj, name) {\n if (obj === void 0 || obj === null) { return false; }\n if (obj[name + '_canCall___']) { return true; }\n if (obj[name + '_grantCall___']) {\n fastpath... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Registers a callback for when `onApprove` is fired. | onApprove(callback) {
this.component.onApprove.subscribe((res) => callback(res));
return this;
} | [
"function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) {\n allowed[msg.sender][_spender] = _value;\n Approval(msg.sender, _spender, _value);\n\n //call the receiveApproval function on the contract you want to be notified. This crafts the function sig... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handle dynamic required validation | handleDynamicRequired(event) {
if(event.target.value === "email") {
this.enableHasError("email", true);
let email = document.getElementById("email");
let control = "emailControl";
// pattern match test
if(this.state.employee.contactPreference==="... | [
"required(modelName, lodashPath, appModelPart, userContext, handlerSpec, cb) {\n if (!_.isString(appModelPart.required)) {\n return cb();\n }\n\n try {\n const val = vutil.getValue(this, appModelPart, lodashPath);\n const { action } = userContext;\n\n let isRequired;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get total supply for native token | async fetchTotalSupply() {
const { data: { tokenIssued: total } } = await this.request({
url: 'https://www.btse.com/api/tokentransparency',
headers: {
'User-Agent': 'PostmanRuntime/7.24.1', // tmp hack: without UserAgent definition url will not work
},
});
return Number(total);
... | [
"async fetchTotalSupply() {\n const total = await this.request('https://tmmtoken.com/api/index.php?para=circulatingSupply');\n return Number(total);\n }",
"async getTokenTotalSupply(token_id) {\n const response = await fetch(`${this.url}/v2/slp/list/${token_id}`);\n const data = await respons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter and Setter for the gender of the employee | get gender() { return this._gender; } | [
"get gender() {\n\t\treturn this.__gender;\n\t}",
"get gender() {\n\t\tif (this.femininity > 50)\n\t\t\treturn \"female\";\n\t\treturn \"male\";\n\t}",
"function setGender(gender) {\r\n\treturn (gender == 1) ? \"Male\" : \"Female\";\r\n}",
"female(personName) {\n return this.assignGender(personName, 'F... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
will do a patch to to migrate tokens | function migrateTokens(elementtoken) {
let element = elementtoken
const options = {
"host": `${baseUrl}.cloud-elements.com`,
"path": "/elements/api-v2/migrate-tokens",
"headers": {
"Content-Type": "application/json",
"Authorization": `User ${user}, Organization ${organization}, Element ${el... | [
"updateTokens() {\n this.getTokens();\n }",
"updateTokens(tokens) {\n this._ready = false;\n this.tokens = [...tokens];\n }",
"changeToken (callback) {\n\t\tconst tokenHandler = new TokenHandler(this.apiConfig.sharedSecrets.auth);\n\t\tconst payload = tokenHandler.decode(this.data.token... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Whether we are currently in the fake async zone. | function isInFakeAsyncZone() {
return Zone.current.get('FakeAsyncTestZoneSpec') != null;
} | [
"static isInAngularZone() {\n // Zone needs to be checked, because this method might be called even when NoopNgZone is used.\n return typeof Zone !== 'undefined' && Zone.current.get('isAngularZone') === true;\n }",
"async function isRunning(address) {\n\ttry {\n\t\tawait call(address, {\n\t\t\turl: '/gatew... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function will return the time group name based on the time group sequence number | function getTimeGroupName(groupSeqNum){
var grpMod = aa.timeAccounting.getTimeGroupTypeModel().getOutput();
grpMod.setTimeGroupSeq(groupSeqNum);
var grps = aa.timeAccounting.getTimeGroupTypeModels(grpMod).getOutput();
return grps[0].getTimeGroupName();
} | [
"function getTimeGroupName(groupSeqNum){\n\tvar grpMod = aa.timeAccounting.getTimeGroupTypeModel().getOutput();\n\tgrpMod.setTimeGroupSeq(groupSeqNum);\n\tvar grps = aa.timeAccounting.getTimeGroupTypeModels(grpMod).getOutput();\n\treturn grps[0].getTimeGroupName();\n}",
"function getRandomGroupName() {\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get report list by category | function getReportSetCategory(category) {
var categoryStr = angular.isDefined(category)
? (category.toLowerCase() === 'uncategorized' ? '' : category)
: '';
return $izendaRsQuery.query('reportlistdatalite', [categoryStr], {
dataType: 'json'
},
// custom error handler:
{
handler: fu... | [
"static Categories (params) {\n return Get('/reports/invoicing_by_category', params)\n }",
"function displayReports(category) {\n var heatmapActive = heatmap.getMap() != null;\n var url = restUrl + 'categories/' + category + '/reports';\n markers[category] = [];\n\n $.get(url, function(data) {\n var ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Proxies a request to sign the person in. We want to intercept the response body and | async function proxySignInRequest(apiUrl, req, res) {
try {
// Make the request to our API with `got` in JSON mode. We will want to
// inspect the result of this request instead of simply streaming
// it through.
const apiResponse = await apiClient.post(
{...apiUrl, path: req.url},
{
... | [
"function signRequest(req, res) {\n if (req.body.headers) {\n signRestRequest(req, res);\n } else {\n signPolicy(req, res);\n }\n }",
"function signRequest(req, res) {\n if (req.body.headers) {\n signRestRequest(req, res);\n } else {\n signPolicy(req, res);\n }\n}",
"function signRe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return promise resolving to the IP address registered for DOMAIN | function getRegisteredIP () {return new Promise ( (resolve, reject) => { dns.lookup ( C.DOMAIN, 4, (err, address) => {if (err) reject(err); else resolve (address);} ) } ); } | [
"async function getIPofDomain(_domain){\n let response = await fetch('https://dns.google/resolve?name='+_domain);\n let json = await response.json();\n return json.Answer[0].data;\n }",
"function getIPAddress() {\n return new Promise((resolve, reject) => {\n network.get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
via This is a very dirty workaround for We're trying to resolve the environment ourselves because Jest does it incorrectly. TODO: remove this as soon as it's fixed in Jest. | function resolveJestDefaultEnvironment(name: string) {
const jestDir = path.dirname(
resolve.sync('jest', {
basedir: __dirname,
}),
);
const jestCLIDir = path.dirname(
resolve.sync('jest-cli', {
basedir: jestDir,
}),
);
const jestConfigDir = path.dirname(
... | [
"static getTargetedTestEnvironment() {\n return process.env.npm_package_config_targeted_test_environment;\n }",
"get environment() { return checkEnvironment() }",
"getEnvironment() {\n // Environment needs only the be parsed once!\n if (!this.environment) {\n this.environment = parse... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility function to xor to multiple hex strings and return as string | function xorItems(...items) {
const xorvalue = items
.map(item => Buffer.from(strip0x(item), 'hex'))
.reduce((acc, item) => xor(acc, item));
return `0x${xorvalue.toString('hex')}`;
} | [
"function xor_hex(hex1, hex2, format){\n\tvar hex_array = [hex1, hex2];\n\n\t/*= input sanitisation */\n\n\tif(hex_array[0] == null || hex_array[1] == null){\n\t\tconsole.log(\"2 hex inputs required!\")\n\t\treturn;\n\t}\n\tif(hex_array[1].length != hex_array[0].length){\n\t\tconsole.log(\"hex strings should have t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get wind (or ocean currents) speed from U and V velocity components | function get_speed_from_u_v(u, v) {
return Math.sqrt(Math.pow(u, 2) + Math.pow(v, 2))
} | [
"function calcSpeed(v) {\n var x = v.x,\n y = v.y;\n return Math.sqrt(x * x + y * y);\n }",
"getVelocity() {\n return this.canTrackVelocity ? (\n // These casts could be avoided if parseFloat would be typed better\n velocityPerSecond(parseFloat(this.current) - parseFloat(this.prev), this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets up a whitePrompt for verifying if a student wants to post their question assumes a whitePrompt element is available for use returns the continue posting button so action can be added to it | function popupVerify() {
var prompt = document.getElementById("whitePrompt");
var title = document.createElement("P");
title.innerHTML = "What about these:";
prompt.appendChild(title);
var questionScroll = document.createElement("DIV");
questionScroll.id = "scrollMenu";
prompt.appendChild(questionScroll);
... | [
"function postQuestionButton() {\n let submitButton = document.getElementById('submit');\n submitButton.textContent = \"Try another one!\";\n document.getElementById('answer').style.display = \"none\";\n submitButton.className = \"try-again\";\n }",
"function addNeedSetUp() {\n inp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use ajax call to get users and their geolocations pass returned array marker locations to callback method Here is the format in which marker data stored geoObj[0] is descripion. geoObj[1] is latitude geoObj[2] is longitude We use geoObj[0] in the infoWindow. Click marker to reveal description. | function retrieveMarkerLocations() {
$(function() {
$.get("/donation/geolocations", function(data) {
$.each(data, function(index, geoObj) {
console.log(geoObj[0] + " " + geoObj[1] + " " + geoObj[2]);
});
callback(data);
});
});
} | [
"function retrieveMarkerLocations() {\n\t$(function() {\n\t\t$.get(\"donorlocation/locations\", function(data) {\n\t\t\t$.each(data, function(index, geoObj) {\n\t\t\t\tconsole.log(geoObj[0] + \" \" + geoObj[1] + \" \" + geoObj[2]);\n\t\t\t});\n\t\t\tcallback(data);\n\t\t});\n\t});\n}",
"function fetchMarkers(){\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pop up messae appends an "active" class to .popup and .popupcontent when the "Open" button is clicked | function openPopUp(onScreen) {
$("p").html(onScreen);
$(".popup-overlay, .popup-content").addClass("active");
$(".page-bckgrnd").addClass("active");
$(".loginbox").addClass("active");
} | [
"function popup() {\n $('[data-popup]').on('click', (event) => {\n // Popup cible\n const { currentTarget: target } = event;\n const popup = $(target).next('.popup');\n\n // Ouvre la popup\n popup.toggleClass('active');\n\n // Insertion du data pour charger le contenu uniquement si l'on ouvre la ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end of displayQuestion function need a 10 second timer that will run AFTER each displayQuestion() | function newQuestion() {
if (questionDone === true) {
setTimeout(displayQuestion, 10000)
};
} | [
"function displayNextQuestion() {\n setTimeout(nextQuestion, 5000);\n }",
"function startQuiz() {\n timerDisplay()\n nextQuestion()\n\n}",
"function nextQuestion(){\n timer.initialTime=30;\n timer.start();\n $(\"#answers-placeholder\").empty();\n displayQandAs(questionCounter);\n}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Notify the DOM that the score changed | _updateScore () {
this._scoreBoard.innerHTML = this._score;
} | [
"updateScore() {\n this.score++;\n document.dispatchEvent(new CustomEvent('updateScore', { detail: this.score }));\n }",
"function updateScore() {\n\t\t$('#score').html(myScore);\n\t\tcheckforWin();\n\t}",
"updateScore() \n\t{\n\t\tdocument.getElementById('score').innerText = this.score;\n\t\td... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves process data to backend | function saveProcess(data) {
helper.http_request("POST", "/process/create_edit", true, data, saveCallback);
} | [
"function saveProcesses () {\r\n fs.writeFileSync(processesFileLocation, JSON.stringify({ forwards }))\r\n}",
"save () {\n try {\n fs.writeFileSync(this.dataPath, JSON.stringify(this.tasks))\n } catch (error) {\n render.logError(error)\n }\n }",
"function save_process_log() {\n let json ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
copy the ionic2angular stuff starter template | _createIonicApp() {
['.gitignore', 'app', 'scripts', 'resources', 'tsconfig.json', 'gulpfile.js', 'webpack.config.js', 'webpack.production.config.js'].forEach((file) => {
this._copy(file);
});
['package.json'].forEach((file) => {
this.createTemplate(file, this.answers);
});
} | [
"async function createStarterTemplate() {\n\tlog(chalk.green.bold(`\nCreating starter template...`));\n\n\tlet addFlexboxGrid = config.flexboxgrid ? `\n <link rel=\"stylesheet\" href=\"https://cdn.antwerpen.be/core_flexboxgrid_scss/1.0.1/flexboxgrid.min.css\">` : '';\n\n\tconst options = {\n\t\tfiles: 'frontend/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=================================================================== Function with all of the general Google Analytics Tracking =================================================================== | function GAtracking() {
// Custom Google Analytics tracking code
// ...
} | [
"function callGA(){\t\n\tvar pageTracker = _gat._getTracker(\"UA-4969726-3\");\n\tpageTracker._initData();\n\tpageTracker._trackPageview();\n}",
"function SetupGoogleAnalyticsTrackEvents(){TrackEventsForImageClicks();}",
"function analytics() {\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a serializer. `nodes` should map node names to functions that take a node and return a description of the corresponding DOM. `marks` does the same for mark names, but also gets an argument that tells it whether the mark's content is block or inline content (for typical use, it'll always be inline). A mark serial... | constructor(nodes, marks) {
this.nodes = nodes;
this.marks = marks;
} | [
"mark(marks) {\n return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);\n }",
"setNodeMarkup(pos, type, attrs = null, marks) {\n setNodeMarkup(this, pos, type, attrs, marks);\n return this;\n }",
"create(attrs = null, content, marks) {\n if (this.isText)\n t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expand items by default. | _expandItemsByDefault(collapseBeforehand) {
const that = this;
if (that._menuItemsGroupsToExpand.length === 0 && !collapseBeforehand ||
that.mode !== 'tree' && !that._minimized) {
return;
}
const restoreAnimation = that.hasAnimation,
animationType = ... | [
"expandItem(item){if(!this._isExpanded(item)){this.push(\"expandedItems\",item)}}",
"expandItem(item){if(!this._isExpanded(item)){this.push('expandedItems',item);}}",
"function expandItem(){\n vm.expanded = !vm.expanded;\n }",
"ExpandAll() {\n if (this.IsNode) {\n for (let i = 0,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enable downloading the SVG code as a standalone file when the Download button is clicked. | function downloadSVG(){
window.URL = window.webkitURL || window.URL;
var contentType = 'image/svg+xml';
var svgCode = $('#exportcode').val();
var svgFile = new Blob([svgCode], {type: contentType});
$('#aDownloadSvg').prop('download','pattern-bar.svg');
$('#aDownloadSvg').prop('href',window.URL.... | [
"function svgDownloadClicked(e) {\n/*\n e.preventDefault();\n svgClose();\n var BB = get_blob();\n saveAs(\n new BB(\n svgBlob, {type: \"text/plain;charset=\" + document.characterSet}\n )\n , (downloadFilename.value || downloadFilename.placeholder) + \".svg\"\n );\n*/\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Normalizes _unlinkSync() across platforms to match Unix behavior, i.e. file can be unlinked even if it's readonly, see | function unlinkSync(file) {
try {
fs.unlinkSync(file);
} catch (e) {
// Try to override file permission
/* istanbul ignore next */
if (e.code === 'EPERM') {
fs.chmodSync(file, '0666');
fs.unlinkSync(file);
} else {
throw e;
}
}
} | [
"function unlinkSync(file) {\n\t try {\n\t fs.unlinkSync(file);\n\t } catch(e) {\n\t // Try to override file permission\n\t if (e.code === 'EPERM') {\n\t fs.chmodSync(file, '0666');\n\t fs.unlinkSync(file);\n\t } else {\n\t throw e;\n\t }\n\t }\n\t}",
"function unlinkSync(file) {\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add settings to the edge that are needed to draw it | function addEdgeSettings(d, source_a, target_a) {
if (target_a - source_a < -pi) {
d.rotation = 'cw';
d.total_angle = 2 + (target_a - source_a) / pi;
d.angle_sign = 1;
} else if (target_a - source_a < 0) {
d.rotation = 'ccw';
d.total_angle = (source_a - target_a) / pi;
d.angl... | [
"function setEdgeLocations(edge){\n edge\n .attr(\"x1\", function (d) {return getEdgeCoordinate(d.source.x, d.source.width);})\n .attr(\"y1\", function (d) {return getEdgeCoordinate(d.source.y, d.source.height);})\n .attr(\"x2\", function (d) {return getEdgeCoordi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the API sepcific request options | function getRequestOptions() {
var requestOptions = url.parse(ENDPOINT);
requestOptions.auth = 'api:' + settings.key;
requestOptions.method = 'POST';
return requestOptions;
} | [
"__getRequestOptions(path, host_name, api_key) {\n return {\n hostname: host_name,\n path: path,\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n 'api_key': api_key,\n 'Accept': 'application/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to delay link redirects by 2 seconds. | function delay (URL) {
setTimeout( function() { window.location = URL }, 1500 );
} | [
"function redirectDelay(url, time)\n{\n setTimeout('window.location = \"' + url + '\"', time);\n}",
"function hrefDelay(URL, time) {\n\t setTimeout(function () {\n\t window.location = URL;\n\t }, time);\n\t }",
"function hrefDelay(URL, time) {\n setTimeout(function() {\n window.location =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Switch Lights switch the corresponding lights to green and start a new timer | function switchLights() {
//console.log("switchLights", );
if(objlightsNorthSouth.yellow){
objlightsNorthSouth.yellow = false;
objlightsNorthSouth.red = true;
ReactDOM.render(<NorthLightsRed />, document.getElementById('lightsNorth'));
ReactDOM.render(<SouthLightsRed />, document.getElementById('lightsS... | [
"function updateLights(){\n\tif (seconds==0) {\n\t\tilluminateStopLight();\n\t\t//console.log(\"turning on Red\");\n\t} else if (seconds==1) {\n\t\tilluminateSlowLight();\n\t\t//console.log(\"turning on Yellow\");\n\t} else if (seconds==2) {\n\t\tilluminateGoLight();\n\t\t//console.log(\"turning on Green\");\n\t} e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removing duplicate events (by name) irrespective of their date. Returns duplicate removed list. Lower duplicates are removed. | function removeDuplicateEvents(sortedEvents) {
var eventHashmap = new Array();
for (var i in sortedEvents) {
eventHashmap[sortedEvents[i].name] = [];
}
for (var i in sortedEvents){
eventHashmap[sortedEvents[i].name].push(sortedEvents[i]);
}
events = [];
for (var key in eventHashmap) {
events.push((event... | [
"function removeDuplicatesEvents(data) {\n return data.filter(function (obj, pos, arr) {\n return arr.map(function (mapObj) {\n return mapObj['id'];\n }).indexOf(obj['id']) === pos;\n });\n }",
"function stripDuplicatedEvents() {\n\tvar venueNames = {};\n\tfor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Work out what boost (if any) we can apply to battle points | function CalculateBattlePointBoost(playerUID, battlePoints)
{
var boostPoints = 0;
var inventoryData = server.GetUserInventory({ PlayFabId: playerUID });
var timedBoost = null;
var consumableBoost = null;
// Determine if the player has any boosts in their inventory
for(var itemIndex=0;itemIndex < inventory... | [
"isBoosted(page) {\n return rank.isImplicitlyBoosted(page) || rank.isExplicitlyBoosted(page) || undefined;\n }",
"function detectMageSubClassBoost() {\n let characterSubClass = document.getElementById('subclass-select').value;\n if(characterSubClass === 'Elementalist') {\n character.baseSta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a flashing bracket | function sendFlashingBracket(message,key) {
var arr = sys.playersOfChannel(tourschan);
for (var x in arr) {
var newmessage = message;
if (tours.tour[key].players.indexOf(sys.name(arr[x]).toLowerCase()) != -1) {
// send highlighted name in bracket
var htmlname = html... | [
"function sendFlashingBracket(message,key) {\n\tvar arr = sys.playersOfChannel(tourschan);\n\tfor (var x in arr) {\n\t\tvar newmessage = message;\n\t\tif (tours.tour[key].players.indexOf(sys.name(arr[x]).toLowerCase()) != -1) {\n\t\t\t// send highlighted name in bracket\n\t\t\tvar htmlname = html_escape(sys.name(ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pointer Events Polyfill: Adds support for the style attribute "pointerevents: none" to browsers without this feature (namely, IE). (c) 2013, Kent Mewhort, licensed under BSD. See LICENSE.txt for details. | function PointerEventsPolyfill(t){if(this.options={selector:"*",mouseEvents:["click","dblclick","mousedown","mouseup"],usePolyfillIf:function(){if("Microsoft Internet Explorer"==navigator.appName){var t=navigator.userAgent;if(null!=t.match(/MSIE ([0-9]{1,}[\.0-9]{0,})/)){var e=parseFloat(RegExp.$1);if(11>e)return!0}}re... | [
"function PointerEventsPolyfill(t){if(this.options={selector:\"*\",mouseEvents:[\"click\",\"dblclick\",\"mousedown\",\"mouseup\"],usePolyfillIf:function(){if(\"Microsoft Internet Explorer\"==navigator.appName){var t=navigator.userAgent;if(null!=t.match(/MSIE ([0-9]{1,}[\\.0-9]{0,})/)){var e=parseFloat(RegExp.$1);if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gen a keypair && ask friendbot to fund it with XLMs | async function createAccount() {
try {
const pair = StellarSdk.Keypair.random();
console.log("Requesting XLMs");
// Asking friendbot to give us some lumens on the new a/c
await fetch(
`https://horizon-testnet.stellar.org/friendbot?addr=${pair.publicKey()}`
);
return pair;
} catch (e)... | [
"function generateKeyPair(req, res, next){\n\n var comment = req.params.email;\n var keyName = req.params.keyName;\n var pair = keypair();\n var publicKey = forge.pki.publicKeyFromPem(pair.public);\n var publicKeySSH = forge.ssh.publicKeyToOpenSSH(publicKey, comment);\n\n //BUGFIX:if a key already e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shifts the values on the cells to the right (rightmost values are removed, leftmost cells are set as empty) | shiftRight() {
for (let line of this.cells) {
for (let i = line.length - 1; i > 0; i--) {
line[i].setType(line[i - 1].type);
}
line[0].setType(BeadType.default);
}
} | [
"function ShiftArrayValsLeft(arr){\n}",
"function flip_right() {\n var temp = get_empty_board(size);\n // For every row\n for (j = 0; j < size; j++) {\n // For every column\n for (i = size - 1; i >= 0; i--) {\n var value = board[i][j];\n if (value != null) {\n temp[j].pus... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
How long should I update the canvas? Clone the canvas, and then fade it away | function cloneFadeCanvas() {
var fadeTime = 1000;
var canvas = $("canvas:not(.clone)")
var canvasClone = canvas.clone();
//Create a clone of the canvas and label it as such
canvasClone.addClass("clone");
canvasClone.insertBefore(canvas);
//Copy the content of the canvas from the original
var cloneContext = ca... | [
"function fadeOut() {\n context.fillStyle = \"rgba(255,255,255,0.1)\";\n context.fillRect(0, 0, canvas.width, canvas.height);\n setTimeout(fadeOut,250);\n}",
"function img_update () {\n\tcontext.drawImage(tmpCanvas, 0, 0);\n\ttmpContext.clearRect(0, 0, tmpCanvas.width, tmpCanvas.height);\n}",
"static _... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accounts // //////////// Returns new unique account ID | getNewAccountId()
{
let id = this.meta["accounts.next-id"]
this.meta["accounts.next-id"] = id + 1
return id
} | [
"function addNewAccount(account){\n\tvar db = Ti.Database.open(royaledb);\n\tdb.execute('INSERT INTO myaccounts(accountName, fullName, infoId, username, password) VALUES (?,?,?,?,?)', account.AccountName, account.FullName, account.InfoId, account.UserName, account.Password);\n\tvar rowId = db.lastInsertRowId;\n\tdb... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that converts the dataURL to a binary blob object | function dataURLtoBlob(dataUrl) {
// Decode the dataURL
var binary = atob(dataUrl.split(',')[1]);
// Create 8-bit unsigned array
var array = [];
for (var i = 0; i < binary.length; i++) {
array.push(binary.charCodeAt(i));
}
// Return our Blob object
return new Blob([ new Uint8Array(array) ]... | [
"function dataURLtoBlob(dataUrl) {\n // Decode the dataURL\n var binary = atob(dataUrl.split(',')[1]);\n\n // Create 8-bit unsigned array\n var array = [];\n for (var i = 0; i < binary.length; i++) {\n array.push(binary.charCodeAt(i));\n }\n\n // Return our Blob object\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the command handler for removing a customer location as defined in protobuf. | function removeCustomerLocation(removeCustomerLocationCommand, entityState, ctx) {
if (!entityState.added) {
ctx.fail("Customer location does not exist");
}
else if (entityState.removed) {
ctx.fail("Customer location already removed");
}
else {
// Create the event.
const customerLocationRemove... | [
"async removeLocation(location) {\n await server.database.query(REMOVE_LOCATION_QUERY, location.id);\n }",
"function customerLocationRemoved(customerLocationRemoved, entityState) {\n entityState.removed = true;\n\n // Return the new state.\n return entityState;\n}",
"function deleteLocation(locatio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wipe save from localStorage | function delete_save() {
vamp_load_vals.forEach(
function (val) {
localStorage.removeItem(val);
}
);
// Also delete special stuff:
localStorage.removeItem('money_flag');
localStorage.removeItem('energy_upgrade_flag');
localStorage.removeItem('buffer');
message('Your local save has been wiped clean.')... | [
"function wipeSave(){\n if (supports_html5_storage()){\n localStorage.removeItem(\"save\");\n cookies = 0;\n cursors = 0;\n }\n}",
"function wipeSave(){\r\n if (supports_html5_storage()){\r\n localStorage.removeItem(\"save\");\r\n cookies = 0;\r\n cursors = 0;\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sorts comments according to comparatorFn. The comment array is sorted in place, but we return a reference to the same comments array. | sort(comments, comparatorFn) {
return comments.sort(comparatorFn);
} | [
"function sortComments(comments) {\n comments.sort(comp);\n $.each(comments, function() {\n this.children = sortComments(this.children);\n });\n return comments;\n }",
"function sortComments() {\n if (pThis.appConfig.commentSortingField &&\n pThis.appCon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Global Scope: Do you know about `foo`? NO: cache ref | function bar() { /* Global Scope: Do you know about `bar`? NO: cache ref */
var foo = 'baz'; /* bar Scope: Do you know about `foo`? NO: cache ref */
function baz() { /* bar Scope: Do you know about `baz`? NO: cache ref */
/* baz Scope: Do you know about `foo` (parameter)? NO: cache ref */
foo = 'bam'; /* b... | [
"function baz() { /* bar Scope: Do you know about `baz`? NO: cache ref */\n /* baz Scope: Do you know about `foo` (parameter)? NO: cache ref */\n foo = 'bam'; /* baz Scope: Do you know about `foo`? YES */\n bam = 'yay'; /* baz Scope: Do you know about `bam`? NO: cache ref in global scope */\n }",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if it is reachabe from asyncid1 to asyncid2 we impliment it by recursion because we also want to get a path for asyncid1 to asyncid2 | function _reachable(records, asyncid1, asyncid2, path, visited, filterLinkType) {
path.push(asyncid1);
visited[asyncid1] = true;
if (asyncid1 == asyncid2)
return true;
var next = [];
if (records.hasOwnProperty(asyncid1)) {
var rcd = records[asyncid1];
... | [
"isReachable(vertID1, vertID2, curr=null, path=[]) {\n if(curr == vertID1) {\n return [];\n }\n if(curr == vertID2) {\n path.push(curr);\n return path;\n }\n let result = [];\n curr = curr || vertID1;\n for(let edge of this.edgeList) {\n if(edge[0] == curr) {\n path.p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a function with a big switch statement to encode our enum > JSON. | function generateEnumToJson(fullName, enumDesc) {
const chunks = [];
const functionName = (0, case_1.camelCase)(fullName) + 'ToJSON';
chunks.push((0, ts_poet_1.code) `export function ${(0, ts_poet_1.def)(functionName)}(object: ${fullName}): string {`);
chunks.push((0, ts_poet_1.code) `switch (object) {`... | [
"generateStackValueEnum() {\n const svEnum = Object.keys(this._allTypes).map(\n (typeName, idx) => `_${idx}(${typeName})`\n );\n this.writeData('SV_ENUM', svEnum.join(',\\n '));\n }",
"function generateEnumFromJson(ctx, fullName, enumDesc) {\n const { options, utils } = ctx;\n const chunks... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An initial paint must be completed before these components can be correctly sized and the whole plot remargined. gd._replotting must be set to false before these will work properly. | function finalDraw() {
Shapes.drawAll(gd);
Images.draw(gd);
Plotly.Annotations.drawAll(gd);
Legend.draw(gd);
RangeSlider.draw(gd);
RangeSelector.draw(gd);
} | [
"function replot() {\n updateBrushData();\n updateYAxis();\n plotContext();\n updateMain();\n }",
"function _redraw(){\n _redrawRequired = true;\n }",
"function redraw() {\n\n\n\n\t\t\t// hide tooltip and hover states\n\n\t\t\tif (tracker.resetTracker) {\n\n\t\t\t\ttracker.resetTracker();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
recursive function; converts multidimension arrays of hex into a single block | function rawHex (hexArray) {
var output = "", i;
for (i=0;i<hexArray.length;i++) {
if (typeof hexArray[i]=="object"&&typeof hexArray[i].push=="function") {
output += rawHex(hexArray[i]);
} else {
output += (hexArray[i]).toString(); // just to make sure everything is a string
}
}
return output;
... | [
"encode64Nested (array) {\n var Buffer = require('buffer').Buffer\n let transformed = []\n let finalArray = []\n\n for (let i =0; i < array.length; i++) {\n for (let j = 0; j < array[i].length; j++) {\n transformed.push(Buffer.from(array[i][j], 'base64').toString('ascii'))\n }\n}\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns when user double clicks in search field | function AutoComplete_DoubleClick(id) {
user_typed_query = __AutoComplete[id]['element'].value;
if (user_typed_query != '') {
AutoComplete_ShowDropdown(id);
return;
}
return false;
} | [
"function jsDblClick() {\n if (!clicked) {\n clicked = true;\n return true;\n }\n else {\n return false;\n }\n }",
"static get searchChanged() {}",
"get doubleClickSelectsWord() {}",
"static set searchChanged(value) {}",
"handleDoubleClick() {\n const { doubleClick = true } = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sell all noninstalled items | async function SellNotInstalled(receivedMessage)
{
var authorID = receivedMessage.author.id; // Get user's id
const AllItems = await Items.findAll({ where: { UID: authorID, place: 0 } }); // Get user's unused items
if (AllItems.length == 0)
{
receivedMessage.channel.send("В вашем инвентаре нет неиспользуе... | [
"function sellUselessItems() {\n\tlet basicsX = parent.G.maps.main.npcs[6].position[0];\n\tlet basicsY = parent.G.maps.main.npcs[6].position[1];\n\t\n\tfor(let i = 0; i < SELLARRAY.length; i++) {\n\t\tif(quantity(SELLARRAY[i]) > 0) {\n\t\t\tif(!is_moving(character)) {\n\t\t\t\tparent.current_map === \"main\" ? smar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allow people to change the name of their hero using window.prompt | function enterName(){
hero.name = prompt("Please enter your hero name!");
if (hero.name != null) {
document.getElementById("name").innerHTML = `Hero Name: ${hero.name}`
} else {
return true;
};
displayStats()
} | [
"function playerNameSelection()\n{\n\tplayer.name = prompt('Veuillez choisir un nom de joueur'); //le prompt nous demande de choisir un nom (Samuel)\n}",
"function editNames() {\n\t\tplayer1 = prompt(\"Change Player1 name\");\n\t\t\n\n\t\tdocument.querySelector(\"p.Player1\").innerHTML = player1;\n\t\n\t}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saving new atom into moleculate.json | static save(atom) {
let data = jsonfile.readFileSync(MAINFILE);
if (isNewAtom(atom.name)) {
data.atoms.push(atom);
jsonfile.writeFileSync(MAINFILE, data, {spaces: 4});
cl(`Created new atom: `.green + `${atom.name}`.gray);
}
else
cl(`Atom already exists: `.red + `${atom.name}`.gray);
} | [
"save() {\n\t\tconst content = JSON.stringify(this.objects);\n\t\tfs.writeFile('./file.json', content, 'utf8', function (err) {\n\t\t\tif (err) {\n\t\t\t\treturn console.log(err);\n\t\t\t}\n\t\t});\n\t}",
"function save() {\n\tconsole.log('Updated')\n\tfs.writeFileSync('people.json', JSON.stringify(people, null, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handleLinks the currentview of value in state this will let us reset currentView as needed by using handleLinks('desired view name') notice currentView is set as '' in this.state above | handleLinks(viewName) {
this.setState({
currentView: viewName
})
} | [
"handleNavItemClick() {\n\t\tthis.props.updateCurrentView( this.props.viewName );\n\t}",
"handleLink () {\n if (this.link === 'Customer') {\n this.linkTo= \"/Customer\";\n }\n else if (this.link === 'Business') {\n this.linkTo=\"/Business\";\n }\n else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
let the bomb explode | explodeBomb(bomb, r) {
var x = bomb.getXPosition();
var y = bomb.getYPosition();
bomb.setAnim(3);
this.makeNoise(c.SOUND_KEY_EXPL, -1);
this.checkForKill(x, y, bomb);
this.gameMap.setTile(x, y, c.FILTER_BOMB | c.MAP_BOMB_CENTER);
var i = 1;
if (r == 0) {
this.commit();
return;
}
// explode rig... | [
"function SuperBombExplosion(bomb)\n\t{\n\t\tfor(var i = 0; i < BoardColSize; i++)\n\t\t{\n\t\t\tfor(var j = 0; j < BoardRowSize; j++)\n\t\t\t{\n\t\t\t\tvar wall = WallLayer.getObjectAt(i, j)\n\t\t\t\tif(wall instanceof Wall)\n\t\t\t\t{\n\t\t\t\t\tperkManager.RemoveWall(wall)\n\n\t\t\t\t\t// Add explosion\n\t\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the string is an Ethereum address using basic regex. Does not validate address checksums. If given value is not a string, then it returns false. | function isEthereumAddress(value) {
return typeof value === 'string' && validator_lib_isEthereumAddress__WEBPACK_IMPORTED_MODULE_1___default()(value);
} | [
"function isEthereumAddress(value) {\n return typeof value === \"string\" && validator.isEthereumAddress(value);\n}",
"function isEthereumAddress(value) {\n return typeof value === \"string\" && validator.isEthereumAddress(value);\n }",
"function isEthereumAddress(value) {\n return typeof value ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
8: Already logged in SL, so now login to CPortal (POST) >>>>>>>>>>>>>>>>>>>>>>>>>>> | function loginCPortal() {
// Final events after loginSL success
console.log("Attempting final actions/POST..");
// Create dummy form and submit
try {
// Create dummy form and submit
var submit_form = document.createElement('form');
submit_form.method = 'POST';
submit_for... | [
"function logIn(){\r\n var url = \"https://xxxxx/login\"; // Replace xxxxx with mission tracker domain\r\n var payload = {\r\n \"username\":\"xxxx\", //Replace xxxx with Mission Tracker User Name\r\n \"password\":\"xxxx\" //Replace xxxx with Mission Tracker pw\r\n }; \r\n var opt = {\r\n \"payload\":pa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select deal type widget. | function SelectDealTypeWidget(userProfile, dealTable) {
this.userProfile = userProfile;
this.dealTable = dealTable;
this.dealTypeComboboxHandler();
if (this.userProfile.privilege === PRIVILEGE_TYPE.NURSE) {
$("#select-deal-type").hide();
}
$.cookie("dealType", "all", {expires : 7, path : "/"});
} | [
"function setSelectedWidget() {\n var widgetType = $('#widget_type').val();\n switch(widgetType) {\n case 'slide':\n widget = slideshowWidget;\n break;\n case 'feed':\n widget = feedWidget;\n break;\n case 'gallery':\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A map of user names of all chatters in the chat, mapped to their status in the channel. | get allChattersWithStatus() {
return new Map(shared_utils_1.flatten(Object.entries(this._data.chatters).map(([status, names]) => names.map(name => [name, status]))));
} | [
"function getChannelsToJoin() {\n var chnls = [];\n var json = jsonParse(\"./userData/activeChannels.json\");\n for (var c in json.activeChannels) {\n //console.log(json.activeChannels[c].username);\n // TODO: if the username is active add to list, if not skip.\n chnls.push(json.activeChannels[c].userna... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all plugins that feature a given property/class method. | getPluginsByProp(prop) {
return this._plugins.filter(plugin => prop in plugin);
} | [
"_detectMethods() {\n let properties = getAllMethods(this)\n\n for (let p of properties) {\n this._methods.push(p)\n }\n }",
"get plugins() {\n return Array.from(this.#plugins.values());\n }",
"async callPlugins(prop, ...values) {\r\n for (const plugin of this.getPluginsByProp(pr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A helper function that returns the standardized ghost DNA The function returs an array of segment objects, which each have these properties pace: The pace of the segment; distance: The distance of the segment; startTime: The time when the segment starts; => this allows quick checking of which segment we are in startDis... | _standardize (args) {
const output = []
const firstSeg = {
pace: typeof(args[0]) === "number" ? args[0] : args[0][0],
distance: typeof(args[0]) === "number" ? 1000 : args[0][1],
startTime: 0,
startDistance: 0
}
output.push(firstSeg)... | [
"createTimeGapMapping() {\n const timeGapMapping = {};\n this.patients.forEach((d) => {\n const curr = this.sampleStructure[d];\n for (let i = 1; i < curr.length; i += 1) {\n if (i === 1) {\n timeGapMapping[curr[i - 1]] = undefined;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set a timer to do a random swim after a random interval of time has passed. | function generateRandomSwim()
{
let randomTimerDuration = RandomSwimInterval_Min + Math.floor((1 + RandomSwimInterval_Max - RandomSwimInterval_Min) * Math.random());
currentRandomTimer = window.setTimeout(doRandomSwim, randomTimerDuration);
} // end generateRandomSwim() | [
"function randomTimer(){\n\tlet randomiseDivAtTime =null;\n\trandomiseDivAtTime = setInterval(randomiseImg, 500);\n\t\n}",
"function changeCulprit() {\n let timerId = null; \n timerId = setInterval(holeRandom, 700) \n}",
"_startTimer() {\n let interval = this.config[\"appear\"][\"interval\"]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Viewmodel for binding transcription controls | function TranscriptionAudioVM( settings ) {
var
self = this,
wavesurfer,
mediaObj = null,
mediaId = settings.mediaId || '',
isPatientPortal = ( settings.patientRegId && settings.patientRegId !== '' ),
proxyDat... | [
"function Prescription(data) {\n var self = this;\n // Reduced view\n self.dateDispensed = ko.observable(new Date(data.dateFilledKey.dateValue));\n self.drugName = ko.observable(data.fdaProductKey.proprietaryProductName);\n\n self.NDC = ko.observable(data.fdaProductKey.ndcNormalizedCode);\n self.q... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
changeColor changes the color of the colored boxes depending on the selection of the respective select box. | function changeColor(){
// Variable idName stores the ID of the elements that invoked this function
var idName = this.id;
var left_color = document.getElementById("links");
var middle_color = document.getElementById("mitte");
var right_color = document.getElementById("rechts");
... | [
"function changeColor(){\n\t// Variable idName stores the ID of the elements that invoked this function\n\tvar idName = this.id;\n\n\t// Use if else statement to distinguish which select box has been used.\n\t// For each case: select the html element that correspond to the used select box.\n\t// For this element se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check the write queue length | function check_queue_write() {
if (intf.intf.queue_write.length < 1) {
intf.intf.writing = false;
return false;
}
intf.intf.writing = true;
return true;
} | [
"queueIsFull() {\n return this.queue.length >= this.maxSize\n }",
"function queueCount(){\n\tif( this.writes&& this.writes.length){\n\t\treturn this.writes.length\n\t}else if( this.reads&& this.reads.length){\n\t\treturn -this.reads.length\n\t}else{\n\t\treturn 0\n\t}\n}",
"get length() {\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
will replace a texture if any of it's flags matches with the flags | function replaceTextureAnyOfFlags(index, texture, flags) {
var nodes;
// sanitize
texture = Math.abs(~~texture);
// is this a known texture?
if (TEXTURE_INFO[texture]) {
nodes = getTextureNodesByIndex(index);
if (TEXTURE_INFO[_rawMap[_blockTextures + nodes... | [
"updateTextures(){\r\n this.enableTextures(this.enableAllTextures);\r\n }",
"RebuildTextures() {}",
"set alphamapTextures(value) {}",
"updateTexture() {\n const currentFrame = this.currentFrame;\n this._previousFrame !== currentFrame && (this._previousFrame = currentFrame, this._texture = this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Refresh forum data and discussions list. | function refreshData() {
var promises = [];
promises.push($mmaModForum.invalidateForumData(courseid));
if (forum) {
promises.push($mmaModForum.invalidateDiscussionsList(forum.id));
promises.push($mmGroups.invalidateActivityGroupMode(forum.cmid));
}
return ... | [
"function fetchForumDataAndDiscussions(refresh) {\n return $mmaModForum.getForum(courseid, module.id).then(function(forumdata) {\n forum = forumdata;\n\n $scope.title = forum.name || $scope.title;\n $scope.description = forum.intro || $scope.description;\n $scope.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Only stop the tree traversal when at least a single result is retrieved. Otherwise, continue digging deeper, overriding maxDepth. This function was added to fix a failing test in the original implementation. (The last one). | function stop() {
const reachedMax = depth >= maxDepth;
if (!reachedMax) return false;
const hasResult = result.length;
if (hasResult) return true;
const hasDeepResult = deepSuggestions.filter(arr => arr.length).length;
return !!hasDeepResult;
} | [
"function depthLimitedSearch(initialNode, problem, limit){\n return recursiveDLS(initialNode, problem, limit);\n}",
"maxDepth() {\n let maximum = null;\n\n const _setMaximum = (depth) => {\n if (maximum === null) {\n maximum = depth;\n return;\n }\n\n if (maximum < depth) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Opportunity Phases by id. | async function getOpportunityPhases (req, res) {
res.send(await service.getOpportunityPhases(req.authUser, req.params.opportunityId))
} | [
"function getAppt (id) {\n return allAppts.get(id);\n }",
"async function updateOpportunityPhases (req, res) {\n res.send(await service.updateOpportunityPhases(req.authUser, req.params.opportunityId, req.body))\n}",
"getAllPlans(id) {\n return this.execute('get', '/partsplan' + `/${i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if a new menu item was selected. | function menuSelect( item ) {
var menuId = createId( "menu_", item );
if ( menuSelected ) {
if ( menuSelected.id == menuId ) {
return false;
}
else {
menuSelected.removeClassName( "selected" );
}
}
menuSelected = $( menuId );
menuSelected.addClassName( "selected" );
return true;
... | [
"function isSelectionUpdated() {\n\t\t\t// sometimes user hover the mouse over menu items then continue outside of the whole menu\n\t\t\t// this will cause no menu item being selected\n\t\t\t// in this case, we will keep the current selection intact (i.e. return true)\n\t\t\tconsole.debug(\"length: \" + $(menuItemS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Applies click listeners to the toolbar buttons | function ApplyToolbarHandlers(){
var buttons = document.getElementsByClassName("toolbar-button");
//Megaplay
buttons[0].addEventListener("click", function(){
gameInstance.SendMessage("RTClipEditor", "PlayActiveClipFromHTML");
});
//Play/pause
buttons[1].addEventListener("click", function... | [
"function createToolbarListeners() { \n var toolbarBtnList = document.getElementsByClassName('toolbarBtn');\n var i;\n for (i = 0; i < toolbarBtnList.length; ++i) {\n var currentButton = toolbarBtnList[i];\n addToolbarClickListener(currentButton);\n }\n}",
"addEventListenersToButtons(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
populates the collapsable area that contains a list of courses. This space is used for learning, teaching as well as favorite videos and courses. the argument typeOfCourses can e the following: learning teaching favoriteVideos favoriteCourses | function populateMyCoursesSection(typeOfCourses) {
var myCoursesData;
if ($testmode == 0) {
myCoursesData = $dataHeader;
} else {
$.getJSON("/modules/header/js/myCourses.json", function (cData) {
myCoursesData = cData;
});
}
// consolelog("MYCOURSES");
// cons... | [
"function populate_courses() {\n console.log(`Building info boxes for ${COURSES.length} courses:`, COURSES.join(\", \"));\n var $table = $('#courselist').empty();\n for (var name of COURSES) {\n $('<div>')\n .append([\n $('<h3>')\n .text(i18next.t(`backend.courses.${name}.name`, name)),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
upload media or reuse from cache | uploadMedia(file, mediaMode) {
} | [
"async function storedMediaAt(url) {\n if ((await CACHED_MEDIA.get(url)) == null) {\n const media = await fetch(url).then((response) => {\n if (response.status === 200) {\n return response.arrayBuffer();\n }\n throw new Error(\n `Received ${response.status} while fetching media to s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Holds all information related to an Interaction event | function InteractionData()
{
/**
* This point stores the global coords of where the touch/mouse event happened
*
* @member {PIXI.Point}
*/
this.global = new core.Point();
/**
* The target Sprite that was interacted with
*
* @member {PIXI.Sprite}
*/
this.target = ... | [
"function InteractionData(){ /**\n\t * This point stores the global coords of where the touch/mouse event happened\n\t *\n\t * @member {PIXI.Point}\n\t */this.global=new core.Point(); /**\n\t * The target Sprite that was interacted with\n\t *\n\t * @member {PIXI.Sprite}\n\t */this.ta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |