query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Constructor: pmaLayout Constructs a new fast pma layout for the specified graph. | function pmaLayout(graph)
{
mxGraphLayout.call(this, graph);
} | [
"function GraphArea(graphManager){\n\tthis.svgManager = graphManager.svgManager;\n\tthis.graphManager = graphManager;\n\t// this.padding = 0.1;\n\t// this.paddingLeft=0.1;\n\t// this.paddingRight = 0.02;\n\tthis.paddingRightPx = 25;\n\t// this.paddingBottom = 0.15;\n\t// this.paddingTop = 0.01;\n\tthis.graphPadding... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the average of the last `number` elements of the given array. | function getAverage(elements, number){
var sum = 0;
//taking `number` elements from the end to make the average, if there are not enought, 1
var lastElements = elements.slice(Math.max(elements.length - number, 1));
for(var i = 0; i < lastElements.length; i++){
... | [
"function averageNumbers(array){\n let sum = 0;\n let avg;\n for ( let i = 0 ; i < array.length ; i++ ){\n sum = sum + array[i];\n avg = sum / array.length\n }\n return avg\n}",
"function avgValue(array)\n{\n\tvar sum = 0;\n\tfor(var i = 0; i <= array.length - 1; i++)\n\t{\n\t\tsum += array[i];\n\t}\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
do a quick gc of a thread: reset the stack (possibly shrinking storage for it) reset all global data checks all known threads if t is null, but not h$currentThread | function h$gcQuick(t) {
if(h$currentThread !== null) throw "h$gcQuick: GC can only run when no thread is running";
h$resetRegisters();
h$resetResultVars();
var i;
if(t !== null) { // reset specified threads
if(t instanceof h$Thread) { // only thread t
h$resetThread(t);
} ... | [
"function cleanup() {\n if (global.gc) {\n global.gc();\n }\n}",
"function h$finalizeMVars() {\n ;\n var i, t, iter = h$blocked.iter();\n while((t = iter.next()) !== null) {\n if(t.status === h$threadBlocked && t.blockedOn instanceof h$MVar) {\n // if h$... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return original URL for req. If index specified, then set it as _index query param | function requestUrl(req, index) {
const port = req.app.locals.port;
let url = `${req.protocol}://${req.hostname}:${port}${req.originalUrl}`;
if (index !== undefined) {
if (url.match(/_index=\d+/)) {
url = url.replace(/_index=\d+/, `_index=${index}`);
}
else {
url += url.indexOf('?') < 0 ? ... | [
"function getListIndex()\n{\n\tvar prmstr = window.location.search.substr(1);\n\tvar prmarr = prmstr.split (\"&\");\n\tvar params = {};\n\n\tfor ( var i = 0; i < prmarr.length; i++) {\n\t var tmparr = prmarr[i].split(\"=\");\n\t params[tmparr[0]] = tmparr[1];\n\t}\n\tlistIndex = params.listindex;\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
buildDatabaseAndCollections() This function will build out our database (by attempting to connect to it, which creates it if it doesn't already exist. It will then call three events asyncronisly to ensure the proper collections are created for us, before closing the connection. | async function buildDatabaseAndCollections(error, database) {
// If we have an error...
if (error) {
// Log it
console.log('database error: ', error);
// Otherwise...
} else {
// Setup a database object
let databaseObject = database.db(config.database.name);
// Call our creation events asyncronis... | [
"function databaseInitialize() {\n if (!db.getCollection(collections.PLACES)) {\n db.addCollection(collections.PLACES);\n }\n\n if (!db.getCollection(collections.RATINGS)) {\n db.addCollection(collections.RATINGS);\n }\n}",
"init() {\n\t\ttry {\n\t\t\tthis.database = new lokijs(consts.databasePath, {\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set up the events if we have a colision between monster and arrow | function colisionMonsterAndArrow(monster, arrow){
if(monster !== undefined && arrow !== undefined){
if(bump.hit(monster, arrow)){
log("colision ok");
// //remove heart
// stage.removeChild(hearts[monsterLives-1]);
// hearts.splice(monsterLives-1, 1);
... | [
"createInteractionZones() {\n this.r3a1_graphics = this.add.graphics({fillStyle: {color: 0xFFFFFF, alpha: 0.0}});\n //this.graphicsTest = this.add.graphics({fillStyle: {color: 0x4F4F4F, alpha: 1.0}});\n //TOP ZONES\n //xpos ypos x y\n this.r3a1_increaseAs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all the seminars | function getSeminars(req, res) {
Seminar.find({},(err, Seminar) => {
if (err) {
res.send(err);
}
res.json(Seminar);
});
} | [
"function retrieveStations() {\n stationsPromise = allStations()\n .then((stns) => {\n stations = stns;\n stationsPromise = null;\n return stns;\n });\n return stationsPromise;\n}",
"static async listStations(req, res) {\n const stations = await Station.retrieve();\n return res.json(s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Executes a MySQL query to insert a new assignment into the database. Returns a Promise that resolves to the ID of the newlycreated assignment entry. | function insertNewAssignment(assignment) {
return new Promise((resolve, reject) => {
assignment = extractValidFields(assignment, AssignmentSchema);
assignment.id = null;
mysqlPool.query(
'INSERT INTO assignments SET ?',
assignment,
(err, result) => {
if (err) {
reject(e... | [
"async insertNewTask(task){\r\n try {\r\n const insertId = await new Promise((resolve, reject) => {\r\n const query = \"INSERT INTO task (Title, List_ID, Done, Task_Date) VALUES (?,?,?,?)\";\r\n\r\n connection.query(query, [task.Title, task.ListID, task.Done, task.Tas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handler for Earth's frameend event. | function frameend()
{
shuttle.update();
} | [
"function endCallback() {\n logger.log('[whois][' + session.getID() + '] whois server connection ended');\n session.clientEnd();\n }",
"function endCallback() {\n endIANA(session);\n }",
"function video_done(e) {\n\tthis.currentTime = 0;\n}",
"function onSocketEn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the path where to store the qr images | function getQrImagePathToSave()
{
return path.join(__dirname,'../../../client/qr-images/');
} | [
"function getImagePath(source){\n\tvar urlPath = url.parse(source).path;\n\tvar lastPath = _.last(urlPath.split(\"/\"));\n\tvar savePath = ORGINAL_IMAGE_PATH + lastPath;\n\treturn savePath;\n}",
"function pngPath(size) {\n\t\treturn path.join(cacheDir, baseName + '-' + size + '.png')\n\t}",
"function findcardim... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add message node before passed second node or to beginning | _addMessageNode(messageNode, nextNode = null) {
if (nextNode) {
this.container.insertBefore(messageNode, nextNode);
} else if (this.left > 0) {
this.container.insertBefore(messageNode, this.buttonLoadMore);
} else {
this.container.appendChild(messageNode);
}
} | [
"function insertAboveConversation(node) {\n let threadNode = document.getElementById('discussion_bucket');\n threadNode.parentNode.insertBefore(node, threadNode);\n}",
"function bringNodeToFront(p) {\n\tlet i, j;\n\tp.selection.bringToFront();\n\tfor (i = 0; i < p.channels.length; ++i) {\n\t\tfor (j = 1; j ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Makes sure the table representing the PeerConnection event log is created and appended to peerConnectionElement. | function ensurePeerConnectionLog(peerConnectionElement) {
var logId = peerConnectionElement.id + '-log';
var logElement = $(logId);
if (!logElement) {
var container = document.createElement('div');
container.className = 'log-container';
peerConnectionElement.appendChild(container);
logElement = d... | [
"function ensureStatsTableContainer(peerConnectionElement) {\n var containerId = peerConnectionElement.id + '-table-container';\n var container = $(containerId);\n if (!container) {\n container = document.createElement('div');\n container.id = containerId;\n container.className = 'stats-table-container'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save the links into the Document Properties | function persistLinks(e) {
var linksInCache = JSON.parse(CacheService.getPrivateCache().get('links'));
var documentProperties = PropertiesService.getDocumentProperties();
var linksInDoc = documentProperties.getProperty('LINKS');
if(linksInDoc == null) {
documentProperties.setProperty('LINKS', JSON.stringify... | [
"function showLinkDialog_LinkSave(propert_key, url) {\n\tPropertiesService.getDocumentProperties().setProperty(propert_key, url);\n}",
"function saveLinks(id, links, type) {\n links = links.trim().split(\",\") //turn comma separated list into array\n links.forEach(link => {\n if (type == \"doc\") {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return an array of gap fillers; if they start on 30m interval, should be a 30 then 1hr if they end on 30m interval, should be hours then a 30 | function getGapFiller(gap) {
const fillers = [];
const remainingGap = {
start: new Date(gap.prev.end),
end: new Date(gap.next.start)
};
var gapEnd = null,
gapStart = null;
// leading 30
if (gap.prev.end.getMinutes() == 30) {
gapEnd = new Date(gap.prev.end);
gapEnd.setMinutes(0)... | [
"function gap(time, div, r) {\r\n if (div === 60) {\r\n return (2 * Math.PI * r) * (60 - time / div);\r\n } else {\r\n return (2 * Math.PI * r) * (12 - time / div);\r\n }\r\n}",
"function minMaxBPM() {\n var min = Infinity;\n var max = 0;\n for (var i = 0; i < coords.length; i++) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Build the path to the virtualenv | function buildVenvDir() {
// Create the venv path
const home_dir = process.env["HOME"];
const action_id = process.env["GITHUB_ACTION"];
if (!home_dir) {
throw new Error("HOME MISSING");
}
return path.join(home_dir, `venv-${action_id}`);
} | [
"getProjectPath() {\n let siteName = this.args.getSiteName();\n let projectPath = (0, _path.join)(this.args.output.filename, siteName);\n\n if (!(0, _fs.existsSync)(projectPath)) {\n (0, _fs.mkdirSync)(projectPath);\n }\n\n return projectPath;\n }",
"function makeKVSpath() {\n\tvar temp = hel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deserialize a dataframe from a JSON text string. | function fromJSON(jsonTextString) {
if (!isString(jsonTextString))
throw new Error("Expected 'jsonTextString' parameter to 'dataForge.fromJSON' to be a string containing data encoded in the JSON format.");
return new DataFrame({
values: JSON.parse(jsonTextString)
});
} | [
"function fromJSON5(jsonTextString) {\r\n if (!isString(jsonTextString))\r\n throw new Error(\"Expected 'jsonTextString' parameter to 'dataForge.fromJSON5' to be a string containing data encoded in the JSON5 format.\");\r\n return new DataFrame({\r\n values: JSON5.parse(jsonTextString)\r\n })... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gymnastics. 5 points. Write a function that prompts the user to enter six scores. From those six scores, the lowest and highest should be discarded. An average score should be computed from the remaining four. Your function should output the discarded scores, as well as the average score. Scores must be real numbers in... | function gymnastics() {
/////////////////// DO NOT MODIFY
let total = 0; //// DO NOT MODIFY
let scores = []; // DO NOT MODIFY
/////////////////// DO NOT MODIFY
/*
* NOTE: The 'total' variable should be representative of the sum of all
* six of the judges' scores.
*/
/*
* NOTE: You need ... | [
"function student1(){\n studentId =\"1234\"; \n fname =\"Paul\";\n lname =\"Calais\";\n email =\"paul@yahoo.com\";\n pic ='images/paul.jpg';\n\n// This function is created to assign for student1 grades\n\n p1Num = 95;\n q1Num = 95;\n\n p2Num = 80;\n q2Num = 75;\n\n p3Num = 88;\n q... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function handling data from SensorEventListener for Motion data, such as Acceleration (with and without gravity included) and Rotation (Gyroscope) | function deviceMotionHandler(eventData) {
var info, xyz = "[X, Y, Z]";
// Update the provided HTML file to give visual feedback (optional, nice to have during development)
// Grab the acceleration from the results
var acceleration = eventData.acceleration;
info = xyz.replace("X", acceleration.x && acceleration.x... | [
"function deviceOrientationHandler (eventData) {\n\tvar info, xyz = \"[X, Y, Z]\";\n\n\t// Update the provided HTML file to give visual feedback (optional, nice to have during development)\n\n\t// Grab the acceleration from the results\n\tinfo = xyz.replace(\"X\", eventData.alpha && eventData.alpha.toFixed(3));\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given the epoch (in millis) at the last inventory update, update the updatedTimeSpan to show the number of elapsed minutes since it was updated. | function updatedTimeSpan(epochAtLastUpdate) {
var e = document.getElementById('updatedTimeSpan');
var nowEpoch = (new Date).getTime();
e.innerHTML = calculateMinutesFromMillis(nowEpoch - epochAtLastUpdate);
} | [
"function updateTimeElapsed() {\n var time = formatTime(Math.round(video.currentTime));\n timeElapsed.innerText = formatTimeHumanize(time);\n timeElapsed.setAttribute('datetime', `${time.hours}h ${time.minutes}m ${time.seconds}s`);\n }",
"function updateTimer() {\n //get time since last u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reverse comparator function for comparing timestamps of notes while sorting | function reverseCompareTimestamps(note1, note2) {
if(note1.timestamp > note2.timestamp)
return -1;
if(note1.timestamp < note2.timestamp)
return 1;
return 0;
} | [
"function noteCompareByTime(note1 , note2) {\n\n\tvar first_time = parseInt(note1.note_time);\n\tvar second_time = parseInt(note2.note_time);\n\n\tif (first_time < second_time) {\n\t\treturn -1;\n\t}\n\tif (first_time > second_time) {\n\t\treturn 1;\n\t}\n\treturn 0;\n\n}",
"function sortNotes(){\n notesList.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Go to the last cell that is run or current if it is running. Note: This requires execution timing to be toggled on or this will have no effect. | function selectLastRunCell(notebook) {
let latestTime = null;
let latestCellIdx = null;
notebook.widgets.forEach((cell, cellIndx) => {
if (cell.model.type === 'code') {
const execution = cell.model.metadata.get('execution');
if (execution &&
... | [
"changeCellRight() {\n const cells = this.get('cells');\n const hoverIndex = this.get('hoverIndex');\n const lastIndex = cells.length > 0 ? cells.length - 1 : 0;\n const isLoop = this.get('isLoop');\n const noSwitch = this.get('noSwitchRight');\n const inheritPosition = this.get('parentWindow.inhe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CREATE Mob. CALLED IN INITIAL.JS.CREATE() create mobs in a for loop or something.. | function createMob(){
mob();
//timer variable keeps track of time elapsed since game started.
} | [
"function createMob() {\n var rand = Math.random();\n var tear = 1;\n if (rand < 0.5) {\n tear = 1;\n } else if (rand < 0.8) {\n tear = 2;\n } else if (rand < 0.95) {\n tear = 3;\n } else {\n tear = 4;\n }\n enemy = new Monster(LEVEL, tear);\n updateMob();\n}",
"spawn(mob){\r\n\r\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_.maxBy(array, [iteratee=_.identity]) This method is like _.max except that it accepts iteratee which is invoked for each element in array to generate the criterion by which the value is ranked. The iteratee is invoked with one argument: (value). Arguments array (Array): The array to iterate over. [iteratee=_.identity]... | function maxBy(arr, iteratee) {
const { length } = arr;
if (!length) {
return arr;
}
if (typeof iteratee === `string`) {
const str = iteratee;
iteratee = (o) => o[str];
}
if (length === 1) {
return iteratee(arr[0]);
}
let maxObj = arr[0];
let maxVal = iteratee(arr[0]);
for (let ... | [
"function max(array, key) {\n let best = null;\n let bestValue = null;\n for (let elt of array) {\n let eltValue = key(elt);\n if (bestValue == null || eltValue > bestValue) {\n bestValue = eltValue;\n best = elt;\n }\n }\n return best;\n}",
"function findMaximumValue(array) {\n\n}",
"fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes the given circle from the map. | removeCircle(circle) {
return this._circles.get(circle).then(c => {
c.setMap(null);
this._circles.delete(circle);
});
} | [
"function removePoint(){\n \t if(currentPt != null){\n \t\t map.removeLayer(currentPt);\n \t\t currentPt = null;\n \t\t recenterMap();\n \t\t resetCurrentLoc();\n \t }\n }",
"removeHitObject() {\n const pos = this.findObj(this.lastUpdated);\n if (pos >= 0) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
does a page with this slug exist? | function pageExists (slug) {
return test('-f', PAGE_DIR+slug+'.md');
} | [
"function pageExists( title )\n{\n if (FILE.file_exists( pagePath( title ) ) || isSpecial( title ) ){\n return true;\n }else{\n return false;\n }\n}",
"async isCorrectPageOpened() {\n let currentURL = await PageUtils.getURL()\n return currentURL.indexOf(this.pageUrl)!== -1\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets a given number of items from a given feed URL optionally starting from a given cursor | function fetchFeedItems(url, from, count, callback) {
from = from || 0;
count = count || 20;
var feed = new google.feeds.Feed(FEED_URL);
feed.setResultFormat(google.feeds.Feed.JSON_FORMAT);
feed.setNumEntries(from + count);
feed.includeHistoricalEntries();
log('From ' + from + ' to ' + (from + count) +... | [
"function fetchItems() {\n const offset = state.offset - 1;\n state.offset += 10 - 1;\n state.index += 10 - 1;\n return axios\n .get(\n `${apiURL}/api/trade/fetch/${state.itemIds.result.splice(\n state.index,\n offset\n )}?query=${state.itemIds.id}`\n )\n .... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a storage profile to the Kaltura DB. | static add(storageProfile){
let kparams = {};
kparams.storageProfile = storageProfile;
return new kaltura.RequestBuilder('storageprofile', 'add', kparams);
} | [
"static update(storageProfileId, storageProfile){\n\t\tlet kparams = {};\n\t\tkparams.storageProfileId = storageProfileId;\n\t\tkparams.storageProfile = storageProfile;\n\t\treturn new kaltura.RequestBuilder('storageprofile', 'update', kparams);\n\t}",
"function addToStorage(key, skill) {\n skillsDatabase.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset input Playlist Name and Playlist Url | function setResetInputsListener() {
$("#reset").on('click', function(event) {
event.preventDefault();
$("#Playlist_Name").val("");
$("#Playlist_Url").val("");
$("#thumbnail").attr("src", "https://vignette.wikia.nocookie.net/pandorahearts/images/7/70/No_image.jpg.png/revision/latest?cb=201210... | [
"function updatePlaylist(playlist, artistName, songTitle){\n playlist[artistName] = songTitle\n return playlist\n}",
"function clearInput() {\n $(\"#url\").val('');\n }",
"function updatePlaylist(playlist, artistName, songTitle) {\n playlist[artistName] = songTitle\n\n return playlist\n}",
"fun... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
zooms to bounding box identified by passed osm_id | function zoomTo(osm_id) {
try {
submitGetRequest( this.url + "?action=getBBOX4OSM_ID&OSM_ID=" + osm_id, handleGetBBOX4OSM_ID, null, false );
} catch(e) {
alert( 1 + JSON.stringify( e ) );
}
} | [
"function zoomToNode(id) {\n const node = figma.getNodeById(id);\n if (!node) {\n console.error(\"Could not find that node: \" + id);\n return;\n }\n figma.viewport.scrollAndZoomIntoView([node]);\n}",
"function startBoxZooming(event, map) {\r\n let x0 = event.clientX;\r\n let x1 = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
the actual loading screen to be shown when you open the game | function loadingScreen() {
textAlign(CENTER);
textSize(40);
image(player, width/4, width/4, width/2, width/2);
text("LOADING. . .", width/2, width/2);
} | [
"function displayLoadingScreenForInitialPageLoad() {\n\t\tdocument.getElementById(\"loading_screen\").style.display = \"block\";\n\t\tsetLoadingScreenDimensions();\n\t}",
"function DefaultLoadingScreen(_renderingCanvas,_loadingText,_loadingDivBackgroundColor){if(_loadingText===void 0){_loadingText=\"\";}if(_loadi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads a LEASE frame from the buffer and returns it. | function deserializeLeaseFrame(buffer, streamId, flags, encoders) {
(0, _invariant2.default)(
streamId === 0,
'RSocketBinaryFraming: Invalid LEASE frame, expected stream id to be 0.'
);
let offset = FRAME_HEADER_SIZE;
const ttl = buffer.readUInt32BE(offset);
offset += 4;
const requestCount = buffer... | [
"function getRomFrame(addr){\n\n}",
"readKey() {\n const r = this.reader;\n\n let code = r.u8();\n\n if (code === 0x00) return;\n\n let f = null;\n let x = null;\n let y = null;\n let z = null;\n\n if ((code & 0xe0) > 0) {\n // number of frames, byte case\n\n f = code & 0x1f;\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Save mapping from documentUri to graphUris, e.g. for future deletion operations | function saveDocToGraphMapping(documentUri, graphUris) {
const prevGraphUris = privateData.documentToGraph[documentUri];
if (!prevGraphUris) {
privateData.documentToGraph[documentUri] = new Set(graphUris);
} else {
graphUris.forEach(u => prevGraphUris.add(u));
}
} | [
"function persistLinks(e) {\n var linksInCache = JSON.parse(CacheService.getPrivateCache().get('links'));\n var documentProperties = PropertiesService.getDocumentProperties();\n var linksInDoc = documentProperties.getProperty('LINKS');\n if(linksInDoc == null) {\n documentProperties.setProperty('LINKS', JSON... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this loops over all the databases and creates pool cluster objects map in poolClusters | static init() {
const oThis = this;
// looping over all databases
for (let dbName in mysqlConfig['databases']) {
let dbClusters = mysqlConfig['databases'][dbName];
// looping over all clusters for the database
for (let i = 0; i < dbClusters.length; i++) {
let cName = dbClusters[i],
cConfig = mys... | [
"function DBCluster(props) {\n return __assign({ Type: 'AWS::Neptune::DBCluster' }, props);\n }",
"function loadClouds() {\n cloud01.create();\n cloud02.create();\n cloud03.create();\n cloud04.create();\n cloud05.create();\n cloud06.create();\n cloud07.create();\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw a mark to the given position | __mark(context, Position) {
const { x, y, } = this.CoordinateTransform(Position); // Get real position
if (Position.x != 1 && Position.y != 1) { // left top
this.__line(context, { x: x - 10, y: y - 5 }, { x: x - 5, y: y - 5 });
this.__line(context, { x: x - 5, y: y - 10 }, { x: x... | [
"function moveMarks() {\r\n moveCircleMark();\r\n moveSquareMark();\r\n }",
"function markModel(markMode, rectangle) {\n\n\n\n}",
"function placeMark(x, y, image) {\n // the particle will be scaled from min to max to add variety\n var scale = Math.random() * (trpm.maxS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Data maintenance / cleaning helper TODO: validation according to further criteria e.g. re where the list of all currencies and precious metals are available We take it granted for now that each entry in fx.json is of a valid currency type Some currencies are misrepresented in the data set (e.g. MOP), maybe some statist... | function cleanFx() {
// Remove entries without a currency code present
fxData.fx = fxData.fx.filter(fx =>
fx.currency
&& (typeof fx.currency === "string")
&& fx.currency.trim() !== ""
&& fx.currency.trim() !== "XXX"
);
} | [
"function parsetransData(d){\n \n return{\n geoid_2: +d.geoid_2,\n geography: d.geo_display,\n total_population: +d.HC01_EST_VC01,\n age_group: [\n {'16-19': +d.HC01_EST_VC03},\n {'20-24': +d.HC01_EST_VC04},\n {'25-44': +d.HC01_EST_VC05},\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
userform_addGroupToUser() flip over the groups in the AvailableGroupList and move any that are selected to the GroupList. at the same time, create the appropriate entries in the userhash. | function userform_addGroupToUser() {
var RN = "userform_addGroupToUser";
var su = userform_lookupSelectedUser();
var agl = document.getElementById('AvailableGroupList');
var gl = document.getElementById('GroupList');
if (agl && gl) {
unHighLightList("GroupList");
unHighLightList("AccessControlList");
for ... | [
"function setHistoryUserGroupList(offset, size, ordinal, direction) {\n\t 'use strict';\n\t \n\t if (offset === undefined || offset === null || isNaN(offset)) {\n\t\toffset = 0;\n\t }\n\t \n\t if (size === undefined || size === null || isNaN(size)) {\n\t\tsize = 20;\n\t }\n\t \n\t if (ordinal === undefined... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a MongoLog Object that takes either a string or an object. If a string is provided it is put on the message property of the MongoLog Object. If an object is provided each key on the object is put on the MongoLog Object. | constructor(db, log, level) {
if (typeof log === 'object') {
Object.keys(log).forEach(key => {
if (key === 'db' || key === 'level') {
throw new TypeError(`Invalid key: ${key}`);
}
this[key] = log[key];
})
} else {
this.message = log;
}
if (typeof db ... | [
"static async createLogDbModelInstanceFromLogDataAndSave(jrContext, type, message, extraData, mergeData) {\n\t\tlet logObj;\n\n\t\tif (message && !(typeof message === \"string\")) {\n\t\t\t// unusual case where the message is an object; for db we should json stringify as message\n\t\t\t// in this way the db log mes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
util.RegExp.addFlags(regexp, flags) > RegExp regexp (RegExp): Regular expression. flags (String): Flags to add. Adds flags to the given regular expression. util.RegExp.addFlags(/\s/, "g"); // > /\s/g util.RegExp.addFlags(/\s/, "gim"); // > /\s/gim If the given regular expression already has the flags, no action is take... | function addFlags(regexp, flags) {
var reg = core.interpretRegExp(regexp);
var regFlags = core.arrayUnique(
reg.flags.split(""),
flags.split("")
).join("");
return new RegExp(reg, regFlags);
} | [
"function regexpFrom(string, flags) {\n return new RegExp(core.escapeRegExp(string), flags);\n }",
"function getRegExp(pattern, flags) {\n var safeFlags = angular.isString(flags) ? flags : \"\";\n return (angular.isString(pattern) && pattern.length > 0) ? new RegExp(pattern, safeFl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets the selected time to client (system) time | resetSelected() {
this.setHour(this.time.hour)
this.setMinute(this.time.minute)
this.setPeriod(this.time.getPeriod())
} | [
"function setCurrentTime() {\n\t\tvar total = player.currentTime;\n\t\tcurrentTimeElement.innerHTML = timeFormat(total);\n\t}",
"function refreshMainTimeView() {\n setText(document.querySelector(\"#text-main-hour\"),\n addLeadingZero(Math.floor(setting.timeSet / 3600), 2));\n setText(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: extGroup.getSubType DESCRIPTION: get ext data subtype ARGUMENTS: groupName extension data group file name RETURNS: string subType | function extGroup_getSubType(groupName)
{
return dw.getExtDataValue(groupName, "subType");
} | [
"function extPart_getPartType(groupName, partName)\n{\n var retVal = \"\";\n\n if (groupName)\n {\n retVal = dw.getExtDataValue(groupName, \"groupParticipants\", partName, \"partType\");\n }\n\n return retVal;\n}",
"function getItemSubType() {\n return new RegExp(`^${template.bug.headlines[0]}`).test(ite... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new ConsoleLog destination. | function ConsoleLogDestination(filter, formatter) {
this.filter = filter || Utils.allowAll;
this.formatter = formatter || defaultFormatter;
} | [
"function Destination(props) {\n return __assign({ Type: 'AWS::Logs::Destination' }, props);\n }",
"function createNewLogFile() {\n var basePath = (global.TYPE.int === global.TYPE_LIST.CLIENT.int ? \"./\" : path.join(__dirname, \"..\")); //Get base path\n if (fs.existsSync(path.join(basePath, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
createTrain() This function creates the train using a train 3D Object to hold the different parts. The body of the train is created using a boxGeom, and the wheels are created using TorusGeometry. | function createTrain() {
var train = new THREE.Object3D();
//create the larger part of the body
var geom = new THREE.BoxGeometry(8,4,2);
var material = new THREE.MeshPhongMaterial({ambient:"rgb(120,60,30)"}); //dark brown
var mesh = new THREE.Mesh(geom,material);
mesh.position.set(... | [
"createModel () {\n var model = new THREE.Object3D()\n var loader = new THREE.TextureLoader();\n var texturaOvo = null;\n\n var texturaEsfera = null;\n \n //var texturaGrua = new THREE.TextureLoader().load(\"imgs/tgrua.jpg\");\n this.robot = new Robot({});\n this.robot.scale.set(3,3,3);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Controller for the MdChips component. Responsible for adding to and removing from the list of chips, marking chips as selected, and binding to the models of various input components. | function MdChipsCtrl ($scope, $mdConstant, $log, $element, $timeout) {
/** @type {$timeout} **/
this.$timeout = $timeout;
/** @type {Object} */
this.$mdConstant = $mdConstant;
/** @type {angular.$scope} */
this.$scope = $scope;
/** @type {angular.$scope} */
this.parent = $scope.$parent;
/** @type ... | [
"function setCurrencyList(currency, defval) {\r\n var obj = {}\r\n for (var key in currency) {\r\n obj[currency[key]] = null\r\n }\r\n $('#ddcurrlist').material_chip({\r\n placeholder: \"Enter Currency Pair\",\r\n data: defval,\r\n autocompleteLimit: 5,\r\n autocompleteOptions: {\r\n data: o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hide the user list frame, and clear some related stuffs | function hideUserFrame(){
cachedName = "";
fullCachedName = "";
listSize = 0;
mentioningUser = false;
if(isUserFrameShown){
userList.remove();
isUserFrameShown = false;
}
} | [
"function hideUI() {\n document.getElementById(\"options\").classList.add(\"hidden\");\n document.getElementById(\"fullelement\").classList.add(\"hidden\");\n document.getElementById(\"memorywindow\").classList.add(\"hidden\");\n}",
"function hideWatchlistTable() {\n $(\"#watch-table-header\").hide();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets value of optimalCrops array Adds up values inside game.discrete.optimalCrops, which is equal to the maximum possible score | function calculateMaxScore () {
for (var i=0; i <= game.maxturn-1; i++) {
game.discrete.maxScore += game.discrete.optimalCrops[i]
}
return game.discrete.maxScore;
} | [
"updateExhaustedVotes() {\n const votesSum = this.count[this.round].reduce((a, b) => a + b);\n const exhausted = (this.p * this.numBallots) - votesSum;\n\n this.exhausted[this.round] = exhausted;\n }",
"set score(newScore) {\r\n score = newScore;\r\n _scoreChanged();\r\n }",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
c. metodo para editar un registro en el document tracks | static async edit(id, titulo, descripcion, avatar, color) {
// comprobar que ese elemento exista en la BD
const trackTemp = await this.findById(id);
if (!trackTemp) throw new Error("El track solicitado no existe!");
// crear un DTO> es un objeto de trancicion
const modificador = {
titulo,
... | [
"function editNote(){\n\t\n\tvar moment = require('alloy/moment');\n\t\n\tvar note= myNotes.get(idNote);\n\tnote.set({\n\t\t\"noteTitle\": $.noteTitle.value,\n\t\t\"noteDescription\": $.noteDescription.value,\n\t\t\"date\": moment().format()\n\t}).save();\n\t\n\tvar toast = Ti.UI.createNotification({\n\t\t \t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads the project id from environment variables. | getProductionProjectId() {
return (process.env['GCLOUD_PROJECT'] ||
process.env['GOOGLE_CLOUD_PROJECT'] ||
process.env['gcloud_project'] ||
process.env['google_cloud_project']);
} | [
"get githubAppId () {\n return process.env.GITHUB_APP_ID\n }",
"loadEnv() {\n let env = dotenvExtended.load({\n silent: false,\n path: path.join(this.getProjectDir(), \".env\"),\n defaults: path.join(this.getProjectDir(), \".env.defaults\")\n });\n\n const... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if a user can affect another user's status based on their roles. | function canAffect(userRole, targetRole) {
if (userRole === 'owner') {
return true;
}
if (targetRole === 'owner') {
return false;
}
return userRole === 'moderator' && targetRole === 'user';
} | [
"function can(user, action, target) {\n assert(typeof action === 'string')\n\n switch (action) {\n case 'READ_MESSAGE': // target is message\n assert(target)\n // Anyone can see a message as long as it's not hidden\n if (!target.is_hidden) return true\n // On... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Push boolean onto the stack. | pushBoolean(b) {
this.pushObject(Lua.valueOfBoolean(b));
} | [
"push(val) {\n this._stack.push(val);\n }",
"_add_boolean_expression_subtree_to_ast(boolean_expression_node, parent_var_type) {\n this.verbose[this.verbose.length - 1].push(new NightingaleCompiler.OutputConsoleMessage(SEMANTIC_ANALYSIS, INFO, `Adding ${boolean_expression_node.name} subtree to abstr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clone and move infoboxes into the right rail. | function doInfoboxen() {
// <div id="section_SpokenWikipedia" class="infobox sisterproject plainlinks haudio">
// Move the infobox into the right rail.
var $ibClone = $('.infobox').clone(true, true);
if ($ibClone.length) {
// Remove the old one.
$('.infobox').remove();
$('#wsidebar').append($i... | [
"function doNavboxen() {\n\t\t\t// Move vertical-navbox into the right rail.\n\t\t\tvar $nbClone = $('.vertical-navbox').clone(true, true);\n\t\t\tif ($nbClone.length) {\n\t\t\t\t// Remove the old one.\n\t\t\t\t$('.vertical-navbox').remove();\n\t\t\t\t$('#wsidebar').append($nbClone);\n\t\t\t}\n\t\t}",
"function d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
8 This function returns a string containing the keys (prperty names) of of all the properties on the flower object. | function listKeys() {
let keyString = "";
for (let key in flower) {
keyString += key + ", ";
}
return keyString;
} | [
"getPropertyKeys() {\n let properties = this.getProperties();\n let propertyKeys = [];\n if (properties) {\n for (var key in properties) {\n if (Object.prototype.hasOwnProperty.call(properties, key)) {\n propertyKeys.push(key);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function replace(string,text,by) Thay the ky tu trong mot chuoi | function replace(pString, pText, by) {
try {
var strLength = pString.length,
txtLength = pText.length;
if ((strLength == 0) || (txtLength == 0)) return pString;
var vIndex = pString.indexOf(pText);
while (vIndex >= 0) {
pString = pString.replace(pText, by);
... | [
"function replace(string,text,by) {\n // Replaces text with by in string\n\t var i = string.indexOf(text);\n\t var newstr = '';\n\t if ((!i) || (i == -1)) return string;\n\t newstr += string.substring(0,i) + by;\n\n\t if (i+text.length < string.length)\n\t\t newstr += replace(string.substring(i+text.length,string.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Register controllers so they can be accessed in the property 'controllers' a literal object with all userdefined controllers. (key = name of controller, value = user defined controller class) | register(...controllers) {
for (let controller of controllers) {
if (controller.name === 'DEFAULT') {
throw new Error('"DEFAULT" is a reserved controller name, use a different name.');
}
this.controllers[controller.name] = new controller(this);
}
... | [
"function initControllers() {\n CONTROLLERS.forEach(loadController)\n }",
"function initializeControllers() {\n let instances = [];\n controllers.forEach(x => {\n instances.push(new x.Controller());\n });\n return instances;\n}",
"function registerRouter(controllers, router) {\n if (!c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate a tick at every multiple of divisor, stop at max width | function generate_ticks(multiple, divisor, suffix) {
var result = [];
var t = 0;
while (true) {
result.push([Math.round(availableSpace * t / totalDuration), t, t / divisor + suffix]);
if (t > totalDuration) {
break;
}
t += multiple ... | [
"static Repeat(value, length) {\n return value - Math.floor(value / length) * length;\n }",
"function generate(min, max, capacity, options) {\n\t\tvar timeOpts = options.time;\n\t\tvar minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);\n\t\tvar major = determin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
REQUETES UTILSATEUR : Onglet : Application de profil TAPEZ ICI LE CODE DE LA REQUETE D'INSERTION | function User_Insert_Application_de_profil_Lot_s__5(Compo_Maitre)
{
/*
***** INFOS ******
Nbr d'esclaves = 2
Id dans le tab: 15;
simple
Nbr Jointure: 1;
Joint n° 0 = article,lo_article,ar_numero
Id dans le tab: 16;
simple
Nbr Jointure: PAS DE JOINTURE;
******************
*/
var Table="lot";
var CleMaitre = ... | [
"function User_Insert_Codes_postaux_Codes_postaux0(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 3\n\nId dans le tab: 203;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 204;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 208;\ncomplexe\nNbr Jointure: 2;\n Joint n° 0 = co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finds the next safe (unique) slug to use | getNextSafeSlug(originalSlug, isDryRun) {
let slug = originalSlug;
let occurenceAccumulator = 0;
if (this.seen.hasOwnProperty(slug)) {
occurenceAccumulator = this.seen[originalSlug];
do {
occurenceAccumulator++;
slug = originalSlug + '-' + occurenceAccumulator;
} while (thi... | [
"function getSlug() {\n\n // if we're on the home page, there won't be a slug\n if (window.location.pathname == '/') {\n return 'home';\n // otherwise, get the slug\n } else {\n // get the full path and split it into components\n var pathComponents = window.location.pathname.match(/([^\\/]+)/g);\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copyright 20052014 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the Licens... | function showGrowl(message, title, theme) {
var context = getContext();
if (theme) {
context.jGrowl(message, { header:title, theme:theme});
}
else {
context.jGrowl(message, { header:title});
}
} | [
"function showInfoFallr(msg) {\n\tjQuery.fallr('show', {\n\t\tcontent : '<p>'+ msg +'</p>',\n\t\ticon : 'info'\n\t});\n}",
"renderWelcomeMessage(language) {\n switch(language) {\n case 'en':\n this.setState({welcomeMessage: 'Welcome message from STORMRIDER'});\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
QueryAssetsByOwner queries for assets based on a passed in owner. This is an example of a parameterized query where the query logic is baked into the TDrive, and accepting a single query parameter (owner). Only available on state databases that support rich query (e.g. CouchDB) Example: Parameterized rich query | async QueryAssetsByOwner(ctx, owner) {
let queryString = {};
queryString.selector = {};
queryString.selector.docType = 'asset';
queryString.selector.owner = owner;
return await this.GetQueryResultForQueryString(ctx, JSON.stringify(queryString)); //shim.success(queryResults);
... | [
"async function searchOrdersOfOwner(login, atState, containerId){\n\tconst uri = '/transdev/shop/v1/secured/api/command/searchOrdersOfOwner/?login=' + login + '&containerId=' + containerId;\n\tconst url = `${API_ROOT}` + uri;\n return _doGet(url);\n}",
"listTournamentRecordsAroundOwner(bearerToken, tournamentI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the metatable for a Lua value. | setMetatable(o, mt) {
if (Lua.isNil(mt)) {
mt = null;
}
else {
this.apiCheck(mt instanceof LuaTable_1.LuaTable);
}
var mtt = mt;
if (o instanceof LuaTable_1.LuaTable) {
var t = o;
t.se... | [
"set type(aValue) {\n this._logger.debug(\"type[set]\");\n this._type = aValue;\n }",
"function set_value(vals, val, is_variable) {\n set_head(head(vals), val);\n set_tail(head(vals), is_variable);\n }",
"function doSetValue(identifier,value,objectname,callbackname,randomnumber)\n{\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Time: O(2n) > n Where n is the amount of even nodes in the LinkedList Space: O(1) | removeEvenValues() {
let current = this.head;
while (this.head.value % 2 === 0) {
if (this.head.next) {
current = this.head.next;
this.head.next = null;
this.head = current;
} else {
this.head.value = null;
}
}
while (current.next) {
if (current.... | [
"function findHalf(head, stack) {\n var runner1, runner2;\n runner1 = runner2 = head;\n\n while (runner2) {\n stack.push(runner1.value);\n runner1 = runner1.next;\n runner2 = runner2.next;\n runner2 = runner2.next;\n if (!runner2 || !runner2.next) break;\n }\n\n while (runner2 && runner2.next) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the Elastic Search Server connection | async initialize() {
const nodes = this._config.get(CONFIG_KEY.ES_NODE);
const maxRetries = this._config.get(CONFIG_KEY.ES_MAXRETRIES);
const requestTimeout = this._config.get(CONFIG_KEY.ES_REQUEST_TIMEOUT);
const sniffOnStart = this._config.get(CONFIG_KEY.ES_SNIFF_ON_START);
Assert.isNonEmptyArray... | [
"function createElasticConnection () {\n\n if (testing) {\n function genPromise() {\n return new Promise(function(resolve, reject) { reject(\"No els\"); });\n }\n\n els = {\n search: function() { return genPromise(); },\n index: fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When the user moves the mouse between the main menu button and the submenu there might be a mouseout() event that will dismiss the submenu. To avoid this UI problem the dismissal is delayed by a little bit and the submenu gets a window in which to cancel its own dismissal. | function dismiss()
{
while( subMenu = subMenusUp.pop() )
{
if( ! subMenu.cancelDismiss )
{
subMenu.getElementsByTagName("ul")[0].style.display = "none";
}
}
} | [
"function close()\n{\n\tif(menuitem) menuitem.style.visibility = 'hidden'; // hide the sub menu\n} // end function",
"static onMenuItemClicked(event) {\n let menuHideOnClick = $(event.target).parents(\".popup-menu\").data(\"hide-on-click\");\n let itemHideOnClick = $(event.target).parents(\"li\").data(\"hid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Devuelve la instancia de la clase AlmacenesRoute | static get instanceAlmacenRoute() {
return this.almacenesRouteInstance || (this.almacenesRouteInstance = new this());
} | [
"_generateRoute( answers ) {\n\n // monta a rota\n let obj = {\n route : `/${answers.path}`,\n controller : `${answers.controller}Controller`,\n function : `${answers.method}`,\n method : answers.action,\n is_public ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle received done message. Records done received. Next run stop detects and performs wrapup. | handleDone () {
const priv = privs.get(this)
switch (priv.state) {
case State.Done:
case State.Errored:
return
case State.Running:
case State.Stopped:
case State.Stopping:
priv.state = State.Done
}
} | [
"handleRunStopped () {\n const priv = privs.get(this)\n if (priv.state === State.Done) privm.wrapup.call(this)\n }",
"function done() {\n putstr(padding_left(\" DONE\", seperator, sndWidth));\n putstr(\"\\n\");\n }",
"function completedProcess(self) {\n\t//console.log('completedProcess called');\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the given result is from failed transaction or transaction list. | static isFailedTx(result) {
if (!result) {
return true;
}
if (CommonUtil.isDict(result.result_list)) {
for (const subResult of Object.values(result.result_list)) {
if (CommonUtil.isFailedTxResultCode(subResult.code)) {
return true;
}
if (subResult.func_results) ... | [
"static txPrecheckFailed(result) {\n const precheckFailureCode = [21, 22, 3, 15, 33, 16, 17, 34, 35];\n return precheckFailureCode.includes(result.code);\n }",
"static isFailedFuncTrigger(result) {\n if (CommonUtil.isDict(result)) {\n for (const fid in result) {\n const funcResult = result[f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gathers all selected cells into a commaseparated list to send as POST parameter | function concatCellIds() {
var cellIds = "";
var key;
var first = true;
for (key in selectedCells) {
if (selectedCells[key] != null && Ext.isPrimitive(selectedCells[key])) {
if (!first) cellIds += ",";
first = false;
cellIds += key;
}
}
var sel... | [
"function updateSelectedRows() {\n var selectedList = [];\n if (grid.api) {\n var selectedRows = grid.api.selection.getSelectedRows();\n _.each(selectedRows, function (row) {\n selectedList.push(row[component.constants.ROW_IDENTIFIER]);\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new instance of the ActiveConnectionService class. | function ActiveConnectionService(connectionService, cimService, powerShellService, fileTransferService) {
return _super.call(this, connectionService, cimService, powerShellService, fileTransferService) || this;
} | [
"constructor() { \n \n VpcPeeringConnection.initialize(this);\n }",
"function ContactService(){\r\n\t\tthis.contacts = [];\r\n\t\tthis.contactsIndex = {};\r\n\t\tthis.uuid = 0;\r\n\t}",
"constructor() { \n \n ComputeInfoProtocol.initialize(this);\n }",
"initConnectionToServic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get and set de raiz | get raiz() {
return this._raiz;
} | [
"function saveValues () {\n ff1 = f1; ff2 = f2; ff3 = f3; // Kraftbeträge\n xxL = xL; yyL = yL; xxR = xR; yyR = yR; // Positionen der Rollen\n }",
"get nombre(){\n return this._nombreMascota\n }",
"setNiveau(niveau) {\n this.niveau = niveau;\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Alias of getQTIAncestor for assessmentItem. | function getQTIAssessmentItem(elem) {
return getQTIAncestor(elem, "assessmentItem");
} | [
"getItemAncestors(item) {\n return this.composer.getItemAncestors(item);\n }",
"getItemParent(item) {\n return this.composer.getItemParent(item);\n }",
"get parentItem()\n\t{\n\t\t//dump(\"get parentItem: title:\"+this.title);\n\t\tif ((!this._parentItem) && (!this._newParentItem)) {\n\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::AppMesh::Route.HttpPathMatch` resource | function cfnRouteHttpPathMatchPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnRoute_HttpPathMatchPropertyValidator(properties).assertSuccess();
return {
Exact: cdk.stringToCloudFormation(properties.exact),
Regex: cdk.stringToCloud... | [
"function cfnGatewayRouteHttpPathMatchPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnGatewayRoute_HttpPathMatchPropertyValidator(properties).assertSuccess();\n return {\n Exact: cdk.stringToCloudFormation(properties.exact),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serializes the body to an encoded string, where keyvalue pairs (separated by `=`) are separated by `&`s. | toString() {
this.init();
return this.keys()
.map(key => {
const eKey = this.encoder.encodeKey(key);
// `a: ['1']` produces `'a=1'`
// `b: []` produces `''`
// `c: ['1', '2']` produces `'c=1&c=2'`
return this.map.get(key).map(value ... | [
"encodeParams(params) {\n return Object.entries(params).map(([k, v]) => `${k}=${encodeURI(v)}`).join('&')\n }",
"function urlEncodePair(key, value, str) {\n if (value instanceof Array) {\n value.forEach(function (item) {\n str.push(encodeURIComponent(key) + '[]=' + encodeURIComponen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
void round_hill (int cx, int cz, unsigned r, float h, float hmax, char allowcanyons) | function round_hill(cx, cz, r, h, hmax, allowcanyons) {
// Una collina rotonda, o una montagna molto erosa (se la si fa grossa).
// hmax entra in gioco se il flag "allowcanyons" Š a zero:
// quando l'altezza puntuale supera "hmax", per allowcanyons=0
// la funzione costruisce un altopiano sulla sommit... | [
"function std_crater(map, cx, cz, r, lim_h, h_factor, h_raiser, align) {\n // Un cratere. A crater.\n var x, z; //int\n\n var dx, dz, d, y, h, fr; //float\n\n h = parseFloat(r) * h_factor;\n r = Math.abs(r);\n fr = r;\n\n for (x = cx - r; x < cx + r; x++)\n for (z = cz - r; z < cz + r; z++) {\n if (x... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the current scale of the viewport | function updateScale(increment) {
var ctx = document.getElementById("canvas").getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
//var viewportScale = document.getElementById("scale").value;
axes.scale += increment;
draw();
} | [
"function setCurrentScale() {\n\t\tFloorPlanService.currentScale = $(FloorPlanService.panzoomSelector).panzoom(\"getMatrix\")[0];\n\t}",
"updateViewport() {\n const { width, height } = this.renderer.getSize();\n const rw = width / this.frameWidth;\n const rh = height / this.frameHeight;\n const ratio ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Performs (if needed) a swap in the shirt numbers on the pitch table | function performPitchTableChangeOnShirtNumbers(textElementIdentifier, draggableAttributeType, draggableAttributeIndex, droppableAttributeType, droppableAttributeIndex) {
var droppablePlayerNumber = $('#' + droppableAttributeType + 'number' + droppableAttributeIndex).text();
var draggablePlayerNumber = $('#' +... | [
"function swapPieces(face, times) {\n\tfor (var i = 0; i < 6 * times; i++) {\n\t\tvar piece1 = getPieceBy(face, i / 2, i % 2),\n\t\t\t\tpiece2 = getPieceBy(face, i / 2 + 1, i % 2);\n\t\tfor (var j = 0; j < 5; j++) {\n\t\t\tvar sticker1 = piece1.children[j < 4 ? mx(face, j) : face].firstChild,\n\t\t\t\t\tsticker2 = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method to animate said sword slashing | slashSwordAnimation() {
// console.log('slashSwordAnimation: ', this.attackAnimationSwitch, this.direction);
if (this.attackAnimationSwitch)
{
this.direction ? this.animations.play('RightAttackHtoL') : this.animations.play('LeftAttackHtoL');
this.attackAnimationSwitch = false;
} else
{
... | [
"function moveTurtle() {\n $('.turtle').animate({\n left: \"+=80vw\"\n }, 100);\n }",
"function textWiggle() {\n var timelineWiggle = new TimelineMax({repeat:-1, yoyo:true}); \n for(var j=0; j < 10; j++) {\n timelineWiggle.staggerTo(chars, 0.1, {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates that radius is a positive number | get radiusIsValid() {
return this._isPositiveNumber(this.state.radius);
} | [
"function checkSqrtArg(arg) {\n var isValid = true;\n if (arg < 0) {\n isValid = false;\n }\n return isValid;\n}",
"validate(value) {\n if (value < 0) throw new Error('Valor negativo para preço');\n }",
"isCircleTooClose(x1,y1,x2,y2){\n // if(Math.abs(x1-x2)<50 && Math.abs(y1-y... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Some mouse events can be translated directly into Responses. | function handleMouseResponseEvents(modelHelper, sortedInputEvents) {
var protoExpectations = [];
forEventTypesIn(
sortedInputEvents, MOUSE_RESPONSE_TYPE_NAMES, function(event) {
var pe = new ProtoExpectation(
ProtoExpectation.RESPONSE_TYPE, MOUSE_IR_NAME);
pe.pushEvent(event);
... | [
"function sendMouse() {\n document.addEventListener(\"mousemove\", sendSomeData);\n document.addEventListener(\"click\", sendClick);\n document.addEventListener(\"keypress\", sendKey);\n}",
"function updateMouse(e) {\n mouseX = e.pageX;\n mouseY = e.pageY;\n}",
"function sendEvent(button, pos) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checkLegal Tests whether the move is legal Params: player the player placing a token x the xcoordinate where the player is trying to place a token y the ycoordinate Returns: True if the move is legal False otherwise | checkLegal (player, x, y) {
//Is the space occupied?
if (this.board.get(x, y) !== 0) {
return false;
}
return this.__evaluationTest(player, x, y);
} | [
"placeToken (player, x, y) {\n if(!this.__gameOver){\n var captured;\n\n if (this.checkLegal(player, x, y)) {\n \t\tthis.__lastMove = {\"x\":x, \"y\":y, \"c\":player, \"pass\":false};\n this.board = this.board.clone();\n this.board.evaluateMove(player, x,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate the output of the cascade of biquad filters for an inputBuffer. | process(inputBuffer, outputBuffer) {
var x;
var y = [];
var b1, b2, a1, a2;
var xi1, xi2, yi1, yi2, y1i1, y1i2;
for (var i = 0; i < inputBuffer.length; i++) {
x = inputBuffer[i];
// Save coefficients in local variables
b1 = this.coefficients[0... | [
"stream(value) {\n let out = 0;\n this.filter.pop();\n this.filter.unshift(value);\n\n for (let i = 0, end = this.coefficients.length; i < end; ++i) {\n out += this.coefficients[i] * this.filter[i];\n }\n\n this.filter.shift();\n this.filter.unshift(out);\n return out;\n }",
"_buffer... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visit a parse tree produced by PlSqlParserset_transaction_command. | visitSet_transaction_command(ctx) {
return this.visitChildren(ctx);
} | [
"visitTransaction_control_statements(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseCounter][1]; //check type of token\n\n\tif (tempDesc == ' print' || ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expand/Collapse all bug's comments. commentSize total comment size. stateInit = set 1 for Expand init or else 2 for Collapse init. | function allCommentAction(commentSize, stateInit, expandId, imgId, prefixId, imgIdx) {
var state1 = "Expand All";
var state2 = "Collapse All";
var expandObj = document.getElementById(expandId == null ? 'comments_expand' : expandId);
imgId = (imgId == null ? "img_comment_" : imgId);
prefixId = (prefixId == null ? "... | [
"function collapseComments() {\n $('.commentarea .comment .child').hide();\n $('.tagline').append('<span class=\"expand-children\">[+]</span>');\n $('.tagline .expand-children')\n .css('cursor', 'pointer')\n .click(function() {\n toggleExpandButton(this);\n $(this).closest('.comment').find('.child').... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Clears the memory property | clearMem() {
this.memory = undefined;
} | [
"_clearMemory() {\n for (let i = 0; i < this._memory.length; i++) {\n this._memory[i] = 0;\n }\n }",
"function clearMemory(){ memory = [] }",
"clear(){\n this.buffer.length = 0;\n this.count = 0;\n }",
"function clear() {\n resetStore();\n }",
"function propertyNull() {\n\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draws in the images | function drawImages(){
image(handSanatizer, handSanatizerX, handSanatizerY, imageSizes, imageSizes);
image(mask, maskX, maskY, imageSizes, imageSizes);
image(broom, broomX, broomY, imageSizes, imageSizes);
image(washingHands, washingHandsX, washingHandsY, imageSizes ,imageSizes);
} | [
"function draw() {\n\n for (var i = 0; i < document.images.length; i++) {\n if (document.images[i].getAttribute('id') != 'frame') {\n canvas = document.createElement('canvas');\n canvas.className = \"canvas-room-basic\"\n canvas.setAttribute('width', 40... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`_encodeLiteral` represents a literal | _encodeLiteral(literal) {
// Escape special characters
let value = literal.value;
if (escape.test(value))
value = value.replace(escapeAll, characterReplacer);
// Write a language-tagged literal
if (literal.language)
return `"${value}"@${literal.language}`;
// Write dedicated litera... | [
"_encodeLiteral(literal) {\n // Escape special characters\n let value = literal.value;\n if (escape.test(value)) value = value.replace(escapeAll, characterReplacer); // Write a language-tagged literal\n\n if (literal.language) return `\"${value}\"@${literal.language}`; // Write dedicated literals per da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new unique buoy callback url. | createCallbackUrl() {
return `${this.serviceAddress}/${uuid_1.v4()}`;
} | [
"function createUrl(username, projectName) {\n return `http://www.github.com/${username}/${projectName}`\n}",
"static get rocketWebhookUrl() {\n\t\tlet rocketUrl = RocketChat.settings.get('Site_Url');\n\t\trocketUrl = rocketUrl ? rocketUrl.replace(/\\/?$/, '/') : rocketUrl;\n\t\treturn `${ rocketUrl }api/v1/sm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
START STATE This is the intro for the game | function displayStart() {
introSFX.play();
push();
createCanvas(500, 500);
background(0);
textAlign(CENTER);
textSize(20);
textFont(myFont);
fill(250);
text("to infinity and beyond!", width / 2, 80);
text("press X to start your adventure", width / 2, 450);
imageMode(CENTER);
translate(width / 2,... | [
"function startGame() {\n removeWelcome();\n questionIndex = 0;\n startTimer();\n generateQuestions();\n}",
"startGame() {\r\n this.generateInitialBoard();\r\n this.printBoard();\r\n this.getMoveInput();\r\n }",
"function startGame() {\n removeWelcomePage();\n createGamePag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
['red', 'green', 'yellow', 'black'] Issue: Arguments cannot be passed to the supertype. / Constructor Stealing To solve prototype inheritance call the supertype constructor within the subtype constructor. Arguments can now be passed to supertype. | function SuperType(name) {
this.colors = ['red', 'green'];
this.name = name;
} | [
"function inheritPrototype(subType, superType) {\n var prototype = object(superType.prototype); //this is a function defined eariler in this document\n //or use the following:\n //var prototype = Object.create(superType.prototype); //ECMAScript 5\n \n prototype.constructor = subType;\n subType.prototype = prototype... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the cursor keys | function createKeys() {
cursors = this.input.keyboard.createCursorKeys();
} | [
"function createCursors(players) {\n\t\tfor (var key in players) {\n\t\t\tcreateCursor(players[key]);\n\t\t}\n\t}",
"generateKeys(octaves, startOctave = 1) {\n\t\tlet tmpKeyboard = ``;\n\t\tfor (let octave = 0 ; octave < octaves; octave++) {\n\t\t\tlet tmpKeys = ``;\n\n\t\t\tthis.constructor.notes.forEach((note, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions Starts the time counter, preloads available texts, and activates the play/stop button | function start() {
generalTime = new Date();
createTextArray();
document.getElementById("playButton").addEventListener('click', buttonControl, false);
}//end function start | [
"processStartButton() {\n\t\tclearTimeout(this.timer);\n\t\tthis.timer = null;\n\t\tthis.game.switchScreens('play');\n\t}",
"function start() {\n // Disables the text area (place where the user provides input)\n $(\"txtarea_input\").disabled = true;\n \n // Enables the Stop button & di... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves the object that is being designated. | getObject() {
return this.object;
} | [
"function GetObject(name)\n{\n\tvar o=null;\n\tif(document.getElementById)\n\t\to=document.getElementById(name);\n\telse if(document.all)\n\t\to=document.all.item(name);\n\telse if(document.layers)\n\t\to=document.layers[name];\n\tif (o==null && document.getElementsByName)\n\t{\n\t\tvar e=document.getElementsByName... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
draw n enemies into enemies array | function drawEnemies(){
for (var _ = 0; _<4; _++){
var x = Math.random()*(innerWidth-enemy_width);
var y = -enemy_height;
var width = enemy_width;
var height = enemy_height;
var speed = Math.random()*4.5;
... | [
"generateEnemies() {\n // Run the spawn timer\n this.timer++;\n if (this.enemies.length == 0) {\n this.timer += 2;\n } else if (this.enemies.length == 1) {\n this.timer += 1;\n }\n\n if (\n this.timer >= this.spawnDelay &&\n this.enemies.length < MAX_ENEMIES.value\n ) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Student TP Number Validation | function tpNumberValidation(sData, tpNumber){
var studentTpNumber
studentTpNumber = sData.filter(obj => {
return obj.tpNumber === tpNumber
})
return studentTpNumber.length
} | [
"function checkInsert() {\n var insert_student_name = document.getElementById('insert_student_name').value;\n var insert_student_score = document.getElementById('insert_student_score').value;\n if (insert_student_name==null || insert_student_name=='') {\n alert('student name cannot be empty.')\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exports html to docx format and downloads automatically | function exportHTML(html){
var header = "<html xmlns:o='urn:schemas-microsoft-com:office:office' "+
"xmlns:w='urn:schemas-microsoft-com:office:word' "+
"xmlns='http://www.w3.org/TR/REC-html40'>"+
"<head><meta charset='utf-8'><title>Export HTML to Word Document with JavaScr... | [
"function Export2Doc(element, filename = ''){\r\n var preHtml = \"<html><head><meta charset='utf-8'><title>Export HTML To Doc</title><link rel='stylesheet' href='/static/css/style.css'></head><body>\";\r\n var postHtml = \"</body></html>\";\r\n var iframe=document.getElementById(\"awindow\");\r\n var re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
minusOne operand by right side | function minusOne() {
setExpression((minus) => {
minus = minus + '';
return minus
.split('')
.slice(0, minus.length - 1)
.join('');
});
} | [
"function removeMultiplicationByNegativeOne(node) {\n if (node.op !== '*') {\n return Node.Status.noChange(node);\n }\n const minusOneIndex = node.args.findIndex(arg => {\n return Node.Type.isConstant(arg) && arg.value === '-1';\n });\n if (minusOneIndex < 0) {\n return Node.Status.noChange(node);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checking that the it has less than 100 words | function checkWordCount(inputMessage) {
var input = inputMessage;
var newInput = input.split(" ");
if (newInput.length >= 100) {
console.log("input with less than 100", newInput);
return false;
};
} | [
"function longWord (input) {\n return input.some(x => x.length > 10);\n}",
"function checkWordCount(input) {\n\t\tconsole.log(\"count words... \", input);\n\t\tvar output = input.split(\" \").length;\n\t\tconsole.log(output);\n\t\tif (output < 100) {\n\t\t\tconsole.log(\"you have entered < 100 words \", output)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a cloned version of 'e' having 'target' as its target property; cancel the original event. | function retargetMouseEvent(e, target) {
var clonedEvent = document.createEvent("MouseEvent");
clonedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
// Object.definePro... | [
"function cancelbubbling(e) {\n Event.stop(e);\n }",
"function getTarget(e)\r\n{\r\n\tvar value;\r\n\tif(checkBrowser() == \"ie\")\r\n\t{\r\n\t\tvalue = window.event.srcElement;\r\n\t}\r\n\telse\r\n\t{\r\n\t\tvalue = e.target;\r\n\t}\r\n\treturn value;\r\n}",
"function extendEvent(e) {\n if (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
an add measurement button was clicked | function addMeasurement(event) {
event.stopPropagation();
// show the add measurement section for the associated measurement type and jump to it
var btnID_pieces = $(this).attr('id').split('_');
var form_type = btnID_pieces[0];
var meas_type = btnID_pieces[1];
showFormSection(meas_type, form_type);
wi... | [
"function pressAdd() {\n\thandleAddSub(PLUS);\n}",
"clickPlusPensioner() {\n\t\t$(document).on('click', '#plus-pensioner', () => {\n\t\t\tlet number = Number($('#number-pensioner').text());\n\t\t\tnumber += 1;\n\t\t\t$('#number-pensioner').html(number);\n\t\t\tthis.onRendered();\n\t\t});\n\t}",
"function addCli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
grants permissions to users and groups in access_list permissions indicated by perm to a resource indicate by resType and resID if user or group does not exist, it is automatically created. granter is made owner of the new group usage: granPermissions("DID"||"PID"||"GID", DID||PID||GID, READ||CHANGE||MANAGE, [emails|gr... | function grantPermission(resType, resID, perm, access_list, granter) {
list = typeof(access_list) == 'string' ? [] + access_list : access_list
for (var i = 0; i < access_list.length; i++) { //iterate over each email address
// console.log("access_list[i]: ", access_list[i])
if(access_list[i].inc... | [
"mayGrant(newPermission, granteePermissions = []) {\n return this._mayGrantOrRevoke('mayGrant', newPermission, granteePermissions);\n }",
"mayGrant(permission, granteePermissions = []) {\n const newPermission = new RNPermission(permission);\n if (this.grantsAllowed() === 0 || !this.matchIdentifier(new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a ray direction and a normal, compute and return a direction of reflected ray | function reflect(rayDirection, normal) {
return vec3.subtract(vec3.create(), rayDirection, vec3.scale(vec3.create(),
normal, 2 * vec3.dot(rayDirection, normal)));
} | [
"function refract(rayDirection, normal, ior) {\n let cosi = vec3.dot(rayDirection, normal);\n let etaOut = 1;\n let etaIn = ior;\n if (cosi < 0) {\n cosi = -cosi;\n } else { // ray hits from inside the object\n [etaOut, etaIn] = [etaIn, etaOut]; // swap etaOut and etaIn\n vec3.negate(normal, normal);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Append characters to the DOM. NOTE: The atag leads to a TEMPORARY destination. Point is to click it and have it lead to that character's character sheet eventually. | function appendCharacters(characters) {
let htmlTemplate = "";
for (let character of characters) {
htmlTemplate += `
<article>
<a href="#profile">
<h2>${character.name}</h2>
<img src="${character.img || 'img/placeholder.jpg'}">
<h3>${character.race} ${character.primary_class... | [
"function storeLetters(letters) {\n let letterContainer = document.getElementById(\"letterContainer\");\n for (const char of letters) {\n let underlined = document.createElement(\"div\");\n underlined.setAttribute(\"class\", \"underlined\");\n letterContainer.appendChild(underlined);\n var charContain... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |