query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Validate data from editMinMax popup: Valid Part Reorder Point is a nonnegative integer Stocking Level is a nonnegative integer Reorder Point is less than or equals to Stocking Level | function validateEditMinMaxPopupData(popupWindowObj, popupCatPartNo, popupReorderPoint, popupStockingLevel) {
var errorMsg = "";
if (isWhitespace(popupCatPartNo)) {
errorMsg += messagesData.valueRequired.replace("{0}", messagesData.partNo) + "\n";
popupWindowObj.$("catPartNo").focus();
} else if (!popupWindowObj... | [
"function validateMinMaxValue() {\n $scope.model.clearErrors();\n var maxValue = $scope.model.fieldData.getField($scope.model.maxField.id());\n var minValue = $scope.model.fieldData.getField($scope.model.minField.id());\n if (maxValue && minValue) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
! \brief create a new row in the table and add contents into the row \param contents: array of data \param value_editable: array of boolean \param contents_id: array of string used as id for \param compoent_type: value as emission, chemical, utility \param is_supplier: boolean | function add_a_table_row(a_table_body, contents, value_editable, contents_id, component_type, is_supplier) {
var aRow = a_table_body.appendChild(document.createElement('tr'));
for (var i = 0; i < contents.length; ++i) {
editable = value_editable[i];
if (!editable) {
var aCell = aRow.... | [
"function btdeCreateRow(options){\n // cellValues: value from DB table cell\n // cellValues is optional so that we can as well create blank rows for new entries for the simple editor mode\n // rowType: currently only 'empty' for completely new record entry for the simple editor\n \n var cellValues = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get theme value in localstorage when page loads | loadTheme(){
let dataTheme = localStorage.getItem('theme');
if(dataTheme === 'dark'){
document.body.setAttribute('data-theme', 'dark');
this.themeInput.checked = true;
}else{
document.body.setAttribute('data-theme', 'light');
this.themeInput.checked = false;
}
} | [
"function storeTheme() {\n localStorage.setItem(\"theme\", theme);\n}",
"function getThemeOverride() {\n return localStorage.getItem('theme');\n}",
"function loadTheme() {\n themeIndicator = localStorage.getItem(\"themeIndicator\");\n nodeLookIndicator = localStorage.getItem(\"nodeLookIndicator\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets all the CMD instructions that are defined in this image. | getCMDs() {
let cmds = [];
for (let instruction of this.instructions) {
if (instruction instanceof cmd_1.Cmd) {
cmds.push(instruction);
}
}
return cmds;
} | [
"getCommands() {\n return this.manifestFiles.reduce((result, { commands }) => {\n Object.keys(commands).forEach((commandName) => {\n result = result.concat(commands[commandName]);\n });\n return result;\n }, []);\n }",
"getAllCommands() {\n l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ALU functionality The ALU is responsible for math and comparisons. If you have an instruction that does math, i.e. MUL, the CPU would hand it off to it's internal ALU component to do the actual work. op can be: ADD SUB MUL DIV INC DEC CMP | alu(op, regA, regB) {
switch (op) {
case 'MUL':
this.reg[regA] = this.reg[regA] * this.reg[regB];
break;
case 'ADD':
this.reg[regA] = this.reg[regA] + this.reg[regB];
break;
case 'INC':
this.reg[r... | [
"alu(op, regA, regB) {\n switch (op) {\n case 'MUL':\n // access the registers and multiply together\n // this.reg[regA] *= this.reg[regB];\n // 0xff prevents anything over 255 bits\n this.reg[regA] *= this.reg[regB] & 0xff;\n break;\n\n case 'CMP':\n this.comp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Section Feature: Sorting / Function: _fnSort Purpose: Change the order of the table Returns: Inputs: object:oSettings dataTables settings object bool:bApplyClasses optional should we apply classes or not Notes: We always sort the master array and then apply a filter again if it is needed. This probably isn't optimal bu... | function _fnSort ( oSettings, bApplyClasses )
{
var
iDataSort, iDataType,
i, iLen, j, jLen,
aaSort = [],
aiOrig = [],
oSort = _oExt.oSort,
aoData = oSettings.aoData,
aoColumns = oSettings.aoColumns;
/* No sorting required if server-side or no sorting array */
if ( !oSettings.... | [
"function _fnSort(oSettings, bApplyClasses) {\n\t\t\tvar iDataSort, iDataType, i, iLen, j, jLen, aaSort = [], aiOrig = [], oSort = _oExt.oSort, aoData = oSettings.aoData, aoColumns = oSettings.aoColumns;\n\n\t\t\t/* No sorting required if server-side or no sorting array */\n\t\t\tif (!oSettings.oFeatures.bServerSid... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
based on the ID of the feature, looks up the first point in a line, e.g. used in route lines | function getFirstPointIdOfLine(featureId, layer) {
var mapLayer = this.theMap.getLayersByName(layer);
if (mapLayer && mapLayer.length > 0) {
mapLayer = mapLayer[0];
}
var ft = mapLayer.getFeatureById(featureId);
if (ft && ft.geometry && ft.geometry.components && ft.geometry.components.length > 0) {
... | [
"function getFirstPointIdOfLine(featureId, layer) {\n var mapLayer = this.theMap.getLayersByName(layer);\n if (mapLayer && mapLayer.length > 0) {\n mapLayer = mapLayer[0];\n }\n var ft = mapLayer.getFeatureById(featureId);\n if (ft && ft.geometry && ft.geometry.componen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set SERVICE/TENANT's role into ROLE alias tenant: tenant object servicename: service name role: role name | setServiceTenantRoleAlias(tenant, servicename, role, callback)
{
if(!r3IsSafeTypedEntity(callback, 'function')){
console.error('callback parameter is wrong.');
return;
}
let _callback = callback;
let _error;
if(r3IsEmptyStringObject(tenant, 'name') || r3IsEmptyString(servicename, true) || r3IsEmptyStri... | [
"setServiceTenantRoleAlias(tenant, servicename, role, callback)\n\t{\n\t\tif(!r3IsSafeTypedEntity(callback, 'function')){\n\t\t\tconsole.error('callback parameter is wrong.');\n\t\t\treturn;\n\t\t}\n\t\tlet\t_callback\t= callback;\n\t\tlet\t_error\t\t= null;\n\t\tif(r3IsEmptyStringObject(tenant, 'name') || r3IsEmpt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: isPlusFloat(valueOfStr). Description: Check out that if the parameter valueOfStr is one plus float number. Param: A string or a number. Return: True when it is or it can be cast to a plus float number,otherwise return false. | function isPlusFloat(valueOfStr){
var patrn1 = /^(\d+)(\.\d+)?$/;
try{
//alert("isPlusFloat("+valueOfStr+").patrn="+patrn1.exec(valueOfStr));
if (patrn1.exec(valueOfStr)){
return true;
}else{
return false;
}
}catch(e){
return false;
}
} | [
"function isFloat(valueOfStr){\r\n\tvar patrn1 = /^([+|-]?\\d+)(\\.\\d+)?$/;\r\n\ttry{\r\n\t\t//alert(\"isFloat(\"+valueOfStr+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t}catch(e){\r\n\t\treturn ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Example 2 Add file to IPFS and wrap it in a directory to keep the original filename | saveToIpfsWithFilename (file) {
let ipfsId
const fileStream = fileReaderPullStream(file)
const fileDetails = {
path: file.name,
content: fileStream
}
const options = {
wrapWithDirectory: true,
progress: (prog) => console.log(`received: ${prog}`)
}
this.ipfsApi.add(fil... | [
"async saveToIpfsWithFilename ([ file ]) {\n const fileDetails = {\n path: file.name,\n content: file\n }\n const options = {\n wrapWithDirectory: true,\n progress: (prog) => console.log(`received: ${prog}`)\n }\n\n try {\n const added = await this.state.ipfs.add(fileDetails,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RELEASE 2: RANDOM GEN take in integer set up empty string for random set of characters set the length to equal the integer passed in generat e | function random_gen(integer){
var rand_str = " "
rand_str.length = integer
var possible = "abcdefghijklmnopqrstuvwxyz";
for( var i=0; i < 10; i++ )
rand_str += possible.charAt(Math.floor(Math.random() * rand_str.length));
console.log(rand_str);
} | [
"generateRandomAssert(){\n var string=''\n var number = Math.floor((Math.random() * 10000000000))\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"; \n for (var i = 0; i < 4; i++){\n text += possible.charAt(Math.floor(Math.random() * possible.length)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Memoizes the `RelayQueryFragment` equivalent of a given GraphQL fragment for the given route, variables, and deferred status. | function createMemoizedFragment(concreteFragment, route, variables, metadata) {
var cacheKey = route.name + ':' + __webpack_require__(210)(variables) + ':' + __webpack_require__(210)(metadata);
var fragment = concreteFragment.__cachedFragment__;
var fragmentCacheKey = concreteFragment.__cacheKey__;
if (!fra... | [
"function createMemoizedFragment(concreteFragment, route, variables, metadata) {\n\t var cacheKey = route.name + ':' + __webpack_require__(144)(variables) + ':' + __webpack_require__(144)(metadata);\n\t var fragment = concreteFragment.__cachedFragment__;\n\t var fragmentCacheKey = concreteFragment.__cacheKey__;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Finishes the game by highlighting the winning tokens | _finish(){
$('.placeholder').remove();
if(this.model.winningStreak != null) {
let winningStreak = this.model.winningStreak;
setTimeout(function() {
for (let i=0; i<winningStreak.length; i++) {
$(".token_" + winningStreak... | [
"function isGameFinished() {\n\n if (nrOfCharacters === amount) { // Finished all text.\n console.log(\"Game over!\");\n gameOver();\n } else {\n spans[amount].classList.add(\"blinkingCursor\"); // And add it to the new one\n }\n }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that creates a stacked data based on sales per region (NA, JPN, and Other) | function createStackedGraph() {
var stack = d3.stack(filteredData)
.keys(["salesJPN", "salesNA", "salesEU", "salesOther"])
.order(d3.stackOrderNone)
.offset(d3.stackOffsetNone);
var series = stack(filteredData);
return series;
} | [
"function get_emission_gases_stacked_data(country)\n{\n data = get_country_data(world_2011_data, country);\n stacked_gases_data = {}\n\n //For some reasons number don't add up, total_emissions != co2+no2+methan+other. I will recompute the total\n total_gases = data.total_other_gases + data.total_co2 + d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Cleanup the connection lists in the dirty set. This function should only be invoked asynchronously, when the stack frame is guaranteed to not be on the path of user code. | function cleanupDirtySet() {
dirtySet.forEach(cleanupConnections);
dirtySet.clear();
} | [
"function cleanupDirtySet() {\n dirtySet.forEach(cleanupConnections);\n dirtySet.clear();\n }",
"function cleanupDirtySet() {\n dirtySet.forEach(cleanupConnections);\n dirtySet.clear();\n }",
"function cleanupDirtySet() {\n dirtySet.forEach(cleanupConnections);\n dirt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates the dictionary in charge of keeping track of disks on the pegs | setPegFilling(){
var pegFilling = {1: [], 2: [], 3: []}
// all disks are initially on the first peg
for(var diskNum = 0; diskNum < this.props.nbDisks; diskNum++){
pegFilling[1].push({...this.disks[diskNum]})
}
return(pegFilling)
} | [
"initDisks(){\n // portion to remove to each disk as we get closer to the smallest one\n // here, the smallest disk should be 1/3 of the width of the largest\n const decr = - 2 / 3 * this.diskWidth / this.props.nbDisks\n var listDisks = []\n // defining the position of the disks\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Link to scope function (onSelectRow) | function onSelectRow() {
// Update selected rows
if (component.initialized) {
updateSelectedRows();
}
} | [
"handleRowSelection(event) {\n this.selectedData = this.template.querySelector('lightning-datatable').getSelectedRows();\n }",
"onSelect(row) {\n this.selectedRows.emit(row);\n }",
"onRowSelect(event) {\n this.rowIdex = event.index;\n }",
"function selectHandler() {\n var select... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IGadget /////////////////////////////////// This class represents a instance of one Gadget. | function IGadget(gadget, iGadgetId, screen, position, width, height, minimized) {
this.id = iGadgetId;
this.gadget = gadget;
this.screen = screen;
this.position = position;
this.width = width;
this.contentHeight = height;
this.height = 2; // TODO 2 is a estimation of the menu's height
if (!minimized)
this... | [
"function GadgetRubeJect(objectPropertyID){\n\tRubeJect.apply(this, arguments);\n\t/* Key Frames for gadget */\n\tthis.keyFrames = new Array();\n}",
"function RenderJSEmbeddedGadget() {\n if (!(this instanceof RenderJSEmbeddedGadget)) {\n return new RenderJSEmbeddedGadget();\n }\n RenderJSGadget.cal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates terrain uniform values, binding its textures to different units and setting the normScale factor needed for the shader. | updateUniformValues() {
this.scene.shaders[0].setUniformsValues({ uSampler: 0, uSampler2: 1 });
this.scene.shaders[0].setUniformsValues({ normScale: this.heightScale });
} | [
"_applyUniforms() {\r\n this.uniforms.uvAnimOffsetX.value = this._uvAnimOffsetX;\r\n this.uniforms.uvAnimOffsetY.value = this._uvAnimOffsetY;\r\n this.uniforms.uvAnimTheta.value = TAU * this._uvAnimPhase;\r\n if (!this.shouldApplyUniforms) {\r\n return;\r\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Init waypoints for header and footer animations | function waypointsInit() {
$('#masthead').waypoint(function(direction) {
$(this).addClass('animation-on');
});
$('#main').waypoint(function(direction) {
$('#masthead').toggleClass('animation-on');
});
$('#footer').waypoint(function(direction) {
$(this).toggleClass('animation-on... | [
"function waypointsInit() {\n\n var headerWaypoint = new Waypoint({\n element: document.getElementById('masthead'),\n offset: -5,\n handler: function (direction) {\n if (direction === 'down')\n this.element.classList.remove('animation-on');\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
a helper function that creates a list item for a given dream | function appendNewDream(dream) {
const newListItem = document.createElement("li");
newListItem.innerText = dream;
dreamsList.appendChild(newListItem);
} | [
"function appendNewDream(dream) {\n const newListItem = document.createElement(\"li\");\n newListItem.innerText = dream;\n}",
"function createListItem(itemName) {\n // get date\n let today = new Date();\n // formate date\n let date =\n `${today.getFullYear()}-${today.getMonth()+1}-${today.getDate... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets whether a value is inside the preview range. | _isInPreview(value) {
return isInRange(value, this.previewStart, this.previewEnd, this.isRange);
} | [
"async isInPreviewRange() {\n return this._hasState('in-preview');\n }",
"isRange(value) {\n return isPlainObject(value) && Point.isPoint(value.anchor) && Point.isPoint(value.focus);\n }",
"_isInRange(value) {\n return isInRange(value, this.startValue, this.endValue, this.isRange);\n }",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reusable Labeled Node Component | function componentLabeledNode () {
/* Default Properties */
var color = "steelblue";
var opacity = 1;
var strokeColor = "#000000";
var strokeWidth = 1;
var radius = 8;
var label = void 0;
var display = "block";
var fontSize = 10;
var class... | [
"function newickNode() {\n // SJC\n // this._type = 'newickNode';\n// Properties of the abstract tree\n this.ancestor;\n this.descendant;\n this.sibling;\n this.lastDescendant;\n this.leftId;\n this.rightId;\n this.label = \"\"; // Label of this node as read from Newick description\n thi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Play Hit animation (avatar has taken damage) | function AnimateHit():void {
charDummy.animation.CrossFade("hit", 0.1);
} | [
"hitBomb(){\n this.physics.pause();\n\n this.player.setTint(0xff0000);\n\n this.player.anims.play('turn');\n\n this.gameOver = true;\n }",
"hit() {\n this.setPlayerStartPosition();\n $('.collision').show().fadeOut();\n playerHit.play();\n }",
"shot() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enable user to cross item out on list: create function and, inside it, attach a toggleClass of "strike" to the item. | function crossOut() {
li.toggleClass("strike");
} | [
"function strike(e){\n //Write Conditional using e.target.tagName to toggle a class when a list item is clicked.\n //Add a text decoration on the class \"done\" to get a strike through effect\n \n if (e.target.id !== \"list\"){\n e.target.classList.toggle(\"done\")\n }\n \n\n}",
"function doneBuyItem() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates and returns the average price of the given set of flavors. The average should be rounded to two decimal places. | function calculateAveragePrice(flavors) {
var sum = 0;
flavors.forEach(function(flavor)
{
sum+= parseFloat(flavor.price.replace('$', ''));
});
return (sum/flavors.length).toFixed(2);
} | [
"function calculateAveragePrice(flavors) {\n var total = 0;\n flavors.forEach(function(element, index, array)\n {\n total += element.price;\n });\n var average = total/flavors.length;\n return average.toFixed(2);\n }",
"function calculateAveragePrice(flavors) {\n \tvar total = 0;\n fla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
returns _PLACES for path | function pathPlace (path) {
let p = _PLACES;
path = ((typeof (path) === 'string') ? JSON.parse(path) : path).forEach((e) => {
p = p.items[p.items.map(jp => jp.name).indexOf(e)];
});
return p;
} | [
"function parse_path(path)\n{\n pnts = [];\n for(var i = 0; i < path.pathPoints.length; i++)\n {\n pnts.push(parse_pnt(path.pathPoints[i]));\n }\n \n return pnts;\n}",
"function paths() {\n return config.patternlab.paths;\n}",
"function potentialLocations(path) {\n var potentialPath... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rotate the vector by an angle and direction (in place) | rotateInPlace({ angle, direction }) {
// Throw an error if the angle is not an Angle
validate({ angle }, 'Angle');
// Throw an error if the direction is not a Direction
validate({ direction }, 'Direction');
// Rotate the vector by the angle and direction
const vector = this.rotate({ angle, di... | [
"rotate({ angle, direction }) {\n\n // Throw an error if the angle is not an Angle\n validate({ angle }, 'Angle');\n\n // Throw an error if the direction is not a Direction\n validate({ direction }, 'Direction');\n\n // Create a Quaternion from the angle and direction\n const rotationQuaterion = Q... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
WebVR page A DOMfriendly WebVR implementation WebVR Spec. Create the manager. Naming conventions | function WebVRPageManager(worlds, renderer, effect, camera, params) {
this.params = params || {};
if (!params.detector) {
console.warn('warning: feature detector not present. Some functions may fail');
}
this.detector = params.detector || {};
// Store the vendor prefix, to simplify code.
this.jsPrefi... | [
"function createPage()\n{\n\twebPage = require('webpage');\n\tpage = webPage.create();\n\tgetUserInput();\n\t\n}",
"function createPage(name, div, button, links, butRef) {\r\n\t// Create page object\r\n\tconst obj = {};\r\n\t// Assign the variables to the page object\r\n\tobj.name = name;\r\n\tobj.div = div;\r\n\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SetCookie This function is called to set a cookie in the current document. params: n name of the cookie v value of the cookie minutes the duration of the cookie in minutes (that is, how many minutes before it expires) | function SetCookie(n,v,minutes) {
var Then = new Date();
Then.setTime(Then.getTime() + minutes * 60 * 1000);
document.cookie = n + "=" + v + ";expires=" + Then.toGMTString();
} | [
"function setCookie(name, value, numMinutes) {\n\t\tvar path = \"/\";\n\t\tvar expireTime = new Date();\n\t\texpireTime.setTime(expireTime.getTime() + (numMinutes * 1000 * 60));\n\t\texpireTime = expireTime.toUTCString();\n\t\tdocument.cookie = name + \"=\" + value + \"; expires=\" + expireTime + \"; path=\" + path... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get video by category id | function GetVideoByCategoryId(id) {
return $resource(_URLS.BASE_API + 'get_video_by_category_id/' + id + _URLS.TOKEN_API + $localStorage.token).get().$promise;
} | [
"function GetVideosByCategoryId(id) {\n return $resource(_URLS.BASE_API + 'getVideosByCategoryId/' + id + _URLS.TOKEN_API + $localStorage.token).get().$promise;\n }",
"getVideosByCategory(id){\n const videos = this.getState().data.videos;\n let returnVideos = new Array();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check env.js If the env.js file is missing, an error occurs. | static isEnvJs() {
try {
const filePath = path.join(__dirname, '../../.env');
fs.accessSync(filePath);
} catch (err) {
const errEnv = new Error(`Can not find '.env' file! <br>Please create a file '/.env', see the example '/.env.example'`);
errEnv.code = 50... | [
"static isEnvJs() {\n try {\n const filePath = path.join(__dirname, '../.env');\n fs.accessSync(filePath);\n } catch (err) {\n const errEnv = new Error(`Can not find '.env' file! <br>Please create a file '/.env', see the example '/.env.example'`);\n errEnv.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serializes the Character format | serializeCharacterFormat(writer, characterFormat) {
writer.writeStartElement(undefined, 'rPr', this.wNamespace);
if (!isNullOrUndefined(characterFormat.styleName)) {
writer.writeStartElement(undefined, 'rStyle', this.wNamespace);
writer.writeAttributeString('w', 'val', this.wName... | [
"saveCharacter () {\n\t\tlet currentCharacter = this.state.characters[this.state.selectedIndex];\n\n\t\tlet characterName = currentCharacter.toString();\n\t\tlet characterJSON = currentCharacter.saveToJSON();\n\t\tlet characterBlob = new Blob([characterJSON], {type: 'text/plain;charset=utf-8'});\n\n\t\tFileSaver.sa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Map state to properties which would be accessible by Authentication component | function mapStateToProps(state) {
return { authenticated: state.auth.authenticated };
} | [
"function mapStateToProps(state) {\n\treturn { authenticated: state.auth.authenticated}\n}",
"authenticate(state) {\n state.isLoggedIn = auth.isLoggedIn();\n if (state.isLoggedIn) {\n state.username = auth.getUsername();\n state.userId = auth.getUserId();\n } else {\n state.use... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recursive resolver according to the specified depth | resolver(name, depth, callback) {
// Exceeded recursive maximum depth
if (depth === 0) {
const errMsg = `could not resolve name (recursion limit of ${defaultMaximumRecursiveDepth} exceeded)`;
log.error(errMsg);
return callback(errcode(new Error(errMsg), 'ERR_RESOLVE_RECURSION_LIMIT'));
}
... | [
"async resolver (name, depth) {\n // Exceeded recursive maximum depth\n if (depth === 0) {\n const errMsg = `could not resolve name (recursion limit of ${defaultMaximumRecursiveDepth} exceeded)`\n log.error(errMsg)\n\n throw errcode(new Error(errMsg), 'ERR_RESOLVE_RECURSION_LIMIT')\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_ESAbstract.GetPrototypeFromConstructor / global Get, Type 9.1.14. GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) | function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { // eslint-disable-line no-unused-vars
// 1. Assert: intrinsicDefaultProto is a String value that is this specification's name of an intrinsic object. The corresponding object must be an intrinsic that is intended to be used as the [[Prototype]... | [
"function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { // eslint-disable-line no-unused-vars\n // 1. Assert: intrinsicDefaultProto is a String value that is this specification's name of an intrinsic object. The corresponding object must be an intrinsic that is intended to be used as the ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Interpretable potentially negative axis index. For example, given axis = 1, and dim = 3, this function will return 2. | function interpretAxis(axis, dim) {
while (axis < 0) {
axis += dim;
}
return axis;
} | [
"function interpretAxis(axis, dim) {\n while (axis < 0) {\n axis += dim;\n }\n return axis;\n}",
"function findDimIndex(dim)\n {\n //For all the dimensions in axes\n for(var i = 0; i < dimensions.length; ++i)\n {\n //for all the dimensions in the data\n for(var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Handle projectile destruction emit | function projectileDestroy(data){
var p = {};
p[id + '_' + data.id] = {
status: 'destroy'
};
io.sockets.emit('projstat', p);
} | [
"doDestroy() {}",
"destructor () {\n console.log('Solid sketch deleted!')\n }",
"onRender() {\n // eliminate the projectile quietly if it has traveled too far\n //let dx = Math.abs(this.mBody.getPosition().x - this.mRangeFrom.x);\n //let dy = Math.abs(this.mBody.getPosition().y - this.m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the rotation in yaw, pitch, roll order in degrees. For those new to 3D graphics and who are not former pilots: Yaw = looking up and down Pitch = looking to the left and right Roll = tilting your head from side to side Returns an array of rotations in the form: [Y axis, X axis, Z axis] | yawPitchRoll() {
return this.yawPitchRollInRadians().map(VrMath.radToDeg);
} | [
"yawPitchRollInRadians() {\n const rotation = this.rotationInRadians();\n return [rotation[1], rotation[0], rotation[2]];\n }",
"toEulerangles() {\n let angles = new FudgeCore.Vector3();\n // roll (x-axis rotation)\n let sinrcosp = 2 * (this.w * this.x + this.y * this.z);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
diag is meant to be the diagonal of a diagonal matrix D. Solves the system Dx = b. | function DiagS(diag) {
this.diag = new Vector(diag);
this.nrow = this.diag.length;
} | [
"function diag_(x) {\n var $x = tensor_util_env_1.convertToTensor(x, 'x', 'diag').flatten();\n var outShape = x.shape.concat(x.shape);\n return engine_1.ENGINE.runKernelFunc(function (backend) { return backend.diag($x); }, { $x: $x })\n .reshape(outShape);\n}",
"function diag_(x) {\n const $x =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
determines avoid areas by GET variable | function loadAvoidAreas(avoidAreas) {
permaInfo[this.avoidAreasIdx] = avoidAreas == undefined ? null : avoidAreas;
avoidAreas = unescape(avoidAreas);
var allAvoidAreas = [];
var differentAreas = avoidAreas.split(';');
for (var j = 0; j < differentAreas.length; j++) {
var lonLatCoordinates = differentAreas... | [
"function loadAvoidAreas(avoidAreas) {\n permaInfo[this.avoidAreasIdx] = avoidAreas == undefined ? null : avoidAreas;\n avoidAreas = unescape(avoidAreas);\n var allAvoidAreas = [];\n var differentAreas = avoidAreas.split(';');\n for (var j = 0; j < differentAreas.length; j++) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates whether a word is missspelled, using an LRU cache to memoize the callout to the actual spell check code. | isMisspelled(text) {
let result = this.isMisspelledCache.get(text);
if (result !== undefined) {
return result;
}
result = (() => {
if (contractionMap[text.toLocaleLowerCase()]) {
return false;
}
if (!this.currentSpellchecker) return false;
// NB: I'm not smart en... | [
"isMisspelled(text) {\n let result = this.isMisspelledCache.get(text);\n if (result !== undefined) {\n // d(`Cache hit: ${text}`);\n return result;\n }\n\n result = (() => {\n if (contractionMap[text.toLocaleLowerCase()]) {\n return false;\n }\n\n if (!this.currentSpellch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the current face turn count. | getFaceTurnCount() {
return this.current == null ?this.ftm : this.ftm + this.countFaceTurns(this.current);
} | [
"getLayerTurnCount() {\n return this.current == null ? this.ltm : this.ltm + this.countLayerTurns(this.current);\n }",
"getNumTurns() {\n\t\treturn this.history.length;\n\t}",
"function getFaceTurnCount(node, coalesce=true) {\n let metrics = new MoveMetrics();\n metrics.setCoalesce(coalesce);\n metrics.a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets the position of the hospital in the array | function getPosition(tempActualLocation,hospital){
var counter = 1;
for(var i=0;i<tempActualLocation.length;i++){
if(tempActualLocation[i]["providerName"]==hospital["providerName"])
break;
else
counter++;
}
//document.write(hospital["name"]+" position is "+counter+"<br>");
return count... | [
"function locateData_indx (array, input) {\n return array.indexOf(input)\n }",
"function array_index(cadena,array){\r\n\t\t\tvar POSICION_INICIAL = 0\r\n\t\t\tfor(z=POSICION_INICIAL;z<=array.length-1;z++){\r\n\t\t\t\tif(array[z]==cadena){\r\n\t\t\t\t\treturn z;\r\n\t\t\t\t}\r\n\t\t\t}\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
translates a parametric function in cartesian space | function translate(vector, originalFunction){
return function(parameter){
var point = originalFunction(parameter);
point[0] += vector[0];
point[1] += vector[1];
return point;
}
} | [
"function translateX(matrix, x) {\n return [matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], matrix[6], matrix[7], matrix[8], matrix[9], matrix[10], matrix[11], x * matrix[0] + matrix[12], x * matrix[1] + matrix[13], x * matrix[2] + matrix[14], x * matrix[3] + matrix[15]];\n}",
"function transla... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Validates that the midterm 2 grade is between 05 | function validateMidTerm2() {
var midterm2 = document.getElementById("midterm2").value;
if (midterm2 < 0 || midterm2 > 5) {
document.getElementById("midterm2_prompt").style.color = "red";
document.getElementById("midterm2_prompt").innerHTML = "The grades should between 1–5";
}
... | [
"function validateMidTerm1() {\r\n var midterm1 = document.getElementById(\"midterm1\").value;\r\n if (midterm1 < 0 || midterm1 > 5) {\r\n document.getElementById(\"midterm1_prompt\").style.color = \"red\";\r\n document.getElementById(\"midterm1_prompt\").innerHTML = \"The grades should between ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a lattice s_elements contains all the elements of the lattice set the order between the elements with addOrder() make the lattice with make() | function Lattice(s_elements) {
//elements contains all the elements of the Lattice with Top and Bottom
//Bottom is the first element
//Top is the last element
this.elements = [];
for (var i = 0; i < s_elements.length; i++) {
this.elements.push(s_elements[i]);
};
//Size contains the ... | [
"function PowerSetLattice() {\n //elements contains all the elements of the Lattice with Top and Bottom\n //Bottom is the first element\n //Top is the last element\n this.keys = [];\n this.values = {};\n\n //Size contains the size of the Lattice\n this.size = this.keys.length;\n\n //add a ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if all kids of a gray `node` are white or black (but not both), it must be white or black and have no kids | simplifyNode(node) {
var whiteBlackCounter = 0;
for (let i = 0; i < node.kids.length; i++) {
if (node.kids[i].color == Octree.GRAY)
this.simplifyNode(node.kids[i]);
else if (node.kids[i].color == Octree.WHITE)
whiteBlackCounter--;
else // Octree.BLACK
whiteBlackCounter++;
}
if (whiteBlack... | [
"function checkColor(i, j)\n{\n if(i < 0 || j < 0 || i >= len || j >= len)\n return 0;\n if(rects[i + len * j].isWhite)\n return 1;\n else\n return 0;\n}",
"forceBlackNodeToSubdivide(node, precision) {\n\t\tif (node == undefined || node.level == precision)\n\t\t\treturn;\n\n\t\tfor (... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes message if everybody has downloaded | function cleanupMessageAfterDownload(message, userId) {
if (!message.public && message.sharedWith) {
message.sharedWith.splice(message.sharedWith.indexOf(userId), 1);
if (message.sharedWith.length < 1) {
console.log("deleted message : " + message._id);
// Delete
M... | [
"delete() {\n if (!this.msg) throw new Error(\"Tried to delete embed pages but they havn't even been created yet.\");\n this.msg.delete().catch(() => null);\n }",
"async delete_message(msgid) {\n \n }",
"function checkDeletedMessages() {\n \"use strict\";\n spamFilter = maxMessa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the shipping label for an order | function getShippingLabel () {
} | [
"shipping() {\n if (this.premium) {\n return \"Free\"\n }\n return \"2.99\"\n \n }",
"get shippingAddress() {\n return internalSlots.get(this).get(\"[[shippingAddress]]\");\n }",
"get label() {\n // If we're wrapping a taxonName, use i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create new random genomes to match the max population size It does not do crossover or mutation, but simply repopulates | repopulate () {
const nbToGenerate = this.populationSize - this.currentPopulation.length
const newGenomes = Array(nbToGenerate).fill('').map(genome => new Genome(this.nbInput, this.nbOutput))
this.currentPopulation = [...this.currentPopulation, ...newGenomes]
} | [
"function createInitialPopulation() {\n genomes = [];\n // for each population randomize the 7 initial values making a genome\n // each value will be updated through the evolution\n for (var i = 0; i < populationSize; i++) {\n // 7 key values of a population\n var genome = {\n\n id: Mat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Download a tool from an url and stream it into a file | function downloadTool(url) {
return __awaiter(this, void 0, void 0, function* () {
// Wrap in a promise so that we can resolve from within stream callbacks
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
try {
const http = new httpm.... | [
"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"
]
]
}
} |
UI State Manipulation Add appropriate event handlers to the DOM elements. We do this rather than requiring lots of boilerplate "oncommand" junk on the nodes. We hook up the following: "command" event listener. reflect filter state | _bindUI() {
for (let filterDef of QuickFilterManager.filterDefs) {
let domNode = document.getElementById(filterDef.domId);
// the loop let binding does not latch, at least in 1.9.2
let latchedFilterDef = filterDef;
let handler;
if (!("onCommand" in filterDef)) {
handler = func... | [
"function observeUIState() {\n const classInit = {\n attributes: true,\n attributeFilter: [\"class\"]\n };\n UI_STATE_OBSERVER.observe(document.querySelector(\"#browser\"), classInit);\n UI_STATE_OBSERVER.observe(document.querySelector(\"#panels-container\"), classInit);\n }",
"function obs... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
================ Update Existing Vehicle Function End ===================// =============== Update Vehicle Function Begin ============================ | function updateVehicle(vehicle) {
self.vehicle = vehicle;
$scope.nameWrong = false;
self.UpdateNotCheckVehicleRegNo = self.vehicle.vehicle_regno;
self.heading = self.vehicle.vehicle_regno;
$('#branch_id').val(JSON.stringify(self.vehicle.branchModel));
$('#branch_name_value').val(self.vehi... | [
"function editVehicle(vehicle) {\r\n\t\t\t\tVehicleService.createVehicle(vehicle)\r\n\t\t\t\t.then(\r\n\t\t\t\t\t\tfunction () {\r\n\t\t\t\t\t\t\tfetchAllVehicles();\r\n\t\t\t\t\t\t\tself.message = vehicle.vehicle_regno + \" vehicle reg no updated..!\";\r\n\t\t\t\t\t\t\tsuccessAnimate('.success');\r\n\t\t\t\t\t\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads bit range [start, end], inclusive. Returns buffers to concat. | async function readBufsForRange (reader, start, end) {
// Kick off any fetches not yet started
const pageStart = Math.floor(start / PAGE_SIZE)
const pageEnd = Math.floor(end / PAGE_SIZE)
for (let page = pageStart; page <= pageEnd; page++) {
let promise = reader._pagePromiseCache[page]
if (promise == nul... | [
"setRange(start /*int*/, end /*int*/) {\n if (end < start || start < 0 || end > this.size) {\n throw new IllegalArgumentException();\n }\n if (end === start) {\n return;\n }\n end--; // will be easier to treat this as the last actu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this functions enables to read all the developer data from local storage | function read(){
let AllKeys = Object.keys(localStorage);
devKeys=AllKeys.filter(value => value.startsWith('Sdev'));
// the global variable for al the objects
devObjects=devKeys.map(obj => JSON.parse(localStorage.getItem(obj)));
display_developers();
} | [
"function readstorage() {\n investorName = JSON.parse(localStorage.getItem(\"investorName\"));\n investorEmail = JSON.parse(localStorage.getItem(\"investorEmail\"));\n investorIndustry = JSON.parse(localStorage.getItem(\"investorIndustry\"));\n investedAmount = JSON.parse(localStorage.getItem(\"invested... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to update the group mc's (radio group fn) | function updateGroupMcs() {
if (!p._keepSelected) {
p._disabled = true;
}
updateState('_down');
var i;
if (p._keepSelected) {
for (i = 0; i < p._groupMcs.length; i++) {
//this.parent[p._groupMcs[i]].disabled = false;
p.updateEvent({
elemId: p._groupMcs[i],
... | [
"function actionGroup(con){\n\tif(con == 'add'){\n\t\tif(gameData.targetArray[gameData.sequenceNum].groups.length < 8){\n\t\t\tvar newGroupText = 'Label'+(gameData.targetArray[gameData.sequenceNum].groups.length+1);\n\t\t\tgameData.targetArray[gameData.sequenceNum].groups.push({text:newGroupText,\n\t\t\t\t\t\t\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Master class, inherits from BaseService. Contains logic that run in the master process. | function Master(options) {
BaseService.call(this, options);
// Is the master shutting down?
this._shuttingDown = false;
// Are we performing a rolling restart?
this._inRollingRestart = false;
this._firstWorkerStarted = false;
this._firstWorkerStartupAttempts = 0;
this.workerStatusMap = ... | [
"function WSServerMaster() {\n\tthis.masterProcess = null;\n\tthis.ip = '127.0.0.1';\n\n\tthis.headers = WSServerMaster.generatePeerHeaders({\n\t\tip: this.ip,\n\t\tversion: '9.8.7',\n\t});\n\n\tthis.wsPort = this.headers.wsPort;\n\tthis.httpPort = this.headers.httpPort;\n}",
"function NominatimService(){\n Ab... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add an edge to the graph. | function addEdge(edge) {
var fromNode = edge[0], toNode = edge[1];
var children = graph.get(toNode);
if (children) {
children.push(fromNode);
}
else {
graph.set(toNode, [fromNode]);
}
} | [
"add(edge) {\n utils.checkType(edge, Edge);\n this.list.push(edge);\n }",
"function addEdge(edge) {\n var fromNode = edge[0], toNode = edge[1];\n var children = graph.get(toNode);\n if (children) {\n children.push(fromNode);\n }\n else {\n graph.set(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given low and high colors and a percent, figure out the RGB of said percent in that scale | function colorFromPercent(percent, c) {
var diffR = (c.highR - c.lowR) * percent,
diffG = (c.highG - c.lowG) * percent,
diffB = (c.highB - c.lowB) * percent;
return 'rgb(' + (c.lowR + diffR).toFixed() + ', ' +
(c.lowG + diffG).toFixed() + ', ' +
(c.l... | [
"function scale_color(percentage) {\n\treturn min_color_percent + (max_color_percent-min_color_percent)*percentage;\n}",
"getColorFromRangeByPercent(colors, percent) {\n if (percent > 1 || percent < 0 || colors.length < 2)\n return colors[0]\n //Find the two colors the percent... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
calculating whether or not user was counted for attendance depending on score | function calculateAttendance() {
var attendance;
var scorePercentage;
scorePercentage = ((score * 10) / (questionCount * 10));
document.getElementById("attendance").innerHTML = (scorePercentage);
if ((scorePercentage > 0.5)) {
attendance = "was";
}
else {
attendance = "wasn'... | [
"function isUserWin(score) { return score < -50; }",
"function overallScore() {\n user.score = extrTotal - intrTotal;\n return extrTotal - intrTotal;\n }",
"function setScore(){\n console.log(\"setScore\");\n\n if(rightAnswer == true){\n userScore++;\n };\n\n }",
"function sc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Download image and save it locally; returns local path | function downloadImage (imageUrl, localPath) {
return httpGet(imageUrl, {
output: localPath
})
.then((res) => {
if (res.statusCode !== 200) throw new Error(format('Failed to download %s (HTTP %s)', imageUrl, res.statusCode))
return localPath
})
} | [
"function saveImageToDisk(url, localPath) {\n var file = fs.createWriteStream(localPath);\n var request = https.get(url, function(response) {\n response.pipe(file);\n });\n }",
"function saveImageToDisk(url, localPath) {\n var fullUrl = url;\n var file = fs.createWriteStream(localPath);\n var requ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Silence "Cirular dependency" warnings: | onwarn(warning, rollupWarn) {
if (warning.code !== "CIRCULAR_DEPENDENCY") rollupWarn(warning);
} | [
"onwarn(warning, rollupWarn) {\n if (warning.code !== 'CIRCULAR_DEPENDENCY') rollupWarn(warning)\n }",
"checkDependencies() {\n if (this._checkLocalMarker()) {\n this._printWarning();\n }\n }",
"function ignoreWarnings(warn) {\n console.warn('===warn', warn);\n if (/Critical dependency/.test(w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Load all files in the given directory, merge them and apply patches in the order found The base structure is always an empty object | async function loadMergedSpec(inputDir) {
const structure = {};
const files = await fs.readdir(inputDir);
for (const file of files.filter(n => n.endsWith('.json')).sort()) {
const data = await fs.readJson(path.join(inputDir, file));
if (file.indexOf('patch') === -1) {
// Copy pro... | [
"static load(patches=\"all\"){\n if(Array.isArray(patches)){\n for(let patch_number of patches){\n let path = this.patch_number_to_path(patch_number)\n try{\n load_files(path)\n }\n catch(err){\n warn... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
to create an Atterberg Limits test entry using the test genTestId | createEntry(genGeoTestId){
console.log("inside create entry func in atterberg limitsdb.js, genGeotestId", genGeoTestId);
return new Promise((resolve, reject) => {
var atterbergLimits = new Determination_of_atterberg_limits({
geoTestId : genGeoTestId ... | [
"async function createTest(myUUID, bucket,definition,steps) {\n\ttry {\n\t\t\n\t\t//create new test\n\t\tlet createTestEndpoint = `https://api.runscope.com/buckets/${bucket}/tests`\n\t\tlet newTest = await postRunscope(createTestEndpoint,definition);\n\t\t\n\t\t//extract test ID from test\n\t\tlet newTestData = new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert the dates of a lockup object to moments. | function momentizeLockup(lockup) {
return {
...lockup,
start: toMoment(lockup.start),
end: toMoment(lockup.end)
}
} | [
"newMoment(datum, keys) {\n datum.date = this.timePeriod.startOfTimePeriodForDate(datum.date);\n return new Moment(datum, keys);\n }",
"parseDates(data) {\n return data.map(attendee => {\n attendee.dates = attendee.dates.map(date => moment(date));\n return attendee;\n })\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if the thing is a flag or not. | function isFlag (word) {
// shorthands never take args.
var split = word.match(/^(-*)((?:no-)+)?(.*)$/)
var no = split[2]
var conf = split[3]
return no || configTypes[conf] === Boolean || shorthands[conf]
} | [
"isFlag(){\n return (this._type === 'boolean')\n }",
"function isFlag (arg) {\n return (arg.startsWith(FlagIdentifier) && arg.length > FlagIdentifier.length) || false \n}",
"function isFlag (word) {\n\t // shorthands never take args.\n\t var split = word.match(/^(-*)((?:no-)+)?(.*)$/)\n\t var no = sp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that not unsupported (data element group sets, orgunit group sets, category) dimensions are used in favourites added visualizations for 2.34 | function validateFavoriteDataDimension() {
var issues = [];
for (var type of ["charts", "mapViews", "reportTables", "eventReports", "eventCharts", "visualizations"]) {
for (var i = 0; metaData.hasOwnProperty(type) && i < metaData[type].length; i++) {
var item = metaData[type][i];
var nameableItem;
if (ite... | [
"function isDimensionMismatch(wallpaper){\n if(acceptedDimensions.indexOf('all') > -1){\n return false;\n }\n var dimensionString = createDimensionString(sizeOfWallpaper(wallpaper));\n if(acceptedDimensions.indexOf(dimensionString) > -1){\n return false; // Is accepted, not mismatch\n } els... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Logging in to zipatobox | function loginToBox() {
var url = "http://my.zipato.com:8080/zipato-web/json/Initialize";
var sREs = "ERROR";
// get settings from appData object
var username = appData.values["settings-username"];
var password = decryptString(appData.values["settings-password"]);
var serial = appData.values["s... | [
"function setupLogin() {\n\tvar athena = window.database.getObject(\"user\", \"athena\");\n\tvar url = document.location.href;\n\t\n\tif (document.location.protocol == 'https:' && athena != null) {\n\t\turl = \"http://picker.mit.edu\";\n\t\t$('#httpsStatus').html('logged in as ' + athena +\n\t\t\t' • <a href=\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Abort the database connection. | async abort() {
await this.conn.end();
} | [
"async abort() {\n await this.releaseConnection(this.connection, this.logWriter);\n }",
"async abort() {\n try {\n await this.connection.destroy();\n } catch (e) {\n }\n this.connection = undefined;\n }",
"async abort() {\n await this.releaseConnection(this.connection, this.yadamuLogger... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the list of `count` frames currently on stack, starting at the index `first` for the specified thread. | function getFrames(threadClient, first, count) {
dumpn("Getting frames.");
return rdpRequest(threadClient, threadClient.getFrames, first, count);
} | [
"function getFrameCount() {\n for (var f = 1; f < 999; f++)\n if (selectFrame(f) == false)\n return f - 1;\n\n return 0;\n}",
"function countStack(stack) {}",
"static get frameCount() {}",
"async fetchCallStack(levels = 20) {\n if (this.stopped) {\n const star... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make action creator for each change and assign it as `change.__eduxActionCreator`. | function bindActionCreator(change, type) {
change.__eduxActionType = type;
var creator = change.__eduxActionCreator = function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return {
type: type,
payload: args... | [
"function actionCreator(){\n return action;\n }",
"function actionCreator() {\n return action\n}",
"function actionCreator() {return action}",
"function actionCreator() {\n return action;\n}",
"function actionCreator() {\n return action\n}",
"function actionCreator() {\n return action;\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieve citation id from url | function getCitationId(url) {
var parts = url.split('?');
if (parts.length > 1) {
var id = parts[1].split('&')[0];
return id.split('=')[1];
}
return null;
} | [
"function extractIdFromUrl( url ) {\n if ( !url ) {\n return;\n }\n \n var matches = urlRegex.exec( url ); \n\n // Return id, which comes after first equals sign\n return matches ? matches[1] : \"\";\n }",
"function extractIdFromUrl( url ) {\n if ( !url ) {\n return;\n }\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return base64encoded scores remaining to send | function getEncodedScores() {
var listScores = [];
for(var questionID in answersToSend) {
listScores.push(questionID);
listScores.push(scores[questionID]);
}
if (listScores.length !== 0) {
listScores.splice(0, 0, teamPassword, window.location.hostname, lastAnswersToSendUpdate.toISOS... | [
"function getEncodedAnswers() {\r\n var listAnswers = [];\r\n for(var questionID in answersToSend) {\r\n var answerObj = answersToSend[questionID];\r\n listAnswers.push([questionID, answerObj.answer]);\r\n }\r\n if (listAnswers.length !== 0) {\r\n return base64_encode(JSON.stringify({pwd: tea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
verify a jwt by comparing with current secret and algo | verifyJwt(token) {
return jwt.verify(token, config.JWT_SECRET, {
algorithms: ['HS256']
});
} | [
"verifyJwt(token) {\n return jwt.verify(token, config.JWT_SECRET, {\n algorithms: ['HS256'],\n });\n }",
"verifyJwt(token) {\n return jwt.verify(token, config.JWT_SECRET, { algorithms: 'HS256' });\n }",
"function verifytoken(token){\n try{\n jwt.verify(token,'mysecret')\n return... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
react life cycle mapper to invoke the creation of the form state | componentWillMount() {
this.createFormState(this.props);
} | [
"constructor(formDescription, component, options) {\n\n this.component = component;\n this.formDescription = formDescription;\n\n if (_.has(options, 'handleSubmit')) {\n this.handleSubmitCallback = options.handleSubmit.bind(component);\n }\n else {\n this.handleSubmitCallback = component.ha... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
avg bytes used vs page bar graph for avg bytes used vs page | function showBarGraphNumBytes() {
var margin = {top: 20, right: 20, bottom: 100, left: 100},
width = 600 - margin.left - margin.right,
height = 300 - margin.top - margin.bottom;
var x = d3.scale.ordinal().rangeRoundBands([0, width], .05);
var y = d3.scale.linear().range([height, 0]);
var xAxis = d3.svg.axis(... | [
"function barGraph(barData, total) {\n Object.keys(barData).forEach(function(key) {\n var label = `${key} ${curSym}${barData[key]}`;\n var graph = new Barcli({\n label: label,\n range: [0, 100],\n });\n var percent = Math.round((barData[key] / total) * 100);\n graph.update(percent);\n });... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Wake up the message loop to process any pending dispatchers. This is a noop if a wake up is not needed or is already pending. | function wakeUpMessageLoop() {
if (frameId === void 0 && !dispatchQueue.empty) {
frameId = raf(runMessageLoop);
}
} | [
"function wakeUpMessageLoop() {\n\t if (frameId === void 0 && !dispatchQueue.empty) {\n\t frameId = raf(runMessageLoop);\n\t }\n\t}",
"function wakeUpMessageLoop() {\n if (frameId === 0 && !dispatchQueue.empty) {\n frameId = raf(runMessageLoop);\n }\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return all types that make up the tuple type. If 'type' is not a tuple, returns a one element array with that type. | function types(type) {
var openParen = type.indexOf('(');
if (openParen === -1) {
return [type];
}
return type.substring(openParen + 2, type.length - 2).split(', ');
} | [
"function splitTupleTypes(type) {\n if (_.endsWith(type, '[]')) {\n throw new Error('Internal error: array types are not supported');\n }\n else if (!_.startsWith(type, 'tuple(')) {\n throw new Error(`Internal error: expected tuple type but got non-tuple type: ${type}`);\n }\n // Trim t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use accounts.find(findCurUser), returns username in account same as curAcc | function findCurUser(username) {
return username.username == curAcc.username;
} | [
"function getAccount(userName){\n var matchedAccount;\n accounts.forEach(function(account){\n if(account.username === userName){\n matchedAccount = account\n }\n })\n return matchedAccount\n}",
"function getAccount(username){\n\tvar user;\n\taccounts.forEach(function (account){\n\t\tif(username ===... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Send a SMS message. Number can be a PSTN or mobile phone number. from is optional | function sendsms (number, msg, from)
{
if (typeof (webphone_api.plhandler) === 'undefined' || webphone_api.plhandler === null)
webphone_api.addtoqueue('SendSms', [number, msg, from]);
else
webphone_api.plhandler.SendSms(number, msg, from);
} | [
"function sendSms() {\n\n // 'msg' and 'numberToDial' are passed in via the HTTP request from the Finesse gadget.\n // Pass these to the Tropo API to send an SMS.\n message(msg, {\n to:\"+\" + numberToDial,\n network:\"SMS\"\n });\n\n log(\"Sent \" + msg + \" to \" + numbertoDial);\n}",... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds a function which builds the transitive closure of the relationship "service A needs service B to initialize" | function buildClosure(inverse)
{
var origin = inverse ? 0 : 1;
var dest = 1 - origin;
return function transitiveClosure (service, current) {
if (typeof(current) === 'undefined') {
var current = {
name: indexedNodes[service],
... | [
"resolve(bind: boolean = false) {\n const needs = gooey.util.values(this.needs)\n const pool = gooey.services()\n const resolved = {}\n\n needs.forEach(req => resolved[req] = pool[req])\n\n if (bind) {\n Object.assign(this.data, dependencies)\n }\n\n return resolved\n }",
"_facto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This is a function for teamsUsernameHooksGet / Returns a paginated list of webhooks installed on this team. | teamsUsernameHooksGet(incomingOptions, cb) {
const Bitbucket = require('./dist');
let defaultClient = Bitbucket.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = incomingOptions.apiKey;
// Uncomment the follow... | [
"async readRegisteredWebHooks() {\n let options = Object.assign({},defaults);\n options.url = options.url + '/v1/webhooks'\n options.method = 'GET'\n const result = await sendRequest(options, 'readRegisteredWebHooks')\n return result\n }",
"function getAllWebhooksPromise(cursor) {\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Scene_Credits The scene class of the credits screen. | function Scene_Credits() {
this.initialize.apply(this, arguments);
} | [
"function mouseClickCredits(e) {\r\n\tcredits.alpha = 1;\r\n\thome.alpha = 0;\r\n\tstage.addChild(credits);\r\n\tcreditsScreen();\r\n\t\r\n\t}",
"function mainMenutoCredits() {\n if (store.getState().lastAction == MENU_CHANGE && store.getState().previousPage == 'MAIN_MENU' && store.getState().currentPage == 'C... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return name to DB according to domain | nameDB() {
let hostname = window.location.host.split('.')
let response = hostname
//Set capitalize to all words
hostname.forEach((word, index) => {
if (index >= 1) {
hostname[index] = word.charAt(0).toUpperCase() + word.slice(1)
}
})
//Remove .com .org....
if (hostname.... | [
"static get localDbName() { return \"LandslideSurvey\" }",
"function getCookieNameFromDomain (domain) {\n\tvar name;\n\tlet protocol = domain.split('//')[0] + '//'; // Gives http:// or https://\n\n\tdomain = domain.split('//')[1].split('/')[0]; // Gives the domain name like localhost:8050\n\n\t// Insert protocol ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Constructs the dataktptarget attribute selector from a full key sequence. | function ktpTargetFromSequences(keySequences) {
return '[' + _KeytipConstants__WEBPACK_IMPORTED_MODULE_0__.DATAKTP_TARGET + '="' + sequencesToID(keySequences) + '"]';
} | [
"function toAttrQuery(key) {\n return '[' + key.replace(/[:.\\-_]/g, v => '\\\\' + v) + ']';\n}",
"function AttributeSelectorStrategy(attrName){\r\n Assert.notNull(attrName)\r\n this.attrName = attrName\r\n }",
"getTargetAttr(target, key) {\n if (target.element) {\n return target.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds one or many rules to the filter stream | async addRules (add) {
if (!Array.isArray(add)) {
add = [ add ]
}
const result = await needle('post', 'https://' + this.TWT_API_HOST + '/2/tweets/search/stream/rules', {
add
}, {
headers: {
"content-type": "application/json",
... | [
"addFilterRule() {\n const filterRules = this.props.ruleComponents.filterRules;\n filterRules.push(['', '', '']);\n const ruleLogic = this.autoGenerateRuleLogic(\n filterRules,\n this.props.ruleComponents.ruleLogic,\n );\n this.updateRuleComponents(filterRules, ruleLogic);\n }",
"addRule... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the number of moves. | getMoveCount() {
return this.moveCount;
} | [
"async function getMoveNum() {\n return MAX_MOVES - moves_remaining;\n}",
"numMoves() {\n return this.board.reduce((tableAcc, row) => {\n return tableAcc + row.reduce((rowAcc, x) => {\n return rowAcc + (x !== null ? 1 : 0);\n }, 0);\n }, 0);\n }",
"function countMoves() {\n\tvar output ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
onCommand is called when speechtotext was processed at the same time hotword was detected | async onCommand(recognition) {
this.console('command detected: ' + recognition.text);
} | [
"onSpeechResult(event) {\n var interimTranscript = '';\n if (event.results[event.results.length-1].isFinal) {\n this.finalTranscript = event.results[event.results.length-1][0].transcript;\n this.transcript += ' ' + this.finalTranscript;\n } else {\n interimTrans... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set HTMLProgressElement.value and HTMLProgressElement.max to valueMax.valuePercentage and valueMax.maxPercentage. | setValueMax_by_ValueMaxObject( valueMax ) {
this.htmlProgress.value = valueMax.valuePercentage;
this.htmlProgress.max = valueMax.maxPercentage;
} | [
"_setValuePercent() {\n const dif = ((this.value - this.min) / (this.max - this.min)) * 100;\n this.el.style.setProperty('--valuePercent', `${dif}%`);\n }",
"function setElementProgressMax(id, max)\n{\n let target = document.getElementById(id)\n target.max = max;\n let toolTip = target.value + ' /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the previous rendernode | function _contextPrev() {
// Get the previous node from the sequence
if (!this._contextState.prevSequence) {
return undefined;
}
if (!this._context.reverse) {
this._contextState.prevSequence = this._contextState.prevSequence.getPrevious();
if ... | [
"getPreviousNode() {\r\n if (this.position.previous !== null) {\r\n this.position = this.position.previous;\r\n return this.position;\r\n } else {\r\n return this.position;\r\n }\r\n \t}",
"function _contextPrev() {\n\n\t // Get the previous node f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set_sliding_height: void sets sliding height, which is amount of sliding distance per one workspace when switching workspace. Nonnegative values are allowed. height: double: sliding height. | function set_sliding_height( height ){
if( height >= 0 ){
sliding_height = height;
configure_plane_offset();
configure_plane_height();
}
} | [
"setHeight(height) {\r\n this.graphDiv.style.height = String(height) + \"px\";\r\n this.dygraph.resize();\r\n }",
"function set_sliding_duration( duration ){\n\tif( duration < 0 )\n\t\tsliding_duration = WindowManager.WINDOW_ANIMATION_TIME;\n\telse\n\t\tsliding_duration = duration;\n}",
"set he... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A menu item may include a header or may itself be a header. | function MenuHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = __WEBPACK_IMPORTED_MODULE_2_classnames___default()('header', className);
var rest = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__lib__["b" /* getUnhandledProps */])(Me... | [
"function headerNavigation() {\n var $menu;\n\n $menu = jQuery(ONEPAGE.menu).find(\".content\");\n if ($menu.length > 0) {\n $menu.click(function () {\n jQuery(\"ul.menu\", this).slideToggle();\n });\n }\n}",
"function MenuHeader(props) {\n var children = props.children,\n className = props.c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`_readBlankNodePunctuation` reads punctuation in a blank node | _readBlankNodePunctuation(token) {
var next;
switch (token.type) {
// Semicolon means the subject is shared; predicate and object are different
case ';':
next = this._readPredicate;
break;
// Comma means both the subject and predicate are shared; the object is different
... | [
"_readBlankNodePunctuation(token) {\n var next;\n switch (token.type) {\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes a specific Deployment. Parameters: deploymentId : String ID of the Deployment to be deleted Returns: Promise that resolves when the Deployment is successfully deleted, or rejects with an error | delete(deploymentId) {
return super.delete(deploymentId);
} | [
"deleteVersion(id, versionId) {\n return this.rest.delete(`${this.baseUrl}/${id}/versions/${versionId}`);\n }",
"deleteDeploymentScope(organizationId, deploymentScopeId, options) {\n return this.sendOperationRequest({ organizationId, deploymentScopeId, options }, deleteDeploymentScopeOperationSpe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If data fetching failed, set input error style | applyErrorStyle() {
this.nodes.inputHolder.classList.add(this.CSS.inputError);
this.nodes.progress.remove();
} | [
"function setErrorCSS(filterobj){\n\t\t\tif (filterobj.error){\n\t\t\t\t$(\"#filterrow\"+filterobj.row+\" td input\").css(\"background\",ERRORCOLOR);\n\t\t\t\t$(\"#filterrow\"+filterobj.row+\" td .token-input-input-token\").css(\"background\",ERRORCOLOR);\n\t\t\t\t$(\"#filterrow\"+filterobj.row+\" td li.mega\").css... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
agrega un track a su lista de tracks | addTrack(track){
this.tracks.push(track);
} | [
"addTrack(track) {\n this.tracks = [track, ...this.tracks];\n this.cache.saveLocalStorage(this.tracks);\n return this.tracks;\n }",
"function putTracksOnTrackList(id) {\n var playlist;\n\n //Check if id is a list[] or a number\n if(isNaN(id)){\n playlist = id;\n tracks = playlist;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resets target object to null | resetTargetObject () {
this._targetObject = null;
} | [
"reset() {\n this.entity = null;\n }",
"reset()\n\t\t{\n\t\t\tinstance = null\n\t\t}",
"clearOriginal() {\n this._original = null;\n }",
"reset() {\n\t\tthis.realPosition = null;\n\t}",
"_reset() {\n this.instance = null;\n }",
"resetTarget () {\n if (!this.target)\n return;\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
+++ NICE TO KNOW, if, should there be, any server connection problems, it is needed to manually refresh the web page +++ to force component to mount again and therfore call getAllAuthors function again. +++ In a perfect reality, it would havde been neat, to have some kind of socketconnection to maintain some kind of li... | componentDidMount() {
this.getAllAuthors()
} | [
"function getAuthors() {\n $.get(\"/api/authors\", renderAuthorList);\n }",
"function getAuthors() {\n $.get(\"/api/authors\", function(data) {\n var rowsToAdd = [];\n for (var i = 0; i < data.length; i++) {\n rowsToAdd.push(createAuthorRow(data[i]));\n }\n renderAuth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This operates the filter dropdown for the top navigation bar when someone hovers over the menu options | function initNavTopDropdown() {
var filter = $( '.navigation-top .sign-in');
filter.hover(
function() {
var nav = $( this ).find('.navigation-top-dropdown');
nav.stop().slideDown();
},
function() {
var nav = $( this ).find('.navigation-top-dropdown');
nav.stop().slideUp();
}
);
} | [
"function handleFilterMenu() {\n $('#js-filter-control').change(() => {\n Store.setRatingFilter(getRatingsFilterDropdownValue());\n render();\n });\n }",
"function filterBar() {\n\n var filterDropdownList = selectorAll('.filter-dropdown__item_list');\n [].forEach.call(filterDropdownList, fu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |