query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Defines the adding time powerup | function addTime() {
timer = timer + 30;
} | [
"function powerupTime() {\n powerupTimer--;\n textSize(20);\n fill(0, 80, 80);\n \n text(`Powerup Timer: ${powerupTimer}`, width / 2, 25);\n \n if (powerupTimer <= 0) {\n powerupOn = false;\n step = 10;\n }\n}",
"_startTimer() {\n let interval = this.config[\"appear\"][\"interval\"]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to create a tube | function tubeLittle(r, h) {
var domaint = DOMAIN([[0,1],[0,2*PI]])([8, 8]);
var tube = CYL_SURFACE([r,h])(8);
var basetmp = BEZIER(S0)([[r, 0, 0], [r, 0, 0], [0, 0, 0]]);
var mappingbase = ROTATIONAL_SURFACE(basetmp);
var base = MAP(mappingbase)(domaint)
var baset = T([2])([h])(base);
return STRUCT([tube, base, ... | [
"function makeTube(){\n // <editor-fold defaultstate=\"collapsed\" desc=\"Method Code\">\n if(self.viewer.tubeVisible){\n self.viewer.createTubeGeometry(self.stlParameters.linearSegments,\n self.stlParameters.tubeRadius, self.stlParameters.radialSegments,\n sel... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
all subclasses of Media has title property, which doesn't have any default value. Hence, constructor method for Media takes only 'title' as an argument | constructor(title) {
// these 3 properties are common to all subclasses of Media
this._title = title;
this._isCheckedOut = false; // to check whether the library is currently in possession of an item or not.
this._ratings = [];
} | [
"constructor(text, media, title, date){\n\t\tsuper(EVENT_SYMBOL, text, media);\n\t\t\n\t\t// check if title was included\n\t\tif (title === undefined){\n\t\t\tthis.title = '';\n\t\t} \n\t\telse{\n\t\t\tthis.title = title;\t\n\t\t}\n\n\t\t// check if time was included\n\t\tif (date === undefined){\n\t\t\tthis.date =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Write a function named modulus that takes two arguments. The function should use the modulo operator to return the remainder between the first and second arguments. e.g. modulus(10, 3) // Should return 1. | function modulus (x, y) {
return x % y;
} | [
"function modulo(a , b){\n return (remainder(a , b));\n}",
"function remainder(a , b){\n return a % b;\n}",
"function modulo(a, b) {\n return a % b;\n}",
"function remainder(a, b) {\n return a % b;\n}",
"function modulo(a, b) {\n return a % b;\n\n }",
"function mod(a, b){return ((a%b)+b)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Methods for iOS users: replaces URL with the respective application URL Schemas | function modifyURLSchema(url, author) {
var parsedURL = url;
if (isIOS) {
if (("standalone" in window.navigator) && window.navigator.standalone) {
parsedURL = parseURLToSchema(parsedURL, author);
}
}
return parsedURL;
} | [
"function updateEngineURL(url, appId) {\n let URLobject = new URL(url);\n const path = URLobject.pathname.length > 1 ? URLobject.pathname : '';\n const app = appId || '';\n URLobject = URLobject.origin + path + app + URLobject.search;\n assignEngineUrl(URLobject);\n }",
"function mungeURL(url) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Dynamically add the limits for choosing the new job post expiry. | function renderJobExpiryLimits() {
const date = new Date();
const min = date.toISOString().substr(0, 10);
date.setFullYear(date.getFullYear() + 1);
const max = date.toISOString().substr(0, 10);
const datePicker = document.getElementById('expiry');
datePicker.setAttribute('min', min);
datePicker.setAttrib... | [
"function setItemExpiry(maxAge){\n\treturn Date.now() + maxAge;\n}",
"function setPolicyLimits() {\n $rootScope.claimItems.forEach(function (item) {\n $rootScope.policyDetails.coverages.forEach(function (cat) {\n if (item.category.id === cat.id) {\n item.limit = cat.limit;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
execute a script that has been preloaded already | function execute_preloaded_script(chain_opts, script_obj, registry_item) {
var script;
function preload_execute_finished() {
if (script != null) { // make sure this only ever fires once
script = null;
script_executed(registry_item);
... | [
"function execute_preloaded_script(chain_opts,script_obj,registry_item) {\n\t\t\tvar script;\n\t\t\t\n\t\t\tfunction preload_execute_finished() {\n\t\t\t\tif (script != null) { // make sure this only ever fires once\n\t\t\t\t\tscript_executed(registry_item);\n\t\t\t\t\tscript = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates height for table widget. | updateHeightForTableWidget(tables, rows, tableWidget, endRowWidget) {
for (let i = 0; i < tableWidget.childWidgets.length; i++) {
let rowWidget = tableWidget.childWidgets[i];
if (rowWidget === endRowWidget) {
break;
}
this.updateHeightForRowWidget(... | [
"setTableHeight() {\n if (!this.context.isRoisTabActive()) return;\n\n this.setHeaderWidth();\n $(\".regions-table\").css(\n 'max-height', 'calc(100% - ' +\n ($(\".regions-tools\").outerHeight() +\n $(\"#panel-tabs\").outerHeight()) + 'px)');\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========================================================= register yourself as children of the parent(cells that are appearing in the formula) ========================================================= | function setParentCHArray(formula, chAddress) {
let formulaTokens = formula.split(" ");
for (let i = 0; i < formulaTokens.length; i++) {
let ascii = formulaTokens[i].charCodeAt(0);
// ascii valid or not
if (ascii >= 65 && ascii <= 90) {
let { rid, cid } = getRIDCIDfromA... | [
"function setParenttoChildren(formula,childrenAddress){\n let formulatoken = formula.split(\" \");\n for(let i = 0; i < formulatoken.length; i++){\n let ascii = formulatoken[i].charCodeAt(0);\n if(ascii >= 65 && ascii <= 90){\n let obj = getindices(formulatoken[i]);\n let p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check whether or not the page has a calltoaction | function hasCallToActionOnPage() {
// needed because Gatsby is built server-side
if (typeof document !== 'undefined') {
// Check if there is an element with the "call-to-action" class
const hasCallToAction = document.querySelector('.call-to-action') !== null
return hasCallToAction
}
// Otherwise we ... | [
"function isThisPageAnySendTroopsPage() { return (isPageAnySendTroopsPage(document.location.href)); }",
"doesActionExist() {\n\t\t\tthis.actionExists = 'undefined' !== typeof W.accelerators.Actions[this.name];\n\t\t\treturn this.actionExists;\n\t\t}",
"function isThisPageAllianceForumMsgs() { return (isPageAlli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a new MultiLine | function MultiLine(name) {
var _this = _super.call(this, name) || this;
_this.name = name;
_this._lineWidth = 1;
/** Function called when a point is updated */
_this.onPointUpdate = function () {
_this._markAsDirty();
};
_this._automaticSize = true;
... | [
"function MultiLine(name){var _this=_super.call(this,name)||this;_this.name=name;_this._lineWidth=1;/** Function called when a point is updated */_this.onPointUpdate=function(){_this._markAsDirty();};_this._automaticSize=true;_this.isHitTestVisible=false;_this._horizontalAlignment=_control__WEBPACK_IMPORTED_MODULE_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
map a function onto a node, which can be any type | function mapNode(node, f) {
// check null first since typeof null is "object".
if (node === null) {
return f(node);
} else if (node.constructor === Array) {
return node.map(f);
} else if (typeof(node) === 'object') {
var out = {};
for (var key in node) {
out[key] = f(node... | [
"function mapVisit(nodes, fn) {\n var len = nodes.length;\n var idx = -1;\n while (++idx < len) {\n visit(nodes[idx], fn);\n }\n }",
"function mapVisit(nodes, fn) {\n var len = nodes.length;\n var idx = -1;\n\n while (++idx < len) {\n visit(nodes[idx], fn);\n }\n }",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
After the user has finished creating/editing exercises in the set, this function will be run. If a user is editing an existing set, a put request will be sent. If a new set is made, a post request will be sent. | function onSubmitSet() {
if (
!formDataSet.chat1 &&
!formDataSet.forstaelse1 &&
!formDataSet.ryddeSetninger1
) {
setErrorMessage(
'Du må legge til minst en oppgave for å opprette et sett.'
);
} else if (location.state?.editSet) {
axiosInstance()
.put(`/cre... | [
"function submit(){\n requestAccessToken(global_enterpriseEndpointUri, global_tokenEndpointUri, global_clientId, global_clientSecret,global_scope);\n if(!changeExerciseState) { //assuming correct input \n insertExerciseTime(global_token, currentDay, programTitle,time,exercise);\n }\n else {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Getter for the height of each item in the list. | get _itemHeight() {
return this._list.selectedItem.clientHeight;
} | [
"get calculatedItemHeight() {\n const firstNode = this.findFirstNode();\n const { calculatedItemMarginTop, calculatedItemMarginBottom } = this;\n const height = firstNode ?\n parseInt(getComputedStyle(firstNode).height, 10) : 0;\n return calculatedItemMarginTop + height + calculatedItemMarginBottom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to create buttons for cities that the user has previously searched | function createCityBtns(searchedCities) {
//empties city button div
$('.cityBtns').empty();
//variable declarations
var searchedCity;
var searchedState;
var searchedCityState;
//for loop to create a button for each city stored in the searchedCities array
for (var i = 0; i < searchedCi... | [
"function renderCityBtn() {\n searchResults.empty();\n for (var i = 0; i < cityList.length; i++) {\n var createBtn = $(\"<button>\");\n createBtn.addClass(\"city-btn\");\n createBtn.attr(\"data-name\", cityList[i]);\n createBtn.text(cityList[i]);\n searchResults.append(createBtn);\n }\n}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PROTECTED Sets the final coordenates, or at least the coordenates where the selection process is currently. | function setFinalCoords(x, y) {
this.finalX = eval(x);
this.finalY = eval(y);
} | [
"setLooseCoord (coord) {\n let width = coord.x - this.fixedCoord.x,\n height = coord.y - this.fixedCoord.y,\n heightCoefficient = (height < 0) ? -1 : 1;\n\n this.width = width;\n this.height = Math.abs(width) * this.aspectRatio * heightCoefficient;\n\n let looseCoor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Navigate to the next page, if possible. | function goToNextPage() {
if ( canNextPage() ) {
goToPage( currentPage() + 1 );
}
} | [
"function gotoNextPage() {\r\n var currentIndex,\r\n nextIndex = $(\"#\" + getCurrentPage()).data(\"nextpage\");\r\n \r\n if (nextIndex === undefined && pageFlowKey) {\r\n currentIndex = pageFlowKey.indexOf(getCurrentPage());\r\n console.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called from the new chordswindow, and fills it with the current chords. | function getChords()
{
chordsWin.insertChords(document.getElementById('editArea').value);
chordsWin.focus();
} | [
"function displayChords(chord){\n\t\t\t// reset key colors\n\t\t\t$('.vpcf_black_key').css('background-color', '#000000');\n\t\t\t$('.vpcf_white_key').css('background-color', '#FFFFFF');\n\n\t\t\t// reset the displayed notes\n\t\t\t$('.vpcf_notes').text('');\n\n\t\t\t// for each note in the chord highlight on the k... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks for the equality of 245c, other cases should be handled by 'author' check. | function author245c(record1, record2) {
var fields1 = select(['245..c'], record1);
var fields2 = select(['245..c'], record2);
var norm245c = ['toSpace("-")', 'delChars("\':,.")', 'trimEnd', 'upper', 'utf8norm', 'removediacs', 'removeEmpty'];
var normalized1 = normalize(select(['245..c'], record1), norm245c);
... | [
"function author_equal(a, b) {\n return a['name'] == b['name'] && a['email'] == b['email'];\n}",
"function do_check_author(aActual, aExpected) {\n do_check_eq(aActual.toString(), aExpected.name);\n do_check_eq(aActual.name, aExpected.name);\n do_check_eq(aActual.url, aExpected.url);\n}",
"function checkXr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draw given edges on the map | function renderEdges(edges, map) {
var overlayPane = d3.select(map.getPanes().overlayPane);
removeEdges(map);
var svg = overlayPane.append('svg').attr('class', 'leaflet-zoom-hide edges');
var g = svg.append('g');
var min = _.min(edges, 'counts').counts;
var ... | [
"function renderEdges()\n\t{\n\t\tvar startV, endV;\n\t\tvar x1, x2, y1, y2;\n\t\tcanvasContext.beginPath();\n\t\tcanvasContext.lineWidth = 1;\n\t\tcanvasContext.strokeStyle='#888';\n\t\tcanvasContext.lineJoin = \"round\";\n\t\tvar n = edges.length;\n\t\t\n\t\tfor (var i = 0; i < n; i++)\n\t\t{\n\t\t\tif (edges[i] ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: Shuffles the elements of the array (a) | function shuffle(a) {
var j, x, i;
for (i = a.length - 1; i > 0; i--) {
j = Math.floor(Math.random() * (i + 1));
x = a[i];
a[i] = a[j];
a[j] = x;
}
return a;
} | [
"function fyShuffle(a) {\n for (var i = a.length; i--; ) {\n var j = rng(i);\n var t = a[i];\n a[i] = a[j];\n a[j] = t;\n }\n return a;\n}",
"function shuffleArray(array) {\n\n}",
"function shuffleElements (arr) {\n\n\tfor (var i = 0; i <64; i++) {\n\t\tvar a = Math.floor(Ma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update parent hash. If FM is not present, update local hash | function updateParentHash (hash) {
if (!FM) {
window.location.hash = hash;
} else {
FM.triggerMessage("QZParent", "child:updateHash", {
hash : hash
});
}
return;
} | [
"function updateParent(entry, callback) {\n readTree(entry.parent, function (err, entries, tree) {\n if (err) return callback(err);\n var found = false;\n for (var i = entries.length - 1; i >= 0; i--) {\n var peer = entries[i];\n if (peer.name !== entry.name) continue;\n found... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads the component's texture tag | readingTextures(textureElem) {
if (textureElem == null)
this.graph.onXMLError("components:: it must have one texture block.");
var id = this.reader.getString(textureElem, 'id');
this.cgfTextureId = id;
if (id == "inherit") {
this.cgfTexture = null;
... | [
"get textureValue() {}",
"get texture() {\n return this.rt.texture\n }",
"get Texture() {}",
"get texture() {\n return this._texture\n }",
"get textureType() {}",
"get texture() {\n return \"texture\" in this.shader ? this.shader.texture : null;\n }",
"get texture() {\n return this.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete form by pressing for 5 seconds click on Delete button | deleteForm() {
cy
.get(this.locators.deleteButton)
.trigger('mousedown')
.wait(5000)
return this;
} | [
"function deleteStaffTake() {\n //request to delete the staff take form\n}",
"function deleteCountdown() {\n var btn = $('#btn-delete');\n var btn2 = $('#del-surveys-btn');\n deleteTimer--;\n if (deleteTimer > 0) {\n btn.html('Click again to confirm(' + deleteTimer + ')');\n btn2.html... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add custom amount Bank Slots | function bankSlots(amount) {
chrome.tabs.getSelected(null, function(tab){
var c = "var s = document.createElement('script');\
s.textContent = \"bankMax+=0+"+amount+"; updateBank();\";\
document.head.appendChild(s);"
chrome.tabs.executeScript(tab.id, {code: c});
});
} | [
"function addToSpendingMoney(sumToBeAdded) {\n spendingMoney += Number(sumToBeAdded);\n const spendingMoneyLbl = document.getElementById(\"spending-money\");\n spendingMoneyLbl.innerHTML = spendingMoney;\n }",
"function updateBankBalance(amount, isAdd) {\n // const totalTag = document.get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return location of msedge.exe file for a given Edge directory. (available: "Edge", "Edge Beta", "Edge Dev", "Edge SxS") | function getEdgeExe (edgeDirName) {
// Only run these checks on win32
if (process.platform !== 'win32') {
return null
}
let windowsEdgeDirectory
let i
let
prefix
const suffix = `Microsoft\\${edgeDirName}\\Application\\msedge.exe`
const prefixes = [process.env.LOCALAPPDATA, process.env.PROGRAMFIL... | [
"function GetExePath(name) {\n var prefManager = Components.classes[\"@mozilla.org/preferences-service;1\"]\n\t.getService(Components.interfaces.nsIPrefBranch);\n\n var os = prefManager.getCharPref(MY_OS_PREF); // get os preference string which maps to the /bin/<os> location of the executable!\n\n var prom... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find Consecutive Sums You are given arr, a list of positive integers 0255 You are given k, a integer between 1255 Find all the consecutive groups of integers that add up to the value k inputs k = 16 arr = [2, 5, 3, 6, 7, 0, 0, 23, 11] outputs [ [2, 5, 3, 6], [3, 6, 7] // 3, 6, 7 appear consecutively, so they are includ... | function findConsqSums(arr, k) {
if (arr.length == 0) return [];
let result = [];
for (let i = 0; i < arr.length; i++) {
if (arr[i] > k) continue;
let temp = [];
let sum = arr[i];
temp.push(arr[i]);
let j = i;
while (j < arr.length && (sum + arr[j + 1]) <= k) {
j++;
sum += arr[j];
temp.push(arr[... | [
"function array_max_consecutive_sum(nums, k) {\n let result = 0;\n let temp_sum = 0;\n for (var i = 0; i < k - 1; i++) {\n temp_sum += nums[i];\n }\n for (var i = k - 1; i < nums.length; i++) {\n temp_sum += nums[i];\n if (temp_sum > result) {\n result = temp_sum;\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a URLsafe UUID | function url_safe_uuid() {
return urlencodeBase64(btoa(uuid_fn()));
} | [
"function uuid() {\n token = decodeToken();\n if (token && token['https://linuxacademy.com/auth/uuid']) {\n return token['https://linuxacademy.com/auth/uuid'];\n } else {\n return '';\n }\n}",
"function getUUID() {\n const buffer = new Buffer(16);\n uuidV4(null, buffer, 0);\n var origin64 = buff... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hover for sub categories function | function hoverToDisplaySubCategories() {
// Variables:
// Item Categories
const categories = document.querySelectorAll(".category");
categories.forEach((category) => {
category.addEventListener("click", function (e) {
console.log(category.nextElementSibling);
category.nextElementSibli... | [
"function showSubcategories(category) {\n\n // Highlight only the category selected\n var allCategories = document.getElementsByClassName(\"category\");\n for (var i = 0; i < allCategories.length; i++) {\n allCategories[i].style.color = \"white\";\n }\n var currentCategory = document.getElemen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make a HighCharts chart from a 1D objective function selector: the CSS selector for the element to create the chart in func: the 1D objective function to use start: the start of the x range to plot the chart over end: the end of the x range to plot the chart over | function makeChart(selector, func, start, end) {
// Sample the function
var samples = sampleFunc(func, start, end);
// Compute the Y range
var yRange = computeRange(samples)[1];
// Compute the precision we should display tooltips over
var xPrec = computePrecision(start, end);
var yPrec = comput... | [
"function createData1(data,array1,title,xAxisLabel,yAxisLabel, divid1)\n{\n var array=new Array();\n array[0]=[\"\"];\n for(var m=0;m<1;++m)\n {\n array[0][m+1]=array1[m];\n }\n var date_index=1;\n var date_length=1;\n var j_index=1;\n $.each(data,function(i,val)\n {\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the theme object. | function getTheme() {
return _theme;
} | [
"function getTheme() {\n\t return _theme;\n\t}",
"get theme() {\n return this.m_themeManager.theme;\n }",
"function getTheme()\r\n{\r\n\treturn getUtilities('theme').theme;\r\n}",
"get theme() {\n return this._current;\n }",
"getTheme() {\n return {\n palette: this.P... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
mouse coordinates event handler that also moves the box | function eventMouseMove(e) {
//move the box based on the mouse X and Y
movePiece(e.offsetX, e.offsetY);
} | [
"function getPosition(event) {\r\n\t\tposX = event.clientX;\r\n\t\tposY = event.clientY;\r\n\t\t$('#map-hover-box').css({\r\n\t\t\t'left': posX - ($('#map-hover-box').outerWidth(true) / 2),\r\n\t\t\t'top': posY + 15\r\n\t\t});\r\n\t}",
"function mouseMove(event) {\n var viewportCoords = getClickedCoords(event)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
addFirst() Returns a new array with a prepended item or items. Usage: `addFirst(array: Array, val: Array|T): Array` ```js arr = ['a', 'b'] arr2 = addFirst(arr, 'c') // ['c', 'a', 'b'] arr2 === arr // false arr3 = addFirst(arr, ['c', 'd']) // ['c', 'd', 'a', 'b'] ``` | function addFirst(array, val) {
if (Array.isArray(val)) return val.concat(array);
return [val].concat(array);
} | [
"function addFirst(array, val) {\n if (Array.isArray(val)) return val.concat(array);\n return [val].concat(array);\n } // -- #### removeLast()",
"function addFirst(array, val) {\n if (Array.isArray(val)) return val.concat(array);\n return [val].concat(array);\n} // -- #### r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
assumes all elements of class "check" are img elements and gives them the inactive check picture hovering and clicking cause the image to change | function populateChecks() {
var allChecks = document.getElementsByClassName("check");
for (var i = 0; i < allChecks.length; i++) {
allChecks[i].src = "images/inactiveCheck.png";
allChecks[i].onmouseenter = function() {
this.src = "images/hoverCheck.png";
}
allChecks[i].onmouseleave = function() {
... | [
"function changeToCheck(p_image) {\n\n uncheckAll(); // Uncheck all image before check this image\n\n // Change the image style to be 'selected'\n p_image.prop('class', 'relative m-2 border-solid border-2 border-green-500 shadow-2xl rounded');\n p_image.children().find(\"input\").prop(\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========================================================================= MethodName: InitiateLegFromTruck Description: Insert Arguments: string Return Value: none =========================================================================== | InitiateLegFromTruck() {
let legFromTruck = new LegPIA();
legFromTruck.legID = this.LegFromPIA.legID; // From PIA
legFromTruck.locationName = this.LegFromPIA.locationName; // From PIA
legFromTruck.DeliverLocation = this.LegFromPIA.DeliverLocation; // From PIA
// Other Data of thi... | [
"function CementTruck() { }",
"createTruck() {\n console.log('creating a truck');\n if (this.state.truck.name && this.state.truck.handle && this.state.truck.yelpId) {\n\n let truckObj = {};\n truckObj.truck = this.state.truck;\n truckObj.days = [];\n for(var key in this.state.days){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is going to be for sorting out employees. | function filterEmployeesbyName() {
// Sorts users by first name, then second if first name is similar, and if both are identical, then sort by ID.
return;
} | [
"function sortEmployees(){\n\tvar employees = myCompany.employees;\n\tvar $employeeList = $('#employeeList');\n\n\t//First, remove the current display of employees\n\t$employeeList.children().remove();\n\n\t//Sort the array of employees alphabetically by lastname\n\temployees.sort(function (a,b){\n\t\tif (a.lastnam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: isFloatD4(valueOfStr). Description: Check out that if the parameter valueOfStr is one float number with 4 decimals. Param: A string or a number. Return: True when it is or it can be cast to a float number and with 4 decimals, otherwise return false. | function isFloatD4(valueOfStr){
var patrn1 = /^([+|-]?[0-9])+(.[0-9]{0,4})?$/;
try{
//alert("isFloatD4("+valueOfStr+").patrn="+patrn1.exec(valueOfStr));
if (patrn1.exec(valueOfStr)){
return true;
}else{
return false;
}
}catch(e){
return false;
}
} | [
"function isFloatTD4(valueOfStr, eLength){\r\n\tvar patrn1 = /^([+|-]?[0-9])+(.[0-9]{0,4})?$/;\r\n\ttry{\r\n\t\t//alert(\"isFloatTD4(\"+valueOfStr+\",\"+eLength+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\t\t\r\n\t\t\tvar tlen = valueOfStr.length;\r\n\t\t\tvar dot = valueOfStr.indexO... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gameRandomCheck 6 random event tiles | function gameRandomCheck(){
if (dogOne.currentStep == 3 || dogOne.currentStep == 6 || dogOne.currentStep == 9 || dogOne.currentStep == 12 || dogOne.currentStep == 16 || dogOne.currentStep == 19){
dogOneGameRandomEvent();
return;
} if (dogTwo.currentStep == 3 || dogTwo.currentStep == ... | [
"randomTile() {\r\n let size = this.size;\r\n let rand1 = Math.floor(Math.random() * size * size);\r\n let rand2 = Math.floor(Math.random() * 10);\r\n let success = false;\r\n while (!success) {\r\n if (this.gameState.board[rand1] === 0) {\r\n success = t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
jsontruncate code, from does not modify input, returns object with truncations. | function truncateJson(obj, maxDepth, options, curDepth) {
if (maxDepth === void 0) { maxDepth = 10; }
if (options === void 0) { options = {}; }
if (curDepth === void 0) { curDepth = 0; }
var flatTypes = [String, Number, Boolean];
function isDefined(val) {
return val !== null && val !== undef... | [
"function truncateObject(obj, level) {\n var maxLength = scale(maxObjectLength, level);\n var dst = {};\n var length = 0;\n for (var key in obj) {\n dst[key] = truncate(obj[key], level);\n length++;\n if (length >= maxLength) {\n break;\n }\n }\n return dst;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function is called when the "Add selected items to cart" button in clicked The purpose is to build the HTML to be displayed (a Paragraph) We build a paragraph to contain the list of selected items, and the total price | function selectedItems(){
var ele = document.getElementsByName("product");
var chosenProducts = [];
var c = document.getElementById('displayCart');
c.innerHTML = "";
// build list of selected item
var para = document.createElement("P");
para.innerHTML = "You selected: ";
para.appendChild(document.createEl... | [
"function selectedItems() {\n\n\tvar c = document.getElementById('displayCart')\n\tc.innerHTML = ''\n\n\n\t// build list of selected item\n\tvar para = document.createElement('P')\n\tpara.innerHTML = 'You selected : '\n\tpara.appendChild(document.createElement('br'))\n\tfor (i = 0; i < cart.length; i++) {\n\t\tpara... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disposes the current player, if there is one. | disposePlayer() {
// Nothing to dispose.
if (!this.player) {
return;
}
// Dispose an in-page player.
if (this.player.dispose) {
this.player.dispose();
// Dispose an iframe player.
} else if (this.player.parentNode) {
this.player.parentNode.removeChild(this.player);
}... | [
"remove() {\n player.dispose();\n }",
"function closePlayer() {\n win.close();\n checkPlayer();\n}",
"function destroyPlayer() {\n PLAYER.obj.destroy();\n PLAYER.obj = null;\n PLAYER.state = null;\n document.getElementById('player_iframe').innerHTML = '';\n\n if (PLAYER.video) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
console.log(param1); console.log(param2); console.log(param3); } panggilParameter('Jakarta','Medan','Balikpapan') | function panggilParameter(idNegara, dataKota) {
console.log(idNegara);
console.log(dataKota);
} | [
"function panggilparameter(){\n console.log('jakarta');\n}",
"function objeto_params(){\n \n}",
"function panggilParamter(idNegara, dataKota) {\n console.log(idNegara);\n console.log(dataKota);\n}",
"function ausgabeNamenParams(firstName, familyName) {\r\n console.log(\"Hallo \" + firstName + \" ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Keeps value within min and max | function keepWithin(value, min, max) {
if(value < min) value = min;
if(value > max) value = max;
return value;
} | [
"function keepWithin(value, min, max) {\n if( value < min ) value = min;\n if( value > max ) value = max;\n return value;\n }",
"function keepWithin(value, min, max) {\n if(value < min) value = min;\n if(value > max) value = max;\n return value;\n }",
"function keepWithin(value, min,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds an introspection to `generates` | function addIntrospection(config) {
config.generates['./graphql.schema.json'] = {
plugins: ['introspection']
};
} | [
"instantiateAll () {\n const files = this.findGeneratorFiles('./templates', /\\.js$/);\n\n files.forEach((filename) => {\n const Constructor = require(filename);\n const object = new Constructor();\n this.viewGenerators[object.constructor.name] = object;\n if (!this.viewGeneratorsContentTy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Triggers the interaction > moreResults analytics event | function allResultsLoadedInteraction() {
pushAnalytics({'event':'interaction_allResultsLoaded'});
} | [
"function moreResultsInteraction() {\n pushAnalytics({'event':'interaction_moreResults'});\n}",
"function addMoreEvents() {\n\n // When the addEventsButton is clicked, increase the number of results displayed with 10\n numberOfResultsDisplayed = numberOfResultsDisplayed + 10\n displayEvents()\n\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get user's information by device address or create new user, if it's new device address | function readUserInfo(deviceAddress, callback) {
db.query(
`SELECT
users.user_address, users.device_address,
users.bt_user_id, receiving_addresses.bt_user_name
FROM users
LEFT JOIN receiving_addresses USING(device_address, user_address)
WHERE device_address=?`,
[deviceAddress],
(rows) => {
if (row... | [
"async function readUserInfo(device_address, callback) {\n\tlet unique_id = crypto.randomBytes(16).toString(\"hex\"); // 32 chars\n\tlet rows = await db.query(`SELECT * FROM users WHERE device_address = ?;`, [device_address]);\n\tif (rows.length) {\n\t\tlet userInfo = rows[0];\n\t\tuserInfo.github_options = userInf... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the largest option length. | largestOptionLength() {
const options = [].slice.call(this.options);
options.push({
flags: '-h, --help'
});
return options.reduce((max, {
flags
}) => Math.max(max, flags.length), 0);
} | [
"largestCommandLength() {\n const commands = this.prepareCommands();\n return commands.reduce((max, command) => Math.max(max, command[0].length), 0);\n }",
"function getOptionsWidth(args) {\n return args.options.reduce((max, opt) => {\n if (!operand.isOperand(opt) && opt.signature) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
we only keep the subtype so we match Python; only Python cares about this | set_subtype(subtype) {
this._subtype = subtype;
} | [
"set_subtype(subtype) {\n this._subtype = subtype;\n }",
"function SubTypeOfNative() { }",
"get kind() { return this._sub_kind; }",
"function get_subtypeOf() {\n const s = get_subtypeOfObj.call(this);\n return s ? s.nodeId : null;\n}",
"function update_batch_subtype(batch) {\n swi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Public: 'Press' a component (e.g. a ``). Your component should respond to the property `onPress`. identifier Identifier for the component. Returns a promise, use await when calling this function. Promise will be rejected if the component is not found. | async press(identifier) {
const component = await this.findComponent(identifier);
component.props.onPress();
} | [
"async TriggerPress(e) {\r\n this.pressEvent.emit(e);\r\n }",
"async fillIn(identifier, str) {\n const component = await this.findComponent(identifier);\n component.props.onChangeText(str);\n }",
"onpress(event) {\n this.signal('press', event.currentTarget);\n }",
"pressfunction() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
object representing the knowledge on a word | function WordKnowledge(word_id, lexicon_origin, reference_knowledge_level, translation_knowledge_level, last_reference_update_date, last_translation_update_date, nb_reference_success, nb_reference_fail, nb_translation_success, nb_translation_fail) {
// word id
this._id = word_id;
// origin of t... | [
"function Word(data) {\n this.data = data;\n}",
"function Word() {\n\tthis.wordBank = [\"Diplo\", \"MuraMasa\", \"Porter\", \"Chainsmokers\", \"Zedd\"];\n\tthis.letterArray = [];\n\tthis.letterObjectArray = [];\n\tthis.wordText = '';\n}",
"wordClass(word) {\r\n return {\r\n der: word.artik... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks if the user is a member of the project or not and the calls the correct function to either leave the project or join it | handleJoin() {
var joined = this.state.joined;
if (joined) {
this.joinProject();
} else {
this.leaveProject();
}
this.handleClick();
this.setMembers();
} | [
"async function leaveProj() {\n try {\n setLoading(true);\n leaveProject(id, userId, 'leaveProject');\n } catch (error) {\n console.log(\"Ocurrió un error\", error.message);\n }\n }",
"function checkInProject() {\n const projectName = app.getArgument('projectName');\n const ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hide View Highest Score in memory section | function hideViewHighScoreSection() {
for (var i = 0; i < viewHighScore.length; i++) {
viewHighScore[i].style.display = "none";
}
} | [
"function hideViewHighScoreResultSection() {\n for (var i = 0; i < viewHighScoreResult.length; i++) {\n viewHighScoreResult[i].style.display = \"none\";\n }\n highestScore.innerHTML = \"\";\n}",
"function viewHighScore() {\n showHide(highScoreScreen, gameOverScreen);\n showHide(highScoreScre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the largest command length. | largestCommandLength() {
const commands = this.prepareCommands();
return commands.reduce((max, command) => Math.max(max, command[0].length), 0);
} | [
"largestArgLength() {\n return this._args.reduce((max, {\n name\n }) => Math.max(max, name.length), 0);\n }",
"function getMaxLength(aCommand) {\n\t return fp.flow(fp.map(function (anArg) {\n\t return anArg.getAliasCommaName().length;\n\t }), fp.max)(aCommand.args);\n\t}",
"largestOptionLength(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::Kendra::DataSource.SalesforceStandardObjectConfiguration` resource | function cfnDataSourceSalesforceStandardObjectConfigurationPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnDataSource_SalesforceStandardObjectConfigurationPropertyValidator(properties).assertSuccess();
return {
DocumentDataFieldName: cdk.... | [
"function cfnDataSourceSalesforceConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnDataSource_SalesforceConfigurationPropertyValidator(properties).assertSuccess();\n return {\n ChatterFeedConfiguration: cfnDataSourceSales... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads the value specified by `key` from the keyvalue store on the server. | async function readValueFromServer(key) {
const serverUrl = `${STORE_URL}?key=${key}`;
const response = await fetch(serverUrl);
if (!response.ok)
throw new Error('An error happened in the server');
const value = await response.text();
// The value is not stored in the server.
if (value === "")
retu... | [
"async function readValueFromServer(key) {\n // Resolve the key if it is a Promise.\n key = await key;\n\n const serverUrl = `${STORE_URL}?key=${key}`;\n const response = await fetch(serverUrl);\n if (!response.ok)\n throw new Error('An error happened in the server');\n const value = await response.text();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compose a transform pipeline and then pass it to addConnection | function createTransformedConnection(events, targetMethod, transformPromise) {
return when(transformPromise, function(transform) {
var composed, node;
node = srcProxy.target;
composed = functional.compose([transform, targetMethod]);
//.bind(targetProxy.target);
removers = removers.... | [
"transform(streamTransformer) {\n return streamTransformer.bind(this);\n }",
"function ConnectorPipeline() {\n _classCallCheck(this, ConnectorPipeline);\n\n this._logger = _logger2.default.child({\n cls: this.constructor.name\n });\n }",
"static async _inputTransformOutputPipeline (inpu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We want to be able to get a list of those spot requests which need to be checked. This is done per region only because the list doesn't really make sense to be panec2. Basically, this is a list of spot requests which we're going to check in on. | async spotRequestsToPoll({region}, client) {
let states = ['open'];
let statuses = [
'pending-evaluation',
'pending-fulfillment',
];
let result = await this.listSpotRequests({region, state: states, status: statuses}, client);
// This is slightly inefficient because we're selecting * from... | [
"knownSpotInstanceRequestIds() {\n // We need to know all the SpotInstanceRequestIds which are known\n // to aws state. This is mostly just the id from the requests\n let allKnownSrIds = this.__apiState.requests.map(r => r.SpotInstanceRequestId);\n\n // We also want to make sure that the Spot Request i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
xLoadScript, Copyright 20012005 Michael Foster (CrossBrowser.com) | function xLoadScript() {
var arg=xLoadScript.arguments;
var url=arg[0];
if(arg.length>1)var onload = arg[1];
if (document.createElement && document.getElementsByTagName) {
var s = document.createElement('script');
var h = document.getElementsByTagName('head');
if (s && h.length) {
s.sr... | [
"function xLoadScript(url)\r\n{\r\n if (document.createElement && document.getElementsByTagName) {\r\n var s = document.createElement('script');\r\n var h = document.getElementsByTagName('head');\r\n if (s && h.length) {\r\n s.src = url;\r\n h[0].appendChild(s);\r\n }\r\n }\r\n}",
"functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function returns the endpoints uris of subscribed servers. It calls "getSubscription" function to get subcriptionsIds and then parse each subscription representation to get notifications Uris. | function getNotificationsUris (subList, body) {
let notifsInfos=[];
console.log('subscriptions List length' + subList.length);
console.log('Corresponding Subscription(s) ')
console.log(subList);
for (let index=0; index<subList.length; index++){
notifsInfos[index] = {
"subscripti... | [
"function GetSubEndpoints() {\n var endpoints = Array.from(document.querySelectorAll(\"#endpoint\"));\n var sub_endpoints = endpoints.filter(e => e.href.includes(\"/channel/\"));\n return sub_endpoints;\n}",
"_getEndpoints() {\n var endpointUrl = 'https://graph.api.smartthings.com/api/smartapps/endpoint... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates auction given auction info and resourCenterID | async initiateAuction(ctx, reliefCenterID,origin,destination){
let bids =[]
let auctionInfo={
origin,
destination,
bids: bids
}
// Assigning AuctionID after reliefcenterID
let auctionID = reliefCenterID
await ctx.stub.putState(auctionID,auctionInfo);
... | [
"function createAuction() {\n return $provider.put(API_URI.concat('/auction/create'));\n }",
"async function createAuction(Title, Description, Seller, hourDuration) {\n \n let auction = new auctionModel({\n title: Title, \n description: Description, \n seller: Seller, \n subDate: new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
team function which is a prompt asking what role of member you want to add and what their information is | function team() {
inquirer.prompt([
{
type: "list",
name: "memberType",
message: "What type of employee would you like to add?",
choices: [
"Engineer",
"Intern",
"I don't require any new employees."
]... | [
"function addingTeamMembers() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"addingMember\",\n message: \"Would you like to add an Engineer, an Intern or are you finished building your team?\",\n choices: [\"Engineer\", \"Intern\",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================================================ Subscribed Newspapers ============================================================================ | function doSubscribedNewspapers() {
allElements = document.getElementById('contentRow').children[1];
tmp = allElements.children[0];
tmp.innerHTML=tmp.innerHTML.replace(/Subscribed newspapers/,"订阅报纸一览表");
results = getElements(document, "//table[@class='dataTable']");
if (results.snapshotLength > 0) {
al... | [
"function hotPubsub() {\n\n}",
"function singularPubsub() {\n\n}",
"function Subscribable() {\n }",
"function Subscribable() {\n }",
"get isSubscribed(): boolean {\n return this._rawEvent.event === 'subscribed';\n }",
"function subscribe(newsType) {\n var current = JSON.parse(GM_getValue(PROPE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format inserts and deletions | function formatLinesModified(obj) {
assert.object(obj, 'obj');
assert.number(obj.deletions, obj.deletions);
assert.number(obj.insertions, obj.insertions);
return f('+%d,-%d', obj.insertions, obj.deletions);
} | [
"function transform_insert_delete(a, b) {\n if (a.type === DELETE) {\n return transform_insert_delete(b, a)\n }\n // we can assume, that a is an insertion and b is a deletion\n // a is before b\n if (a.pos <= b.pos) {\n b.pos += a.str.length\n }\n // a is after b\n else if (a.pos >= b.pos + b.str.leng... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create the waffle iron. | constructor() {
if (this.#instance) {
return this.#instance;
}
/**
* Cook a waffle.
*
* @param {Batter} batter - The waffle batter.
* @return {Waffle} The cooked waffle.
*/
this.cook = function(batter) {};
this.#instance ... | [
"function createWBC(){\n\t\tcreationFrequency += stage.boneMarrowWbcUse;\n\t\tif (boneMarrowBarEnd >= creationFrequency){\n\t\t\tif (allowToCreateWBC()){\n\t\t\t\tWBCs.push( new WBC(mouse.x, mouse.y, (WBC_normal.width / 2)) );\n\t\t\t\tupdateBoneMarrowBar(\"decrease\");\n\t\t\t}\n\t\t}\n\t\telse //Make the BoneMarr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
useGasPump React hook that models the actions of a physical gas pump direction: indicates whether the pump should count up or down initalFuelLevel: specifies the starting level of fuel tickAmount: specifies the delta that will be added or subtracted to current fuel level tickSpeed: how fast in ms the gas will increment... | function useGasPump(direction, initialFuelLevel, tickAmount, tickSpeed, logger) {
const [currentFuelLevel, setFuelLevel] = useState(initialFuelLevel);
const [intervalId, setIntervalId] = useState(null); // keep track of interval id so we can stop our ticker
console.log(logger);
return {
currentFuelLevel,
... | [
"function newPump(gas) { //'gas' = whether the current pump was successfully harvested or missed\n\t\t\t\tconst dPump = 2000; //average distance between pumps [m]\n\t\t\t\tconst dSpread = 500; //spread of dPump [m]\n\t\t\t\tconst vMin = 50/3.6; //minimal average velocity to reach next pump [m/s]\n\n\t\t\t\tlet d = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set time entered of a scene | function setTime(){
let dt = new Date();
currScene.timeInScene = dt.getTime();
} | [
"function setTime(time) { action.time = time; }",
"function mark_current_time() {\n if (!s_start) {\n s_start = reference.nearest_scene_change(video_time(), true)\n wc.send('mute', true)\n console.log(\"Scene start marked at \", s_start)\n } else {\n var s_end = reference.nearest... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
initGenerate creates a channel for ipcMain to listen to the generate invoice event and replies with the generated html of the requested invoice | initGenerate() {
const listenChannel = 'generate-invoice-channel';
const replyChannel = 'generate-invoice-reply-channel';
const invoiceLocation = `file://${__dirname}/../../ui/invoice.html`;
this.ipcMain.on(listenChannel, (event, args) => {
try {
const fetchIn... | [
"initFetchAll() {\n const listenChannel = 'fetch-all-invoices-channel';\n const replyChannel = 'fetch-all-invoices-reply-channel';\n this.ipcMain.on(listenChannel, (event, _) => {\n try {\n this.invoiceService.fetchAllInvoices()\n .then(invoiceDTOs =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Max, Min, Average PrintMaxMinAverageArrayVals(arr) Given an array, print the max, min and average values for that array. | function PrintMaxMinAverageArrayVals(arr){
} | [
"function PrintMaxMinAverageArrayVals(arr){\n\tvar max=arr[0];\n\tvar min=arr[0]\n\tvar sum=0\n\n\tfor(var x=0; x<arr.length; x++){\n\t\tif(arr[x] > max){\n\t\t\tmax=arr[x];\n\t\t}\n\t\tif(arr[x]<min){\n\t\t\tmin=arr[x];\n\t\t}\n\t\tsum+=arr[x];\n\t}\n\tconsole.log(`Max: ${max}; Min: ${min}; Avg: ${sum/arr.length}`... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove styles, related to absolute positioning of the thumb when it's dragged | _removeDragStyles() {
const that = this;
that._supportCSSVariables ? that.$.innerContainer.removeAttribute('style') : that.$.innerContainer.style.left = '';
that._supportCSSVariables ? that.$.innerContainer.removeAttribute('style') : that.$.innerContainer.style.top = '';
that._mouseDown ... | [
"function removeDraggingStyle(){\r\n\t\tupload_field.parent().removeClass(\"dragging\"); \r\n\t\treturn false;\r\n\t}",
"onDragEndCallback() {\n // Get thumb and tooltip\n const thumb = this.shadowRoot.querySelector(\"#thumb\");\n const tooltip = this.shadowRoot.querySelector(\"#tooltip\");\n\n // Rev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return single array of label angle & value per group | getTypeLabels(d) {
const k = (d.endAngle - d.startAngle) / 2
return [{ value: poketypejson[d.index].name, angle: k + d.startAngle }]
} | [
"function _group_ticks(d) {\n var k = (d.endAngle - d.startAngle) / d.value;\n return d3.range(0, d.value, 50).map(function(v, i) {\n return {\n angle: v * k + d.startAngle,\n label: i % 5 ? null : v / 1\n }\n })\n }",
"function groupTicks(d) {\n var k = (d.end... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the URL hash. | function setUrlHash(url){
location.hash = url;
} | [
"setHash(hash) {\n this.hash = hash;\n }",
"function setHash(str){\n window.location.hash = str;\n lastHash = blaze.base.getHash();\n }",
"function setHash (hash) {\n if (!GOVUK.support.history()) {\n return\n }\n\n var newLocation = hash || GOVUK.getCurrentLocat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send the request to create a map | function createMap(){
const name = document.getElementById("map_name").value;
putServerData(`/ws/maps/${name}/user/${current_user_id}`,refresh);
} | [
"function createMapDocument(formData) {\n return new Promise(function(resolve, reject) {\n map.create({\n mapName: formData.mapName,\n description: formData.description,\n uriPath: \"\"\n }, function(err, newMap) {\n if (err) {\n reject(err... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TEST: function: call converter function with randomly generate color numbers | function testColorConverter (){
let arrColors=[];
// TODO: make this function DRY
arrColors = randomColor(10, 'rgb');
arrColors.forEach(col => {
console.log(`${col} ==> ${getColorType(col)}`);
})
arrColors = randomColor(10, 'hex');
arrColors.forEach(col => {
// call the con... | [
"function rgbGenerate(){ return Math.floor(Math.random() * 256);}",
"function rgbColorGenerator()\r\n{ \r\n return `rgb(${~~(Math.random() * 256)},${~~(Math.random() * 256)},${~~(Math.random() * 256)})`;\r\n}",
"function randomize() {\n color1.value = createHexValue();\n color2.value = createHexValue... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Store the displayed angles in _current. Then, interpolate from _current to the new angles. During the transition, _current is updated inplace by d3.interpolate. | function arcTween(a) {
console.log(this._current);
var i = d3.interpolate(this._current, a);
this._current = i(0);
return function (t) {
return arc(i(t));
};
} | [
"function updateAngles() {\n const pov = svl.map.getPov();\n let heading = pov.heading;\n const fov = PanoMarker.get3dFov(pov.zoom);\n if (angle) {\n if (heading - angle > 180) {\n heading -= 360;\n }\n if (heading - angle < -180) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursively replaces all leaves of the current layout | function replaceLeafLayouts(layout: MosaicNode, replacerFn: (layout: MosaicNode) => MosaicNode) {
if (typeof layout === "string") {
return replacerFn(layout);
}
return {
...layout,
first: replaceLeafLayouts(layout.first, replacerFn),
second: replaceLeafLayouts(layout.second, replacerFn),
};
} | [
"function fixLeafNodes(g){\r\n\r\n}",
"recursiveLayout(current, first, parentTagName) {\n\n if (!current) {\n return;\n }\n let locationInLayout = current.locationInLayout;\n\n // Ignore html, head, body\n const blockTypesToIgnore = {\n 'html': true,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fee Collection Gains Set airline estimated share of tickets on which fees were previously not or incorrectly collected | function setEstimatedShareOfTicketsOnWhichFeesWereNotCorrectlyCollected (input) {
incorrectly_collected_fees = input;
} | [
"function sumFeesAssessedBeforeInvoiceAndAddTechFee () {\r\n\tlogDebug(\"start sumFeesAssessedBeforeInvoiceAndAddTechFee\");\r\n\r\n\tvar checkFeesArr = [], \r\n\t\ttechFeeTotal = 0,\r\n\t\ttechFeeAmt = 0;\r\n\t\t\r\n\tcheckFeesArr = loadFees();\r\n\t\r\n\tlogDebug(\"printing check fees array -----------\");\r\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return all named instances | get named_instances() {
return [...this._instances.values()].filter(instance => instance.name);
} | [
"function getInstances() {\n\n}",
"function SweetDevRia_getAllInstances (className) {\n\tvar instance = SweetDevRia.getInstance ();\n\tvar repository = instance.repository;\n\n\tvar instancesRepo = repository [className+SweetDevRia.CLASSNAME_SUFFIXE];\n\n\treturn instancesRepo;\n}",
"function getAllInstances(ad... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shutdown for Shadow Wizard | function Shutdown() {
var going = false;
return {
next: function (ce) {
if (ce.event_type === 1 &&
ce.content === '!!SHU' &&
ce.user_name.toLowerCase().contains('wizard') &&
!going) {
... | [
"function shutdown() {\n RobotUtils.onService(function(ALSystem) {\n // Bind button callbacks\n ALSystem.shutdown();\n });\n}",
"shutdown () {\n if (this.log) this.log.info('Playbook shutting down')\n _.invokeMap(this.scenes, 'exitAll')\n _.invokeMap(this.dialogues, 'end')\n }",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Procesar clicks en el MouseArea del mapa (no el mousearea del canvas de dibujo) | function mapaClick(mouse) {
switch (root.actividad) {
case 0: // Nada cargado
break
case 1: // Ubicar marcas para recorte
LogEtaCorte.agregarMarca(mouse)
break
case 2: // Marcar contornos
var posR = posReal(mouse, mapa.escala)
console.log("pos real: ", posR.x, posR.y)
if (Glo.ha... | [
"function setMapClickArea(corner1, corner2){\r\n\tif( typeof corner1 !== 'undefined' && typeof corner2 !== 'undefined')\r\n\t{\r\n\t\t\tleft_corner = corner1;\r\n\t\t\tright_corner = corner2;\r\n\t\t\tmap.on('contextmenu', startAdding);\r\n\t\t\tmap.on('click', stopAdding);\r\n\t}\t\r\n}",
"function canvasClick(e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The pulsating effect shows spikes in radiation measurements. When the radius of the circle increases, it is an indication of radiation detection. | function pulse(circle) {
let i = 0;
(function repeat() {
circle
.transition()
.duration(100)
.attr("stroke-width", 0)
.attr('stroke-opacity', 0)
.transition()
.duration(100)
.attr("stroke-width", 0)
... | [
"pulse() {\n //If a tap is in progress\n if(Input.keys[' '] || Input.touch) {\n //Constsrict the circle\n this.circle.radius = 90;\n\n //Call the taphandler to handle the press\n let delta = this.tapHandler.tapDown();\n \n //If feedback... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets a setting for a guild | async set(guild, key, val) {
let guildObj = await this.getGuild(guild);
guildObj.settings[key.toLowerCase()] = val;
guildObj.markModified('settings');
await guildObj.save();
} | [
"async set (guild, key, val) {\n let guildObj = await this.getGuild(guild)\n\n guildObj.settings[key.toLowerCase()] = val\n guildObj.markModified('settings')\n\n await guildObj.save()\n }",
"setGuildId(guildId) {\r\n if (this.guildId < 0) {\r\n this.guildId = guildId;\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculate an arrow path. x0 and x1 are the left and right ends, y is the top, and reverse should be set to true to draw on the reverse strand | function arrowPath(x0, x1, y, height, reverse) {
const arr_width = height / 2 * (reverse ? -1 : 1);
if (reverse) {
const tmp = x0;
x0 = x1;
x1 = tmp;
}
const path = d3.path();
// starting corner
path.moveTo(x0, y);
// straight across
path.lineTo(x1 - arr_width, y);
// diagonal to tip of p... | [
"function drawArrow(start, direction){\r\n c.beginPath();\r\n c.moveTo(start, 525);\r\n c.lineTo(start+5*direction, 525);\r\n c.lineTo(start+20*direction, 550);\r\n c.lineTo(start+5*direction, 575);\r\n c.lineTo(start, 575);\r\n c.lineTo(start+10*direction, 550);\r\n c.closePath();\r\n c.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check to see if the url should be included. If there are no inclusions, then everything is included. | isInclusion(url) {
const inclusions = this.option.index.inclusions;
if (!inclusions) {
return true;
}
let _UrlParser$parse2 = _url.default.parse(url),
path = _UrlParser$parse2.path;
for (let inclusion of inclusions) {
if (path.startsWith(inclusion)) {
return true;
... | [
"canAllowUrl(url) {\n if (this._exclude !== null && [...this._exclude].filter(pattern => matchesGlob(pattern, url)).length) {\n return false;\n }\n\n if (this._include !== null && [...this._include].filter(pattern => matchesGlob(pattern, url)).length === 0) {\n return false;\n }\n\n return ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if frame is a proxy. | isproxy() {
return this.state == PROXY;
} | [
"function isBadProxy(){\n\treturn badProxy;\n}",
"isProxy(doc) {\n return doc && doc.isProxy;\n }",
"hasProxy(proxyName) {\n return this.proxyMap[proxyName] != null;\n }",
"function isProxyable(a) {\n switch (typeof (a)) {\n case \"object\":\n case \"function\":\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
build "bugs info" HTML for sidebar from json features | function f2bugInfo(featureData,lang) {
var ok = true;
var contact = ["website", "phone", "email"];
// check for these tags (case insensitive) and show them as hint if available
var info = [new RegExp('^fixme(:.+)*$', "i"), new RegExp('^note(:.+)*$', "i"), new RegExp('^comment(:.+)*$', "i")];
var osmlink = '<... | [
"function renderTrackingBugs (bugs) {\n var bugNodes = bugs.map(function (bug) {\n return html('a', { href: bug.link, target: '_blank' }, [\n bug.id,\n ' (',\n bug.assignee || 'Unassigned',\n ', ',\n bug.status,\n ')'\n ])\n })\n\n bugNodes = _joinNodes(bugNodes, ', ')\n\n re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check winner between user and computer | function checkWinner() {
// Select any random icon
const computerChoice = pickRandomChoice();
// Display user and computer choice
updateSelection(user_select, userChoice);
updateSelection(computer_select, computerChoice);
//GAME RULES
// Draw game if use... | [
"function checkwinner() {\r\n\r\n if (playerChoice == ComputerChoice) {\r\n\r\n updatescore(0)\r\n result.innerText = \"DRAW\"\r\n\r\n }\r\n if (playerChoice == 'paper' & ComputerChoice == 'rock' || playerChoice == 'rock' & ComputerChoice == 'scissors' ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update the word count every 25 words | function updateWordCount(count) {
if (count % 25 !== 0) return;
document.querySelector('#words').innerHTML = count;
} | [
"function update_word_count()\n \t\t{\n \t\t\tvar e=document.getElementById(\"div_rb_counter\");\n \t\t\tflip(e,\"word_conter\");\n \t\t\te.innerHTML='<font color=\"gray\" size=\"3px\">Word</font><font size=\"6px\" color=\"#404040\"> '+current_word_number+'</font><font size=\"5px\" color=\"gray\">/'+word_list.lengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
using || operator, check if a value is not between 10 and 20 (including both 10 and 20), return "Outside" if yes, return "Inside" if no: | function testLogicalOr(val) {
if (val <10 || val >20) {
return "Outside";
}
return "Inside";
} | [
"function testLogicalOr(val) {\n if (val > 20 || val <10) {\n return \"Outside\";\n }\n return \"Inside\";\n}",
"function testLogicalOr(val) {\n \n if (val <10 || val > 20) {\n return \"Outside\";\n }\n return \"Inside\";\n }",
"function testLogicalOr(val) {\n // Only change code below t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::ApplicationInsights::Application` resource | function cfnApplicationPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnApplicationPropsValidator(properties).assertSuccess();
return {
ResourceGroupName: cdk.stringToCloudFormation(properties.resourceGroupName),
AutoConfigurationEnab... | [
"properties() {\n return this.display.show(\n this._section(\n Text(`Properties accessible from ${this.getSignature()}`),\n this._renderProperties(2, this.metadata.allProperties())\n )\n );\n }",
"renderProperties(x) { return ui.divText(`Properties for ${x.name}`); }",
"function c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
triggers update of the address when the location on the map is changed | function updateAddressOnMapChange() {
var marker = getMarker();
if (!marker) { return; }
getMap().on('draw:edited', function (e) {
updateAdress();
updateMapView(marker.getLatLng());
});
} | [
"function updateMap(event, delay) { \n if (this.spinner) this.spinner.style.display = 'block';\n \n // Fires addresschooser:suggests:started\n this.mapProxy.trigger(this.element, 'addresschooser:suggests:started');\n // Ask map proxy for getting placemarks\n this.mapProxy.getPlacemarks(this.get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A reference has base part (`this` value) and name part. We cache them separately for compiling complex expressions. `a()[b()] ?= c` > `(_base = a())[_name = b()] ? _base[_name] = c` | cacheReference(o) {
var base, bref, name, nref, ref1;
ref1 = this.properties, [name] = slice1.call(ref1, -1);
if (this.properties.length < 2 && !this.base.shouldCache() && !(name != null ? name.shouldCache() : void 0)) {
return [this, this]; // `a` `a.b`
}
base = new Value(this.base... | [
"cacheReference(o) {\n var base, bref, name, nref, ref1;\n ref1 = this.properties, [name] = slice1.call(ref1, -1);\n if (this.properties.length < 2 && !this.base.shouldCache() && !(name != null ? name.shouldCache() : void 0)) {\n return [this, this]; // `a` `a.b`\n }\n ba... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes applicant table from view | function removeTable() {
let table = $("#applicants-table");
table.find("tr:not(:first)").remove();
table.find("td").remove();
table.hide();
} | [
"function clearApplicantTable(){\n d3.selectAll(\".new-trs\").remove();\n}",
"function removeConfirmationTable()\n {\n var table = document.getElementById(\"volunteer-confirmation\");\n if (table !== null)\n {\n var parent = document.getElementById(\"volunteer-confirmation\").p... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Grab all the widget instances on the system, assuming we have already got the base widgets. | function grabWidgetInstances(widgetName) {
return endPointTransceiver.listWidgets().then(results => {
// Now look at each instance in turn.
return Promise.map(preProcessInstances(results.data.items), widgetInstance => {
// See if we are after a specific widget.
if (widgetName && widgetName != w... | [
"function grabAllWidgets() {\n\n return grabRequestedWidgets().then(grabWidgetInstances)\n}",
"createWidgetInstances()\n {\n this.widgets = this.widgets.concat(\n TextWidget.createInstances(\n this.window, this.document, this\n )\n )\n\n this.widgets =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds word to submittedWords in state | addSubmittedWord(word) {
let submittedWords = this.state.submittedWords;
if (!submittedWords.includes(word)) {
submittedWords.push(word);
this.setState({ submittedWords });
}
} | [
"addWords(words) {}",
"function addWord(e) {\n let args = (arguments.length === 0 || e.type === 'click') ? prompt('Please enter a word').replace(/\\s/g, '').split(',') : e,\n words = [].concat(args),\n cleanWords = words.map(word => {\n let lcWord = word.toLowerCase();\n if (lcWord !== '' &... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loops over imgList Array Constructs Cards Pushes to Card Array | function createCards() {
for (let i = 0; i < imgList.length; i += 1) {
const cards = document.createElement('div');
cards.classList.add('card');
cards.innerHTML = `<div class='back'>${imgList[i]}</div>
<div class='front'><i class="fa fa-line-chart" style="font-size:2em;color:#ffffff;"></i></di... | [
"function createCards() {\n for (let i = 0; i < imgList.length; i += 1) {\n const cards = document.createElement('div');\n cards.classList.add('card');\n cards.innerHTML = `<div class='back'>${imgList[i]}</div>\n <div class='front'><i class=\"fa fa-book\" style=\"font-size:2em;color:#ffffff;\"></i></di... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new interface to the RippleAPI. | constructor() {
var options = {};
this.offline = !!Config.get('offline');
if (!this.offline) {
options.server = Config.get('server');
}
const {RippleAPI} = require('ripple-lib');
this.api = new RippleAPI(options);
this.api.on('error', this._apiError... | [
"_createRipple() {\n this._rippleContainer = this.$.knob;\n const ripple = PaperRippleBehavior._createRipple();\n ripple.id = 'ink';\n ripple.setAttribute('recenters', '');\n ripple.classList.add('circle', 'toggle-ink');\n return ripple;\n }",
"_createRipple () {\n this._rippleContainer = th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize the view. Args: options (object): Options for the view. Option Args: reviewRequestEditorView (RB.ReviewRequestEditorView): The review request editor view. | initialize(options) {
ParentView.prototype.initialize.call(this, options);
this.reviewRequestEditorView = options.reviewRequestEditorView;
this._reviewView = null;
this._draftBannerShown = false;
this._$boxStatus = null;
this._$fixItLabel = null;
this._$shipItLab... | [
"initialize(options) {\n this.options = options;\n this.entryModel = options.entryModel;\n this.reviewRequestEditorView = options.reviewRequestEditorView;\n\n this._bannerView = null;\n this._draftBannerShown = false;\n this._openIssueCount = 0;\n this._reviewReply =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function for creating real array type input(s): gScp: (scope) global scope output(s): (none) | function create__realArrayType(gScp){
//create dummy type real array
var tmp_r_arr_type = new type("array<real>", OBJ_TYPE.ARRAY, gScp);
//create symbol 'this'
tmp_r_arr_type.createField(
"this", //variable name
tmp_r_arr_type, //variable type
tmp_r_arr_type._scope._start //first block in the typ... | [
"function create__integerArrayType(gScp){\n\t//create dummy type integer array\n\tvar tmp_i_arr_type = new type(\"array<integer>\", OBJ_TYPE.ARRAY, gScp);\n\t//create symbol 'this'\n\ttmp_i_arr_type.createField(\n\t\t\"this\", \t\t\t\t\t\t\t//variable name\n\t\ttmp_i_arr_type, \t\t\t\t\t//variable type\n\t\ttmp_i_a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
load data for a particular show | function loadShow(showID, onLoaded, onError) {
var path = getPath();
// TODO : set a real URL for this request
KIP.ajaxRequest(KIP.AjaxTypeEnum.POST, path, function (data) {
var show;
if (data) {
// try to parse the show
try {
... | [
"function loadShows() {\n\tfor (var i=0;i<items.length/2;i++) {\n\t\tvar object = get_one_recommended_show(i);\n\n\t\titems[i+items.length/2].children[0].children[1].children[0].innerHTML = object.name;\n\n\t\t// Set link to go to the indiviual title page\n\t\t$(items[i+items.length/2]).attr(\"href\", \"title/title... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper function to create a node n with the attributes v for svg | function getNode(n, v) {
n = document.createElementNS("http://www.w3.org/2000/svg", n);
for (var p in v)
n.setAttributeNS(null, p, v[p]);
return n
} | [
"function createNode(weight, horizontalPosition, verticalPosition) {\n const circle = document.createElementNS(svgNS, 'circle');\n circle.setAttribute('cx', `${horizontalPosition}`);\n circle.setAttribute('cy', `${verticalPosition}`);\n circle.setAttribute('r', weight);\n circle.setAttribute('fill', ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |