query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
get menus for dms organization tree right click | function getMangeDmsMenus(node){
var data = $(node);
var currentNode = data.attr("id");
var disabledCreate = false;
var disabledEdit = false;
if(data.attr("isRoot") == 'true'){
disabledEdit = true;
disabledDelete = true;
}
if(data.attr("canEdit") != 'true'){
disabledEdit = true;
}
if(data.attr("canCreat... | [
"function contextMenu(node) {\n\n var path = node.attr('path'),\n type = node.attr('type'),\n interfaces = jQuery.parseJSON(node.attr('interfaces'));\n\n // now create the menu\n var menu = {};\n\n menu.properties = {\n \"label\" : 'Properties',\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get circulating supply for native token | async fetchCirculatingSupply() {
const { data: { circulatingSupply } } = await this.request({
url: 'https://www.btse.com/api/tokentransparency',
headers: {
'User-Agent': 'PostmanRuntime/7.24.1', // tmp hack: without UserAgent definition url will not work
},
});
return Number(circu... | [
"async fetchCirculatingSupply() {\n const { result: supply } = await this.request('https://api.polygonscan.com/api?module=stats&action=maticsupply');\n return Number(supply) / 10 ** 18;\n }",
"async fetchCirculatingSupply() {\n const { result: supply } = await this.request(`https://api.polygonscan.com/a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toastr TYPE: primary info error sucess warning POSITION topright topleft topcenter topfullwidth bottomright bottomleft bottomcenter bottomfullwidth USAGE: _toastr("My Message here","topright","error",false); NOTE: _onclick = url to redirect (example: | function _toastr(_message,_position,_notifyType,_onclick) {
var _btn = $(".toastr-notify");
if(_btn.length > 0 || _message != false) {
loadScript(plugin_path + 'toastr/toastr.js', function() {
// toastr.clear();
/** BUTTON CLICK
********************* **/
_btn.on("click", function(e) {
e.prevent... | [
"function _toastr(_message, _position, _notifyType, _onclick) {\n//\tvar _btn = $(\".toastr-notify\");\n if (_message != false) {\n loadScript(plugin_path + 'toastr/toastr.min.js', function () {\n /** JAVSCRIPT / ON LOAD\n ************************* **/\n if (_message != f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function display the Serching result for NMS. Related With: None Parameter: event: This contain the keyup event object. Return: None Output: This function return a searching result in html unorder list format and display the output on side panel . How to Use: pass json format and div id for display the result . js... | function searchNMSResult(event)
{
var flag=0;
var html="";
html+="<ul>";
for( i in nmsData){
if (((nmsData[i].name).toLowerCase().indexOf($("#searchNMS").val().toLowerCase()))>=0)
{
html+="<li id="+nmsData[i].name+"><a href=# style=\"text-decoration: none\" onClick=\"nmsHostDetails('"+nmsData... | [
"function showResult(){\r\n let inputName = $(\"#name\").val().toLowerCase();\r\n let search = peoples.getSearch(name => name.name, inputName);\r\n\r\n //this removes all the old search results to make room for the new search\r\n //results\r\n let getRid = document.getElementsByTagName(\"p\");\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Path on remote of the final ipa file produced by the build process | get ipaFile() {
return `${this.options.remoteBuildsDir}/${this.projectData.projectName}/platforms/ios/build/Debug-iphoneos/${this.projectData.projectName}.ipa`
} | [
"get buildOutputPath() { // used by create-client\n return path.join(process.cwd(), instance.buildOutput);\n }",
"function buildRemoteFileUrl(){\n var submissionId = self.getSubmissionId();\n var fileGroupId = self.getFileGroupId();\n var urlTemplate = appForm.config.get('formUrls', {}).fileSu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clear search results when user clicks away | function clearResults(){
searchResults.innerHTML = '';
} | [
"function clearSearchResults() {\n $(\".search-results\").empty();\n }",
"function clearResults() {\r\n $('#searchresults').empty();\r\n}",
"function clearResults() {\n $(RESULTS_CONTAINER).add(SEARCH_RESULTS).removeClass('open');\n $(RESULTS_CONTAINER).height('');\n $(SEARCH_RESULTS).html... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
registry_id computed: true, optional: false, required: false | get registryId() {
return this.getStringAttribute('registry_id');
} | [
"function dynamicRebooterId() {\n return [[\"0\",\"0\"]]\n}",
"resourceKey(type) {\n return 'remoteId';\n }",
"getPasswordRegistrationByDescription(description) {}",
"function getID() {\n\t\t// Create a custom function that generates a unique ID which can be verified by the web service to validat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For devel use. Block the thread totally for at least `time` ms. | blockFor(time) {
var now = performance.now();
while (performance.now() - now < time);
} | [
"function wait(time) {\n try {\n var e = new Date().getTime() + time;\n while (new Date().getTime() <= e) {}\n } catch (err) {\n console.log(err);\n }\n}",
"doBlockingWork(time) {\n if (this.queueType === QueueType.BLOCKING_QUEUE) {\n\n };\n this.manageTimeSlice(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sends server stats to all Admins | function sendStats() {
push('stats', {
hits: hits,
totalHits: totalHits,
bytes: bytes,
totalBytes: totalBytes,
cost: cost,
totalCost: totalCost,
period: STATS_PERIOD,
uptime: +(new Date) - startTime
});
hits = 0;
bytes = 0;
cost = 0;
} | [
"sendStatsToClients() {\n this.sendMessageToAllClients({\n command: 'stats',\n bandwidth: this.getBandwidth(),\n rtt: this.getRTT()\n });\n }",
"function updateServerStats () {\n\n model.homeClients.each(function (homeClient) {\n\n homeClient.get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pointsPer48(12, 20) > 28.8 pointsPer48(10, 10) > 48.0 pointsPer48(5, 17) > 14.1 pointsPer48(0, 0) > 0 pointsPer48(30.8, 34.7) > 42.6 pointsPer48(22.9, 33.8) > 32.5 | function pointsPer48(ppg, mpg) {
if (mpg===0){return 0;}
return Math.round((ppg*(48/mpg))*10) / 10;
} | [
"function pointsPer48(ppg, mpg) {\n return +(ppg/mpg*48).toFixed(1)||0;\n}",
"function pointsPer48(ppg, mpg) {\n let extrap = (ppg / mpg) * 48\n\n if (ppg === 0 && mpg === 0){\n return Number(0)\n }else{\n return Number(extrap.toFixed(1))\n }\n}",
"function pointsPer48(ppg, mpg) {\n var pointsPerMin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tab label container/label text container event handler. | _labelContainerHandler(currentElement, event, eventType) {
const that = this,
click = eventType === 'up' && that._downTarget === currentElement;
if (eventType === 'down') {
that._downTarget = currentElement;
if (that.selectionMode === 'click' && currentElement !== t... | [
"_labelContainerHandler(currentElement, event, eventType) {\n const that = this,\n click = eventType === 'up' && that._downTarget === currentElement;\n\n if (eventType === 'down') {\n that._downTarget = currentElement;\n\n if (that.selectionMode === 'click' && currentE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Note: permissions passed here are handed to all downstream methods, in addition to operations on the collection itself tableName, subclass, indexName, partitionKey, sortKey are all optional here | collection({path, tableName, subclass, indexName, partitionKey, sortKey, credentials}) {
path = u.packKeys(path)
this._ensureIsCollection(path)
this.ensurePermission({path, write: false, credentials})
let seriesKey = this._makeCollectionSeriesKey(path)
subclass = subclass || thi... | [
"function attemptAdminOperations(collection1Link,user1,user1Col1ReadPermission) {\n \n var resourceTokens = {};\n resourceTokens[(collection1Link._rid)] = (user1Col1ReadPermission._token); \n\n var client = new DocumentDBClient(host, {\n resourceTokens: resourceTokens\n });\n \n client.r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds each persona to the carousel. Assumes the HTML file is formatted appropriately | function buildCarousel() {
for (persona in PERSONAS) {
buildCarouselItem(PERSONAS[persona]);
}
} | [
"function buildCarouselItem(persona) {\n var goals = '<b>' + gettext('Goals:') + '</b><br>';\n var frustrations = '<b>' + gettext('Frustrations:') + '</b><br>';\n for (var x=0; x < persona.goals.length; x++) {\n goals += '– ' + persona.goals[x] + '<br>';\n }\n for (var y=0; y < persona.frustrations.le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates the next permutation of 'arr'. | function genNextPerm(arr) {
var k = null;
m2(arr, function(x,y, i){if (x<y){k=i;}});
if (k == null) return false;
var l=k+1;
for (j=l; j<arr.length; j++) {
if (arr[j]>arr[k]) l=j;
}
return arr.slice(0,k).concat(arr[l],arr.slice(k+1,l).concat(arr[k], arr.slice(l+1)).reverse());
} | [
"function permutations(arr) {\n var l = arr.length,\n r = [arr.slice()],\n c = new Array(l).fill(0),\n i = 1, k, p;\n\n while (i < l) {\n if (c[i] < i) {\n k = i % 2 && c[i];\n p = arr[i];\n arr[i] = arr[k];\n arr[k] = p;\n ++c[i];\n i = 1;\n r.push(arr.slice()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Have the function StringReduction(str) take the str parameter being passed and return the smallest number you can get through the following reduction method. The method is: Only the letters a, b, and c will be given in str and you must take two different adjacent characters and replace it with the third. For example "a... | function StringReduction(str) {
var res = str.length + 1;
while(res>str.length){
res = str.length;
str = str.replace(/ab|ba/, 'c');
str = str.replace(/ca|ac/, 'b');
str = str.replace(/bc|cb/, 'a');
} ;
// code goes here
return str.length;
} | [
"function StringReduction(str) { \n var lastLength;\n \n do {\n lastLength = str.length;\n str = str.replace(/ab|ba/, \"c\");\n str = str.replace(/bc|cb/, \"a\");\n str = str.replace(/ac|ca/, \"b\");\n }\n while (lastLength > str.length)\n \n return str.length;\n}",
"function stringReduction(st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that will allow us to know if Ajax uploads are supported | function supportAjaxUploadWithProgress() {
return supportFileAPI() && supportAjaxUploadProgressEvents() && supportFormData();
// Is the File API supported?
function supportFileAPI() {
var fi = document.createElement('INPUT');
fi.type = 'file';
return 'files' in fi;
};
// Are progress events supported?
fun... | [
"function supportAjaxUploadWithProgress() {\n return supportFileAPI() && supportAjaxUploadProgressEvents() && supportFormData();\n // Is the File API supported?\n function supportFileAPI() {\n var fi = document.createElement('INPUT');\n fi.type = 'file';\n return 'files' in fi;\n };... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get latest marker and call removeMarker function | function popMarker() {
if (vm.markers.length > 0) {
var id = vm.markers[vm.markers.length - 1].id;
removeMarker(id).finally(validatePopMarker);
}
} | [
"function removeLastMarker() {\n myMarkers.pop();\n}",
"function removerExistMarker() {\r\n markers.clearLayers();\r\n }",
"function removePreviousMarker() {\n if (prevMarker !== null) {\n prevMarker.setMap(null);\n }\n}",
"function removeMarker(marker) {\n var index = mar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prints ArrayExpression, prints elements. | function ArrayExpression(node, print) {
var elems = node.elements;
var len = elems.length;
this.push("[");
print.printInnerComments();
for (var i = 0; i < elems.length; i++) {
var elem = elems[i];
if (elem) {
if (i > 0) this.space();
print.plain(elem);
if (i < len - 1) th... | [
"function ArrayExpression(node, print) {\n var elems = node.elements;\n var len = elems.length;\n\n this.push(\"[\");\n print.printInnerComments();\n\n for (var i = 0; i < elems.length; i++) {\n var elem = elems[i];\n if (elem) {\n if (i > 0) this.space();\n print.plain(elem);\n if (i < le... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a class to deal with our parameter slider instances | function ParameterSlider(inp){
// Keep the jQuery selector for the HTML select box
this.select = inp.select;
this.index = this.select[0].selectedIndex;
// If a starting index is provided, we will use that instead
if(typeof inp.index==="number" && parseFloat(inp.index) == parseInt(inp.index)){
this.index ... | [
"constructor(slider) {\n this.slider = slider;\n }",
"function Slider(name) {\r\n this.leftValue = 0;\r\n this.rightValue = 1;\r\n this.defaultValue = 0;\r\n this.offsetX = 1;\r\n this.offsetY = 1;\r\n this.maxSlide = 100;\r\n this.buttonWidth = 6;\r\n this.buttonHeight = 28;\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Input: [3,2,1,5,6,4] and k = 2 Output: 5 Solution 1 | function findKthLargest(nums, k) {
return quickSelect(nums, 0, nums.length - 1, k);
} | [
"function findKthLargest(arr, k) {\n\tif (arr === null || typeof arr === \"undefined\" || arr.length === 0 || k > arr.length) {\n\t\treturn;\n\t}\n\treturn findKth(arr, arr.length - k + 1, 0, arr.length - 1);\n}",
"function kMostFrequent(array, k){\n \n}",
"function findKthBiggest(root, k) {}",
"function b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parseDefaultRoute looking for "" last parts in path for any route matching | parseDefaultRoute(url) {
if (url.trim() === '/')
throw Error('Url is index!');
if (url[url.length - 1] === '/')
url = url.slice(0, -1);
if (url[0] === '/')
url = url.slice(1, url.length);
var indexAnyRoute = -1;
for (var i = 0; i < this.routes.... | [
"static getDefaultRoute() {\n return Router.routes.find(route => (route.isDefault === true)) || Router.routes[0];\n }",
"parseParametedRoute(url) {\n var nBread = url.split('/');\n var matched = {};\n for (var i = 0; i < this.routes.length; i++) {\n var route = this.routes[i];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
test if all the pieces will fit with this block size | doesAllPiecesFit(testedSize) {
// multiply the margin by 2 because there is a margin on each side of the piece
const pieceWidth = (SHAPE_MAX_SIZE + (2 * this._blockMargin));
const nbBlocksToPlace = NB_OF_PIECES * (pieceWidth * pieceWidth);
const availableBlocks = (this._positionRect.widt... | [
"function boardIsFull() {\r\n return counter === size * size;\r\n}",
"isFull() {\n if (this.ammoCount >= this.canvasWidth * 0.6) {\n return true;\n }\n return false;\n }",
"isFull(){\n if(this.maxSize){\n return this.top + 1 === this.maxSize;\n }\n else{\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Layout pwBuildLayout() Senses size of viewport and number of products and sets up proper layout. In the end it loads the first page. This function works independently from pwFilterProducts(). We can call it whenever we want it works with the existing data and sets the proper layout from there. This keeps us from having... | function pwBuildLayout() {
var resultWrap = $('#result-inner');
var gridClass = '';
// Set up all proper variables so we can paginate
pwViewportWidth = jQuery('body').outerWidth();
pwProductAmount = currentSelection.length;
if(pwViewportWidth >= 1170) { // Large layout
if(pwProductAmount... | [
"function layout () {\n logger.log(\"Layout changed\");\n $('.cm-collection--productlisting .cm-category-item__title').equalHeights();\n // only on desktop\n if (deviceDetector.getLastDevice().type == DEVICE_DESKTOP) {\n setMegaMenuItemsWidth();\n }\n // on desktop and tablet\n if (deviceD... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the registered class by name | function getClassByName(classname) {
return _nameToClass[classname];
} | [
"function getClassByName(classname) {\n return _nameToClass[classname];\n }",
"function getClassByName(classname) {\n return _nameToClass[classname];\n}",
"function getClass(name){\n\tfor(var i = 0; i < this.classes.length; i++){\n\t\tif(this.classes[i][0] === className){\n\t\t\treturn this.classes[i][1];\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether a data row or group header is collapsed. | _isCollapsed(data) {
let parent = data.parent;
while (parent) {
if (!parent.expanded) {
return true;
}
parent = parent.parent;
}
return false;
} | [
"isCollapsed() {\n return this.outerElement.classList.contains('collapsed');\n }",
"function isCollapsed(node) {\n return node.className == \"collapsed\";\n}",
"isCollapsed() {\n let collapseState = Session.get(\"minutesedit.collapsetopics.\"+_minutesId);\n return collapseState ? colla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a verification token | function createVerificationToken() {
try {
var bytes = crypto.randomBytes(config.VERIFICATION.TOKEN_LENGTH);
return bytes.toString('hex');
} catch(ex) {
createVerificationToken();
}
} | [
"function create_auth_token() {\n let token = md5( timestamp( true ) + \"\");\n return token;\n }",
"function createToken() {\n\tvar epoch = new Date().getTime().toString();\n\tvar cipher = crypto.createCipher(config.tokenCipherAlgorithm, config.tokenCipherKey);\n\tvar crypted = cipher.update(epo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the frequency of the oscillator and start it running. | function startTone( frequency )
{
if (audioContext) {
var now = audioContext.currentTime;
oscillator.frequency.setValueAtTime(frequency, now);
// Ramp up the gain so we can hear the sound.
// We can ramp smoothly to the desired value.
// First we should canc... | [
"function startTone( frequency )\r\n{\r\n var now = audioContext.currentTime;\r\n \r\n oscillator.frequency.setValueAtTime(frequency, now);\r\n \r\n // Ramp up the gain so we can hear the sound.\r\n // We can ramp smoothly to the desired value.\r\n // First we should cancel any previous schedul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for creating a marker based off of city, and size of marker as input parameters. | function addMarker(latlng, size, city) {
"use strict";
city.marker.setMap(null);
city.marker = new google.maps.Marker({
path: google.maps.SymbolPath.CIRCLE,
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: size
},
title: 'Hello',
position: c... | [
"function createMarker(city){\n\tvar icon = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2%7CFE7569'\n\tvar cityLL = {\n\t\tlat: city.lat,\n\t\tlng: city.lon\n\t}\n\tvar marker = new google.maps.Marker({\n\t\tposition: cityLL,\n\t\tmap: map,\n\t\ttitle: city.city,\n\t\ticon: icon\n\t})\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create worklists to represent the lanes of the board, then save the board. | function saveBoardWithLanes() {
$scope.board.lanes = [];
var lanePromises = [];
for (var i = 0; i < $scope.lanes.length; i++) {
var lane = $scope.lanes[i];
var addLane = addLaneDetails(i);
lane.project_id = $scope.board.project_id;
... | [
"function updateBoardLanes(newList) {\n for (var i = 0; i < $scope.board.worklists.length; i++) {\n var lane = Board.getLane($scope.board,\n $scope.board.worklists[i].id);\n if (!lane) {\n $scope.board.lanes.push({\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a set of n random numbers, from within a set of size s | function get_random_numbers(n, s) {
var rands = [];
for (var i=0; i<n; i++) {
var rand = parseInt(Math.random() * s) % s;
while (rands.indexOf(rand) >= 0) rand = (rand+1)%s;
rands.push(rand);
}
return rands;
} | [
"function getRandomNumberSet(setSize, max) {\n\n // create an array we can splice things from\n var numberArray = [];\n for(let i = 0; i < max; i++) {\n numberArray.push(i);\n }\n\n // get an array of random, non-repeating numbers\n var randomNumberSet = [];\n for(let i = 0; i < setSize;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws the heatmap onto the canvas context. | function draw(ctx) {
// Each row
for (var y=0; y<height; y++) {
// Each column
for (var x=0; x<width; x++) {
// Set the fill style to the color computed using the returned value and the 1.0 color defined above.
ctx.fillStyle = `rgba(${heatMap[x][y]*COLORS.red}, ${heatMap[x][y]*COLORS.green}, ${h... | [
"function drawHeatmap(){\n heatmap.setData(pointsArr);\n heatmap.set('radius', 40);\n}",
"function drawHeatMap() {\n clearLayers();\n var points = [];\n eventMarkers.eachLayer(function (marker) {\n points.push(marker.getLatLng());\n });\n heatmap = L.heatLayer(points, {\n radius: 15,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Figure out if the provided value is a list of stack frames. | function containsStackFrames(value)
{
if (typeof value !== "string") {
return false;
}
if (value.indexOf("resource://") != 0 &&
value.indexOf("main@resource://") != 0 &&
value.indexOf("chrome://") != 0)
{
return false;
}
if (value.indexOf(" -> ") == -1) {
... | [
"static isList(value){\n return Array.isArray(value);\n }",
"function isLContainer(value) {\n return Array.isArray(value) && value[TYPE] === true;\n}",
"function isLContainer(value) {\n return Array.isArray(value) && value[TYPE] === true;\n}",
"function isLContainer(value) {\n return Array.isArra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Derive an endpoint to use for the current situation. We'll use a `deriveEndpoint` function passed in to the options as our first choice, followed by `endpoint` (an endpoint spec) from the options, and failing either of those we just use the `type` of the endpoint that is being proxied. edge "top" or "bottom" index 0 wh... | function deriveEndpoint(edge, index, ep, conn) {
return options.deriveEndpoint ? options.deriveEndpoint(edge, index, ep, conn) : options.endpoint ? options.endpoint : ep.type;
} | [
"function deriveEndpoint(edge,index,ep,conn){return options.deriveEndpoint?options.deriveEndpoint(edge,index,ep,conn):options.endpoint?options.endpoint:ep.type;}//",
"function endpointAddress(options) {\n return ({\n ip: (options && options.ip) || null,\n }).merge(options);\n}",
"addEndpoint(option... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onAddAddressButtonClick Add Address button has been clicked | function onAddAddressButtonClick() {
$.trigger('customer:address', {
newAddress : true
});
} | [
"addNewAddressBtnClickDetection() {\n if (this.referenceClickNewAddressBtn === null) {\n this.missingAddressBtn.addEventListener('click', this.referenceClickNewAddressBtn = this.emitAddNewAddressEvent.bind(this));\n }\n }",
"function onNextButtonClick() {\n var address = selectedAdd... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Accept.js paymentFormUpdate functionality implementation | function paymentFormUpdate(opaqueData) {
dataDescriptor.value = opaqueData.dataDescriptor;
dataValue.value = opaqueData.dataValue;
// To blank out the fields before submitting them to your server.
//Clear all fields on submit in accept js
cardNumber.value = "";
expMonth.value = "";
expYear... | [
"function payment_update(request, response, next) {\n console.log('Payment update');\n}",
"function StartWebPaymentSubmitForm() {\n var webpaymentform = app.getForm('WebPayment');\n webpaymentform.handleAction({\n paymentSelect : function() {\n\n },\n creditCardSelect : function() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Another alias for _hideErrMsg. | function ux_hideMsg() {
_hideErrMsg();
} | [
"function SA_DisplayErr(ErrMsg) {\r\n\t\tDisplayErr(ErrMsg);\r\n\t}",
"function _hideMessages(){\n $(errorClassContainer).hide(); \n }",
"function hideErrorMessage()\n\t{\t\n\t\t\tidFirstNameError.hide();\n\t\t\tidLastNameError.hide();\n\t\t\tidEmailError.hide();\n\t\t\tidMobileError.hide();\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the type is given, only inserts parameters with the same type | function insertInto(container, type)
{
Parameters.container.sequence.forEach(function(parameter)
{
if (!type || parameter.type.equals(type))
{
container.append($('<option>', { value: parameter.id, text: parameter.name }));
}
});
} | [
"function appendTypeParameters(typeParameters, declarations) {\n for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) {\n var declaration = declarations_2[_i];\n var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration));\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In sythesizers, "arpeggio" means an abrupt change in frequency during a sound. This synthesizer only supports a single cutoff point. Parameters: arp_speed, arp_mod | function applyArpeggio(params, periodSamples) {
var len = periodSamples.length;
var artime = Math.floor(Math.pow(1.0 - params.arp_speed, 2.0) * 20000 + 32);
if (params.arp_mod === 0.0 || artime >= len) {
// No arpeggio. The algorithm below will produce an exact copy
// of the input. Don't bo... | [
"function updateArpSequence() {\n\tcur_chords = [];\n\tcur_bass_notes = [];\n\tfor (var i = 0; i < arpSequence.length; i++) {\n\t\tcur_chords.push(scale_chord_notes[arpSequence[i]]);\n\t\tcur_bass_notes.push(scale_bass_notes[arpSequence[i]]);\n\t}\n}",
"function initChordPattern() {\n\tarpSequence = [0];\n\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
createAnt while attaching their data interval | function createAnt() {
var ant = $('<div class="ants"></div>');
body.append(ant);
ant.css("left", Math.random() * window.innerWidth);
var intervalId = setInterval(function() {
ant.css("left", Math.random() * window.innerWidth);
}, 1500)
ant.attr('data-inte... | [
"createAnt() {\n const antHillCell = this._land.findAntHill();\n if (antHillCell) {\n this.ants.push(new Ant(antHillCell));\n this.notify(\"cells\");\n }\n }",
"function createAnts() {\n\n for (var i=0; i < numAnts; i++) {\n ants[i] = new Ant(\n M... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate resources from APIs | async generateResources () {
console.log('Logging into Azure');
const token = JSON.parse(await this._authorize()).access_token;
console.log('Listing Azure APIs');
const apis = JSON.parse(await this._listAPIs(token));
return this._generateAssets(apis, token);
} | [
"function genApi(name, chain, token, blueprint) {\n var api = {};\n blueprint.ast.resourceGroups.forEach(function(rg) {\n rg.resources.forEach(function(res) {\n var baseName = res.name.split(' ')[0];\n var apiname = pluralize(decapitalize(baseName));\n api[apiname] = api[apiname] || {};\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create an `Auth0` instance with `options` | function Auth0 (options) {
// XXX Deprecated: We prefer new Auth0(...)
if (!(this instanceof Auth0)) {
return new Auth0(options);
}
assert_required(options, 'clientID');
assert_required(options, 'domain');
this._useJSONP = null != options.forceJSONP ?
!!options.forceJSONP :
... | [
"function Auth0 (options) {\n // XXX Deprecated: We prefer new Auth0(...)\n if (!(this instanceof Auth0)) {\n return new Auth0(options);\n }\n\n assert_required(options, 'clientID');\n assert_required(options, 'domain');\n\n this._useJSONP = null != options.forceJSONP ?\n !!options.force... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fill a template with the data dictionnary passed | function fillTemplate(template, data){
var result = template;
for(var el in data){
var mark = "{{ " + el + " }}";
result = result.replace(mark, data[el]);
}
return result;
} | [
"function populateTemplate(template, data) {\n for (let key in data) {\n let regex = new RegExp('{{' + key + '}}', 'g');\n template = template.replace(regex, data[key]);\n }\n return template;\n}",
"function replaceInTemplate(template, data) {\n Object.keys(data).forEach(function(key) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets all of the items that are in the data cube | function getDataCubeItems(){
for(var i = 0; i < data_cube.length; i++){
if (patient_items.indexOf(data_cube[i].PATIENT_ID) < 0) { //If the patients name has not been added yet to the select, then add it
patient_items.push(data_cube[i].PATIENT_ID);
}
if (test_type_items.indexOf(data_cube[i].TEST_TYPE) < 0) { /... | [
"async function all() {\n const ids = await readIds()\n if (ids) {\n const itemKeyList = ids.map(id => gStoreKey('id', id))\n const result = await store.adapter.read(itemKeyList)\n return Object.values(result)\n } else {\n return []\n }\n }"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
10 Javascript Program to check Armstrong number | function armstr()
{
var arm=0,a,b,c,d,num;
num=Number(document.getElementById("no_input").value);
temp=num;
while(temp>0)
{
a=temp%10;
temp=parseInt(temp/10);
arm=arm+a*a*a;
}
if(arm==num)
{
alert("Armstrong number");
}
else
{
alert("Not Armstrong number");
}
} | [
"isArmstrong() {\n\n\t\tvar num = prompt(\"Enter a number\");\n\t\tvar input_num = parseInt(num);\n\t\tvar numLength = num.length;\n\t\tvar sum = 0;\n\t\tfor(var i = 0; i < numLength; i++)\n\t\t{\n\t\t\tvar container = 1;\n\t\t\tvar int_num = parseInt(num.charAt(i));\n\t\t\tfor(var j = 0; j < numLength; j++)\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add text to chat log AND print that text. | function pushLog(text) {
chatLog.push(text);
console.log(text);
} | [
"function addTextToLog(text) {\n let textLine = $(\"<p></p>\");\n textLine.addClass(\"log-text\");\n textLine.text(text);\n $(\".log-output\").append(textLine);\n}",
"function addTextToChat(text) {\n let textLine = $(\"<p></p>\");\n textLine.addClass(\"chat-text\");\n textLine.text(text);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds the term for the given entry if not already added. | function _addPreferredTerm(term, entry, typeOrLanguageValue) {
if(!entry.hasOwnProperty(typeOrLanguageValue)) {
entry[typeOrLanguageValue] = term;
}
} | [
"function _addPreferredTerm(term, entry, typeOrLanguageValue) {\n if(!(typeOrLanguageValue in entry)) {\n entry[typeOrLanguageValue] = term;\n }\n }",
"function _addPreferredTerm(mapping, term, entry, typeOrLanguageValue) {\n if (!(typeOrLanguageValue in entry)) {\n entry[typeOrLanguag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds or removes attoseconds. | addAttoseconds(value, createNew) {
return this.addFractionsOfSecond(value, createNew, '_attosecond', '_femtosecond', 'addFemtoseconds');
} | [
"function addToTime(time, addSeconds) {\n\n}",
"addZeptoseconds(value, createNew) {\n return this.addFractionsOfSecond(value, createNew, '_zeptosecond', '_attosecond', 'addAttoseconds');\n }",
"function incrementBonusTime(){\n\n if (+extraTime.seconds === 59){\n extraTime.seconds = 0\n extraT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates an instance of in memory service. | function InMemoryService(config) {
this.config = config;
this.cache = new Map();
this.inFlightObservables = new Map();
this.maxAge = config.cacheMaxAge;
} | [
"function getService() {\n return new service();\n }",
"function InMemoryStorageService() {\r\n var _this = _super.call(this, StorageTranscoders.JSON) || this;\r\n /**\r\n * A map that serves as the underlying backing storage for this service.\r\n */\r\n _this.storag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stablish if the worm should a hole | function isHole(currentWorm)
{
var module = currentWorm.length%(holeSize+spaceBetweenHoles);
if(module <= holeSize)
return true;
return false;
} | [
"isHole() {\n return this.field[this.locationY][this.locationX] === hole;\n }",
"checkWormhole () {\r\n // If only 1, then add another.\r\n if (this.getNumWormholes() == 1) {\r\n // Randomly selects a row. As in add blocks, the first two rows are for the balls, and a blank row r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loops through img and p tags in the page and adds an event handler to load for edit view | function eventLoader() {
var p = document.getElementsByName("p");
for (var i = 0; i < p.length; ++i) {
p[i].addEventListener("click", loadElementsToEditView());
}
var img = document.getElementsByTagName("img");
for (var i = 0; i < img.length; ++i) {
img[i].addEventListener("click", l... | [
"function pageLoad() {\n //Get the ImgEdit control.\n _imgEdit = $find('ImgEdit1');\n //Get the ImgThumbnail control.\n _imgThumbnails = $find('ImgThumbnails1');\n //Get the ImgScan control.\n _imgScan = $find('ImgScan1');\n //Get the ImgAnnotations control.\n _imgAnnotations = $find('ImgAnn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
trim any 0 intensity peaks from the end of the ms/ms peaks array | function trimPeaksArray(options) {
var peaksLength = options.peaks.length;
var lastNonZeroIntensityPeakIndex = peaksLength - 1;
for(var i = peaksLength - 1; i >= 0; i--)
{
if(options.peaks[i][1] != 0.0)
{
lastNonZeroIntensityPeakIndex = i;
... | [
"function trimPeaksArray(options)\n {\n var peaksLength = options.peaks.length;\n var lastNonZeroIntensityPeakIndex = peaksLength - 1;\n for(var i = peaksLength - 1; i >= 0; i--)\n {\n if(options.peaks[i][1] != 0.0)\n {\n lastNonZeroIntensityPeakIn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converti un nombre binaire en base 2, le rempli sois de '0' ou de '1' sur la gauche pour avoir un nombre de taille X par exemple : toBinaryX('0', 8, '0') > '0000000' number : int > nombre a convertir X : int > nombre de bit de codage voulu bit : string > sois '1' sois '0' c'est le bit avec lequel on va remplir les bit ... | function toBinaryX(number, X, bit){
let tmp = (number).toString(2);
let length = X - tmp.length;
for(let i = 0; i < length; i++)
{
tmp = bit + tmp;
}
return tmp;
} | [
"getBinario( number) {\n var base = 2;\n return Number(number).toString(base);\n }",
"tobinary(num){\n var str = num.toString();\n var bin = (+str).toString(2);\n var s=\" \";\n console.log(bin);\n var j=bin.length-1;\n for(let i=0;i<bin.length;i++){\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
mix measurements and real values from the dataset for one place ID | function mixMeasurementsAndRealValues(measurements, realValues, id) {
var toSend = [];
var everything = [];
// Make an array with everything
everything = everything.concat(measurements);
everything = everything.concat(realValues);
// Sort by date
everything.sort(function (data1, data2) {
... | [
"function mixMeasurementsAndRealValues(measurements, realValues, id) {\n var toSend = [];\n var everything = [];\n\n // Make an array with everything\n everything = everything.concat(measurements);\n everything = everything.concat(realValues);\n\n // Sort by date\n everything.sort(function (dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Marching square algorithm for traching the contour of a pixel group | function MarchingSquares(contour, potentialArea, threshold) {
var marched = false;
var getVal = function getVal(x, y) {
return potentialArea.cells[x + y * potentialArea.width];
};
var getState = function getState(x, y) {
var squareVal = 0;
if (getVal(x - 1, y - 1) >= threshold) {
squareVal ... | [
"function MarchingSquares(contour, potentialArea, threshold) {\n var marched = false;\n\n var getVal = function getVal(x, y) {\n return potentialArea.cells[x + y * potentialArea.width];\n };\n\n var getState = function getState(x, y) {\n var squareVal = 0;\n\n if (getVal(x - 1, y - 1) >= threshold) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Mousedown event only for updating activeElement | function mousedown(event) {
activeElement = event.target;
} | [
"function mousedown(event) {\n activeElement = event.target;\n }",
"function mousedown(event) {\n activeElement = event.target;\n }",
"function mousedown(event) {\r\n activeElement = event.target;\r\n }",
"function mousedown(event) {\r\n activeElement = event.t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=========================================================================== Set match_start to the longest match starting at the given string and return its length. Matches shorter or equal to prev_length are discarded, in which case the result is equal to prev_length and match_start is garbage. IN assertions: cur_matc... | function longest_match(s, cur_match) {
var chain_length = s.max_chain_length; /* max hash chain length */
var scan = s.strstart; /* current string */
var match; /* matched string */
var len; /* length of current match */
var best_len = s... | [
"function longest_match$1(s, cur_match) {\n\t var chain_length = s.max_chain_length; /* max hash chain length */\n\t var scan = s.strstart; /* current string */\n\t var match; /* matched string */\n\t var len; /* length of current match */\n\t var best_len =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validate an instance against a JSON Schema. | function validate(instance, schema, tightenSchema) {
if (!schema || !_.isObject(schema)) {
return {
valid: false,
errors: [
'Invalid schema.'
]
};
}
if (_.isUndefined(tightenSchema) || tightenSchema) {
schema = tighten(schema);
}
if (!instance || !_.isObject(instance)) ... | [
"validate(instance, s) {\n const jsonSchemaCompatibleObject = JSON.parse(stringify(instance));\n // eslint-disable-next-line\n return this._validator.validate(jsonSchemaCompatibleObject, s);\n }",
"function isValid (instance) {\n return instance && checkSchema(instance, indraSchema)\n}",
"function ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Free busy for the selected day | getFreeBusyDate(date, calendar_id) {
const period_start = dayjs__WEBPACK_IMPORTED_MODULE_8__(date).startOf('d').unix();
const period_end = dayjs__WEBPACK_IMPORTED_MODULE_8__(date).endOf('d').unix();
const calendars = calendar_id;
return this.freeBusy({
period_start,
... | [
"function display_busy(busyday,vals,st,nd) {\n var retval = '';\n //says whether we're in a free period or a busy period\n var am_free = true;\n //go through all hours in the day (starting at 8 am)\n for (var ii = st; ii < nd; ii++) {\n if ((vals.indexOf(busyday[ii],0) > -1) ^ !am_free) {\n am_free = !... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find a node before which we can insert the sheet. | function findPrevNode(options) {
var registry = sheets.registry;
if (registry.length > 0) {
// Try to insert before the next higher sheet.
var sheet = findHigherSheet(registry, options);
if (sheet && sheet.renderer) {
return {
parent: sheet.renderer.element.parentNode,
... | [
"function findPrevNode(options) {\n var registry = sheets.registry;\n\n if (registry.length > 0) {\n // Try to insert before the next higher sheet.\n var sheet = findHigherSheet(registry, options);\n\n if (sheet && sheet.renderer) {\n return {\n parent: sheet.renderer.element.parentNode,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
determines if freq is beat based on freq & loudness | function isBeat(freq, avg){
let beat = 0;
if(freq < 330 && avg >= .2){
//subtract threshold from freq so lower frequencies rate higher
beat = (Math.abs(freq-330.0) * avg)/330.0; //divide total by maximum possible value (freq thresh)
}
return beat;
} | [
"function detectBeat(level) {\n if (level > beatCutoff && level > beatThreshold){\n onBeat();\n beatCutoff = level * 1.2;\n framesSinceLastBeat = 0;\n } else {\n if (framesSinceLastBeat <= beatHoldFrames){\n framesSinceLastBeat ++;\n }\n else{\n beatCutoff *= beatDecayRate;\n bea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
UPDATE or ADD new shortcode variable to obj | function fpPOSH_update_codevars(codevar,value){
if(shortcode_keys.indexOf(codevar)>-1
&& shortcode_vars.length>0){
$.each( shortcode_vars, function( key, arr ) {
if(arr && arr.code==codevar){
shortcode_vars[key].val=value;
}
});
}else{
var obj = {'code': codevar,'val':value};
//shortcod... | [
"function evoPOSH_update_shortcode(){\r\n\t\t\r\n\t\tvar el = $('#evoPOSH_code');\r\n\t\tvar string = el.data('curcode')+' ';\r\n\t\t\r\n\t\tif(shortcode_vars.length==0){\r\n\t\t\tstring=string;\r\n\t\t}else{\r\n\t\t\t$.each( shortcode_vars, function( key, value ) {\r\n\t\t\t\tstring += value.code+'=\"'+value.val+'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle deleting a chip from the array | function handleDelete(event, topic) {
const newTopicChipArray = topicChipsArray.filter((indexedTopic) => indexedTopic._id !== topic._id)
setChipData(newTopicChipArray);
} | [
"function handleDelete(event, topic) {\n const newTopicChipArray = topicChipsArray.filter((indexedTopic) => indexedTopic._id !== topic._id)\n setChipData(newTopicChipArray);\n }",
"delete(value) {\n this.chips = this.chips.filter((item) => {\n return item !== value;\n });\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Invoke the callbacks for the matching signals in the list. Connections added during dispatch will not be invoked. This returns `true` if there are dead connections in the list, `false` otherwise. | function invokeList(list, sender, signal, args) {
var dirty = false;
var last = list.last;
var conn = list.first;
while (conn !== null) {
if (!conn.callback) {
dirty = true;
}
else if (conn.signal === signal) {
conn.callback.call(conn.thisArg, sender, args... | [
"function invokeList(list, args) {\n var dirty = false;\n var last = list.last;\n var conn = list.first;\n while (conn !== null) {\n if (conn.callback) {\n conn.callback.call(conn.thisArg, args);\n }\n else {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Download bytes from given URL. | async downloadBytes(url, maxLength) {
return this.downloadFile(url, maxLength, async (file) => {
const stream = fs_1.default.createReadStream(file);
const chunks = [];
for await (const chunk of stream) {
chunks.push(chunk);
}
return Buf... | [
"static downlaodFile(url) {\n const file_name = url.split('/').pop();\n request(url)\n .pipe(fs.createWriteStream('./downloaded/' + file_name))\n .on('close', function () {\n return { path: '/downloaded/'+ file_name, downloaded: true }\n });\n }",
"function dl(url, loc) {\n console.l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
make the obj selected, if the value of obj is empty, 'def' will be set as value. | function field_select(obj, def)
{
if (obj.value == '') obj.value = def;
obj.select();
} | [
"function setSingleInputValue(obj,value) {\n\tswitch(obj.type){\n\t\tcase 'radio': case 'checkbox': if(obj.value==value){obj.checked=true;return true;}else{obj.checked=false;return false;}\n\t\tcase 'text': case 'hidden': case 'textarea': case 'password': obj.value=value;return true;\n\t\tcase 'select-one': case 's... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[END bigquery_export_gcs] [START bigquery_insert_stream] | function insertRowsAsStream (datasetId, tableId, rows, projectId) {
// Instantiates a client
const bigquery = BigQuery({
projectId: projectId
});
// References an existing dataset, e.g. "my_dataset"
const dataset = bigquery.dataset(datasetId);
// References an existing table, e.g. "my_table"
const ta... | [
"function insertIntoBigquery(data) {\n\n\tvar rows = []\n\n\tdata.seatdata.forEach(function(seat) {\n\n\t\tconst row = {\n\t\t\tdeviceId: data.deviceId,\n\t \ttimestamp: data.timestamp,\n\t \toffice: data.office,\n\t \tlocation: data.location,\n\t \tsensorId: seat.id,\n\t \tweight: seat.wei... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
colocar la imagen de odontograma vacio en el canvas | function cargar_canvas_odontograma(){
// alert ("cargar_canvas_odontograma");
var canvas = document.getElementById('canvas_odontograma');
if (canvas.getContext) {
var ctx = canvas.getContext('2d');
var img = new Image();
//defino el evento onload del objeto imagen
canvas.width = 780;
c... | [
"function rebuilCanvas(){\n\tdrawImage();\n}",
"function ocultarImagenes(){\n\tfor(var a=0;a<imagenesOcultas.length;a++){\n\t\timagenesOcultas[a].src=\"imagenes/parejas/atras.png\";\n\t}\n}",
"function clearphoto() {\n const context = canvas.getContext('2d');\n context.fillStyle = \"#AAA\";\n context.f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shift(): return & remove first item. | shift() {
return this.removeAt(0);
} | [
"shift() {\n /// use the removeAt function, this time at the beginning\n return this.removeAt(0)\n }",
"shift() {\n if (this.length == 0)\n throw new Error(\"List is empty\");\n const result = this.get(0);\n this.remove(0);\n return result;\n }",
"shift() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
createTransactionProcessor returns a function that accepts txData and parses it according to the viewOpts | function createTransactionProcessor(viewOpts, resultHandler) {
function txProcessor(txData) {
var txContainer = {
close_time_timestamp: (new Date()).getTime(),
transactions: [txData.transaction]
};
txContainer.transactions[0].metaData = txData.meta;
// use the map function to parse txCo... | [
"parseTransaction(tx) {\n let fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase());\n if (!fragment) {\n return null;\n }\n return new TransactionDescription({\n args: this._abiCoder.decode(fragment.inputs, \"0x\" + tx.data.substring(10)),\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ProfileOperateController use operate.html view | function ProfileOperateController($scope, RestFul) {
RestFul.global(
{"action": "Log:OperationLogs", "params": {}},
function(response) {
if (!response) { return; };
if (response.hasOwnProperty('message')) {
$scope.operateLogs = response.data;
}
... | [
"function profileController() {\n\n }",
"editProfile(){\n\t\tresources.profileEdit().click();\n\t}",
"viewProfile(event){\n\t\t// TODO\n\t}",
"function goToProfile(){\n\t// performAction('profile-details');\n\t/* var portletName = 'ms_profile';\n\tvar targetDiv = 'profile-details-portlet';\n\tvar hideDiv = '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
change filter Gain and update display | function changeFilterGain(gain) {
filter.gain.value = gain;
filterGain.innerHTML = gain + "dB";
} | [
"function changeFilterGain(gain) {\n vcf1.gain.value = gain;\n\tvcf2.gain.value = gain;\n filterGain.innerHTML = gain + 'dB';\n}",
"function filterChange() {\n\t\t/* filters the low frequencies */\n\n\t\t// let only the high frequencies pass\n\t\tbiquadFilter.type = \"highpass\";\n\n\t\t// calculate new fil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
grant the user access to their own mechannel, strictly for testing purposes (since they are not confirmed yet) | async grantMeChannel () {
// subscription cheat must be provided by test script
if (!this.subscriptionCheat) {
return;
}
// allow unregistered users to subscribe to me-channel, needed for mock email testing
this.api.warn(`NOTE - granting subscription permission to me channel for unregistered user ${this.mo... | [
"async grantUserChannel () {\n\t\t// user can only subscribe to their own me-channel\n\t\tconst channel = this.request.params.channel.toLowerCase();\n\t\tif (channel !== `user-${this.user.id}`) {\n\t\t\tthrow this.errorHandler.error('readAuth');\n\t\t}\n\t\tawait this.grantChannel(channel);\n\t}",
"async grantTea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parse a URLQuery from the provided text. | static parse(text) {
const result = new URLQuery();
if (text) {
if (text.startsWith("?")) {
text = text.substring(1);
}
let currentState = "ParameterName";
let parameterName = "";
let parameterValue = "";
for (let i ... | [
"function parseQuery(text) {\r\n try {\r\n let query = QUERY_LANGUAGE.query.tryParse(text);\r\n return Result.success(query);\r\n }\r\n catch (error) {\r\n return Result.failure(\"\" + error);\r\n }\r\n}",
"function parseQuery(sUrl){\n\tvar aRet = new Array();\n\t\n\tvar indQ = sU... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`replaceInContext` will traverse children looking for a node for which `match` returns true. Once found, the matching node will be replaced by the result of calling `replacement`. | replaceInContext(match, replacement) {
var attr, child, children, i, j, k, len1, len2, ref1, ref2;
if (!this.children) {
return false;
}
ref1 = this.children;
for (j = 0, len1 = ref1.length; j < len1; j++) {
attr = ref1[j];
if (children = this[attr]) {
if (Arra... | [
"replaceInContext(match, replacement) {\n var attr, child, children, i, j, k, len1, len2, ref1, ref2;\n if (!this.children) {\n return false;\n }\n ref1 = this.children;\n for (j = 0, len1 = ref1.length; j < len1; j++) {\n attr = ref1[j];\n if (children ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
wgText.js Webgine Created by Simon Schmudde on 19.11.11. Copyright (c) 2011 Simon Schmudde Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the righ... | function wgText()
{
this.texture = 0;
this.dimx = 16;
this.dimy = 16;
this.string = 0;
this.x = 0,this.y = 0;
this.ltext = new Array();
} | [
"function TextExt() {}",
"function TextRenderer() {}",
"function TextUtilities () {\n }",
"function TextRenderer(){}// no need for block level renderers",
"function TextExtPlugin() {}",
"function text(){\n var att=['x', 'y', 'text'];\n var object = shape('text', att);\n\n // Override the functio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to create the facial features (eyes, nose) of the wolf Input none. output facialfeature | function createWolfFacialFeature(){
var facialFeatureGeom = new THREE.SphereGeometry(wolfParams.facialFeatureRadius,20,10);
var facialFeatureMat = new THREE.MeshPhongMaterial({color: 0x000000,
ambient: 0x000000,
spec... | [
"function generateFeature(){\n\tvar txt = \"\";\n\tvar tag = \"@ui\\n\";\n\tvar featureSample = \"Feature: test line 1\\n\"\n\t\t\t\t\t+ \" test line 2\\n\"\n\t\t\t\t\t+ \" i want test line 3\\n\";\n\tvar scenarioSample = \" Scenario: ralph_test\\n\";\n\ttxt += tag;\n\ttxt += featureSample;\n\ttxt += scenarioSam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
global Assets / eslintdisable noconsole Returns the definition array associated with collectionName in the restoreJSON structure. | function getDefinitions(restoreJSON, collection) {
return _.find(restoreJSON.collections, obj => obj.name === collection).contents;
} | [
"function getDefinitions(restoreJSON, collection) { //\n return _.find(restoreJSON.collections, function (obj) { // 16\n return obj.name === collection; //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define own GA update method (cf | function updateAnalytics () {
_gaq.push(['_trackPageview', document.location.href]);
} | [
"function onUpdateAnnotation() {}",
"function updateAnalytics() {\n _gaq.push([\"_trackPageview\", document.location.href]);\n //ga('send', 'pageview', document.location.href);\n }",
"function update_metrics() {\n metric_signups();\n past_events();\n photos_count();\n upcoming_events();... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Displays the company step. | function showCompanyStep() {
transitionSteps(getCurrentStep(), $steps.company, function() {
processing = false;
});
} | [
"function printCompany(company) {\n const parentSection = document.getElementById(\"js-businessInfo\");\n\n let div = document.createElement(\"div\");\n parentSection.appendChild(div);\n div.setAttribute(\"class\", \"created-div\");\n div.innerHTML = '<img src=\"' + company.logo + '\"><p class=\"page-text nam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replaces the current menu bar of the app | function setMenu(menuBar){
Menu.setApplicationMenu(Menu.buildFromTemplate(menuBar));
} | [
"function updateCurrentAppDisplay(value)\n {\n menuBarAppName.textContent = value\n }",
"function changeMenu() {\n\t\tIBMCore.common.module.masthead.editProfileMenu({\n\t\t\taction: \"replace\",\n\t\t\tlinks: userLinks\n\t\t});\n\t\t\n\t\t// Replace menu from API; hack for now until imple... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display content after data is recieved name parameter is the name of div tag | function DisplayContent(name)
{
obj = document.getElementById(name);
obj.innerHTML = req.responseText;
} | [
"function setContent(data) {\n ajaxDiv.text(data);\n}",
"function displayContent(event) {\n // ---------- Your Code Here ----------\nvar displayString = $(this).data(\"content\");\n$(\"#display-area\").append(displayString);\n\n\n\n\n\n // ---------- End of Code area ----------\n}",
"function displayContent(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
prevent element from turning on properties | _enableProperties() {
if (!this.hasAttribute(DISABLED_ATTR)) {
if (!this.__dataEnabled) {
super._initializeProperties();
}
super._enableProperties();
}
} | [
"_enableProperties() {\n if (!this.hasAttribute(DISABLED_ATTR)) {\n if (!this.__dataEnabled) {\n super._initializeProperties();\n }\n super._enableProperties();\n }\n }",
"_enableProperties() {\n if (!this.hasAttribute(DISABLED_ATTR)) {\n if (!this.__data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function displays all turkeys params: turkeys an array containing all frames turkeys were bowled in | function displayTurkeys(turkeys) {
$('ul').empty();
turkeys.forEach(function(turkey) {
$('ul').append("<li>Frame " + turkey + "</li>");
});
} | [
"function drawKeys(keys) {\n keys.forEach(key => {\n drawKey(key);\n });\n }",
"function displayAll() {\n\t// info is the array of flights that are\n\t// currently being moused over\n\tlet info = [];\n\tfor(let x = 0; x < flights.getRowCount(); x++) {\n\t\t// Every frame, check if each flight is being... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Transclude the materialTab view/body contents into materialView containers; which are stored in the tabsContent area... | function transcludeContentItems() {
var cntr = findNode('.tabs-content', element),
materialViewTmpl = '<div class="material-view" ng-show="active"></div>';
scope.$watch(getTabsHash, function buildContentItems() {
var tabs = tabsCtrl.$$tabs(notInCache),
views ... | [
"function transcludeContentItems() {\n var cntr = findNode('.tabs-content', element),\n materialViewTmpl = '<div class=\"material-view\" ng-show=\"active\"></div>';\n\n scope.$watch(getTabsHash, function buildContentItems() {\n var tabs = tabsController.$$tabs(notInCache),\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set or clear the hashkey for an object. | function setHashKey(obj, h) {
if (h) {
obj.$$hashKey = h;
} else {
delete obj.$$hashKey;
}
} | [
"function setHashKey(obj, h) {\n if (h) {\n obj.$$hashKey = h;\n } else {\n delete obj.$$hashKey;\n }\n }",
"function setHashKey(obj, h) {\n\t if (h) {\n\t obj.$$hashKey = h;\n\t } else {\n\t delete obj.$$hashKey;\n\t }\n\t}",
"function setHashKey(obj, h) { ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
find the overlapped cluster which has overlap with more number of clusters returns the index of the overlapped cluster, or 1 if no overlap note: returns real index to be used in the variable clusters.clusters | getRelatedOverlappedClusterWithClosestCentroid ( clusters, c ) {
let cluster1 = clusters.clusters[c];
let cluster2 = clusters.clusters[cluster1.overlapWithWhichClusters[0]];
// distance between the centroids
let point1 = {
x: cluster1.represent[0],
y: cluster1.represent[1],
};
let point2 = {
x: clu... | [
"findOverlappedCluster ( clusters, clustersOrder ) {\n\t\tlet index = -1;\n\t\tlet maxNumOverlap = 0;\n\t\tfor ( let i = 0; i < clustersOrder.length; i++ ) {\n\t\t\tindex = this.getClusterIndex( clustersOrder, i );\n\t\t\tlet cluster = clusters.clusters[index];\n\t\t\tif ( cluster.valid && cluster.overlapWithWhichC... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Iterate over listings and for each calls the airbnb calendars endpoint. Saves to calendars collection. | async function getCalendars(listingsArray, opts) {
let calendarSaveCounter = 0;
for (let listing of listingsArray) {
let response;
opts.listingId = listing['listing']['id'];
let url = buildCalendarUrl(opts);
log(`getting calendar for listing_id ${opts.listingId}\n`, url + '\n');
... | [
"async function populateCalendars(location) {\n log(`--- Populating calendars for location ${location} on airbnb --- `);\n let currentDate = new Date();\n currentDate.setDate(currentDate.getDate() + 1);\n\n // Airbnb allows accessing a listing's calender only up to 3 months in the past;\n // (I added... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
peform generic parsing of the body of CSI control sequences: returns a list of semicolon separated numbers; a zero is inserted in empty sequences; if a nonsemicolon or digit is encountered, returns an empty array | parseCSIBuffer() {
var entries = [];
var currentEntry = "";
for (let c of this.csiBuffer) {
if (c == ';') {
if (currentEntry.length == 0) {
entries.push(0);
}
entries.push(Number(currentEntry));
curre... | [
"function tokenize(s) {\n let result = [{ \"type\": eTokenType.BEGIN }];\n for (let i = 0; i < s.length; ++i) {\n let tokenStr = s.charAt(i);\n if (!NUM_TOKENS.hasOwnProperty(tokenStr)) {\n return null;\n }\n result.push(NUM_TOKENS[tokenStr]);\n }\n result.push({ \"type\": eTo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Name : vBoxMain Author : Kony Solutions Purpose : Below function will return the top Vbox which contains 2 HBoxes . | function vBoxMain(){
random = random+1;
var vboxbasicConf1 = {id:"vBoxMain"+random,isVisible:true,position: constants.BOX_POSITION_AS_NORMAL,orientation:constants.BOX_LAYOUT_VERTICAL,skin:"vboxTransp"};
var vboxlayoutConf1 = {containerWeight:100,margin:[0,0,0,0],padding:[0,0,0,0],percent:true,vExpand: false,hExpa... | [
"function vBoxOuter(){\n\t\tvar vboxbasicConf1 = {id:\"vBoxOuterId\",isVisible:true,position: constants.BOX_POSITION_AS_NORMAL,orientation:constants.BOX_LAYOUT_VERTICAL,skin:\"hBoxTransparentUnrounded\"};\n\t\tvar vboxlayoutConf1 = {containerWeight:100,margin:[0,0,0,0],padding:[0,0,0,0],percent:true,vExpand: false,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks for merging / deployment workflow. | function detectMergeDeployTags(story) {
// We care about merging only when story is accepted.
var storyAccepted = story.classList.contains('accepted');
var storyHasBody = story.querySelector('.name') !== null;
if (!storyAccepted || !storyHasBody) {
return;
}
//... | [
"async _checkMergePreconditions() {\n this._log(\"checking merge preconditions\");\n\n await this._checkActive();\n\n // yes, _checkStagingPreconditions() has checked the same message\n // already, but our _criteria_ might have changed since that check\n if (!this._commitMessage)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this function sort the target array (request list) by the sort keyObject such as date key object, type key object, etc.. | function sortRequestListBy(keyObject, targetArray) {
const index = findKeyIndex(keyObject.key, targetArray);
let tempArray = [...targetArray];
const sortFunction = (a, b) => {
const x = keyObject.value(a[keyObject.key]);
const y = keyObject.value(b[keyObject.key]);
if (x > y) {
re... | [
"function sortRequestedFields(request){\n console.log(\"sortRequestedFields entered\");\n\n var requestedFields = [];\n var sortedFields = [];\n var fieldMapOrder = [];\n var curObject, fieldsArray, curField;\n var path = getFieldMap(request);\n \n \n //Place fieldMap object_children combinations in one ar... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gatherStrings: given an object, return an array of all of the string values. | function gatherStrings(obj) {
const strArr=[];
for (let key in obj) {
if (typeof obj[key] === "string") strArr.push(obj[key]);
if (typeof obj[key] === "object") strArr.push(...gatherStrings(obj[key]));
}
return strArr;
} | [
"function gatherStrings(obj) {\n\n let acc = [];\n function _gather(vals, i = 0) {\n if (i < vals.length) {\n if (typeof vals[i] === 'string') acc.push(vals[i]);\n else if (typeof vals[i] === 'object') _gather(Object.values(vals[i]));\n _gather(vals, i + 1);\n }\n return acc;\n }\n\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Marks the given class or property as excluded. By default the property is excluded in both constructorToPlain and plainToConstructor transformations. It can be limited to only one direction via using the `toPlainOnly` or `toClassOnly` option. Can be applied to class definitions and properties. | function Exclude(options = {}) {
/**
* NOTE: The `propertyName` property must be marked as optional because
* this decorator used both as a class and a property decorator and the
* Typescript compiler will freak out if we make it mandatory as a class
* decorator only receives one parameter.
... | [
"static not(propertyToInvert, options) {\n return new DerivedProperty([propertyToInvert], x => !x, options);\n }",
"function ignore(target, property, descriptor) {\n DI.inject(ignore)(target, property, descriptor);\n} // Hack: casting below used to prevent TS from generate a namespace which can't be commente... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change the ui_state variable | function set_ui_state(new_state) {
if (!ui_transition_is_valid(new_state)) {
console.error('Illegal ui transition from ' + ui_state + ' to ' + new_state);
// throw {};
}
console.log('setting ui_state ' + new_state);
ui_state = new_state;
switch (ui_state)
{
case UI_STATES.BEGIN:
... | [
"function UIState() {}",
"function setUIState(state) {\n\t\tsetStreamURLBarElementState(state);\n\t\tsetMenuElementState(state);\n\t}",
"changeUI(ui) {\n\t\t// Change the UI.\n\t\tthis.setState({\n\t\t\tcurrentUI: ui\n\t\t});\n\t}",
"function updateUi(state) {\n\t\t$('#state').text(JSON.stringify(state));\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Compare A with Memory Immediate 0xC9 | function _cmpAImmediate() {
this.name = "Compare A with Memory Immediate"
this.argCount = 0;
this.size = Size.MEMORY_A;
this.addrMode = AddressingMode.IMMEDIATE_MEMORY;
this.mnemonic = 'CMP'
} | [
"function _cmpAAbsoluteX() {\n\tthis.name = \"Compare A with Memory Absolute Indexed X\"\n\tthis.argCount = 0;\n\tthis.size = Size.MEMORY_A;\n\tthis.addrMode = AddressingMode.ABSOLUTE_INDEXED_X;\n\tthis.mnemonic = 'CMP'\n}",
"function _cmpADPX() {\n\tthis.name = \"Compare A with Memory Stack Relative Indirect Ind... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called on receipt of input from the customer | _gotCustomerInput(utterance) {
// Look up this customer
this.router.customerStore
.getOrCreateCustomer(this.socket.id)
.then(customer => {
// Tell the router to perform any next steps
return this.router._routeCustomer(utterance, customer, this.socket.id);
})
.then(respons... | [
"function customerArrived(){\n\t\tconsole.log('Welcome to ATM: ' + location)\n\n\t\trl.question('Enter your account number or type \"new\" to create a new account: ', (response) => {\n\t\t\t//Creates a new account\n\t\t\tif(response === 'new'){\n\t\t\t\tcreateAccount(this);\n\t\t\t} \n\t\t\telse if(response===''){\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
input: an array of strings output: the integer length of the longest string(s) | function longestLength(array) {
// start with an empty current longest
var currentLongest = "";
// iterate over the array
for (var i = 0; i < array.length; i++) {
// IF the string is longer than current longest
if (array[i].length > currentLongest.length) {
// THEN it becomes the current_longest
c... | [
"function longestString(inputArray) {\n const lengths = inputArray.map(str => str.length);\n return inputArray[lengths.indexOf(Math.max(...lengths))];\n}",
"function longestString(arr) {\n return arr.reduce((current, value) => current.length < value.length ? value : current);\n }",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns the smallest powerof2 which contains v | function nextPowerOfTwo(v){
return Math.pow(2, Math.ceil(Math.log(v)/Math.log(2)));
} | [
"function smallestPowerOfTwo(number) {\n let result = 1;\n while (result < number) result <<= 1;\n return result;\n}",
"_getNearestPowerOfTwo(x: number): number {\n return Math.pow( 2, Math.round( Math.log( x ) / Math.LN2 ) );\n }",
"function nearestPowerOf2(n) {\n return 1 << 31 - Math.clz32(n);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
STEP 2: Read each page namespaces | function readPageNamespaces(langs) {
readDirR(currentPagesDir).forEach(page => {
const pageId =
page
.replace(currentPagesDir, '')
.replace(/(\/index.js)|(\/index.jsx)|(\.js)|(\.jsx)/gm, '') || '/'
const namespaces = pages[pageId] || []
if (!isNextInternal(page)) {
console.lo... | [
"function readPageNamespaces() {\n allPages.forEach(async (page) => {\n const pageId =\n clearPageExt(page.replace(currentPagesDir, ''))\n // Clear index folder case\n .replace(/\\/index$/, '') || '/'\n\n const namespaces = await getPageNamespaces({ pages }, pageId)\n\n if (!isNextInter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Search from current BN for matches normalized case insensitive If current BN is a folder (or Root), ignore it in the search If it is a bookmark/separator, go to parent folder (and ignore the parent in the search) a_matchStr is an array of normalized lower case word strings to match (no space) If is_recur is specified a... | function searchBNRecur (BN, a_matchStr, matchRegExp, isRegExp, isTitleSearch, isUrlSearch, is_recur = true) {
let a_result = [];
if (BN.type != "folder") { // Parent must be a folder ..
BN = curBNList[BN.parentId];
}
let url;
if (((url = BN.url) == undefined) || !url.startsWith("place:")) { // Ignore... | [
"function BN_search (BN, a_matchStr, matchRegExp, isRegExp, isTitleSearch, isUrlSearch, a_result, is_recur = true) {\r\n if (BN_match(BN, a_matchStr, matchRegExp, isRegExp, isTitleSearch, isUrlSearch)) {\r\n\ta_result.push(BN);\r\n }\r\n if (is_recur && (BN.type == \"folder\")) {\r\n\tlet children = BN.children;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |