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 |
|---|---|---|---|---|---|---|
This method enchants the scope, applying the macro's enchantment's classes to the matched elements. | enchantScope() {
const {attr, data, functions, section, changer} = this;
let {scope} = this;
/*
scope could be a jQuery, if this is a HTML scope created by, say, (enchant: "<i>"). In which
case, convert it to an array for the purposes of this method.
*/
if (scope instanceof $) {
scope = Array... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addCodeClasses() {\n $(activeElement).find('font').addClass('proper-code');\n }",
"enterClassClauseTo(ctx) {\n\t}",
"enterClassClause(ctx) {\n\t}",
"enterClassClauseThrough(ctx) {\n\t}",
"ClassBody() {\n classScopes.push(true);\n }",
"enterClassClauseFrom(ctx) {... | [
"0.5635625",
"0.5535627",
"0.5506361",
"0.5305473",
"0.4979745",
"0.49744552",
"0.48947477",
"0.48056322",
"0.46783212",
"0.46647754",
"0.4608408",
"0.46029004",
"0.45899293",
"0.45866665",
"0.45759186",
"0.4564722",
"0.4557412",
"0.45547003",
"0.45547003",
"0.45547003",
"0.4... | 0.67099303 | 0 |
This method removes the enchantment wrappers installed by enchantScope(). This is called by Section whenever the scope's DOM may have been changed, so that enchantScope() can then select the newly selected regions. | disenchant() {
/*
Clear all existing <tw-enchantment> wrapper elements placed by
the previous call to enchantScope().
*/
this.enchantments.each(function() {
const c = $(this).contents();
c.unwrap();
/*
Undo the preceding CSS "inherit" kludge for <tw-story>.
*/
const enchantedPr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"destroy() {\n for (const editor of this.#editors.values()) {\n editor.isAttachedToDOM = false;\n editor.div.remove();\n editor.parent = null;\n this.div = null;\n }\n this.#editors.clear();\n this.#uiManager.removeLayer(this);\n }",
"destroy() {\n if (this.#uiManager.getActive... | [
"0.6185335",
"0.61181945",
"0.59376186",
"0.5663701",
"0.55935884",
"0.55935884",
"0.55935884",
"0.5560228",
"0.554872",
"0.5540174",
"0.5539271",
"0.5539271",
"0.5520706",
"0.55010283",
"0.55010283",
"0.5476973",
"0.5451685",
"0.5416847",
"0.5416847",
"0.5404546",
"0.5381298... | 0.6513406 | 0 |
Helper method to register cloud hooks for current collection | static registerCloudHooks() {
Parse.Cloud.beforeSave('Landmark', (request, { success, error }) =>
Landmark.beforeSaveHandler(request).then(success).catch(error)
);
Parse.Cloud.afterDelete('Landmark', (request, { success, error }) =>
Landmark.afterDeleteHandler(request).then(success).catch(error)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _applyHookFunctions(collection) {\n if (hooksApplied) return; // already run\n\n hooksApplied = true;\n var colProto = Object.getPrototypeOf(collection);\n HOOKS_KEYS.forEach(function (key) {\n HOOKS_WHEN.map(function (when) {\n var fnName = when + ucfirst(key);\n\n colProto[fnName] = fun... | [
"0.6480858",
"0.6134398",
"0.6023812",
"0.6020765",
"0.5997129",
"0.59905255",
"0.58435655",
"0.57034856",
"0.57012093",
"0.56434137",
"0.5636818",
"0.56337273",
"0.5528152",
"0.55242175",
"0.5483087",
"0.5471022",
"0.5407079",
"0.5398592",
"0.5342825",
"0.5323379",
"0.532016... | 0.69457495 | 0 |
function _all() Parameters: void Return values: Closurescoped array articles Behavior: Getter function. Returns articles. | function _all() {
return db.any('SELECT * FROM $1~;', ['articles'])
.then( (data) => {
return data;
})
.catch( (error) => {
console.log('all() ' + error);
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getArticlesAll(){\n var title = getArticlesTitle()\n var href = getArticlesHref()\n var account_name = getArticles_AccountName()\n var account_href = getArticles_AccountHref()\n var summary = getArticlesSummary()\n var view = getArticlesView()\n var time = getArticlesTime()\n\n var... | [
"0.6878419",
"0.68621224",
"0.6598874",
"0.64191675",
"0.6342996",
"0.63406515",
"0.6302313",
"0.62716603",
"0.62716603",
"0.62694675",
"0.62153405",
"0.6202602",
"0.61755264",
"0.6166764",
"0.6142697",
"0.6003474",
"0.5994809",
"0.5990538",
"0.59846807",
"0.5978299",
"0.5968... | 0.76144797 | 0 |
function _getByTitle(urlTitle) Parameters: The urlTitle of an article. Return values: The article object OR false (not found) Behavior: Uses _indexOfArticle() to find an article object in the _articles array and return it. | function _getByTitle(urlTitle) {
const title = decodeURIComponent(urlTitle);
return db.any(`SELECT * FROM $1~ WHERE title = $2;`, ['articles', title])
.then( (data) => {
return data;
})
.catch( (error) => {
return false;
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function titleArticle(title){\n for(let i = 0; i < catalog.length; i++){\n if(catalog[i].title === title){\n article = catalog[i];\n }\n }\n console.log(article);\n return article;\n }",
"function getArticle(title, callback) {\n var url = \"https://en.wikipedia.org/w/api.php?\" +... | [
"0.66063297",
"0.6180034",
"0.6135076",
"0.6131527",
"0.61305195",
"0.6122416",
"0.60029864",
"0.6002056",
"0.583291",
"0.5665282",
"0.55711776",
"0.55303746",
"0.5508238",
"0.5451919",
"0.54416084",
"0.54024756",
"0.53872144",
"0.5352409",
"0.5341463",
"0.528527",
"0.5283585... | 0.82461035 | 0 |
function _editArticle(newArticleProps) Parameters: New article properties. NOTE: Title is required! Return values: true (if the function was performed successfully) OR false (if the function was NOT performed successfully) Behavior: Uses _indexOfArticle() to find the index of an object in _articles. This object is spli... | function _editArticle(article) {
article.title = decodeURIComponent(article.title);
return db.none('UPDATE $1~ ' +
'SET author = $2, content = $3 ' +
'WHERE articles.title = $4;', ['articles', article.author, article.body, article.title])
.then( (data) => {
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function editArticle(id) {\r\n\t$.post(\"index.php\", {\"mod\": \"admin\", \"action\": \"editArticle\", \"id\": id}, function(result){\r\n\t\tresult = strToJson(result);\r\n\t\tif(result.code == 1) {\r\n\t\t\tvar title = result.data.title;\r\n\t\t\tvar box = result.data.box;\r\n\t\t\t$(\"#editArticles_title\").val... | [
"0.5682279",
"0.5586084",
"0.5482962",
"0.5472097",
"0.54140955",
"0.53472936",
"0.53124523",
"0.53057575",
"0.5286246",
"0.5239986",
"0.5204915",
"0.5191945",
"0.5141779",
"0.51376075",
"0.5087983",
"0.5057607",
"0.50437146",
"0.50264245",
"0.5017737",
"0.5008114",
"0.500458... | 0.7156271 | 0 |
function _deleteByTitle(urlTitle) Parameters: The urlTitle of an article. Return values: true (if the function was performed successfully) OR false (if the function was NOT performed successfully) Behavior: Uses _indexOfArticle() to find the index of an object in _articles. This object is spliced out. | function _deleteByTitle(urlTitle) {
title = decodeURIComponent(urlTitle);
return db.none(`DELETE FROM $1~ WHERE articles.title = $2;`, ['articles', title])
.then( (data) => {
return true;
})
.catch(function(error) {
return false;
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function delete_category(title){\r\n\ttitle = (title || req.data.title);\r\n\tvar category = this.get_categories([title])[0];\r\n\tif(!category){\r\n\t\treturn false;\r\n\t}\r\n\tcategory._parent.remove(category);\r\n\treturn true;\r\n}",
"function _getByTitle(urlTitle) {\n const title = decodeURIComponent(ur... | [
"0.64869183",
"0.64511096",
"0.616396",
"0.5846067",
"0.5648879",
"0.55795735",
"0.5563528",
"0.5458494",
"0.54036117",
"0.5395483",
"0.5355661",
"0.5339491",
"0.53299457",
"0.5300752",
"0.5295267",
"0.52745587",
"0.525428",
"0.5237415",
"0.5204693",
"0.5193744",
"0.517949",
... | 0.8779541 | 0 |
Helper functions: Convert columnrow position into xy coordinates, and vice versa Return the xcoordinate starting the given column. | function columnToX(col) {
return col * 101;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getPosition(row, column){\r\n return {\r\n x : column * cellSize.width + cellPadding.left,\r\n y : row * cellSize.height + cellPadding.top\r\n };\r\n }",
"function getCoordinate(row, col) {\n\tvar index = 0;\n\tfor(var i = 0; i < row; i++) {\n\t\tif(i < 4) {\n\t\t\... | [
"0.67755485",
"0.67030585",
"0.6355732",
"0.62659985",
"0.62133276",
"0.6196639",
"0.6116407",
"0.6044491",
"0.60319805",
"0.60233223",
"0.60016775",
"0.5996101",
"0.59463024",
"0.59447354",
"0.59376585",
"0.5923438",
"0.5899523",
"0.5894957",
"0.5878546",
"0.58714426",
"0.58... | 0.7189981 | 0 |
Return the ycoordinate starting the given row. | function rowToY(row) {
// Minus an offset where an enemy or player's sprite should be drawn
return row * 83 - 20;
// return row * 83 ;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getPixelYCoordinate() {\n return map(this.y, -1, 1, height, 0);\n }",
"getRow(y) {\n return this.state[y]\n }",
"$rowToRowIndex(row) {\n for (var i = 0; i < this.lines.getLength(); i++){\n var cell = this.lines.get(i);\n if (cell.row == row)\n return i;... | [
"0.64177984",
"0.63931704",
"0.6287049",
"0.62084574",
"0.61893594",
"0.6181415",
"0.61282605",
"0.6114409",
"0.60227025",
"0.6019392",
"0.599465",
"0.5980628",
"0.59513706",
"0.59275305",
"0.5884571",
"0.585372",
"0.58363116",
"0.58251363",
"0.5823065",
"0.5820525",
"0.57965... | 0.7377634 | 0 |
Revision: SW 12/5/13 Description: uses global counter to bring last pressed element to the top zindex Parameters: element to set zindex | function zIndexControl(elem) {
zIndexCount++;
elem.css("z-index", zIndexCount);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"incrementZindex () {\n this._highestZindex++\n }",
"function updateZindex(){\r\n\t\t\r\n\t\t// The CSS method can take a function as its second argument.\r\n\t\t// i is the zero-based index of the element.\r\n\t\t\r\n\t\tul.find('li').css('z-index',function(i){\r\n\t\t\treturn cnt-i;\r\n\t\t});\r\n\t}",
"f... | [
"0.7526713",
"0.7340405",
"0.6882007",
"0.6681178",
"0.66675144",
"0.66600263",
"0.6633889",
"0.6559155",
"0.6525361",
"0.65201724",
"0.65201724",
"0.65201724",
"0.65051854",
"0.65051854",
"0.65051854",
"0.65051854",
"0.65046895",
"0.6469452",
"0.64465034",
"0.64465034",
"0.6... | 0.74850464 | 1 |
Parses the query as we build it locally and creates an appropriate post for the server | function parseQuery(ref){
var source = ref.source;
var study = ref.study;
var task = ref.task;
var sortstudy = ref.sortstudy;
var sorttask = ref.sorttask;
var sortgroup = ref.sortgroup;
var sorttime = ref.sorttime;
var showE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function parseQuery(ref){\n var source = ref.source;\n var study = ref.study;\n var task = ref.task;\n var sortstudy = ref.sortstudy;\n var sorttask = ref.sorttask;\n var sortgroup = ref.sortgroup;\n var sorttime = ref.sorttime;\n ... | [
"0.68506867",
"0.679317",
"0.6783459",
"0.59176505",
"0.586697",
"0.57297593",
"0.56993973",
"0.56699353",
"0.5643092",
"0.5593833",
"0.55753183",
"0.5571115",
"0.55063736",
"0.5501374",
"0.5487494",
"0.5476794",
"0.54736245",
"0.5453305",
"0.54049104",
"0.53900695",
"0.53540... | 0.6857241 | 0 |
create an array including file and all its children | function spreadFile(file){
var children = ensureArray(file.files).map(spreadFile);
return [file].concat(children);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function spreadFile(file){\n var children = ensureArray(file.files).map(spreadFile);\n return [file].concat(children);\n }",
"function spreadFile(file){\n var children = ensureArray(file.files).map(spreadFile);\n return [file].concat(children... | [
"0.66925746",
"0.66925746",
"0.6658312",
"0.62726736",
"0.61477387",
"0.6013221",
"0.5980496",
"0.58713275",
"0.5849183",
"0.58423865",
"0.58395535",
"0.581656",
"0.5746257",
"0.57313406",
"0.5696054",
"0.560379",
"0.5601539",
"0.5591929",
"0.55728644",
"0.5559431",
"0.555559... | 0.6856852 | 1 |
Renders the artifact dialog if it is open, and the child component. All props are passed to the child component. | render() {
const { Container, componentProps } = this.props;
const { showArtifact, currentArtifact } = this.state;
const artifactDialog = showArtifact ? (
<Artifact open={showArtifact} onClose={this.hideArtifact} artifact={currentArtifact} />
) : (
<div />
);
return (
<React.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function withArtifactDialog(component) {\n return props => <ArtifactDialogWrapper Container={component} componentProps={props} />;\n}",
"render() {\n const { viewType } = this.props;\n\n return (\n <div>\n <MaterialDialog title=\"Pie chart\" open={this.props.showCompleteV... | [
"0.6954848",
"0.62634844",
"0.5652628",
"0.5613306",
"0.5499921",
"0.5476037",
"0.5460737",
"0.5450058",
"0.5445344",
"0.54351014",
"0.5404284",
"0.5404213",
"0.5384711",
"0.5380685",
"0.535329",
"0.5348418",
"0.5296802",
"0.527293",
"0.52378476",
"0.5228116",
"0.52254134",
... | 0.78587323 | 0 |
Produces a new component that is equal to the specified component wrapped with a component that displays an artifact dialog when the child's `onArtifactClick` handler is called. | function withArtifactDialog(component) {
return props => <ArtifactDialogWrapper Container={component} componentProps={props} />;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"render() {\n const { Container, componentProps } = this.props;\n const { showArtifact, currentArtifact } = this.state;\n\n const artifactDialog = showArtifact ? (\n <Artifact open={showArtifact} onClose={this.hideArtifact} artifact={currentArtifact} />\n ) : (\n <div />\n );\n\n return ... | [
"0.7437248",
"0.53103864",
"0.52525437",
"0.52397215",
"0.5172023",
"0.51634634",
"0.51634634",
"0.51634634",
"0.51634634",
"0.51634634",
"0.51244944",
"0.507852",
"0.50125414",
"0.50119275",
"0.49737573",
"0.48734295",
"0.48715338",
"0.48712212",
"0.4861931",
"0.4859016",
"0... | 0.73380667 | 1 |
11. Create a function that accepts an argument `val`. The function should convert `val` to a string, then drop the first character off the string, but only if there is more than one character in the string. Return `val` and set the `majorKey` to the returned value. | function funcA(val){
val = val.toString();
if(val.length>1){
val = val.substr(1);
}
return val;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function stringShortener(val) {\nval = val.toString()\n while (val.length>1) {\n val = val.replace(val[0], \"\");\n }\nreturn val\n}",
"function keepFirst(str){\n return str.substring(0,2)\n}",
"function cutFirst(arg) {\n return arg.substring(2, arg.length);\n}",
"function keepFirst(s){\n ... | [
"0.57969743",
"0.5766988",
"0.57061446",
"0.5441925",
"0.5337801",
"0.53203964",
"0.52322483",
"0.518676",
"0.51791215",
"0.51588756",
"0.515134",
"0.51409614",
"0.51292104",
"0.5078761",
"0.50602496",
"0.5016493",
"0.50160825",
"0.49954197",
"0.49928242",
"0.49745336",
"0.49... | 0.6469274 | 0 |
private function refreshes a component list | function _refreshList(component) {
if (_contest[component].length === 0) {
view.contest[component].sayEmpty();
return;
}
// pick resources
var resources = component === "brains" ? BRAINS : WORLDS;
// get and clear view list
var v = view.contest[component];
v.clear();
// now populate it
for (va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"refreshList() {\r\n this.currentProdotto = undefined;\r\n this.currentIndex = -1;\r\n this.retrieveProdotti();\r\n }",
"function refreshChildComponents(components) {\n if (components != null) {\n for (var i = 0; i < components.length; i++) {\n componentRefresh(compone... | [
"0.7040795",
"0.6960827",
"0.6960827",
"0.69571835",
"0.69545305",
"0.6913193",
"0.6913193",
"0.6913193",
"0.6913193",
"0.6913193",
"0.6913193",
"0.6913193",
"0.6913193",
"0.6913193",
"0.6913193",
"0.6799603",
"0.6745827",
"0.67428744",
"0.6658264",
"0.66505575",
"0.6626276",... | 0.75549877 | 0 |
Fetches the time entries from the static JSON file and puts the results on the vm.timeentries | function getTimeEntries() {
time.getTime().then(function(results) {
vm.timeentries = results;
updateTotalTime(vm.timeentries);
console.log(vm.timeentries);
}, function(error) {
console.log(error);
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getTimeEntries() {\n time.getTime().then(function(results) {\n vm.timeentries = results;\n updateTotalTime(vm.timeentries);\n console.log(vm.timeentries);\n }, function(error) {\n console.log('Erro ao... | [
"0.76729345",
"0.6766274",
"0.66127646",
"0.60037875",
"0.59794205",
"0.5918877",
"0.58053887",
"0.5765849",
"0.57086396",
"0.56422466",
"0.56290996",
"0.5624686",
"0.5624328",
"0.55719155",
"0.55566746",
"0.5539668",
"0.5506622",
"0.54987353",
"0.5495514",
"0.5483709",
"0.54... | 0.7372413 | 1 |
Update the values in the total time box by calling the getTotalTime method on the time service | function updateTotalTime(timeentries) {
vm.totalTime = time.getTotalTime(timeentries);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updateTotalTime(timeEntries){\n\t\t\t\tvm.totalTime = time.getTotalTime(timeEntries);\n\t\t\t}//end updateTotalTime",
"function update() {\n var timePassed = delta();\n time += timePassed; \n formattedTime = timeFormatter(time); // redundant\n ss.storage[naming(tab)][\"timeSp... | [
"0.7998386",
"0.7206404",
"0.70075226",
"0.685555",
"0.68168515",
"0.68168104",
"0.67817444",
"0.67664367",
"0.673558",
"0.6722308",
"0.66660964",
"0.66477156",
"0.6639308",
"0.66323453",
"0.6624063",
"0.65778786",
"0.6564375",
"0.6540871",
"0.6537737",
"0.65365934",
"0.65347... | 0.8009397 | 1 |
Start Yahoo mail signature code | function yahooSig() {
var sendSpan = $("span[data-action='send']");
if (sendSpan.length > 0) {
if (flag) {
flag = false;
sendSpan.unbind("click").click(function () {
$("#rtetext").html(sig + $("#rtetext").html()); ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onSigFile( responseDetails ){\t\r\n\tif( !checkText( bodyArea.value, responseDetails.responseText ) ){ // check message box doesn't already contain sig\r\n\t\tvar sig = parseSig( responseDetails.responseText, arrCurrentTrackData );\r\n\t\tinsertSig( sig );\r\n\t}\r\n}",
"function authCallbackYahoo(reque... | [
"0.5350522",
"0.53265643",
"0.52117264",
"0.513741",
"0.512325",
"0.5086106",
"0.50482553",
"0.5043937",
"0.50051606",
"0.49944338",
"0.49853802",
"0.4985343",
"0.4985117",
"0.49586868",
"0.49273273",
"0.4900477",
"0.4873975",
"0.48591286",
"0.48357567",
"0.482567",
"0.482291... | 0.5933505 | 0 |
End Gmail mail signature /Start Hotmail | function HotmailSig() {
$ = jQuery.noConflict();
var msg = $("#ComposeRteEditor_surface");
var sendbtn = $("#SendMessage");
sendbtn.unbind("click").click(function () {
var msg = $("#ComposeRteEditor_surface");
var bodymessage = msg.contents().find("body");
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function main() {\n// logger([\"function started\"])\n // Get all of the messages from your inbox\n var ChaseMailThreads = ChaseMail.getThreads();\n \n // cycle through each one and check it for the subject line \n logger([\"Found threads\",ChaseMailThreads.length]);\n for (var i = 0 ; i < ChaseMailThreads.... | [
"0.5697261",
"0.5654429",
"0.5506933",
"0.544618",
"0.53965014",
"0.53903264",
"0.53558666",
"0.5271983",
"0.5270561",
"0.52312976",
"0.52232057",
"0.51978225",
"0.51810384",
"0.5166749",
"0.51571226",
"0.51433843",
"0.51392055",
"0.5132284",
"0.5132284",
"0.51098204",
"0.507... | 0.57592046 | 0 |
Convert an index into the string into line/column for use in error messages As such, this doesn't have to be efficient. | function indexToLineAndColumn(text, index) {
var lines = text.split(/\n/g);
for (var i=0; i < lines.length; i++) {
var line=lines[i];
if (index >= line.length) {
index -= line.length;
} else {
return { line: i + 1, column: index + 1 };
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function updatePosition(str) {\n\t var lines = str.match(/\\n/g);\n\t if (lines) lineno += lines.length;\n\t var i = str.lastIndexOf('\\n');\n\t column = ~i ? str.length - i : column + str.length;\n\t }",
"function updatePosition(str) {\n var lines = str.match(/\\n/g);\n if (lines) lineno += l... | [
"0.60255843",
"0.5989244",
"0.5989244",
"0.5989244",
"0.5989244",
"0.5989244",
"0.5989244",
"0.5989244",
"0.5989244",
"0.5989244",
"0.5989244",
"0.5970028",
"0.5967322",
"0.59599286",
"0.59599286",
"0.5938246",
"0.59368753",
"0.57982415",
"0.5786266",
"0.5611615",
"0.5611615"... | 0.6723285 | 0 |
NOTE: ADVANCED_OPTIMIZATIONS mode. This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using constructs incompatible with that mode. / global $interpolateMinErr: false / global indexToLineAndColumn: false / global InterpolationParts: false / global PluralMessage: false / global SelectM... | function copyNestedParserState(src, dst) {
dst.expressionFn = src.expressionFn;
dst.expressionMinusOffsetFn = src.expressionMinusOffsetFn;
dst.pluralOffset = src.pluralOffset;
dst.choices = src.choices;
dst.choiceKey = src.choiceKey;
dst.interpolationParts = src.interpolationParts;
dst.ruleChoiceKeyword =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_parse () {\n\t\t// Try to extract a list of top-level statements/declarations. If\n\t\t// the parse fails, attach file info and abort\n\t\tlet ast;\n\n\t\ttry {\n\t\t\tast = parse( this.source, {\n\t\t\t\tecmaVersion: 6,\n\t\t\t\tsourceType: 'module',\n\t\t\t\tonComment: ( block, text, start, end ) => this.commen... | [
"0.56591946",
"0.5232505",
"0.5215162",
"0.51892453",
"0.51812124",
"0.5077117",
"0.50737727",
"0.50737727",
"0.50737727",
"0.50737727",
"0.50737727",
"0.50737727",
"0.50737727",
"0.50737727",
"0.50737727",
"0.5056277",
"0.5049701",
"0.5042765",
"0.5042765",
"0.5042765",
"0.5... | 0.6458679 | 0 |
Fetch the STOMP endpoint from the melis discover server | function fetchStompEndpoint(self) {
var discoveryUrl = self.apiDiscoveryUrl
logger.log("Discovering STOMP endpoint using: ", discoveryUrl)
return fetch(discoveryUrl, {
headers: { "user-agent": "melis-js-api/" + C.CLIENT_API_VERSION }
}).then(function (res) {
if (res.status !== 200)
throw new Melis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"discoverServer() {\n this.uri = 'tone-wfe.cern.ch';\n this.saveServerList(initialServerList);\n this.saveServerListFromServer();\n }",
"function getDataEndpoint () {\n return endpoint;\n}",
"function getInfo(){\n return sendWS({\n action : `server/info`\n })\n .then(messageData => messageDat... | [
"0.5966046",
"0.551539",
"0.55145186",
"0.5478455",
"0.5420291",
"0.53775424",
"0.5310588",
"0.5272231",
"0.52582806",
"0.51486856",
"0.512324",
"0.50725853",
"0.50566614",
"0.5041208",
"0.5041001",
"0.50368106",
"0.499813",
"0.4989081",
"0.49816307",
"0.49519506",
"0.4942871... | 0.8262091 | 0 |
Calculates the student and faculty id ranges from the configured id template | calcIDRangeFromTemplate() {
//If the user has selected manual mode or no assignment is selected, skip the calculation
if (this.manualMode || this.assignmentDetailIndex == -1) {
return;
}
//If there is no template, set the range to empty string
if (!this.studentIDTempl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"validateIDRange(client, assignment, id) {\n\n if (!client.assignments || client.assignments.length == 1) return true;\n client.assignments.forEach(item => {\n if (item.firstID === null || item.firstID == \"\" || item.lastID === null || item.lastID === \"\") {\n return this.d... | [
"0.5856275",
"0.55626345",
"0.5537937",
"0.5348975",
"0.52751726",
"0.52494144",
"0.5187079",
"0.50694287",
"0.50129217",
"0.49956283",
"0.49404517",
"0.47905624",
"0.4780783",
"0.47728857",
"0.47600353",
"0.47566682",
"0.47443074",
"0.47381282",
"0.47379234",
"0.4723628",
"0... | 0.7768123 | 0 |
Calculate a user id from a template idPrefix an id template. Templates are defined for products. id an integer | getID(idPrefix, id) {
if (idPrefix) {
var len = idPrefix.lastIndexOf(this.config.ID_WILDCARD) - idPrefix.indexOf(this.config.ID_WILDCARD) + 1;
var prefix = "000".substr(0, len - id.toString().length)
return idPrefix.substr(0, idPrefix.indexOf(this.config.ID_WILDCARD)) + prefi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateId(prefix, id)\n{\n return id !== undefined ? id\n : typeof DEBUG !== 'undefined'\n ? prefix + '-' + DEBUG.id++\n : generateGuid();\n}",
"function userId({id}) {\n return id;\n}",
"function userId({ id }) {\n return id;\n}",
"function handleIntIdTemplate (url) {\n return url... | [
"0.61142445",
"0.5957834",
"0.5939415",
"0.5764221",
"0.5746121",
"0.5746121",
"0.5746121",
"0.57378393",
"0.5732778",
"0.56795716",
"0.5672637",
"0.56633824",
"0.56458014",
"0.56383",
"0.5552293",
"0.550631",
"0.550631",
"0.5505195",
"0.55047286",
"0.55047286",
"0.55047286",... | 0.6267903 | 0 |
Check to see if an id range overlaps other assignments in the same client | validateIDRange(client, assignment, id) {
if (!client.assignments || client.assignments.length == 1) return true;
client.assignments.forEach(item => {
if (item.firstID === null || item.firstID == "" || item.lastID === null || item.lastID === "") {
return this.dialog.showMess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isOverlapping(srcAppt, tgtAppt){\n return (srcAppt.id != tgtAppt.id) //Not same appt\n && ( srcAppt.start < tgtAppt.end ) //Check boundries\n && ( srcAppt.end > tgtAppt.start ); //Check boundries\n }",
"function checkOverlappingRange(range)\r\n{\r\n range.isTest... | [
"0.679104",
"0.6628136",
"0.65225166",
"0.63913864",
"0.6272906",
"0.6254293",
"0.6169543",
"0.61623615",
"0.61396545",
"0.61190015",
"0.6089408",
"0.60008156",
"0.5987596",
"0.59532315",
"0.59494996",
"0.5939765",
"0.59325606",
"0.5915437",
"0.5901959",
"0.58977175",
"0.5896... | 0.7923398 | 0 |
Find index of assignment in request detail | setAssignmentIndex(client) {
for (let k = 0; k < this.selectedRequestDetail.assignments.length; k++) {
if (this.selectedRequestDetail.assignments[k].client == client) {
this.assignmentDetailIndex = k;
return;
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getIndex() {\n return internal.index;\n }",
"function getIndex(inputField) {\n var i = 0;\n var index = -1;\n errors.forEach(function(entry) {\n if(entry[1] == inputField[0].id ) {\n index = i;\n } \n i++;\n });\n return index; \n}",
... | [
"0.58571917",
"0.5815404",
"0.57647383",
"0.57495743",
"0.5734954",
"0.5716611",
"0.57156074",
"0.5711791",
"0.5701389",
"0.56761044",
"0.5634997",
"0.5609521",
"0.559125",
"0.55881464",
"0.55732834",
"0.5563825",
"0.555872",
"0.55500644",
"0.5547798",
"0.5541176",
"0.5539906... | 0.5831205 | 1 |
gets the request for platform specialists report | function getRequest() {
var request = {};
var headerText = "";
if($("a#platformSpecialist").length != 0) {
request.userIds = $("#platformSpecialist").selectedValuesString();
var options = $("a#platformSpecialist").next('.multiSelectOptions').find('INPUT:checkbox:checked').not('.optGroup... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function giveReport() {\n //getRequest(\"/getStudentColumns\", \"\", reportHelper);\n //console.log(\"got to report\");\n getRequest(\"/uniqueAttendance/\", \"\", reportHelper);\n}",
"function request() { return { type: medicineTemplatesConstants.GET_MEDICINE_DATA_REQUEST } }",
"function getSpecificat... | [
"0.56967527",
"0.5684456",
"0.55346555",
"0.54155695",
"0.5365381",
"0.52068865",
"0.51906365",
"0.5152582",
"0.5122528",
"0.50958705",
"0.5089022",
"0.5080346",
"0.5074583",
"0.5047994",
"0.5018934",
"0.5001061",
"0.49732512",
"0.4946992",
"0.49371523",
"0.49351808",
"0.4927... | 0.6231517 | 0 |
20190704: New function to change base directory for BrowserSync Based on Consulted 20190704 | function browserSyncNewBaseDir() {
return bs.init({server: {baseDir: './dist'}});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function changeBase(file, cb) {\n file.base = SRC_DIR;\n cb(null, file);\n}",
"set commonBasePath(value) { }",
"function MybrowserSync(bdir)\n{\n browserSync.init({\n server: {\n baseDir: bdir + \"/\"\n }\n });\n}",
"function browsersyncDev() {\n\tbrowserSync.init({\n\t\t\tserver: {\n\t\t... | [
"0.7066988",
"0.6722785",
"0.6665775",
"0.6040765",
"0.60334814",
"0.6030843",
"0.60219115",
"0.5993707",
"0.5971724",
"0.59432447",
"0.5933795",
"0.5860422",
"0.58193386",
"0.5813468",
"0.5813468",
"0.5807754",
"0.58077484",
"0.57895577",
"0.5787567",
"0.5768384",
"0.5727467... | 0.7812938 | 0 |
function to render three different random images to a page | function renderImages() {
var getThreeIndex = randomNoArray(0, surveyImagesArray.length);
var randomObject, elBody, elImg;
elBody = document.getElementById('market-research');
for (var i = 0; i < 3; i++) {
randomObject = surveyImagesArray[getThreeIndex[i]];
elImg = document.createElement('img');
elI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function randomImage() {\n var pics = Array('./Assets/images/banana.png', './Assets/images/bar.png', './Assets/images/cherry.png', './Assets/images/orange.png', './Assets/images/bell.png', './Assets/images/grape.png', './Assets/images/seven.png', './Assets/images/blank.png', './Assets/images/blank.png', './... | [
"0.7714088",
"0.7618263",
"0.7615547",
"0.75299746",
"0.7473947",
"0.7462659",
"0.74600863",
"0.7430336",
"0.7377973",
"0.7315516",
"0.7308198",
"0.7272865",
"0.7257718",
"0.7237466",
"0.7221663",
"0.7096222",
"0.70865864",
"0.70729613",
"0.7052072",
"0.70333654",
"0.7030862"... | 0.78411406 | 0 |
Retrieve all information for a specific type of filterable data report | function getFilterableReportData(filterableDataTypeToUse, fullDatasetCollectionData) {
let listOfReportData = [];
// Retrieve all mandatory information fields for filterable data report
function getMandatoryFilterableReportInformation(datasetCollectionItem) {
const url = new URL(dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"filterData() {\n var queryObject = this.getQueryObject();\n this.fetchData(queryObject);\n }",
"function filterBy(){\n\tTYPE_OF_ATTACK = document.getElementById(\"typeOfAttack\").value;\n\t// console.log(TYPE_OF_ATTACK);\n\tvar filteredData = getFilterData();\n\tdrawMap(GLOBAL_MAP, filteredData, \"country... | [
"0.61689943",
"0.6118467",
"0.6087673",
"0.60176206",
"0.59492517",
"0.5861917",
"0.5847184",
"0.5845175",
"0.58235025",
"0.581573",
"0.5805046",
"0.58001316",
"0.57911545",
"0.5789528",
"0.57470244",
"0.5745023",
"0.5731602",
"0.57293993",
"0.5716108",
"0.571258",
"0.5711186... | 0.65353584 | 0 |
sets user input of textarea to local storage | function saveLS1() {
localStorage.setItem("input1", textArea1.value);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function saveText(){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\tvar text = document.getElementById(\"textarea\").value;\n\tlocalStorage[\"textArea\"] = text;\n\t\n}",
"function saveLS9() {\n localStorage.setItem(\"input9\", textArea9.value);\n}",
"function rememberValue(){\n localStorage.setItem(textId, user... | [
"0.7756628",
"0.7463439",
"0.74335736",
"0.7369183",
"0.73405653",
"0.73003995",
"0.72863156",
"0.7233693",
"0.7222798",
"0.72053844",
"0.71786106",
"0.7099012",
"0.70033944",
"0.70018655",
"0.6972199",
"0.6929135",
"0.6840704",
"0.68267995",
"0.68149954",
"0.6806018",
"0.679... | 0.7645129 | 1 |
find the two entries that sum to 2020 | function findEntriesSum2020(arr) {
let answer1
let answer2
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < arr.length; j++) {
const arg1 = arr[i]
const arg2 = arr[j]
const res = arg1 + arg2
console.log(res)
if (res === 2020) {
answer1 = arg1 * arg2
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findingSumTo2020(array, goalNumber){\n //starting for loop with 1st number\n for (let i = 0; i < array.length - 1; i++){\n //2nd for loop for the 2nd number\n for (let j = i + 1; j < array.length; j++){\n if (array[i] + array[j] === goalNumber){\n console.log(... | [
"0.630548",
"0.6075201",
"0.6060443",
"0.58889353",
"0.5809767",
"0.5650587",
"0.5404288",
"0.53961766",
"0.5347345",
"0.53446776",
"0.52778274",
"0.5255955",
"0.521431",
"0.5206254",
"0.5164365",
"0.51538247",
"0.5151388",
"0.51359576",
"0.512892",
"0.51271236",
"0.5104925",... | 0.64752287 | 0 |
to access local storage for accessing qty | function retrieve() {
var q = localStorage.getItem('Qty');
if(q) {
qty = JSON.parse(q);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function save_item() {\n\n localStorage.setItem('Qty',JSON.stringify(qty));\n}",
"function savestorage() {\n get_total();\n localStorage.setItem('cart_items', JSON.stringify(cart_items));\n}",
"function totalCost(product, qty) {\n let cartCost = localStorage.getItem('totalCost');\n\n if (cartCost !=... | [
"0.71150637",
"0.69956994",
"0.68760973",
"0.6598319",
"0.6596386",
"0.65858",
"0.65124005",
"0.6491145",
"0.64469117",
"0.64038545",
"0.63898784",
"0.638103",
"0.6371322",
"0.6359387",
"0.63563573",
"0.63290995",
"0.6328452",
"0.6322417",
"0.6290503",
"0.6287236",
"0.6262461... | 0.8103767 | 0 |
deletes all assets (HTML, fonts, images) in dist | function cleanAssets(done) {
return del(
['dist/**/*'],
{ force: true }
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function assets_clean() {\n return del([dist+'*']);\n }",
"function clean() {\n return del([STATIC_DIST_ROOT]);\n}",
"function cleanAssets(done) {\n del.sync(['public/assets/*.html']);\n cache.clearAll();\n done();\n}",
"function clean() {\n return del(['dist/css/*','dist/js/*'])\n}",
"as... | [
"0.8657246",
"0.80085313",
"0.80052906",
"0.7812188",
"0.77212524",
"0.7688818",
"0.76571167",
"0.7562278",
"0.7487746",
"0.74771416",
"0.7458028",
"0.7441771",
"0.7427125",
"0.7420701",
"0.73865014",
"0.73865014",
"0.73704404",
"0.7353461",
"0.7335278",
"0.73131067",
"0.7313... | 0.8091299 | 1 |
publish HTML for production | function publishHtmlProduction(done) {
return publishHtml(done, true);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function publishHtmlDevelopment(done) {\n return publishHtml(done, false);\n}",
"function copyProdHtml(cb){\n copyHtml(config.distHtml, config.build)\n cb();\n}",
"function publishHtml(done, for_production = false) {\n let pipeline = gulp.src('src/**/*.{html,htm}')\n .pipe(cache('html'));\n\n ... | [
"0.749366",
"0.7359699",
"0.70451224",
"0.6701145",
"0.65810525",
"0.6575971",
"0.6561162",
"0.6549084",
"0.65285003",
"0.6425653",
"0.6394085",
"0.6373224",
"0.63639045",
"0.6309694",
"0.6215965",
"0.6166403",
"0.6165016",
"0.6155674",
"0.6142129",
"0.611701",
"0.6065123",
... | 0.7941574 | 0 |
publish HTML for development | function publishHtmlDevelopment(done) {
return publishHtml(done, false);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function publishHtmlProduction(done) {\n return publishHtml(done, true);\n}",
"function htmlTask() {\n return src(files.htmlPath)\n .pipe(htmlmin({ removeComments: true }))\n .pipe(dest('pub')\n );\n}",
"function copyProdHtml(cb){\n copyHtml(config.distHtml, config.build)\n cb();\n}",
"funct... | [
"0.77349573",
"0.69800735",
"0.69516313",
"0.67693406",
"0.67326355",
"0.66985476",
"0.6593531",
"0.6587306",
"0.65556395",
"0.65365106",
"0.64887494",
"0.64808196",
"0.6450233",
"0.6359744",
"0.6343565",
"0.63313854",
"0.63255435",
"0.632089",
"0.62696725",
"0.6254708",
"0.6... | 0.7885953 | 0 |
Auto register the route actions from `src/Services//Actions` | registerRoutes () {
const services = this.getApplication()
.getServicesRegistry()
.getAll();
this.publicRoutes = [];
Object.keys(services).map(serviceName => {
this.getApplication().log("%s SERVICE ROUTES:", serviceName.camelToSpace().toUpperCase());
const service = services[servic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"registerActions() {\n\n this.S.addAction(this._customAction.bind(this), {\n handler: 'customAction',\n description: 'A custom action from a custom plugin',\n context: 'custom',\n contextAction: 'run',\n options: [{\n option: 'option',\n ... | [
"0.6513122",
"0.63680273",
"0.63271517",
"0.63224804",
"0.6229011",
"0.617188",
"0.60890603",
"0.59874076",
"0.5972585",
"0.5952431",
"0.5938638",
"0.5796708",
"0.579609",
"0.5783842",
"0.5779643",
"0.5737758",
"0.5712836",
"0.56900144",
"0.568803",
"0.56827915",
"0.56730825"... | 0.648706 | 1 |
Fill the swiping Welcome Text | function fillWelcomeText(name) {
$(welcomeText).find('h1').append(name + '!');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function customWelcome() {\n $('.banner p').html(\n userName + ' we are happy that you come to our wedding ' + ' <i class=\"fa fa-heart\" aria-hidden=\"true\"></i> !'\n );\n }",
"function welcomeText(){ \n textSize(16); //sets size of font\n textFont(\"Georgia\"); //sets font\n text(\"Welcom... | [
"0.7000837",
"0.6843687",
"0.67949426",
"0.67529076",
"0.6715177",
"0.6548438",
"0.6474508",
"0.6404316",
"0.6360023",
"0.62824816",
"0.6245136",
"0.61307645",
"0.6098219",
"0.6086007",
"0.6070024",
"0.6049535",
"0.6048059",
"0.60316557",
"0.60108936",
"0.60058844",
"0.600266... | 0.6898797 | 1 |
get the wiki page using the argument "name" from wikipedia using Axios to make the request using Promise to handle the response and return the data as a json object | function search(name) {
return new Promise((resolve, reject) => {
axios.get(`https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&exintro=&explaintext=&titles=${name}`)
.then(response => {
resolve(response.data);
})
.catch(error => {
reject(error);
});
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getWikipediaApi(wikiSearch) {\n let wikiParams = {\n origin: '*',\n action: 'query',\n format: 'json',\n prop: 'extracts|pageimages',\n indexpageids: 1,\n redirects: 1,\n exchars: 1200,\n exsectionformat: 'plain',\n piprop: 'name|thumbnail|... | [
"0.7039653",
"0.68892866",
"0.6682961",
"0.65358293",
"0.651855",
"0.65048337",
"0.645442",
"0.62633884",
"0.6169457",
"0.6167604",
"0.61373514",
"0.61084175",
"0.60743725",
"0.6053093",
"0.60380846",
"0.6031614",
"0.60192955",
"0.60068506",
"0.60046834",
"0.5992255",
"0.5989... | 0.74042094 | 0 |
reset config file, clear all user sites | function resetConfig() {
fs.writeFileSync(configFilePath, JSON.stringify(defaultConfig, null, 2));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resetAll () {\n for (var key in Config.defaults) {\n if (Config.defaults.hasOwnProperty(key))\n reset(key);\n }\n }",
"function configClear()\n\t\t{\n\t\t\t// clear\n\t\t\t\tvar config = new Config('test');\n\t\t\t\tconfig.clear()\n\t\t\t\tt... | [
"0.68617356",
"0.65799487",
"0.6509148",
"0.63848877",
"0.6375249",
"0.62114996",
"0.61878026",
"0.613102",
"0.61175954",
"0.6114205",
"0.60685295",
"0.60412",
"0.6017425",
"0.6004558",
"0.59290403",
"0.5924929",
"0.59029424",
"0.58983177",
"0.58958274",
"0.5880405",
"0.58713... | 0.7027737 | 0 |
copy config file to given path | function copyConfig(_path) {
const dist = path.resolve(_path);
if (!fs.readdirSync(dist)) {
handleError(`the path: ${dist} does not exist or is not a directory`);
}
const config = configure();
const distDir = path.join(dist,
`config_${new Date().toISOString().split('.')[0].replace(/:/g, '-')}.json`);
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function copyFile(src, dest) {\n\tvar srcfile = path.join(rootdir, src);\n\tvar destfile = path.join(rootdir, dest);\n\tconsole.log(\"copying \"+srcfile+\" to \"+destfile);\n\tvar destdir = path.dirname(destfile);\n\tif (fs.existsSync(srcfile) && fs.existsSync(destdir)) {\n\t fs.createReadStream(srcfile).pipe(\n... | [
"0.631106",
"0.62765133",
"0.61634886",
"0.61307126",
"0.600526",
"0.59120125",
"0.5874701",
"0.58701897",
"0.5850127",
"0.5844609",
"0.58402514",
"0.58263457",
"0.57884544",
"0.57723373",
"0.5716405",
"0.56948483",
"0.5693599",
"0.5632067",
"0.5626106",
"0.5587235",
"0.55651... | 0.7626628 | 0 |
returns the top foods for a given nutrient | function top_foods(nutrient, amount) {
var foods = []
var value = 0
for (var i = 0; i < food_json.length; i++) {
var name = food_json[i]["name"]
for (var j = 0; j < food_json[i]["nutrients"].length; j++) {
if (food_json[i]["nutrients"][j]["name"] == nutrient) {
var value = food_json[i]["nutr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function topfew(data, production, selectedflux) {\n var tally = 0;\n data = [...data]\n .filter(d => {\n if (selectedflux[d] > 0) return d;\n })\n .map(function(d) {\n var val = selectedflux[d];\n tally += val;\n return {\n reaction: ncdata.rates[d],\n value: val,\n ... | [
"0.60637647",
"0.6030224",
"0.5696129",
"0.5621055",
"0.56193",
"0.5616545",
"0.5598935",
"0.55812323",
"0.55630106",
"0.5559288",
"0.5540285",
"0.5501025",
"0.54908496",
"0.5490199",
"0.54857045",
"0.5470184",
"0.5444216",
"0.5429249",
"0.54230005",
"0.54222304",
"0.54079336... | 0.82022727 | 0 |
reveal nutrient_display at click site and populate it with top foods | function display_detail(nutrient) {
if (display_activity != "") {
var to_del = document.getElementById('display')
to_del.parentNode.removeChild(to_del)
display_activity = ""
}
display_activity = nutrient.innerHTML
var grid = nutrient.parentElement
var nutrient_display = document.createElement('d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function showNutrients(foodData){\n\n // Store in browser session\n sessionStorage.setItem('foodLookupData', JSON.stringify(foodData));\n\n // Select the div container for the nutrients and ensure it is clear of previous lists\n container = $(\"div.nutrient-list\");\n container.empty();\n\n // Cr... | [
"0.70978916",
"0.6772951",
"0.6675916",
"0.6556426",
"0.62595266",
"0.6256456",
"0.61713976",
"0.6166135",
"0.616284",
"0.6124762",
"0.6092847",
"0.60465115",
"0.60460895",
"0.60434616",
"0.6038339",
"0.6037648",
"0.6021279",
"0.5969812",
"0.5967144",
"0.5959899",
"0.59595215... | 0.70304686 | 1 |
Converts an RDF/JS literal to its value. If its type represents a number, it returns a number. Else it returns a literal. | function rdfLiteralToValue(literal) {
if (literal.termType !== "Literal") return undefined;
if (literal.datatype.equals(xsd.integer)) {
return parseInt(literal.value);
} else if (literal.datatype.equals(xsd.double)) {
return parseFloat(literal.value);
} else {
return literal.val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getRDFValue(aLiteral) {\n if (aLiteral instanceof Ci.nsIRDFLiteral)\n return aLiteral.Value;\n if (aLiteral instanceof Ci.nsIRDFResource)\n return aLiteral.Value;\n if (aLiteral instanceof Ci.nsIRDFInt)\n return aLiteral.Value;\n return null;\n}",
"function transformLiteral(lit) {\n if (... | [
"0.6923774",
"0.67465556",
"0.6742398",
"0.673352",
"0.67265785",
"0.67231315",
"0.64908487",
"0.644643",
"0.63755774",
"0.63418144",
"0.63418144",
"0.63418144",
"0.63418144",
"0.63418144",
"0.63418144",
"0.63418144",
"0.63418144",
"0.63418144",
"0.6321716",
"0.6309166",
"0.6... | 0.806032 | 0 |
Convert term into its boolean value. Return undefined if it's not a valid boolean | function xsdBoolToBool(term) {
if (term.termType !== "Literal" || !xsd.boolean.equals(term.datatype)) {
return undefined;
}
if (term.value === "true") {
return true;
} else if (term.value === "false") {
return false;
} else {
return undefined;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toBool(val) { return /yes/i.test(val) }",
"function parse_bool() {\n return {\n type: \"bool\",\n value: input.next().value == \"true\",\n };\n }",
"function isTerm(object) { return !!object.termType; }",
"function parseBool(val) {\n if ((typeof val === 'string' && (val.toLowerCa... | [
"0.6871674",
"0.66746384",
"0.64098805",
"0.63932395",
"0.6388285",
"0.6375151",
"0.6263721",
"0.6241624",
"0.6181722",
"0.6169144",
"0.6109276",
"0.610888",
"0.60546845",
"0.6051611",
"0.60139257",
"0.5996482",
"0.592589",
"0.5899598",
"0.5899279",
"0.5865267",
"0.5850706",
... | 0.79075575 | 0 |
handler to handle cell changes & update values in draft values | handleCellChange(event) {
this.updateDraftValues(event.detail.draftValues[0]);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function cellValueChanged(event) {\r\n propagateForwardMode = document.getElementById(\"propagateForward\").checked;\r\n propagateBackwardMode = document.getElementById(\"propagateBackward\").checked;\r\n\r\n // Gets the name of the column that was edited and that row's index in the grid\r\n colEdited = event.... | [
"0.7231778",
"0.696564",
"0.6939246",
"0.6852423",
"0.67389464",
"0.6706555",
"0.66639996",
"0.66603094",
"0.65539354",
"0.65480256",
"0.65165496",
"0.65165496",
"0.6475619",
"0.64589536",
"0.6378614",
"0.6367789",
"0.6362639",
"0.6351965",
"0.6327286",
"0.6317789",
"0.630961... | 0.83697605 | 0 |
update 3D pointer position to match the position of the annotation being viewed | function update3DPointerPostion(mesh, AnnotationSet) {
//Show annotation marker implemented as global pointer in the scene
mesh.position.copy(AnnotationSet.queue[AnnotationSet.queue.curr_annot_index].camera_target);
//update the 3D marker's up vector to point in the right direction
mesh.up.copy(AnnotationSet.qu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"updateCameraPosition() {\n const targetPivot = new PIXI.Point(\n this.followedObject.x - Game.app.renderer.width / 2,\n this.followedObject.y - Game.app.renderer.height / 2,\n );\n this.world.pivot.copyFrom(targetPivot);\n }",
"updateprev(){\r\n this.prevpos.x=this.pos.x;\r\n ... | [
"0.63786125",
"0.63167375",
"0.62603706",
"0.619114",
"0.6159587",
"0.61217403",
"0.6107717",
"0.6090585",
"0.603991",
"0.603991",
"0.6015914",
"0.60085076",
"0.5981085",
"0.5939452",
"0.59019905",
"0.5809412",
"0.5803642",
"0.58029276",
"0.58014035",
"0.5790956",
"0.5763733"... | 0.79014456 | 1 |
Wait for messages in the web console output, resolving once they are receieved. | function waitForMessages({ hud, messages }) {
return new Promise(resolve => {
let numMatched = 0;
let receivedLog = hud.ui.on("new-messages",
function messagesReceived(e, newMessages) {
for (let message of messages) {
if (message.matched) {
continue;
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function waitForReadyOutput() {\n function onCloseBeforeReady(exitCode) {\n done(exitCode && new Error('non-zero exit code ' + exitCode));\n }\n\n let outputBuffer = '';\n\n function checkChunkForReady(chunk) {\n outputBuffer += chunk.toString('utf8');\n\n // ensure the buf... | [
"0.60869795",
"0.5848385",
"0.5833569",
"0.5711481",
"0.5692824",
"0.5627641",
"0.5522284",
"0.5514055",
"0.55071425",
"0.5448169",
"0.5400597",
"0.5400597",
"0.5392529",
"0.53802896",
"0.53697145",
"0.53518134",
"0.52937436",
"0.52828395",
"0.5235144",
"0.5231882",
"0.51961"... | 0.6709906 | 0 |
Find a message in the output. | function findMessage(hud, text, selector = ".message") {
const elements = findMessages(hud, text, selector);
return elements.pop();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findMessage(message){\n for(var i = 0; i < service.messages.length; i++) { \n if(service.messages[i].data == message.data){\n return i;\n }\n \n } //end for\n return false;\n }",
"function findElemen... | [
"0.6351775",
"0.63377213",
"0.62471247",
"0.5879686",
"0.5871834",
"0.58560646",
"0.5840061",
"0.57605386",
"0.5655445",
"0.55880314",
"0.555831",
"0.5524637",
"0.54868764",
"0.54819185",
"0.54557115",
"0.5453986",
"0.5440071",
"0.54201025",
"0.5361036",
"0.5287907",
"0.52820... | 0.68106127 | 0 |
Find multiple messages in the output. | function findMessages(hud, text, selector = ".message") {
const messages = hud.ui.outputNode.querySelectorAll(selector);
const elements = Array.prototype.filter.call(
messages,
(el) => el.textContent.includes(text)
);
return elements;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function waitForMessages({ hud, messages }) {\n return new Promise(resolve => {\n let numMatched = 0;\n let receivedLog = hud.ui.on(\"new-messages\",\n function messagesReceived(e, newMessages) {\n for (let message of messages) {\n if (message.matched) {\n continue;\n ... | [
"0.6640574",
"0.5955944",
"0.59008723",
"0.58763254",
"0.5788453",
"0.5740496",
"0.56892884",
"0.562334",
"0.5575422",
"0.5554638",
"0.5549754",
"0.54763496",
"0.54588157",
"0.5437572",
"0.53977984",
"0.53880334",
"0.5356689",
"0.53258795",
"0.5317767",
"0.53122896",
"0.53120... | 0.7050995 | 0 |
Hide the webconsole context menu popup. Returns a promise that will resolve when the context menu popup is hidden or immediately if the popup can't be found. | function hideContextMenu(hud) {
let popup = hud.ui.newConsoleOutput.toolbox.doc.getElementById("webconsole-menu");
if (!popup) {
return Promise.resolve();
}
let onPopupHidden = once(popup, "popuphidden");
popup.hidePopup();
return onPopupHidden;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function hideContextMenu() {\n var el = document.getElementById('contextMenu');\n el.style = 'opacity:0;';\n setTimeout(() => {\n el.style = 'visibility:hidden;';\n ctxPos.visible = false;\n }, 200); // Hide after 2 sec\n}",
"function hide() {\n if (contextMenu != null) {\n co... | [
"0.68607277",
"0.6809743",
"0.6791892",
"0.66997695",
"0.6601737",
"0.65358084",
"0.6451754",
"0.6448618",
"0.6325689",
"0.62445956",
"0.6054001",
"0.60463566",
"0.5986421",
"0.58640224",
"0.5832541",
"0.5787974",
"0.5773832",
"0.5767878",
"0.5763307",
"0.5759093",
"0.5659279... | 0.7780726 | 0 |
show students in alerts | function showStudents(array){
for(var i = 0; i < array.length; i ++){
alert('Student ' + (i + 1) + '\nName : ' + (array[i].name) + '\nPhone Number : ' + (array[i].phone) + "\nCity : " + (array[i].city));
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function studentPresent() {\n let stud;\n if (localStorage.getItem('school') === null) {\n stud = [];\n } else {\n stud = JSON.parse(localStorage.getItem('school'));\n }\n\n stud.forEach(\n function (s) {\n let checked = s[2];\n if (checked) {\n ... | [
"0.6374994",
"0.63253564",
"0.6321958",
"0.62632453",
"0.61979586",
"0.61685175",
"0.61619526",
"0.6112694",
"0.6093518",
"0.608788",
"0.60609245",
"0.60412407",
"0.6034135",
"0.5963822",
"0.5946883",
"0.59396994",
"0.5931799",
"0.59146935",
"0.5887068",
"0.5887068",
"0.58870... | 0.68382686 | 0 |
Create a function that console.logs "prints out more" | function printMore(){
console.log("Prints out more Text!");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function printMore(){\n\n console.log(\"Prints more text\");\n }",
"function printMore()\n{\n console.log(\"This is different text.\");\n}",
"function printMore(){\n console.log(\"This is different text\")\n }",
"function printMore(){\n console.log(\"This is different text\");\n }",
"function graM... | [
"0.8179663",
"0.7733959",
"0.7548376",
"0.7504914",
"0.62436545",
"0.61856616",
"0.6164334",
"0.5965723",
"0.59208035",
"0.58554614",
"0.5821521",
"0.5808843",
"0.57989424",
"0.5795851",
"0.5791712",
"0.5783071",
"0.57531065",
"0.5735833",
"0.5735541",
"0.5682202",
"0.5677925... | 0.8167742 | 1 |
Post new weapon and return the new game state | function postWeapon(req, res) {
var gameId = req.params.id;
var playerWeapon = req.body.playerWeapon;
if (playerWeapon!=="rock" && playerWeapon!=="paper" && playerWeapon!=="scissors") { return res.status(403).json({ errorStatus: 403, errorMessage: "Invalid Action" }); }
Game.findOne({ _id: gameId }, function(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addFamed() {\n\t\tlet form = document.getElementById(\"add_famed_form\");\n\t\tlet type = document.getElementById(\"weaponType\").value;\n\t\tlet inputs = form.getElementsByTagName(\"input\");\n\t\tlet values = Object.values(inputs);\n\t\tlet arr = [];\n\t\tfor (let i = 0; i < values.length; i++) {\n\t\t\... | [
"0.6212816",
"0.60048294",
"0.5918547",
"0.58549076",
"0.5685234",
"0.5615627",
"0.5606438",
"0.558702",
"0.5546685",
"0.5518013",
"0.5491025",
"0.54842883",
"0.54558194",
"0.54141545",
"0.5406423",
"0.53981256",
"0.53565276",
"0.53519195",
"0.5326625",
"0.5306198",
"0.526620... | 0.6306565 | 0 |
Computer Random Weapon Selection | function randomWeaponSelection () {
var weapon;
var randomNumber = Math.random();
if (randomNumber < 0.33333) { weapon = "rock"; }
else if(randomNumber < 0.66666) { weapon = "paper"; }
else{ weapon = "scissors"; }
return weapon;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generate_weapons(){\n var rand = Math.floor((Math.random() * 4));\n if (rand == 0){\n\treturn [\"Dual Wield\", 6, 4, 0];\n }\n else if (rand == 1){\n\treturn [\"Two Hand\", 10, 0, 0];\n }\n else if (rand == 2){\n\treturn [\"One Hand/Shield\", 6, 0, 2];\n }\n else{\n\treturn [\"Rang... | [
"0.7376904",
"0.7361634",
"0.70548564",
"0.70408994",
"0.6894417",
"0.689325",
"0.68531746",
"0.6843101",
"0.68330187",
"0.68204725",
"0.68192995",
"0.676201",
"0.67124206",
"0.66839415",
"0.6641114",
"0.657047",
"0.6524226",
"0.6520542",
"0.65158373",
"0.64552134",
"0.645481... | 0.80858415 | 0 |
Get Winning Choice/Weapon (or "tie") | function getWinningWeapon(choice1,choice2) {
if(choice1===choice2) {
return "tie";
}
if(choice1==="rock") {
if(choice2==="scissors" || choice2==="") {
return "rock";
}
else {
return "paper";
}
}
if(choice1==="paper") {
if(choice2==="rock" || choice2==="") {
return "pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getWinsAgainst(selection) {\n if (selection === rock) {\n return scissors;\n } else if (selection === paper) {\n return rock;\n } else if (selection === scissors) {\n return paper;\n }\n}",
"function randomWeaponSelection () {\n var weapon;\n var randomNumber = Math.ra... | [
"0.7229225",
"0.6992354",
"0.6698984",
"0.6551467",
"0.65469116",
"0.65249056",
"0.649744",
"0.64872736",
"0.64715296",
"0.6454955",
"0.64515483",
"0.64501065",
"0.639904",
"0.6385806",
"0.63054925",
"0.62995917",
"0.6296351",
"0.6284238",
"0.6274689",
"0.62566817",
"0.622018... | 0.8172287 | 0 |
Renderizador, onde busco o template Builder e passo o tipo de template e os dados | render() {
return <TemplateBuilder
type = {
TEMPLATE.MAIN
}
data = {
this.getData()
}
/>;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function render(template, data){\n\tif(typeof templates[template] === 'undefined'){\n\t\ttemplates[template] = Hogan.compile($('#'+template).html());\n\t}\n return templates[template].render(data, templates);\n}",
"function render(data) {\r\n // seleziona il template da utilizzare\r\n var source = $(\"#elm-... | [
"0.6430124",
"0.6196099",
"0.6158738",
"0.60628635",
"0.5940288",
"0.5929761",
"0.5882871",
"0.5870617",
"0.5865321",
"0.5844341",
"0.583838",
"0.58117557",
"0.58091825",
"0.58091825",
"0.5806429",
"0.57918674",
"0.5757875",
"0.5756077",
"0.5744806",
"0.574092",
"0.5725371",
... | 0.64225584 | 1 |
get the users we want to add to the team as admins | getAddedAdmins () {
return this.users.splice(1).map(data => data.user);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async getUsers () {\n\t\tlet memberIds = \n\t\t(\n\t\t\tthis.attributes.$addToSet && \n\t\t\tthis.attributes.$addToSet.adminIds\n\t\t) || \n\t\t(\n\t\t\tthis.attributes.$pull && \n\t\t\tthis.attributes.$pull.adminIds\n\t\t) || \n\t\t(\n\t\t\tthis.attributes.$addToSet &&\n\t\t\tthis.attributes.$addToSet.removedMemb... | [
"0.72625124",
"0.7139883",
"0.71007425",
"0.7009826",
"0.693534",
"0.6859997",
"0.6859506",
"0.6805689",
"0.6686505",
"0.6685272",
"0.6580835",
"0.6529882",
"0.65057594",
"0.64716524",
"0.6435769",
"0.642643",
"0.6393107",
"0.6388759",
"0.6335012",
"0.63313115",
"0.6314534",
... | 0.77618057 | 0 |
return a sorted meetup list | loadedMeetups (state) {
return state.loadedMeetups.sort((meetupA, meetupB) => {
return meetupA.date > meetupB.date
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"loadedMeetups (state) {\n return state.loadedMeetups.sort((meetupA, meetupB)=>{\n return meetupA.date > meetupB.date\n })\n }",
"upcomings() {\n return this.meetups.filter(meetup => new Date(meetup.happeningOn.toString()) > new Date());\n }",
"function Meetings(p... | [
"0.668253",
"0.6245507",
"0.6087185",
"0.5872128",
"0.57780445",
"0.57319105",
"0.56514996",
"0.559568",
"0.55750483",
"0.55620444",
"0.5555887",
"0.5547281",
"0.553982",
"0.54978096",
"0.54731625",
"0.54357135",
"0.54234785",
"0.5414292",
"0.5393533",
"0.5390543",
"0.5383584... | 0.6895112 | 0 |
load a specific meetup based on the id | loadedMeetup (state) {
return (meetupId) => {
return state.loadedMeetups.find((meetup) => {
return meetup.id === meetupId
})
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getOne(meetupId) {\n const meetupIdtoNumber = Number(meetupId);\n return this.meetups.find(meetup => meetup.meetupId == meetupId);\n }",
"async show ({ response, params }) {\n const { id } = params\n\n try {\n const meeting = await Meeting.findOrFail(id)\n\n await meeting.loadMany({\n ... | [
"0.66850656",
"0.6228603",
"0.60400116",
"0.58205473",
"0.58124566",
"0.560201",
"0.5557294",
"0.5525585",
"0.54799193",
"0.5463154",
"0.54622054",
"0.544601",
"0.53922087",
"0.5372652",
"0.5356213",
"0.5344116",
"0.53318506",
"0.531753",
"0.5291619",
"0.5285351",
"0.5278608"... | 0.6267861 | 1 |
Animates a cursive section mask of the 'Relish' SVG | function animateSectionMask(index) {
// If current section exists show it and animate mask
if(index >= 0 && index < globals.masks.length) {
$(globals.letters[index]).css({"opacity": 1});
var pathLength = parseInt($(globals.masks[index]).css("stroke-dasharray"));
$(globals.masks[index])
.css({"opa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function animateSVGIntro() {\r\n giantSVGCircle.animate(\r\n {\r\n cx: 0, \r\n cy: 0,\r\n r: 0\r\n }, 300, mina.backin);\r\n // add / remove the class of animation to the header / paragraph elements according to the underlying background\r\n // white backgrou... | [
"0.6136124",
"0.5999109",
"0.58837146",
"0.5848453",
"0.5794956",
"0.57041895",
"0.56106997",
"0.55759823",
"0.5574426",
"0.55720794",
"0.5551844",
"0.5545455",
"0.5543141",
"0.55304515",
"0.5496322",
"0.54815084",
"0.5474803",
"0.54599017",
"0.54571694",
"0.54473376",
"0.544... | 0.61610526 | 0 |
Check to see if at least one person within 'people' is 19 years old | isAtLeastOnePerson19(people) {
return people.some((person) => { // .some() checks to see if at least one element matches the criteria, if so, it return true, else false
const now = new Date();
return (now.getFullYear() - person.year) >= 19;
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"isEveryone19(people) {\n return people.every((person) => { // .every() checks to see if all the elements matches the criteria, if so, it return true, else false\n const now = new Date();\n return now.getFullYear() - person.year === 19;\n })\n }",
"function isAdult(person) ... | [
"0.8167417",
"0.76442766",
"0.75301063",
"0.7012596",
"0.69099",
"0.6877777",
"0.67912674",
"0.67912674",
"0.64843875",
"0.64538544",
"0.64220047",
"0.639863",
"0.6386943",
"0.63811064",
"0.63796604",
"0.6337396",
"0.632487",
"0.6272649",
"0.62572134",
"0.62448287",
"0.623429... | 0.857815 | 0 |
Check to see if everyone is 19 within 'people' | isEveryone19(people) {
return people.every((person) => { // .every() checks to see if all the elements matches the criteria, if so, it return true, else false
const now = new Date();
return now.getFullYear() - person.year === 19;
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"isAtLeastOnePerson19(people) {\n return people.some((person) => { // .some() checks to see if at least one element matches the criteria, if so, it return true, else false\n const now = new Date();\n return (now.getFullYear() - person.year) >= 19;\n })\n }",
"function all... | [
"0.7405553",
"0.7066271",
"0.69332343",
"0.65985996",
"0.658901",
"0.65830034",
"0.6559444",
"0.64295065",
"0.6355587",
"0.62999386",
"0.62999386",
"0.6284536",
"0.62801456",
"0.6220513",
"0.61943626",
"0.617592",
"0.6110289",
"0.6069072",
"0.6041557",
"0.6033639",
"0.5997195... | 0.77070355 | 0 |
Find a comment with a specific id | findCommentWithSpecificId(comments, id) {
return comments.find((comment) => { // .find() is similar to filter, but just splits out the very first element that meets the criteria and return it
return comment.id === id;
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function findcomment(id) {\n try {\n let query = 'select `id` from `comment` where `user`=?'\n let param = [id]\n const [resultid] = await mypool.execute(query, param)\n if (resultid.length > 0) {\n cycleid(resultid, 'comment', id)\n }\n } catch (err) {\n next(err)\... | [
"0.7929026",
"0.7852395",
"0.77386236",
"0.7556298",
"0.71397954",
"0.7103274",
"0.70248145",
"0.7008946",
"0.696994",
"0.6784257",
"0.6783233",
"0.6669393",
"0.65673363",
"0.65435165",
"0.65405095",
"0.6525376",
"0.634885",
"0.62781584",
"0.62622607",
"0.6195835",
"0.6176774... | 0.8082143 | 0 |
Find the index of a comment with a specific id and delete it from the comments | findIndexOfCommentWithSpecificIdAndDeleteIt(comments, id) {
let commentIndex = comments.findIndex((comment) => {
return comment.id === id;
})
commentIndex !== -1 ? comments.splice(commentIndex, 1) : null;
return comments;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"removeComment(id){\n let { comments } = this.state;\n let index = comments.map(function(comment) {\n return comment.id\n }).indexOf(id);\n\n comments.splice(index, 1);\n this.setState({comments, commentsLoading: false});\n }",
"function removeComment(tree, id) {\n tree.comments.forEach(comm... | [
"0.72853386",
"0.6988608",
"0.69016385",
"0.6818262",
"0.6790455",
"0.6753947",
"0.66771066",
"0.6676866",
"0.6650204",
"0.6608081",
"0.66070664",
"0.660514",
"0.6590356",
"0.6567101",
"0.6562014",
"0.6487287",
"0.6412978",
"0.6389942",
"0.63809246",
"0.63200104",
"0.63132226... | 0.8656807 | 0 |
It is important to call this function after the specialEventBanner's content has been set because its height is an essential part of the repostitioning formula. | function repositionSpecialEventBanner()
{
const $banner = $("#specialEventBanner"),
bannerHeight = $banner.height(),
{ boardHeight } = gameData;
$banner.offset({ top: boardHeight/2 - bannerHeight });
$(".specialEventImg").css(
{
top: boardHeight/2 + bannerHeight/4,
left: getDimension("specialEventImgMarg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handle_resize() {\n var article = _el('article');\n article.style.height =\n ''+Math.max(500, document.body.clientHeight - 320)+'px';\n}",
"applyContentHeight() {\n const imgRoot = this.element ? this.element.querySelector('dxp-image') : this.element.querySelector('dxp-image');\n ... | [
"0.6405558",
"0.6372401",
"0.6359765",
"0.63521016",
"0.62785935",
"0.6211363",
"0.62023",
"0.61908346",
"0.6188847",
"0.61547303",
"0.61493665",
"0.61470795",
"0.61138046",
"0.6110272",
"0.6110104",
"0.6037225",
"0.601447",
"0.5989087",
"0.59659594",
"0.5961833",
"0.5958825"... | 0.63867635 | 1 |
Appends either a single cardKey or an array of cardKeys to this Player's cardKeys array. Excludes Epidemic cards because they go straight to the discard pile after being resolved. | addCardKeysToHand(cardKeys)
{
this.cardKeys = [
...this.cardKeys,
...ensureIsArray(cardKeys).filter(key => !isEpidemicKey(key))
];
this.panel.setCollapsedCardCount(this.cardKeys.length);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addKeycards() {\n var defWrap = document.getElementById(\"keydefs\");\n defWrap.innerHTML = \"\";\n for (var i = 0; i < chosenProfile.keyData.length; i++) {\n addKeycard(chosenProfile.keyData[i].displayName, chosenProfile.keyData[i].mappedEvdevName, chosenProfile.keyData[i].EvdevID);\n ... | [
"0.55514765",
"0.54445726",
"0.539879",
"0.53663963",
"0.5365182",
"0.53472024",
"0.52581626",
"0.5202595",
"0.5152479",
"0.51506495",
"0.5102412",
"0.5080493",
"0.5076272",
"0.50744605",
"0.5068905",
"0.50681347",
"0.50483364",
"0.50276744",
"0.5027515",
"0.50157017",
"0.500... | 0.6841885 | 0 |
Removes the card element from the player's panel, and removes the cardKey from the player object's cardKeys array. Accepts a single cardKey string, or an array of cardKey strings. | removeCardsFromHand(cardKeys)
{
for (let key of ensureIsArray(cardKeys))
{
this.panel.removeCard(key);
this.cardKeys.splice(this.cardKeys.indexOf(key), 1);
}
this.panel.setCollapsedCardCount(this.cardKeys.length);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function removeCardfromPlayer(card){\n\t\t\tfor (var i = 0; i < players.length; i++) {\n\t\t\t\tif(players[i].hand.indexOf(card)> -1){\n\t\t\t\t\tplayers[i].removeCard(card);\n\t\t\t\t}\n\t\t\t};\n\t\t}",
"remove(card) {\n for(i in this.card) {\n var c = this.card[i];\n if(c === card... | [
"0.670012",
"0.6698705",
"0.64050466",
"0.63745797",
"0.62794626",
"0.624502",
"0.620396",
"0.60587186",
"0.60466295",
"0.6024383",
"0.5944841",
"0.5867892",
"0.5857775",
"0.5856439",
"0.58564246",
"0.5855812",
"0.5842949",
"0.5831439",
"0.58083284",
"0.5766393",
"0.5765297",... | 0.73281115 | 0 |
Returns an array of cardKeys that can be given to another player in the same city via Share Knowledge. | getShareableCardKeys()
{
if (this.role === "Researcher")
return this.cardKeys.filter(cardKey => isCityKey(cardKey));
else if (this.isHoldingCardKey(this.cityKey))
return [this.cityKey];
return [];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"distributeHoleCards() {\n const holeCards = [];\n const cardMap = new Map();\n this.pokerRound.pokerActivePlayers.forEach((element) => {\n const { card1, card2 } = this.deck.getHoleCards();\n holeCards.push({\n socketID: element.socketID,\n playerName: element.playerName,\n ... | [
"0.5693639",
"0.56781644",
"0.5401764",
"0.53221613",
"0.5214327",
"0.5176153",
"0.5144858",
"0.5093416",
"0.5093416",
"0.5093416",
"0.5070405",
"0.5070216",
"0.505248",
"0.50350016",
"0.5012633",
"0.5007489",
"0.49974233",
"0.4992297",
"0.49875924",
"0.49857858",
"0.49807164... | 0.80514103 | 0 |
If the player has enough cards of one color to discover a cure, and the disease color in question has not already been cured, returns an array of the cardKeys that can be used to discover a cure. Returns false otherwise. | getCardsForDiscoverACure()
{
// Discover A Cure requires:
// - The player must be holding 5 cards of the same color,
// or 4 of the same if the player is the Scientist.
// - The status of said disease color must not be cured or eradicated.
const cardsByColor = {
y: [],
r: [],
u: [],
b: []
},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getCardColors(card) {\n var cardColors = [];\n\n // Before doing anything, check to see if the card has a color indicator.\n // If it does, we consider this to be the definitive source of the card's\n // color, overriding the mana cost.\n if (card.colorIndicator !== undefined) {\n fo... | [
"0.6186975",
"0.5941146",
"0.5904362",
"0.568231",
"0.55846334",
"0.55598474",
"0.5525903",
"0.55092376",
"0.5505677",
"0.54378825",
"0.5427583",
"0.53693795",
"0.536548",
"0.5359712",
"0.5357415",
"0.5357091",
"0.53255576",
"0.5322751",
"0.5321336",
"0.530119",
"0.5300958",
... | 0.7617032 | 0 |
given an array of city info, loads any research stations and disease cubes | function loadCityStates(cityInfoArray)
{
if (typeof cityInfoArray == "undefined")
return;
const colors = ["y", "r", "u", "b"],
cubeSupplyCounts = [24, 24, 24, 24];
let cityInfo,
city,
color,
numCubes;
// for each city in the array...
for (let i = 0; i < cityInfoArray.length; i++)
{
cityInfo = cit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function loadSearchedCitys() {\n \n var latestTerms = getLatestSearches()\n\n var recentlySearched = latestTerms[0];\n\n provideWeather(recentlySearched);\n}",
"function loadCity(){\n var url = 'http://api.openweathermap.org/data/2.5/weather?q='+cities.value()+\n '&APPID=f02124924447c73bc1d1626b1bee5f45... | [
"0.6888688",
"0.631259",
"0.6222737",
"0.6092334",
"0.60090905",
"0.5969015",
"0.59541535",
"0.59522814",
"0.5940293",
"0.584511",
"0.5844556",
"0.566942",
"0.56551784",
"0.5633185",
"0.5633185",
"0.56263745",
"0.562055",
"0.561557",
"0.559506",
"0.55929834",
"0.5575487",
"... | 0.78138745 | 0 |
adds a city key to the cluster queue | function queueCluster(cityKey)
{
gameData.pendingClusters.add(cityKey);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"add(key, value) {\n const hashCode = MyHashTable.getHashCode(key);\n const bucket = this.buckets[this.getBucketIdx(hashCode)];\n bucket.add(key, value);\n }",
"insert(key, value) {\n let idx = hash(key, this.size);\n this.buckets[idx].set(key,value);\n }",
"insert(key, value) {\n... | [
"0.55043656",
"0.55033463",
"0.5494586",
"0.5285374",
"0.5238921",
"0.522181",
"0.52118444",
"0.5199673",
"0.5198459",
"0.5160563",
"0.5118103",
"0.5112261",
"0.5104996",
"0.5071536",
"0.5021605",
"0.5014844",
"0.5001086",
"0.4992958",
"0.49753326",
"0.49664703",
"0.49647483"... | 0.87690586 | 0 |
Returns true only if 2 epidemics were drawn on the same turn, the first has been resolved, and the second is waiting to be resolved. On page 7 of the official rules, under EVENT CARDS: "When 2 Epidemic cards are drawn together, events can be played after resolving the first epidemic." | function betweenEpidemics()
{
// The current step must be Epidemic Step 1: Increase, else we are not waiting to resolve an epidemic.
// Additionally, 1 epidemicIntensify event needs to have been recorded this turn, else 0 epidemics have been resolved this turn.
return currentStepIs("epIncrease")
&& getEventsOfTurn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function hasGameEnded() {\n const p1Check = didItHitSmth(gameData.player1.snake, gameData.player1.snakeHead, gameData.player2.snake)\n const p2Check = didItHitSmth(gameData.player2.snake, gameData.player2.snakeHead, gameData.player1.snake)\n\n return p1Check || p2Check;\n}",
"function numEpidemicsToResolve()\... | [
"0.6076997",
"0.60599506",
"0.58801746",
"0.58592963",
"0.5855545",
"0.5796268",
"0.5777025",
"0.57617885",
"0.573772",
"0.5713409",
"0.5713409",
"0.569213",
"0.5691988",
"0.5674887",
"0.56670386",
"0.5647628",
"0.5644491",
"0.5638498",
"0.5635576",
"0.5633865",
"0.56304586",... | 0.7041944 | 0 |
Returns the player who has more cards than the hand limit. It's impossible for there to be more than one player with too many cards at one time because two players never receive cards simultaneously. | function getPlayerWithTooManyCards()
{
const { players, HAND_LIMIT } = gameData;
let player;
for (let rID in players)
{
player = players[rID];
if (player.cardKeys.length > HAND_LIMIT)
return player;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function moreCard() {\n cardPick(game.playerHand, game.playerCards, false);\n cardCount();\n }",
"function minHandSize(player, num){\n if (player.hand.length >= num) {\n return true;\n } else {\n return false;\n }\n }",
"function get_winning_card(cards) {\n l... | [
"0.63969564",
"0.626944",
"0.61685497",
"0.59142804",
"0.59050614",
"0.58969545",
"0.58477217",
"0.5655232",
"0.5587663",
"0.55716985",
"0.5551264",
"0.5524259",
"0.5517608",
"0.5503361",
"0.5500749",
"0.54914874",
"0.546803",
"0.54395884",
"0.54339814",
"0.5419974",
"0.54058... | 0.8427642 | 0 |
Returns true when the turnNum has been updated for a new turn but the step has not changed from "infect cities" (final step of previous turn). This can occur if the user plays an event card before clicking "CONTINUE" at the end of the "infect cities" step. | function infectionStepJustFinished()
{
if (!currentStepIs("infect cities"))
return false;
// If the current step is "infect cities" and no cardDraw event has been recorded this turn,
// the "infect cities" step is over and a new turn has begun.
return getEventsOfTurn(eventTypes.cardDraw).length === 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"turnCheck() {\n this.displayStats();\n // game.cityImgChange();\n\n if (game.playerOne.moved === true && game.playerTwo.moved === true) {\n this.turns++;\n\n // set moved boolean back to false\n this.playerOne.moved = false;\n this.playerTwo.moved = ... | [
"0.6527665",
"0.5946557",
"0.5864052",
"0.58194166",
"0.57840073",
"0.5674656",
"0.566729",
"0.5637253",
"0.56259435",
"0.5594018",
"0.5574229",
"0.55579674",
"0.55422693",
"0.55416894",
"0.55131507",
"0.55031055",
"0.54866475",
"0.545248",
"0.5435257",
"0.5414584",
"0.539344... | 0.70967853 | 0 |
Loads the alreadydrawn infection card elements if the game is resumed during the infection step and one or more infection cards were already drawn on the resumed turn. | function loadInfCardsDrawnThisTurn()
{
const infectionEvents = getInfectCityEventsOfTurn(),
numCardsDrawnThisTurn = infectionEvents.length;
if (numCardsDrawnThisTurn > 0)
{
// Insert the contents of any cards drawn this turn.
const $infectionContainer = $("#infectCitiesContainer");
let city,
$card;
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setCoveredCards() {\n\tif (covered !== null) { \n\t\tjQuery.each(covered, function(card, val) { // inspect each card by ID\n\t\t\t$(\"#\" + card).css('border', '2px solid #333'); // resets the card-slot border as unmarked\n\t\t\tif ( (card != 'GC') && (card != 'PL') ) {\n\t\t\t var cardObj = $(\"#\" ... | [
"0.59241575",
"0.54913104",
"0.5483591",
"0.53332543",
"0.5291443",
"0.5263818",
"0.5263029",
"0.523742",
"0.52070886",
"0.51698726",
"0.5147312",
"0.5145803",
"0.51225054",
"0.5119666",
"0.5116556",
"0.5106723",
"0.5104504",
"0.5101796",
"0.5095339",
"0.5094227",
"0.50857544... | 0.7530833 | 0 |
When an event card is played 'from contingency' (the Contingency Planner stored the event card and then played it), it is removed from the game rather than simply discarded. This function creates arrays which will exist briefly while the game is being resumed (page was refreshed while the game is in progress). These ar... | function prepareToFlagRemovedEventCardEvents()
{
gameData.eventCardEvents = [];
gameData.removedEventCardKeys = [];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function DeleteCard(){\n\tvar eventObject = localStorage.getObject('EventLocal'); // get saved event object from storage\n\tvar PlayerArrayTMP = localStorage.getObject('LocalPlayerArray'); //player array from storage\n\tfor(var i = 0; i < PlayerArrayTMP.length; i++){ //looking for active player in a Array by ID\n\... | [
"0.6375009",
"0.6300167",
"0.6139085",
"0.6132499",
"0.6026504",
"0.60250825",
"0.5859916",
"0.57821274",
"0.5780754",
"0.5756473",
"0.5711572",
"0.5662005",
"0.5659718",
"0.5656062",
"0.5637281",
"0.5611884",
"0.5588793",
"0.5573165",
"0.5567136",
"0.55638385",
"0.554454",
... | 0.7228764 | 0 |
Returns the number of unresolved epidemics that were drawn this turn. | function numEpidemicsToResolve()
{
// The one and only cardDraw event of the turn will tell us how many epidemics were drawn.
// The presence of each epidemicIntensify event indicates that an epidemic was fully resolved.
const { cardDraw, epidemicIntensify } = eventTypes,
cardDrawEvent = getEventsOfTurn(cardDraw);... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get violationsOfPreference2() {\n let count = new Number(0);\n let lastPlanned=this.schedule[0];\n for (let day=0; day<this.schedule.length; day++) {\n if (this.schedule[day]!=lastPlanned) {\n if(this.schedule[day]=='x' || lastPlanned=='x') {\n coun... | [
"0.6026019",
"0.5987861",
"0.5702866",
"0.5655341",
"0.55355364",
"0.5501306",
"0.5431291",
"0.5387194",
"0.5347419",
"0.5345054",
"0.53428113",
"0.53428113",
"0.53201956",
"0.5302409",
"0.5302231",
"0.529542",
"0.52706087",
"0.52680594",
"0.5267168",
"0.52443707",
"0.5232542... | 0.80418026 | 0 |
Returns the recorded events of the desiredEventTypes from the current turn. Accepts an array of desiredEventTypes, or a single event type. | function getEventsOfTurn(desiredEventTypes, { turnNum } = {})
{
const { events } = eventHistory,
eventsOfTurn = [];
turnNum = turnNum || gameData.turnNum;
desiredEventTypes = ensureIsArray(desiredEventTypes);
for (let i = events.length - 1; i >= 0; i--)
{
event = events[i];
// Skip events queued for n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getEventList() {\n return events.map(function(e) {\n e.setup()\n return e;\n });\n}",
"function getEventTypes() {\n\t \tjobEventTypeService.getAll(function(response) {\n\t \tjac.eventTypes = response;\n\t \t\n\t }, function() {\n\t \n\t });}",
"functio... | [
"0.5604553",
"0.55839133",
"0.5547242",
"0.5362761",
"0.5317499",
"0.5252879",
"0.52357346",
"0.522765",
"0.5170764",
"0.51020616",
"0.5040861",
"0.50386614",
"0.50224006",
"0.4987592",
"0.4987592",
"0.49827155",
"0.4978364",
"0.497819",
"0.49723104",
"0.49618384",
"0.4951623... | 0.7980722 | 0 |
Randomizes the order of all role options, EXCEPT the roleToLandOn which is placed at this.MIDDLE_OPTION_INDEX. | randomizeRoleOrder(roleOptions, roleToLandOn)
{
const randomizedRoles = [];
roleOptions.splice(roleOptions.indexOf(roleToLandOn), 1);
let i = 0,
roleIndex,
role;
while (roleOptions.length)
{
if (i === this.MIDDLE_OPTION_INDEX)
role = roleToLandOn;
else
{
roleIndex = randomNumberB... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"generateOrder() {\n const options = Object.keys(OPTIONS);\n\n for (let i = 0; i < this.orderSize; i++) {\n const idx = Math.floor(Math.random() * options.length);\n const random = options[idx];\n this.order.push(random);\n }\n }",
"function randomiseOption... | [
"0.6083681",
"0.588363",
"0.5581914",
"0.5501087",
"0.5469188",
"0.5420954",
"0.53997195",
"0.5333651",
"0.5332698",
"0.5275697",
"0.52246743",
"0.522397",
"0.5171283",
"0.5122092",
"0.510919",
"0.5107294",
"0.5059331",
"0.5031461",
"0.49927709",
"0.49787852",
"0.49633357",
... | 0.816107 | 0 |
Append cart to body | function append_cart() {
let products = db.table("products").getIn("id", storage.get("items")),
products_count = Object.keys(products).length;
$(".cart-menu").empty();
$(".cart-items-count").html(products_count);
products.forEach((product) => {
$(".cart-menu").append(view.render("cart", { product: pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function appendItemsInCart(){\n ui.cartItems.innerHTML = \"\";\n cart.forEach((item)=>{\n ui.appendItemsInCart(item.imgSrc,item.numberOfUnits,item.price,item.id,item.title,item.size);\n })\n}",
"function viewCart(cart) {\n var source = document.getElementById(\"cart-content\").innerHTML;\n ... | [
"0.72878945",
"0.7044084",
"0.70282954",
"0.7007778",
"0.6934163",
"0.69119245",
"0.68999106",
"0.6869763",
"0.6838358",
"0.6834168",
"0.6792165",
"0.67886806",
"0.6731466",
"0.6731466",
"0.6681796",
"0.66802967",
"0.6630155",
"0.66240513",
"0.662237",
"0.6616318",
"0.6601645... | 0.7131447 | 1 |
if flow has a condition, it must be evaluated and if result is true flow will continue otherwise, flow will be discarded. | run(item) {
let action = __1.FLOW_ACTION.take;
if (this.def.conditionExpression) {
// conditionExpression:{"$type":"bpmn:Expression","body":"true"}
let expression = this.def.conditionExpression.body;
item.token.log('..conditionExpression:' + JSON.stringify(this.def.co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"asmUntil( threadContext, params ) {\n // Get the condition\n const condition = params;\n const conditionEval = ( typeof( condition ) == 'function' )?\n condition():\n condition;\n\n if( !conditionEval ) {\n threadContext.pc -= 2; // re-execute the previous block or statement\n }\n\n ... | [
"0.6046588",
"0.5993421",
"0.5993421",
"0.59897965",
"0.59891546",
"0.58651114",
"0.57919264",
"0.5778546",
"0.5757543",
"0.574397",
"0.5673707",
"0.5617417",
"0.5561313",
"0.553753",
"0.553753",
"0.5501341",
"0.5474449",
"0.54353565",
"0.5420763",
"0.5377037",
"0.5364309",
... | 0.61152655 | 0 |
parse attributes on element | parseAttributes() {
if (this.hasAttribute('label')) {
this.label = this.getAttribute('label');
}
if (this.hasAttribute('assetsperday')) {
this.assetsperday = this.getAttribute('assetsperday');
}
if (this.hasAttribute('activedays')) {
this.act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getAttributes(el) {\n var res = {};\n for (var i = 0, len = el.attributes.length; i < len; i++) {\n res[el.attributes[i].name] = el.attributes[i].value;\n }\n return res;\n}",
"function attributes(src, name) {\n const result = [];\n let start = 0;\n let end = src.... | [
"0.6814016",
"0.67338914",
"0.67315686",
"0.6614117",
"0.6515918",
"0.6515918",
"0.6474347",
"0.6427428",
"0.64005005",
"0.6398755",
"0.63735056",
"0.63720566",
"0.630412",
"0.63003975",
"0.628557",
"0.628557",
"0.6257079",
"0.6223827",
"0.6209432",
"0.62011665",
"0.61568004"... | 0.73560035 | 0 |
change datetime number resolution | changeDateResolution(datetime, resolution) {
var date = new Date(datetime);
var res = 1000 * 60 * 60 * 24 * resolution;
return res * parseInt(datetime / res);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static set timeScale(value) {}",
"static set unscaledTime(value) {}",
"function cubism_graphiteFormatDate(time) {\n return Math.floor(time / 1000);\n}",
"function cubism_graphiteFormatDate(time) {\n return Math.floor(time / 1000);\n}",
"function floor(d, p) {\n switch (p) {\n case 31536e6... | [
"0.60577905",
"0.583761",
"0.5720453",
"0.5720453",
"0.5610176",
"0.5581703",
"0.5577615",
"0.5571768",
"0.5566558",
"0.5549417",
"0.5549417",
"0.55488116",
"0.55257",
"0.5456573",
"0.54481494",
"0.544098",
"0.5433847",
"0.5432839",
"0.5420339",
"0.5414351",
"0.54136634",
"... | 0.7633462 | 0 |
Fires when an attribute was added, removed, or updated. | attributeChangedCallback(attr, oldVal, newVal) {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"attributeChangedCallback(name, oldValue, newValue) {\n \n }",
"attributeChangedCallback(attr, oldVal, newVal) {\n \n }",
"attributeChangedCallback(name, oldValue, newValue) {\n // implement by subclass\n }",
"attributeChangedCallback(name, oldValue, newValue) {\n // do stuff\n }",
"at... | [
"0.7274376",
"0.71901935",
"0.71628755",
"0.71364015",
"0.7118078",
"0.7093941",
"0.7063483",
"0.70240164",
"0.70240164",
"0.6985378",
"0.68553966",
"0.6850244",
"0.6808217",
"0.680258",
"0.6781571",
"0.6751302",
"0.67473876",
"0.67348367",
"0.67078805",
"0.67078805",
"0.6707... | 0.7326251 | 1 |
Build and return a dummy payingUser This is to support older versions of the app that grouped requests by paying user | getDummyPayingUser(request) {
const dummyUser = {};
if (request._owners && request._owners.length) {
const ownerNames = request._owners.map(owner => owner._user.name);
const joinedNames = ownerNames.join(', ');
dummyUser._id = 'multipleOwners';
dummyUser.name = joinedNames;
}
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async createUserAsNeeded () {\n\t\tif (this.user) {\n\t\t\treturn;\n\t\t}\n\t\tthis.request.log('No match to user, will create...');\n\t\tthis.userCreator = new UserCreator({\n\t\t\trequest: this.request,\n\t\t\t// allow unregistered users to listen to their own me-channel, strictly for testing purposes\n\t\t\tsub... | [
"0.6049587",
"0.58977723",
"0.5836717",
"0.5826544",
"0.57823974",
"0.5771736",
"0.5696197",
"0.56952775",
"0.5692343",
"0.56692547",
"0.5647228",
"0.5603446",
"0.55988646",
"0.5585691",
"0.55759513",
"0.5574939",
"0.5571964",
"0.55698484",
"0.55292505",
"0.5510357",
"0.55013... | 0.7096039 | 0 |
var button = document.getElementById("clickerCount"); console.log(button); var counterDisp = document.getElementById("table"); | function clickerCounter() {
count += 1;
//console.log(count);
document.getElementById("clickerCount").innerHTML = "Counter: " + count;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Uix() {\n var button = document.getElementById('#button');\n button.addEventListener('click', () => {\n this.countClick();\n });\n}",
"function clickCounter() {\n console.log(\"Click\");\n totalClicks ++;\n clickReadout.innerHTML = \"Total Clicks: \" + totalClicks;\n}",
"function increm... | [
"0.6792578",
"0.66972095",
"0.6570781",
"0.6410237",
"0.6377552",
"0.6359358",
"0.6356616",
"0.63510734",
"0.63329357",
"0.6319782",
"0.6313129",
"0.6286475",
"0.6250948",
"0.6233968",
"0.6223742",
"0.6212472",
"0.6188149",
"0.61866623",
"0.61778873",
"0.6175476",
"0.61574084... | 0.7329908 | 0 |
Sets the color (and material as the result) of the roof by color name | function setColor(color, secondaryColor) {
if (colors.shingleMap[color]) {
let texture = textureLoader.load(assets.img[colors.shingleMap[color]]);
let bump = textureLoader.load(assets.img[colors.shingleMap[color] + "_b"]);
texture.wrapS = texture.wrapT =
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function changeColorRim(_color) {\n saveToUndo();\n rimMat = new THREE.MeshStandardMaterial({\n color: _color,\n metalness: 0.8,\n roughness: 0.2,\n name: 'orange'\n });\n updateMaterials()\n }",
"function colorRojo()\r\n{\r\n\tcolor = \"red\"\r\n}",
"setColor... | [
"0.7019844",
"0.67920357",
"0.6729663",
"0.6669576",
"0.6647933",
"0.66376346",
"0.66307855",
"0.6612923",
"0.66021967",
"0.6549761",
"0.6544162",
"0.6535559",
"0.65293545",
"0.65175056",
"0.65004814",
"0.6466291",
"0.64351976",
"0.6409246",
"0.6356976",
"0.63435715",
"0.6342... | 0.6916476 | 1 |
n = 6, denoms = [1,5] output: 2 todo: brute force do a recursive solution iterate through the array with recursive call imagine a tree structure starting with 1, then 5, etc.. then return whenever we hit out target number todo: Do dynamic programming keep track of out values from 0 > n to track number of ways to keep t... | function numberOfWaysToMakeChange(n, denoms) {
// create the array of length n + 1
const way = new Array(n + 1).fill(0)
way[0] = 1;
// outer for loop iterating through the denoms
for (let denom of denoms) {
for (let i = 0; i < way.length; i++) {
if (denom <= i) {
way[i] += way[i - denom];
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function numberOfWaysToMakeChange(n, denoms) {\n // Create an an array ways = [0,0,0,0,0,0,0]\n const ways = new Array(n + 1).fill(0);\n // Create base case for ways to make change for 0\n ways[0] = 1;\n // for each denomination in the denoms array\n for (let denom of denoms) {\n // we are going to compar... | [
"0.6495892",
"0.6244851",
"0.6168768",
"0.6157259",
"0.61118406",
"0.61112505",
"0.6084783",
"0.60288256",
"0.60223705",
"0.5977464",
"0.59655",
"0.5941775",
"0.59029233",
"0.58952725",
"0.58597624",
"0.5859466",
"0.58450466",
"0.5839561",
"0.5836242",
"0.5796703",
"0.5769357... | 0.6910187 | 0 |
allowed to mutate input array waiting time = amount of time that it must wait before its execution starts 2nd query waiting time is the duration of the 1st query 3rd query is the sum of the durations of the first 2 queries | function minimumWaitingTime(queries) {
// sort in ASCENDING order => this order ensures minimum waiting time by having smaller #s first
queries.sort((a,b) => a - b);
// keep track of total time of ALL subqueries summed together
let runningSum = 0;
// keep track of individual query time
let ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function minimumWaitingTime(queries) {\n // sort the input so that the longet querie will be always at the end\n queries = queries.sort((a, b) => a - b);\n //create an array and at each index store the total waiting time for each querie\n let res = [0]; //1st querie will never have to wait to execute so its wa... | [
"0.7194251",
"0.6261816",
"0.62578666",
"0.60828334",
"0.5709751",
"0.5566432",
"0.55599356",
"0.55365694",
"0.54485685",
"0.5370551",
"0.53403544",
"0.5321338",
"0.5314046",
"0.5267553",
"0.5264035",
"0.5244771",
"0.5237036",
"0.5211305",
"0.5192863",
"0.5164697",
"0.5152267... | 0.6598212 | 1 |
Remember, suicide is the normal exit path, if a worker dies without suicide being set then it is abnormal, and we record the time. | function _recordSuicide(self, worker) {
if(worker && !worker.suicide) {
self._lastAbnormalExit = Date.now();
debug('master - abormal exit by worker %s at time %s', worker.id, self._lastAbnormalExit);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function timed() {\n\tabsentConf = fs.existsSync('numTracker.json');\n\tconsole.log(\"Scraping interrupted : \" + absentConf);\n\tif (absentConf == true && get.recover == true) {\n\t\tconsole.log(\"Didn't finish eating last time around!\");\n\t\tvar encode = JSON.parse(fs.readFileSync(\"numTracker.json\", \"utf-8\... | [
"0.5823176",
"0.5473665",
"0.54590863",
"0.5364797",
"0.5328229",
"0.5234331",
"0.5229291",
"0.5218073",
"0.5166187",
"0.5149176",
"0.5149176",
"0.51466185",
"0.5145658",
"0.51175994",
"0.5110719",
"0.50941926",
"0.5091838",
"0.50901085",
"0.5068434",
"0.50648123",
"0.5050459... | 0.76038474 | 0 |
shutdown the first worker that has not had .disconnect() called on it already | function stopOne(callback) {
var self = this;
// XXX(sam) picks by key order, semi random? should it sort by id, and
// disconnect the lowest? or sort by age, when I have it, and do the oldest?
var workerIds = Object.keys(cluster.workers);
for(var i = workerIds.length - 1; i >= 0; i--) {
var id = workerId... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"shutdown() {}",
"shutdown () {\n\t\tif (this.shuttingDown) { return; }\n\t\tthis.shuttingDown = true;\n\t\tsetTimeout(() => {\n\t\t\tprocess.exit(0);\n\t\t}, 100);\n\t}",
"shutdown() {\n // Empty\n }",
"terminate() {\n this.closed = true\n this.workers.forEach(worker => worker.terminateImmediately(... | [
"0.7140293",
"0.66916007",
"0.66574323",
"0.6623699",
"0.6599541",
"0.65715414",
"0.6563723",
"0.65601736",
"0.655305",
"0.6543829",
"0.6543829",
"0.6543829",
"0.6514523",
"0.6510815",
"0.65027887",
"0.6489496",
"0.6489496",
"0.64498675",
"0.6424946",
"0.6362481",
"0.63422716... | 0.67308265 | 1 |
creates hash and determines color of block based on signiture | function bc(blockNumber) {
for (var count2=blockNumber; count2 < nodeNumber; count2++) {
if (count2 >= 1) {
prevSelector[count2].innerHTML = hashSelector[count2 - 1].innerHTML
}
hashSelector[count2].innerHTML = "";
hashSelector[count2].innerHTML +=
CryptoJS.SHA256(dataSelector[count2].value +
non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateColorBlocks() {\n $('.palette').html('');\n\n $('.palette').append('<h4 class=\"text-muted\">Dominant Color</h4>');\n\n var c = rgbToCssString(bgColor);\n\n $('.palette').append('<div class = \"color-blocks\"><div class=\"color-block\" style=\"background-color: ' + c + ... | [
"0.65951455",
"0.6310047",
"0.6238448",
"0.6192489",
"0.61835086",
"0.61385506",
"0.6136176",
"0.61356264",
"0.61199296",
"0.6098002",
"0.60925823",
"0.60748786",
"0.6041252",
"0.6026281",
"0.6023267",
"0.6010377",
"0.5960548",
"0.59280485",
"0.58645034",
"0.5856891",
"0.5853... | 0.6645572 | 0 |
Toilet Listings Returns a djangocompatible filter to only select toilets within a distmilesided square centered on (lat, lng) | function toiletFilterByDistance(lat, lng, dist){
var sb = squareBounds(lat, lng, dist);
var xmin, xmax, ymin, ymax;
var smallLeft = (sb.x_left < sb.x_right);
xmin = smallLeft ? sb_x.left : sb.x_right;
xmax = smallLeft ? sb.x_right : sb.x_left;
var smallBottom = (sb.y_bottom < sb.y_top);
ym... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getToiletListings(filter, sortFn){\n return function (queryCallback, start, end){\n\tconsole.log(\"getToiletListings\");\n\tvar params = {\n noun: \"toilet\",\n verb: \"retrieve\",\n data: { start: start, end: end, filters: filter },\n callback: function (dat... | [
"0.61924344",
"0.5882151",
"0.58798194",
"0.58644843",
"0.5765469",
"0.57516605",
"0.5676976",
"0.56391364",
"0.5543593",
"0.5351868",
"0.5339068",
"0.532918",
"0.52478164",
"0.5242077",
"0.5240827",
"0.5216217",
"0.5201061",
"0.51976293",
"0.5155971",
"0.5150657",
"0.5141531... | 0.7527556 | 0 |
Returns sorting comparison functions that will sort toilets by distance or rating. Ties are broken by sorting by the other parameter. | function toiletSorts(lat, lng){
var sorts = {
"distance" : function(d1, d2, fin){
if(d1.distance === d2.distance){
if(fin) return 0;
else return sorts["rating"](d1, d2, true);
}
return d1.distance < d2.distance ? -1 : 1;
}
,"rating" : function (d1, d2, fin){
d1.rating = parseInt(d1.fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getSorter(firstCriterion, secondCriterion, factor) {\n return (a, b) => {\n let aFirst;\n let bFirst;\n let aSecond;\n let bSecond;\n let result;\n\n if (a.isFavorite && !b.isFavorite) {\n result = -1;\n } else if (!a.isFavorite && b.isFavorit... | [
"0.6900185",
"0.68853706",
"0.64915675",
"0.6424424",
"0.62584263",
"0.61550915",
"0.61323845",
"0.61019903",
"0.6078497",
"0.6033281",
"0.6033281",
"0.60177815",
"0.60125893",
"0.6008965",
"0.5994195",
"0.59918153",
"0.5958446",
"0.5952801",
"0.5944353",
"0.5927764",
"0.5898... | 0.7460932 | 0 |
Returns a function that will retrieve toilets from the server. (Compatible with bsScrollLoad) queryCallback is passed the data retrieved from the server start is the first toilet to retrieve and end is the last. Note that sortFn is expected to set the distance for each toilet in the data. Weird but efficient (prevents ... | function getToiletListings(filter, sortFn){
return function (queryCallback, start, end){
console.log("getToiletListings");
var params = {
noun: "toilet",
verb: "retrieve",
data: { start: start, end: end, filters: filter },
callback: function (data) {
if(sortFn !==... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toiletSorts(lat, lng){\n var sorts = {\n\t\"distance\" : function(d1, d2, fin){\n\t if(d1.distance === d2.distance){\n\t\tif(fin) return 0; \n\t\telse return sorts[\"rating\"](d1, d2, true);\n\t }\n\t return d1.distance < d2.distance ? -1 : 1; \n\t}\n\t,\"rating\" : function (d1, d2, fin){\n... | [
"0.63224334",
"0.5232049",
"0.4905483",
"0.47300115",
"0.47136402",
"0.4668137",
"0.46661314",
"0.46555805",
"0.46302465",
"0.45944312",
"0.45715553",
"0.45633614",
"0.44978333",
"0.44820178",
"0.44815516",
"0.4481094",
"0.44624677",
"0.43895683",
"0.4373335",
"0.43567702",
"... | 0.7512818 | 0 |
This is sort of a janky way to fix the bugs we faced when doing searches toiletsLoading isn't reset properly and numToiletsLoaded is incrementing each call causing no results to be returned | function searchReset() {
toiletsLoading = false;
numToiletsLoaded = 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"loadItems() {\n let {cursor, hasMoreItems, endOfListMessage, users, shownUsers, page, query} = this.state;\n // Start showing users if 50 users are loaded from the API\n if (users.length > 49){\n // Check if the users should be filtered by a seach query\n let filteredUsers = this.filterUsers(use... | [
"0.61993515",
"0.608494",
"0.6080071",
"0.5993136",
"0.57601154",
"0.57445663",
"0.5739759",
"0.5732799",
"0.57214767",
"0.567266",
"0.5657122",
"0.56224036",
"0.56113327",
"0.56101805",
"0.56038296",
"0.55979276",
"0.55854523",
"0.55733764",
"0.5561371",
"0.5556223",
"0.5555... | 0.7238187 | 0 |
Seed a collection with data contained within a JSON file. | function seedCollection(file) {
var collDef = require(path.join(dataLoc, file));
console.log('seedCollection() - file = '+file);
console.log('seedCollection() - model = '+collDef.model);
console.log('seedCollection() - length = '+collDef.data.length);
var model = db.conn.model... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function populateMatchesDB() {\n\n fs.readFile('json/matches.json', function (err, data) {\n if (err) {\n console.log(\"read file error: \" + err);\n return;\n }\n // insert all documents\n MatchModel.insertMany(JSON.parse(data), function (error, docs) {\n ... | [
"0.6280022",
"0.61064184",
"0.60590434",
"0.6032659",
"0.59141344",
"0.5859657",
"0.56967276",
"0.5652317",
"0.5642984",
"0.56389564",
"0.5615981",
"0.5598929",
"0.55774796",
"0.5559657",
"0.55513346",
"0.55393136",
"0.553688",
"0.55337083",
"0.5517997",
"0.55137366",
"0.5503... | 0.68794763 | 0 |
Export data from a collection to a JSON file using a model name. | function exportCollection(modelName) {
var exportData = {};
// Name the file so that it will be ignored by a seed
// all command.
var file = '-' + modelName + '_export.json';
var model = db.conn.models[modelName];
model.find()
.exec(function (err, docs) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function saveToJson(){\n let dump = JSON.stringify(tweet_collection);\n fs.writeFileSync('./tweet_dump.txt', dump);\n process.exit();\n}",
"async export() {\n const data = await this.get();\n const a = document.createElement('a');\n a.href = URL.createObjectURL(new Blob([JSON.stringify(data, nu... | [
"0.5928749",
"0.5847014",
"0.58335954",
"0.5802817",
"0.5689579",
"0.5662758",
"0.564893",
"0.5615307",
"0.5603415",
"0.5595936",
"0.5572757",
"0.549138",
"0.5473211",
"0.54444003",
"0.5399546",
"0.53667617",
"0.5347927",
"0.53359115",
"0.5335823",
"0.53320354",
"0.5322539",
... | 0.81717724 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.