query stringlengths 9 14.6k | document stringlengths 8 5.39M | metadata dict | negatives listlengths 0 30 | negative_scores listlengths 0 30 | document_score stringlengths 5 10 | document_rank stringclasses 2 values |
|---|---|---|---|---|---|---|
Example binToHex(["0111110", "1000000", "1000000", "1111110", "1000001", "1000001", "0111110"]) | function binToHex(bins) {
return bins.map(bin => ("00" + (parseInt(bin, 2).toString(16))).substr(-2).toUpperCase()).join("");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function binToHex(a) {\r\n\tvar newVal = \"\";\r\n\tfor (i = 0; i < a.length/8; i++) \r\n\t\tnewVal += (\"00\" + parseInt(a.slice(8*i, 8*i+8),2).toString(16)).slice(-2);\r\n\treturn newVal;\r\n}",
"function binToHex(bin) {\n for (var fourBitChunks = [], c = 0; c < bin.length; c += 4)\n fourBitChunks.pu... | [
"0.7413676",
"0.70409733",
"0.7034735",
"0.6969076",
"0.69535136",
"0.69194937",
"0.68874204",
"0.6870118",
"0.6826296",
"0.6817666",
"0.680198",
"0.680198",
"0.680198",
"0.67952865",
"0.67902726",
"0.67830145",
"0.6762924",
"0.6740234",
"0.67265904",
"0.6723809",
"0.67170584... | 0.74536294 | 0 |
Build a list of configuration (custom launcher names). | function buildConfiguration(type, target) {
const targetBrowsers = Object.keys(browserConfig)
.map(browserName => [browserName, browserConfig[browserName][type]])
.filter(([, config]) => config.target === target)
.map(([browserName]) => browserName);
// For browsers that run locally, the browser name shouldn't be prefixed with the target
// platform. We only prefix the external platforms in order to distinguish between
// local and remote browsers in our "customLaunchers" for Karma.
if (target === 'local') {
return targetBrowsers;
}
return targetBrowsers.map(browserName => {
return `${target.toUpperCase()}_${browserName.toUpperCase()}`;
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static Configurators() {\n const customizeNothing = []; // no customization steps\n return [ customizeNothing ];\n }",
"function updateArgProcessorList() {\n var argProcessorList = new commandLineUtils.ArgProcessorList();\n\n // App type\n addProcessorFor(argProcessorList, 'apptype', 'E... | [
"0.5952684",
"0.54929423",
"0.5462945",
"0.54263645",
"0.53882575",
"0.5377423",
"0.534919",
"0.5339271",
"0.53169733",
"0.53052163",
"0.5300868",
"0.5283008",
"0.5272032",
"0.52457243",
"0.5242057",
"0.5235154",
"0.52095884",
"0.5202356",
"0.5185812",
"0.5145657",
"0.5125965... | 0.5686087 | 1 |
There are two things needed to place a beacon: the position and a name TO DO: name will have to be unique. At this point, if there are two entries with the same name, it will return the first it finds (a) position: currently, the position is the PLAYER'S position when player places the marker block, so use 'self.position' (b) name: enter a name in quotation marks, like "beacon1" or "pool" | function beacon(me, beaconName){
//we place a marker at the position we want:
box(blocks.beacon,1,2,1);
//In the next lines, we build the beacon object:
var loc = me.getLocation();
//the next line appends the beacon's name to the array that contains only the tag key (the name the player gives to the beacon)
beaconNameArray.push(beaconName);
//the position is returned as an object which has coordinates as properties (keys). We are extracting the properties x, y and z
//and puting them in an array whic we call locx. Since I want the numbers to be easy to read, and extreme precision is not
//important for this plugin, I also round the numbers
var locx = [Math.round(loc.getX()),Math.round(loc.getY()),Math.round(loc.getZ())];
//The beacon object is then assembled and appended to the beaconArray array
var beaconObj = {tag: beaconName, position: locx};
beaconArray.push(beaconObj);
//finally, we display the result to the player, showing the name of the beacon and its coordinates.
//TO DO: TAB list of beacons' names
echo('You are at ' + beaconName + ' at position ' + locx[0] + ", " + locx[1] + ", " + locx[2]);
/*
these were used to debug:
echo(beaconObj.tag + beaconObj.position);
echo(beaconArray.length);
echo(beaconArray[0]);
echo(beaconNameArray[0]);
*/
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getNewdidFromPos(position) {\n\t//flag ( \"getNewdidFromPos():: Started! Called for position: \" + position );\n\t//a=GM_getValue(myacc())\n\tvar allVillagePos = GM_getValue(myacc() + \"_allVillagePos2\").split(\",\");\n\t//flag ( \"getNewdidFromPos: allVillagePos=\"+allVillagePos+\";\");\n\tfor (var i = ... | [
"0.55945784",
"0.55155414",
"0.5372061",
"0.53548574",
"0.52936345",
"0.5292482",
"0.52400655",
"0.52102",
"0.5159438",
"0.51353896",
"0.51154304",
"0.5113312",
"0.51111436",
"0.5110201",
"0.5109417",
"0.5098488",
"0.50911343",
"0.50832295",
"0.5079928",
"0.5076207",
"0.50456... | 0.7198466 | 0 |
Setup canvas based on the video input | function setup_canvases() {
canvas.width = video_element.scrollWidth;
canvas.height = video_element.scrollHeight;
output_element.width = video_element.scrollWidth;
output_element.height = video_element.scrollHeight;
console.log("Canvas size is " + video_element.scrollWidth + " x " + video_element.scrollHeight);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_setupCanvas() {\n\t\tconst {video, elements} = this;\n\n\t\tconst virtualCanvas = elements.virtualCanvas = document.createElement('canvas');\n\n\t\tthis.context = elements.canvas.getContext('2d');\n\t\tthis.virtualContext = virtualCanvas.getContext('2d');\n\n\t\telements.canvas.width = virtualCanvas.width = video... | [
"0.78905183",
"0.73323876",
"0.7324095",
"0.6902919",
"0.6802968",
"0.6754874",
"0.674903",
"0.67110926",
"0.6707982",
"0.66969913",
"0.66809857",
"0.6675698",
"0.6649001",
"0.65843296",
"0.65676445",
"0.65668964",
"0.65466964",
"0.65347123",
"0.6457012",
"0.6453839",
"0.6424... | 0.7507471 | 1 |
Connect the proper camera to the video element, trying to get a camera with facing mode of "user". | async function connect_camera() {
try {
let stream = await navigator.mediaDevices.getUserMedia({
video: { facingMode: "user" },
audio: false
});
video_element.srcObject = stream;
video_element.setAttribute('playsinline', true);
video_element.setAttribute('controls', true);
// remove controls separately
setTimeout(function() { video_element.removeAttribute('controls'); });
} catch(error) {
console.error("Got an error while looking for video camera: " + error);
return null;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function setupCamera() {\n const video = document.getElementById('video')\n video.width = videoWidth\n video.height = videoHeight\n\n const stream = await navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n facingMode: 'user',\n width: videoWidth,\n height: videoHeight... | [
"0.76734245",
"0.74210167",
"0.7339442",
"0.7298811",
"0.72884417",
"0.72826576",
"0.72387886",
"0.7193497",
"0.7098979",
"0.709148",
"0.70444125",
"0.7037726",
"0.70060045",
"0.6965139",
"0.6923468",
"0.6908866",
"0.6832422",
"0.68167394",
"0.6798288",
"0.67865056",
"0.67649... | 0.8200102 | 0 |
converts it to a base b number. Return the new number as a string E.g. base_converter(5, 2) == "101" base_converter(31, 16) == "1f" | function baseConverter(num, b) {
if (num === 0) {
return ""
};
const digit = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];
return baseConverter((num/b), b) + digit[num % b];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function baseConverter(num, base) {\n const bases = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]\n const possibleBases = bases.slice(0, base)\n\n let result = [];\n\n while (num >= base) {\n result.unshift(possibleBases[num % base])\n num = Math.floor(num / base)\n }\n resul... | [
"0.78933334",
"0.7787537",
"0.76196146",
"0.746665",
"0.74133676",
"0.7408443",
"0.7408443",
"0.7408443",
"0.7408443",
"0.7367569",
"0.7335649",
"0.72488385",
"0.7197895",
"0.7121101",
"0.7059255",
"0.7058206",
"0.69450194",
"0.6917524",
"0.6917524",
"0.68824667",
"0.68824667... | 0.81513506 | 0 |
Add room name to DOM | function outputRoomName(room) {
const roomName = document.getElementById('room-name');
roomName.innerHTML = room;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function outputRoomName(room) {\n roomName.innerHTML = `<li class=\"contact\">\n <div class=\"wrap\">\n <div class=\"meta\">\n <p class=\"name\">${room}</p>\n </div>\n ... | [
"0.7907107",
"0.7804841",
"0.7804841",
"0.7804841",
"0.7804841",
"0.7804841",
"0.7804841",
"0.77756387",
"0.7764691",
"0.7764691",
"0.77535206",
"0.7694868",
"0.7694868",
"0.7694868",
"0.7694868",
"0.76699555",
"0.7601553",
"0.7549329",
"0.7530662",
"0.74739176",
"0.7458124",... | 0.7851127 | 1 |
Vanilla JS to delete tasks in 'Trash' column | function emptyTrash() {
/* Clear tasks from 'Trash' column */
document.getElementById("trash").innerHTML = "";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteTasks() {\n const mutateCursor = getCursorToMutate();\n if (mutateCursor) {\n clickTaskMenu(mutateCursor, 'task-overflow-menu-delete', false);\n } else {\n withUnique(\n openMoreMenu(),\n 'li[data-action-hint=\"multi-select-toolbar-overflow-menu-delete\"]',\n ... | [
"0.7403256",
"0.72473013",
"0.7158116",
"0.7153182",
"0.71489525",
"0.7123197",
"0.70864403",
"0.70445865",
"0.70080054",
"0.6972743",
"0.6972021",
"0.69592506",
"0.6953322",
"0.69066185",
"0.6871405",
"0.68564725",
"0.6838206",
"0.6827074",
"0.68257725",
"0.6818862",
"0.6803... | 0.7694405 | 0 |
handleMessage: do the entire sequence for this message. subscribe: send the machine if available, else send error. any other command: send error. This method returns a promise that usually resolves. It rejects only if there is a bug or internal error. | handleMessage(clientId, data) {
return new Promise( (resolve, reject) => {
log(`client ${clientId}: |${data}|`);
if (data.match(/^\s*subscribe\s+/)) {
const m = data.match(/subscribe\s+(\w+)/);
if (m) {
let machine = m[1];
this.subscribe(clientId, machine)
.then( () => {
log(`subscribed ${clientId} to machine ${machine}`);
resolve();
})
.catch( errMsg => {
const fullMsg = `error: ${errMsg}`;
log(fullMsg);
this.sendMessage(clientId, fullMsg)
.then(resolve)
.catch(reject);
});
} else {
const msg = `error: bad subscribe command`;
log(`sending ${msg} to client ${clientId}`);
this.sendMessage(clientId, `${msg}`)
.then(resolve)
.catch(reject);
}
} else if (data.match(/^command\s+/)) {
const m = data.match(/^\s*command\s+(\w+)/);
const arr = data.split('\n').filter( e => e.length > 0);
if (!m) {
log(`did not match command pattern`);
return reject(`bad command line: ${arr[0]}`);
}
log(`emitting command ${m[1]} ${clientId}: |${arr.slice(1)}|`);
this.emit('command', m[1], clientId, arr.slice(1));
return resolve();
} else {
const msg = `bad command: |${trunc(data)}|`;
console.log(`sending ${msg} to client ${clientId}`);
this.sendMessage(clientId, msg)
.then(resolve)
.catch(reject);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function handleMessage(msg, reply) {\n let response = 'success';\n try {\n if (msg.command == 'capture') {\n if (!msg.streamId) {\n throw new Error('No stream ID received');\n }\n await startCapture(msg.streamId);\n } else if (msg.command == 'stop') {\n stopCapture();\n ... | [
"0.62991405",
"0.6008539",
"0.58747715",
"0.581249",
"0.57012355",
"0.5655519",
"0.5601487",
"0.55965835",
"0.55960613",
"0.5570987",
"0.554621",
"0.55416393",
"0.55300313",
"0.54769",
"0.54657245",
"0.5454042",
"0.54484653",
"0.53516346",
"0.5329301",
"0.5327847",
"0.5322457... | 0.6933967 | 0 |
subscribe() returns a promise. write a "provide" command followed by the serialization of the indicated machine. If no such machine, then reject. | subscribe(clientId, machine) {
return new Promise( (resolve, reject) => {
if (typeof machine !== 'string' || !machine.match(/^[a-z0-9]+$/)) {
return reject(`subscribe: bad machine name: ${machine}`);
}
const rec = this._clientMap.get(clientId);
if (! rec) {
return reject(`subscribe(${machine}): no such client: ${clientId}`);
} else if (rec.machines.includes(machine)) {
log(`subscribe(${machine}): already subscribed`);
return resolve();
} else if (! this._machineMap.has(machine)) {
return reject(`subscribe: no such machine: ${machine}`);
}
rec.machines.push(machine);
log(`sending machine ${machine} to client ${clientId}`);
this.sendMachine(machine, rec.wse)
.then( resolve )
.catch( errMsg => reject(`failed sending ${machine}: ${errMsg}`) );
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ProductionEngineSubscription(machine) {\n //console.log('created pe subs: ', machine.id);\n\n let pesMachine = machine;\n let peState = null;\n\n this.getPeState = () => peState;\n this.getMachine = () => pesMachine;\n\n this.makeUpdater = function () {\n return function(newState)... | [
"0.5257558",
"0.51723474",
"0.4928612",
"0.48542452",
"0.48314035",
"0.48277408",
"0.48249453",
"0.47648463",
"0.47130254",
"0.47021812",
"0.4699739",
"0.46977046",
"0.46927583",
"0.46921438",
"0.46291152",
"0.46257806",
"0.46217126",
"0.45902544",
"0.4585775",
"0.45815372",
... | 0.68615836 | 0 |
Return a promise to load features for the genomic interval | async readFeatures(chr, start, end) {
const index = await this.getIndex()
if (index) {
this.indexed = true
return this.loadFeaturesWithIndex(chr, start, end)
} else if (this.dataURI) {
this.indexed = false
return this.loadFeaturesFromDataURI()
} else {
this.indexed = false
return this.loadFeaturesNoIndex()
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async readFeatures(chr, start, end) {\n\n const index = await this.getIndex()\n if (index) {\n return this.loadFeaturesWithIndex(chr, start, end);\n } else if (this.dataURI) {\n return this.loadFeaturesFromDataURI();\n } else {\n return this.loadFeatures... | [
"0.6543959",
"0.61009336",
"0.590788",
"0.5869675",
"0.5767293",
"0.5726963",
"0.571669",
"0.5531802",
"0.54262996",
"0.5398379",
"0.53473455",
"0.52430815",
"0.5231676",
"0.5218503",
"0.5158587",
"0.5131139",
"0.5100868",
"0.5091692",
"0.50904274",
"0.50904274",
"0.5066121",... | 0.6294286 | 1 |
Return a Promise for the async loaded index | async loadIndex() {
const indexURL = this.config.indexURL
return loadIndex(indexURL, this.config, this.genome)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async getCurentIndex() {\n\n this.check()\n return await this.storage.loadIndex()\n }",
"async loadIndex() {\n const indexURL = this.config.indexURL;\n let indexFilename;\n if (isFilePath(indexURL)) {\n indexFilename = indexURL.name;\n } else {\n const uri... | [
"0.70689124",
"0.6799907",
"0.6459076",
"0.64186",
"0.6398918",
"0.6349781",
"0.62687784",
"0.62290114",
"0.6192579",
"0.6090689",
"0.60649323",
"0.60526985",
"0.6047419",
"0.60411704",
"0.6028308",
"0.6021699",
"0.60055244",
"0.5975181",
"0.59711975",
"0.5960433",
"0.5925177... | 0.7352213 | 0 |
return the two oldest/oldest ages within the array of ages passed in. | function twoOldestAges(ages){
ages.sort((a,b) => b-a)
ages = ages.slice(0,2)
ages.sort((a,b) => a-b);
return ages;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function twoOldestAges(ages){\n let sorted = ages.sort((a, b) => { return b - a; });\n return [sorted[1], sorted[0]];\n }",
"function twoOldestAges(ages){\nlet oldestAges = ages.sort((a, b) => b-a).splice(0,2).reverse();\n return oldestAges;\n}",
"function twoOldestAges(ages){\n var sortArr = ages... | [
"0.78486305",
"0.7427882",
"0.7326222",
"0.7013265",
"0.6738038",
"0.6712644",
"0.6627846",
"0.65975624",
"0.6574193",
"0.65132743",
"0.64635026",
"0.6458466",
"0.6167384",
"0.61547387",
"0.61451113",
"0.6124622",
"0.61235875",
"0.6054878",
"0.60398024",
"0.5996854",
"0.59744... | 0.74437 | 1 |
remove the created div when this Modal Component is unmounted Used to clean up the memory to avoid memory leak | componentWillUnmount() {
modalRoot.removeChild(this.element);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"destroy() {\n $.removeData(this.element[0], COMPONENT_NAME);\n }",
"destroy() {\n this.teardown();\n $.removeData(this.element[0], COMPONENT_NAME);\n }",
"destroy() {\n this._componentRef.destroy();\n }",
"destroy() {\n if (!this.isDestroyed) {\n this.uiWrapper.parentNo... | [
"0.72245914",
"0.71879286",
"0.70123136",
"0.6941995",
"0.6914517",
"0.691231",
"0.6912048",
"0.6909787",
"0.6885292",
"0.6876775",
"0.6874604",
"0.6846686",
"0.6827205",
"0.6821308",
"0.6811845",
"0.67996776",
"0.67801577",
"0.6775338",
"0.67741215",
"0.67691034",
"0.6741515... | 0.7750632 | 0 |
Navigate to Submit an Ad Page | function gotoSubmitAd() {
if (localStorage.getItem('user_id')) {
window.location.href = "../dashboard/dashboard.html";
}
else {
window.location.href = "../login/login.html";
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function submitPost(post) {\n $.post(\"/api/posts\", post, function() {\n window.location.href = \"/addexercise\";\n });\n }",
"function goToSubmit() {\n var element = document.getElementById('car_submit');\n element.scrollIntoView({ behavior: \"smooth\", block: \"end\" });\... | [
"0.6617835",
"0.6567393",
"0.6372224",
"0.6305512",
"0.62939143",
"0.6288367",
"0.62680435",
"0.6235656",
"0.6207745",
"0.6203159",
"0.6171488",
"0.611962",
"0.61175114",
"0.6093927",
"0.6084791",
"0.6063685",
"0.60440403",
"0.5987568",
"0.59585685",
"0.59585685",
"0.59500283... | 0.6731556 | 0 |
gets the time that the standup report will be generated for a channel | function getStandupTime(channel, cb) {
controller.storage.teams.get('standupTimes', function(err, standupTimes) {
if (!standupTimes || !standupTimes[channel]) {
cb(null, null);
} else {
cb(null, standupTimes[channel]);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getBotMsgTime(session){\n\tconsole.log(\"getBotMsgTime() executing\");\n\tvar botTime = new Date(session.userData.lastMessageSent);\n\tconsole.log(\"Bot time unformatted is:\");\n\tconsole.log(botTime);\n\n\tvar botTimeFormatted = dateFormat(botTime, \"yyyy-mm-dd HH:MM:ss\");\n\n\tconsole.log(\"Bot messag... | [
"0.6040518",
"0.60359293",
"0.6010521",
"0.6001613",
"0.5957078",
"0.5952818",
"0.590619",
"0.58774245",
"0.5787974",
"0.5776971",
"0.56780404",
"0.56668615",
"0.5617398",
"0.56120676",
"0.5591071",
"0.55838776",
"0.55686265",
"0.5552662",
"0.55173296",
"0.55053",
"0.55017895... | 0.7024009 | 0 |
gets the time a user has asked to report for a given channel | function getAskingTime(user, channel, cb) {
controller.storage.teams.get('askingtimes', function(err, askingTimes) {
if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {
cb(null,null);
} else {
cb(null, askingTimes[channel][user]);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getStandupTime(channel, cb) {\n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n if (!standupTimes || !standupTimes[channel]) {\n cb(null, null);\n } else {\n cb(null, standupTimes[channel]);\n }\n });\n}",
"function getBotMsgT... | [
"0.6046183",
"0.5564972",
"0.5558473",
"0.55167425",
"0.54932386",
"0.5406893",
"0.5406754",
"0.5369679",
"0.5338762",
"0.5330139",
"0.52722967",
"0.5264473",
"0.51975965",
"0.5191128",
"0.5190129",
"0.51743525",
"0.5171066",
"0.5164562",
"0.5160631",
"0.5139034",
"0.5132241"... | 0.6806506 | 0 |
cancels a user's asking time in a channel | function cancelAskingTime(user, channel) {
controller.storage.teams.get('askingtimes', function(err, askingTimes) {
if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {
return;
} else {
delete askingTimes[channel][user];
controller.storage.teams.save(askingTimes);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"cancel() {\n return this.channel.basicCancel(this.tag)\n }",
"cancelA2HSprompt(_this) {\n document.getElementById('cancel-btn').addEventListener('click', () => {\n _this.delayA2HSprompt();\n _this.hideMsg();\n });\n }",
"function OnCancelAndUnlockPressed()\n{\n\t// Un... | [
"0.62495184",
"0.61248153",
"0.60613745",
"0.6051775",
"0.5957667",
"0.579878",
"0.5796032",
"0.5793594",
"0.57708716",
"0.5764484",
"0.5754102",
"0.5734898",
"0.5730226",
"0.57185125",
"0.57181215",
"0.5714681",
"0.57004356",
"0.56908435",
"0.56721675",
"0.56693536",
"0.5641... | 0.8139517 | 0 |
adds a user's standup report to the standup data for a channel | function addStandupData(standupReport) {
controller.storage.teams.get('standupData', function(err, standupData) {
if (!standupData) {
standupData = {};
standupData.id = 'standupData';
}
if (!standupData[standupReport.channel]) {
standupData[standupReport.channel] = {};
}
standupData[standupReport.channel][standupReport.user] = standupReport;
controller.storage.teams.save(standupData);
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function doStandup(bot, user, channel) {\n\n var userName = null;\n\n getUserName(bot, user, function(err, name) {\n if (!err && name) {\n userName = name;\n\n bot.startPrivateConversation({\n user: user\n }, function(err, convo) {\n if (!... | [
"0.6443461",
"0.592248",
"0.59018815",
"0.58021027",
"0.57642514",
"0.5632085",
"0.5553548",
"0.5301624",
"0.516726",
"0.51363057",
"0.5127875",
"0.5127709",
"0.5107881",
"0.51040447",
"0.50867414",
"0.50698984",
"0.5049063",
"0.504188",
"0.50250804",
"0.5000019",
"0.49985132... | 0.74245036 | 0 |
gets all standup data for a channel | function getStandupData(channel, cb) {
controller.storage.teams.get('standupData', function(err, standupData) {
if (!standupData || !standupData[channel]) {
cb(null, null);
} else {
cb(null, standupData[channel]);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getLobbyData(){}",
"function clearStandupData(channel) {\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel]) {\n return;\n } else {\n delete standupData[channel];\n controller.storage.te... | [
"0.6174487",
"0.6143607",
"0.6024814",
"0.6006331",
"0.597928",
"0.5950036",
"0.5829109",
"0.56514424",
"0.56441987",
"0.564225",
"0.5628344",
"0.55985993",
"0.5591854",
"0.5590676",
"0.55876064",
"0.5571876",
"0.5569628",
"0.55689764",
"0.55517554",
"0.55306715",
"0.5503061"... | 0.7028158 | 0 |
clears all standup reports for a channel | function clearStandupData(channel) {
controller.storage.teams.get('standupData', function(err, standupData) {
if (!standupData || !standupData[channel]) {
return;
} else {
delete standupData[channel];
controller.storage.teams.save(standupData);
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"clear() {\n\t\treturn this._sendMessage(JSON.stringify({type: \"clearHistory\"}), (resolve, reject) => {\n\t\t\tresolve([channel]);\n\t\t});\n\t}",
"clearAllChannels() {\n this.state.channels.forEach((channel) => {\n if (channel.active) {\n this.context.api.newsItem.removeChannel... | [
"0.6528912",
"0.6494929",
"0.64406866",
"0.6426045",
"0.62254184",
"0.6205152",
"0.62045234",
"0.6150138",
"0.61259806",
"0.5997079",
"0.5973085",
"0.5954252",
"0.5943247",
"0.591203",
"0.59086585",
"0.5901544",
"0.58659446",
"0.58659446",
"0.58659446",
"0.5856577",
"0.585166... | 0.68249196 | 0 |
intended to be called every minute. checks if there exists a user that has requested to be asked to give a standup report at this time, then asks them | function checkTimesAndAskStandup(bot) {
getAskingTimes(function (err, askMeTimes) {
if (!askMeTimes) {
return;
}
for (var channelId in askMeTimes) {
for (var userId in askMeTimes[channelId]) {
var askMeTime = askMeTimes[channelId][userId];
var currentHoursAndMinutes = getCurrentHoursAndMinutes();
if (compareHoursAndMinutes(currentHoursAndMinutes, askMeTime)) {
hasStandup({user: userId, channel: channelId}, function(err, hasStandup) {
// if the user has not set an 'ask me time' or has already reported a standup, don't ask again
if (hasStandup == null || hasStandup == true) {
var x = "";
} else {
doStandup(bot, userId, channelId);
}
});
}
}
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function promptStandup(promptMessage) {\n usersService.getLateSubmitters().then(lateSubmitters => {\n if (lateSubmitters.length > 0) {\n console.log(\"Behold late submitters members = > \" + lateSubmitters);\n lateSubmitters.forEach(user => {\n sendMessageToUser(user,... | [
"0.6484531",
"0.6158379",
"0.5830184",
"0.579746",
"0.57936287",
"0.5697816",
"0.5687309",
"0.5672732",
"0.5660969",
"0.56362784",
"0.5614853",
"0.55957496",
"0.5588634",
"0.553915",
"0.5532074",
"0.55250454",
"0.5511523",
"0.5510523",
"0.5507814",
"0.54976106",
"0.54964715",... | 0.6836265 | 0 |
will initiate a private conversation with user and save the resulting standup report for the channel | function doStandup(bot, user, channel) {
var userName = null;
getUserName(bot, user, function(err, name) {
if (!err && name) {
userName = name;
bot.startPrivateConversation({
user: user
}, function(err, convo) {
if (!err && convo) {
var standupReport =
{
channel: channel,
user: user,
userName: userName,
datetime: getCurrentOttawaDateTimeString(),
yesterdayQuestion: null,
todayQuestion: null,
obstacleQuestion: null
};
convo.ask('What did you work on yesterday?', function(response, convo) {
standupReport.yesterdayQuestion = response.text;
convo.ask('What are you working on today?', function(response, convo) {
standupReport.todayQuestion = response.text;
convo.ask('Any obstacles?', function(response, convo) {
standupReport.obstacleQuestion = response.text;
convo.next();
});
convo.say('Thanks for doing your daily standup, ' + userName + "!");
convo.next();
});
convo.next();
});
convo.on('end', function() {
// eventually this is where the standupReport should be stored
bot.say({
channel: standupReport.channel,
text: "*" + standupReport.userName + "* did their standup at " + standupReport.datetime,
//text: displaySingleReport(bot, standupReport),
mrkdwn: true
});
addStandupData(standupReport);
});
}
});
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initiateConversation(adminID){\n rainbowSDK.contacts.searchById(adminID).then((contact)=>{\n console.log(\"[DEMO] :: \" + contact);\n if(mocClicked == \"Chat\"){\n rainbowSDK.conversations.openConversationForContact(contact).then(function(conversation) {\n consol... | [
"0.5840379",
"0.56874186",
"0.5675624",
"0.5628233",
"0.55131686",
"0.54803413",
"0.5475566",
"0.5454759",
"0.5421371",
"0.5414625",
"0.5405184",
"0.5356118",
"0.5349045",
"0.5308127",
"0.5287822",
"0.5276483",
"0.52346283",
"0.520408",
"0.520408",
"0.520408",
"0.520408",
"... | 0.69738185 | 0 |
when the time to report is hit, report the standup, clear the standup data for that channel | function checkTimesAndReport(bot) {
getStandupTimes(function(err, standupTimes) {
if (!standupTimes) {
return;
}
var currentHoursAndMinutes = getCurrentHoursAndMinutes();
for (var channelId in standupTimes) {
var standupTime = standupTimes[channelId];
if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {
getStandupData(channelId, function(err, standupReports) {
bot.say({
channel: channelId,
text: getReportDisplay(standupReports),
mrkdwn: true
});
clearStandupData(channelId);
});
}
}
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function clearStandupData(channel) {\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel]) {\n return;\n } else {\n delete standupData[channel];\n controller.storage.teams.save(standupData);\n ... | [
"0.6351986",
"0.57172143",
"0.57172",
"0.5665382",
"0.5609832",
"0.56097007",
"0.5597038",
"0.5584903",
"0.5575114",
"0.5570066",
"0.55546856",
"0.55154425",
"0.55140424",
"0.5512958",
"0.54904246",
"0.54677385",
"0.5444892",
"0.5407005",
"0.54037684",
"0.53916013",
"0.539094... | 0.63896483 | 0 |
returns an object (not date) with the current hours and minutes, Ottawa time | function getCurrentHoursAndMinutes() {
var now = convertUTCtoOttawa(new Date());
return { hours: now.getHours(), minutes: now.getMinutes() };
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getNow() {\n var now = new Date();\n return {\n hours: now.getHours() + now.getMinutes() / 60,\n minutes: now.getMinutes() * 12 / 60 + now.getSeconds() * 12 / 3600,\n seconds: now.getSeconds() * 12 / 60\n };\n }",
"function time() {\r\n var data = new Date();\r\n v... | [
"0.7421034",
"0.7070131",
"0.7042703",
"0.7019506",
"0.7016044",
"0.6983289",
"0.69333446",
"0.68698555",
"0.68485516",
"0.6821014",
"0.68004423",
"0.6745183",
"0.67373943",
"0.6730873",
"0.6727982",
"0.67008406",
"0.66862845",
"0.65916675",
"0.6536028",
"0.65289223",
"0.6526... | 0.7886335 | 0 |
compares two objects (not date) with hours and minutes | function compareHoursAndMinutes(t1, t2) {
return (t1.hours === t2.hours) && (t1.minutes === t2.minutes);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function compare(a,b) {\r\n var startTimeA = (a.StartTimeHour*60) + a.StartTimeMinute;\r\n var startTimeB = (b.StartTimeHour*60) + b.StartTimeMinute;\r\n return startTimeA - startTimeB;\r\n}",
"equalsTo(operand){\r\n return (this.hours === operand.hours && this.minutes === operand.minutes);\r\n }",
"fun... | [
"0.7367753",
"0.694777",
"0.6863364",
"0.6707897",
"0.6653542",
"0.6519639",
"0.64801466",
"0.64379394",
"0.64292246",
"0.63552475",
"0.6304667",
"0.624035",
"0.6188942",
"0.6164275",
"0.6143916",
"0.6035805",
"0.6030706",
"0.59936357",
"0.59759927",
"0.5975752",
"0.5959879",... | 0.81036144 | 0 |
if the given date is in UTC, converts it to Ottawa time. this is a 'reasonable' hack since the only two places that the js will be run will be on azure (UTC), and locally (Ottawa time) | function convertUTCtoOttawa(date) {
var d = new Date();
if (d.getHours() === d.getUTCHours()) {
d.setUTCHours(d.getUTCHours() - 5);
}
return d;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toMarketTime(date,tz){\n\t\t\t\tvar utcTime=new Date(date.getTime() + date.getTimezoneOffset() * 60000);\n\t\t\t\tif(tz && tz.indexOf(\"UTC\")!=-1) return utcTime;\n\t\t\t\telse return STX.convertTimeZone(utcTime,\"UTC\",tz);\n\t\t\t}",
"toFinnishTime(date) {\n //var date = new Date();\n date.setH... | [
"0.69358057",
"0.66025054",
"0.6601455",
"0.65316075",
"0.65142703",
"0.6426732",
"0.6398034",
"0.63451177",
"0.6302007",
"0.63002443",
"0.6222299",
"0.61798775",
"0.6176149",
"0.6171457",
"0.6171189",
"0.61192024",
"0.60711014",
"0.6012052",
"0.60070336",
"0.5975017",
"0.596... | 0.79901075 | 0 |
returns a formatted string of the current datetime in Ottawa time | function getCurrentOttawaDateTimeString() {
var date = convertUTCtoOttawa(new Date());
var hour = date.getHours();
hour = (hour < 10 ? "0" : "") + hour;
var min = date.getMinutes();
min = (min < 10 ? "0" : "") + min;
var year = date.getFullYear();
var month = date.getMonth() + 1;
month = (month < 10 ? "0" : "") + month;
var day = date.getDate();
day = (day < 10 ? "0" : "") + day;
return year + "-" + month + "-" + day + ": " + hour + ":" + min;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getFormattedCurrentDateTime() {\n return new Date().toJSON().slice(0, 19).replace('T', ' ');\n}",
"function nowAsString() {\n return new Date().toISOString().replace(\"T\", \" \").replace(\"Z\",\" \");\n}",
"function formatCurrentDateTime() {\n // Timestamp from API seems to be GMT, which the... | [
"0.7872003",
"0.7791804",
"0.7354191",
"0.73127687",
"0.72452915",
"0.7146017",
"0.7138602",
"0.7121298",
"0.7103326",
"0.7062861",
"0.7016527",
"0.70033497",
"0.695631",
"0.6956222",
"0.69544303",
"0.69452065",
"0.69369656",
"0.6936768",
"0.6931186",
"0.6926132",
"0.6895374"... | 0.8083763 | 0 |
builds a string that displays a single user's standup report | function getSingleReportDisplay(standupReport) {
var report = "*" + standupReport.userName + "* did their standup at " + standupReport.datetime + "\n";
report += "_What did you work on yesterday:_ `" + standupReport.yesterdayQuestion + "`\n";
report += "_What are you working on today:_ `" + standupReport.todayQuestion + "`\n";
report += "_Any obstacles:_ `" + standupReport.obstacleQuestion + "`\n\n";
return report;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getReportDisplay(standupReports) {\n \n if (!standupReports) {\n return \"*There is no standup data to report.*\";\n }\n\n var totalReport = \"*Standup Report*\\n\\n\";\n for (var user in standupReports) {\n var report = standupReports[user];\n totalReport += getSingleR... | [
"0.68696153",
"0.67091095",
"0.58703655",
"0.58037055",
"0.5690617",
"0.56840926",
"0.56504303",
"0.5626813",
"0.55754954",
"0.5566497",
"0.55646896",
"0.5559293",
"0.54887426",
"0.5483268",
"0.5476705",
"0.5465037",
"0.54605424",
"0.5443541",
"0.54333824",
"0.5423004",
"0.54... | 0.75525874 | 0 |
return "Hello, " + person; } | function greeter(person) {
return "Hi " + person.firstName + " " + person.lastName;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function person(name) {\n return \"I think\" + name + \"is a cool guy\";\n}",
"function greeter2(person) {\n return \"Aloha \" + person + \"!\";\n}",
"function greeter(person) {\n return \"Hello, \" + person;\n}",
"hello(someone) {\n return \"hello, \"+ someone\n }",
"function sayName(pers... | [
"0.83308357",
"0.82673615",
"0.82393354",
"0.7925421",
"0.7888341",
"0.7842417",
"0.7716826",
"0.7624223",
"0.76173675",
"0.7573261",
"0.7572713",
"0.7570779",
"0.7568589",
"0.75617194",
"0.7533274",
"0.751613",
"0.7516",
"0.75083584",
"0.75056255",
"0.74988335",
"0.74911076"... | 0.8291874 | 1 |
COUNT items in each brand | countItemsInBrand(getBrandArr, getItemsArr) {
for (let i = 0; i < getBrandArr.length; i++) {
var tmp = getItemsArr.filter((item) => item.subcategoryArr.id === getBrandArr[i].id).length;
getBrandArr[i].itemCount = tmp;
}
return getBrandArr;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"countOfItems() {\n var count = 0\n for (var sku in this.items) {\n var li = this.items[sku]\n count = Number(count) + Number(li.quantity)\n }\n return count\n }",
"itemsCount() {\n return this._checkoutProducts\n .map((checkoutProduct) => checkoutProdu... | [
"0.67231584",
"0.6563493",
"0.63034475",
"0.62030816",
"0.6187013",
"0.60876316",
"0.60441923",
"0.6032323",
"0.59975",
"0.59230274",
"0.5913571",
"0.59081304",
"0.590752",
"0.5882206",
"0.5869655",
"0.5868861",
"0.5865619",
"0.5865054",
"0.58574206",
"0.5835562",
"0.5833918"... | 0.7266751 | 0 |
Page Title Vertical Align | function pageTitle(){
if ( $(window).width() >= 1000 && pageTitleResized == false ) {
$('#ins-page-title').each(function() {
var marginTop = 55;
var extra = 0;
var titleInner = $(this).find( '.ins-page-title-inner' );
var titleInnerHeight = titleInner.height();
if( $('#header').length ) {
extra = 80 / 2;
}
if( $('#topbar').length ) {
extra += $('#topbar').height() / 2;
}
if( $('.bottom-nav-wrapper').length ) {
extra += $('.bottom-nav-wrapper').height() / 2;
}
marginTop = extra;
$(this).find( '.ins-page-title-inner' ).css( 'margin-top', marginTop );
pageTitleResized = true;
});
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fTitlePlacement (elem, ht, vPos) {\n fAnimateHeight (elem, ht);\n fAnimateTop (elem, vPos);\n }",
"function fTitlePlacement (elem, ht, vPos) {\n fAnimateHeight (elem, ht);\n fAnimateTop (elem, vPos);\n }",
"function getPageTitle () {\n return title;\n }",
"function createTitlePages... | [
"0.6289992",
"0.6289992",
"0.620483",
"0.6144102",
"0.6076659",
"0.597595",
"0.5893578",
"0.586862",
"0.5790285",
"0.575313",
"0.5747338",
"0.5740914",
"0.5738883",
"0.5738883",
"0.5716012",
"0.57087487",
"0.5697498",
"0.56831956",
"0.5679236",
"0.5669497",
"0.5648148",
"0.... | 0.6583696 | 0 |
Boot up the Native Messaging and establish a connection with the host, indicated by hostName | function connect() {
var hostName = "com.google.chrome.example.echo";
port = chrome.runtime.connectNative(hostName);
port.onMessage.addListener(onNativeMessage);
port.onDisconnect.addListener(onDisconnected);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"connect() {\n\t\tthis._communicator.connect();\n\t}",
"function connect() {\n console.log(\"Connecting to `\" + localStorage.broker + \"` on port `\" + localStorage.port + \"`\");\n var clientId = \"myclientid_\" + parseInt(Math.random() * 100, 10);\n\n client = new Messaging.Client(localStorage.broker,... | [
"0.5986448",
"0.58668643",
"0.5841325",
"0.5841325",
"0.5785808",
"0.57438385",
"0.5655347",
"0.5622621",
"0.56021273",
"0.55080324",
"0.54482317",
"0.54211783",
"0.5416453",
"0.54157996",
"0.5405801",
"0.535047",
"0.53294265",
"0.5316533",
"0.5309893",
"0.5305062",
"0.530001... | 0.60736364 | 0 |
When disconnected from host, set port to null value so that it may reconnect at the next request | function onDisconnected() {
console.log("Failed to connect: " + chrome.runtime.lastError.message);
port = null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static set port(value) {}",
"repickHost() {\n this.host = null;\n var newHostId = Object.keys(this.socketNames)[0];\n this.host = newHostId ? newHostId : null;\n }",
"reset() {\n this.socket = this._newSocket();\n }",
"get port() { return this._port; }",
"reassignHostSocke... | [
"0.66604096",
"0.6570076",
"0.64096314",
"0.6310094",
"0.6273757",
"0.6256183",
"0.6221901",
"0.6196667",
"0.6173534",
"0.6066822",
"0.6055589",
"0.6055589",
"0.6052514",
"0.6027057",
"0.60181713",
"0.60075426",
"0.5991197",
"0.5986552",
"0.5976626",
"0.5960655",
"0.59246415"... | 0.6781185 | 0 |
uploaded images on mobile are typically oriented incorrectly. loadImage corrects the image orientation. | orientImage(file, callback) {
window.loadImage(
file,
img => callback(img.toDataURL("image/png")),
{ canvas: true, orientation: true }
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function loadImage(image) {\n if (artwork.orientation == 'landscape') {\n context.drawImage(\n image,\n Math.abs(canvas.width / 2 - artwork.longDimension/2),\n Math.abs(canvas.height / 2 - artwork.shortDimension / 2),\n artwork.longDimension,\n artwo... | [
"0.7144427",
"0.6631277",
"0.645808",
"0.6393823",
"0.6194077",
"0.60488397",
"0.59705955",
"0.59705955",
"0.59020543",
"0.5868273",
"0.5816981",
"0.58118296",
"0.58105105",
"0.5767477",
"0.57385",
"0.57257855",
"0.5700381",
"0.5699242",
"0.5688993",
"0.5681487",
"0.5679571",... | 0.687945 | 1 |
Passes the uploaded file object as well as a base 64 of the image to the onUpload callback | uploadImage(e) {
const { onUpload } = this.props;
let file = e.target.files[0]
this.orientImage(file, (src) => {
onUpload({
file,
name: file.name,
src
})
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handleFile(e) {\n const reader = new FileReader();\n const file = e.target.files[0];\n\n if (!file) return;\n\n //useful for debugging base64 to images http://codebeautify.org/base64-to-image-converter\n reader.onload = function () {\n this.setState({\n cropperOpen: true,\n upload... | [
"0.69902676",
"0.6935119",
"0.6765236",
"0.6727766",
"0.6721871",
"0.6705777",
"0.6676353",
"0.6668043",
"0.66410273",
"0.6615347",
"0.6575097",
"0.65480185",
"0.6494769",
"0.64868236",
"0.6479687",
"0.64705485",
"0.6443938",
"0.6443938",
"0.6442665",
"0.64375377",
"0.6433047... | 0.69668007 | 1 |
remove a specific value from the heap | remove(data) {
const size = this.heap.length;
let i;
for (i = 0; i < size; i++) {
if (data === this.heap[i]) {
break;
}
}
[this.heap[i], this.heap[size - 1]] = [this.heap[size - 1], this.heap[i]];
this.heap.splice(size - 1);
for (let i = parseInt(this.heap.length / 2 - 1); i >= 0; i--) {
this.maxHeapify(this.heap, this.heap.length, i);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"remove() {\n // Swap root value with last element in the heap\n // Pop the last element from heap array\n // Perform siftDown to correct position of swapped value\n // Return popped value\n this.swap(0, this.heap.length - 1, this.heap);\n const valueToRemove = this.heap.pop();\n this.siftDown(... | [
"0.80592644",
"0.771712",
"0.75571394",
"0.75185335",
"0.748075",
"0.7324977",
"0.7206284",
"0.7075653",
"0.7057192",
"0.7057192",
"0.6849966",
"0.67913896",
"0.66329116",
"0.65866756",
"0.6565453",
"0.64938587",
"0.64443773",
"0.6443872",
"0.6382864",
"0.6373806",
"0.6357709... | 0.77889985 | 1 |
returns the max value from the heap | findMax() {
return this.heap[0];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"extractMax() {\n\t\tconst max = this.heap[0];\n\t\tconst tmp = this.heap.pop();\n\t\tif (!this.empty()) {\n\t\t\tthis.heap[0] = tmp;\n\t\t\tthis.sinkDown(0);\n\t\t}\n\t\treturn max;\n\t}",
"extractMax() {\r\n\t\tconst max = this.heap[0];\r\n\t\tthis.remove(max);\r\n\t\treturn max;\r\n\t}",
"function maxHeap(va... | [
"0.82991564",
"0.7957347",
"0.78086686",
"0.7646159",
"0.7423833",
"0.73725516",
"0.7348753",
"0.72745484",
"0.72237366",
"0.72114444",
"0.7197894",
"0.7177174",
"0.7163383",
"0.7146565",
"0.70919085",
"0.70852536",
"0.70802695",
"0.7070464",
"0.7062798",
"0.7037336",
"0.7013... | 0.84279215 | 0 |
removes the max value from the heap | removeMax() {
this.remove(this.heap[0]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"deleteMax() {\n // recall that we have an empty position at the very front of the array, \n // so an array length of 2 means there is only 1 item in the heap\n\n if (this.array.length === 1) return null;\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// edge case- if no nodes in tree, exit\n\n if (this.array.lengt... | [
"0.8018191",
"0.76265055",
"0.7623531",
"0.7504439",
"0.74354666",
"0.72889215",
"0.7252715",
"0.71510285",
"0.71128887",
"0.7089084",
"0.69999665",
"0.6982427",
"0.6941861",
"0.68232596",
"0.6717149",
"0.67013896",
"0.6697178",
"0.66557425",
"0.6639741",
"0.6616899",
"0.6611... | 0.88509464 | 0 |
return the size of the heap | size() {
return this.heap.length;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"size() {\n\t\treturn this.heap.length;\n\t}",
"getHeap() {\r\n\t\treturn this.heap;\r\n\t}",
"getHeap() {\r\n\t\treturn this.heap;\r\n\t}",
"get size() {\n let size = 0;\n for (let i = 0; i < this.children.length; i++)\n size += this.children[i].size;\n return size;\n }",
"function size() {\... | [
"0.823258",
"0.6719874",
"0.6719874",
"0.6594933",
"0.65847397",
"0.6490526",
"0.6471409",
"0.64260876",
"0.641185",
"0.63683355",
"0.6361953",
"0.6324604",
"0.6305498",
"0.6303767",
"0.62501025",
"0.6240314",
"0.62244964",
"0.61938465",
"0.61566305",
"0.6134111",
"0.6093153"... | 0.8242203 | 1 |
check if the heap is empty | isEmpty() {
return this.heap.length === 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function heapisEmpty() {\n return this.size == 0 ? true : false;\n}",
"isEmpty() {\n return !this.heapContainer.length;\n }",
"function isEmpty() {\n return this.top === 0;\n}",
"heapHasIndex(index){\r\n if(index>=0 && index<this.heapContainer.length)\r\n return true;\r\n \r\n return ... | [
"0.8801127",
"0.7740314",
"0.69832236",
"0.6907285",
"0.6777653",
"0.6752135",
"0.6746486",
"0.67290246",
"0.65971357",
"0.6547033",
"0.65308535",
"0.6521938",
"0.6514921",
"0.65049946",
"0.6492355",
"0.64725035",
"0.64722633",
"0.6470793",
"0.64603376",
"0.64533764",
"0.6418... | 0.82852596 | 1 |
returns the heap structure | getHeap() {
return this.heap;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Heap()\n{\n\t// h[0] not used, heap initially empty\n\n\tthis.h = [null]; // heap of integer keys\n\tthis.h_item = [null]; // corresponding heap of data-items (any object)\n\tthis.size = 0; // 1 smaller than array (also index of last child)\n\n\n\t// ----... | [
"0.7372717",
"0.7307348",
"0.7011272",
"0.6944502",
"0.69332767",
"0.6875817",
"0.6830716",
"0.6772608",
"0.6742784",
"0.6742784",
"0.6671171",
"0.66410375",
"0.6612922",
"0.6560505",
"0.6552577",
"0.65003353",
"0.6475312",
"0.6475312",
"0.6475312",
"0.6475312",
"0.6440758",
... | 0.74754506 | 0 |
return the size of the heap | size() {
return this.heap.length;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"size() {\n\t\treturn this.heap.length;\n\t}",
"getHeap() {\r\n\t\treturn this.heap;\r\n\t}",
"getHeap() {\r\n\t\treturn this.heap;\r\n\t}",
"get size() {\n let size = 0;\n for (let i = 0; i < this.children.length; i++)\n size += this.children[i].size;\n return size;\n }",
"function size() {\... | [
"0.8232244",
"0.6720662",
"0.6720662",
"0.6595036",
"0.658402",
"0.6490136",
"0.6471042",
"0.64250314",
"0.64119965",
"0.636866",
"0.6362219",
"0.6324369",
"0.6306118",
"0.6303182",
"0.62492096",
"0.62391216",
"0.62245953",
"0.6194299",
"0.61576664",
"0.61351967",
"0.6093203"... | 0.8241832 | 0 |
returns the heap structure | getHeap() {
return this.heap;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Heap()\n{\n\t// h[0] not used, heap initially empty\n\n\tthis.h = [null]; // heap of integer keys\n\tthis.h_item = [null]; // corresponding heap of data-items (any object)\n\tthis.size = 0; // 1 smaller than array (also index of last child)\n\n\n\t// ----... | [
"0.7372717",
"0.7307348",
"0.7011272",
"0.6944502",
"0.69332767",
"0.6875817",
"0.6830716",
"0.6772608",
"0.6742784",
"0.6742784",
"0.6671171",
"0.66410375",
"0.6612922",
"0.6560505",
"0.6552577",
"0.65003353",
"0.6475312",
"0.6475312",
"0.6475312",
"0.6475312",
"0.6440758",
... | 0.74754506 | 1 |
Alyssa postulates the existence of an abstract object called an interval that has two endpoints: a lower bound and an upper bound. She also presumes that, given the endpoints of an interval, she can construct the interval using the data constructor make_interval. Alyssa first writes a function for adding two intervals. She reasons that the minimum value the sum could be is the sum of the two lower bounds and the maximum value it could be is the sum of the two upper bounds: | function addInterval(x, y) {
return makeInterval(
lowerBound(x) + lowerBound(y),
upperBound(x) + upperBound(y)
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addTwo(range1, range2) {\n if (range1.overlaps(range2, {adjacent: true})) {\n var start = moment.min(range1.start, range2.start);\n var end = moment.max(range1.end, range2.end);\n var sum = moment.range(start, end);\n return sum;\n } else {\n return null;\n }\n}... | [
"0.66479737",
"0.6616013",
"0.652245",
"0.6456774",
"0.6433727",
"0.6431704",
"0.6426851",
"0.6387165",
"0.6342265",
"0.63171923",
"0.63106346",
"0.62977326",
"0.62505305",
"0.6249269",
"0.6243401",
"0.62178606",
"0.61666274",
"0.60571927",
"0.6051225",
"0.6029278",
"0.602211... | 0.73323363 | 0 |
Alyssa also works out the product of two intervals by finding the minimum and the maximum of the products of the bounds and using them as the bounds of the resulting interval. (math_min and math_max are primitives that find the minimum or maximum of any number of arguments.) | function mulInterval(x, y) {
const p1 = lowerBound(x) * lowerBound(y);
const p2 = lowerBound(x) * upperBound(y);
const p3 = upperBound(x) * lowerBound(y);
const p4 = upperBound(x) * upperBound(y);
return makeInterval(Math.min(p1, p2, p3, p4), Math.max(p1, p2, p3, p4));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function iclamp(a, min, max) {\n\treturn Math.max(min, Math.min(a, max));\n}",
"function product_Range(a,b) {\n var prd = a,i = a;\n\n while (i++< b) {\n prd*=i;\n }\n return prd;\n}",
"function map(x, in_min, in_max, out_min, out_max,checkRanges) {\n if ((typeof checkRanges != 'undefined') && checkR... | [
"0.63497293",
"0.6287785",
"0.6074114",
"0.6001888",
"0.5925367",
"0.5914643",
"0.58827174",
"0.5819397",
"0.58159214",
"0.5801726",
"0.5793916",
"0.5776489",
"0.5767991",
"0.57658136",
"0.576004",
"0.5758149",
"0.5742974",
"0.5724646",
"0.57046723",
"0.5695718",
"0.5684329",... | 0.69145757 | 0 |
To divide two intervals, Alyssa multiplies the first by the reciprocal of the second. Note that the bounds of the reciprocal interval are the reciprocal of the upper bound and the reciprocal of the lower bound, in that order. | function divInterval(x, y) {
return mulInterval(x, makeInterval(1.0 / upperBound(y), 1.0 / upperBound(y)));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function divide(a, b) {\n\t\ta = a + 0.0;\n\t\tb = b + 0.0;\n\t\tif(Math.abs(b) < 0.00001) {\n\t\t\tb = 0.0001;\n\t\t}\t\n\t\treturn a / b;\n\t}",
"function divide1(a, b) {\n return a / b; \n}",
"function divide(a, b) {\n return divide(a, b);\n}",
"function division(a, b) {\r\n\treturn a / b;\r\n}",
"fun... | [
"0.6556227",
"0.6140319",
"0.6107507",
"0.6097738",
"0.60297906",
"0.5959053",
"0.59564245",
"0.5914174",
"0.5869834",
"0.5859574",
"0.5777394",
"0.5768386",
"0.57455504",
"0.5718051",
"0.5714318",
"0.5704635",
"0.5701839",
"0.5690303",
"0.56748295",
"0.5670914",
"0.5670283",... | 0.6592287 | 0 |
Define a constructor make_center_percent that takes a center and a percentage tolerance and produces the desired interval. You must also define a selector percent that produces the percentage tolerance for a given interval. The center selector is the same as the one shown above. | function makeCenterPercent(center, percent, width = center * (percent / 100)) {
return makeCenterWidth(center, width);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getCubicBezierXYatPercent(startPt,controlPt1,controlPt2,endPt,percent){\n var x=CubicN(percent,startPt.x,controlPt1.x,controlPt2.x,endPt.x);\n var y=CubicN(percent,startPt.y,controlPt1.y,controlPt2.y,endPt.y);\n return({x:x,y:y});\n }",
"percent(val) {\n this._percent ... | [
"0.5441083",
"0.5423155",
"0.53515947",
"0.51415503",
"0.5099301",
"0.50814635",
"0.50578564",
"0.50578564",
"0.50578564",
"0.50578564",
"0.5045009",
"0.50370234",
"0.50069755",
"0.50069755",
"0.50069755",
"0.4975419",
"0.49723375",
"0.4970372",
"0.49646857",
"0.49646857",
"0... | 0.7483115 | 0 |
returns number of cannons in a pyramid of cannonballs using a recurrence relation cannonball(n) = nn + cannonball(n1) | function cannonball(n) {
if( n === 1){
return 1;
}else{
return n * n + cannonball(n - 1);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pyramid(cans){\n\tvar total = 0;\n\tvar counter = 1;\n\tvar result = 0;\n\twhile(total <= cans){\n\t\ttotal += Math.pow(counter,2);\n\t\tresult = counter;\n\t\tcounter++;\n\t}\n\treturn --result;\n}",
"function pyramid(cans){\n\tvar res = []; \n\t// var x = 0\n\twhile(cans > 1){\n\n\t\tres.push(Math.sqr... | [
"0.6721067",
"0.6645689",
"0.6422362",
"0.6253035",
"0.62261575",
"0.61913514",
"0.59372807",
"0.59161866",
"0.5898323",
"0.5876457",
"0.58520705",
"0.58518714",
"0.58251727",
"0.5822372",
"0.5803231",
"0.5732289",
"0.5717674",
"0.57052827",
"0.56735444",
"0.5653135",
"0.5651... | 0.7278037 | 0 |
edit storage company section | async function onStorageCompanyEdit() {
event.preventDefault();
if (!$("#modalWindowBlock .modal #addForm").valid()) {
return;
}
let form = document.querySelector("#addForm");
let formData = new FormData(form);
let parameters = new URLSearchParams(formData);
await sendRequest("/storageCompanys", "put", parameters);
onModalClose();
getItemsList("storageCompanys");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"update(companyId) {\n return Resource.get(this).resource('Admin:updateCompany', {\n company: {\n ...this.displayData.company,\n margin: this.displayData.company.settings.margin,\n useAlternateGCMGR: this.displayData.company.settings.useAlternateGCMGR,\n serviceFee: this.displayD... | [
"0.6512022",
"0.6260384",
"0.6237383",
"0.6085678",
"0.5973081",
"0.59060085",
"0.5844136",
"0.56873536",
"0.56678903",
"0.5568383",
"0.5495501",
"0.54906136",
"0.54874307",
"0.5475003",
"0.5434733",
"0.54195154",
"0.54015535",
"0.53953695",
"0.53770345",
"0.5372026",
"0.5350... | 0.67870003 | 0 |
Appends new file form row. This changes `model`. | addFile() {
this.addCustom('type', {
inputLabel: 'Property value'
});
const index = this.model.length - 1;
const item = this.model[index];
item.schema.isFile = true;
item.schema.inputType = 'file';
this.requestUpdate();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addFile(row, col, action) {\n\t\t\tconsole.log(\"add file example\", row);\n\t\t\tvar d = new Date();\n\t\t\tvar modifyItem = row.entity;\n\t\t\tif(modifyItem != undefined){\n\t\t\t\tmodifyItem.filename='newfile.jpg';\n\t\t\t\tmodifyItem.serial=10;\n\t\t\t\tmodifyItem.date = d;\n\t\t\t}\n\t\t\t//update ac... | [
"0.64594394",
"0.62547046",
"0.6169036",
"0.5937158",
"0.5894436",
"0.58939934",
"0.58461946",
"0.5761837",
"0.5725706",
"0.56414187",
"0.5603139",
"0.5497808",
"0.54590863",
"0.54520863",
"0.5437351",
"0.5404809",
"0.54003686",
"0.5393868",
"0.5362818",
"0.5359372",
"0.53406... | 0.6369479 | 1 |
Appends empty text field to the form. This changes `model`. | addText() {
this.addCustom('type', {
inputLabel: 'Property value'
});
const index = this.model.length - 1;
const item = this.model[index];
item.schema.isFile = false;
item.schema.inputType = 'text';
/* istanbul ignore else */
if (hasFormDataSupport) {
item.contentType = '';
}
this.requestUpdate();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makingInputEmpty(input){\n input.value = \"\";\n}",
"getItemEmpty() {\n this.elements.form.querySelector('.field-title').value = '';\n this.elements.form.querySelector('.field-price').value = '';\n }",
"function emptyField(event){\n\t\tvar thisObj = $(this);\n\t\tvar currVal=thisObj.val();\n... | [
"0.6011149",
"0.599558",
"0.5973112",
"0.5938429",
"0.58705604",
"0.5869868",
"0.5852022",
"0.58518314",
"0.58482265",
"0.583491",
"0.5822847",
"0.58139586",
"0.5799688",
"0.57825714",
"0.57810926",
"0.575355",
"0.57521373",
"0.5744637",
"0.5742645",
"0.5734894",
"0.5734518",... | 0.6622295 | 0 |
This function represents the starting point of the program, leading straight to entering meta data and initializes the SVG output. | function start(){
var p = document.getElementById("input");
p.innerHTML = metaDataForm;
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function start() {\n const logoText = figlet.textSync(\"Employee Database Tracker!\", 'Standard');\n console.log(logoText);\n loadMainPrompt();\n}",
"function doInitialization() {\n\t\tvar svg = \"\";\n\n\t\tif (typeof theSvgElement === \"undefined\") {\n\t\t\t// Add event to body: each time a key is hi... | [
"0.6164258",
"0.6153753",
"0.6103125",
"0.60569006",
"0.6028724",
"0.60109293",
"0.5989982",
"0.5943327",
"0.5902008",
"0.58985037",
"0.5887603",
"0.5883157",
"0.58719426",
"0.5870687",
"0.5868651",
"0.584427",
"0.582053",
"0.58100206",
"0.58062714",
"0.5795493",
"0.57847077"... | 0.6928524 | 0 |
Reads the data entered in the meta data form and saves it, leading to the source form afterwards. | function createMetaData(){
var title = document.getElementById("title").value;
var composer = document.getElementById("composer").value;
var author = document.getElementById("author").value;
var availability = document.getElementById("availability").value;
var comment = document.getElementById("comment").value;
metaData = new MetaData(title, composer, author, availability, comment);
document.getElementById("input").innerHTML = sourceForm();
document.getElementById("meiOutput").value = createMEIOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function applyMetaDataChanges(){\n var title = document.getElementById(\"title\").value;\n var composer = document.getElementById(\"composer\").value;\n var author = document.getElementById(\"author\").value;\n var availability = document.getElementById(\"availability\").value;\n var comment = docum... | [
"0.59718615",
"0.591337",
"0.57427394",
"0.5741593",
"0.5740494",
"0.5718736",
"0.5649828",
"0.56201446",
"0.54978794",
"0.54947",
"0.54677665",
"0.53675306",
"0.5363405",
"0.53455406",
"0.53410196",
"0.53374064",
"0.5306338",
"0.5278786",
"0.5275786",
"0.5230865",
"0.5230068... | 0.61347723 | 0 |
Navigational, leads to syllable form from neume variants. | function toSyllableFromNeumeVariations(){
pushedNeumeVariations = false;
neumeVariations = new Array();
isNeumeVariant = false;
if(syllables.length > 1){
currentColor = syllables[syllables.length-1].color;
}
document.getElementById("input").innerHTML = syllableForm();
document.getElementById("meiOutput").value = createMEIOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function L() {\n if (Syllable.DEBUG) Vex.L(\"Vex.Flow.Syllable\", arguments);\n }",
"function toSyllableFromVariations(){\n pushedVariations = false;\n variations = new Array();\n \n if(syllables.length > 1){\n currentColor = syllables[syllables.length-1].color;\n }\n \n document.... | [
"0.5760608",
"0.562237",
"0.5390461",
"0.5292844",
"0.52794814",
"0.5221145",
"0.5215348",
"0.5215348",
"0.5215348",
"0.5215348",
"0.519355",
"0.51407933",
"0.5074362",
"0.5043243",
"0.5035038",
"0.50228405",
"0.49539477",
"0.495328",
"0.49445188",
"0.4937989",
"0.49374697",
... | 0.59461 | 0 |
Reads the data entered in the neume form and saves it. If no pitch is given and the neume type is virga, punctum, pes, clivis, torculus, porrectus, scandicus or climacus, all needed pitches will be automatically added. | function createNeume(){
var type = document.getElementById("type").value;
if(isClimacus){
maxPitches = document.getElementById("numberofpitches").value;
}
currentNeume = new Neume();
currentNeume.type = type;
if(type == "virga" || type == "punctum"){
var p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "pes"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "clivis"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "torculus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "porrectus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "climacus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
if(maxPitches == 4){
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
if(maxPitches == 5){
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
}
else if(currentNeume.type == "scandicus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
currentSyllable.neumes.push(currentNeume);
document.getElementById("meiOutput").value = createMEIOutput();
document.getElementById("input").innerHTML = neumeForm();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createPitch(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"con... | [
"0.6827162",
"0.60986024",
"0.58212453",
"0.56243604",
"0.5201323",
"0.5145991",
"0.51065415",
"0.5074942",
"0.50642186",
"0.49391967",
"0.49211776",
"0.48684478",
"0.48668554",
"0.48605475",
"0.48126107",
"0.48085874",
"0.48085874",
"0.48085874",
"0.48049897",
"0.47893217",
... | 0.6151761 | 1 |
Reads the data entered in the neume variation form and saves it. If no pitch is given and the neume type is virga, punctum, pes, clivis, torculus, porrectus, scandicus, climacus or torculusresupinus, all needed pitches will be automatically added. | function createNeumeVariation(){
var sourceID = document.getElementById("source").value;
var type = document.getElementById("type").value;
if(isClimacus){
maxPitches = document.getElementById("numberofpitches").value;
}
currentSID = sourceID;
currentNeume = new Neume();
currentNeume.type = type;
if(type == "virga" || type == "punctum"){
var p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "pes"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "clivis"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "torculus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "porrectus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
else if(currentNeume.type == "climacus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
if(maxPitches == 4){
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
if(maxPitches == 5){
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "d";
currentNeume.pitches.push(p);
}
}
else if(currentNeume.type == "scandicus"){
var p;
p = new Pitch();
p.pitch = "none";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch();
p.pitch = "none";
p.intm = "u";
currentNeume.pitches.push(p);
}
var i;
if(neumeVariations.length < 1){
for(i = 0; i < sources.length; i++){
var neumeVariation = new NeumeVariation(sources[i].id);
neumeVariations.push(neumeVariation);
}
}
for(i = 0; i < neumeVariations.length; i++){
if(neumeVariations[i].sourceID == sourceID){
neumeVariations[i].additionalNeumes.push(currentNeume);
break;
}
}
if(!pushedNeumeVariations){
currentSyllable.neumes.push(neumeVariations);
pushedNeumeVariations = true;
}
else{
currentSyllable.neumes.pop();
currentSyllable.neumes.push(neumeVariations);
}
isNeumeVariant = true;
document.getElementById("meiOutput").value = createMEIOutput();
document.getElementById("input").innerHTML = neumeVariationForm();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createPitch(){\n var pitch = document.getElementById(\"pitch\").value;\n var octave = document.getElementById(\"octave\").value;\n var comment = document.getElementById(\"comment\").value;\n var intm = document.getElementById(\"intm\").value;\n var connection = document.getElementById(\"con... | [
"0.6741597",
"0.597301",
"0.58804256",
"0.58528537",
"0.5750121",
"0.5664778",
"0.5650399",
"0.5647673",
"0.56339335",
"0.5263557",
"0.5105627",
"0.498471",
"0.48323354",
"0.48112124",
"0.47628936",
"0.47326404",
"0.47216412",
"0.47216412",
"0.47216412",
"0.46968457",
"0.4564... | 0.6479758 | 1 |
Reads the data entered in the neume form and saves it. Thereby the function controls the length and intervals for neumes of the types virga, punctum, pes, clivis, torculus, porrectus, scandicus and climacus. Also if the first pitch is not specified for the previously mentioned types, the function will automatically generate the rest of the neume. | function createPitch(){
var pitch = document.getElementById("pitch").value;
var octave = document.getElementById("octave").value;
var comment = document.getElementById("comment").value;
var intm = document.getElementById("intm").value;
var connection = document.getElementById("connection").value;
var tilt = document.getElementById("tilt").value;
var variation = document.getElementById("variation").value;
var supplied = document.getElementById("supplied").value;
var p = new Pitch(pitch, octave, comment, intm, connection, tilt, variation, supplied);
currentNeume.pitches.push(p);
if(currentNeume.type == "virga" || currentNeume.type == "punctum"){
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(currentNeume.type == "pes"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "clivis"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "torculus"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 2)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "porrectus"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 2)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "climacus"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 2)
{
if(maxPitches == 4 || maxPitches == 5){
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(pitchCounter == 3)
{
if(maxPitches == 5){
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(pitchCounter == 4)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "scandicus"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 2)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else if(currentNeume.type == "torculusresupinus"){
if(pitch == "none" && pitchCounter == 0){
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "d";
currentNeume.pitches.push(p);
p = new Pitch(pitch, octave, comment, intm, connection, tilt);
p.intm = "u";
currentNeume.pitches.push(p);
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
else if(pitchCounter == 0){
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 1)
{
currentIntm = "d";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 2)
{
currentIntm = "u";
pitchCounter++;
document.getElementById("input").innerHTML = pitchForm();
}
else if(pitchCounter == 3)
{
currentIntm = "none";
pitchCounter = 0;
if(isNeumeVariant){
document.getElementById("input").innerHTML = neumeVariationForm();
}
else{
document.getElementById("input").innerHTML = neumeForm();
}
}
}
else{
document.getElementById("input").innerHTML = pitchForm();
}
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createNeumeVariation(){\n var sourceID = document.getElementById(\"source\").value;\n var type = document.getElementById(\"type\").value;\n \n if(isClimacus){\n maxPitches = document.getElementById(\"numberofpitches\").value;\n }\n \n currentSID = sourceID;\n \n currentNe... | [
"0.6208604",
"0.6010984",
"0.5994155",
"0.59246314",
"0.52992785",
"0.51781476",
"0.5166663",
"0.50967073",
"0.5086359",
"0.49839997",
"0.49170277",
"0.4833895",
"0.48119894",
"0.48114663",
"0.47898984",
"0.47560632",
"0.47492164",
"0.47482073",
"0.47360724",
"0.47360724",
"0... | 0.6293426 | 0 |
Deletes the selected source and adjusts variations. | function deleteSource(id){
var i;
for(i = 0; i < sources.length; i++){
if(sources[i].id == id){
if(sources.length == 1){
document.getElementById("input").innerHTML = sourceDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
return;
}
else if(i != 0){
currentSID = sources[i - 1].id;
currentSource = sources[i - 1];
}
else{
currentSID = sources[i + 1].id;
currentSource = sources[i + 1];
}
sources.splice(i, 1);
}
}
for(i = 0; i < syllables.length; i++){
for(var j = 0; j < syllables[i].neumes.length; j++){
if(Array.isArray(syllables[i].neumes[j])){
for(var k = 0; k < syllables[i].neumes[j].length; k++){
if(syllables[i].neumes[j][k].sourceID == id){
syllables[i].neumes[j].splice(k, 1);
}
}
}
else{
for(var l = 0; l < syllables[i].neumes[j].pitches.length; l++){
if(Array.isArray(syllables[i].neumes[j].pitches[l])){
for(var k = 0; k < syllables[i].neumes[j].pitches[l].length; k++){
if(syllables[i].neumes[j].pitches[l][k].sourceID == id){
syllables[i].neumes[j].pitches[l].splice(k, 1);
}
}
}
}
}
}
}
document.getElementById("input").innerHTML = sourceDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteOpportunitySource(req, res) {\n if (!validator.isValid(req.body.sourceId)) {\n res.json({code: Constant.ERROR_CODE, message: Constant.REQUIRED_FILED_MISSING});\n } else {\n source.findByIdAndUpdate(req.body.sourceId, {deleted: true}, function(err, data) {\n if (err) {\... | [
"0.6051235",
"0.59864193",
"0.5911509",
"0.5821981",
"0.56926495",
"0.55836654",
"0.5563558",
"0.55533856",
"0.55462766",
"0.5451462",
"0.5419775",
"0.53814393",
"0.5349823",
"0.53339475",
"0.5304059",
"0.52924186",
"0.5276334",
"0.5257821",
"0.5257723",
"0.52446765",
"0.5225... | 0.6068513 | 0 |
Navigational, leads to change staff data form, setting the current staff to the first of all staffs. | function toChangeStaffData(){
if(staffs.length > 0){
currentN = staffs[0].n;
}
document.getElementById("input").innerHTML = staffDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"SYS_STF_LST_READY(state, p){\n state.staff.list = p.list;\n }",
"function setListStaff(){\n vm.listStaff.$promise.then(function(data) {\n $timeout(function() {\n var arr_tmp = [];\n for(var i = 0; i < data.length; i++) {\n data[i].id = data[i]._id;\n arr_tm... | [
"0.6424013",
"0.626715",
"0.5780946",
"0.5619246",
"0.5508845",
"0.5502562",
"0.5488556",
"0.5407104",
"0.53879005",
"0.5325747",
"0.53236014",
"0.5302032",
"0.52616704",
"0.5252225",
"0.5250208",
"0.5208702",
"0.5191996",
"0.51850426",
"0.51532906",
"0.5118942",
"0.51098365"... | 0.6435792 | 0 |
Deletes the selected staff and the syllables using that staff. | function deleteStaff(n){
var i;
for(i = 0; i < staffs.length; i++){
if(staffs[i].n == n){
if(staffs.length == 1){
document.getElementById("input").innerHTML = staffDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
return;
}
else if( i != 0){
currentN = staffs[i-1].n;
currentStaff = staffs[i-1];
}
else{
currentN = staffs[i + 1].n;
currentStaff = staffs[i + 1];
}
staffs.splice(i, 1);
}
}
for(i = 0; i < syllables.length; i++){
if(syllables[i].staff == n){
syllables.splice(i, 1);
i--;
}
}
document.getElementById("input").innerHTML = staffDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteSyllable(){\n syllables.splice(currentSyllableIndex, 1);\n \n currentSyllableIndex = 0;\n \n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function delSele... | [
"0.6465517",
"0.581751",
"0.57589823",
"0.57563466",
"0.55770546",
"0.5530611",
"0.5504792",
"0.5500302",
"0.54334754",
"0.5417416",
"0.54026306",
"0.53906167",
"0.53874385",
"0.5372126",
"0.53588396",
"0.53256476",
"0.5320947",
"0.5294121",
"0.5274152",
"0.5269597",
"0.52666... | 0.68533444 | 0 |
Navigational, leads to syllable change form. | function toChangeSyllableData(){
if(syllables.length > 0){
currentType = syllables[0].type;
currentColor = syllables[0].color;
}
pushedNeumeVariations = false;
document.getElementById("input").innerHTML = syllableDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function applyCurrentSyllable(){\n currentSyllableIndex = document.getElementById(\"syllable\").value;\n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n}",
"function applySyllableDataChanges(){\n \n var page = document.getElementById(\"page\").value;\n var line = documen... | [
"0.67458194",
"0.57106864",
"0.56991607",
"0.5685656",
"0.5662797",
"0.56036144",
"0.55806",
"0.5488491",
"0.547239",
"0.5461994",
"0.542756",
"0.5423051",
"0.5423051",
"0.53920394",
"0.53740466",
"0.5349346",
"0.5333484",
"0.5317176",
"0.53145134",
"0.5292881",
"0.5279999",
... | 0.62301207 | 1 |
Applies changes made to the selected syllable. | function applySyllableDataChanges(){
var page = document.getElementById("page").value;
var line = document.getElementById("line").value;
var staff = document.getElementById("staff").value;
var syllable = document.getElementById("syllabletext").value;
var initial = document.getElementById("initial").checked;
var color = document.getElementById("color").value;
var comment = document.getElementById("comment").value;
if(page){
currentSyllable.page = page;
}
if(line){
currentSyllable.line = line;
}
if(staff){
currentSyllable.staff = staff;
}
if(syllable){
currentSyllable.syllable = syllable;
}
currentSyllable.initial = initial;
if(color && color != "none"){
currentSyllable.color = color;
}
if(comment){
currentSyllable.comment = comment;
}
document.getElementById("meiOutput").value = createMEIOutput();
document.getElementById("input").innerHTML = syllableDataChangeForm();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function applyCurrentSyllable(){\n currentSyllableIndex = document.getElementById(\"syllable\").value;\n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n}",
"function toChangeSyllableData(){\n if(syllables.length > 0){\n currentType = syllables[0].type;\n currentC... | [
"0.6954043",
"0.63057995",
"0.5626521",
"0.5541029",
"0.54764396",
"0.5379822",
"0.52435076",
"0.5228192",
"0.52049494",
"0.5200517",
"0.5200517",
"0.50805396",
"0.50448585",
"0.5040489",
"0.50388575",
"0.5013113",
"0.5009509",
"0.50055045",
"0.49421582",
"0.49377894",
"0.489... | 0.65288746 | 1 |
Deletes currently selected syllable. | function deleteSyllable(){
syllables.splice(currentSyllableIndex, 1);
currentSyllableIndex = 0;
document.getElementById("input").innerHTML = syllableDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"deleteLabel() {\n /** @type {number} */\n let rowIdx = this.labels.indexOf(this.label);\n\n if (rowIdx > -1) {\n this.labels.splice(rowIdx, 1);\n }\n }",
"function deleteMenuDeleteClicked() {\n canvas.removeLabel(canvas.getCurrentLabel());\n oPublic.hideDeleteLabel();\n myA... | [
"0.6352314",
"0.6223733",
"0.59342545",
"0.58443886",
"0.58173317",
"0.571928",
"0.56487775",
"0.5629056",
"0.5611144",
"0.5610573",
"0.55932754",
"0.55804163",
"0.55733085",
"0.55733085",
"0.55733085",
"0.55298275",
"0.5529695",
"0.5520145",
"0.55065244",
"0.5461864",
"0.545... | 0.7606057 | 0 |
Deletes the currently selected pitch. | function deletePitch(){
currentNeume.pitches.splice(currentPitchIndex, 1);
currentPitchIndex = 0;
document.getElementById("input").innerHTML = pitchDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteVariationPitch(){\n currentNeume.pitches[currentPitchIndex][currentVarSourceIndex].additionalPitches.splice(currentVarPitchIndex, 1);\n \n currentVarPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").v... | [
"0.67750955",
"0.577435",
"0.56466293",
"0.56040037",
"0.5565921",
"0.54883426",
"0.5440928",
"0.5363801",
"0.5356186",
"0.5355239",
"0.5349126",
"0.534746",
"0.5335379",
"0.5254939",
"0.5249522",
"0.5247628",
"0.5236143",
"0.52346873",
"0.5182655",
"0.51549447",
"0.51549447"... | 0.7280706 | 0 |
Creates a new variation which can later be tweaked by the user. | function createAdditionalVariation(){
variations = new Array();
for(i = 0; i < sources.length; i++){
var variation = new Variation(sources[i].id);
variations.push(variation);
}
currentNeume.pitches.splice(currentPitchIndex, 0, variations);
document.getElementById("meiOutput").value = createMEIOutput();
document.getElementById("input").innerHTML = pitchDataChangeForm();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Interpreter_AddVariation(theObject, eProp, strValue)\n{\n\t//get this object's variations map\n\tvar objectMap = this.Variations[theObject.DataObject.Id];\n\t//no map?\n\tif (!objectMap)\n\t{\n\t\t//create a new one\n\t\tobjectMap = {};\n\t\t//set it\n\t\tthis.Variations[theObject.DataObject.Id] = objectM... | [
"0.694004",
"0.62396306",
"0.6203838",
"0.5590959",
"0.5456772",
"0.5446231",
"0.53901875",
"0.5368162",
"0.5363705",
"0.5279377",
"0.5266426",
"0.52592355",
"0.5250064",
"0.523601",
"0.52161443",
"0.5201425",
"0.51934534",
"0.518344",
"0.51736003",
"0.51620394",
"0.51599216"... | 0.6720598 | 1 |
Deletes the pitch of a variation. | function deleteVariationPitch(){
currentNeume.pitches[currentPitchIndex][currentVarSourceIndex].additionalPitches.splice(currentVarPitchIndex, 1);
currentVarPitchIndex = 0;
document.getElementById("input").innerHTML = pitchDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deletePitch(){\n currentNeume.pitches.splice(currentPitchIndex, 1);\n \n currentPitchIndex = 0;\n \n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function deleteSh... | [
"0.6880858",
"0.57012665",
"0.56136405",
"0.5587377",
"0.5557648",
"0.55111945",
"0.542531",
"0.54174113",
"0.5399664",
"0.53873914",
"0.5384007",
"0.53207153",
"0.530118",
"0.52598375",
"0.5217453",
"0.5209899",
"0.5203828",
"0.5190707",
"0.5187357",
"0.5131172",
"0.5121391"... | 0.77226067 | 0 |
Deletes the neume in a variation. | function deleteNeumeInVariant(){
currentSyllable.neumes[currentNeumeIndex][currentNeumeVariationIndex].additionalNeumes.splice(currentNeumeInVariationIndex, 1);
currentNeumeInVariationIndex = 0;
document.getElementById("input").innerHTML = neumeDataChangeForm();
document.getElementById("meiOutput").value = createMEIOutput();
createSVGOutput();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteNeume(){\n currentSyllable.neumes.splice(currentNeumeIndex, 1);\n \n currentNeumeIndex = 0;\n \n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}",
"function delete... | [
"0.70665705",
"0.6344076",
"0.611338",
"0.61124647",
"0.61124647",
"0.60330266",
"0.6019716",
"0.5986053",
"0.5861187",
"0.57542586",
"0.574653",
"0.57440805",
"0.5741301",
"0.57347727",
"0.5734445",
"0.5731595",
"0.57023925",
"0.5695025",
"0.56697977",
"0.5653932",
"0.562234... | 0.795165 | 0 |
Set the selected source ID to be current source ID according to the form and reload it. | function applyCurrentSource(){
currentSID = document.getElementById("source").value;
document.getElementById("input").innerHTML = sourceDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toChangeSourceData(){\n isChangingSources = true;\n if(sources.length > 0){\n currentSID = sources[0].id;\n }\n document.getElementById(\"input\").innerHTML = sourceDataChangeForm();\n}",
"function setSource(aSrc) {\n\n\tdocument.getElementById('frmFacturation').hdnSource.value = aSrc;... | [
"0.70406044",
"0.64564556",
"0.6252756",
"0.6245405",
"0.6176669",
"0.5838951",
"0.58054924",
"0.568314",
"0.5662627",
"0.564564",
"0.56438553",
"0.5641112",
"0.5638255",
"0.5630472",
"0.56117994",
"0.55540216",
"0.55443627",
"0.5513411",
"0.550988",
"0.54959524",
"0.54640895... | 0.6893277 | 1 |
Set the selected staff to be current staff according to the form and reload it. | function applyCurrentStaff(){
currentN = document.getElementById("staff").value;
document.getElementById("input").innerHTML = staffDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function selecionarEmpleadoStaff(id){\n\tvar url =$('.staff_empleado_url').attr('id');\n\turl = url+'?empleadoStaff='+id;\n\n\t$.post(url, function( data ) {\n\t\tdata.forEach( function(valor, indice, array) {\n\t\t\t$('#staff_empleado').val(valor.empleado_codigo).trigger('change');\n\t\t\t$('#staff_tarea').val(va... | [
"0.6330211",
"0.6120926",
"0.6079444",
"0.5784053",
"0.57264775",
"0.57064766",
"0.5625",
"0.5576152",
"0.5551675",
"0.5512408",
"0.5479664",
"0.5473718",
"0.54386705",
"0.5428659",
"0.53851527",
"0.5380228",
"0.53154707",
"0.5297902",
"0.52948344",
"0.52673614",
"0.5265763",... | 0.6225552 | 1 |
Set the selected clef to be current clef according to the form and reload it. | function applyCurrentClef(){
currentClefIndex = document.getElementById("clef").value;
document.getElementById("input").innerHTML = clefDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updatePreviewWithClef(sender, clef) {\r\n // console.log(\"clef changed to \" + clef)\r\n selectedClef = clef\r\n updateNotesSVG()\r\n}",
"function setCurrent(current) {\n deselectFeature();\n\n $.each($(\"#editorFeatures\").find(\"div.panel-body div input\"), function (index, input) {\n ... | [
"0.62188315",
"0.60764533",
"0.5962494",
"0.59495044",
"0.5940669",
"0.5797134",
"0.5691537",
"0.5642058",
"0.5637858",
"0.55275893",
"0.5476251",
"0.5464947",
"0.54585445",
"0.54477674",
"0.5432277",
"0.54301274",
"0.54079443",
"0.5403106",
"0.53918",
"0.53680503",
"0.536753... | 0.63718075 | 0 |
Set the selected syllable to be current syllable according to the form and reload it. | function applyCurrentSyllable(){
currentSyllableIndex = document.getElementById("syllable").value;
document.getElementById("input").innerHTML = syllableDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toChangeSyllableData(){\n if(syllables.length > 0){\n currentType = syllables[0].type;\n currentColor = syllables[0].color;\n }\n pushedNeumeVariations = false;\n document.getElementById(\"input\").innerHTML = syllableDataChangeForm();\n}",
"function applySyllableDataChanges(){... | [
"0.6784174",
"0.6132346",
"0.5928821",
"0.5838092",
"0.5741207",
"0.5551991",
"0.5539273",
"0.5481438",
"0.5383608",
"0.5383608",
"0.53811604",
"0.53811604",
"0.53734535",
"0.53444487",
"0.5330527",
"0.53058916",
"0.5289711",
"0.5289358",
"0.52828467",
"0.5253412",
"0.5251887... | 0.7612395 | 0 |
Set the selected pitch index to be current pitch index according to the form and reload it. | function applyCurrentPitch(){
currentPitchIndex = document.getElementById("pitc").value;
document.getElementById("input").innerHTML = pitchDataChangeForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function applyCurrentVariation(){\n currentVarPitchIndex = document.getElementById(\"varpitch\").value;\n document.getElementById(\"input\").innerHTML = pitchDataChangeForm();\n}",
"function applyCurrentOctave(){\n currentOctave = document.getElementById(\"octave\").value;\n document.getElementById(\... | [
"0.6336565",
"0.5809133",
"0.55543834",
"0.54844683",
"0.53527266",
"0.53527266",
"0.53513706",
"0.53462267",
"0.53462267",
"0.53462267",
"0.53462267",
"0.533309",
"0.5288151",
"0.5266077",
"0.52589005",
"0.5233567",
"0.51925147",
"0.51778054",
"0.51749754",
"0.5151192",
"0.5... | 0.6773352 | 0 |
Set the selected octave to be current octave according to the form and reload it. | function applyCurrentOctave(){
currentOctave = document.getElementById("octave").value;
document.getElementById("input").innerHTML = pitchForm();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setOctave(keyAdjust) {\n\tvar octaves = document.getElementsByName('octave');\n\tvar octaveSet = \"\";\n\n\t//find which octave button is selected\n\tfor(var i = 0; i < octaves.length; i++){\n\t if(octaves[i].checked){\n\t octaveSet = octaves[i].value;\n\t }\n\t}\n\t\n\t//if it's a positive o... | [
"0.64532727",
"0.6226794",
"0.59063274",
"0.5747786",
"0.5722116",
"0.5243063",
"0.52056074",
"0.5198421",
"0.51464415",
"0.51365244",
"0.5114822",
"0.507811",
"0.5076945",
"0.5055766",
"0.50290275",
"0.501767",
"0.49903986",
"0.49648476",
"0.4961119",
"0.4949368",
"0.4945698... | 0.709136 | 0 |
Factory method to create a TerrainRenderer from img urls instead of img objects | static async fromImgUrl (shapeCanvas, opts) {
const imgOpts = Object.assign({}, opts, {
groundImg: await loadImage(opts.groundImg)
})
return new TerrainRenderer(shapeCanvas, imgOpts)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initRasterFactory(getURL) {\n // Input getURL returns a tile URL for given indices z, x, y, t (t optional)\n\n return { create };\n\n function create(z, x, y, t) {\n const tileHref = getURL(z, x, y, t);\n const img = loadImage(tileHref, checkData);\n\n const tile = { \n z, ... | [
"0.5914441",
"0.5603538",
"0.5532649",
"0.5461344",
"0.543083",
"0.54229",
"0.53484315",
"0.53467107",
"0.53092444",
"0.53054607",
"0.5298784",
"0.5286089",
"0.52688277",
"0.52600914",
"0.52369606",
"0.52326185",
"0.51437235",
"0.5139459",
"0.5138149",
"0.5136494",
"0.5130034... | 0.7094668 | 0 |
callback function to handle submit on the form to add an activity | function addActivity(event) {
event.preventDefault();
let form = event.target;
let memberName = form.name;
let newActivity = form.elements[0].value;
// add the activity to the object
if (newActivity)
{
let list = document.getElementById(memberName);
let li = document.createElement("li");
li.textContent = newActivity;
list.appendChild(li);
getMember(memberName).activities.push(newActivity);
}
else{
window.alert("Please enter an activity");
return;
}
form.elements[0].value = null;
} // End of callback function addActivity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"submitForm(e) {\n e.preventDefault();\n window.M.updateTextFields();\n let data = Util.getDataElementsForm(e.target, false);\n\n MakeRequest({\n method: 'post',\n url: 'actividad/post',\n data : data\n }).then(response => {\n if (respon... | [
"0.69341975",
"0.68606526",
"0.6770345",
"0.6732411",
"0.6714598",
"0.6586078",
"0.656666",
"0.65280867",
"0.6518199",
"0.65049475",
"0.64693755",
"0.63927644",
"0.63830346",
"0.63198674",
"0.63124996",
"0.630023",
"0.62911195",
"0.6286407",
"0.62854224",
"0.6280558",
"0.6278... | 0.75676477 | 0 |
options can be: Local options: lineRegex: defaults to /[\n\r]/. Better know what your doing if you change it. Parent options: decodeStrings: If you want strings to be buffered (Default: true) highWaterMark: Memory for internal buffer of stream (Default: 16kb) objectMode: Streams convert your data into binary, you can opt out of by setting this to true (Default: false) | constructor(options) {
super(options);
this._lineRegex = (is.notNil(options) && is.notNil(options.lineRegex)) ? options.lineRegex : DEFAULT_LINE_REGEX;
this._last = null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructor(options) {\n this.context = options.context;\n this.dryRun = options.dryRun;\n this.logger = options.logger;\n this.encoding = options.encoding || 'utf-8';\n }",
"function Source(obj, options) {\n Readable.call(this, options);\n this.obj = obj;\n this.arrLen = this.arrInd = 0;\n... | [
"0.598805",
"0.5458345",
"0.53923386",
"0.53203326",
"0.5241645",
"0.5241645",
"0.5212115",
"0.51200736",
"0.51083565",
"0.51083565",
"0.50362635",
"0.5031804",
"0.50278515",
"0.5024184",
"0.5013628",
"0.5013628",
"0.50017864",
"0.50017864",
"0.50017864",
"0.50017864",
"0.500... | 0.63171875 | 0 |
Base pairs are a pair of AT and CG. pairElement("ATCGA") should return [["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]. pairElement("TTGAG") should return [["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]. pairElement("CTCTA") should return [["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]. split("") the str to turn into an array create a for loop for the newly created array create the switch() statement for each iterated element. case "A" : ["A", "T"]; break; case "C" : newArr.push(["C", "G"]); break; return newArr; | function pairElement(str) {
let arr = str.split("");
let newArr = [];
let len = arr.length;
for (let i = 0; i < len; i++) {
switch(arr[i]) {
case 'A':
newArr.push(['A', 'T']);
break;
case 'T':
newArr.push(['T', 'A']);
break;
case 'C':
newArr.push(['C', 'G']);
break;
case 'G':
newArr.push(['G','C']);
break;
}
}
return newArr;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pairElement(str) {\n let at = ['A','T'];\n let ta = ['T','A'];\n let gc = ['G','C'];\n let cg = ['C','G'];\n let returnArr = [];\n let arr = str.split(\"\");\n \n arr.map(k => {\n if(k === \"A\") {\n returnArr.push(at);\n } else if(k === \"T\") {\n returnArr.push(ta);\n } else i... | [
"0.8297701",
"0.82293373",
"0.820291",
"0.8188886",
"0.8101683",
"0.7922902",
"0.7810319",
"0.7804721",
"0.77858955",
"0.77729666",
"0.77284795",
"0.7638515",
"0.7618238",
"0.7614296",
"0.75772583",
"0.7571956",
"0.7476376",
"0.74648416",
"0.739352",
"0.7204998",
"0.719899",
... | 0.83368564 | 0 |
takes a JSON or YAML string, returns YAML string | function load(string) {
var jsonError, yamlError;
if (!angular.isString(string)) {
throw new Error('load function only accepts a string');
}
// Try figuring out if it's a JSON string
try {
JSON.parse(string);
} catch (error) {
jsonError = error;
}
// if it's a JSON string, convert it to YAML string and return it
if (!jsonError) {
return jsyaml.dump(JSON.parse(string));
}
// Try parsing the string as a YAML string and capture the error
try {
jsyaml.load(string);
} catch (error) {
yamlError = error;
}
// If there was no error in parsing the string as a YAML string
// return the original string
if (!yamlError) {
return string;
}
// If it was neither JSON or YAML, throw an error
throw new Error('load function called with an invalid string');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function yamlString2JsonObject (data) {\n // 1. Render YAML template\n // nunjucks.configure({ autoescape: false });\n // const contents = nunjucks.renderString(template, params);\n // 2. Convert YAML text to JSON Object\n return yaml.load(data);\n}",
"function yaml(hljs) {\n var LITERALS = 'true fal... | [
"0.7436097",
"0.63431114",
"0.62323123",
"0.6145358",
"0.6144687",
"0.6144687",
"0.6138018",
"0.5777885",
"0.5621768",
"0.5467203",
"0.54542303",
"0.538984",
"0.52895117",
"0.523634",
"0.52218056",
"0.5184282",
"0.5152882",
"0.5137597",
"0.5083414",
"0.50124794",
"0.50003785"... | 0.7127248 | 1 |
calcule de la moyenne des notes de l'eleve avec les coefficients | static moyenneNote(tableauNotes,idStagiaire = -1) {
// sommes des notes*coef
// sommes des coef
let sommeNoteCoef = 0
let sommeCoef = 0
tableauNotes.forEach(function(element) {
if (element.id === idStagiaire || idStagiaire === -1) {
sommeNoteCoef += element.note * element.coef
sommeCoef += element.coef
}
});
if (sommeCoef != 0 && tableauNotes.length !=0) {
return sommeNoteCoef /sommeCoef
}
else {
return -1
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"pow22523(z) {\r\n const t0 = new FieldElement();\r\n const t1 = new FieldElement();\r\n const t2 = new FieldElement();\r\n let i;\r\n t0.square(z);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t1.square(t0);\r\n for (i... | [
"0.6165908",
"0.59032685",
"0.5873705",
"0.5796195",
"0.57925344",
"0.5783441",
"0.57514644",
"0.5713553",
"0.5702795",
"0.56911266",
"0.5604644",
"0.55746",
"0.55706394",
"0.55626744",
"0.554239",
"0.5528351",
"0.5527571",
"0.55149704",
"0.5494513",
"0.5465213",
"0.5457862",... | 0.6571702 | 0 |
Method to load a random card (callable from any component) | loadRandomCard(currentCardId, a) {
//document.getElementById(card.id).title = "test test test";
document.getElementById("frontface").style.display = "block";
//card.testest();
// Remove current card so we don't randomly select it
const cards = this.get('cards').filter(card => card.id !== currentCardId)
const card = cards[Math.floor(Math.random() * cards.length)]
this.set({
currentCard: card.id,
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function newRndCard() {\n $.getJSON('https://api.scryfall.com/cards/random?q=-type%3Aland+legal%3Alegacy+not%3Atoken+not%3Asplit+not%3Atransform', function (data) {\n saveCard(data);\n })\n }",
"function newRandomCard() {\n currentCard = getRandomCard(cardList);\n // ignore transfor... | [
"0.6958431",
"0.6816011",
"0.6625624",
"0.6609234",
"0.6605706",
"0.6546299",
"0.6516402",
"0.6473475",
"0.6454191",
"0.641102",
"0.63849986",
"0.6367232",
"0.63656986",
"0.6342588",
"0.63051146",
"0.62916833",
"0.62818265",
"0.62649316",
"0.62610537",
"0.62522215",
"0.623763... | 0.7514743 | 0 |
getStorage will test to see if the requested storage type is available, if it is not, it will try sessionStorage, and if that is also not available, it will fallback to InMemoryStorage. | function getStorage(type) {
try {
// Get the desired storage from the window and test it out.
const storage = window[type];
testStorageAccess(storage);
// Storage test was successful! Return it.
return storage;
} catch (err) {
// When third party cookies are disabled, session storage is readable/
// writable, but localStorage is not. Try to get the sessionStorage to use.
if (type !== 'sessionStorage') {
console.warn('Could not access', type, 'trying sessionStorage', err);
return getStorage('sessionStorage');
}
console.warn(
'Could not access sessionStorage falling back to InMemoryStorage',
err
);
}
// No acceptable storage could be found, returning the InMemoryStorage.
return new InMemoryStorage();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _getStorageImpl() {\n\tif (_storageImpl) {\n\t\treturn _storageImpl;\n\t}\n\n\t_impls.some(function(impl) {\n\t\tif (impl.isAvailable()) {\n\t\t\tvar ctor = impl.StorageInterface;\n\t\t\t_storageImpl = new ctor();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t});\n\n\treturn _storageImpl;\n}",
"getSt... | [
"0.73001933",
"0.7217747",
"0.7106509",
"0.708953",
"0.7034303",
"0.70313287",
"0.6801023",
"0.6793784",
"0.67905945",
"0.6764917",
"0.67363673",
"0.67202085",
"0.66941226",
"0.66817075",
"0.6681604",
"0.6681604",
"0.6677933",
"0.6471737",
"0.6456842",
"0.6394462",
"0.6381311... | 0.80599177 | 0 |
verifies whether the given packageJson dependencies require an update given the deps & devDeps passed in | function requiresAddingOfPackages(packageJsonFile, deps, devDeps) {
let needsDepsUpdate = false;
let needsDevDepsUpdate = false;
packageJsonFile.dependencies = packageJsonFile.dependencies || {};
packageJsonFile.devDependencies = packageJsonFile.devDependencies || {};
if (Object.keys(deps).length > 0) {
needsDepsUpdate = Object.keys(deps).some((entry) => !packageJsonFile.dependencies[entry]);
}
if (Object.keys(devDeps).length > 0) {
needsDevDepsUpdate = Object.keys(devDeps).some((entry) => !packageJsonFile.devDependencies[entry]);
}
return needsDepsUpdate || needsDevDepsUpdate;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function determineDependents({\n releases,\n packagesByName,\n dependencyGraph,\n preInfo,\n config\n}) {\n let updated = false; // NOTE this is intended to be called recursively\n\n let pkgsToSearch = [...releases.values()];\n\n while (pkgsToSearch.length > 0) {\n // nextRelease is our dependency, thin... | [
"0.639414",
"0.6271797",
"0.6222505",
"0.6055485",
"0.6050687",
"0.5780931",
"0.57698435",
"0.5756768",
"0.5727764",
"0.5701409",
"0.5691746",
"0.56767374",
"0.5662534",
"0.56625015",
"0.5588799",
"0.55429953",
"0.5493228",
"0.5476981",
"0.5446969",
"0.5441043",
"0.5437413",
... | 0.79547036 | 0 |
Updates the package.json given the passed deps and/or devDeps. Only updates if the packages are not yet present | function addDepsToPackageJson(deps, devDeps, addInstall = true) {
return (host, context) => {
const currentPackageJson = readJsonInTree(host, 'package.json');
if (requiresAddingOfPackages(currentPackageJson, deps, devDeps)) {
return schematics_1.chain([
updateJsonInTree('package.json', (json, context) => {
json.dependencies = Object.assign(Object.assign(Object.assign({}, (json.dependencies || {})), deps), (json.dependencies || {}));
json.devDependencies = Object.assign(Object.assign(Object.assign({}, (json.devDependencies || {})), devDeps), (json.devDependencies || {}));
json.dependencies = sortObjectByKeys(json.dependencies);
json.devDependencies = sortObjectByKeys(json.devDependencies);
return json;
}),
add_install_task_1.addInstallTask({
skipInstall: !addInstall,
}),
]);
}
else {
return schematics_1.noop();
}
};
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function requiresAddingOfPackages(packageJsonFile, deps, devDeps) {\n let needsDepsUpdate = false;\n let needsDevDepsUpdate = false;\n packageJsonFile.dependencies = packageJsonFile.dependencies || {};\n packageJsonFile.devDependencies = packageJsonFile.devDependencies || {};\n if (Object.keys(deps)... | [
"0.73457325",
"0.6911505",
"0.65562487",
"0.619107",
"0.6153813",
"0.6046005",
"0.5957651",
"0.5914926",
"0.59013903",
"0.5895902",
"0.58865327",
"0.5879123",
"0.5726318",
"0.569718",
"0.56145304",
"0.5594718",
"0.55524945",
"0.5523478",
"0.5501209",
"0.548553",
"0.5478032",
... | 0.74712354 | 0 |
! SCOREBOARD ASSETS This is the function that runs to add scoreboard assets | function addScoreboardAssets(){
manifest.push({src:'assets/scoreboard/bg_scoreboard.png', id:'bgScoreboard'});
manifest.push({src:'assets/scoreboard/icon_replay.png', id:'iconReplay'});
manifest.push({src:'assets/scoreboard/icon_save.png', id:'iconSave'});
manifest.push({src:'assets/scoreboard/icon_scoreboard.png', id:'iconScoreboard'});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function AddAssets()\n{\n\t//Add static background sprites\n\tbackColor = gfx.CreateRectangle(1, 1, 0xfffdad )\n\tgfx.AddGraphic( backColor, 0 , 0 )\n\tgfx.AddSprite( face, 0, 0.886, 1 )\n\tgfx.AddSprite( pasta, 0.85, 0.08, 0.1 )\n\tgfx.AddSprite( pastaIcon, 0.85, 0.08, 0.1 )\n\tgfx.AddSprite( paperIcon, 0.86, 0.1... | [
"0.665967",
"0.618519",
"0.6041548",
"0.5946782",
"0.590872",
"0.58981675",
"0.5803563",
"0.57757103",
"0.5715938",
"0.56942326",
"0.5668764",
"0.5655068",
"0.5628573",
"0.5514279",
"0.5502467",
"0.5500538",
"0.54809815",
"0.5478778",
"0.546091",
"0.54503673",
"0.53984475",
... | 0.7803341 | 0 |
! SCOREBOARD CANVAS This is the function that runs to build scoreboard canvas | function buildScoreBoardCanvas(){
if(!displayScoreBoard){
return;
}
//buttons
resultContainer.removeChild(replayButton);
buttonReplay = new createjs.Bitmap(loader.getResult('iconReplay'));
centerReg(buttonReplay);
createHitarea(buttonReplay);
saveButton = new createjs.Bitmap(loader.getResult('iconSave'));
centerReg(saveButton);
createHitarea(saveButton);
scoreboardButton = new createjs.Bitmap(loader.getResult('iconScoreboard'));
centerReg(scoreboardButton);
createHitarea(scoreboardButton);
resultContainer.addChild(buttonReplay, saveButton, scoreboardButton);
//scoreboard
scoreBoardContainer = new createjs.Container();
bgScoreboard = new createjs.Bitmap(loader.getResult('bgScoreboard'));
scoreTitle = new createjs.Text();
scoreTitle.font = "80px bariol_regularregular";
scoreTitle.color = "#ffffff";
scoreTitle.text = scoreBoardTitle;
scoreTitle.textAlign = "center";
scoreTitle.textBaseline='alphabetic';
scoreTitle.x = canvasW/2;
scoreTitle.y = canvasH/100*14;
scoreBackTxt = new createjs.Text();
scoreBackTxt.font = "50px bariol_regularregular";
scoreBackTxt.color = "#ffffff";
scoreBackTxt.text = scoreBackText;
scoreBackTxt.textAlign = "center";
scoreBackTxt.textBaseline='alphabetic';
scoreBackTxt.x = canvasW/2;
scoreBackTxt.y = canvasH/100*95;
scoreBackTxt.hitArea = new createjs.Shape(new createjs.Graphics().beginFill("#000").drawRect(-200, -30, 400, 40));
scoreBoardContainer.addChild(bgScoreboard, scoreTitle, scoreBackTxt);
var scoreStartY = canvasH/100*23;
var scoreSpanceY = 49.5;
for(scoreNum=0;scoreNum<=10;scoreNum++){
for(scoreColNum=0;scoreColNum<score_arr.length;scoreColNum++){
$.scoreList[scoreNum+'_'+scoreColNum] = new createjs.Text();
$.scoreList[scoreNum+'_'+scoreColNum].font = "35px bariol_regularregular";
$.scoreList[scoreNum+'_'+scoreColNum].color = "#ffffff";
$.scoreList[scoreNum+'_'+scoreColNum].textAlign = score_arr[scoreColNum].align;
$.scoreList[scoreNum+'_'+scoreColNum].textBaseline='alphabetic';
$.scoreList[scoreNum+'_'+scoreColNum].x = canvasW/100 * score_arr[scoreColNum].percentX;
$.scoreList[scoreNum+'_'+scoreColNum].y = scoreStartY;
if(scoreColNum == 0){
//position
$.scoreList[scoreNum+'_'+scoreColNum].text = scoreRank_arr[scoreNum-1];
}
if(scoreNum == 0){
$.scoreList[scoreNum+'_'+scoreColNum].text = score_arr[scoreColNum].col;
}
scoreBoardContainer.addChild($.scoreList[scoreNum+'_'+scoreColNum]);
}
scoreStartY += scoreSpanceY;
}
scoreBoardContainer.visible = false;
canvasContainer.addChild(scoreBoardContainer);
$.get('submit.html', function(data){
$('#canvasHolder').append(data);
buildScoreboardButtons();
toggleSaveButton(true);
resizeScore();
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showScoreBoard() {\n let title = level >= 15 ? 'Congrats, you won!' : 'Ah, you lost!',\n titleX = level >= 15 ? 152 : 220,\n titleY = 280,\n totalScore = level * 60 + GemsCollected.blue * 30 + GemsCollected.green * 40 + GemsCollected.orange * 50,\n scoreB... | [
"0.73607624",
"0.70869297",
"0.70739704",
"0.70584774",
"0.6974996",
"0.6938553",
"0.6934178",
"0.6922656",
"0.6910067",
"0.6897704",
"0.6890096",
"0.68763286",
"0.68348974",
"0.67919546",
"0.6740421",
"0.6738843",
"0.6728717",
"0.6710097",
"0.66862345",
"0.66760695",
"0.6633... | 0.82207555 | 0 |
! SCOREBOARD BUTTONS This is the function that runs to build scoreboard buttons | function buildScoreboardButtons(){
$('#buttonCancel').click(function(){
playSound('soundSelect');
goScorePage('');
});
$('#buttonSubmit').click(function(){
playSound('soundSelect');
var typeString = 'quizgame'
if(categoryPage){
typeString = category_arr[categoryNum];
}
submitUserScore(typeString, playerData.score);
});
scoreBackTxt.cursor = "pointer";
scoreBackTxt.addEventListener("click", function(evt) {
playSound('soundSelect');
goScorePage('');
});
buttonReplay.cursor = "pointer";
buttonReplay.addEventListener("click", function(evt) {
playSound('soundSelect');
if(categoryPage){
goPage('category');
}else{
goPage('game');
}
});
saveButton.cursor = "pointer";
saveButton.addEventListener("click", function(evt) {
playSound('soundSelect');
goScorePage('submit');
});
scoreboardButton.cursor = "pointer";
scoreboardButton.addEventListener("click", function(evt) {
playSound('soundSelect');
goScorePage('scoreboard');
var typeString = 'quizgame'
if(categoryPage){
typeString = category_arr[categoryNum];
}
loadScoreboard(typeString);
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createButtons() {\n // When the A button is pressed, add the current frame\n // from the video with a label of \"rock\" to the classifier\n buttonA = select('#addClassRock');\n buttonA.mousePressed(function() {\n addExample('Rock');\n });\n\n // When the B button is pressed, add the current frame... | [
"0.69475615",
"0.6863367",
"0.6840834",
"0.6805191",
"0.68026936",
"0.67381406",
"0.672422",
"0.6720168",
"0.6617027",
"0.6563274",
"0.65039325",
"0.64585024",
"0.64482474",
"0.64416",
"0.64400285",
"0.64362717",
"0.64337057",
"0.6413039",
"0.6410319",
"0.63975495",
"0.638806... | 0.80036443 | 0 |
! RESIZE SCORE This is the function that runs to resize score | function resizeScore(){
$('.fontLink').each(function(index, element) {
$(this).css('font-size', Math.round(Number($(this).attr('data-fontsize'))*scalePercent));
});
$('#scoreHolder').css('width',stageW*scalePercent);
$('#scoreHolder').css('height',stageH*scalePercent);
$('#scoreHolder').css('left', (offset.left/2));
$('#scoreHolder').css('top', (offset.top/2));
$('#scoreHolder .scoreInnerContent').css('width',contentW*scalePercent);
$('#scoreHolder .scoreInnerContent').css('height',contentH*scalePercent);
var spaceTop = (stageH - contentH)/2;
var spaceLeft = (stageW - contentW)/2;
$('#scoreHolder .scoreInnerContent').css('left', spaceLeft*scalePercent);
$('#scoreHolder .scoreInnerContent').css('top', spaceTop*scalePercent);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score... | [
"0.6918159",
"0.66235214",
"0.6431632",
"0.6410671",
"0.63819176",
"0.6295828",
"0.6294661",
"0.62264955",
"0.6119847",
"0.6098467",
"0.60890585",
"0.6087336",
"0.60847205",
"0.6015591",
"0.600963",
"0.59730434",
"0.59582454",
"0.595048",
"0.5935952",
"0.5930025",
"0.59141195... | 0.75561607 | 0 |
sensei: pjfranzini Write a function that accepts a square matrix (N x N 2D array) and returns the determinant of the matrix. How to take the determinant of a matrix it is simplest to start with the smallest cases: A 1x1 matrix |a| has determinant a. A 2x2 matrix [ [a, b], [c, d] ] or |a b| |c d| has determinant: ad bc. The determinant of an n x n sized matrix is calculated by reducing the problem to the calculation of the determinants of n matrices ofn1 x n1 size. For the 3x3 case, [ [a, b, c], [d, e, f], [g, h, i] ] or |a b c| |d e f| |g h i| the determinant is: a det(a_minor) b det(b_minor) + c det(c_minor) where det(a_minor) refers to taking the determinant of the 2x2 matrix created by crossing out the row and column in which the element a occurs: | | | e f| | h i| Note the alternation of signs. The determinant of larger matrices are calculated analogously, e.g. if M is a 4x4 matrix with first row [a, b, c, d], then: det(M) = a det(a_minor) b det(b_minor) + c det(c_minor) d det(d_minor) | function determinant(m) {
switch (m.length) {
//handles empty matrix
case 0: return 1;
//exit condition && handles singleton matrix
case 1: return m[0][0];
default:
//detrmnnt will build array of terms to be combined into determinant
//ex. a*det(a_minor) - b*det(b_minor)...
let detrmnnt = []
//pos controls alternation of terms ('+' or '-')
for (let i = 0, pos = 1; i < m.length; i++, pos *= -1) {
//adds term, ex. +/- a * det(a_minor)
detrmnnt.push(pos * (m[0][i] * determinant(nMinor(m, i))))
}
return detrmnnt.reduce((accu, elem) => accu + elem)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function determinant(m) {\n if (m.length == 1)\n return m[0][0];\n function calc(matrix) {\n if (matrix.length == 2)\n return matrix[0][0] * matrix[1][1] - matrix[1][0] * matrix[0][1];\n let res = 0, sign = 1;\n for (let i = 0; i < matrix[0].length; i++) {\n ... | [
"0.74909025",
"0.73743075",
"0.7320607",
"0.7210089",
"0.7180129",
"0.7121054",
"0.7027388",
"0.6933576",
"0.67923373",
"0.67677796",
"0.6689784",
"0.61586154",
"0.60582674",
"0.59964216",
"0.597575",
"0.59676594",
"0.5915091",
"0.5856863",
"0.581085",
"0.58018345",
"0.571447... | 0.75930524 | 0 |
functions creates n_minor from m | function nMinor (m, n) {
let minor = []
//h = 1 to skip first row of matrix
for (let h = 1; h < m.length; h++) {
minor.push(m[h].filter((el, it) => it !== n))
}
return minor
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function minor2x2() {\r\n if (selection_text_misc_2x2.textContent == \"Inverse\" || selection_text_misc_2x2.textContent == \"Co-factor\" || selection_text_misc_2x2.textContent == \"Adjoint\") {\r\n minor_array.push(Number(misc_array_1[3]));\r\n minor_array.push(Number(misc_array_1[2]))... | [
"0.6104964",
"0.6036262",
"0.5782669",
"0.57583183",
"0.5351479",
"0.53313696",
"0.53313696",
"0.53313696",
"0.5235025",
"0.5235025",
"0.50572795",
"0.5027724",
"0.50156075",
"0.4935707",
"0.48972484",
"0.488601",
"0.48772857",
"0.47691962",
"0.4761753",
"0.47323486",
"0.4722... | 0.69566524 | 0 |
function prevents the localstorage being reset from var highScores = []; that was declared in the beginning | function getHighScores () {
var getPastScores = localStorage.getItem("highscore");
if (getPastScores === null) {
highScores = [];
} else {
highScores = JSON.parse(localStorage.getItem("highscore"));
};
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function storedHighs() {\n localStorage.setItem(\"Scores\", JSON.stringify(highs));\n }",
"function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n var allScores = localStorage.getItem(\"allScores\");\nallScores = JSON.parse(allScores);... | [
"0.8045468",
"0.8006161",
"0.797451",
"0.7972429",
"0.79716206",
"0.7776171",
"0.7736761",
"0.7723185",
"0.7712638",
"0.77111447",
"0.7690294",
"0.7683815",
"0.76812947",
"0.767065",
"0.7668651",
"0.762816",
"0.7620422",
"0.7620355",
"0.76109535",
"0.76096016",
"0.7598561",
... | 0.8064676 | 0 |
Given a node it returns the Microsoft Word list level, returning undefined for an item that isn't a MS Word list node | function getMsWordListLevel (node) {
if (node.nodeName.toLowerCase() !== 'p') {
return
}
const style = node.getAttribute('style')
const levelMatch = style && style.match(/mso-list/i) ? style.match(/level(\d+)/) : null
return levelMatch ? parseInt(levelMatch[1], 10) : undefined
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getLevel(node){\n\tif(node.properties.hasOwnProperty(\"Level\")){\n\t\treturn node.properties.Level;\n\t}else{\n\t\treturn -1;\n\t}\n}",
"function getFakeBulletText(node, levels) {\n // Word uses the following format for their bullets:\n // <p style=\"mso-list:l1 level1 lfo2\">\n // <s... | [
"0.6671859",
"0.6670137",
"0.63771504",
"0.621316",
"0.61555356",
"0.57949203",
"0.57655865",
"0.57128376",
"0.5696541",
"0.5672241",
"0.5568159",
"0.5547469",
"0.55358106",
"0.55073684",
"0.5431245",
"0.5384732",
"0.5379493",
"0.53498167",
"0.5301591",
"0.5284614",
"0.526821... | 0.84267855 | 0 |
Based on a node that is a list item in a MS Word document, this returns the marker for the list. | function msWordListMarker (node, bulletListMarker) {
const markerElement = node.querySelector('span[style="mso-list:Ignore"]')
// assume the presence of a period in a marker is an indicator of an
// ordered list
if (!markerElement || !markerElement.textContent.match(/\./)) {
return bulletListMarker
}
const nodeLevel = getMsWordListLevel(node)
let item = 1
let potentialListItem = node.previousElementSibling
// loop through previous siblings to count list items
while (potentialListItem) {
const itemLevel = getMsWordListLevel(potentialListItem)
// if there are no more list items or we encounter the lists parent
// we don't need to count further
if (!itemLevel || itemLevel < nodeLevel) {
break
}
// if on same level increment the list items
if (nodeLevel === itemLevel) {
item += 1
}
potentialListItem = potentialListItem.previousElementSibling
}
return `${item}.`
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getListItemMetadata(node) {\n if (node.nodeType == 1 /* Element */) {\n var listatt = getStyleValue(node, MSO_LIST_STYLE_NAME);\n if (listatt && listatt.length > 0) {\n try {\n // Word mso-list property holds 3 space separated values in the following format: lst1... | [
"0.6383941",
"0.5983728",
"0.5825579",
"0.57465446",
"0.56685364",
"0.5611878",
"0.55966437",
"0.54887724",
"0.5485846",
"0.5417776",
"0.54173636",
"0.541471",
"0.54123527",
"0.54061615",
"0.54061615",
"0.54061615",
"0.54061615",
"0.54061615",
"0.54061615",
"0.54061615",
"0.5... | 0.7593762 | 0 |
Scroll to Our STORY | function scrollToStory()
{
storyText.scrollIntoView();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function work() {\n var scrollPos = $(\".case-studies\").offset().top - 80;\n TweenLite.to(window, 2, {scrollTo: {y: scrollPos}, ease: Power2.easeOut});\n }",
"function goToWidget(id) {\n document.getElementById(id).scrollIntoView({\n behavior: 'smooth'\n });\n ... | [
"0.6868092",
"0.66545063",
"0.6495838",
"0.64606917",
"0.64475346",
"0.64205945",
"0.64086664",
"0.63724476",
"0.63724476",
"0.6349916",
"0.63439167",
"0.63286847",
"0.63221884",
"0.63221884",
"0.63221884",
"0.63145316",
"0.63108826",
"0.6302561",
"0.63000506",
"0.6259576",
"... | 0.76658046 | 0 |
aborts the execution with the specified error message | function abort(message) {
util.error(message);
process.exit(1);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"abort() {\n }",
"abort () {\n // ...\n }",
"function abort(what) {\n if (Module['onAbort']) {\n Module['onAbort'](what);\n }\n\n what += '';\n out(what);\n err(what);\n\n ABORT = true;\n EXITSTATUS = 1;\n\n var output = 'abort(' + what + ') at ' + stackTrace();\n what = output;\n\n // T... | [
"0.73568654",
"0.7273281",
"0.66536456",
"0.6487658",
"0.64087343",
"0.64084333",
"0.64084333",
"0.6369309",
"0.6358718",
"0.63555205",
"0.6352029",
"0.6352029",
"0.6335197",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655",
"0.6332655... | 0.7767521 | 0 |
align modifiers like time signature for vertical staves with different key signatures / time signature xs This method should be static, but that makes using it with `any` usage more difficult. | formatBegModifiers(staves) {
let maxX = 0;
// align note start
staves.forEach((stave) => {
if (stave.getNoteStartX() > maxX) maxX = stave.getNoteStartX();
});
staves.forEach((stave) => {
stave.setNoteStartX(maxX);
});
maxX = 0;
// align REPEAT_BEGIN
staves.forEach((stave) => {
const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, Barline.CATEGORY);
modifiers.forEach((modifier) => {
if (modifier.getType() == Barline.type.REPEAT_BEGIN)
if (modifier.getX() > maxX) maxX = modifier.getX();
});
});
staves.forEach((stave) => {
const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, Barline.CATEGORY);
modifiers.forEach((modifier) => {
if (modifier.getType() == Barline.type.REPEAT_BEGIN) modifier.setX(maxX);
});
});
maxX = 0;
// Align time signatures
staves.forEach((stave) => {
const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, TimeSignature.CATEGORY);
modifiers.forEach((modifier) => {
if (modifier.getX() > maxX) maxX = modifier.getX();
});
});
staves.forEach((stave) => {
const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, TimeSignature.CATEGORY);
modifiers.forEach((modifier) => {
modifier.setX(maxX);
});
});
// Align key signatures
// staves.forEach((stave) => {
// const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, KeySignature.CATEGORY);
// modifiers.forEach((modifier) => {
// if (modifier.getX() > maxX) maxX = modifier.getX();
// });
// });
// staves.forEach((stave) => {
// const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, KeySignature.CATEGORY);
// modifiers.forEach((modifier) => {
// modifier.setX(maxX);
// });
// });
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"set alignment(value) {}",
"get alignment() {}",
"function parseAlign(alignSpec) {\n const parts = alignSpecRe.exec(alignSpec),\n myOffset = parseInt(parts[2] || 50),\n targetOffset = parseInt(parts[4] || 50); // Comments assume the Menu's alignSpec of l0-r0 is used.\n\n return {\n myAlignmen... | [
"0.58732045",
"0.53072876",
"0.51479733",
"0.5048906",
"0.5013621",
"0.49928164",
"0.49863285",
"0.4961542",
"0.49455246",
"0.49009168",
"0.48984364",
"0.48505536",
"0.4820889",
"0.48134044",
"0.47912028",
"0.47906253",
"0.47906253",
"0.47906253",
"0.47906253",
"0.47906253",
... | 0.68977565 | 0 |
This returns the y for the center of a staff line | getYForLine(line) {
const options = this.options;
const spacing = options.spacing_between_lines_px;
const headroom = options.space_above_staff_ln;
const y = this.y + (line * spacing) + (headroom * spacing);
return y;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_line_y(c) {\n\treturn 94 + c * 75;\n}",
"function getCenterY()/*:Number*/ {\n return this.getUpperY() + this.getMyHeight() / 2;\n }",
"function get_point_y(c) {\n\treturn 94 + c * 75;\n}",
"function getOriginY() {\n\t\treturn Math.min(this.originY, this.finalY);\n\t}",
"function d4_svg_lin... | [
"0.73848116",
"0.72168785",
"0.700793",
"0.6577882",
"0.6486009",
"0.6479815",
"0.6423857",
"0.6405464",
"0.6405464",
"0.6405464",
"0.63861865",
"0.63235414",
"0.63163394",
"0.6313648",
"0.62426716",
"0.6235886",
"0.62303513",
"0.62129",
"0.6207007",
"0.6193924",
"0.61735964"... | 0.7668172 | 0 |
delete transaction by id | function deleteTransactionById(_id) {
return TransactionModel.deleteOne({ _id }).exec();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteTransaction(id) {\n transaction.deleteTransaction(id)\n .then(res => loadTransactions())\n .catch(err => console.log(err));\n }",
"function deleteTransaction(id) {\n transactions = transactions.filter( transaction => transaction.id != id );\n init();\n}",
"function deleteTran... | [
"0.87048256",
"0.83477056",
"0.8138373",
"0.8123875",
"0.8030812",
"0.79025096",
"0.789536",
"0.77007",
"0.7653753",
"0.73849493",
"0.7232468",
"0.722017",
"0.70500445",
"0.704107",
"0.6940432",
"0.6928991",
"0.6897247",
"0.67960155",
"0.67626005",
"0.6711767",
"0.6695826",
... | 0.8468602 | 1 |
delete all transaction that relate to customer by customer id | function deleteAllTransactionsByCustomerId(customer_id) {
return TransactionModel.deleteMany({ customer_id }).exec();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteTransaction(id) {\n transactions = transactions.filter( transaction => transaction.id != id );\n init();\n}",
"async function clearCustomers() {\n try {\n const { result : { customers } } = await customersApi.listCustomers();\n if (customers) {\n for (const key in customers) {\n ... | [
"0.6873459",
"0.66026664",
"0.65450925",
"0.6539166",
"0.64093316",
"0.63606864",
"0.6349919",
"0.62439823",
"0.6242813",
"0.6217943",
"0.62073547",
"0.6166351",
"0.6119943",
"0.60789025",
"0.602603",
"0.6015245",
"0.5917384",
"0.58527005",
"0.5841049",
"0.5835707",
"0.581489... | 0.8589326 | 0 |
Creates a Constructor for an Immutable object from a schema. | function Immutable (originalSchema) {
var schema = {}, blueprint, prop, propCtor;
if (!originalSchema) {
return new InvalidArgumentException(new Error('A schema object, and values are required'));
}
// Convert any objects that aren't validatable by Blueprint into Immutables
for (prop in originalSchema) {
if (!originalSchema.hasOwnProperty(prop)) {
continue;
} else if (prop === '__skipValidation') {
continue;
} else if (prop === '__skipValdation') {
schema.__skipValidation = originalSchema.skipValdation;
}
if (
is.object(originalSchema[prop]) &&
!Blueprint.isValidatableProperty(originalSchema[prop]) &&
!originalSchema[prop].__immutableCtor
) {
schema[prop] = new Immutable(originalSchema[prop]);
} else {
schema[prop] = originalSchema[prop];
}
if (schema[prop].__immutableCtor) {
// Add access to the Immutable on the Parent Immutable
propCtor = prop.substring(0,1).toUpperCase() + prop.substring(1);
Constructor[propCtor] = schema[prop];
}
}
// This is the blueprint that the Immutable will be validated against
blueprint = new Blueprint(schema);
/*
// The Constructor is returned by this Immutable function. Callers can
// then use it to create new instances of objects that they expect to
// meet the schema, set forth by this Immutable.
*/
function Constructor (values) {
var propName,
// we return self - it will provide access to the getters and setters
self = {};
values = values || {};
if (
// you can override initial validation by setting
// `schema.__skipValidation: true`
originalSchema.__skipValidation !== true &&
!Blueprint.validate(blueprint, values).result
) {
var err = new InvalidArgumentException(
new Error(locale.errors.initialValidationFailed),
Blueprint.validate(blueprint, values).errors
);
config.onError(err);
return err;
}
try {
// Enumerate the schema, and create immutable properties
for (propName in schema) {
if (!schema.hasOwnProperty(propName)) {
continue;
} else if (propName === '__blueprintId') {
continue;
}
if (is.nullOrUndefined(values[propName])) {
makeReadOnlyNullProperty(self, propName);
continue;
}
makeImmutableProperty(self, schema, values, propName);
}
Object.freeze(self);
} catch (e) {
return new InvalidArgumentException(e);
}
return self;
} // /Constructor
/*
// Makes a new Immutable from an existing Immutable, replacing
// values with the properties in the mergeVals argument
// @param from: The Immutable to copy
// @param mergeVals: The new values to overwrite as we copy
*/
setReadOnlyProp(Constructor, 'merge', function (from, mergeVals, callback) {
if (typeof callback === 'function') {
async.runAsync(function () {
merge(Constructor, from, mergeVals, callback);
});
} else {
var output;
merge(Constructor, from, mergeVals, function (err, merged) {
output = err || merged;
});
return output;
}
});
/*
// Copies the values of an Immutable to a plain JS Object
// @param from: The Immutable to copy
*/
setReadOnlyProp(Constructor, 'toObject', function (from, callback) {
return objectHelper.cloneObject(from, true, callback);
});
/*
// Validates an instance of an Immutable against it's schema
// @param instance: The instance that is being validated
*/
setReadOnlyProp(Constructor, 'validate', function (instance, callback) {
return Blueprint.validate(blueprint, instance, callback);
});
/*
// Validates an instance of an Immutable against it's schema
// @param instance: The instance that is being validated
*/
setReadOnlyProp(Constructor, 'validateProperty', function (instance, propertyName, callback) {
if (!instance && is.function(callback)) {
callback([locale.errors.validatePropertyInvalidArgs], false);
} else if (!instance) {
return {
errors: [locale.errors.validatePropertyInvalidArgs],
result: false
};
}
return Blueprint.validateProperty(blueprint, propertyName, instance[propertyName], callback);
});
/*
// Prints an immutable to the console, in a more readable way
// @param instance: The Immutable to print
*/
setReadOnlyProp(Constructor, 'log', function (instance) {
if (!instance) {
console.log(null);
} else {
console.log(Constructor.toObject(instance));
}
});
/*
// Returns a copy of the original schema
*/
setReadOnlyProp(Constructor, 'getSchema', function (callback) {
return objectHelper.cloneObject(originalSchema, true, callback);
});
/*
// Returns a this Immutable's blueprint
*/
setReadOnlyProp(Constructor, 'blueprint', blueprint);
setReadOnlyProp(Constructor, '__immutableCtor', true);
return Constructor;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Constructor (values) {\n var propName,\n // we return self - it will provide access to the getters and setters\n self = {};\n\n values = values || {};\n\n if (\n // you can override initial validation by ... | [
"0.64946556",
"0.6098677",
"0.6028341",
"0.6028341",
"0.5984513",
"0.5890175",
"0.5673409",
"0.5543228",
"0.5372351",
"0.5367328",
"0.5352167",
"0.5319163",
"0.52733094",
"0.5245628",
"0.5244429",
"0.52235764",
"0.52235764",
"0.519638",
"0.5193204",
"0.51500684",
"0.51453054"... | 0.67670506 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.