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 |
|---|---|---|---|---|---|---|
Apply border style to a selection. | function d3c_applyBorderStyle(selection, borderOpts, fillOpts, chartContext, functor) {
if (fillOpts.fill || fillOpts.fillOpacity || fillOpts.fillOpacity === 0) {
borderOpts = borderOpts || {};
if (borderOpts.enabled === false) {
delete borderOpts.stroke;
delete borderOpts.st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addBorder(event){\r\n\tthis.style['border'] = \"5px solid red\";\r\n\tthis.style['margin'] = \"-5px, 0px\";\r\n}",
"setBorder() {\n this.removeBorder();\n if (this.currentElement !== null){\n this.currentElement.style.border = \"1.5px solid blue\";\n }\n }",
"function populateBorderStyl... | [
"0.6290394",
"0.61496055",
"0.6061748",
"0.6012238",
"0.588044",
"0.57990295",
"0.5781738",
"0.5763865",
"0.5734291",
"0.5704978",
"0.569994",
"0.5683403",
"0.5664563",
"0.56530666",
"0.55941635",
"0.55941635",
"0.5556598",
"0.5548204",
"0.55384976",
"0.55255806",
"0.55189854... | 0.62093174 | 1 |
Apply font style to selection. | function d3c_applyFontStyle(selection, fontStyleOpts, chartContext, functor) {
fontStyleOpts = functor ? functor.apply(selection, [fontStyleOpts, chartContext]) : fontStyleOpts;
selection.style(d3c_adaptFontStyle.call(selection, fontStyleOpts, chartContext));
return selection;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"applyFont() {\n this.p.currentRenderer.textFont(this.textFontArgument);\n }",
"function changeFont() {\r\n\t\tvar font = this.value;\r\n\t\tvar text = document.getElementById(\"doc\");\r\n\t\ttext.style.fontFamily = font;\r\n\t}",
"function setFont(font) {\n $('#fontSelect')[0].selectedIndex=fonts[... | [
"0.7002148",
"0.64941114",
"0.6447857",
"0.6332898",
"0.6293721",
"0.62464476",
"0.6191336",
"0.6170347",
"0.61611545",
"0.6032179",
"0.60184366",
"0.60082424",
"0.5970239",
"0.59496456",
"0.59394944",
"0.5888797",
"0.5883591",
"0.5842722",
"0.5820067",
"0.57656467",
"0.57584... | 0.76308787 | 0 |
Convert margin option to standard format, the returned margin option contains top&right&bottom&left. | function d3c_adaptMargin(margin) {
if (typeof margin === 'string') {
var values = margin.split(/ /g);
switch (values.length) {
case 1:
return {
top : values[0],
right : values[0],
bottom : values[0],
left : values[0]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"margins() {\n const axis = this.axisSpec()\n const noXAxis = axis?.x?.label === undefined\n const noYAxis = axis?.y?.label === undefined\n\n const top = MARGIN / 2.0\n const right = MARGIN / 2.0\n const bottom = MARGIN + (noXAxis ? 0 : X_AXIS_LABEL_WIDTH)\n const le... | [
"0.623237",
"0.615841",
"0.588908",
"0.57011443",
"0.549844",
"0.5474689",
"0.53411114",
"0.5314657",
"0.5297987",
"0.5230022",
"0.519404",
"0.5175708",
"0.51432866",
"0.5123668",
"0.5106848",
"0.50979877",
"0.508051",
"0.50670797",
"0.50670797",
"0.50657237",
"0.5041467",
... | 0.70690435 | 0 |
Add margin's settings to a bbox object. | function d3c_plusOfMargin2BBox(bbox, margin) {
var m = d3c_adaptMargin(margin),
b = d3c_copy(bbox);
b.y += m.top;
b.x += m.left;
b.width += m.left + m.right;
b.height += m.top + m.bottom;
return b;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addMargins() {\n\t// To Be Decided\n}",
"function setupBodyMarginValues() {\n if (\n 'number' ===\n typeof (settings[iframeId] && settings[iframeId].bodyMargin) ||\n '0' === (settings[iframeId] && settings[iframeId].bodyMargin)\n ) {\n settings[iframeId].bodyMargi... | [
"0.60032463",
"0.5649063",
"0.5646971",
"0.55721956",
"0.5379397",
"0.5379397",
"0.5376866",
"0.53544366",
"0.5352085",
"0.533894",
"0.52703595",
"0.5236079",
"0.52070934",
"0.51986754",
"0.51716375",
"0.5122736",
"0.51208496",
"0.5077492",
"0.5066704",
"0.50574726",
"0.50540... | 0.685878 | 0 |
Return min and max of specified property in data set. | function d3c_getValuesMinMax(data, prop) {
var arr = d3c_seriesValues(data, prop);
return arr ? d3.extent(arr) : false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get_max_min(values ,max_min_val){\n for(var i = 0; i<values.length; i++){\n if(max_min_val.max < values[i])\n max_min_val.max = values[i]\n if(max_min_val.min > values[i])\n max_min_val.min = values[i]\n }\n }",
"function getMinMax(fil... | [
"0.7004767",
"0.6523902",
"0.6430364",
"0.63970166",
"0.6365636",
"0.63407254",
"0.63299453",
"0.6329646",
"0.6305636",
"0.62951446",
"0.6288829",
"0.6272469",
"0.6266528",
"0.6214997",
"0.6158161",
"0.6124909",
"0.6116916",
"0.6080005",
"0.6051578",
"0.6031844",
"0.6030209",... | 0.67425615 | 1 |
Create series instance according to series type. | function d3c_createSeries(eContainer, chartContext, serieOpts) {
return SERIES_CREATOR_SET[serieOpts.type] && SERIES_CREATOR_SET[serieOpts.type].call(this, eContainer, chartContext, serieOpts);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createSeries(FCtype, color, type, name, yAxis, showvalue, linecolor, linethickness, marker) {\n return {\n data: [],\n FCtype: FCtype,\n color: color,\n type: type,\n name: name ? name: ' ',\n yAxis: yAxis... | [
"0.7052599",
"0.6333199",
"0.62202305",
"0.61998665",
"0.61804247",
"0.61195517",
"0.5839617",
"0.5694161",
"0.5678828",
"0.5654627",
"0.55848736",
"0.5574728",
"0.5551768",
"0.5524988",
"0.54623514",
"0.54556704",
"0.5405872",
"0.53895015",
"0.5352996",
"0.52997476",
"0.5268... | 0.6842957 | 1 |
Create a d3c path object, call push function to add paths, and call toString function return entire path string. | function d3c_path() {
var paths = [], i = 0;
function path() {
return path.toString();
}
path.push = function (_type, coordinates) {
paths.push(_type);
i = 1;
while (i < arguments.length) {
paths.push(arguments[i]);
i++;
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makeD3Path(path) {\n var p = d3.path();\n p.moveTo(1000*path[0][0], 1000*path[0][1]);\n for (var i = 1; i < path.length; i++) {\n p.lineTo(1000*path[i][0], 1000*path[i][1]);\n }\n return p.toString();\n}",
"function makeD3Path(path) {\n var p = d3.path();\n p.moveTo(1000*path... | [
"0.6896569",
"0.6896569",
"0.63721263",
"0.6357627",
"0.61853844",
"0.60292506",
"0.59606755",
"0.5883242",
"0.57957685",
"0.5762199",
"0.5751539",
"0.57101685",
"0.56912833",
"0.5665363",
"0.5631017",
"0.5628678",
"0.56036085",
"0.5586801",
"0.5575717",
"0.5558512",
"0.55521... | 0.78230286 | 0 |
Create a d3c symbol object | function d3c_symbol() {
var s = d3.svg.symbol();
function symbol() {
return s();
}
symbol.type = function () {
if (!arguments.length) {
return s.type();
} else {
s.type(arguments[0]);
}
return symbol;
};
symbol.size =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function c$u(o,e,t,i){const m=h$r[o.type]&&h$r[o.type][e.type]||l$E[e.type];return m?new m(o,e,t,i):(s$4g.getLogger(\"esri.views.3d.layers.graphics.Graphics3DSymbolLayerFactory\").error(\"GraphicsLayerFactory#make\",`unknown symbol type ${e.type}`),null)}",
"function customSymbol3D(name) {\nreturn {\ntype: \"web... | [
"0.67624116",
"0.669231",
"0.6532108",
"0.6532108",
"0.6532108",
"0.62962246",
"0.62739843",
"0.6209547",
"0.61770946",
"0.61541766",
"0.6085589",
"0.6053628",
"0.6053628",
"0.6053628",
"0.604973",
"0.6042498",
"0.6019867",
"0.59134144",
"0.58755445",
"0.5861942",
"0.5818113"... | 0.8389754 | 0 |
Calculate proper scale domain according to specified values. | function d3c_calculateScaleDomain(axisOpts, rangesOpts, values) {
function getScale(_v) {
var t = Math.abs(_v), i = -1;
if (t === 1) {
return 0;
} else if (t > 1) {
while (t > 1) {
t = t / 10;
i++;
}
return Math.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function scale() {\n\tvar domain = [];\n\tvar range = [];\n\n\tvar _scale = function _scale(x) {\n\t\tif (domain.length < 2) {\n\t\t\treturn _scale;\n\t\t}\n\t\tif (range.length < 2) {\n\t\t\treturn _scale;\n\t\t}\n\n\t\tx = Math.max(x, domain.min);\n\t\tx = Math.min(x, domain.max);\n\t\tvar x2 = distance(domain[0... | [
"0.7484674",
"0.7083391",
"0.6838889",
"0.6625036",
"0.66148555",
"0.6583248",
"0.6542994",
"0.65180206",
"0.65139025",
"0.6490478",
"0.6477137",
"0.64756936",
"0.6467508",
"0.6440571",
"0.6401633",
"0.63851684",
"0.63580763",
"0.63580763",
"0.6348958",
"0.6328932",
"0.630281... | 0.7732126 | 0 |
Checking Link URL Types in case to use suitable TYPE modules like TYEP_WEBVIDEO or TYPE_RSS | function checkLinkType(link,_stored_session_id){
var header ;
var pattern_youtube = /^(https?\:\/\/)?\w{0,3}.?youtube+\.\w{2,3}\/.*[\?|\&]v=([\w-]{11})/
var pattern_url_1 = /^(http(s)?\:\/\/)?([\w-]+\.)+[\w-]+(\/[\w- 0-9./?%&=]*)?/
var pattern_url_2 = /^([https|http]?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"checkLinkType() {\n /* As comments are the only thing implemented for now let's ignore the rest\n TODO : \n - Implement users when on other sites\n - Implement discussions (couldn't get discussion embed code from reddit when I tried (bug?))\n - Improve link detection for comments... | [
"0.7500601",
"0.6826081",
"0.67814684",
"0.6374825",
"0.6354873",
"0.6311554",
"0.62720376",
"0.62146926",
"0.61904293",
"0.61211824",
"0.5962467",
"0.5961198",
"0.5954022",
"0.5891426",
"0.58584064",
"0.5850133",
"0.5750209",
"0.5703951",
"0.5688182",
"0.56539637",
"0.563818... | 0.70638895 | 1 |
Read employee List & Update the table | function updateTable() {
$.get("/EmployeeList", function (data) {
table.clear();
$.each(data, function (i, employee) {
table.row.add(createRow(employee)).draw();
});
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setEmployees() {\n\tlet csvData = readCsv(EMPLOYEE_FILE);\n\tfor(var i = 0; i < csvData.length; i++) {\n\t\temployees.push({\n\t\t\tid: csvData[i][0],\n\t\t\tfirstName: csvData[i][1],\n\t\t\tlastName: csvData[i][2],\n\t\t\temail: csvData[i][3],\n\t\t\thourlyWage: Number(csvData[i][4])\n\t\t});\n\t}\n}",
... | [
"0.69878566",
"0.640689",
"0.61240506",
"0.60812277",
"0.6056573",
"0.60395277",
"0.6029925",
"0.6023429",
"0.5938678",
"0.58981496",
"0.58025557",
"0.5800316",
"0.57981044",
"0.5790517",
"0.57899755",
"0.5780117",
"0.5766204",
"0.5730823",
"0.5728666",
"0.5724786",
"0.572429... | 0.71291494 | 0 |
Set Form in New Employee Mode | function newEmployee() {
$('#EmployeeForm').trigger('reset');
$('#action').val('Afegir');
$('#formType').html('Afegir nou');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function newEmp() {\n inquirer.prompt(newEmpPrompt).then((answers) => {\n switch (answers.employeeType) {\n case \"Add an Engineer.\":\n newEngineer();\n break;\n case \"Add an Intern.\":\n newIntern();\n break;\n ... | [
"0.6382293",
"0.62456995",
"0.61425257",
"0.6139634",
"0.61031485",
"0.606032",
"0.6040439",
"0.6037591",
"0.60047966",
"0.6002294",
"0.60009474",
"0.5994242",
"0.5970164",
"0.5960093",
"0.5958178",
"0.5955656",
"0.5941973",
"0.5918274",
"0.5918274",
"0.5917331",
"0.59028155"... | 0.75991553 | 0 |
Take the enum codes for Employee Jobs. | function getJobCode(job) {
if (job == 'Director de projectes') {
return 'Director_Projectes';
} if (job == 'Programador Senior') {
return 'Programador_Senior';
} if (job == 'Programador Mid-Level') {
return 'Programador_Mid';
} if (job == 'Programador Junior') {
return 'Programador_Junior';
} if (job == 'A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getStandardJobCodes() {\n return standardJobCodeArray;\n }",
"static PriorityEnum() {\n return Joi.string().valid(\n \"low\",\n\n \"medium\",\n\n \"high\",\n\n \"urgent\"\n );\n }",
"function getJobButtonType (status) {\n for (let i = 0 ; i < job_status.length;i... | [
"0.61442834",
"0.5616376",
"0.51452863",
"0.5046524",
"0.50086725",
"0.49794012",
"0.49376157",
"0.49046147",
"0.48644155",
"0.48322615",
"0.48265997",
"0.4776348",
"0.47502354",
"0.47439152",
"0.4735838",
"0.47130978",
"0.46832913",
"0.46832913",
"0.46832913",
"0.46832913",
... | 0.6314658 | 0 |
Unmounts the overlay and its container | _unmountOverlay() {
React.unmountComponentAtNode(this[$OVERLAY_CONTAINER_PROP]);
this[$OVERLAY_CONTAINER_INSTANCE_PROP] = null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"unmountOverlay() {\n this.appendToIndex(this.$node, this.$overlayWrapper.parent(), this.originalNodeIndex)\n this.$overlayWrapper.remove()\n this.originalNodeIndex = 0\n }",
"_detachOverlay() {\n if (this._overlayRef) {\n this._overlayRef.detach();\n }\n th... | [
"0.81664586",
"0.72029185",
"0.72029185",
"0.72029185",
"0.72029185",
"0.6907111",
"0.6824765",
"0.6823292",
"0.68010813",
"0.6784492",
"0.6784492",
"0.6784492",
"0.6784492",
"0.6751797",
"0.6693458",
"0.6693045",
"0.66848546",
"0.6608945",
"0.65740895",
"0.65668166",
"0.6561... | 0.8329872 | 0 |
create the doot message and update the o count in the database | async function doot(){
const settingsRef = db.collection('dootbot').doc('settings')
try {
await db.runTransaction(async (t) => {
const settings = await t.get(settingsRef);
countDoot = settings.data().countDoot + 1;
if (countDoot === 200){countDoot = 2;}
t.update(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateMessage() {\n getMessages().then(messages => {\n messages.rows.forEach(row => {\n let doc = row.doc;\n doc.sincronizado = true;\n db.put(doc);\n });\n });\n}",
"static updateMessageOnResponse(message){\n let messageObj;\n repository.write(() => {\n m... | [
"0.59884363",
"0.5865939",
"0.5818244",
"0.5808565",
"0.5748888",
"0.5694655",
"0.56686604",
"0.56024086",
"0.54535884",
"0.54494536",
"0.54447204",
"0.5443568",
"0.54137474",
"0.54070777",
"0.5397488",
"0.5359817",
"0.5359531",
"0.52794313",
"0.5275046",
"0.52667934",
"0.526... | 0.62832725 | 0 |
REMOVE BUSINESS AREA FROM THE SELECTED BUSINESS LIST: | function Remove_BusinessAreas()
{
var strHtml = "";
var lstSelectedBusinessList = document.getElementById("lstSelectedBusinessList");
/*
CHECK THE SELECTED BUSINESS LIST IS EMPTY OR NOT:
*/
if(lstSelectedBusinessList.length > 0)
{
/*
CHECK THE BUSINESS IS SELECTED IN THE LIST OR NOT:
*/
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function rmSubjFromSubjLst( itemValue ){\n \n let selectedItem = -1;\n Array.from(scene_subjects.options).forEach(function (item,index){\n if (item.value == itemValue)\n selectedItem = index;\n });\n\n if (selectedItem != -1)\n scene_subjects.options[selectedItem].remove();\n\n \n\n}",
"... | [
"0.64023197",
"0.6279473",
"0.5979866",
"0.59150064",
"0.5891692",
"0.5882989",
"0.5877764",
"0.5872041",
"0.58602345",
"0.5843584",
"0.5835091",
"0.58350873",
"0.5821134",
"0.5803125",
"0.5781319",
"0.5781311",
"0.57721674",
"0.57718074",
"0.5768751",
"0.57652676",
"0.576282... | 0.7062497 | 0 |
REMOVE LOCATION FROM THE SELECTED LOCATION LIST: | function Remove_Location()
{
var strHtml = "";
var lstSelectedLocationList = document.getElementById("lstSelectedLocation");
/*
CHECK THE SELECTED LOCATION LIST IS EMPTY OR NOT:
*/
if(lstSelectedLocationList.length > 0)
{
/*
CHECK THE LOCATION IS SELECTED IN THE LIST:
*/
if(lstSelectedLoc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function removeLocation (location) {\n var temp = {...myLocations}\n delete temp[location]\n localStorage.setItem('myLocations', JSON.stringify(temp))\n setMyLocations(temp)\n }",
"function deselectLocation() {\n $(\".element\").removeClass(\"selectedLocation\");\n }",
... | [
"0.69212514",
"0.6919601",
"0.6706353",
"0.65628105",
"0.65442526",
"0.64301366",
"0.6340774",
"0.6282175",
"0.6237089",
"0.62273604",
"0.62103605",
"0.6207026",
"0.61502564",
"0.61500293",
"0.6099443",
"0.60817134",
"0.6080604",
"0.607872",
"0.59919125",
"0.5987014",
"0.5981... | 0.6984295 | 0 |
Subject can only contain letters az in lowercase | function isValidSubject(inputText){
var subjectformat = /^[a-z]+$/;
if(inputText.value.match(subjectformat))
{
return true;
}
else {
text = "The subject can only contain letters a-z";
errorMessage.innerHTML = text;
return false;
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isValidSubject(subject)\n{\n var reg = new RegExp(\".{6,60}\");\n\tvar reg2 = new RegExp(\"\\\\s{30,60}\");\n\tvar reg3 = new RegExp(\"^\\\\s{0,60}$\");\n\n\t// reg.test(message) && !reg2.test(message) &&\n if(reg.test(subject) && !reg2.test(subject) && !reg3.test(subject) && (subject.length >= 6) && (s... | [
"0.6423318",
"0.62158954",
"0.61340636",
"0.6069297",
"0.58314586",
"0.5799364",
"0.57850444",
"0.57799304",
"0.57712275",
"0.5762582",
"0.57575923",
"0.5734662",
"0.5734662",
"0.572743",
"0.5720478",
"0.5687274",
"0.56681025",
"0.5655633",
"0.5649092",
"0.5638757",
"0.562695... | 0.7684206 | 0 |
Must contain more than 10 characters | function isValidMessage(inputText){
var messagelength = /^.{10,}$/;
if(inputText.value.match(messagelength))
{
return true;
}
else {
text = "Please Enter More Than 10 Characters in Your Message";
errorMessage.innerHTML = text;
return false;... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validarPregunta(pregunta) {\n if (pregunta.length < 10) { // si el enunciado es menor a 10 caracteres muestra alerta y devuelve false\n alert(\"La pregunta debe tener mínimo 10 caracteres\")\n return false;\n }\n else {\n return true;\n }\n}",
... | [
"0.7068711",
"0.6921545",
"0.6818929",
"0.67824674",
"0.6781015",
"0.67569023",
"0.67299956",
"0.67104405",
"0.6681634",
"0.6680462",
"0.66744614",
"0.6654684",
"0.6633843",
"0.66328776",
"0.66216457",
"0.65930426",
"0.657697",
"0.6555735",
"0.6550828",
"0.65447587",
"0.65403... | 0.7437078 | 0 |
Sets the value of the color property. | setColor (newValue) {
this.color = newValue
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"set color(newColor){\n this._color = newColor;\n }",
"set color( v ){ this._color.set( new Colour( v ).rgb ); }",
"setColor(color) {\n this.color = color;\n this.colorString = this.color.asString();\n }",
"setColor(color) {\n if (color !== this.color) {\n this.color = color... | [
"0.82012635",
"0.76034606",
"0.7477081",
"0.7264632",
"0.722947",
"0.71954054",
"0.71252126",
"0.71033967",
"0.7086351",
"0.70616436",
"0.700521",
"0.69912124",
"0.6910346",
"0.6893578",
"0.6875668",
"0.67248344",
"0.6710983",
"0.6701377",
"0.66555667",
"0.665176",
"0.6594324... | 0.7697666 | 1 |
Find the html elements that map to a specific target line in the editor. If an exact match, returns a single element. If the line is between elements, returns the element prior to and the element after the given line. | function getElementsForSourceLine(targetLine) {
const lineNumber = Math.floor(targetLine);
const lines = getCodeLineElements();
let previous = lines[0] || null;
for (const entry of lines) {
if (entry.line === lineNumber) {
return { previous: entry, next: undefined };
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findPreviousLine(viewLine) {\n const refTop = parseInt(viewLine.style.top || \"\", 10) || 0;\n const lineHeight = parseInt(viewLine.style.height || \"\") || 30;\n const target = refTop - lineHeight + \"px\";\n // In most cases, the previous element is actually the one we're\n // looking for... | [
"0.62018555",
"0.61516845",
"0.5980334",
"0.55412537",
"0.55412537",
"0.53707033",
"0.5324237",
"0.53128046",
"0.53109175",
"0.52876276",
"0.5241103",
"0.52385443",
"0.52385443",
"0.52385443",
"0.52286613",
"0.5224192",
"0.52213705",
"0.52213705",
"0.5207454",
"0.5196815",
"0... | 0.61598665 | 1 |
Find the html elements that are at a specific pixel offset on the page. | function getLineElementsAtPageOffset(offset) {
const lines = getCodeLineElements();
const position = offset - window.scrollY;
let lo = -1;
let hi = lines.length - 1;
while (lo + 1 < hi) {
const mid = Math.floor((lo + hi) / 2);
const bounds = lines[mid].element.getBoundingClientRect()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"findChildAtOffset(offset) {\n let children = this.$(\"ul\").children();\n let i = 0,\n acc = 0;\n let elem = null;\n while (acc < offset && i < children.length) {\n elem = children.eq(i);\n acc += elem.outerWidth();\n i++;\n }\n return { element: elem, offset: acc };\n }",
... | [
"0.6496099",
"0.5957458",
"0.5929195",
"0.5761782",
"0.5757515",
"0.56834114",
"0.5643218",
"0.563645",
"0.5634487",
"0.5634487",
"0.5634487",
"0.562338",
"0.56134295",
"0.56010675",
"0.55569595",
"0.5513407",
"0.5503582",
"0.55030984",
"0.54978484",
"0.5481733",
"0.54751086"... | 0.64411354 | 1 |
Attempt to reveal the element for a source line in the editor. | function scrollToRevealSourceLine(line) {
if (!settings_1.getSettings().scrollPreviewWithEditor) {
return;
}
if (line <= 0) {
window.scroll(window.scrollX, 0);
return;
}
const { previous, next } = getElementsForSourceLine(line);
if (!previous) {
return;
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function scrollToRevealSourceLine(line) {\n const { previous, next } = getElementsForSourceLine(line);\n if (previous && settings_1.getSettings().scrollPreviewWithEditor) {\n let scrollTo = 0;\n const rect = previous.element.getBoundingClientRect();\n const previousTop = rect.top;\n ... | [
"0.72572565",
"0.6356633",
"0.6092823",
"0.5858579",
"0.57388246",
"0.56920093",
"0.5618959",
"0.5618959",
"0.56084687",
"0.55972713",
"0.55972713",
"0.55972713",
"0.55972713",
"0.55972713",
"0.55972713",
"0.55972713",
"0.55972713",
"0.55972713",
"0.55972713",
"0.55972713",
"... | 0.72957826 | 0 |
Remove the entry for `key` in `map` using internal hash. | function remove_(map, key) {
return map.remove(key);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function remove(key) {\n return map => remove_(map, key);\n}",
"remove(key){const _map=this._map;const entry=_map.get(key);if(entry){_map.delete(key);if(entry===this._back){this._back=entry.previous;}else if(entry.next){entry.next.previous=entry.previous;}if(entry===this._front){this._front=entry.next;}else if(... | [
"0.7452416",
"0.739875",
"0.7170954",
"0.7011267",
"0.6978695",
"0.68241984",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.657952",
"0.6563015",
"0.6514507",
"0.6441591",
"0.64322877",
"... | 0.806242 | 0 |
Remove the entry for `key` in `map` using internal hash. | function remove(key) {
return map => remove_(map, key);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function remove_(map, key) {\n return map.remove(key);\n}",
"remove(key){const _map=this._map;const entry=_map.get(key);if(entry){_map.delete(key);if(entry===this._back){this._back=entry.previous;}else if(entry.next){entry.next.previous=entry.previous;}if(entry===this._front){this._front=entry.next;}else if(ent... | [
"0.806242",
"0.739875",
"0.7170954",
"0.7011267",
"0.6978695",
"0.68241984",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.6679781",
"0.657952",
"0.6563015",
"0.6514507",
"0.6441591",
"0.64322877",
"0... | 0.7452416 | 1 |
Calculate the number of key/value pairs in a map | function size(map) {
return map.length.get;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDictLength(dict) {\r\n return Object.keys(dict).length;\r\n}",
"function cnt_from_keys(dict)\n{\n if (get_type(dict) !== \"Dict\") { return 0; }\n var d = (dict.contains(\"_\")) ? 1 : 0;\n var keys = dict.getkeys();\n switch (get_type(keys)) {\n case \"String\": return (1 - d);\n case \"Arra... | [
"0.7581819",
"0.73551476",
"0.7318011",
"0.7220603",
"0.7092366",
"0.69306123",
"0.68631566",
"0.67288154",
"0.670784",
"0.67053294",
"0.6683074",
"0.66719705",
"0.6640369",
"0.6612467",
"0.66046584",
"0.6600528",
"0.65744257",
"0.65446",
"0.6516848",
"0.6510918",
"0.64917535... | 0.7577149 | 1 |
Alter the value stored for `key` in `map` using function `f` using internal hash function. `f` is invoked with the current value for `k` if it exists, or no arguments if no such value exists. `modify` will always either update or insert a value into the map. Returns a map with the modified value. Does not alter `map`. | function modify_(map, key, f) {
const v = f(map.get(key));
if (O.isSome(v)) {
map.set(key, v.value);
} else {
map.remove(key);
}
return map;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function modify(key, f) {\n return map => modify_(map, key, f);\n}",
"function update_(map, key, f) {\n return map.update(key, f);\n}",
"function update(key, f) {\n return map => update_(map, key, f);\n}",
"function map_update(map, key, fn, deflt){\n let val = map.get(key)\n if (val === undefined) { val... | [
"0.7678477",
"0.696175",
"0.64651877",
"0.63207513",
"0.6037874",
"0.58343196",
"0.57724744",
"0.5760618",
"0.56641567",
"0.5488718",
"0.540871",
"0.50135154",
"0.50051105",
"0.49893615",
"0.49893615",
"0.49543944",
"0.48475116",
"0.48351392",
"0.48270893",
"0.48209536",
"0.4... | 0.7530062 | 1 |
Alter the value stored for `key` in `map` using function `f` using internal hash function. `f` is invoked with the current value for `k` if it exists, or no arguments if no such value exists. `modify` will always either update or insert a value into the map. Returns a map with the modified value. Does not alter `map`. | function modify(key, f) {
return map => modify_(map, key, f);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function modify_(map, key, f) {\n const v = f(map.get(key));\n\n if (O.isSome(v)) {\n map.set(key, v.value);\n } else {\n map.remove(key);\n }\n\n return map;\n}",
"function update_(map, key, f) {\n return map.update(key, f);\n}",
"function update(key, f) {\n return map => update_(map, key, f);\n}... | [
"0.7530062",
"0.696175",
"0.64651877",
"0.63207513",
"0.6037874",
"0.58343196",
"0.57724744",
"0.5760618",
"0.56641567",
"0.5488718",
"0.540871",
"0.50135154",
"0.50051105",
"0.49893615",
"0.49893615",
"0.49543944",
"0.48475116",
"0.48351392",
"0.48270893",
"0.48209536",
"0.4... | 0.7678477 | 0 |
Updates command name in database | changeCommandName(name) {
database.updateCommand(this.state.command.id, {
name: name,
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function change_entry(){\n if(arguments.length==3){\n exec(\"UPDATE dumpster SET '\"+arguments[1]+\"' = '\"+arguments[2]+\"' WHERE name = '\"+arguments[0]+\"'\");\n get_all();\n }\n else{\n post(\"Wrong number of arguments\");\n }\n}",
"setName(name) {\n this.updateName = ... | [
"0.61223054",
"0.6075607",
"0.592707",
"0.57622206",
"0.5724723",
"0.57212526",
"0.5673303",
"0.56001675",
"0.55842954",
"0.55206865",
"0.55149704",
"0.5496709",
"0.54858464",
"0.5485201",
"0.54822177",
"0.54436517",
"0.5425414",
"0.53946793",
"0.538995",
"0.53644234",
"0.535... | 0.8289574 | 0 |
Deletes command from database | deleteCommand() {
database.removeCommand(this.state.command.id);
super.deleteCommand();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"DELETE() {\n this.execute('DELETE');\n }",
"function deleteFromDB() {\n fs.delete(\n filepath, note\n )\n}",
"function glomeCleanAds()\n{\n q = 'DELETE FROM ads';\n log.debug(q);\n var statement = db.createStatement(q);\n statement.execute();\n statement.reset();\n}",
"async delet... | [
"0.7140144",
"0.6839941",
"0.6680753",
"0.66097045",
"0.6584328",
"0.6446625",
"0.6427111",
"0.6418285",
"0.6406194",
"0.6360217",
"0.635541",
"0.6351485",
"0.63378865",
"0.633338",
"0.6322256",
"0.6287482",
"0.6283962",
"0.62656426",
"0.62389284",
"0.6227196",
"0.6217572",
... | 0.8154028 | 0 |
Adds query for command to database | addQuery(text) {
this.setState({
command: database.addQuery(this.state.command.id, text),
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function pushQuery(query) {\n if (!query) return;\n\n if ((0, _lodash.isString)(query)) {\n query = {\n sql: query\n };\n }\n\n if (!query.bindings) {\n query.bindings = this.formatter.bindings;\n }\n\n this.sequence.push(query);\n this.formatter = this.client.formatter(this._commonBuilder);\n... | [
"0.67232716",
"0.6359549",
"0.63490164",
"0.6224951",
"0.6169412",
"0.60453534",
"0.5905097",
"0.5893396",
"0.5887059",
"0.5850436",
"0.57872224",
"0.5753902",
"0.57361555",
"0.5681342",
"0.56633615",
"0.56633615",
"0.5638486",
"0.5629373",
"0.5629373",
"0.56288534",
"0.56154... | 0.66392463 | 1 |
Deletes query for command from database | deleteQuery(query) {
this.setState({
command: database.removeQuery(this.state.command.id, query.id),
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"deleteCommand() {\n database.removeCommand(this.state.command.id);\n super.deleteCommand();\n }",
"function glomeCleanAds()\n{\n q = 'DELETE FROM ads';\n log.debug(q);\n var statement = db.createStatement(q);\n statement.execute();\n statement.reset();\n}",
"async hardDelete(query) {\n return th... | [
"0.7503175",
"0.72767055",
"0.71865815",
"0.69404024",
"0.6909889",
"0.6813496",
"0.66953444",
"0.66436553",
"0.6598383",
"0.65603197",
"0.64886034",
"0.64576477",
"0.6373095",
"0.6348707",
"0.63375515",
"0.63316596",
"0.6323574",
"0.631936",
"0.6290923",
"0.62743556",
"0.627... | 0.7278317 | 1 |
Get card sizes according to the window size. It checks device orientation by getting the comparison of the width and height. It assumes squared cards | function getCardSizes(){
if (window.innerWidth > window.innerHeight){
return (window.innerHeight - 3 * padding) / 3;
}
else {
return (window.innerWidth - 3 * padding) / 3;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setBaseSize(type) {\r\n let w_card = 1024;\r\n let h_card = 1024;\r\n let widthRatio = 0.95;\r\n let maxWindowHeight = 1080.0;\r\n let heightMax = window.innerHeight - 225;\r\n if (this.mobile) {\r\n if (window.innerHeight < maxWindowHeight * 0.8) {\r\n ... | [
"0.66537064",
"0.6255884",
"0.61042625",
"0.59549433",
"0.5847709",
"0.5800137",
"0.5770178",
"0.57700664",
"0.5765637",
"0.5761664",
"0.57006645",
"0.56850225",
"0.56776214",
"0.5672621",
"0.5655327",
"0.56097066",
"0.5549435",
"0.55385596",
"0.5538192",
"0.55359924",
"0.553... | 0.7985278 | 0 |
Generate cards on PIXI.js stage and their covers on the 2d html5 canvas, by creating a sprite per card. This could be random on the actual game. Here it assumes it is always a 3x3 matrix | function generateCards(){
let size = getCardSizes();
for (let i = 0; i < 3; i++){
for (let j = 0; j < 3; j++){
let card = new Sprite(resources["../assets/card.jpg"].texture);
card.width = size;
card.height = size;
card.x = padding * (i + 0.5) + size * i;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makedeck() {\n var cardCounter = 0;\n \n for (var i = 0; i < NUM_COLS; i++) {\n for (var j = 0; j < NUM_ROWS; j++) {\n\n pic = new Image();\n\n var pairNumber = Math.floor(cardCounter/2);\n pic.src = pics[pairNumber];\n\n deck.push(new Card(20 + i * (cardwidth + mar... | [
"0.7077922",
"0.7041504",
"0.7036094",
"0.69265527",
"0.6876664",
"0.6850947",
"0.6833979",
"0.6760525",
"0.6755876",
"0.67270696",
"0.67053944",
"0.6703515",
"0.6667034",
"0.6661009",
"0.66586965",
"0.6632776",
"0.66286147",
"0.66250986",
"0.65897053",
"0.6583582",
"0.657499... | 0.8392584 | 0 |
retrieves a list of elements present in the priority queue after the given cell has been played | retrieveEntriesAfterTurn(cell){
this.temp = [];
let counter = 0;
while(!this.isEmpty()){
if(this.front().element == cell){
this.dequeue();
}
else{
this.temp[counter] = this.dequeue();
counter++;
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"printPriorityQueue() {\n let arr = [];\n for (let i = 0; i < this.items.length; i++) {\n arr.push(this.items[i].element);\n }\n return arr;\n }",
"dequeue() {\n var prioridade = this.itens[0].priority;\n var aux = 0;\n for (var i = 1; i < this.itens.length; i++) {\n if ( this.iten... | [
"0.60839593",
"0.58805686",
"0.57296675",
"0.56898344",
"0.56508994",
"0.5626709",
"0.56264365",
"0.56021833",
"0.5601037",
"0.55837643",
"0.5499286",
"0.5459275",
"0.54574513",
"0.545207",
"0.5448675",
"0.5444563",
"0.5377134",
"0.53701174",
"0.5322555",
"0.53209996",
"0.532... | 0.67838967 | 0 |
Configs para quando o scope for 'edit' | configureEdit () {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Edit() {}",
"function switchToAssocEditor() {\n $scope.editSection = 'assoc-editor';\n }",
"doEditMode() {\n\n }",
"function editme(id, name) {\n\tMAIN_ACTIVE_GENELIST_ID = id;\n\tMAIN_ACTIVE_GENELIST_NAME = name;\n\t$(\"#formBarang\").show();\n\t$(\"#namebarangid\").val(name);\n\tcur... | [
"0.65273833",
"0.64160943",
"0.6360178",
"0.63124144",
"0.6310677",
"0.6293517",
"0.62788355",
"0.6220563",
"0.6151092",
"0.6138152",
"0.61219364",
"0.60923636",
"0.6080144",
"0.6080144",
"0.6080144",
"0.6080144",
"0.6080144",
"0.6080144",
"0.6047461",
"0.6041438",
"0.6039105... | 0.7068579 | 0 |
splitOnVal(5) for the list (1=>3=>5=>2=>4) will change list to (1=>3), and the return value will be a new list containing (5=>2=>4) | splitOnVal(val) {
const newList = new SList();
if (this.isEmpty()) {
return newList;
}
if (this.head.data === val) {
newList.head = this.head;
this.head = null;
return newList;
}
let runner = this.head;
while (runner... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function splitOnVal(head, x){\n\tvar prev = head;\n\tvar current = head.next;\n\tvar head2;\n\t\n\tif (head.val === x){\n\t\treturn head;\n\t \n\t} else {\n\t \n\t while (current){\n\t\tif (current.val === x){\n\t\t prev.next = null;\n\t\t head2 = current;\n\t\t}\n\t\tprev = current;\n\t\tcurrent = prev.next;... | [
"0.6120786",
"0.60740566",
"0.59672683",
"0.5894703",
"0.56267035",
"0.55891263",
"0.5492298",
"0.5406693",
"0.5353722",
"0.5255451",
"0.5190709",
"0.5167422",
"0.51508135",
"0.5145458",
"0.5101207",
"0.5098373",
"0.50478935",
"0.5047328",
"0.50230145",
"0.5015769",
"0.500228... | 0.7136949 | 0 |
insertPersonAscAge: build an add person method that adds a person object to linked list maintaing asc order by person's age key | addPersonAscAge(person) {
const newNode = new Node(person);
// assume that this is an object
if (this.isEmpty()) {
this.head = newNode;
return this;
}
if (this.head.next === null) {
if (person.age > this.head.data.age) {
this.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sort_by_age() {\n if (sorted === 'age_asc') {\n persons.sort(function(a, b){\n return parseFloat(a.age) + parseFloat(b.age);\n });\n sorted = 'age_dsc';\n } else if (sorted === 'age_dsc') {\n sort_by_id();\n } else {\n persons.sort(function(a, b){\n ... | [
"0.6300043",
"0.58327556",
"0.57797277",
"0.5676595",
"0.55245143",
"0.5516332",
"0.55110896",
"0.5487141",
"0.5465789",
"0.54270065",
"0.539981",
"0.53516436",
"0.53429234",
"0.532737",
"0.53163606",
"0.5273323",
"0.5273201",
"0.5256722",
"0.5252606",
"0.52469265",
"0.524482... | 0.7480364 | 0 |
Functionality just to check to see if the ListeningMessageEmoji has expired or not. When it's expired, we usually know to delete that ListeningMessageEmoji object. | static isExpired(listeningMessageEmoji) {
return new Promise(function(resolve, reject) {
if ((Date.now() - listeningMessageEmoji.date) > listeningMessageEmoji.expirationTime) { //Older than expiration time
resolve(true);
} else {
resolve(false)
}
});
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"clear(message) {\n if(message.timestamp.expiryTimer) {\n clearTimeout(message.timestamp.expiryTimer);\n }\n }",
"static isTokenExpired() {\n const token = this.getToken();\n try {\n const decoded = decode(token);\n return decoded.exp < Date.now() / 1000;\n } catch (err) {\n... | [
"0.6212591",
"0.59508127",
"0.582394",
"0.5803159",
"0.5803159",
"0.5799656",
"0.57806534",
"0.57397485",
"0.5712958",
"0.57080674",
"0.55873513",
"0.5521158",
"0.5490223",
"0.548777",
"0.54505986",
"0.54339486",
"0.53900915",
"0.53730977",
"0.5361776",
"0.5361229",
"0.535086... | 0.7896219 | 0 |
No alternate, make into a guarded expression | function toGuardedExpression(path) {
const { node } = path;
if (
node.consequent &&
!node.alternate &&
node.consequent.type === "ExpressionStatement"
) {
let op = "&&";
if (t.isUnaryExpression(node.test, { operator: "!" })) {
node.test = node.test.argument;
op =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"visitExclusiveOrExpression(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"function genTernaryExp (el) {\n return el.once ? genOnce(el) : genElement(el)\n }",
"function genTernaryExp (el) {\n return el.once ? genOnce(el) : genElement(el)\n }",
"function genTernaryExp (el) {\n return el.once ? ... | [
"0.61173254",
"0.58171725",
"0.58171725",
"0.58171725",
"0.58171725",
"0.58171725",
"0.58171725",
"0.58171725",
"0.58171725",
"0.58171725",
"0.58171725",
"0.58171725",
"0.56831944",
"0.5654687",
"0.5654687",
"0.5654687",
"0.5641688",
"0.5641688",
"0.5641688",
"0.5641688",
"0.... | 0.6855844 | 0 |
both consequent and alternate are expressions, turn into ternary | function toTernary(path) {
const { node } = path;
if (
t.isExpressionStatement(node.consequent) &&
t.isExpressionStatement(node.alternate)
) {
path.replaceWith(
t.conditionalExpression(
node.test,
node.consequent.expression,
node.alternate.expression
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ternaryOp(firstArg, secondArg) {\n return secondArg ? secondArg : firstArg\n}",
"function genTernaryExp(el) {\n return altGen\n ? altGen(el, state)\n : el.once\n ? genOnce(el, state)\n : genElement(el, state)\n }",
"function genTernaryExp (el) {\n return alt... | [
"0.75027895",
"0.7207741",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
"0.7182771",
... | 0.76535314 | 0 |
Make if statements with conditional returns in the body into an if statement that guards the rest of the block. | function conditionalReturnToGuards(path) {
const { node } = path;
if (
!path.inList ||
!path.get("consequent").isBlockStatement() ||
node.alternate
) {
return;
}
let ret;
let test;
const exprs = [];
const statements = node.consequent.body;
for (let i = 0, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function parseIf() {\n var blockResult = null;\n var label = _webassemblyjs_ast__WEBPACK_IMPORTED_MODULE_1__[\"identifier\"](getUniqueName(\"if\"));\n var testInstrs = [];\n var consequent = [];\n var alternate = [];\n\n if (token.type === _tokenizer__WEBPACK_IMPORTED_MODULE_4__[\"tok... | [
"0.64328283",
"0.6320618",
"0.6320618",
"0.6171482",
"0.61407655",
"0.61049056",
"0.59998316",
"0.59998316",
"0.598861",
"0.598861",
"0.59865224",
"0.59824",
"0.59715605",
"0.59664744",
"0.5956639",
"0.5956639",
"0.595205",
"0.59477156",
"0.594628",
"0.59314775",
"0.59165895"... | 0.7272222 | 0 |
Locate Strider Extensions Under a specified path dir look for directories containing file 'strider.json'. These are considered Strider modules. dir may be either a string or a list of strings. cb is a function of signature cb(err, extensions) where extensions is an array of filesystems path on success and err is an err... | function findExtensions(dir, cb) {
var filename = "strider.json";
var extensions = [];
// fs.readdir list of paths in parallel.
// used when `dir` arg is an array.
function readEntries(dirs, cb) {
var funcs = []
dirs.forEach(function(dir) {
funcs.push(function(c) {
fs.readdir(dir, fun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findExtensions(dir, cb) {\n\n var filename = \"strider.json\";\n\n var extensions = [];\n\n Step(\n function() {\n // find top-level module dirs\n fs.readdir(dir, this);\n },\n function(err, entries) {\n if (err) {\n throw err;\n }\n // Stat extension files in... | [
"0.80906546",
"0.6195047",
"0.6157988",
"0.61185515",
"0.58981735",
"0.58904344",
"0.55814695",
"0.5544019",
"0.55174595",
"0.53473735",
"0.53227556",
"0.5311208",
"0.5270901",
"0.5266449",
"0.52427846",
"0.5223514",
"0.5220633",
"0.5190029",
"0.51777685",
"0.5162885",
"0.515... | 0.7994727 | 1 |
Load a Strider extension moduleDir is a directory containing a strider.json file and a package.json file. cb is a function of signature function(err, extension) where extension is an extension object on success and err is an error on failure. Note that this function does not initialize the extension. | function loadExtension(moduleDir, cb) {
Step(
function() {
var striderFile = path.join(moduleDir, "strider.json");
var packageFile = path.join(moduleDir, "package.json");
fs.readFile(striderFile, this.parallel());
fs.readFile(packageFile, this.parallel());
},
function(err, striderD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function loadExtension(moduleDir, cb) {\n Step(\n function() {\n var striderFile = path.join(moduleDir, \"strider.json\");\n var packageFile = path.join(moduleDir, \"package.json\");\n fs.readFile(striderFile, this.parallel());\n fs.readFile(packageFile, this.parallel());\n },\n funct... | [
"0.8524324",
"0.5758005",
"0.5608734",
"0.5506915",
"0.5503246",
"0.5328835",
"0.5299403",
"0.5205167",
"0.5181454",
"0.51534164",
"0.5095998",
"0.50916237",
"0.50210315",
"0.49991247",
"0.49794066",
"0.49707675",
"0.49328232",
"0.48834825",
"0.48268992",
"0.48096237",
"0.473... | 0.822435 | 1 |
Initialize Strider Extensions Find, load and initialize extenions of type type under extension directory extdir type may be one of "webapp" or "worker". Context should be a Strider context object with keys: config (strider config object) emitter (global eventemitter) extensionRoutes (list of webapp routes) registerTran... | function initExtensions(extdir, type, context, appInstance, cb) {
var templates = {}
Step(
function() {
console.log("Looking for %s-type extensions under %s", type, extdir);
findExtensions(extdir, this);
},
function(err, extensions) {
var group = this.group();
extensions.forEac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initExtensions(extdir, type, context, appInstance, cb) {\n Step(\n function() {\n console.log(\"Looking for %s-type extensions under %s\", type, extdir);\n findExtensions(extdir, this);\n },\n function(err, extensions) {\n var group = this.group();\n extensions.forEach(functi... | [
"0.8176122",
"0.6226706",
"0.5873506",
"0.57398486",
"0.53751516",
"0.52969927",
"0.5292431",
"0.5283341",
"0.52807754",
"0.5245879",
"0.5175483",
"0.51629233",
"0.50563854",
"0.50345224",
"0.50345224",
"0.49473047",
"0.49372295",
"0.49308312",
"0.49208784",
"0.49110207",
"0.... | 0.7834532 | 1 |
BlockingPopup PUBLIC Constructor This object covers the whole web page with a transparent overglass and shows a future gui's popup which allows to view the current flow's progression. | function BlockingPopup(title) {
this.title = title;
this.attributes = new Array();
this.addAttribute = addBPAttribute;
this.show = showBP;
this.release = releaseBP;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function block() {\n $.blockUI({\n css: {\n 'border': 'none',\n 'padding': '15px',\n 'backgroundColor': '#000',\n '-webkit-border-radius': '10px',\n '-moz-border-radius': '10px',\n 'opacity': 0.5,\n 'color': '#fff'\n },\n // Styles for the overlay\... | [
"0.6068541",
"0.5950136",
"0.57558864",
"0.57417315",
"0.57308424",
"0.57276464",
"0.5716585",
"0.5649515",
"0.5625506",
"0.55770844",
"0.55610234",
"0.55423033",
"0.5535656",
"0.55327386",
"0.55235016",
"0.55204767",
"0.5499624",
"0.5461952",
"0.5425204",
"0.5418118",
"0.541... | 0.6990297 | 0 |
Open a dialog when users click on a node for timeline data | function openNodeDialog(datapoint, svgObj) {
// Grab a list of dataKeys
var dataKeys = Object.keys(datapoint);
// Create a dialog with the datapoint's name for the title, a div for a
// timeline for just this datapoint, a word cloud, and a button that shows
// the raw JSON data
var nodeName = d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function nodepicker_dialog_open(instance) {\n instanceId = instance;\n $(\"body\").append(\"<div id='nodepicker_dialog'><iframe id='nodepicker_dialog_contents' src='\"+Drupal.settings.nodepicker.basepath + \"?q=nodepicker/nodes' width='602' height='446' frameborder='0' /></div>\");\n $(\"#nodepicker_dialog\").d... | [
"0.61756206",
"0.6016666",
"0.5954385",
"0.58894616",
"0.58312637",
"0.58254963",
"0.5811937",
"0.57991827",
"0.5769814",
"0.57360446",
"0.57229793",
"0.57163143",
"0.56922436",
"0.5691073",
"0.5678908",
"0.56578827",
"0.5610764",
"0.5597456",
"0.55901814",
"0.558528",
"0.555... | 0.6412609 | 0 |
A helper function to determine which squares in the heatmap should be selected. A square will only be selected if the selection box contains the square or if the selection box's bounds go through the sqaure | function determineHeatmapSelection(x1, x2, y1, y2, dataPoint, svgObj) {
// For the current square, calculate the relative x-coordinates for the left
// and right edges
var dx1;
var dx2;
// The existence of the invert function helps to determine if the data is
// categorical or continuous
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function drawSelectedSquares() {\n\tGameManager.drawSurface.strokeStyle = \"rgb(0,255,0)\";\n\tGameManager.drawSurface.fillStyle = \"rgb(0,255,0)\";\n\tGameManager.drawSurface.lineWidth = 2;\n\tfor (var i = 0; i < selection.length; i++) {\n\t\tif (selectionType == \"raider\") {\n\t\t\tGameManager.drawSurface.strok... | [
"0.6836867",
"0.6564079",
"0.6314196",
"0.62923604",
"0.6152657",
"0.6110076",
"0.60846794",
"0.60317594",
"0.60315645",
"0.60000145",
"0.5977468",
"0.5948288",
"0.59022063",
"0.5881017",
"0.5854676",
"0.5853912",
"0.58510226",
"0.5838161",
"0.5816912",
"0.58080494",
"0.58047... | 0.7137082 | 0 |
A helper function to determine which barchart overviews to select. A barchart overview will only be selected if all bars for that node are contained within the selection box | function determineBarchartOverviewSelection(x1, x2, y1, y2, dataPoint, svgObj) {
// Get the numKeys, calculate the bar width, and set the barPadding
var numKeys = svgObj.dataKeys.length;
var barWidth = (width - svgPadding*2 - chartPadding*2) *
(1 - scalePadding*2)/numKeys - 5;
var barPadding = 5... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"selectAllBar() {\n var self = this;\n\n return self.body.selectAll('.c9-custom-rect');\n }",
"function selectedChartGroup(chartGrp) {\n \tvar selections = chartGrp.selections;\n \tvar hasDropDown = selections.length > 1;\n \tvar hasSelected = false, chart, param, title = \"\"; \n \... | [
"0.5808288",
"0.5733245",
"0.5533533",
"0.5470346",
"0.54579693",
"0.54457116",
"0.5418738",
"0.5386189",
"0.5377588",
"0.5367258",
"0.53578997",
"0.53365934",
"0.5322184",
"0.530277",
"0.5266839",
"0.5263499",
"0.5235585",
"0.52346325",
"0.5229507",
"0.5202744",
"0.51972187"... | 0.71690446 | 0 |
A helper function to determine which timelines to select. A timeline will only be selected if all lines in a timeline are within the selection box | function determineTimelineSelection(x1, x2, y1, y2, dataPoint, svgObj) {
// Iterate through all the dataKeys to determine whether all lines in the
// given dataPoint's timeline lie within the selection box
var timelineInSelection = true;
var i;
for (i = timelineKeyStartIndex;
timelineInSelecti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function selectedGroup(lines, oneSelected) {\n let linesLen = lines.length;\n let eventTable = $(lines[1]).data(\"table\");\n\n if (oneSelected) {\n for (let i = 1; i < linesLen; i += 2) { \n if (lines[i].classList.contains(\"selected\")) \n ... | [
"0.5641352",
"0.55627704",
"0.550956",
"0.5507579",
"0.5494078",
"0.53750765",
"0.53063864",
"0.52494115",
"0.5176188",
"0.5130239",
"0.5129386",
"0.51161295",
"0.5042722",
"0.5041354",
"0.5041354",
"0.5040546",
"0.5033877",
"0.5028553",
"0.5017717",
"0.5012816",
"0.49736002"... | 0.70378184 | 0 |
Crops the canvas (as determined by id), to the rectangle defined by x, y, w, h | function cropCanvasToImage(id, x, y, w, h) {
var tmp_canvas = document.createElement('canvas')
, tmp_context = tmp_canvas.getContext('2d')
, from_canvas = document.getElementById(id)
, from_context = from_canvas.getContext('2d');
tmp_canvas.width = w;
tmp_canvas.height = h;
tmp_context.putImageData( from_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function cropImage(img,rect) {\n \n let draw = new DrawContext()\n draw.size = new Size(rect.width, rect.height)\n \n draw.drawImageAtPoint(img,new Point(-rect.x, -rect.y)) \n return draw.getImage()\n}",
"function crop(canvas, offsetX, offsetY, width, height, callback) {\n // create an in-memory c... | [
"0.65762234",
"0.6516141",
"0.65126663",
"0.64849275",
"0.6433759",
"0.6362643",
"0.62814367",
"0.61777264",
"0.6095679",
"0.6055037",
"0.6049115",
"0.6049115",
"0.6017438",
"0.59933615",
"0.5978837",
"0.5962326",
"0.59314936",
"0.5928247",
"0.59163374",
"0.58947265",
"0.5894... | 0.6939045 | 0 |
Returns true if px,py are inside the rectangle defined by x,y,w,h | function inRect(px, py, x, y, w, h) {
return (px >= x && px <= x+w && py >= y && py <= y+h);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"inside(x,y){const box=this.bbox();return x>box.x&&y>box.y&&x<box.x+box.width&&y<box.y+box.height}",
"function pointInRectangle ([x, y, xMin, xMax, yMin, yMax]) {\n if (x >= xMin && x <= xMax && y >= yMin && y <= yMax) {\n console.log('inside');\n } else {\n console.log('outside');\n }\n}",
"check_insi... | [
"0.80892116",
"0.78484875",
"0.7818514",
"0.7783285",
"0.77819806",
"0.7769615",
"0.7767836",
"0.7751226",
"0.7720019",
"0.7633003",
"0.7618427",
"0.7615676",
"0.7604337",
"0.76019156",
"0.75747633",
"0.7562162",
"0.7538146",
"0.7521778",
"0.75162905",
"0.7504112",
"0.7502292... | 0.8707354 | 0 |
Constrains value to the range min...max | function constrain(min, max, value) {
return Math.max(min, Math.min(max, value));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function constrain(num, min, max) {\n \treturn Math.max(Math.min(num, max), min);\n }",
"function ensureRange(min, max, value) {\n return Math.max(min, Math.min(max, value));\n }",
"function restrictToRange(val, min, max) {\n if (val < min) return min;\n if... | [
"0.8054202",
"0.804228",
"0.7927233",
"0.7917523",
"0.790468",
"0.77926594",
"0.7761049",
"0.7620082",
"0.7617665",
"0.7615214",
"0.7612683",
"0.76117975",
"0.75696695",
"0.74850744",
"0.74765694",
"0.74765694",
"0.7463246",
"0.7461176",
"0.74605733",
"0.7453733",
"0.7406978"... | 0.8733101 | 0 |
Returns the highest power of two below the given number | function powerBelow(num) {
var power = Math.floor(logTwo(num));
return Math.pow(2,power);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function largestPower(n){\n return Math.ceil(Math.log10(n) / Math.log10(3)) - 1;\n}",
"function largestNumber(n) {\n return Math.pow(10, n) - 1;\n}",
"function largestNumber(n) {\n return Math.pow(10, n) - 1;\n}",
"_getNearestPowerOfTwo(x: number): number {\n return Math.pow( 2, Math.round( Math.... | [
"0.7921131",
"0.7315683",
"0.7315683",
"0.7286649",
"0.7249143",
"0.7155697",
"0.68662834",
"0.66156316",
"0.6593583",
"0.6590606",
"0.6571578",
"0.6564496",
"0.6484986",
"0.6468466",
"0.6458297",
"0.64186496",
"0.64118105",
"0.63937753",
"0.63855296",
"0.6373583",
"0.6369883... | 0.8063091 | 0 |
Returns base2 log of num | function logTwo(num) {
return Math.log(num) / Math.log(2);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function logBase2(num) {\n let count = 0;\n while(!!num) {\n num = num >> 1;\n count++;\n }\n return count - 1;\n}",
"function calcBinLog(number){\n console.log(Math.log2(number)); \n}",
"function log2(n) {\n var l = 0;\n while (n != 1) {\n ++l;\n n = n >> 1;... | [
"0.828528",
"0.7941131",
"0.74460167",
"0.7369266",
"0.7327558",
"0.7316648",
"0.7316505",
"0.72968054",
"0.72907",
"0.7259419",
"0.72586536",
"0.7246056",
"0.7246056",
"0.7246056",
"0.7246056",
"0.7246056",
"0.7246056",
"0.7246056",
"0.7151544",
"0.7151544",
"0.71288997",
... | 0.79917914 | 1 |
validate if there is data for a specific date and building ID | function valid_data(data, year, month, day, bID) {
if(bID in data) {
if (year in data[bID]) {
if (month in data[bID][year]) {
if (day in data[bID][year][month]) {
if(data[bID][year][month][day][1] == null) return false;
return true;
}
}
}
}
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function dataIsValid(date){\n if(date == null)\n return false;\n if (!date.match(/^\\d{4}-\\d{2}-\\d{2}$/))\n return false;\n\n var date_list = date.split(\"-\");\n year = date_list[0];\n month = date_list[1];\n day= date_list[2];\n\n if (month < 1 || month > 12 || day < 1 || day... | [
"0.6421408",
"0.6188698",
"0.6155061",
"0.6135472",
"0.6076415",
"0.59138006",
"0.5906031",
"0.5877244",
"0.5864324",
"0.5844902",
"0.58413064",
"0.5841246",
"0.58028626",
"0.5798472",
"0.5781247",
"0.5781247",
"0.575969",
"0.57572085",
"0.57346505",
"0.57198304",
"0.5712872"... | 0.65841055 | 0 |
calculate percentage error of two data sets | function get_percentage_error(actual, predicted) {
if(actual.length != predicted.length) {
console.log("two datasets have different size");
return [];
}
var len = actual.length;
var i;
var error = [];
for (i = 0; i < len; i++) {
error.push((100*Math.abs(actual[i]-predicted[i])/actual[i]).toFixe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function differenceAccuracy(target, data1, data2) {\n\n\t}",
"function meanSquaredError( pointsOne, pointsTwo ) {\n let sum = 0;\n for (let i = 0; i < pointsOne.length; i++) {\n // add squared distances.\n let y1 = pointsOne[i][1];\n let y2 = pointsTwo[i][1];\n sum += (y2 - y1)*... | [
"0.6445578",
"0.6015689",
"0.55588585",
"0.55585915",
"0.54693687",
"0.54573596",
"0.5444537",
"0.5429554",
"0.54215354",
"0.54191375",
"0.54060274",
"0.53434265",
"0.53300935",
"0.53125674",
"0.53107566",
"0.5303189",
"0.52830535",
"0.52697057",
"0.5269101",
"0.5251227",
"0.... | 0.7135013 | 0 |
Functions for making navigation links either focusable or unfocusable depending on the situation. These must be used only on mobile. | function makeUnfocusable() {
mainNavLinks.forEach(l => {
l.setAttribute("tabindex", "-1");
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toggleFocus() {\n \tvar self = this;\n\n \t// Move up through the ancestors of the current link until we hit .mobile-menu.\n \twhile (-1 === self.className.indexOf( 'nav-menu' ) ) {\n\t \t// On li elements toggle the class .focus.\n\t \tif ( 'li' === self.tagName.toLowerCase() ) {... | [
"0.61713123",
"0.61022353",
"0.6003481",
"0.60024774",
"0.5960578",
"0.59545153",
"0.5944835",
"0.5936745",
"0.58333945",
"0.57263654",
"0.57192296",
"0.5698828",
"0.56841874",
"0.56841874",
"0.56821555",
"0.5659482",
"0.5659482",
"0.5659482",
"0.5659482",
"0.5659482",
"0.565... | 0.64099544 | 0 |
Had to encapsulate the logic in a func to use it more than one time. when Screen is not wider than 600px, links will be unfocusable. | function focusOrNot() {
const mql = window.matchMedia("(max-width: 600px)");
if(mql.matches) {
makeUnfocusable();
} else {
makeFocusable();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function companyLinkClickAction(){\n $(\"#company-link\").click(function(ev){\n var doc = $(document);\n if(doc.width()<760){\n ev.preventDefault;\n }else{\n document.location = ev.currentTarget.href;\n }\n });\n}",
"function closeMenuOnAnchor() {\r\n if ($(window).width() < 769){\r\n ... | [
"0.6666536",
"0.6471269",
"0.6400222",
"0.63874966",
"0.63170075",
"0.6294009",
"0.62807137",
"0.6241906",
"0.62186986",
"0.6217637",
"0.6217454",
"0.6196719",
"0.61658746",
"0.60775876",
"0.6002239",
"0.6000393",
"0.5937202",
"0.5889117",
"0.5854847",
"0.58404267",
"0.582901... | 0.6845641 | 0 |
calculate all monthly and yearly consumption values needed for further calculations calculates: monthlyConsumption, dailyConsumptionMonthly, dailyConsumptionTotal, nightlyConsumptionMonthly, yearlyConsumption | function calculateMonthlyAndYearlyConsumptionValues(electricityConsumption) {
//monthly consumption available
if (electricityConsumption["type"] == MONTHLY) {
monthlyConsumption = electricityConsumption["data"];
for (let i = 0; i < NUMBER_OF_MONTHS; i++) {
dailyConsumptionMonthly[i] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calculateNeededValues(electricityConsumption) {\n calculateMonthlyAndYearlyConsumptionValues(electricityConsumption);\n calculatePVEfficiency();\n calculateNeededModules(yearlyConsumption);\n\n //electricity revenue without irradiation\n const electricityRevenueFactor = areaFactor * ((peakE... | [
"0.6941818",
"0.6546753",
"0.63654125",
"0.62195295",
"0.606431",
"0.6051152",
"0.5936262",
"0.58566326",
"0.58099693",
"0.5790973",
"0.57688266",
"0.5754114",
"0.5743513",
"0.57355046",
"0.57262194",
"0.56972915",
"0.5695506",
"0.5665846",
"0.56390786",
"0.56390274",
"0.5632... | 0.832118 | 0 |
calculate the pv efficiency per module | function calculatePVEfficiency() {
areaFactor = areaFactorTable[getIndexRoofAngle()][getIndexRoofOrientation()] / 100;
pvEfficiencyPerModule = totalIrradiation * areaFactor * (peakEfficiency / 1000) * (1 - (degreeOfEffectiveness / 100));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static pmt(pv, r, n, y) {\n r = r / n;\n n = n * y;\n return (r * pv) / (1 - Math.pow(1 + r, -n));\n }",
"function pv(){\r\n\t\t\tinvest = ((100 - tax) * risk) / 100;\r\n\t\t\tnetRate = (invest + 100) / (100 + annualIncrease);\r\n\t\t\ttotal = annualIncome;\r\n\r\n\t\t\tfor(var i = 1; i <= futureYears;... | [
"0.6290523",
"0.61264426",
"0.61008906",
"0.58739936",
"0.5854347",
"0.58263004",
"0.57980305",
"0.5603347",
"0.5571667",
"0.5562642",
"0.5553618",
"0.55474794",
"0.54590994",
"0.54173005",
"0.53613317",
"0.53480864",
"0.5336425",
"0.5318027",
"0.5313858",
"0.52674115",
"0.52... | 0.7846883 | 0 |
calculate amounts of needed modules and area needed for installation | function calculateNeededModules(yearlyConsumption) {
// round up amount of modules (ceil). We can only have full modules
neededAmountOfModules = Math.ceil(yearlyConsumption / pvEfficiencyPerModule);
neededRoofAreaTotal = neededAmountOfModules * neededRoofAreaPerModule;
if (neededRoofAreaTotal > roofSur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function solvePartOne() {\n moduleMass.forEach(mass => {\n let thisCalc = fuelCalculation(mass);\n totalPartOne += thisCalc;\n })\n console.log('PART ONE: Fuel required for modules alone = ' + totalPartOne);\n return totalPartOne;\n}",
"function countModules() {\n /*\n Description:\n Counts the am... | [
"0.66351616",
"0.62750876",
"0.5932652",
"0.59190637",
"0.5868754",
"0.5841333",
"0.5839296",
"0.57978165",
"0.5699025",
"0.5611259",
"0.558829",
"0.55505186",
"0.5511162",
"0.5509261",
"0.5499973",
"0.54894036",
"0.5488405",
"0.5485726",
"0.5474505",
"0.54658777",
"0.5442987... | 0.6392421 | 1 |
calculate saved electricity costs for each month and the whole year | function calculateAllSavedElectricityCosts() {
for (let i = 0; i < NUMBER_OF_MONTHS; i++) {
savedElectricityCostsMonthly[i] = calculateSavedElectricityCosts(electricityRevenueMonthly[i], dailyConsumptionMonthly[i]);
}
savedElectricityCostsTotal = sumArray(savedElectricityCostsMonthly);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calculateAllEEGCosts() {\n for (let i = 0; i < NUMBER_OF_MONTHS; i++) {\n eegCostsMonthly[i] = calculateEEGCosts(electricityRevenueMonthly[i], dailyConsumptionMonthly[i]);\n }\n eegCostsTotal = sumArray(eegCostsMonthly);\n}",
"function calculateMonthlyAndYearlyConsumptionValues(electrici... | [
"0.6939419",
"0.64890856",
"0.6371912",
"0.621864",
"0.6043064",
"0.5928729",
"0.5869353",
"0.5838146",
"0.58345443",
"0.5777625",
"0.56818694",
"0.5670004",
"0.56258965",
"0.5624638",
"0.5611739",
"0.560284",
"0.55819356",
"0.55810213",
"0.55364954",
"0.55315435",
"0.5528028... | 0.758878 | 0 |
calculate saved electricity costs parameter electricityRevenue and dailyConsumption | function calculateSavedElectricityCosts(electricityRevenue, dailyConsumption) {
if (electricityRevenue - dailyConsumption >= 0) {
return dailyConsumption * electricityCosts;
}
else {
return electricityRevenue * electricityCosts;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calculateNeededValues(electricityConsumption) {\n calculateMonthlyAndYearlyConsumptionValues(electricityConsumption);\n calculatePVEfficiency();\n calculateNeededModules(yearlyConsumption);\n\n //electricity revenue without irradiation\n const electricityRevenueFactor = areaFactor * ((peakE... | [
"0.7400099",
"0.7054769",
"0.687257",
"0.67849535",
"0.66489965",
"0.62885076",
"0.62310296",
"0.61862075",
"0.61008394",
"0.6031233",
"0.60279596",
"0.6004225",
"0.59989065",
"0.5983892",
"0.5940909",
"0.59140676",
"0.5875707",
"0.5810808",
"0.57579064",
"0.57507455",
"0.571... | 0.77866375 | 0 |
calculate eeg costs for each month and the whole year | function calculateAllEEGCosts() {
for (let i = 0; i < NUMBER_OF_MONTHS; i++) {
eegCostsMonthly[i] = calculateEEGCosts(electricityRevenueMonthly[i], dailyConsumptionMonthly[i]);
}
eegCostsTotal = sumArray(eegCostsMonthly);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fullMonthCosts(){\n let total = 0;\n costs.forEach(element => {\n if (element.span.span == \"Daily\"){\n total += (element.amount * 30.45);\n }else if (element.span.span == \"Weekly\"){\n total += (element.amount * (30.45/7));\n }else {\n total +... | [
"0.6387349",
"0.5995279",
"0.59901196",
"0.5986686",
"0.59532505",
"0.59316915",
"0.5912718",
"0.5874658",
"0.5870526",
"0.5837614",
"0.57885",
"0.56604254",
"0.56423664",
"0.56195694",
"0.5582293",
"0.5576156",
"0.5556447",
"0.55456775",
"0.55454445",
"0.55410963",
"0.553424... | 0.71582943 | 0 |
calculate eeg costs parameter pvRevenue and dailyConsumption | function calculateEEGCosts(pvRevenue, dailyConsumption) {
return pvRevenue > dailyConsumption ? (pvRevenue - dailyConsumption) * eegPrice : 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function calculateRevenueEuro() {\n revenueEuroTotal = savedElectricityCostsTotal + eegCostsTotal;\n for (let i = 0; i < NUMBER_OF_MONTHS; i++) {\n revenueEuroMonthly[i] = electricityRevenueMonthly[i] - dailyConsumptionMonthly[i];\n }\n}",
"function calculateSavedElectricityCosts(electricityReven... | [
"0.6411271",
"0.6364888",
"0.6298509",
"0.60949564",
"0.59950596",
"0.5985166",
"0.59608567",
"0.59294814",
"0.58767146",
"0.5745715",
"0.5742899",
"0.57044196",
"0.5635773",
"0.56173337",
"0.55700684",
"0.55683064",
"0.55666065",
"0.55480623",
"0.55468214",
"0.5511944",
"0.5... | 0.76105136 | 0 |
calculate revenue in euro for each month and the whole year | function calculateRevenueEuro() {
revenueEuroTotal = savedElectricityCostsTotal + eegCostsTotal;
for (let i = 0; i < NUMBER_OF_MONTHS; i++) {
revenueEuroMonthly[i] = electricityRevenueMonthly[i] - dailyConsumptionMonthly[i];
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getTotalRevenue() {\n return this.salesReport.map(s => s.totalSale).reduce((a, b) => a + b, 0);\n }",
"function calculateAllEEGCosts() {\n for (let i = 0; i < NUMBER_OF_MONTHS; i++) {\n eegCostsMonthly[i] = calculateEEGCosts(electricityRevenueMonthly[i], dailyConsumptionMonthly[i]);\n }\n ... | [
"0.6684556",
"0.6403491",
"0.61494803",
"0.59467345",
"0.59103423",
"0.5906411",
"0.58345634",
"0.5781209",
"0.57303524",
"0.5722484",
"0.57084763",
"0.56982815",
"0.5635131",
"0.5623578",
"0.56203043",
"0.5589087",
"0.557121",
"0.5567742",
"0.55669916",
"0.5544071",
"0.55431... | 0.79881674 | 0 |
calculate amortization time parameter module cost | function calculateAmortization(moduleCosts) {
let amortizationYear0 = moduleCosts * neededAmountOfModules;
let amortizationYear1 = amortizationYear0 - revenueEuroTotal + (0.01 * amortizationYear0);
return amortizationYear0 / (amortizationYear0 - amortizationYear1);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"calculateAdvancedTransportationCost() {\n var scale = this.isMonthly ? 1 : 1 / 12; // divide by 12 if the user input yearly numbers\n this.cost = parseInt( ( parseInt(this.carYearlyUpkeepCost) + parseInt(this.carMonthlyOwnershipCost) + parseInt(this.repairCost) \n + parseInt(this.gasCos... | [
"0.61215067",
"0.6042237",
"0.60380864",
"0.5887677",
"0.574977",
"0.569924",
"0.5689833",
"0.56832427",
"0.56411016",
"0.5591699",
"0.55537945",
"0.55388176",
"0.5515739",
"0.54803836",
"0.5466676",
"0.5442467",
"0.54161614",
"0.54032135",
"0.53846127",
"0.5374118",
"0.53521... | 0.614622 | 0 |
returns the index of the roof orientation for the area factor table | function getIndexRoofOrientation() {
// * 15 not needed, it already returns the correct index
// * 15 would round the value to the nearest 15-step value
return Math.round(roofOrientation / 15)/* * 15 */;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function determineOrientationIndex(orientation) {\n switch (orientation) {\n case \"A\":\n case \"P\":\n return \"x\";\n case \"L\":\n case \"R\":\n return \"y\";\n case \"S\":\n case \"I\":\n return \"z\";\n default:\n throw new Error(\"Oblique acquisitions are not curren... | [
"0.6840513",
"0.67767304",
"0.6298104",
"0.5998916",
"0.5981771",
"0.5968068",
"0.5965911",
"0.5934993",
"0.5865035",
"0.5830327",
"0.5704666",
"0.56689256",
"0.5655947",
"0.5545707",
"0.54908043",
"0.5459973",
"0.5428444",
"0.54096776",
"0.54054445",
"0.53981054",
"0.5385312... | 0.7482642 | 0 |
returns the index of the roof angle for the area factor table | function getIndexRoofAngle() {
// * 10 not needed, it already returns the correct index
// * 10 would round the value to the nearest 10-step value
return Math.round(roofAngle / 10)/* * 10 */;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getIndexRoofOrientation() {\n // * 15 not needed, it already returns the correct index\n // * 15 would round the value to the nearest 15-step value\n return Math.round(roofOrientation / 15)/* * 15 */;\n}",
"function angle(i) {return 36*i*Math.PI/180}",
"function angle(n) {\n return 180*(n-2)... | [
"0.7039323",
"0.62087137",
"0.59769315",
"0.597539",
"0.59279126",
"0.5885712",
"0.5781732",
"0.5759027",
"0.571707",
"0.57097214",
"0.57072115",
"0.5704647",
"0.56844395",
"0.5660281",
"0.5639262",
"0.5595484",
"0.55888206",
"0.55761045",
"0.55757743",
"0.5563862",
"0.555897... | 0.749291 | 0 |
To Validate phonenumber we create a function : | validatePhonenumber(){
const phone_digits = /^\d{10}$/
if(this.formValues.phonenumber === ""){
this.errorValues.phonenumberErr = "* Phone Number Cannot Be Empty"
this.showErrorMsg(2,this.errorValues.phonenumberErr)
} else if(phone_digits.test(this.formValues.phon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validate_phoneno(ph)\n\t{\n\tvar pattern=new RegExp(/^[0-9]{10}$/);\n\treturn pattern.test(ph);\n\t}",
"static validatePhoneNumber(value){\n if(!/(03|05|07|08|09|01[2|6|8|9])+([0-9]{8})\\b/.test(value)){\n return Resources.ValidateError.PhoneNumber;\n }\n }",
"function Vali... | [
"0.80115736",
"0.800733",
"0.797024",
"0.78611743",
"0.7852632",
"0.78155077",
"0.7809761",
"0.77872753",
"0.7744903",
"0.76633924",
"0.75531095",
"0.75347495",
"0.7533764",
"0.7517283",
"0.74977016",
"0.74841887",
"0.7473384",
"0.7462753",
"0.7446708",
"0.7441065",
"0.742791... | 0.8062678 | 0 |
Transforms the given y canvas coordinate into a world coordinate (removes scrolling and zooming) | worldPosY(y) {
return (y / this.scaleY) - this.offY;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function worldTo2Dcoordinates(x, y){\n\tif(!currentMap)\n\t\treturn false;\n return {\n x: (Math.abs(currentMap.x) + x) / (currentMap.scale * 1024) * canvas.width,\n y: (Math.abs(currentMap.y) - y) / (currentMap.scale * 1024) * canvas.height\n };\n}",
"toWorld(x, y)\n {\n if (argume... | [
"0.7122502",
"0.6899078",
"0.67823696",
"0.6626363",
"0.66024226",
"0.65113515",
"0.6490696",
"0.6468666",
"0.64336556",
"0.6421338",
"0.6398873",
"0.63912743",
"0.6380204",
"0.63764787",
"0.637488",
"0.6369834",
"0.6346076",
"0.6333031",
"0.63189286",
"0.628986",
"0.62878174... | 0.6927485 | 1 |
Transforms the given x world scale coordinate into a canvas scale coordinate (responds to scrolling and zooming) | canvasScaleX(x) {
return x * this.scaleX;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"transform(x, y) {\n return {\n x: (x - this.x) / this.zoom + this.viewport.width / 2,\n y: (y - this.y) / this.zoom + this.viewport.height / 2,\n };\n }",
"applyWorldTransform(ctx) {\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.scale(this.displayZoom, this.displayZoom)... | [
"0.7136482",
"0.6880474",
"0.6807462",
"0.67108965",
"0.6615264",
"0.6514196",
"0.6477699",
"0.6441497",
"0.6437892",
"0.6386321",
"0.6383381",
"0.6377324",
"0.6355878",
"0.63045794",
"0.62965363",
"0.6290662",
"0.62745106",
"0.62665415",
"0.6253307",
"0.6246748",
"0.62425506... | 0.7299045 | 0 |
Transforms the given y world scale coordinate into a canvas scale coordinate (responds to scrolling and zooming) | canvasScaleY(y) {
return y * this.scaleY;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"transform(x, y) {\n return {\n x: (x - this.x) / this.zoom + this.viewport.width / 2,\n y: (y - this.y) / this.zoom + this.viewport.height / 2,\n };\n }",
"applyWorldTransform(ctx) {\n ctx.setTransform(1, 0, 0, 1, 0, 0);\n ctx.scale(this.displayZoom, this.displayZoom)... | [
"0.6874687",
"0.686502",
"0.6567652",
"0.6483146",
"0.64714897",
"0.63569313",
"0.6345687",
"0.6338414",
"0.6311066",
"0.6282301",
"0.6262376",
"0.62541753",
"0.6207623",
"0.6177687",
"0.61372626",
"0.6114936",
"0.61112964",
"0.61077386",
"0.6107484",
"0.6097686",
"0.60940844... | 0.7296945 | 0 |
Executes the given code block, performing all line related functions with a line width proportional to the current zoom (i.e. in world space) | usingZoomedLineWidth(block) {
this._block = block;
this._oldLineWidth = this.lineWidth;
this.lineWidth *= this.zoom;
this._block();
this.lineWidth = this._oldLineWidth;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function lineSet(){\n HlineSet();\n VlineSet();\n}",
"function start(){\n //Assign the above variables to new Lines with 0 for all arguments.\n \n //Use your setHorizontalLine function with argument half the height\n \n //Use your setVerticleLine function with argument half the width\n \n //Add your hor... | [
"0.60078144",
"0.56378835",
"0.55995315",
"0.55094206",
"0.55094206",
"0.55094206",
"0.5505493",
"0.5493427",
"0.5458384",
"0.543863",
"0.53503823",
"0.53443426",
"0.53007305",
"0.5296208",
"0.52647865",
"0.5258607",
"0.5230712",
"0.52301085",
"0.5221995",
"0.5217647",
"0.521... | 0.5802237 | 1 |
Executes the given code block, performing all text related functions with a font size proportional to the current zoom (i.e. in world space) | usingZoomedFontSize(block) {
this._block = block;
this._oldFontSize = this.fontSize;
this.fontSize *= this.zoom;
this._block();
this.fontSize = this._oldFontSize;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"scaleInPlace(factor) {\n this.fontInfo.size = SmoScoreText.fontPointSize(this.fontInfo.size) * factor;\n }",
"updateBounds() {\n //save context\n this.context.save();\n //apply font size and type\n this.context.font = this.getFont();\n //get width\n this.width = this... | [
"0.6017955",
"0.5841813",
"0.5823299",
"0.57776123",
"0.577535",
"0.5735451",
"0.5705372",
"0.57011807",
"0.56941557",
"0.5681082",
"0.56750387",
"0.5615635",
"0.55888623",
"0.5548818",
"0.55467165",
"0.55290264",
"0.54897857",
"0.5487817",
"0.5470758",
"0.54615194",
"0.54596... | 0.5890378 | 1 |
OTHER FUNCTIONS Scales the canvas context based on the scale factor property. Must be called when changes are made to the canvas scale | applyScale() {
this.context.scale(this.resScaleFactor, this.resScaleFactor);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"changeResolution(canvas, context, scaleFactor) {\n // Set up CSS size if it's not set up already\n if (!canvas.style.width)\n canvas.style.width = canvas.width + 'px';\n if (!canvas.style.height)\n canvas.style.height = canvas.height + 'px';\n\n canvas.width = Math.ceil(canvas.width * sca... | [
"0.75210273",
"0.74383503",
"0.7162032",
"0.6988615",
"0.6973768",
"0.6913831",
"0.69131446",
"0.6861286",
"0.6837304",
"0.6802149",
"0.68007225",
"0.68007225",
"0.68007225",
"0.6722281",
"0.6671176",
"0.6603348",
"0.66032004",
"0.65907544",
"0.6556844",
"0.652219",
"0.650761... | 0.7799658 | 0 |
Returns the current font family | get fontFamily() {
return this._fontFamily;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getFontFamily(ff)\n{\n const start = ff.indexOf('family=');\n if (start === -1) return 'sans-serif';\n let end = ff.indexOf('&', start);\n if (end === -1) end = undefined;\n return ff.slice(start + 7, end);\n}",
"function fontFace(font) {\n return Glamor.fontFace(font);\n }",
"function ... | [
"0.7283446",
"0.7263807",
"0.70764965",
"0.66368777",
"0.6634429",
"0.6535724",
"0.65223074",
"0.6494772",
"0.6257834",
"0.6196366",
"0.6194606",
"0.616845",
"0.6131512",
"0.6109774",
"0.6074726",
"0.60546",
"0.6030533",
"0.58957124",
"0.58532757",
"0.58497036",
"0.5827347",
... | 0.8135345 | 0 |
This function converst a set of inputfields to an array of artists | function inputfieldsArtistsToArray(inputfieldsArtists){
var arrayArtists = []
for(var inputfield of inputfieldsArtists){
arrayArtists.push(inputfield.value)
}
return arrayArtists
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getMainArtists(arrSongs) {\n\tarrSongs.map(function(song){\n\t\tartist = song.artist;\n\t\tfeaturingIndex = artist.search(\" featuring\");\n\t\tif (featuringIndex > 0) {\n\t\t\treturn artist.substring(0, featuringIndex);\n\t\t} else {\n\t\t\treturn artist;\n\t\t}\n\t});\n}",
"function generateArticalArr... | [
"0.5580706",
"0.55491173",
"0.54598176",
"0.53822225",
"0.53644484",
"0.5344775",
"0.52377236",
"0.5201192",
"0.5191361",
"0.51757556",
"0.51370883",
"0.51294255",
"0.51145136",
"0.51003975",
"0.5095367",
"0.50882167",
"0.50351346",
"0.50159913",
"0.50147694",
"0.49941778",
"... | 0.7966591 | 0 |
exercise 5 Print the array as a string do not change the array but print it as a string do not use any array methods | function printArrayAsString(myArray){
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function printArray(array){\n //show me the code!\n return array.join(\",\")\n}",
"function arrayToString(x) { return x.join(''); }",
"function print(arr){\n\n}",
"function arrayToString(array){\n\tvar newString;\n\tnewString = array.toString();\n\treturn newString;\n}",
"function printString(arr) {\n ... | [
"0.71170753",
"0.6932808",
"0.69246465",
"0.691279",
"0.6826059",
"0.6771566",
"0.67603135",
"0.6754528",
"0.67371666",
"0.6669798",
"0.6651222",
"0.66365933",
"0.6635036",
"0.6621428",
"0.6593746",
"0.6572306",
"0.65534323",
"0.6548215",
"0.6518783",
"0.6515946",
"0.6485904"... | 0.7473028 | 0 |
exercise 9 copy the values from myArray into the target array assume the target array has a legnth of zero | function copyArray(myArray, targetArray){
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"moveZeros(array){\n \n }",
"function mapToNoChange(sourceArray) {\n return Array.from(sourceArray)\n}",
"function copyarray(x){\n return x.slice(0);\n}",
"function arrayShift(arr) {\n arr = [5,1,1,7]\n for (var x = 1; x < arr.length; x++) {\n arr[x - 1] = arr[x];\n }\n arr[arr.leng... | [
"0.64723015",
"0.63299596",
"0.6142205",
"0.6017072",
"0.59823644",
"0.58965236",
"0.58965236",
"0.58665687",
"0.58665687",
"0.5863792",
"0.58592975",
"0.58471596",
"0.58265305",
"0.58158165",
"0.58055615",
"0.58018595",
"0.58018595",
"0.579848",
"0.57980794",
"0.57949847",
"... | 0.740966 | 0 |
A random 6 character long string | function sixCharStr() {
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
let result = '';
for (let i = 0; i < 6; i++) {
result += chars.charAt(Math.floor(Math.random() * 36));
}
return result.toUpperCase();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateRandomString() {\n var text = \"\";\n var length = 6;\n\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for(var i = 0; i < length; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return text;\n}",
"function ra... | [
"0.8073106",
"0.80138505",
"0.800888",
"0.7982787",
"0.7978764",
"0.7978764",
"0.79264104",
"0.79044276",
"0.7897397",
"0.78817296",
"0.7874277",
"0.7869779",
"0.7864859",
"0.7853026",
"0.78457314",
"0.78375447",
"0.78375447",
"0.7826854",
"0.7824816",
"0.78204626",
"0.781855... | 0.81486446 | 0 |
Private Methods ////////////////////// Handles animating the maps to the specified region. | _animateTo(lat, long){
// We watch for the initial animation to then
// allow for the redo search button logic
// to be executed.
if(!this.state.initialAnimation){
this.setState({
initialAnimation: INITIAL_ANIMATION_TRUE_BOOL
})
}
this.setState({ isAnimating: IS_ANIMATING... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function animate() {\n\n\n // Request next frame\n\trequestAnimationFrame( animate );\n\n // update Map controls.\n controls.update();\n mouseHover();\n\n renderer.render(scene, camera);\n \n \n}",
"animateToRegion(region) {\n if (this._root != undefined) {\n this._root.animateToRegi... | [
"0.6640925",
"0.6579243",
"0.634352",
"0.6265148",
"0.61213267",
"0.6020962",
"0.58631295",
"0.58607036",
"0.58479017",
"0.584618",
"0.58352506",
"0.5792643",
"0.5786441",
"0.5763789",
"0.5681607",
"0.56815207",
"0.56642073",
"0.56487834",
"0.56369704",
"0.5635426",
"0.562822... | 0.7393381 | 0 |
Handles calculating the distance of two lat/lng points and returns a string with the appropraite distance and unit. | _distanceString(lat1, lon1, lat2, lon2, unit){
let unitString = MILES_UNIT_STRING;
let dist = this._distance(lat1, lon1, lat2, lon2, unit);
if (unit===KILOMETERS_UNIT_STRING) {
unitString = KILOMETERS_UNIT_STRING;
}
return parseInt(dist).toString() + " " + unitString;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_distance(lat1, lon1, lat2, lon2, unit) {\n\n let radlat1 = Math.PI * lat1/180\n let radlat2 = Math.PI * lat2/180\n let theta = lon1-lon2\n let radtheta = Math.PI * theta/180\n // Calcaulte thet distance \n let dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) *... | [
"0.736856",
"0.70347124",
"0.70184296",
"0.70134604",
"0.6990923",
"0.6981574",
"0.6838288",
"0.6814373",
"0.6807587",
"0.67702013",
"0.6766715",
"0.67468756",
"0.6732928",
"0.6730465",
"0.67295617",
"0.6698927",
"0.66833144",
"0.66812444",
"0.66809946",
"0.66696614",
"0.6658... | 0.75742257 | 0 |
Handles returining the lat and lng from a project object. | _extractLocation(project){
let coords = project.location.loc.coordinates;
let lat = coords[1];
let lng = coords[0];
return { lng, lat};
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function project(d) {\n return map.project(new mapboxgl.LngLat(d.long, d.lat));\n }",
"mapboxProject(lngLatZ) {\n const [lng, lat] = lngLatZ;\n const lngLat = new LngLat(lng, lat);\n const point = this.locationPoint(lngLat);\n const {x, y} = point;\n // console.log('Project',... | [
"0.6519763",
"0.64969814",
"0.6425995",
"0.6376194",
"0.6278438",
"0.6121157",
"0.5993955",
"0.59100044",
"0.58983237",
"0.5893222",
"0.5886847",
"0.5880104",
"0.58661014",
"0.58504957",
"0.5831786",
"0.57606494",
"0.5750688",
"0.5723129",
"0.57187855",
"0.57166463",
"0.56833... | 0.76956517 | 0 |
Handles displaying the GPS setting prompt | _platformGpsSettingPrompt(){
this._displayGpsSettingsPrompt(GPS_WARNING_HEADER_STRING, GPS_WARNING_BODY_STRING);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateUserCoordsDisplay() {\n var coordsStr = LAST_KNOWN_LOCATION ? formatCoords(LAST_KNOWN_LOCATION) : 'unknown';\n $('#gps_location').val(coordsStr);\n}",
"_displayGpsSettingsPrompt(header, body){\n\n if(!this.state.showingGpsWarning){\n basicAlert(\n header, \n body,\n ... | [
"0.65595657",
"0.63892823",
"0.6116286",
"0.6039408",
"0.59186435",
"0.59168667",
"0.59168667",
"0.59110767",
"0.58742106",
"0.5865201",
"0.58391666",
"0.5804241",
"0.57723856",
"0.57611656",
"0.5751901",
"0.5749601",
"0.5747239",
"0.5727652",
"0.5721893",
"0.571614",
"0.5715... | 0.8278964 | 0 |
Handles fetching the user GPS location and then fetching the project data by locaton. The users lat and lng is cached, to later calcualte the project to user location distance deltas. | _getDataByGpsLocation(){
// Handle iOS and Android dangerous permissions
Permissions.request(PERMISSION_LOCATION_VALUE).then(response => {
console.log(response);
if(response === PERMISSION_RESPONSE_DENIED_VALUE || response === PERMISSION_RESPONSE_RESTRICTED_VALUE || response === PERMISSION_RESPONSE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getUsersLocation() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(geoLocationSuccess, getLocationError);\n } else {\n getLocationError();\n }\n\n function geoLocationSuccess(position) {\n ... | [
"0.6328187",
"0.6225942",
"0.6166885",
"0.6162069",
"0.6150514",
"0.59973246",
"0.5986925",
"0.59782374",
"0.59633684",
"0.5933832",
"0.59094775",
"0.58515203",
"0.58453643",
"0.58437276",
"0.5808165",
"0.58020085",
"0.5758353",
"0.57516134",
"0.5751156",
"0.5743729",
"0.5739... | 0.7108257 | 0 |
Callback ////////////////////// Handles animating to the marker corresponding to the current page of the project carousel and updating the carousel page indicator. | _onPageChangeEnd(page){
// Check if the currentPage is within bounds of
// of the available project count
if(page < this.props.projects.length){
let loc = this._extractLocation(this.props.projects[page]);
this._animateTo(loc.lat, loc.lng);
this._carouselIndicator.setActivePageIndicator(p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_onMarkerPressed(e){\n \n // Determine the page for the marker.\n // The marker page is determined by\n // the assined indentifier prop\n // for each marker.\n let event = e.nativeEvent;\n let page = parseInt(event.id);\n // Scroll to the page\n this._projectCarousel.goToPage(page);\n ... | [
"0.7207596",
"0.67342865",
"0.5973037",
"0.59145194",
"0.59081364",
"0.5906529",
"0.5796475",
"0.5771152",
"0.577072",
"0.5739271",
"0.573776",
"0.5713084",
"0.5642054",
"0.5629233",
"0.55699617",
"0.5562767",
"0.5556241",
"0.55390686",
"0.5538125",
"0.5524821",
"0.5517631",
... | 0.74271196 | 0 |
Handles on map marker press, when a map marker is pressed the carousel is transitioned to the corresponding page and the map zooms in on the marker. | _onMarkerPressed(e){
// Determine the page for the marker.
// The marker page is determined by
// the assined indentifier prop
// for each marker.
let event = e.nativeEvent;
let page = parseInt(event.id);
// Scroll to the page
this._projectCarousel.goToPage(page);
this._carouse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function markerClick() {\n\t\t// ref - #0. listed at bottom of file\n\t\tpopulateInfoWindow(this, largeInfowindow);\n\t\tanimateMarker(this, defaultIcon, highlightedIcon);\n }",
"locationPress(e, i) {\n \tif (e.key === 'Enter'){\n \t\ti = e.target.dataset.id;\n\t var marker = this.props.markers[i]\n\t ... | [
"0.6700773",
"0.62768394",
"0.62130564",
"0.6184605",
"0.6170637",
"0.6164821",
"0.6150244",
"0.61235714",
"0.61215264",
"0.60431784",
"0.60407305",
"0.6030977",
"0.6025552",
"0.59975994",
"0.5987171",
"0.59819376",
"0.59807307",
"0.5977151",
"0.59621614",
"0.59416276",
"0.59... | 0.78445166 | 0 |
Handles on region changes The method handles the logic for when the redo search button should be shown. | _onRegionChangeComplete(region){
if(this.props.projects.length > 0){
let lat = region.latitude;
let lng = region.longitude;
let distanceDelta = this._distance(this._currentRegionLat, this._currentRegionLng, lat, lng);
let loc = this._extractLocation(this.props.projects[0]);
//... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handleRegionChanged(region) {\n\t\tsetCurrentRegion(region);\n\t}",
"function changeEditedRegion() {\n try {\n let value = settings.get(regionField.selectedItem + '-region');\n let region;\n if (value == null) {\n value = '';\n region... | [
"0.7071393",
"0.66109294",
"0.6566004",
"0.6516217",
"0.6467299",
"0.6373741",
"0.6306954",
"0.6272541",
"0.62711966",
"0.6190524",
"0.61510545",
"0.60125005",
"0.5897811",
"0.5891666",
"0.58717775",
"0.5866046",
"0.5791867",
"0.57151175",
"0.5679652",
"0.56182057",
"0.557001... | 0.691203 | 1 |
Handles on the redo button press. The method executes the refetch of projects relative to the current region. | _onRedoSearchPress(){
this.setState({
redoSearchVisible: REDO_SEARCH_VISIBLE_FALSE_BOOL,
initialAnimation: INITIAL_ANIMATION_FALSE_BOOL
})
this.props.clearProjectData();
this.props.getProjectsByLocation(this._currentRegionLat, this._currentRegionLng , this.state.radius, PROJECT_FETCH_LIMIT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_onRegionChangeComplete(region){\n\n if(this.props.projects.length > 0){\n\n let lat = region.latitude;\n let lng = region.longitude;\n let distanceDelta = this._distance(this._currentRegionLat, this._currentRegionLng, lat, lng);\n let loc = this._extractLocation(this.props.projects[0]);\n ... | [
"0.6480318",
"0.6319107",
"0.6121201",
"0.59881043",
"0.5939177",
"0.59260476",
"0.59223056",
"0.58944505",
"0.58601254",
"0.5804819",
"0.5679468",
"0.5643688",
"0.5626231",
"0.5585741",
"0.55704874",
"0.5550756",
"0.55163187",
"0.55138034",
"0.5483287",
"0.54175943",
"0.5410... | 0.67211485 | 0 |
Life Cycle ////////////////////// Handles removing the app state listener | componentWillUnmount() {
AppState.removeEventListener(APP_STATE_CHANGE_STRING, this._handleAppStateChange);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"componentWillUnmount() {\n AppState.removeEventListener('change', this._handleAppStateChange);\n }",
"componentWillUnmount() {\n //Garbage collection\n AppState.removeEventListener('change', this._handleAppStateChange);\n }",
"componentWillUnmount() {\n AppState.removeEventLis... | [
"0.7434035",
"0.7316754",
"0.7251199",
"0.69359666",
"0.69359666",
"0.69359666",
"0.6796396",
"0.6751369",
"0.6747643",
"0.66731346",
"0.6582609",
"0.65746325",
"0.6564617",
"0.6545172",
"0.654162",
"0.65401727",
"0.6538303",
"0.65307105",
"0.65289396",
"0.651834",
"0.650626"... | 0.73281294 | 1 |
When a service call is made to fetch projects the redux state is updated and rererenders. This calls for an animation to the first project in the newly fetched data. | componentDidUpdate(){
if(this.props.projects.length > 0 && !this.state.initialAnimation){
let loc = this._extractLocation(this.props.projects[0]);
// Animate to the first project marker
this._animateTo(loc.lat, loc.lng);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"componentDidMount() {\n // Dispatch action to request the projects from the API\n this.getProjectList();\n }",
"function getProjects() {\n $.get(\"/api/projects\", function(data) {\n projects = data;\n displayProj(projects);\n });\n }",
"displayProject(projects, projectName) {... | [
"0.6207719",
"0.61686075",
"0.6167278",
"0.6139191",
"0.61298966",
"0.6082164",
"0.6004856",
"0.59990376",
"0.598617",
"0.59826165",
"0.59329873",
"0.59266216",
"0.58979917",
"0.5893791",
"0.5886053",
"0.58854955",
"0.58779764",
"0.586851",
"0.58595717",
"0.5845855",
"0.58068... | 0.65289813 | 0 |
end level menu options | function endLevelMenuFunc(id : int){
var buttonHeight = 88;
GUI.skin = buttonSkin;
if (!lastLevel && gameWon){
if(GUILayout.Button("Next Level", GUILayout.Height(buttonHeight))){
AudioSource.PlayClipAtPoint(audioClick, transform.position);
gameWon = false;
Application.LoadLevel("Level2");
}
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function ECMS_end_menu() {\n\tif (ECMS_menu_tree[ECMS_menu_tree_index]) {\n\t\t// root node exists, continue\n\t\tECMS_PF_create_menu(ECMS_menu_tree[ECMS_menu_tree_index]);\n\t\tECMS_menu_tree_index++;\n\t}\n}",
"function goToLevelSelect() {\n\tmenuLayer.active = false;\n\tlevelSelectLayer.active = true;\n}",
... | [
"0.70886743",
"0.6759067",
"0.6522239",
"0.6516828",
"0.6385137",
"0.6332257",
"0.6331929",
"0.62192935",
"0.6201699",
"0.6180547",
"0.61718005",
"0.6156327",
"0.61441725",
"0.61079633",
"0.60880375",
"0.60745305",
"0.6061831",
"0.60538876",
"0.6009576",
"0.60060525",
"0.6000... | 0.6762327 | 1 |
updates the variable which saves the highest level reached by the user, if needed | function UpdateMaxLevelReached(){
var oldMaxLevelReached = PlayerPrefs.GetInt("maxLevelReached");
if(oldMaxLevelReached == currentLevel){
PlayerPrefs.SetInt("maxLevelReached", oldMaxLevelReached + 1);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get maxLevel() { return 6 }",
"checkLevel(userData, callback) {\n var level = Math.floor(((userData['xp'] - 500) / 400) + 1)\n if(level === 0)\n level = 1\n\n if(level > maxLevel)\n level = maxLevel\n\n callback(level)\n }",
"updateLevel() {\n this.level ... | [
"0.72767055",
"0.69923306",
"0.6896602",
"0.686377",
"0.6823528",
"0.68192655",
"0.6765882",
"0.6692244",
"0.66301566",
"0.6592365",
"0.6592276",
"0.65840536",
"0.65763026",
"0.6576251",
"0.65088207",
"0.6490191",
"0.6485783",
"0.6469033",
"0.6429005",
"0.63657856",
"0.634278... | 0.7553487 | 0 |
sets the light back to its normal state | function backToNormalLight(){
pointLight.color = Color.white;
pointLight.intensity = pointLight.intensity/2;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function changeState(){\n lightOn = !lightOn;\n}",
"function turnLightOff() {\n \n lightOn = false;\n \n // enable the turn light on button\n enableTurnLightOnButton(true);\n \n // disable the turn light off button\n enableTurnLightOffButton(false);\n \n /*\n * set this flag ... | [
"0.73422736",
"0.7323008",
"0.7033137",
"0.69756436",
"0.6798367",
"0.66892695",
"0.6624188",
"0.6595269",
"0.6568811",
"0.6519665",
"0.65024465",
"0.64503396",
"0.64297587",
"0.6415096",
"0.6404141",
"0.6400832",
"0.6363036",
"0.63486534",
"0.63405466",
"0.6325187",
"0.63021... | 0.7367685 | 0 |
/ SearchView provides observer independent data handling and communication capability / using get, post and find calls to a hosted web service and gets typed content / objects SearchView extends functionality from ObjectView. / SearchView is extract and present only CRUD component, this means its useful / when informat... | function SearchView(options) {
var instance = (options.instance !== null && options.instance !== undefined) ? options.instance : this;
var extender = new InstanceExtender();
if (options.instance === null || options.instance === undefined) {
instance = extender.extendNewInstance({ 'instance': in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"searchObject(query, object, searchFields)\t{ return this._behavior('search object', query, object, searchFields); }",
"function MailSearchView() {\n ListView.apply(this, arguments);\n }",
"renderSearch() {\n const searchContainer = this.searchContainer;\n const searchComponent = new Search({\n ... | [
"0.6466221",
"0.62402177",
"0.5856741",
"0.57632047",
"0.57308125",
"0.56809646",
"0.56809646",
"0.56349623",
"0.56339157",
"0.56244147",
"0.5623622",
"0.5618274",
"0.56140363",
"0.560938",
"0.556989",
"0.556989",
"0.556989",
"0.556989",
"0.55562365",
"0.5507604",
"0.5485803"... | 0.79691243 | 0 |
Initialize the main menu editor widget. | _initEditor() {
// The menu editor class encapsulates a lot of logic already (especially drag-and-drop
// behavior), however, we have to connect to several signals to wire everything up.
this._editor = this._builder.get_object('menu-editor');
// If an item is selected, we update the settings sidebar a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"initMenu() {\n this.setVariable('renderer', this.renderer, true);\n this.setVariable('collapsible', this.collapse, true);\n this.setVariable('explorer', this.explore, true);\n\n this.menuVariable('explorer').registerCallback(() => {\n this.explore = this.doc.menu.settings.exp... | [
"0.70216113",
"0.6844303",
"0.67352146",
"0.6731391",
"0.67255396",
"0.6645497",
"0.660387",
"0.6508655",
"0.6497792",
"0.64793414",
"0.6455254",
"0.6436987",
"0.64189243",
"0.6399573",
"0.63261575",
"0.6323593",
"0.63025594",
"0.6299242",
"0.6236328",
"0.6137302",
"0.6131324... | 0.7643145 | 0 |
Overrides the currently displayed tip in the infolabel with the given text. After several seconds, a new random tip will be shown. | _showInfoLabel(text) {
// Clear any pending timeouts.
if (this._infoLabelTimeoutA) {
GLib.source_remove(this._infoLabelTimeoutA);
this._infoLabelTimeoutA = null;
}
if (this._infoLabelTimeoutB) {
GLib.source_remove(this._infoLabelTimeoutB);
this._infoLabelTimeoutB = null;
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateTips(t) {\n tips.text(t).addClass(\"ui-state-highlight\");\n setTimeout(function() {\n tips.removeClass(\"ui-state-highlight\", 1500);\n }, 500);\n}",
"function placeTip() {\n var random = Math.floor(Math.random() * tips.length);\n var randTip = tips.splice(random, 1)... | [
"0.6620868",
"0.642438",
"0.62882507",
"0.62148124",
"0.61958706",
"0.61745775",
"0.61364764",
"0.6134472",
"0.6130313",
"0.60966736",
"0.60869443",
"0.6054401",
"0.6054401",
"0.6054401",
"0.6016167",
"0.60101396",
"0.59717816",
"0.59045744",
"0.5868008",
"0.5789767",
"0.5747... | 0.76987904 | 0 |
If index =menuPath.length, nothing will happen. For all indices between, the corresponding menu will be opened in the editor and the previously opened child menu will be selected. | _gotoMenuPathIndex(index) {
if (index + 1 >= this._menuPath.length) {
return;
}
// Got to the menu overview.
if (index < 0) {
// Make the previously edited menu the selected child.
let selectedIndex = -1;
if (this._menuPath.length > 0) {
this._selectedItem = this._menuP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"selectItem(path) {\n\n // Check whether a menu is currently visible.\n if (this._menuID == null) {\n return DBusInterface.errorCodes.eNoActiveMenu;\n }\n\n // The path should start with a '/'.\n if (path.length == 0 || path[0] != '/') {\n return DBusInterface.errorCodes.eInvalidPath;\n ... | [
"0.65310544",
"0.62442595",
"0.6229856",
"0.6113725",
"0.61117786",
"0.60417676",
"0.5995572",
"0.5995572",
"0.59886724",
"0.5959773",
"0.59430474",
"0.5927156",
"0.5925452",
"0.5915583",
"0.5893467",
"0.5855267",
"0.5818959",
"0.580889",
"0.5754259",
"0.57505196",
"0.5749395... | 0.797445 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.