query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Function for calling the cart page with the item in the shopping cart | function goToCart() {
// Get shopping cart
messagejson = getCartList();
if (messagejson) {
document.querySelector('#button-cart-hidden').value = messagejson;
document.querySelector("#form-cart").submit();
};
return;
} | [
"async navigateToCart() {\n const cartButtonLocator = await this.components.cartLink()\n await cartButtonLocator.click()\n }",
"clickCart() {\n cy.get(CART_LINK_CSS)\n .click();\n\n return cartPage();\n }",
"function showCart() {\n console.log(chal... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the skin defers silhouette operations until the last possible minute, this will be called before isTouching uses the silhouette. | updateSilhouette () {} | [
"handleSkierRhinoCollision() {\n this.updateEatAsset();\n }",
"function PrisonMaidLightTorture() {\n\tPrisonMaidIsAngry = true;\n\tPrisonMaid.Stage = \"PrisonerTortured\";\n\tvar torture = Math.random() * 4;\n\tif (torture < 1) {\n\t\tPrisonMaid.CurrentDialog = DialogFind(PrisonMaid, \"PrisonMaidTorture... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================================================// ============================================================================// ============================================================================// ============================================================================// ====... | function update_payment() {
var date = new Date();
var now = date.getTime()/1000.0;
var delta = now - last_payment_update_time;
last_payment_update_time = now;
time_spent += delta;
total_time_spent += delta;
console.log('Time spent:' + time_spent);
//console.log('Total time spent:' + total_time_... | [
"function countdown() {\r\n var timer_min_span = document.getElementById(\"timer_min\");\r\n var timer_sec_span = document.getElementById(\"timer_sec\");\r\n var min_count = 5, sec_count = 0; // 5 Minute Timer\r\n\r\n setInterval(() => { // Executes the following every 1000 milliseconds (1 second)\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Augment the Uint8Array instance (not the class!) with Buffer methods | function augment (arr) {
arr._isBuffer = true
// save reference to original Uint8Array get/set methods before overwriting
arr._get = arr.get
arr._set = arr.set
// deprecated, will be removed in node 0.13+
arr.get = BP.get
arr.set = BP.set
arr.write = BP.write
arr.toString = BP.toString
arr.toLoca... | [
"constructor(ringbuf) {\n if (ringbuf.type() != \"Uint8Array\") {\n throw \"This class requires a ring buffer of Uint8Array\";\n }\n // const SIZE_ELEMENT = 5;\n this.ringbuf = ringbuf\n }",
"toUint8() {\n\t\treturn new Uint8Array(this.buffer, this.byteOffset, this.byteLength)\n\t}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
handle any changes in the message text area: if the message is empty then the fee is zero. | function setTextAreaHandler() {
const msgTextArea = document.getElementById('msgTextArea');
msgTextArea.addEventListener('input', function() {
console.log('setTextAreaHandler: msgTextArea.value = ' + msgTextArea.value);
if (msgTextArea.value == '' && (!attachmentSaveA.href || !attachmentSaveA.download))
... | [
"function totalAmtReceived_Calc(){\r\n\t\r\n\tvar cashAmount = $(\"#cashAmount\").val();\r\n\tvar cardAmount = $(\"#cardAmount\").val();\r\n\tvar chequeAmount = $(\"#chequeAmount\").val();\r\n\tvar voucherAmount = $(\"#voucherAmount\").val();\r\n\tvar totalAmtReceived = 0;\r\n\t\t\r\n\tif( cashAmount == null || ca... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Specified time constraints validation handler for reservation creation | function dayAndTimeValidation(req, res, next) {
const { reservation_date, reservation_time } = res.locals.body;
const dateObject = new Date(reservation_date + "T" + reservation_time);
const today = new Date();
const [year, month, day] = [
today.getFullYear(),
today.getMonth(),
today.getDate(),
];
... | [
"function validateDateAndTime(req, res, next) {\n const { reservation_date, reservation_time } = req.body.data;\n const reservationDate = new Date(`${reservation_date}T${reservation_time}:00.000`);\n const todaysDate = new Date();\n const reservationTime = Number(reservation_time.replace(\":\", \"\"));\n\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the next (or previous if `forward` is false) grapheme / cluster break from the given start position (as an offset inside / the line, not the document). Will return a position greater than / (or less than if `forward` is false) `start` unless there is no / such index in the string. | findClusterBreak(start, forward) {
if (start < 0 || start > this.length)
throw new RangeError("Invalid position given to Line.findClusterBreak");
let contextStart, context;
if (this.content == "string") {
contextStart = this.from;
context = this.content;
... | [
"findClusterBreak(start, forward) {\n if (start < 0 || start > this.length)\n throw new RangeError(\"Invalid position given to Line.findClusterBreak\");\n let contextStart, context;\n if (this.content == \"string\") {\n contextStart = this.from;\n co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to delete matrix column option | function deleteMatrixColumnOption(id) {
$('#matrix_column_' + id).remove();
} | [
"function deleteMatrixRowOption(id) {\n $('#matrix_row_' + id).remove();\n}",
"deleteColumn() {\n let tableBand = this.getParent();\n let table = this.getTable();\n if (tableBand !== null && table !== null) {\n let colIndex = tableBand.getColumnIndex(this);\n if (colI... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Description: Computes the number of empty lines in the text Parameter: txt Returns: number of empty lines in the txt | function nonEmptyLines(txt){
let count = (txt.match(/^\s*\S/gm) || "").length;
return count;
} | [
"function linesCount(txt){\n if (txt.length === 0){\n return 0;\n } else{\n return txt.split('\\n').length;\n }\n}",
"function charCount(txt){\n return txt.length;\n}",
"function processText(tmp){\n line = line + (tmp.length)/tailleMax\n if (line >= nbLineMax){\n erase_tex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `ReplicationTimeProperty` | function CfnBucket_ReplicationTimePropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
if (typeof properties !== 'object') {
errors.collect(new cdk.ValidationResult('Expected an object, but receive... | [
"function CfnBucket_ReplicationTimeValuePropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an obj... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
number of successful inserts to OrderItem eventdriven(?) notify method that continues when ALL items have been added. | function notifySuccess() {
successes++;
if (successes >= orderItems.length) {
console.log("order added for table " + order.tableNum + ", party " + party + " with orderID " + orderID);
... | [
"itemsChanged() {\n this._processItems();\n }",
"function Notify() {\n\t\t//fined not checked products from all\n\t\tconst arrayCount = stateProducts.filter(product => (product.bought !== 'checked' && true))\n\t\tsetCount(() => arrayCount.length);\n\t\treturn (arrayCount.length);\n\t}",
"placeOrders() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Draws the x and y axis on the svg object within their respective groups along with their axis labels | function drawAxis() {
svg.select('.x-axis-group .axis.x')
.attr('transform', `translate(0, ${chartHeight})`)
.call(xAxis);
svg.select('.y-axis-group .axis.y')
.call(yAxis);
} | [
"function drawAxis( axisIndex, key ,ext)\n {\n var scale = d3.scale.linear()\n .domain( ext[axisIndex] )\n .range( axisRange )\n\n scales[axisIndex] = scale;\n if(!x.options.axis) return;\n var numTicks = x.options.numticks[axisIndex];\n var tickSize = 0.1;\n\n // tick... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
after component mounts, checks localStorage to see if user is there, if it is, changes state of loggedIn to true, if not, loggedIn is set to false | componentDidMount() {
if (localStorage.getItem('user') && localStorage.getItem('password')) {
this.setState({ loggedIn: true });
} else {
this.setState({ loggedIn: false });
}
} | [
"function loginStatusToStorage() {\n\tlocalStorage.loggedIn = loggedIn;\n\tlocalStorage.loggedInID = loggedInID;\n}",
"checkForToken() {\n if(localStorage.getItem('token')) {\n this.setState({token: localStorage.getItem('token')});\n this.setState({authenticated: true});\n }\n }",
"onLoggedIn(u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
same as the first one but im using the filter() method to traverse a array of objects looking for a name that matches the string passed in | function matchName(arrayOfObjs, string){
const matchingNames = arrayOfObjs.filter(element => string === element.name);
return matchingNames ? matchingNames : undefined;
} | [
"static find(x) {\n return this.data.filter(foodModel => foodModel.name.toLowerCase().includes(x.toLowerCase()));\n }",
"function getEmployees(name_part){\n let emps = employees.filter(function(emp){\n return emp.first_name.toLowerCase().startsWith(name_part.toLowerCase()); \n })\n displayEmployees(e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Serialize a class symbol information | function serializeClass(symbol) {
var details = serializeSymbol(symbol);
// Get the construct signatures
var constructorType = checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
details.constructors = constructorType
.getConstructSignatures()
.map... | [
"function serializeClass(symbol) {\n \n var classDetails = serializeSymbol(symbol);\n var details = {'@id':classDetails.name, '@type':classDetails.type}\n //var prop ={}\n \n symbol.members.forEach((value)=>{\n var {name, type} = serializeSymbol(value)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a function which takes as input the educational data and merges its values in the SVG values | function mergeData(data) {
// fetch the SVG values and include the JSON format from the response
fetch(URL_SVG)
.then((response) => response.json())
.then((json) => {
// loop through the array of educational data
for(let i = 0; i < data.length; i++) {
// for each educational data point... | [
"function createAYEChart(selectedCountry, sex) {\n console.log(\"Selected country: \" + selectedCountry);\n let AYEData;\n if (selectedCountry === \"AVG\") {\n if (sex === \"both\") {\n AYEData = averageData.map(function(d) {\n return {\n year: d.year,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
register yourself as children of the parent(cells that are appearing in the formula) | function setParentCHArray(formula, chAddress) {
// (A1 +A2 )
let formulaTokens = formula.split(" ");
for (let i = 0; i < formulaTokens.length; i++) {
let ascii = formulaTokens[i].charCodeAt(0);
if (ascii >= 65 && ascii <= 90) {
let { rid, cid } = getRIDCIDfromAddress(formulaToken... | [
"function setParentChildrenArray(formula, address) {\n //convert ( A1 + A2 ) -> ( 10 + 20 )\n // split with space\n\n let formulaTokens = formula.split(\" \");\n for(let i=0; i<formulaTokens.length; i++) {\n let ascii = formulaTokens[i].charCodeAt(0);\n if(ascii >= 65 && ascii<=90) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to load view for all years for give ICDCode | function loadViewForAllYears(icd, text) {
// set sideNav to true
sideNav = true;
// Hide tooltip to prevent it from staying after click
$(this).tooltip('hide');
setSectionHeader("2000 - 2014");
// remove stacked barchart
removeBarChart(960, 500);
// remove pie chart
removePieChart();
... | [
"function loadViewForYear(jahr, icd, description) {\r\n\r\n\t// Set sideNav to false\r\n\tsideNav = false;\r\n\r\n\t// show details div\r\n\t$('#some-details').show();\r\n\t$('#pieChart').show();\r\n\r\n\t// Set new headers\r\n\tsetAllHeaders(icd, description, \"\", jahr);\r\n\r\n\t// Add Year Overview Button\r\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Go thru each expression in every module, function, step, box, and update any function call expressions | function updateOtherFuncCalls(fOcur, arg, remove) {
var pO = CurProgObj;
var fname = fOcur.funcCallExpr.str;
for (var m = 0; m < pO.allModules.length; m++) { // each module
var mO = pO.allModules[m];
for (var f = 0; f < mO.allFuncs.length; f++) { // each func
va... | [
"function call(){\n\t\t\t$.each(funstack, function(index, value){\n\t\t\t\tvalue();\n\t\t\t});\n\t\t}",
"function initCodeOfStep(sO) {\r\n\r\n var fO = CurFuncObj;\r\n\r\n // if we have alredy intialized code of the setp, nothing to do.\r\n //\r\n if (sO.boxExprs.length)\r\n return;\r\n\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
On Sync Start CallBack | function onsyncstartCallback(outputparams) {
kony.print("Sync Started");
kony.print("syncResetSuccess");
setPercentageForLoader(0);
} | [
"async onBegin() {\n\t}",
"function syncActivityDataCB(data){\n var wasImmediateSync = data.isImmediate;\n var l_data = data.activityData;\n \n console.log(\"IsImmediate : \"+wasImmediateSync+\"||\"+l_data[0].activityId);\n \n if(wasImmediateSync){\n l_synAllData = {};\n //for(var ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Outputs maps, adding clearfixes where necessary, and updates the number of results shown Parameters:maps HTMLCollection of maps mapsNode the node where the maps will be placed into | function outputMaps(maps, mapsNode) {
mapsNode.innerHTML = "";
var count = mapsNode.parentNode.children[0].children[3].firstElementChild;
if (maps.length === 0) {
count.textContent = "0 results shown";
mapsNode.textContent = "No maps to display";
} else if (maps.length == 1) {
count.textContent = "1 result sh... | [
"function drawMap() {\n map = document.createElement(\"div\");\n var tiles = createTiles(gameData);\n for (var tile of tiles) {\n map.appendChild(tile);\n }\n document.body.appendChild(map);\n }",
"function changeOrder() {\n\tvar controlsNode = this.parentNode.parentNode;\n\tvar maps = $(cont... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets sockets with the obtained api key by using socket.io.js | function _setupSockets(api_key) {
console.log("Connecting " + api_key);
var agile = api_key;
socket = io.connect('https://push.agilecrm.com');
socket.on('connect', function() {
console.log('socket connected');
socket.emit('subscribe', {
agile_id : agile
});
});
socket.on('browsing', function(data) {
... | [
"function initSocket() {\n socketRef.current = io(\"localhost:8000\");\n setId(socketRef.current.id);\n setSocket(socketRef.current);\n }",
"set _socket( socket ) {\n this._propSocket = socket;\n }",
"function initSocketIO(){\n io.on('connection', function(socket){\n\n });\n}",
"function b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set the pressed attribute of the key based on the type of event (down = true, up = false) | function keyEvent(code, isDown) {
for (const [key, value] of Object.entries(keyStates)) {
for (var ci in value.codes) {
if (value.codes[ci] == code) {
value.pressed = isDown;
// console.debug(keyStates, isDown, ci, value.codes[ci] == code, value.pressed);
}
}
}
} | [
"toggleKeyPress() {\r\n const style = this.class + '-pressed';\r\n this.el.classList.toggle(style);\r\n }",
"function keyPressed() {\n changeSnakeDir(keyCode);\n}",
"function keyPressed() {\n if (keyCode === UP_ARROW) {\n hain = true;\n }\n}",
"keyControl() {\n\n if (keyIsDown(this.a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns `true` when this permission covers all specified permissions. `permissions` can be either permission strings or RNPermission objects. Throws an error when permission string is invalid. | allows(...permissions) {
const perms = _.flatten(permissions).map(e => new RNPermission(e));
return perms.every(e => this.matchIdentifier(e) && this.matchPrivileges(e.privileges()));
} | [
"function can(permissionsData, permission) {\n try {\n const permissions = JSON.parse(permissionsData);\n return permissions[permission];\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(`Error parsing permissions data: ${permissionsData}`);\n }\n return false;\n}",
"isAnyA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Forces header of area report to remain at the top of the area table during scrolling (the header is the row with the column titles ALUTs, FFs, etc.) | function
stickTableHeader()
{
var reportBody = $(currentPane + " #report-body")[0];
if (!reportBody) return;
var areaTable = $(currentPane + " #area-table-content")[0];
if (!areaTable) return;
var panel = reportBody.getBoundingClientRect();
var table = areaTable.getBoundingClientRect();
var ... | [
"function fixHead() {\n var thead = $(settings.table).find(\"thead\");\n var tr = thead.find(\"tr\");\n var cells = thead.find(\"tr > *\");\n\n setBackground(cells);\n cells.css({\n 'position': 'relative'\n });\n }",
"function constructHea... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inform the observer that the filters have changed for a particular list. | function filtersHaveChanged(listKey, filters) {
if (_.has(filtersHaveChangedCallbacks, listKey)) {
filtersHaveChangedCallbacks[listKey](filters);
}
} | [
"function registerFiltersHaveChangedCallback(listKey, callback) {\n filtersHaveChangedCallbacks[listKey] = callback;\n }",
"updateList() {\n console.log(\"$$$$$$$$ updateList\");\n this.forceUpdate();\n }",
"function updateFromFilters(){\n\n //$(\"input\").prop('disabled', true);\n\n var ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a list of ancestor paths for a given path. The paths are sorted from deepest to shallowest ancestor. However, if the `reverse: true` option is passed, they are reversed. | ancestors(path) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var {
reverse = false
} = options;
var paths = Path.levels(path, options);
if (reverse) {
paths = paths.slice(1);
} else {
paths = paths.slice(0, -1);
}
return path... | [
"ancestors(path) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var {\n reverse = false\n } = options;\n var paths = Path.levels(path, options);\n\n if (reverse) {\n paths = paths.slice(1);\n } else {\n paths = paths.sli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function that generates random candies on the first row when candy is crushed | function generateCandy() {
for (let i = 0; i < width; i++) {
const cell = document.getElementById(`${i}`)
if (!cell.classList[1]) {
cell.classList.add(`${colors[Math.floor(Math.random() * Math.floor(4))]}`)
}
}
} | [
"function getRandomCell(winCombs) {\n return winCombs[Math.floor(Math.random() * winCombs.length)];\n}",
"generateCalBurnt()\r\n {\r\n var calories = Math.floor((Math.random() * 20) + 1)\r\n console.log(calories)\r\n }",
"function getRandomCell() {\n\n\tvar randRow = Math.floor(Math.random... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
take the playlist object and return an acceptable filename | fileName(playlist) {
return playlist.name.replace(/[^a-z0-9\- ]/gi, '').replace(/[ ]/gi, '_').toLowerCase();
} | [
"function MusicItem( id, name, playlistId ) {\n\n this.id = id;\n this.name = name;\n this.playlistId = playlistId;\n\n var type = id.substring( 0, 2 );\n\n this.getTypeName = function() {\n switch ( type ) {\n case 'tr': return 'track';\n case 'ar': return 'artist';\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the value of a parameter. `name` name of the parameter `value` new value or null if the user wishes to unset the parameter | setParameter(name, value) {
if (value != null) {
return this.params[name] = value;
} else {
return delete this.params[name];
}
} | [
"function ServerBehavior_setParameter(name, value)\n{\n if (this.bInEditMode)\n {\n this.applyParameters[name] = value;\n }\n else\n {\n this.parameters[name] = value; \n }\n}",
"function setValue(param, value) {\n if (lmsConnected) {\n DEBUG.LOG(`setting ${param} to ${value}`);\n scorm.set(par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check if lat and lng are filled before confirm | function validate(event) {
// const needsLatAndLng = true;
// if (needsLatAndLng) {
// event.preventDefault()
// alert('Selecione um ponto no mapa')
// }
// const validLat = document.querySelector('[name="lat"]')
// const validLng = document.querySelector('[name="lng"]')
// if (... | [
"function checkLocation(){\r\n\tif (guylocation.value == null || guylocation.value == \"\"){\r\n\t\temptyFieldsArray.push(\" Location\");\r\n\t\tborderRed(guylocation);\r\n\t\treturn true;\r\n\t}\r\n\telse{\r\n\t\treturn false;\r\n\t}\r\n}",
"function validateData() {\n hideGeoportalView();\n var geocoder= ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get Start Controller Position | function startController(e) {
conXstart = e.touches[0].pageX; //Srart X Cursor
conYstart = e.touches[0].pageY; //Srart Y Cursor
contPositionL = this.getBoundingClientRect().left; //Left Position Controller on X page
contPositionR = this.getBoundingClientRect().right; //Left Position Controller on X page
cont... | [
"getScreenPosition() {\n var game = this.game;\n var cam = game.camera;\n\n var screenX = this.position.x - cam.x;\n var screenY = this.position.y - cam.y;\n\n return new Point(screenX, screenY);\n }",
"get_top_left() {\n this.__top_left_c = this.__top_left_c || this._... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extended Resource Settings storeOffline: true, resourceName: openmrs.user usesEncryption: true, primaryKey : "uuid" queryFields : all (for now) | function getResource() {
var v = "custom:(uuid,username,systemId,roles:(uuid,name,privileges))";
r = $resource(OpenmrsSettings.getContext() + "/ws/rest/v1/user/:uuid",
{uuid: '@uuid', v: v},
{query: {method: "GET", isArray: false}}
);
return new dataMgr.ExtendedResource(r,true,re... | [
"function getResource() {\n r = $resource(OpenmrsSettings.getContext() + \"/ws/rest/v1/provider/:uuid\",\n {uuid: '@uuid', v: v},\n {query: {method: \"GET\", isArray: false}}\n );\n return new dataMgr.ExtendedResource(r,true,resourceName,false,\"uuid\",null);\n }",
"function getRes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets up the voices to use when using text to speech from options or default value. | setUpVoices() {
if (this.voices.length === 0) {
this.voices = this.synth.getVoices(); let i = 0, name = MyOptions.alarms.ttsName;
if (name !== '') { for (const voice of this.voices) { if (voice.name === name) this.voiceIndex = i; i++; }}
}
} | [
"function populateVoices() {\n // remove current voice options\n while (voiceSelect.hasChildNodes()) {\n voiceSelect.removeChild(voiceSelect.firstChild);\n }\n\n const voices = SpeechSynthesisAdapter.getVoices();\n\n // add voice options\n voices.forEach(voice => {\n const option = document.createElemen... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This obscure mess of constants computes the minimum length of an unchanged range (not at the start/end of the compared content). The idea is to make it higher in bigger replacements, so that you don't get a diff soup of coincidentally identical letters when replacing a paragraph. | function minUnchanged(sizeA, sizeB) {
return Math.min(15, Math.max(2, Math.floor(Math.max(sizeA, sizeB) / 10)))
} | [
"function stringRange(p_min, p_max) {\n\tvar result = \"\";\n\tvar optionalSpace = \"\";\n\tif (p_min != null) {\n\t\tresult = \">= \" + p_min;\n\t\toptionalSpace = \" et \";\n\t}\n\tif (p_max != null) {\n\t\tresult += optionalSpace + \"<= \" + p_max;\n\t}\n\treturn result;\n}",
"function setMaxCharacterCount() {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rolls smiley button out | function rollSmileyOut () {
btn1.style.animationDuration = "0.4s";
btn2.style.animationName = "none";
btn1.style.animationName = "rollSmileyOut";
btn1.style.animationIterationCount = "1";
} | [
"function yourTurn(level) {\n btnContainer.classList.remove('unclickable')\n}",
"function revoke_mouseout(revo)\n{\n revo.classList.remove('btn-revoke-active');\n revo.classList.add('btn-revoke-in-active');\n}",
"function imojieClick(emojie) {\n gMeme.lines.push({\n txt: `${emojie}`,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Exit a parse tree produced by Java9ParserarrayAccess_lf_primary. | exitArrayAccess_lf_primary(ctx) {
} | [
"exitArrayAccess_lfno_primary(ctx) {\n\t}",
"exitUnannArrayType(ctx) {\n\t}",
"exitArrayCreationExpression(ctx) {\n\t}",
"exitOrdinaryCompilation(ctx) {\n\t}",
"exitFieldAccess_lf_primary(ctx) {\n\t}",
"exitMethodInvocation_lf_primary(ctx) {\n\t}",
"visitExit_statement(ctx) {\n\t return this.visitChild... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Internal: actually reading body. Each step, buf to use is passed in through yield result. Returns on no more data to read or error. | async *_bodyStream() {
let buf = yield 0; // dummy yield to retrieve user provided buf.
if (this.headers.has("content-length")) {
const len = this.contentLength;
if (len === null) {
return;
}
let rr = await this.... | [
"_read() {\n if (this.index <= this.array.length) {\n //getting a chunk of data\n const chunk = {\n data: this.array[this.index],\n index: this.index\n };\n //we want to push chunks of data into the stream\n this.push(chunk);\n this.index += 1;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Visits a classbased binding and updates the new value (if changed). This function is called each time a classbased styling instruction is executed. It's important that it's always called (even if the value has not changed) so that the inner counter index value is incremented. This way, each instruction is always guaran... | function updateClassBinding(context, data, element, prop, bindingIndex, value, deferRegistration, forceUpdate) {
var isMapBased = !prop;
var state = getStylingState(element, stateIsPersisted(context));
var index = isMapBased ? STYLING_INDEX_FOR_MAP_BINDING : state.classesIndex++;
var updated = updateBin... | [
"setComponentClasses() {\n this._codeblockRender.setAttribute(\"class\", this.codePrismLanguage());\n this._codeblockRenderOuterPreTag.setAttribute(\"class\", this.appliedCssClasss());\n if (this.codeLineNumberStart !== 1) {\n this._codeblockRenderOuterPreTag.style.counterReset = \"linenumber \" + (th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
callback for setInterval that will be changing slides automatically | function intervalCallback() {
if (currentSlide === 4) {
changeSlides(currentSlide, 0);
} else {
changeSlides(currentSlide, currentSlide + 1);
}
} | [
"function privateAutoSlide(){\n\t\tprivateInterval = setInterval(privateNextSlide, TIME_AUTO_SEC*1000); //auto slide\n\t}",
"function play() {\n clearInterval(slideShow);\n\n slideShow = setInterval(function () {\n setSlide(nextSlideId);\n\n updateSlideVars(nextSlideId)\n }, timer);\n}",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This Function is used for uploading the object to s3. | function uploadObjectToS3(params, typeOfFile, callback){
var bucketName = params.Bucket;
var keyName = params.Key;
//Variable for Logging the messages to the file.
var logger = log.logger_rfq;
s3.putObject(params, function(err, data) {
if (err){
resJson = {
"http_code" : "500",
"message"... | [
"function storeInS3(jsonObj, bucketName, fileName, fileType) {\n fileName = fileName + \" \" + getFormattedDate();\n // Serialize JSON object\n const jsonBody = EJSON.stringify(jsonObj);\n // Instantiate an S3 service client\n const s3Service = context.services.get('s3').s3('us-east-1');\n // Put the object i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: Function will submit email address to servlet and determine if user qualifies for Premier Required input is formObj as defined: formName: This is the name of the form being submitted from (REQUIRED) textElement: ID of element that contains the email (REQUIRED) bref: hold BREF | function onSubmitCheckElgible(formObj) {
if(!formObj) { return false; }
var formName = formObj.formName;
var txtField = formObj.textElement;
var strUrl = window.open("https://www.wireless.att.com/IRUEmailDispatch.dyn?emailAddr=" + document.getElementById(txtField).value + "&bref=" + formObj.bref);
r... | [
"function validateForm() {\n var emailInput = document.getElementById('email');\n var submitButton = document.getElementById('button-submit');\n var email = emailInput.value;\n var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
True when this node is produced by a skip rule. | get isSkipped() {
return (this.flags & 2) /* NodeFlag.Skipped */ > 0
} | [
"shouldBeIgnored() {\n if (!this.json_.tag_)\n return false;\n\n var tag = this.json_.tag_;\n if (!tag.startsWith(\"autogenerated:\"))\n return false;\n\n if (tag == \"autogenerated:gerrit:newPatchSet\")\n return false;\n\n if (tag == \"autogenerated:gerrit:newWipPatchSet\")\n ret... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test: .offset should throw on invalid element | function offsetShouldThrowOnInvalidElement() {
expect(() => {
element.offset("invalid")
}).toThrow(
new TypeError("Invalid element: 'invalid'"))
} | [
"function offsetShouldReturnOffsetsForElement() {\n const data = element.offset(fixture.el.querySelector(\".container\"))\n expect(data)\n .toEqual({\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n })\n}",
"function offsetShouldReturnOffsetsForElementWithMargin() {\n const data = eleme... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function replaces the words in `raw` with the words in `code_words` such that the first occurrence of each word in `raw` is assigned the first unassigned word in `code_words` | function encoderSolution(raw, coded_words) {
mapping = {}
ans = []
var uniqueRaw = Array.from(new Set(raw));
for (i=0; i<uniqueRaw.length; i++) {
mapping[uniqueRaw[i]] = coded_words[i]
}
for (i of raw) {
ans.push(mapping[i]);
}
return ans
} | [
"function SearchAndReplace(arr,oldWord,newWord) {\n var t = '';\n var text = arr.split(' ');\n for (let i = 0; i < text.length; i++) {\n if (text[i] == oldWord) {\n t = text[i].charAt(0);\n if (t == text[i].charAt(0).toUpperCase()) {\n t = newWord.charAt(0).toUpp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Opens the showtime view | function openShowtimeView(e) {
var showtime = e.source.showtime;
var selectSeatsViewController = Alloy.createController('SelectSeatsView', {showtime:showtime, movie:movie});
context.openNewWindow(selectSeatsViewController.getView());
} | [
"function renderShowtimeButton(showtime) {\r\n\t\tvar showtimeBtn = Titanium.UI.createView({\r\n\t\t \tbackgroundColor: '#CCCCCC',\r\n\t\t \theight:50,\r\n\t\t \twidth:50,\r\n\t\t \tshowtime:showtime,\r\n\t\t \tborderColor:\"#0B6121\",\r\n\t\t\tborderWidth:\"4\",\r\n\t\t\tborderRadius:\"4\"\r\n\t\t});\r\n\t\tva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change the accessibility boolean of the story | function editorStoryAccessibleChange(element) {
loadedStory.accessible = element.checked;
editorDirty = true;
} | [
"function setAccessibilityState() {\n if (reduceMotionQuery.matches) {\n enableAnimations = false\n } else { \n enableAnimations = true\n }\n }",
"function toggle_button(event_target) {\r\n\tvar event_target_aria_pressed = event_target.getAttribute(\"aria-pressed\");\r\n\tdocument.getElementBy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
`data` holds the info we need to generically generate form fields | renderFormField(data, i) {
const { label, type, input } = data;
return (
<div key={i} className="form-group">
<label className="label form-label" htmlFor={input}>{label}</label>
<input className="input form-control" type={type} ref={input} id={input} name={input} />
</div>
);
} | [
"function getInputFieldsHtml(template_name)\n{\n //variables which change depending on the input type\n var num_input_index=0;\n var str_dynamic_index=0;\n var data = \"\";\n var cls = \"\";\n var input_type=\"\";\n var fieldName=\"\";\n\n var html=\"<div class='\"+template_name+\"-input'>\";\n var endDiv ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This component expects 2 props: text the text to display maxLength how many characters to show before "read more" | function Example10() {
const text = `Focused, hard work is the real key to success.
Keep your eyes on the goal, and just keep taking the next step towards completing it.`;
const maxLength = 35;
// Create a piece of state, and initialize it to `true`
// `hidden` will hold the current value of the state,
//... | [
"generateSmallDescription(text){\r\n\t if(text){\r\n\t\tif(text.length > 120){\r\n\t\t text= text.slice(0,120) + '...';\r\n\t\t return text;\r\n\t\t}\r\n\t\telse{\r\n\t\t return text;\r\n\t\t}\r\n\t }\r\n\t}",
"function ShowExampleAppLongText(p_open) {\r\n SetNextWindowSize(new ImVec2(520, 600), ImGui... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
moves the map East | function moveEast() {
currentLonPoint += 0.00050
console.log(currentLonPoint)
map.setView([currentLatPoint, currentLonPoint], 18)
} | [
"function East() {\n props.setMoveLocation(true);\n props.setLocation((longMove += 0.002), latMove);\n }",
"function moveWest() {\n currentLonPoint -= 0.00050\n console.log(currentLonPoint)\n map.setView([currentLatPoint, currentLonPoint], 18)\n\n }",
"function moveSouth() {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DirectiveLocations : Name DirectiveLocations | Name | function parseDirectiveLocations(lexer) {
var locations = [];
do {
locations.push(parseName(lexer));
} while (skip(lexer, _lexer.TokenKind.PIPE));
return locations;
} | [
"getSuggestions(name, distance = 3) {\n const leven = require('leven');\n const { commands, aliases } = this.getAllCommandsAndAliases();\n const suggestions = commands\n .filter(({ commandName }) => leven(name, commandName) <= distance)\n .map(({ commandName }) => commandN... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts the current name input into a token. | addToken() {
//Do nothing if there is no input.
if (!this.newNameField.value) {
return;
}
var newName = this.newNameField.value;
//Truncate the name.
while (newName.endsWith(" ")) {
newName = newName.substring(0, newName.length - 1);
}
while (newName.startsWith(" ")) {
newName = newName.subst... | [
"getTokenGenerator (name) {\n return get (this._tokenGenerators, name);\n }",
"defaultToken(){}",
"function setToken(token_temp) {\n token = token_temp\n}",
"function getNextToken(){\n currentToken = tokens[0];\n tokens.shift();\n}",
"makeToken() {\n if ( this.pattern === '*' ) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if the given `mention` text is valid. | function isValidMention(mention, serviceName) {
var re = mentionRegexes[serviceName];
return re.test(mention);
} | [
"function isMentionTextChar(char) {\n return mentionTextCharRe.test(char);\n }",
"function checkText(...strs) {\n for (const str of strs) {\n if (str === currentToken().text) {\n return true;\n }\n }\n return false;\n }",
"function check_is_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
:: VOID > yngwieTextNode Creates a clone of this yngwieTextNode: | clone() {
return new YngwieTextNode(`${this._value}`);
} | [
"function makeTextNode(token) {\n var node = makeObj(baseTextNode);\n node.text = token;\n return node;\n }",
"appendText(str) {\n this.current.appendChild(browser.createTextNode(str));\n return this;\n }",
"function createTextElement(text) {\n return new VirtualEle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return the reference to a paragraph style. if the style did not exist, create the style | function returnParagraphStyleOrCreatenew(stylename, groupname, stylePreferences){
var style;
var group;
//prepare style preferences. if none are given, only include the name
if (stylePreferences == null){
stylePreferences = {name: stylename};
} else {
stylePreferences.name = stylename;
}
if (!groupname){ ... | [
"havingStyle(style) {\n if (this.style === style) {\n return this;\n } else {\n return this.extend({\n style: style,\n size: sizeAtStyle(this.textSize, style)\n });\n }\n }",
"getStyleByID(styleID){\n\t\treturn this.styles[this.findIndexBy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Saves the items structure into a the userData format. | function save() {
var value, data = '';
// localStorage can be disabled on WebKit/Gecko so make a dummy storage
if (!hasOldIEDataSupport) {
return;
}
for (var key in items) {
value = items[key];
data += (data ? ',' : '') + key.length.toString(32) + ',' + key + ',' + value.length.toString(32) + ',' ... | [
"save(item){\n //if there is no data\n if(!this.data){\n this.data = [item];\n //create newData to store\n let newData = JSON.stringify(item);\n //pass in newData\n this.storage.set('todos', newData);\n } else {\n //if there is data, then push the new data\n this.data.push(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Pedir por prompt el precio y el porcentaje de descuento, mostrar el precio final con descuento por id. | function mostrar()
{
var precio;
var descuento;
var preFinal;
precio = prompt(precio)
descuento = prompt(descuento);
preFinal= (precio /100 * descuento);
document.getElementById("elPrecioFinal").value=preFinal;
} | [
"function calcularPrecioConDescuento(precio, descuento){\n const porcentajePrecioConDescuento = 100 - descuento;\n const precioConDescuento = (precio * porcentajePrecioConDescuento) / 100;\n\n return precioConDescuento;\n //return (precio * (100 - descuento) ) / 100;\n // esto no es tan legible como lo anterio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Emulate ARM assembly in Thumbs mode (e.g. almost all Smartphones, Raspberry Pi) | function run_THUMB(asmInput, singleStep) {
ks_endian = ENDIANESS? ks.MODE_BIG_ENDIAN:ks.MODE_LITTLE_ENDIAN
uc_endian = ENDIANESS? uc.MODE_BIG_ENDIAN:uc.MODE_LITTLE_ENDIAN
return run_generic(asmInput, 0x10000, ks.ARCH_ARM,ks.MODE_THUMB+ks_endian,uc.ARCH_ARM,uc.MODE_THUMB+uc_endian,"THUMB","nop",THUMB_REGISTE... | [
"function run_ARM(asmInput, singleStep) {\n ks_endian = ENDIANESS? ks.MODE_BIG_ENDIAN:ks.MODE_LITTLE_ENDIAN\n uc_endian = ENDIANESS? uc.MODE_BIG_ENDIAN:uc.MODE_LITTLE_ENDIAN\n return run_generic(asmInput, 0x10000, ks.ARCH_ARM,ks.MODE_ARM+ks_endian,uc.ARCH_ARM,uc.MODE_ARM+uc_endian,\"ARM\",\"nop\",ARM_REGIS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gestion de la suppression | function confirmerSuppression() {
let n = new Noty({
text: 'Confirmer la demande de suppression ',
layout: 'center', theme: 'sunset', modal: true, type: 'info',
animation: {
open: 'animated lightSpeedIn',
close: 'animated lightSpeedOut'
},
buttons: [
... | [
"function suppressionArticle(i) {\n panier.splice(i, 1); /* suppression de l'element i du tableau */\n localStorage.setItem(\"monPanier\", JSON.stringify(panier)); /* maj du panier sans l'élément i */\n window.location.reload();\n}",
"function _warningRemoveItems() {\n //hide top app bar\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pops off next word and adds to flashcard | function nextWord(){
currentWord = currentList.pop();
$('#front').text(currentWord.nativeWord);
setTimeout(function(){
$('#back').text(currentWord.foreignWord);
}, 500);
$('#next-question').hide();
$('#quiz-answer').show();
$('.flashcard').toggleClass('flipped');
} | [
"function nextWord() {\n\n //Agrega la siguiente palabra en un string, seguido por un espacio\n text.text = text.text.concat(line[wordIndex] + \" \");\n\n //Avanza el indice de la palabra\n wordIndex++;\n\n //Si es la ultima palabra...\n if (wordIndex === line.length)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks if the current word is a url Adapted from the original Javascript Brill tagger | function current_word_is_url(tagged_sentence, i, parameter) {
var is_url = false;
if (tagged_sentence[i][0].indexOf(".") > -1) {
// url if there are two contiguous alpha characters
if (/[a-zA-Z]{2}/.test(tagged_sentence[i][0])) {
is_url = true;
}
}
return((parameter === "YES") ? is_url : !is_u... | [
"static isUrl(text) {\n\t\tconst pattern = /^((http(s)?|ftp)?:\\/\\/)?([a-z0-9]+(:[a-z0-9]+)?@)?((www\\.)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(:\\d{1,5})?([^\\s.]+)?$/gmi;\n\t\treturn pat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add content to media entry which is not yet associated with content (therefore is in status NO_CONTENT). If the requirement is to replace the entry's associated content, use action updateContent. | static addContent(entryId, resource = null){
let kparams = {};
kparams.entryId = entryId;
kparams.resource = resource;
return new kaltura.RequestBuilder('media', 'addContent', kparams);
} | [
"function addMediaAfterSubmit (post) {\n var set = {};\n if(post.url){\n var data = getEmbedlyData(post.url);\n if (!!data) {\n // only add a thumbnailUrl if there isn't one already\n if (!post.thumbnailUrl && !!data.thumbnailUrl) {\n set.thumbnailUrl = data.thumbnailUrl;\n }\n //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determines if the current token represents a constructor, and the next token after it is a paren | function isConstructorToken() {
return t.type === 'ident' && t.value === 'constructor';
} | [
"visitConstructor_declaration(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"enterConstructorDeclarator(ctx) {\n\t}",
"visitConstructor_spec(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"noMoreThanOneConstructor(constructors) {\n doCheck(\n constructors.length <= 1,\n `A type declarati... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Begin preconnecting to warm up the iframe load | static warmConnections() {
if (this.preconnected) return;
// The iframe document and most of its subresources come right off youtube.com
this.addPrefetch('preconnect', 'https://www.youtube-nocookie.com');
this.addPrefetch('preconnect', 'https://i.ytimg.com');
this.addPrefetch('preconnect', 'https:/... | [
"function start()\n {\n let reloadParams = \"reload=reload\";\n fetch(\"memomedia.php\", {method: 'POST', credentials: 'include', headers: {\"Content-Type\": \"application/x-www-form-urlencoded\"}, body: reloadParams})\n .then(response => response.json())\n .then(fillPage)\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A reusable function to set up the models. We're passing in a position parameter so that they can be individually placed around the scene. Here we are just loading one 3D model, you are welcome to expand to more | function loadModels() {
const loader = new THREE.GLTFLoader();
const onLoad = ( gltf, position ) => {
model_tim = gltf.scene;
model_tim.position.copy( position );
//console.log(position)
//model_tim_skeleton= new T... | [
"createModel () {\n var model = new THREE.Object3D()\n var loader = new THREE.TextureLoader();\n var texturaOvo = null;\n\n var texturaEsfera = null;\n \n //var texturaGrua = new THREE.TextureLoader().load(\"imgs/tgrua.jpg\");\n this.robot = new Robot({});\n this.robot.scale.set(3,3,3);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Funcion auxiliar para procesar los argumentos y conocer el host a conectarse | function getHostByArg() {
//Recojemos los parametros con slice a partir del segundo elemento de la peticion
var args = process.argv.slice(2);
//Valor por defecto para el host
var host = '127.0.0.1';
//console.log("Host " + host);
if (args.length > 0) {
//Procesamos el array de parametros para conocer el par ... | [
"_parseConnect(...args) {\n var connectCallback, errorCallback, headers;\n headers = {};\n switch (args.length) {\n case 2:\n [headers, connectCallback] = args;\n break;\n case 3:\n if (args[1] instanceof Function) {\n [headers, co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create objects from Web API Takes the data returned from the web api and restructure it to create the the objects below which are then used to create the sliders veg_initial_conditions veg_type_state_classes_json | function createVegInitialConditionsDict(){
// current_proejct.definitions can be slow to initialize. Keep trying until it's defined.
if (typeof current_project.definitions != "undefined") {
var veg_initial_conditions = {};
veg_initial_conditions["veg_sc_pct"] = {};
$.each(current_scenario... | [
"static apiToModel(data) {\n const res = new KubernetesComponentStatus();\n res.ComponentName = data.metadata.name;\n\n const healthyCondition = _.find(data.conditions, { type: 'Healthy' });\n if (healthyCondition && healthyCondition.status === 'True') {\n res.Healthy = true;\n } else if (health... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a TagLink to a Model, optionally checking for ownership. | static async add(id, item_type, link, ownershipCheck) {
// Compose the query to find the comment.
const query = {
id,
'tags.tag.name': {
$ne: link.tag.name,
},
};
// If ownership verification is required, ensure that the person that is
// assigning the tag is the same pers... | [
"static newTagLink(user, tag) {\n return {\n tag: TagsService.newTag(tag),\n assigned_by: user.id,\n created_at: new Date(),\n };\n }",
"function addTag(req, res) {\n var errorCallback = function(err) {\n res.send({error: 'Unable to add tag'});\n };\n\n Model('findOne', {_id: req.param... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a tooltip message based on the content/control for the given subscription and thee given user info | tooltipMessage(userInfoType) {
// if (userInfoType === "email" && this.props.email.length < 1) {
// return "Please enter your email and search again"
// }
// else if (userInfoType === "phone" && this.props.phone.length < 1) {
// return "Please enter your phone number and search again"
// }
... | [
"function sp_ToolTip()\n{\n\ntry {\n\tnDomain = DVD.CurrentDomain;\n\tif (nDomain != 4) return;\n\n nSubpics = DVD.SubpictureStreamsAvailable;\n if (nSubpics == 0) {\n\t\tAudio.ToolTip = L_NoSubtitles_TEXT;\n\t\tAudioFull.ToolTip = L_NoSubtitles_TEXT;\n\t\treturn;\n\t}\n \n nCurrentSP = DVD.CurrentSubpi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
============================================= Funcion para llenar la tabla ascensor_valores_proteccion, trayendo del servidor los items en un archivo JSON ============================================== | function llenarTablaAscensorValoresProteccion(){
var cod_inspector = window.localStorage.getItem("codigo_inspector");
var parametros = {"inspector" : cod_inspector};
$.ajax({
async: true,
url: "http://www.montajesyprocesos.com/inspeccion/servidor/php/json_app_ascensor_valores_proteccion.php",
data: p... | [
"function llenarTablaAscensorValoresIniciales(){\n var cod_inspector = window.localStorage.getItem(\"codigo_inspector\");\n var parametros = {\"inspector\" : cod_inspector};\n $.ajax({\n async: true,\n url: \"http://www.montajesyprocesos.com/inspeccion/servidor/php/json_app_ascensor_valores_iniciales.php\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checkData() given an object, representing the parse of the XML, look through it, validating things. The output comes back as a string. | function checkData(xmlobject)
{
var output = "";
// TODO - make sure each field has a name, type, op, label (warning), and perspective
// TODO - make sure, depending upon the op, that the other fields are there
// (the array below is the current requirements)
var reqFields = { count: ["t... | [
"function reportCleanXML(passedData){\n\tconsole.trace(passedData);\n}",
"function getData( xHRObject, xsllnk )\n{\n var READY_STATE_UNINITIALIZED = 0;\n var READY_STATE_LOADING = 1;\n var READY_STATE_LOADED = 2;\n var READY_STATE_INTERACTIVE = 3;\n var READY_STATE_COMPLETE = 4;... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configure aws with your accessKeyId and your secretAccessKey | async function configAWS(){
aws.config.update({
region: 'us-east-1', // Put your aws region here
accessKeyId: config.AWSAccessKeyId,
secretAccessKey: config.AWSSecretKey
})
} | [
"function create(accessKeyId, secretAccessKey) {\n config.accessKeyId = accessKeyId;\n config.secretAccessKey = secretAccessKey;\n\n AWS.config.update(config);\n AWS.config.region = window.AWS_EC2_REGION;\n AWS.config.apiVersions = {\n cloudwatch: '2010-08-01',\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
It should make the conversion if the given string only contains a single integer value (and eventually spaces including tabs, line feeds... at both ends) For all other strings (including the ones representing float values), it should return NaN It should assume that all numbers are not signed and written in base 10 | function myParseInt(str) {
var newString= str.replace(/ /g, '');
var isFloat=newString.indexOf('.') != -1
var isValidNumber=!isNaN(newString);
var hasLetters=(newString.match(/[a-z]/i));
var specialCharacters=!(/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g.test(newString));
if (isValidNumber && !isFloat && !hasL... | [
"function cleanNumber(numstr, defaultvalue) {\n\tvar resultStr = \"\";\n\tvar decCount = 0;\t\t// number of decimal points in the string\n\n //??? Jan 2014 ??? if (arguments.length < 2) defaultvalue = \"0\"\t//use this default value\n\tif (arguments.length < 2) defaultvalue = \"0\"\t//use this default value\n\t/... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
we validate we can handle multiple requests on the same connection | function multipleRequests() {
//bad content-length
var connection = net.createConnection(8888);
var numReq;
connection.on('data',function (data) {
console.log('---Client got--------\n'+data.toString()+'\n---------')
});
var httpReq = "GET /check/text.txt HTTP/1.1\nHost: localhost:8888\n... | [
"async *iterateHttpRequests(conn) {\n const bufr = new bufio_ts_2.BufReader(conn);\n const w = new bufio_ts_2.BufWriter(conn);\n let req;\n let err;\n while (!this.closing) {\n try {\n req = await readRequest(conn, bufr);\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
useCartDispatch function for actions in cart like adding and item, removeing an item or clearing all the cart | function useCartDispatch() {
const context = React.useContext(CartDispatchContext)
if (context === undefined) {
throw new Error('useCartDispatch must be used within a CartProvider')
}
return context
} | [
"function mapDispatchToProps(dispatch) {\n return {\n removeFromCart: (index) => {\n dispatch(removeFromCart(index))\n }\n }\n}",
"function handleAdd() {\n dispatch({\n type: ADD_TO_CART,\n payload: { id, price }\n })\n }",
"submit() {\n api.submitCart(this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
removePolicies removes policy rules from the model. | removePolicies(sec, ptype, rules) {
var _a;
const effects = [];
const ast = (_a = this.model.get(sec)) === null || _a === void 0 ? void 0 : _a.get(ptype);
if (!ast) {
return [false, []];
}
for (const rule of rules) {
if (!this.hasPolicy(sec, ptype,... | [
"clearPolicy() {\n this.model.forEach((value, key) => {\n if (key === 'p' || key === 'g') {\n value.forEach(ast => {\n ast.policy = [];\n });\n }\n });\n }",
"removePolicy(sec, key, rule) {\n var _a;\n if (this.h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the scroll position of the viewport. | _getViewportScrollPosition() {
const cachedPosition = this._parentPositions.positions.get(this._document);
return cachedPosition ? cachedPosition.scrollPosition :
this._viewportRuler.getViewportScrollPosition();
} | [
"function getScrollOffset() {\n return {\n x: main.scrollLeft,\n y: main.scrollTop };\n\n}",
"function icinga_get_scroll_position() {\n\n\tvar scroll_pos;\n\n\t//most browsers\n\tif (typeof window.pageYOffset != 'undefined') {\n\t\tscroll_pos = window.pageYOffset;\n\t}\n\t//IE6\n\telse if (typeof document.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves all municipalities within a given county from the database. | getMunicipalitiesByCounty(county, callback) {
super.query('SELECT municipality FROM municipality WHERE county = ?', [county], callback);
} | [
"getAllCounties(callback) {\n super.query('SELECT * FROM county', [], callback);\n }",
"function loadCountyData(state, callback) {\n // for now let's always load the county data all at once. later we can again split\n // into single-state files if that turns out to be useful for performance.\n if(!countyDa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SZPS[] Set Zone PointerS 0x16 | function SZPS(state) {
var n = state.stack.pop();
if (exports.DEBUG) { console.log(state.step, 'SZPS[]', n); }
state.zp0 = state.zp1 = state.zp2 = n;
switch (n) {
case 0:
if (!state.tZone) { initTZone(state); }
state.z0 = state.z1 = state.z2 = state.tZone;
... | [
"function updateZone(axios$$1, zoneToken, payload) {\n return restAuthPut(axios$$1, '/zones/' + zoneToken, payload);\n }",
"function sec1EncodePoint(P) {\n const pointBits = P.toBits();\n const xyBytes = sjcl.codec.bytes.fromBits(pointBits);\n return [0x04].concat(xyBytes);\n}",
"mainZonePowerOn() ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
invokes session failure requests | executeSessionFailureRequests() {
this.$http.executeSessionFailureRequests();
} | [
"function requestFailed(response) {\n //need to handle scenario if user session is expried and try to add chain.\n console.log(response);\n if (response.status == '400') {\n notificationService.displayError(response.data.Message);\n console.log(response... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the given term would be able to be shifted (optionally / after some reductions) on this stack. This can be useful for / external tokenizers that want to make sure they only provide a / given token when it applies. | canShift(term) {
for (let sim = new SimulatedStack(this); ; ) {
let action =
this.p.parser.stateSlot(
sim.state,
4 /* ParseState.DefaultReduce */
) || this.p.parser.hasAction(sim.state, term)
if (action == 0) return false
if ((act... | [
"forceReduce() {\n let { parser } = this.p\n let reduce = parser.stateSlot(\n this.state,\n 5 /* ParseState.ForcedReduce */\n )\n if ((reduce & 65536) /* Action.ReduceFlag */ == 0) return false\n if (!parser.validAction(this.state, reduce)) {\n let depth... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The user will eventually be able change the array size /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~HELPERS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ resetArray | function resetArray(){
const newArray = [];
//populate the new away array
for(let i = 0; i < arraySize; i++){
newArray.push(randomIntFromInterval(10,500));
}
setArray(newArray);
} | [
"reset() {\n this.#length = 0;\n }",
"function empty() {\n snakeArray.length = 0;\n}",
"function redefineTableArray () {\n\t//function to redefinetableArray\n\t\n\tvar r = originalNumberRecords; //start from rows 3\nvar c = originalNumberOfFields; //start from col 5..if edit don't forget to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Halts the request when the timeout is reached | function haltOnTimeout(req, res, next) {
if (!req.timedout) {
next();
}
} | [
"function throwTimeout() {\n \n if(!responseReceived) {\n \n throwError(\"The request timed out.\");\n }\n}",
"onTimeOut() {\n if (this.exhausted) {\n this.stop();\n return;\n }\n\n this.roll();\n }",
"sleep() {\n const self = this;\n //... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
show the browser window (if hidden) | function show() {
if (settings.shown) return;
win.show();
settings.shown = true;
} | [
"function hide() {\n if (!settings.shown) return;\n win.hide();\n settings.shown = false;\n }",
"showWindow() {\n this.window.show();\n this.window.webContents.send('open-dictionary');\n }",
"function showAboutWindow() {\n if (aboutWindowOpen) {\n return;\n }\n aboutWi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function for shorthand access to adding eventListener to element | function addListener(selector, eventType, func) {
return document.querySelector(selector).addEventListener(eventType, func);
} | [
"function addEventListener(element, event, listener) {\n\t\tif (element.addEventListener) {\n\t\t\telement.addEventListener(event, listener, false);\n\t\t}\n\t\telse if (element.attachEvent) {\n\t\t\telement.attachEvent(\"on\" + event, listener);\n\t\t}\n\t}",
"function addListener(element, events, listener) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::AppMesh::Route.GrpcRouteAction` resource | function cfnRouteGrpcRouteActionPropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnRoute_GrpcRouteActionPropertyValidator(properties).assertSuccess();
return {
WeightedTargets: cdk.listMapper(cfnRouteWeightedTargetPropertyToCloudFormation)(p... | [
"function cfnGatewayRouteGrpcGatewayRouteActionPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnGatewayRoute_GrpcGatewayRouteActionPropertyValidator(properties).assertSuccess();\n return {\n Rewrite: cfnGatewayRouteGrpcGatewayRouteRe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ResultType := > | ':' void | ':' TypeExpression BNF is above but, we remove > pattern, so token is always TypeToken::COLON | function parseResultType() {
consume(Token.COLON, 'ResultType should start with :');
if (token === Token.NAME && value === 'void') {
consume(Token.NAME);
return {
type: Syntax.VoidLiteral
};
}
return parseTypeExpression();
} | [
"function parseType() {\n var id;\n var params = [];\n var result = [];\n\n if (token.type === _tokenizer.tokens.identifier) {\n id = identifierFromToken(token);\n eatToken();\n }\n\n if (lookaheadAndCheck(_tokenizer.tokens.openParen, _tokenizer.keywords.func)) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initializes a new instance of `XMLCData` `text` CDATA text | constructor(parent, text) {
super(parent);
if (text == null) {
throw new Error("Missing CDATA text. " + this.debugInfo());
}
this.name = "#cdata-section";
this.type = NodeType.CData;
this.value = this.stringify.cdata(text);
} | [
"function cdata(x) {\n\tif (typeof x === \"undefined\") { return; }\n\treturn x && x.toString && x.toString().length ? '<![CDATA[' + x + ']]>' : x;\n}",
"function createTextElement(text) {\n return new VirtualElement(0 /* Text */, text, emptyObject, emptyArray);\n }",
"function loadCCT... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Rebuilds all the current filters. Necessary if something like the time zone has changed. | rebuildFilters() {
log.debug('Rebuilding filters');
const { model } = this.props;
const { advancedFilters, quickFilters } = this.state;
const { columns } = model;
const newAdvancedFilters = new Map();
const newQuickFilters = new Map();
advancedFilters.forEach((value, key) => {
const... | [
"clearAllFilters() {\n this.currentFilters = []\n\n each(this.filters, filter => {\n filter.value = ''\n })\n }",
"apply_filters() {\n return this.data\n .filter(d => this.selected_towns[d.town])\n .filter(d => this.selected_categ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this.name of parent class is used and speed that comes intp the function. | topSpeed(speed){
console.log ('Top speed for' +this.name+' is ' +speed);
} | [
"Super() {\n this._eat(\"super\");\n return {\n type: \"Super\",\n };\n }",
"visitCost_class_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}",
"static measure(name, executedFunction) { \n\t\tvar usedTicks = Game.cpu.getUsed();\n\t\texecutedFunction();\n\t\tusedTicks = Game.cpu.getUsed() -... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CODING CHALLENGE 262 Write a function that creates an object with each (key, value) pair being the (lower case, upper case) versions of a letter, respectively. | function mapping(letters) {
let y = letters.reduce((acc, elem) => {
acc[elem] = elem.toUpperCase();
return acc;
}, {})
return y;
} | [
"function BAKeyEquivalents() {\n\t/** associative array of key asign. { keymark : { aliasName, keyCode, DOMName }, ... }\n\t @type Object @const @private */\n\tthis.keyAlias = {\n\t\t'$' : { aliasName : 'Shift' , keyCode : 16, DOMName : 'shiftKey' }, \n\t\t'%' : { aliasName : 'Ctrl' , keyCode : 17, DOMNa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::LookoutMetrics::AnomalyDetector.MetricSource` resource | function cfnAnomalyDetectorMetricSourcePropertyToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnAnomalyDetector_MetricSourcePropertyValidator(properties).assertSuccess();
return {
AppFlowConfig: cfnAnomalyDetectorAppFlowConfigPropertyToCloudFormat... | [
"function cfnAnomalyDetectorRedshiftSourceConfigPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnAnomalyDetector_RedshiftSourceConfigPropertyValidator(properties).assertSuccess();\n return {\n ClusterIdentifier: cdk.stringToCloudForm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
check to see if the tab is special | function isSpecialTab(tab) {
var url = tab.url;
if (url.indexOf('chrome-extension:') === 0 ||
url.indexOf('chrome:') === 0 ||
url.indexOf('chrome-devtools:') === 0 ||
url.indexOf('file:') === 0 ||
url.indexOf('chrome.google.com/webstore') >= 0) {
return true;
}
return false;
} | [
"function checkTab(tab){\n if (mainPomodoro.currentMode == 'work' || mainPomodoro.currentMode == 'break_pending' || mainPomodoro.currentMode == 'longbreak_pending') {\n executeInTabIfBlocked('block', tab);\n }else{\n executeInTabIfBlocked('unblock', tab);\n }\n }",
"function checkIfTabAv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Test if the name is just the key or tag value (e.g. "park") | function nameMatchesRawTag(lowercaseName, tags) {
for (let i = 0; i < keysToTestForGenericValues.length; i++) {
let key = keysToTestForGenericValues[i];
let val = tags[key];
if (val) {
val = val.toLowerCase();
if (key === lowercaseName ||
val === lowercaseName ||
... | [
"isKeyField() {\n return 1 === this.length && \"__name__\" === this.get(0);\n }",
"function tagTester(name) {\n var tag = '[object ' + name + ']';\n return function(obj) {\n return _setup[\"t\" /* toString */].call(obj) === tag;\n };\n}",
"function isTyler(name) {\n if (name === \"Tyler\") {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change Hero Image with JS | function changeHeroImage() { // function to change the background image at the top of the page //
var heroDiv = document.getElementById("image-change"); // find the image by id //
var heroImage = document.getElementById("heroImage");
$('#image-change').addClass("hide");
setTimeout(() => { $('#image-chan... | [
"function changeImageChicken() {\n var img = document.getElementById('image');\n img.src = 'sdchicken.png';\n}",
"function changePhoto () {\n if (currentWord === \"beagle\") {\n document.getElementById(\"dog-photo\").src=\"assets/images/beagle.jpg\"\n }\n if (currentWord === \"bo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return array of nonnoise normalized words from string content. Nonnoise means it is not a word in the noiseWords which have been added to this object. Normalized means that words are lowercased, have been stemmed and all nonalphabetic characters matching regex [^az] have been removed. | words(content) {
//@TODO
let content_array = content.split(/\s+/);
const normalized_content = content_array.map((w)=>normalize(w));
const words = normalized_content.filter((w) => !this.noise_w_set.has(w));
return words;
} | [
"function getWords() {\n\t\tvar raw = Util.txt.getInputText();\n\t\tvar cleanText = Util.txt.clean(raw);\n\t\t\tcleanText = cleanText.toLowerCase();\n\t\t\tcleanText = cleanText.replace(/[\\t\\s\\n]/g,\" \");\n\t\t\tcleanText = cleanText.replace(/[ ]{2,}/g,\" \");\n\t\tvar words = cleanText.split(\" \");\n\t\t\twor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configure state data by linking it to senators and giving it the proper color | function configureStateData(){
var dataPtr = _stateData.objects.states.geometries;
for(var j = 0; j < dataPtr.length; j++){
dataPtr[j].properties.senators = new Array();
dataPtr[j].properties.scoreAvg = 0;
}
for(var i = 0; i < _senatorData.length; i++){
... | [
"function configureSenatorData(data) {\n var graphData = new Array(data.length);\n var voteMin, voteMax, speechMin, speechMax;\n var speechMagnitude;\n var isRandom = 0;\n var _fillC, _strokeC, _cssClass;\n for (var i = 0; i < data.length; i++) {\n //assign our c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Fonction de suppression des tags uniquement sur la table | function removeTagSingle(param) {
if ($table.bootstrapTable('getSelections') == true) {
$table.bootstrapTable('updateCell', {
index: $table.bootstrapTable('getSelections'),
field: 'tags',
value: $(".tag-table" + param).remove(),
})
} else {
return fals... | [
"removeNonEnTags(){\r\n\t\tif (this.data.hasOwnProperty(\"tags\")){\r\n\t\t\tvar tagsStr = \"\";\r\n\t\t\tvar tagsArray = this.data.tags.tags;\r\n\t\t\tfor (var i = 0; i < tagsArray.length; i++){\r\n\t\t\t\tif(tagsArray[i].hasOwnProperty(\"translation\")){\r\n\t\t\t\t\tif(tagsArray[i].translation.hasOwnProperty(\"e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to handle user response (click). Records which response option the user selected and asks the next question if there is a next question to be asked, otherwise shows results. | function handleResponse(event) {
let elementClicked = event.target; // returns the list element "<li>3</li>" that was clicked on
// Record user selection.
let questionObject;
// Find the questionObject that corresponds to the question the user responded to.
for (i = 0; i < questionObjects.leng... | [
"function handleAnswer() { \n $(SUBMIT_BUTTON_CLASS).click(function(event) {\n event.preventDefault();\n var userSelection = $('input[name=\"answerButton\"]:checked').val();\n evalAnswer(userSelection);\n layoutForFeedback();\n incrementQuestion();\n });\n}",
"function handleQuestion() {\n $('... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Warn if tests have been enabled to the exclusion of all others | function exclusionaryTests() {
let exclusionary = danger.git.created_files
.filter(filepath => filepath.endsWith('.test.js'))
.map(filepath => ({filepath, content: readFile(filepath)}))
.filter(
({content}) =>
content.includes('it.only') || content.includes('describe.only'),
)
if (!exclusionary.length... | [
"function silenceFailureLogging() {\n if (goog.global['G_testRunner']) {\n stubs.set(goog.global['G_testRunner'], 'logTestFailure', goog.nullFunction);\n }\n}",
"SetExcludeFromAnyPlatform() {}",
"function shouldInstrument () {\n if (process.env.CI) {\n return !!process.env.REPORT_COVERAGE;\n }\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |