query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Gets the closest th element to hover. | _getClosestThToHover(event) {
const that = this,
x = event.clientX,
headerCellElements = Array.from(that.$.tableContainer.querySelectorAll('th[data-field]:not(.smart-pivot-table-total-header)'));
let closest, closestDistance, side;
for (let i = 0; i < headerCellEle... | [
"function retrieveNearestRow(element) {\n // find nearest row\n var nearestRow = $(element).closest(\".row.sqs-row\")[0];\n return nearestRow;\n}",
"static getClosestHeading($, headingsSelector, element) {\n const prevElements = $(element).prevAll();\n for (let i = 0; i < prevElements.length; i += 1) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addButton(label) take in a string and create a button with that string as the label | function addButton(label) {
var $button = $("<div class='guess'></div>").text(label).button().click(handleGuess).removeClass("ui-corner-all");
$('.btn-wrapper').append($button);
} | [
"addButton(text, parent = this.$controls) {\n return $(document.createElement('button')).text(text).appendTo(parent);\n }",
"function addButton(label) {\n // Creating a guess class that will be added to the HTML body\n // Said class will contain an animal name due to the 'label' argument\n let $div... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Soal No. 1 Fungsi Teriak / Buatlah sebuah fungsi bernama teriak(), yang mengembalikan nilai berupa "Halo Function!", yang kemudian akan ditampilkan di halaman html. Tampilkan dengan cara document.getElementById("jawaban1").innerHTML seperti di CONTOH. | function teriak() {
// Tulis Code mulai di sini
document.getElementById("jawaban1").innerHTML = "Aku Teriak"
// Tampilkan dengan cara document.getElementById("jawaban1").innerHTML seperti di CONTOH.
} | [
"function tampilkan() {\n document.getElementById(\"contohJawaban\").innerHTML = \"Aku Tampil\"\n }",
"function buatKalimat(nama, umur, alamat, hobi) {\n // Code kamu mulai dari sini\n var kalimat = \"Nama saya \" + nama + \", Umur \" + umur + \" Bertempat tinggal di \" + a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Default to a dummy "batch" implementation that just runs the callback | function defaultNoopBatch(callback){callback();} | [
"function defaultNoopBatch(callback) {\n\t callback();\n\t}",
"function defaultNoopBatch(callback) {\n callback();\n }",
"addBatchCallback(callback) {\n this.batchCallback = callback;\n return this;\n }",
"function defaultNoopBatch(callback) {\n callback();\n}",
"function ba... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Queue life when the particle died completely (increase the opacity once set to 0 or less) /wait for as much as the delay was set | queueLife() {
if (this.alpha < 1) {
setTimeout(() => {
this.alpha += 0.1;
this.queueLife();
}, this.delay);
} else {
this.dead = false;
this.queueDeath();
}
} | [
"queueDeath() {\n if (this.alpha > 0) {\n setTimeout(() => {\n this.alpha -= 0.1;\n this.queueDeath();\n }, this.delay);\n } else {\n this.dead = true;\n this.inversion = Math.random() <= 0.5 ? -1 : 1;\n this.inversion2 = Math.random() <= 0.5 ? -1 : 1;\n this.Xpos =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expand a the node with the given ID | function expand(id, recursive)
{
collapse(id, recursive, false);
} | [
"function ECMS_expand_id(tree, id) {\n\tECMS_control_node(ECMS_find_node(tree, id), 1);\n}",
"function expandCompressNode(id) {\t\n\tvar node = nodeIndex[id];\n\t \n\tif (!node.expanded) {\n\t\tnode.expandChildren();\n\t} else {\t\t\n\t\tnode.expanded = false;\n\t\tnode.compressChildren();\n\t}\n}",
"expand(no... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pads a `tf.Tensor4D` with a given value and paddings. See `pad` for details. | function pad4d_(x, paddings, constantValue) {
if (constantValue === void 0) { constantValue = 0; }
util.assert(paddings.length === 4 && paddings[0].length === 2 &&
paddings[1].length === 2 && paddings[2].length === 2 &&
paddings[3].length === 2, function () { return 'Invalid number of paddings. ... | [
"function pad4d_(x, paddings, constantValue) {\n if (constantValue === void 0) {\n constantValue = 0;\n }\n assert(paddings.length === 4 && paddings[0].length === 2 && paddings[1].length === 2 && paddings[2].length === 2 && paddings[3].length === 2, function () {\n return 'Invalid number of paddings. Must ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Classifies as either sky or ground object TO BE CHANGED LATER | function generate_context(object) {
var sky_objects = ["angel", "bee", "bird", "butterfly", "helicopter",
"mosquito", "owl", "parrot", "rain", "snowflake","swan"];
if (sky_objects.includes(object)){
return "sky";
} else{
return "ground";
}
} | [
"function changeTileSky (el){\n console.log(el, shovel.value);\n if(shovel.value === true){\n console.log('removing groundtile');\n el.target.classList.add('skyTile')\n el.target.classList.remove('groundTile')\n }\n}",
"updateEarth() {\n // Check Environment status\n if (getEnvironment()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get a react component from name (components can be an angular injectable e.g. value, factory or available on window | function getReactComponent( name, $injector ) {
// if name is a function assume it is component and return it
if (angular.isFunction(name)) {
return name;
}
// a React component name must be specified
if (!name) {
throw new Error('ReactComponent name attribute must be specified');
}... | [
"function getReactComponent( name, $injector ) {\n // if name is a function assume it is component and return it\n if (angular.isFunction(name)) {\n return name;\n }\n\n // a React component name must be specified\n if (!name) {\n throw new Error('editor-ui-lib: UI component name attribute must be specif... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lets you make any Instagram API request. | function api(obj) {
var method = obj.method || 'GET',
params = obj.params || {},
url;
params['access_token'] = tokenStore['igtoken'];
url = 'https://api.instagram.com/v1' + obj.path + '?' + toQueryString(params);
if (method === 'GET') {
jsonp(url, ... | [
"function instagramAPI(){\n const instagramURL = 'https://graph.instagram.com/me/media?fields=id,caption,media_type,media_url,permalink,thumbnail_url,timestamp&access_token=';\n const url = instagramURL + authKey;\n fetch(url)\n .then(response => {\n if (response.ok) {\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shows the borders and shading dialog | showBordersAndShadingDialog() {
if (this.bordersAndShadingDialogModule && !this.isReadOnlyMode && this.viewer) {
this.bordersAndShadingDialogModule.show();
}
} | [
"function showHandles() {\n\tupdateHandles();\n\tneHandle.setOpacity(1);\n\tnwHandle.setOpacity(1);\n\tseHandle.setOpacity(1);\n\tswHandle.setOpacity(1);\n}",
"function displayDialog ( )\n{\n var modal= document.getElementById('modal');\n var shade= document.getElementById('shade');\n \n //\n // if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggle whether a button's text starts 'Hide' or 'Show'. | function hiddenToggle($button)
{
var oldText = $button.text(),
hide;
if (oldText.substr(0, 4) == 'Show') {
hide = false;
$button.text('Hide' + oldText.substr(4));
} else {
hide = true;
$button.text('Show' + oldText.substr(4));
}
return hide;
} | [
"function toggleHideShowText() {\n let showHideCopy = showHideButton.innerHTML.toLowerCase() === 'hide' ? 'Show' : 'Hide';\n\n showHideButton.innerHTML = showHideCopy;\n}",
"function changeButtonText() {\n if ($(\"#myDiv\").hasClass(\"showText\")) {\n $(\"#btnShowText\").text(\"Hide Text\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
disableInsConsButton() enableInsConsButtonEnable a button "accept" | function enableInsConsButton() {
var xbutton = document.getElementById("insconsbutton");
if( xbutton != undefined ){
document.getElementById("insconsbutton").removeAttribute('hidden');
acceptButton = true;
}
return true;
} | [
"function disableInsConsButton() {\t\t\n\tvar xbutton = document.getElementById(\"insconsbutton\");\n\tif( xbutton != undefined ){\n\t\tdocument.getElementById(\"insconsbutton\").setAttribute('hidden', 'true');\n\t\tacceptButton = false;\n\t}\n\treturn true;\n}",
"function enableAcceptButton() {\t\t\n\tvar xbutto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reset foreground color to default | function resetForeColor() {
richTextField.document.execCommand("foreColor", true, "#000000");
} | [
"reset() {\n this.colorFg = this.defaultFg;\n this.colorBg = this.defaultBg;\n }",
"function resetBGColor () {\r\n\teditValue('bgColor', '#0000FF');\r\n\tchangeBGColor('bgColor');\r\n}",
"reset() {\n this.changeColors(EMPTYCOLOR);\n }",
"function resetTextColor () {\r\n\teditValue('textColor', '#FF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove a page from view, using input string pageId | function removePage(pageId) {
var page = $(pageId);
page.attr("style", "display: none");
} | [
"function deletePage(pageId) {\n return pageModel.remove({_id: pageId});\n}",
"function deletePage(pageId) {\n for (var i = 0; i < pages.length; ++i) {\n if (pages[i]._id == pageId)\n pages.splice(i, 1);\n }\n }",
"function deletePage() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Charge function that is called for each node. As part of the ManyBody force. This is what creates the repulsion between nodes. Charge is proportional to the diameter of the circle (which is stored in the radius attribute of the circle's associated data. This is done to allow for accurate collision detection with nodes ... | function charge(d) {
return -Math.pow(d.radius, 2.1) * forceStrength;
} | [
"function charge(d) {\n return -Math.pow(d.radius, 2.0) * forceStrength;\n }",
"function charge(d) {\n return -1.4 * Math.pow(d.radius, 2.0) * forceStrength;\n }",
"function charge(d) {\r\n\t\t\t\t\t return -Math.pow(d.radius, 2.0) * forceStrength;\r\n\t\t\t\t\t }",
"function charge(d) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Derives the `R3DirectiveMetadata` structure from the AST object. | function toR3DirectiveMeta(metaObj, code, sourceUrl) {
var typeExpr = metaObj.getValue('type');
var typeName = typeExpr.getSymbolName();
if (typeName === null) {
throw new fatal_linker_error_1.FatalLinkerError(typeExpr.expression, 'Unsupported type, its name could not be determined')... | [
"getModuleMetadataForDirective(classSymbol) {\n const result = {\n directives: [],\n pipes: [],\n schemas: [],\n };\n // First find which NgModule the directive belongs to.\n const ngModule = this.analyzedModules.ngModuleByPipeOrDirective.get(classSymbol)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In order to keep the number of buttons to switch playlist pages reasonable, once the number of pages gets too large, only show the first few, last few, and a neighborhood around the current page. | function populatePages() {
$('#playlist-pages').empty();
$('#playlist-pages').append('<li id="playlist-pages-label">Page: </li>')
num_pages = Math.floor((vid_array.length-1)/8) + 1;
if(num_pages <= 9) {
var i = 1;
for (i = 1; i<=num_pages; i++) {
$('#playlist-pages').append('<li><a onclick="javascript:switch... | [
"function show_page( n ) {\n\n // Increment page counter:\n current_page += n;\n n = current_page;\n\n // Erase last page of tablets:\n $(\"#tablet_previews\").html('');\n\n // add \"next page\" and \"previous page\" buttons:\n var buttons = document.createElement(\"div\");\n buttons.id = \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A panel to display a study's participant annotation types. | function StudyAnnotationTypesPanelCtrl($scope,
Panel) {
var vm = this,
panel = new Panel($scope.panelId, $scope.addStateName);
vm.study = $scope.study;
vm.annotationTypes = $scope.annotationTypes;
vm.annotationTypeIdsInUse = $... | [
"function showAnnotationType(annotTypeId) {\n annotTypeModalService.show('Specimen Link Annotation Type', vm.annotTypesById[annotTypeId]);\n }",
"function showAnnotationType(annotTypeId) {\n annotTypeModalService.show('Specimen Link Annotation Type', vm.annotationTypesById[annotTypeId]);\n }",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is the container that contains both tabs for the login and register | render() {
return (
<Col className="justify-content-center" id="myLoginBox">
<Container id="loginContainer">
<Tabs
defaultActiveKey="Login"
id="UserLoginRegister"
className="justify-content-ar... | [
"function compare_plan_login() {\n\tvar tabs, tabContent, tabModule;\n\t\n\ttabs = $('#tabGroup > li > a');\n\ttabContent = $('#tabContent');\n\t\n\ttabModule = new tabingModule();\n\ttabModule.init(tabs, tabContent);\n}",
"register() {\n const section = document.querySelector(\"#login-section\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
when the user clicks on a waypoint search result, it is used as waypoint. The search results vanish and only the selected address is shown. | function handleSearchWaypointResultClick(e) {
var rootElement = $(e.currentTarget).parent().parent().parent().parent();
var index = rootElement.attr('id');
rootElement.removeClass('unset');
rootElement = rootElement.get(0);
rootElement.querySelector('.searchAgainButton').show();
rootElement.querySele... | [
"function handleWaypointResultClick(atts) {\n\t\t\tvar wpIndex = atts.wpIndex;\n\t\t\tvar featureId = atts.featureId;\n\t\t\tvar searchIds = atts.searchIds;\n\t\t\tif (searchIds) {\n\t\t\t\tsearchIds = searchIds.split(' ');\n\t\t\t}\n\n\t\t\tvar type = selectWaypointType(wpIndex);\n\t\t\tvar waypointResultId = map.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
render tabs eyebrow text | renderTabsEyebrowText() {
if (this.eyebrowText) {
return (core.h("p", { class: "tabs-eyebrow-text dxp-title-eyebrow dxp-font-size-sm" }, this.eyebrowText));
}
} | [
"function _jsTabControl_drawTab(d, tab) {\n\td.write(\"<table border=\\\"0\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\"><tr><td><img src=\\\"\");\n\td.write(IMG_TAB_OFF[0].filename);\n\td.write(\"\\\" border=\\\"0\\\" height=\\\"\");\n\td.write(IMG_TAB_OFF[0].height);\n\td.write(\"\\\" width=\\\"\");\n\td.write(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function which creates a function which creates wrapped versions of internal `request` and `get` calls within `http` and `https` modules. (NB: Not a typo this is a creator^2!) | function _createWrappedRequestMethodFactory(breadcrumbsEnabled, tracingEnabled) {
return function wrappedRequestMethodFactory(originalRequestMethod) {
return function wrappedMethod() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments... | [
"function createHttp() {\n const http = {\n request(url, options = {}) {\n return new Promise((resolve, reject) => {\n fetch(url, options).then((response) => {\n if (response.ok) {\n response.json().then((data) => {\n resolve(data)\n })\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end utility functions reliableEntropy is the Shannon Entropy with the total always being 1 for hot init | function reliableEntropy (pspace) {
let tfreq = vectorSum(Object.values(pspace)) + 1
let hrel = -(1 / tfreq) * Math.log2(1 / tfreq)
for (var freq in pspace) {
var tmp = pspace[freq] / tfreq
hrel -= tmp * Math.log2(tmp)
}
return hrel
} | [
"get entropy(): number {\n return 0.5 * 0.693 * Math.log2(2* Math.PI * Math.E * this.trials * this.successProb * (1 - this.successProb));\n }",
"generateEntropy () {\n return this.get32RandomBytes();\n }",
"get entropy(): number {\n return -1 * (Math.log(1- this.p) * (1 - this.p) + Math.log... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Run the constraint with the given ID. | function runConstraint(constraintId, responseDiv) {
console.log("runConstraint(" + constraintId + ")");
responseDiv.text("");
responseDiv.attr("class", "list-group-item"); // reset the CSS of the DIV
showSpinner();
$.ajax(JqaConstants.REST_ANALYSIS_CONSTRAINT_URL,
{
'data': c... | [
"runValidation(validationId, planId) {\n return this.defaultRequest(`/validations/${validationId}/run`, {\n method: 'PUT',\n data: { plan_id: planId }\n });\n }",
"function check_compound_constraint(constraint_id){\n\n var reverse_constraint_lookup = \n e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recontruct the world from past epochs | async build (history, getCurrent) {
// Get epoch models sorted oldest to most recent
this.history = history ? history.map(item => {
return item instanceof Epoch ? item : new Epoch(item);
}).sort((a, b) => {
return parseInt(a._signed_.number) - parseInt(b._signed_.number);
}) : [];
if (this.history.len... | [
"function epoch(currentEpoch) {\n\n // Randomize the order of the cities and loop through them\n var rndCityIndices = shuffleArray(Array.apply(null, { length: numCities }).map(Number.call, Number));\n\n for (var i = 0; i < numCities; i++) {\n\n var city = cities[rndCityIndices[i]];\n var winn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
code to get Restricted locations data | function hrAuthRestrictedRole() {
gso.getCrudService().execute(constants.get,'/api-config/v1/company/'+gso.getAppConfig().companyId+ "/" +gso.getAppConfig().userId+'/locations',null,
function (response) {
$scope.locationsData = response;
},... | [
"function u(){n.getData(m.getParameterizedUrl(\"FIND_ACCESSIBLE_SYSTEM_LOCATION\"),null,function(b){a.accessabelSystemLocation=b.data,a.accessabelSystemLocation&&!o.isEmpty(a.accessabelSystemLocation)&&(a.whetherSystemUser=!0)},function(a){o.isEmpty(a.data)||o.isEmpty(a.data.messages[0])||g(\"error\",i.instant(a.da... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load tags that a user just added for both websites | function loadTags(website, tags) {
var site = '#' + website;
var editor = $(site).next('.CodeMirror')[0].CodeMirror;
var tag_names = "";
var colors = ['red', 'pink', 'yellow', 'purple', 'deep-purple', 'indigo', 'blue', 'light-blue', 'cyan', 'teal', 'green', 'light-green', 'lime', 'amber', 'orange', 'deep-orange... | [
"function getUserTags(username) {\n\tvar query = \"SELECT Content.id, username_tagger, username_taggee, Tag.timest \" +\n\t\t\t\t\"FROM Tag, Content WHERE Tag.id = Content.id AND username_taggee = ? AND status IS false\";\n\treturn new Promise((resolve, reject) => {\n\t\tconnection.query(query, username, (err, rows... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the next prefetch request should only be served from the edge cache. This is done by comparing a random number between 0 and 1 to options.forcePrefetchRatio | function shouldAcceptThrottling() {
return !options.forcePrefetchRatio || Math.random() > options.forcePrefetchRatio;
} | [
"validatePrefetch(cachedResponse) {\n const isThrottled = Object.keys(this.request.query || {}).includes(constants_1.THROTTLED_QUERY_PARAM);\n if (isThrottled && !cachedResponse) {\n this.response.writeHead(constants_1.LAYER0_UNCACHED_PREFETCH_STATUS);\n this.response.end();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset environment variables used by JSDoc to the default values for tests. | function resetJsdocEnv() {
const env = require('jsdoc/env');
env.conf = {
tags: {
dictionaries: ['jsdoc']
},
templates: {
cleverLinks: false,
monospaceLinks: false
}
};
env.dirname = path.resolve(__dirname, '../../node_modules/jsdoc');... | [
"static resetEnvVariables() {\n for (const k in TestEnvConfig) {\n delete process.env[k];\n }\n TestEnvConfig = {};\n }",
"function reset() {\n environment = { ...defaultEnvironment };\n}",
"function clear() {\n const env = getEmptySlateEnv();\n SLATE_ENV_VARS.forEach(key => process.env[key] =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
; public static const ISSUE_ELEMENT_LINK:BEMElement = | function ISSUE_ELEMENT_LINK$static_(){IssuesPanelBase.ISSUE_ELEMENT_LINK=( IssuesPanelBase.ISSUE_BLOCK.createElement("link"));} | [
"function ISSUE_BLOCK$static_(){IssuesPanelBase.ISSUE_BLOCK=( new com.coremedia.ui.models.bem.BEMBlock(\"cm-issue\"));}",
"function EBX_Constants() {\r\n\r\n}",
"function EBX_Constants() {\n\n}",
"function ELEMENT_ICON$static_(){IconWithTextBEMEntities.ELEMENT_ICON=( IconWithTextBEMEntities.BLOCK.createElemen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The CenterControl adds a control to the map that recenters the map on Chicago. This constructor takes the control DIV as an argument. | function CenterControl(controlDiv, map) {
// Set CSS for the control border.
var controlUI = document.createElement('div');
controlUI.style.backgroundColor = '#fff';
controlUI.style.border = '2px solid #fff';
controlUI.style.borderRadius = '3px';
controlUI.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)... | [
"function CenterControl(controlDiv, map) {\n \n // Set CSS for the control border.\n var controlUI = document.createElement('div');\n controlUI.className=\"mapCenterButton\"\n controlUI.title = 'Click to recenter the map';\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the db name from the url path. Strip nonword characters and 'store/' from the start | function getDbName(url) {
//get the path and make the db name the path.json
var dbName = url.pathname.replace(/\W/g, '').replace(/^store/, '');
if (dbName) {
return dbName + '.json';
}
return 'default.json';
} | [
"function getDatabaseName() {\n const url_string = window.location.href;\n const url = new URL(url_string);\n const dbNameFromUrl = url.searchParams.get('database');\n\n let ret = 'heroesdb';\n if (dbNameFromUrl) {\n console.log('databaseName from url: ' + dbNameFromUrl);\n ret += dbNam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given plant information, we fill in the defaults. | function fill_default_show(plant) {
$("#water-amount").val(plant.water);
$("#sunlight-amount").val(plant.sunlight);
$("#plant-season").val(plant.plant_during);
$("#bloom-season").val(plant.blooming_season);
} | [
"function setupPlant() {\n // Generate mostly random values for the arguments of the Plant constructor\n for (let i = 0; i < numLeaves; i++) {\n let leafX = random(225, 275);\n let leafY = random(440, 450);\n let leafWidth = random(0, 5);\n let leafHeight = random(0, 10);\n let leafAvatar = leafAva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This anonymous function takes three parameters and adds them together then returns the total back to addTasks. | function addTasks(pasqualeTasks, darylTasks, kadriTasks ){
var totalTasks = Number(pasqualeTasks) + Number(darylTasks) + Number(kadriTasks);
return totalTasks;
} | [
"function getTotal() {\n let args = Array.prototype.slice.call(arguments);\n\n if (args.length == 2) return args[0] + args[1];\n else if (args.length == 1) {\n return (num2) => {\n return args[0] + num2;\n };\n }\n}",
"addAdditionTask(y) {\n this.tasks.push((x) => x+y);\n }",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
proxy clicks to input focus | click() {
this.$('input').focusin();
} | [
"setFocus() {\n trapFocus(this.wrapper);\n }",
"setFocus(){\n this.getInputEle().focus();\n }",
"focus() {\n this.callMethodOnElementOrChild(this.input, 'focus');\n }",
"setFocus() {\n const focusable = this.wrapper.querySelectorAll('a, button, input, select')[0];\n if (focusable) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Selects the next tab in the list, if any. | selectNextTab() {
const selectedTab = this.selectedTab;
const tabs = this.tabs;
const length = tabs.get('length');
let idx = selectedTab.get('index');
let tab;
do {
idx++;
// Next from the last tab should select the first tab.
if (idx === length) {
idx = 0;
}
... | [
"_nextTab() {\n const tabs = this._allTabs();\n let newIdx = tabs.findIndex(tab => tab.selected) + 1;\n return tabs[newIdx % tabs.length];\n }",
"_nextTab() {\n const tabs = this._allTabs();\n let newIdx = tabs.findIndex(tab => tab.selected) + 1;\n return tabs[newIdx % tabs.length];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the measure question from a set of numeric responses | function getMeasureQuestionFromNumericResponses(numericResponses) {
for (var i = 0; i < numericResponses.length; i++) {
// Check if we hit the magic measure question
if (numericResponses[i].question_id == this.standardMeasureQuestion.id) {
return numericResponses[i];
}
}
return... | [
"function getMeasureQuestionAnswer(measureQuestion) {\n\n var possibleAnswers = this.standardMeasureQuestion.answers;\n\n // Loop through our predefined array of measure question answers (excellent, very good...)\n for (answer in possibleAnswers) {\n\n // Get question column\n if (measureQuestion... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Grabs values from the comment form fields and places them in the object which is subsequently pushed into an array | function getVal() {
let obj = {};
obj.userName = document.getElementById('name').value;
obj.userComment = document.getElementById('comment').value;
arrayOfDynamicComments.push(obj);
} | [
"function postNewComments(input, formData) {\n // return array of only objects that has new comments and with all other properties\n const updatedData = [];\n\n for (const id in formData) {\n const matchingData = input.find((element) => {\n return element.id == id;\n });\n\n if (matchingData.commen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for repositoriesWorkspaceRepoSlugCommitNodeApprovePost / Approve the specified commit as the authenticated user. This operation is only available to users that have explicit access to the repository. In contrast, just the fact that a repository is publicly accessible to users does not give them the a... | repositoriesWorkspaceRepoSlugCommitNodeApprovePost(incomingOptions, cb) {
const Bitbucket = require('./dist');
let defaultClient = Bitbucket.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = incomingOptions.apiKey... | [
"getAllApprovePost({ commit }, payload) {\n return new Promise((resolve, reject) => {\n const query = new URLSearchParams(payload).toString();\n axios\n .get(`${ENDPOINTS.POSTS.GET}/approved?${query}`)\n .then(res => {\n commit(\"SET_POST\", res.data);\n resolve(res);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Assemble l'objet de contact et le tableau d'id de produit | function assembleProductEtContact() {
let products = creerTableauCommande();
let contact = creerObjetContact();
return {contact, products};
} | [
"function User_Insert_Contacts_Liste_des_contacts0(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 2\n\nId dans le tab: 114;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 115;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\n******************\n*/\n\n var Table=\"contact\";\n var CleMaitre = T... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
transferFunds function allows user to see transfer menu and to transfer funds to another user | function transferFunds() {
console.log("\nTRANSFER FUNDS");
console.log("-----------------------------");
console.log(user.name + ", (ID: " + user.id + ")");
console.log("Current balance: " + Math.floor(user.balance* 100) / 100);
console.log("-----------------------------");
const transferAmount... | [
"function transferFunds(amount, user, escrow, loanId, orderBookId) {\n\n var amt = web3.toWei(amount);\n // console.log(orderBookId, amt);\n loanCreatorInstance.transferFunds(loanId, orderBookId, {\n from: user,\n value: amt\n }, function(err, res) {\n console.log(res);\n if (!err) {\n // var x... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle bookmark moved event bnId = string. ID of the item that was moved. curParentId = string. ID of the current parent folder. targetParentId = string. ID of the new parent folder. targetIndex = integer. The new index of this item in its parent. | function bkmkMoved (bnId, curParentId, targetParentId, targetIndex) {
//console.log("Move event on: "+bnId+" from: <<"+curParentId+">> to: <<"+targetParentId+", "+targetIndex+">>");
if (!isDisplayComplete) // If we get an event while not yet ready, ignore
return;
// Retrieve the real BookmarkNode and all its chil... | [
"async function moveBkmk (a_id, a_BN, newParentId, newIndex = undefined) {\n let len = a_BN.length;\n // Fecord a multiple operation if more than one item in the array\n if (len > 1) {\n\tawait recordHistoryMulti(\"move\", a_id);\n }\n\n if (newIndex == undefined) { // Cut and pasting into a folder, at end\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End Segment2d\\ Start Segment3d\\ Segment3d Class | function Segment3d () {
/**
* Ray of segment
* @type Ray3d
*/
this.pRay = new Ray3d();
/**
* Distance
* @type Float
*/
this.fDistance = 0.0;
} | [
"function SegmentBase() {\n}",
"function doSegmentDemo() {\n appendHeading(\"Segment\");\n let qr;\n let segs;\n const QrCode = qrcodegen.QrCode; // Abbreviation\n const QrSegment = qrcodegen.QrSegment; // Abbreviation\n // Illustration \"silver\"\n const silver0 =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `DistributionConfigProperty` | function CfnDistribution_DistributionConfigPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
errors.collect(cdk.propertyValidator('aliases', cdk.listValidator(cdk.validateString))(properties.aliases));
... | [
"function CfnDistributionPropsValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('distributionConfig', cdk.requiredValidator)(properties.distributionConfig));\n e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Represents a strategy that validates the configuration (post loading). | function ValidateClientConfigStrategy () {
} | [
"function Strategy() {\n passport.Strategy.call(this);\n this.name = 'requireuser';\n}",
"constructor(strategy) {\n /**\n * @type {Strategy} The Context maintains a reference to one of the Strategy\n * objects. The Context does not know the concrete class of a strategy. It\n * should work with al... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reset the CBT by connecting at 1200 baud | function reset(){
var oldBaudRate = baudRate;
baudRate = 1200;
close()
.then(open)
.then(close)
.then(function(){
baudRate = oldBaudRate;
open();
$timeout(function(){
$rootScope.$broadcast('SerialService.RESET' );
}, 500);
});
} | [
"function re_connectSerial(){ \n setTimeout(function(){\n connectSerial();\n }, 2000);\n }",
"function resetDevice()\n{\n sendMidi(0xB0, 0, 0);\n\n for(var i=0; i<80; i++)\n {\n pendingLEDs[i] = 0;\n }\n flushLEDs();\n}",
"function reset_settings()\n {\n set... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
N is a variable for storing the length of input string bubblesortstr is a user defind fucntion which takes the original string and sort it | function bubblesortstr(string1) {
var N = string1.length;
array1 = string1.split("");
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
if (array1[j + 1] < array1[j]) // comparing the adjacent element
{
temp = array1[j + 1];
array1[... | [
"insertionSortForString(n, arr) {\n\n var temp;\n var j;\n\n for (i = 1; i <= n; i++) {\n temp = arr[i];\n j = i - 1;\n while (temp < arr[j] && j >= 0) {\n arr[j + 1] = arr[j];\n j = j - 1;\n }\n arr[j + 1] = t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loads usage data for the given timeframe and format. | async fetchUsages(timeframe, format) {
const url = this.createUrlBuilder()
.setFileType("txt" /* TEXT */)
.setTimeframe(timeframe)
.setFormat(format)
.build();
return usages_1.usageFromString(await this.request(url, "txt" /* TEXT */));
} | [
"async loadPerformanceHistory() {\n let rawFile = null;\n try {\n rawFile = await fse.readFile(this.hardConfigs.heatmapDataFile, 'utf8');\n } catch (error) { }\n\n const setFile = async () => {\n try {\n await fse.writeFile(this.hardConfigs.heatmapDat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
select and focus on plot change the view of active plot | function focusIn(element, type){
let clicked = d3.select(element);
if (type == "plot") d3.activeGraph.activePlot = clicked;
else if (type == "cursor") {
d3.activeGraph.activeCursor = clicked;
}
} | [
"function focusIn(element, type){\n let clicked = d3.select(element);\n if (type == \"plot\") d3.activeGraph.activePlot = clicked;\n else if (type == \"cursor\") d3.activeGraph.activeCursor = clicked;\n }",
"function activateChart() {\n drawChart(store, xChoice.getValue(), yChoice.getValu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a Query with a path and optional additional query constraints. Path must currently be empty if this is a collection group query. | function Query(path, collectionGroup, explicitOrderBy, filters, limit, startAt, endAt) {
if (collectionGroup === void 0) {
collectionGroup = null;
}
if (explicitOrderBy === void 0) {
explicitOrderBy = [];
}
if (filters === void 0) {
filters = [];
}
if (limit === void 0) ... | [
"function Query(path, collectionGroup, explicitOrderBy, filters, limit, startAt, endAt) {\n if (collectionGroup === void 0) { collectionGroup = null; }\n if (explicitOrderBy === void 0) { explicitOrderBy = []; }\n if (filters === void 0) { filters = []; }\n if (limit === void 0) { limit ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Simple hash for mapping items to indices. ITEMS is a seq of objects, each having field denoted by KEY. Map item.key to item's index in ITEMS. Returns resulting association map (hash map). | function simpleHash (items, key) {
var itemhash = {};
var i = 0;
for (var o in items) {
var x = items[o][key];
itemhash[x]=i;
i = i + 1;
}
return itemhash;
} | [
"function createKeyToIndexMap(items, start, end) {\n const map = new Map();\n for (let i = start; i <= end; i++) {\n const item = items[i];\n if (item !== null) {\n map.set(item.key, i);\n }\n }\n return map;\n}",
"function indexBy(iterator, context) {\n var memo = n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
print enemies onto HTML | function printEnemies(){
for (var i = 0; i < enemies.length; i++) {
var en = $('<div class="fighter enemy media p-2 m-2 rounded" data-fighter-pos="'+fighters.indexOf(enemies[i])+'"><div class="media-body"><h5>'+enemies[i].name+'</h5><p>Health: '+enemies[i].health+'</p></div><img src="'+enemies[i].img+'" alt="... | [
"function showEnemies(){\n enemies.forEach(function(enemy) {\n $('#enemies').prepend($(\"<div>\").html(\"<img src='assets/images/\" + enemy.name + \".png' alt='\" + enemy.name + \"'>\"));\n });\n }",
"function displayEnemies() {\n\n\t\tvar enemiesCounter = 0;\n\n\t\t// Loop through the... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Web Sockets Functions Sharing userselected EQ type to backend | function getEQtype() {
var x = document.getElementById("EQtype").value;
console.log(x);
var socket = io.connect('http://localhost:3001');
socket.on('connect', function(data){
socket.emit('typeSel', x);
});
} | [
"function sendVoteChar(){\n\tcheckConnection();\n\tvar socket = io();\n\tvar val = sessionStorage.getItem('user');\n\tsocket.emit('Get Voted Charities', val);\n}",
"function askValue(e){\n\n var payload = {\n key: document.getElementById('key_to_obtain').value\n }\n socket.send(JSON.stringify(payload));\n \... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fonction qui incremente le nombre de victoires pour le login | async function incrementeVictoires(login){
try{
await knex.raw("UPDATE users SET partiesGagnees = partiesGagnees+1 WHERE users.login= ?", [login]);
}
catch(err){
console.error('Erreur dans la connection d\'un utilisateur dans la table users (incrementeVictoires)');
}
} | [
"function addCount() {\n if (count == 16) {\n count = 0;\n // console.log(count);\n showPerson();\n // console.log('count:',count);\n flashIndex();\n } else {\n count += 1;\n // console.log(count);\n showPerson();\n // console.log('count:', ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes year, month and day as strings and pads them as needed | function normalizeDate(year, month, day) {
return [year.padStart(4, '2000'), month.padStart(2, '0'), day.padStart(2, '0')];
} | [
"function padDate(date) {\n const year = date.getFullYear();\n const month = date.getMonth() + 1;\n const day = date.getDate();\n\n return year + String(month).padStart(2, \"0\") + String(day).padStart(2, \"0\");\n}",
"dateString(someDate = new Date()) {\n let year = String(someDate.getFullYear()).padStart... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changer le titre de la page | function replace_titre_page() {
add_log(3,"replace_titre_page() > Début.");
var nouv_titre = "[" + document.title.split(" ")[1].toUpperCase() + "] " + var_divers['village_actif_nom'] + " (" + var_divers['village_actif_pos'][0] + "|" + var_divers['village_actif_pos'][1] + ")";
document.title = nouv_titre;
add_lo... | [
"function changeTitleEverywhereOnThePage(pageName, newTitle)\r\n{\r\n\t//get global title (20 = length of \"Заголовок сторінки: \")\r\n\tvar titlePrefix = $(\"[id $= '_title_label']\").html().substring(\"Заголовок сторінки: \".length, $(\"[id $= '_title_label']\").html().length);\r\n\t\r\n\t//change editor form dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Process the bidding history to find the first bid of a particular userID | function showFirstBid() {
var aBid;
var i=0;
var firstBidString="You have not placed a bid in this auction.";
var searchUserID=document.forms[0][2].value.toUpperCase();
var endOfBidHistory=auction.bidHistory.length==i;
var found=false;
while (!endOfBidHistory && !found) {
aBid=auction.bidHistory[i];
if (aB... | [
"function showFirstBidLogic() {\n\tvar aBid;\n\tvar i=0;\n\tvar firstBidString=\"You have not placed a bid in this auction.\";\n\tvar searchUserID=document.forms[0][2].value.toUpperCase();\n\tvar found=false;\n\t\n\twhile ((i!=auction.bidHistory.length) && !found) {\n\t\taBid=auction.bidHistory[i];\n\t\tif (aBid.us... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
change the slider Development Mode | function toogleSlider()
{
if($('#DevelopmentModeToggle .slider').hasClass('sliderRight')){
$('#DevelopmentModeToggle .slider').removeClass('sliderRight');
$('#DevelopmentModeToggle .slider').addClass('sliderLeft');
}
else{
$('#DevelopmentModeToggle .slider').removeClass('sliderLeft');
$('#DevelopmentModeTogg... | [
"function drawingSwitchToSlideMode()\n{\n\tcurrentMode = SLIDE_MODE;\n\n\tvar tempDict;\n\n\tif (ROOT_NODE.hasAttribute(\"style\"))\n\t\ttempDict = propStrToDict(ROOT_NODE.getAttribute(\"style\"));\n\telse\n\t\ttempDict = new Object();\n\n\ttempDict[\"cursor\"] = \"auto\";\n\tROOT_NODE.setAttribute(\"style\", dictT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send an expression (or result of an advanced expression) to the input screen. | function addHistExprToScreen(expr){
var inputScreen = document.querySelector('.screen');
// extract inner expression from a square root expression and send the square root of that expression to the input screen.
if(expr.startsWith('sqrt(')){
var innerExpr = evaluateArgument(expr.substring(5, expr.length-1));
inp... | [
"function display(answer) {\n\texpression.value = answer;\n}",
"function calculate(equation) {\n let answer = eval(equation);\n document.getElementById('screen').value = answer;\n}",
"function pressOperator(op) {\n terms[0] = num;\n terms[1] = op.value;\n showDisplay(op.value)\n num = '';\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate DOM elements for variant selectors ============================================================ | function generateSelectors(product) {
var elements = product.options.map(function(option) {
return '<select name="' + option.name + '">' + option.values.map(function(value) {
return '<option value="' + value + '">' + value + '</option>';
}) + '</select>';
});
return element... | [
"function generateDOMProductSelector(product) {\n $(`#product-${product.id} .product-variantSelector`).html(generateSelectors(product));\n }",
"function generateSelectors(product) {\n var elements = '';\n\n product.options.map(function(option) {\n elements +='<ul name=\"' + option.name + '\" clas... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
delete a specific supplier | deleteSupplier(params){
return Api().delete('/suppliers/' + params)
} | [
"function destroy(supplier_id) {\n // Unlike update() and insert(), del() does not accept any arguments\n return knex(\"suppliers\").where({ supplier_id }).del();\n}",
"function deleteSupplier(id) {\n results.style.display = \"none\";\n SupplierController.Delete(id, onDeleteSupplier);\n}",
"function... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
callback allowing modification of newly created image objects | imageCreated(/* image */) {} | [
"addImage() {\n }",
"function setImageChanged() {\n imageChanged = true;\n}",
"imageProcessed(img, eventname) {\n console.log(img.hist);\n this.allpictures.insert(img);\n console.log(\"image processed \" + this.allpictures.stuff.length + eventname);\n if (this.allpictures.stuff.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate element ancestors. Check if an element has the required set of elements. At least one of the selectors must match. | static validateAncestors(node, rules) {
if (!rules || rules.length === 0) {
return true;
}
return rules.some((rule) => node.closest(rule));
} | [
"function isAncestorOf(element, selector) {\n\n // If the element itself matches, then we're done already.\n if (element.matches(selector)) {\n return true;\n }\n\n // Ascend along the ancestor elements and check.\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load the interactions from a scene and keep it in common variable | function LoadInteractions() {
ReadCSV("CurrentIntro", CurrentChapter, CurrentScreen, "Intro", GetWorkingLanguage());
ReadCSV("CurrentStage", CurrentChapter, CurrentScreen, "Stage", GetWorkingLanguage());
LoadText();
} | [
"function loadScene() {\n var obj = pullGet();\n if (obj) {\n loadFromObject(obj);\n }\n}",
"interact() {\n if (this.currentInteractive instanceof Book) {\n //var text = this.scene.add.bitmapText(this.x,this.y + 100, 'editundo', this.currentInteractive.formattedText);\n game.sce... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stack limit checks only occur for Kernel mode and are either a yellow warning trap after instruction completion, or a red abort which stops the current instruction. | function stackCheck(virtualAddress) {
"use strict";
if (!CPU.mmuMode) { // Kernel mode 0 checking only
if (virtualAddress <= CPU.stackLimit || virtualAddress >= 0xfffe) {
if (virtualAddress + 32 <= CPU.stackLimit || virtualAddress >= 0xfffe) {
CPU.displayPhysical = -1; // Set... | [
"function stackCheck(virtualAddress) {\n \"use strict\";\n if (!CPU.mmuMode) { // Kernel mode 0 checking only\n if (virtualAddress <= CPU.stackLimit || virtualAddress >= 0xfffe) {\n if (virtualAddress + 32 <= CPU.stackLimit || virtualAddress >= 0xfffe) {\n CPU.CPU_Error |= 4; ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
===================RABBITMQ============================= Set up and start rabbit mq | function start() {
amqp.connect(config.rabbit.url, function (err, conn) {
if (err) {
return setTimeout(start, 1000);
}
conn.on("error", function (err) {
if (err.message !== "Connection closing") {
}
});
conn.on("close", function () {
... | [
"async start() {\n try {\n const conn = await this.createConnection();\n console.log(\"Connected to RabbitMQ\");\n this.channel = await conn.createChannel();\n await this.channel.assertExchange(RABBITMQ_EXCHANGE, \"direct\", {\n durable: false,\n });\n let queue = await this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check buffer length regularly and apply various policies to avoid buffering | _checkBuffer() {
const EPS = 1e-3;
if (this.config.isLive) {
// Live stream, try to maintain buffer between 3s and 8s
// TODO make 3s and 8s configurable
let currentBufferEnd = this.getCurrentBufferEnd();
if (typeof currentBufferEnd === 'undefined') {
// QUICKFIX:
// if g... | [
"onBuffering() {}",
"function checkBufferCompleteness(buffer) {\n // Return 0 if buffer's length less than 6, it means that the buffer has not been received completely.\n if (buffer.length < 6) {\n return 0;\n }\n const bodyLength = buffer.readInt32BE(2);\n return 6 + bodyLength;\n}",
"function _isBuffe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Estimates cloud shadow mask from image sun parameters. | function computeCloudShadowMask(sunElevation, sunAzimuth, cloudMask, options) {
var maxCloudHeight = 8000 // in image pixel units
var cloudHeightStep = 200
var radiusDilate = 10
var radiusErode = 3
if(options) {
maxCloudHeight = options.maxCloudHeight || maxCloudHeight
cloudHeightStep = options.clo... | [
"function cloud_and_shadow_maskS2(img) {\n var toa = sentinel2toa(img);\n var cloud = ESAcloud(toa);\n var shadow = shadowMask(toa,cloud);\n var mask = cloud.or(shadow).eq(0);\n return toa.updateMask(mask);\n }",
"function projectShadows(cloudMask,image,irSumThresh,contractPixels,dilatePixels,clou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to delete a channel name for an event via the REST API | function delete_slack_channel_for_event(event_id, channel_id, callback) {
var url = "/events/" + event_id + "/slack-channels/"+channel_id;
$.ajax_delete(url, callback);
} | [
"function delete_channel_for_event(event_id, channel_id, callback) {\n var url = \"/events/\" + event_id + \"/channels/\"+channel_id;\n $.ajax_delete(url, callback);\n}",
"deleteChannel(name){\n if(typeof this.activeChannels[name]!=='undefined') {\n delete this.activeChannels[name];\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Keep track of slider state and update price accordingly | onSliderChange(e, v) {
const newValue = Math.round(v * this.maxServiceHours);
const diff = newValue - this.state.previousServiceHours;
this.setState({
serviceHours: newValue,
price: this.state.price + (this.props.data.flatrate.serviceHourPrice * diff),
previou... | [
"function updateSlider() {\n var val = $(\"#slider\").val();\n\n $(\"#salary-cap-box\").html(`$${addCommas(val)}`);\n luxuryTax();\n }",
"function onSliderChange() {\n var zero = ($(\"#slider\").val() == 0);\n $(\"#not-paying\").toggle(zero);\n $(\"#payment-types\").toggle(!zero);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
xPageY, Copyright 20012007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL | function xPageY(e)
{
var y = 0;
e = xGetElementById(e);
while (e) {
if (xDef(e.offsetTop)) y += e.offsetTop;
e = xDef(e.offsetParent) ? e.offsetParent : null;
}
return y;
} | [
"function _loadYDirectPageX() {\n this.name = \"Load Index Register Y from Memory Direct Page Indexed X\"\n this.argCount = 0;\n this.size = Size.INDEX;\n this.addrMode = AddressingMode.DIRECT_PAGE_INDEXED_X;\n this.mnemonic = 'LDY'\n}",
"function xPageY(e)\n{\n if (!(e=xGetElementById(e))) return 0;\n var... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
picks config.tagsCount random tags from config.tags list | function pickRandomTags() {
const tags = config.tags.sort((a, b) => Math.random() > 0.5 ? 1 : -1);
let res = '';
for (let i = 0; i < config.tagsCount; ++i) {
res += `#${tags[i]} `;
}
return res.trim();
} | [
"function createTagPool(){\n let tagPool = [];\n let i;\n for (i = 0; i < 10; i++) {\n tagPool.push(faker.lorem.word());\n }\n _.uniq(tagPool);\n return tagPool;\n}",
"function getRandomTag() {\n\tvar tagLists = [\n\t\tapparelTags, \n\t\tcelebrityTags, \n\t\tcolorTags, \n\t\tdemographicsTags, \n\t\tfoodT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name:onlinePushNotificationiPhoneCallback Author:Kony Purpose:Callback function for the push message recieving event while online. | function onlinePushNotificationiPhoneCallback(msg, actionId) {
kony.print("************ JS onlinePushNotificationCallback() called *********");
kony.print("\n received push:-" + JSON.stringify(msg));
//alert("Message: "+JSON.stringify(msg));
kony.print("Action id is:" + actionId);
if (actionId == "a... | [
"function onlinePushNotificationCallback(msg){\n debugger;\n kony.print(\"************ JS onlinePushNotificationCallback() called *********\");\n kony.print(JSON.stringify(msg));\n kony.store.setItem(\"isNewOnlineNotification\", true);\n var currentForm = kony.application.getCurrentForm();\n if(currentForm.id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function will initiate the stripe checkout flow requires orderId | function intStripeCheckOut(orderId, email){
//get the sku of the item to be ordred
var stripeSKU = $(this).data('init-checkout-flow');
//get the active product
var product = getActiveProduct();
//init stripe
var stripe = Stripe('pk_test_9zTgVGnh5lp27tRAdf0DDSkO');
//get the quantity of items... | [
"async function startCheckout() {\n const {error} = await stripe.redirectToCheckout({\n sessionId: s_id\n });\n\n if (error) {\n alert('Something went wrong with the payment, please try again.');\n }\n}",
"async function startCheckout() {\n const { error } = await stripe.redirectToChe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculating the Block Data Hash SHA256 hashing of the JSON representation of the following fields 'index' 'transactions' 'difficulty' 'prevBlockHash' 'minedBy' | calculateBlockDataHash() {
let transactionsListJson = [];
for (let i = 0; i < this.transactions.length; i++) {
let transactionJson = this.transactions[i];
let transactionDataToAddJson = {
'from': transactionJson.from,
'to': transactionJson.to,
... | [
"calculateBlockHash(){\n return SHA256(this.index + this.timestamp + JSON.stringify(this.data) + this.prevHash).toString();\n }",
"calculateBlockHash() {\n let blockHashDataToHashString = `${this.blockDataHash}|${this.nonce}|${this.dateCreated}`;\n let blockHash = CryptoJS.SHA256(blockHashDataTo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renderizamos el componene ListaResultados con sus subcomponentes en un div id=cuerpo Recibe la lista de resultados | function renderizar(resultadosBusqueda){
ReactDOM.render(<ListaResultados list={resultadosBusqueda}/>,document.getElementById("Cuerpo"));
controlEventosJquery();
} | [
"function consultarDatosPuntos() {\n $.ajax({\n type: 'POST',\n dataType: 'json',\n url: url + \"ReporteAPH/ctrlLocalizacionLesiones/ListarDatosPuntos\",\n data: {\"idReporteAPH\": idReporteAPH}\n }).done(function (res) {\n\n var puntoTemp = [];\n\n // Recorro el json res por ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Shows the remote window | function showRemote() {
$("#remote").centerInClient();
$("#remote").css("display", "block");
documentReady();
} | [
"show()\n {\n this._window.show();\n }",
"show() {\n this.window.show();\n this.window.focus();\n }",
"function openAdminRemoteWindow() {\n\turl = \"/internal/adminremote.php\";\n var adminRemoteWindow =\n window.open(url,\n \"adminRemoteWindow\",\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called when user presses the "reconnect" button. Basically restarts channel. | function user_reconnect() {
console.log("User reconnected.");
attempt_reopen_channel = true;
fullyUsedUp = false;
// set this to true so websockets automatically reopen the channel if they fail
open_channel = true;
send_version();
set_ui_state(UI_STATES.CONNECTED);
} | [
"on_reconnect(context) {\n logger.err(\"On_reconnect called. :c\");\n this.currentState = STATE.RECONNECTING;\n stats.reconnectedCount++;\n }",
"_onReconnectAttempt () {\n log( 'Event: reconnect_attempt' );\n\n this.emit( 'reconnect_attempt' );\n }",
"function OnPlayerReconnect(data) {\n\tPlaye... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
= Description Call this if you need to remove a component from its parent's views array without destroying the DOM element itself, making it in effect a view without parent. Useful, for example, for moving a view from one parent component to another. = Returns +self+ | remove() {
if (this.parent) {
const _viewZIndex = this.parent.viewsZOrder.indexOf(this.viewId);
const _viewParentIndex = this.parent.views.indexOf(this.viewId);
this.parent.views.splice(_viewParentIndex, 1);
HSystem.delView(this.viewId);
this.parent.viewsZOrder.splice(_viewZIndex, 1);
... | [
"remove() {\n for (let i = 0; i < this._childViews.length; i++) {\n // no need to unregister child from parent,\n // since the parent is also being removed\n this._childViews[i]._unregisterFromParent = false;\n this._childViews[i].remove();\n }\n\n if (this._parentView && this._unregist... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set click events for mobile nav and country selector | setEvents() {
$('.fa-bars').click(() => {
$('.top-nav').addClass('-active');
});
this.$navToggle.on('click', (e) => {
e.preventDefault();
this.$navMenu.toggleClass('-active');
this.$navToggle.toggleClass('-close');
});
$(document).on('click', this.$countryToggle.selector, (e) => {
e.preventD... | [
"function setClickEvents() {\n // Toggle html class\n [...nodes.navToggle].forEach((btn) => {\n btn.addEventListener('click', () => {\n App.EM.emit('Nav::toggle');\n });\n });\n }",
"function initMobileNav() {\n jQuery('.wrap').mobileNav({\n menuActiveClass: 'active',\n menuOpene... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws the axes on the chart, on the bottom and to the right. TODO: Different axes styles, i.e. x=0, y=0, right, left | draw_axes () {
let canvas = this.layers.get(CONST.CHART_LAYER_AXES);
// Draw axes
let ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = CONST.WHITE;
ctx.lineWidth = 3;
ctx.beginPath();
ctx.moveTo(0, canvas.height-this.chart_padding_x_ax... | [
"function draw_axes() {\n\t\t// Open the path to start drawing\n\t\tcontext.beginPath();\n\t\t\n\t\t// Start the path at the top of the y-axis\n\t\tcontext.moveTo(40, graph_properties.top_gap);\n\t\t\n\t\t// Draw the rest of the path\n\t\tcontext.lineTo(40, 344);\n\t\tcontext.lineTo(490, 344);\n\t\tcontext.lineTo(4... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Utility function to add metdata to a vFile. | function addMetadata(vFile, destinationFilePath) {
vFile.data = {
destinationFilePath,
destinationDir: path.dirname(destinationFilePath),
};
} | [
"updateDataFile(file, data, info) {\n console.log(file, this._mapFile[file]);\n this._mapFile[file]['info'] = info;\n this._mapFile[file]['data'] = data;\n }",
"function add(data, filepath, stats){\n newUpdates.push({\n app: data.app,\n version: completeVer(data.version),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
moveDown(board: Board, emptyIdx: int): void | function moveDown(board, emptyIdx){
for(let i = emptyIdx; i < board.HEIGHT - 1; i++){
let copy = [];
for(let j = 0; j < board.WIDTH; j++){
copy.push(board.board[i+1][j]);
}
board.board[i] = copy;
}
for(let i = 0; i < board.WIDTH; i++){
board.board[board.HEIGHT - 1][i] = {isEmpty: () => true, color: () =... | [
"moveDown() {\n let indexZero = this.board.indexOf(0);\n if (indexZero < this.board.length - this.N) {\n this.__makeMove__(indexZero, indexZero + this.N);\n }\n }",
"moveUp() {\n let indexZero = this.board.indexOf(0);\n if (indexZero > this.N - 1) {\n this.__makeMove__(indexZero, indexZe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the default domain. | setDefaultDomain() {
let htmlFileName = window.location.href.split('/').filter((pth) => pth.indexOf('.html') > -1)[0] || '____'
config.domain = window.location.href.replace(htmlFileName, '');
if (config.domain.slice(-1) === '/') {
config.domain = config.domain.slice(0, -1)
}
... | [
"function setDomain(domain) {\n\t defaultDomain = domain;\n\t hasSetDomain = true;\n\t}",
"function getDomain() {\n\t return defaultDomain;\n\t}",
"function setDomain() {\n let parseDomain = function(url) {\n if (!url || typeof url !== 'string' || url.length === 0) return;\n\n var match = url.ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
= [ 20, 2, 4.428571428571429 ] Given an array, if a value in that array is a negative, replace with the word "Negative": | function replaceNegative(arr){
for(var i = 0; i < arr.length; i++){
if(arr[i] < 0){
arr[i] = "Negative"
}
}
console.log(arr);
} | [
"function replaceNegatives(array){\n for (var i = 0; i < array.length; i++) {\n if (array[i] < 0){\n array[i] = 0;\n }\n }\n return array;\n}",
"function SwapStringForArrayNegativeVals(arr) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] < 0) {\n arr[i] = 'dojo';\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method for overriding Here should be all of footer render | renderFooter() {
return null;
} | [
"renderFooter() {\n return null;\n }",
"get footerRender() {\n return this.$slots.footer || this.$props.footer ? (\n <footer class={`${this.prefixCls}-footer`}>{this.$slots.footer || this.$props.footer}</footer>\n ) : null;\n }",
"renderFooterWrapper() {\n return (\n <footer>\n {t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
An element consisting of an image on the left and an article with a scrollbar on the right articleright options: 0: image URL 1: article text | function buildArticleRight(options) {
html += `<section id="article-right">
<img src="${options[0]}" />
<p>${options[2]}</p>
</section>
`} | [
"function buildArticleLeft(options) {\n html += `<section id=\"article-left\">\n <p>${options[2]}</p>\n <img src=\"${options[0]}\" />\n \n </section>\n `}",
"function scrollThumbnailRight() {\n\t\t// Set flag to using scrolls\n\t\tthumbnailScrollUse = true;\n\n\t\tif (thumbnailScrollIndex >=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public function `infinity`. Returns true if `data` is positive or negative infinity, false otherwise. | function infinity (data) {
return data === neginf || data === posinf;
} | [
"function infinity (data) {\n return data === Number.POSITIVE_INFINITY || data === Number.NEGATIVE_INFINITY;\n }",
"function infinity(data) {\n return data === neginf || data === posinf;\n}",
"function infinity(data) {\n return data === neginf || data === posinf;\n }",
"function infinity(data) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Setup typeahead on the category input, killing the prevous instance if present. | setupCategorySearch() {
if (this.typeahead) this.typeahead.destroy();
$('#category-input').typeahead({
ajax: {
url: 'https://commons.wikimedia.org/w/api.php',
timeout: 200,
triggerLength: 1,
method: 'get',
preDispatch: query => {
return {
acti... | [
"_createTypeahead() {\n\n if (this.typeahead === true || this.inputEl.getAttribute('data-typeahead') !== null) {\n this.typeahead = new Typeahead(this.el, {\n onBlur: this._onBlurBound\n });\n }\n }",
"function initializeTypeahead() {\n var reinitialize = !!terms;\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
with ticket update radio box checked, pop up the tickets | function statusRadioTicket(e) {
if (e.id == 'optTicket1') {
$('#list-tickets').show('0.3');
} else {
$('#list-tickets').hide('0.3');
}
} | [
"function changeViewTickets(){\n\tif($(\"#webpartTickets .slm-layout-main\").attr(\"data-current\") == \"cards\"){\n\t\tfade($(\"#webpartTickets .ticket_display\"),\"out\",null);\n\t\tfade($(\"#webpartTickets .ticket_submit\"),\"in\",\"add\");\n\t}\n\telse if($(\"#webpartTickets .slm-layout-main\").attr(\"data-curr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lookup table for btoa(), which converts a sixbit number into the corresponding ASCII character. | function btoaLookup(idx) {
if (idx < 26) {
return String.fromCharCode(idx + 'A'.charCodeAt(0));
}
if (idx < 52) {
return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));
}
if (idx < 62) {
return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));
}
if (idx == 62) {
return '+';
}
if (i... | [
"function btoaLookup(idx) {\n\t if (idx < 26) {\n\t return String.fromCharCode(idx + \"A\".charCodeAt(0));\n\t }\n\t if (idx < 52) {\n\t return String.fromCharCode(idx - 26 + \"a\".charCodeAt(0));\n\t }\n\t if (idx < 62) {\n\t return String.fromCharCode(idx - 52 + \"0\".charCodeAt(0));\n\t }\n\t if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find an enemy tile adjcaent to fog with a minimum army value | static chooseEnemyTargetTileByLowestArmy(gameState, gameMap) {
let tilesWithFog = [];
//loop through all visible enemy tiles
for (let [key, value] of gameState.enemyTiles) {
if(gameMap.isAdjacentToFog(gameState, key)) {
tilesWithFog.push({"index": key, "value": value});
}
}
if(tilesWithF... | [
"function steeringBehaviourLowestCost(agent) {\r\n\r\n\t//Do nothing if the agent isn't moving\r\n\tif (agent.velocity.magnitude() == 0) {\r\n\t\treturn zeroVector;\r\n\t}\r\n\tvar floor = agent.floor(); //Coordinate of the top left square centre out of the 4\r\n\tvar x = floor.x;\r\n\tvar y = floor.y;\r\n\r\n\t//F... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get an xkcd comic | function getXkcd (number, callback) {
var BASE_URL = 'https://xkcd.com/'
var url
if (number) {
url = BASE_URL + number + '/info.0.json'
} else {
url = BASE_URL + 'info.0.json'
}
var options = {
url: url,
json: true
}
request(options, (err, res, body) => {
if (res.statusCode === 200) ... | [
"function retrieveComic(doc_id){\n var comic = DocumentApp.openById(doc_id).getBody().getText();\n return comic\n}",
"function srvConcGet(cntx) {\n\t\tvar dataRequest = {\n\t\t\tiden: cntx.form.get('conc').data\n\t\t};\n\t\tsetBase(dataRequest, cntx);\n\t\t\n\t\tvar d = $q.defer();\n\t\t\n\t\tvar output = srv.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs features necessary for a coverage track showing base composition for BAM reads Params features: a list of features from BAM records. currentRefSeq: a DASSequence object containing reference sequence. baseColors: an object mapping base to desired colors. Returns a list of features of type basecoverage. | function getBaseCoverage(features, currentRefSeq, baseColors) {
var minBin = null;
var maxBin = null;
var allBins = [];
// Populate BaseBins
for (var fi = 0; fi < features.length; ++fi) {
var f = features[fi];
if (f.groups && f.groups.length > 0) {
// Don't downsample c... | [
"function getBaseCoverage(features, currentRefSeq, baseColors) {\n var minBin = null;\n var maxBin = null;\n\n var allBins = [];\n\n // Populate BaseBins\n for (var fi = 0; fi < features.length; ++fi) {\n var f = features[fi];\n if (f.groups && f.groups.length > 0) {\n // Don... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return Vega sort parameters (tuple of field and order). | function sortParams(orderDef, fieldRefOption) {
return array(orderDef).reduce(function (s, orderChannelDef) {
var _a;
s.field.push(_vgField(orderChannelDef, fieldRefOption));
s.order.push((_a = orderChannelDef.sort) !== null && _a !== void 0 ? _a : 'ascending');
return s;
}, {
fie... | [
"function common_sortParams(orderDef, fieldRefOption) {\n return vega_util_src_array(orderDef).reduce((s, orderChannelDef) => {\n var _a;\n s.field.push(channeldef_vgField(orderChannelDef, fieldRefOption));\n s.order.push((_a = orderChannelDef.sort, (_a !== null && _a !== void 0 ? _a : 'asce... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a string describing `odesc`. | function operationMeaning (odesc) {
let msg
switch (odesc.type) {
case 'accountMerge':
return 'Merge account inside {destination}'
case 'allowTrust':
if (odesc.authorize) {
return 'Allow usage of your asset {assetCode} to {trustor}'
} else {
return 'Deny usage of your asset... | [
"function getDescription(){\n\t\tvar str = \"Draw Tool\";\n\n\t\treturn str;\n\t}",
"function calcolaStringaSoggetto(sog) {\n var res = sog.codiceSoggetto || \"\";\n res = sog.denominazione ? res + \" - \" + sog.denominazione : res;\n res = sog.codiceFiscale ? res + \" - CF: \" + sog.codiceF... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends a request to the server to add a new artifact to a project. This AJAX request has content type urlformencoded. | function onAddNewArtifactSubmit() {
let form = new FormData(this);
form.append('action', 'addArtifact');
api.post('/artifacts.php', form, true)
.then(res => {
snackbar(res.message, 'success');
onAddArtifactSuccess(
res.content.id,
form.get('na... | [
"issueAddArtifact(artifact,op) {\n if (artifact && op) {\n var body = this.suppliedArtifact;\n body.nodeType = this.name;\n body.class = this.name;\n // copy in values from this.suppliedArtifact\n\n this.$.addGridArtifactAjaxId.method =\"post\";\n this.$.addGridArtifac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws an array of SCRIB.Face_Info structures to the screen, using HTML5 Canvas2D. | function drawFaceInfoArray(G, face_info_array)
{
var len = face_info_array.length;
for(var i = 0; i < len; i++)
{
var face = face_info_array[i];
// Note: We could put the color attribute in face.face.faceData.color,
// But, I want to keep halfedge stuff out of my ScribbleJS user's m... | [
"function drawFaceInfoArray(G, face_info_array)\n{\n\n var comp_faces = [];\n\n var len = face_info_array.length;\n for(var i = 0; i < len; i++)\n {\n var face = face_info_array[i];\n\n // Note: We could put the color attribute in face.face.faceData.color,\n // But, I want to keep h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the index of the reader based on its id | function getReaderIndexByID(id){
// Iterates through the reader array
for (var i = 0; i < readerArr.length; i++) {
// If the id is correct, return the index
if (readerArr[i].id == id) {
return i;
}
}
// If id not found, return the length (next index) of the array
return readerArr.length;
} | [
"function getIndex(id){\n for(var i = 0; i < self.length; ++i)\n if(self.fields[i].id == id)\n return i;\n return -1;\n }",
"function _findIndexFromID(id) \n{\n var len=this.rsList.length, i=0;\n\n for(i=0; i<len; i++) {\n\tif(id == this.rsList[i].ruleID)\n\t break;\n }\n if(i ==... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |