query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Tests whether the items currently selected can be edited in the event dialog. Invitations are not considered editable here. | function canEditSelectedItems() {
let items = currentView().getSelectedItems();
return items.every(item => {
let calendar = item.calendar;
return (
cal.acl.isCalendarWritable(calendar) &&
cal.acl.userCanModifyItem(item) &&
calendar.supportsScheduling &&
!calendar.getSchedulingSupport... | [
"isEditingItem() {\n return this.editItem != null;\n }",
"_canItemBeSelected(item) {\n return item.disabled === false && item.templateApplied !== true;\n }",
"get todo_items_writable() {\n let selectedTasks = getSelectedTasks();\n for (let task of selectedTasks) {\n if (cal.acl.is... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
function to filter by manager and view employees | function viewAllEmployeesByManager() {
inquirer
.prompt({
name: "managerAction",
type: "list",
message: "Select the manager to filter by:",
choices: managers,
})
.then((response) => {
//add this to the query text defined above to filter by manager
employeeQuery +=
... | [
"viewAllEmployeesByManager(){\n return this.connection.query(\n `\n SELECT\n e1.id AS ID,\n e1.first_name AS First_Name,\n e1.last_name AS Last_Name,\n role.title AS Role,\n department.name AS Department,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes a child "jqxaccordionitem" node. | removeChild(node) {
const that = this;
if (!that.isCompleted) {
const args = Array.prototype.slice.call(arguments, 2);
return HTMLElement.prototype.removeChild.apply(that, args.concat(Array.prototype.slice.call(arguments)));
}
if (!(node instanceof HTMLElement)... | [
"removeChild(node) {\n const that = this;\n\n if (!that.isCompleted) {\n const args = Array.prototype.slice.call(arguments, 2);\n\n return HTMLElement.prototype.removeChild.apply(that, args.concat(Array.prototype.slice.call(arguments)));\n }\n\n if (!(node instanceo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Master Combination of all validation()'s | function Validation()
{
Validation1();
Validation2();
Validation3();
Validation4();
} | [
"runValidations() {\n var errors = _.reduce(this.inputs, (errors, input)=> {\n return _.concat(errors, input.runValidations())\n }, [])\n return errors\n }",
"function validateAll() {\n\t\t\t\tvar error = labelInput.validate();\n\t\t\t\tif (error && error !== null) {\n\t\t\t\t\treturn error;\n\t\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
end of file// start of file Object > Glyph A single collection of outlines that could either represent a character, or be used as part of another character through components. The following objects are stored as Glyph Objects: Glyphs (Characters) Ligatures Components GLYPH OBJECT | function Glyph(oa){
// debug('\n Glyph - START');
oa = oa || {};
this.objtype = 'glyph';
this.hex = oa.glyphhex || false;
this.name = oa.name || getGlyphName(oa.glyphhex) || false;
this.glyphhtml = oa.glyphhtml || hexToHTML(oa.glyphhex) || false;
this.isautowide = isval(oa.isautowide)? oa.isautowide : tr... | [
"function Glyph() {\n this.textureInfo = undefined;\n this.dimensions = undefined;\n this.billboard = undefined;\n }",
"get Glyphs() {\n const glyphs = new ImVector();\n this.native.IterateGlyphs((glyph) => {\n glyphs.push(new Im... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a new btn with passed prop obj. | function getBtnElement( prop ) {
let element = prop["target"];
let cssList = JSON.parse(prop["css"]);
let btnElement = document.createElement("button");
btnElement.insertAdjacentHTML("afterbegin", element);
for ( let css of cssList ) {
const cssInfo ... | [
"function button(obj) {\n return (typeof obj === 'string') ? {text: obj, class: ''} : obj;\n }",
"createNewElement() {\r\n let button = document.createElement('button');\r\n button.className = BUTTON_ACTIVE_CLASS;\r\n button.id = String(this.name).toLowerCase();\r\n let buttonText = document.createE... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sets the max score of the game | function setMaxScore( maxScoreValue ) {
maxScoreInput.value = maxScoreValue;
maxScoreDisplay.textContent = maxScoreValue.toString();
} | [
"function setRubricMinScoreAgainstMax(max) {\r\n var min = viewModel.assessment.rubricMinScore;\r\n if (min > max) {\r\n viewModel.set('assessment.rubricMinScore', max);\r\n }\r\n }",
"function getScoreMax() {\n return scoreMax;\n}",
"setHighScore(tempScore) {\n gameOp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Format trig value as multiple of pi if appropriate. | function formatTrigValue( iLargeTickIndex, iTickValue) {
var kLargestSmallFractionDenominator = 72,
piFraction = GSP.math.reduceFraction( Math.abs( iLargeTickIndex),
largeTicksPerPI),
tickValue, tickValueSign, tic... | [
"function myPi(num){\n var myNumber = Math.PI;\n\n console.log(myNumber.toFixed(num)); \n}",
"function moreDigitPI(){\n\tpi = Math.PI.toFixed(20);\n\t//if you need 5 more digits\n\t//20 is the max in javascript\n\t//less accurate - more digits\n}",
"function myPi(n) {\n return parseFloat((Math.PI).toFixe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Functions This function is created for moving the Starting pointer or the ending pointer. | function moveStartOrEnd(prevIndex,newIndex,startOrEnd) {
var newCellY = newIndex % totalCols;
var newCellX = Math.floor((newIndex - newCellY)/totalCols);
if (startOrEnd == "start") {
startCell = [newCellX,newCellY];
console.log("Moving start to ["+newCellX+","+newCellY+"]")
} else {
endCell = [newCellX, new... | [
"function moveCommand(origin, destination){\n document.getElementById('cycleSteps').insertBefore(document.getElementById('cycleStep'+origin), document.getElementById('rightCycleSpacer' + destination).nextSibling);\n document.getElementById('cycleSteps').insertBefore(document.getElementById('cycleSteps... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks to see if the Duration array contians candidate value user desires to replace. | function DoesDurationContain(target, voiceNumber) {
for (var x = 0; x < voiceArray[voiceNumber - 1].durationMappingArray.length; x++) {
if (voiceArray[voiceNumber - 1].durationMappingArray[x] == target) {
return true;
}
}
return false;
} | [
"function phaseArrayContainsValues(phaseArray, assignedPhaseValues) {\n for (var i=0; i < assignedPhaseValues.length; i++) {\n if (phaseArray.indexOf(assignedPhaseValues[i]) > -1) {\n return true;\n }\n }\n return false;\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Parses the quoted string from the given startIndex of the urlChars and return the length of the parsed quoted string. | parseQuotedString(startIndex, urlChars, tokenIndex, token) {
let i = startIndex + 1; // look for closing '"' from the next index
while (i < urlChars.length) {
const curChar = urlChars[i];
if (curChar == EXT_DOUBLE_QT) {
// Got the " which ends the quoted block, so break the loop
// R... | [
"static subStrCount(string, subString, start, length) {\n var c, i, j, len, ref, sublen;\n c = 0;\n string = '' + string;\n subString = '' + subString;\n if (start != null) {\n string = string.slice(start);\n }\n if (length != null) {\n string = string.slice(0, lengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Call the API and generate graph for Block data | function getBlockAPI(arr){
var parameter = arr[0];
console.log(parameter)
var id = arr[1];
var symbol = arr[2];
var datatype = arr[3];
var interval = arr[4];
fetch(parameter)
.then(
function(response) {
if (response.status !== 200... | [
"function getCompanyInfoBlocks(callback){\n var model = modelsService.getModel('statistics');\n var blocksRef = getSpecificEndpoint(model.root);\n blocksRef.once('value').then(function(snapshot) {\n var blocks = snapshot.val()\n if(blocks) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function compares the cards that were put in the tempCards array. firstClick and secondClick are assigned in the click function below. If the cards in the tempCards array match, the first card is sent to a matchedCards array and the winGame function will run If the cards do not match the show and open classes are ... | function compareCards() {
if (tempCards[0] === tempCards[1]) { // takes and compares the two cards from the openCards array.
$(firstClick).removeClass('show open').addClass('match'); // if matched the open and how are removed and match is added to both cards.
$(secondClick).removeClass('show open').addClass('... | [
"function compareCards() {\n\tif(openCards.length == 2) {\n\n\t\tstarSystem();\n\n\t\tif (openCards[0].dataset.card == openCards[1].dataset.card) {\n\t\t\topenCards[0].classList.add('match');\n\t\t\topenCards[1].classList.add('match');\n\t\t\topenCards = [];\n\t\t\tcardsMatched ++;\n\t\t\tif (cardsMatched == 8) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ask the user for some inputs (string)message: Explains why we ask for an input (function)callback : The callback to trigger when the user confirm or close the modal | function ModalAskInput(message, callback, placeholder, selectorModal){
var modal = new Modal(selectorModal||'globalModal');
var timeStamp = new Date().getTime();
var placeholderValue = (placeholder || "");
modal.content(message + "<br/>" + "<input type='text' class='form-control col-lg-12 col-md-12 col... | [
"function popUpModalPrompt(header, message, instruction, buttonText) {\r\n\tif (typeof header==\"string\") $('#message').children('h2').first().text(header);\r\n\tif (typeof message==\"string\") $('#message').children('p').first().text(message);\r\n\tif (typeof instruction==\"string\") $('#message').children('p').l... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function : Used for form submission on pagelength change. | function updatePageLength()
{
document.pagexform.FROM_INDEX.value = "1";
document.pagexform.TO_INDEX.value = parseInt(document.pagexform.FROM_INDEX.value) + parseInt(document.pagexform.viewLength.value)-1;
document.pagexform.PAGE_NUMBER.value = "1";
document.pagexform.submit();
} | [
"function page_num_input_form_size(page_number_text) {\n if(page_number_text.val()) {\n var page_number_text_size = page_number_text.val().length * 10 + 25;\n var page_number_width = page_number_text_size + \"px\";\n\n page_number_text.css({width: page_number_width, \"max-width\": \"125px\"}... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
RDMLX routines evtRoutine1 AppBar.IconClick | function evtRoutine1( sender, parms )
{
var fld = this.FLD.D1_MAIN, ref = this.REF, rtn = Lansa.evtRoutine( this, COM_OWNER, "#AppBar.IconClick", 45 );
//
// EVTROUTINE Handling(#AppBar.IconClick)
//
rtn.Line( 45 );
{
//
// #AppDrawer.ToggleDrawer
//
... | [
"function evtRoutine1( sender, parms )\n {\n var ref = this.REF, rtn = Lansa.evtRoutine( this, COM_OWNER, \"#AppBar.IconClick\", 74 );\n\n //\n // EVTROUTINE Handling(#AppBar.IconClick)\n //\n rtn.Line( 74 );\n {\n\n //\n // #AppDrawer.ToggleDrawer\n //\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This interface is for collectors of search results. | function PathSearchResultCollector() {
} | [
"function SearchResults(data){this.resultsCount=data.PrimaryQueryResult.RelevantResults.TotalRows;this.items=convertRowsToObjects(data.PrimaryQueryResult.RelevantResults.Table.Rows.results,this.resultsCount)}",
"async function onSearchCollector() {\n try {\n const collectorsInfo = await collecto... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set style of an icon | function setStyle(el){
//reset the inline style from other icons on the page
el.setAttribute('style','');
//remove px unit for calculations
var sizeNum = parseInt( settings.size.replace("px","") );
// the auto radius is 15% of the size of the icon
if(settings.radius=='auto')
settings.radius = sizeNum*.... | [
"function initIconStyle() {\n setLabel(\"iconStyle\");\n $(\"#iconStyle\").find(\"input[value='\" + bp.settings.iconStyle + \"']\").prop(\"checked\", true);\n $(\"#iconStyle\").find(\"input\").click(stringUpdater(\"iconStyle\", bp.settings));\n }",
"get style () {\n return new IconData(0xe41d,{fontFa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method to set culture for chart | setCulture() {
this.localeObj = new L10n(this.getModuleName(), this.defaultLocale, this.locale);
} | [
"setCulture() {\n this.intl = new Internationalization();\n }",
"set locale(value) {\n this._locale = value;\n this.initYearFormatter();\n }",
"static set locale(value) { _locale = value; }",
"set locale(value) {\n this._locale = value;\n this.initMonthFormatter();\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
= Description Sets the number of bits per input character. = Parameters +_bits+:: Amount of bits per input character. 8 for ascii, 16 for unicode. | setChrsz(_bits) {
this._chrsz = _bits;
} | [
"appendBits(bits) {\n\t\tif (typeof bits === 'boolean' && this.bitsSet < this.length) {\n\t\t\tthis._setBitAt(bits ? 1 : 0, this.bitsSet);\n\t\t\t// console.log(this.arr[0].toString(2));\n\t\t\t// arr[floor(this.bitsSet / 8)] =\n\t\t\t// \tarr[floor(this.bitsSet / 8)] || (bits ? 1 : 0) << (7 - (this.bitsSet % 8));\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function updates the plane position based on the Curtains class scroll manager values params: | updateScrollPosition(lastXDelta, lastYDelta) {
// actually update the plane position only if last X delta or last Y delta is not equal to 0
if(lastXDelta || lastYDelta) {
// set new positions based on our delta without triggering reflow
this._boundingRect.document.top += lastYDel... | [
"updatePosition() {\n // set the new plane sizes and positions relative to document by triggering getBoundingClientRect()\n this._setDocumentSizes();\n\n // apply them\n this._applyWorldPositions();\n }",
"function configure_plane_offset(){\n\tplane_offset = \tworkspace_indexer.work... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Display esignature explanation dialog popup | function esignExplainLink() {
$.get(app_path_webroot+'Locking/esignature_explanation_popup.php', { }, function(data) {
if (!$('#esignExplain').length) $('body').append('<div id="esignExplain"></div>');
$('#esignExplain').dialog('destroy');
$('#esignExplain').html(data);
$('#esignExplain').dialog({ bgifram... | [
"function showSignature() {\r\n print(\"Showing signature\");\r\n window.sigCtl.GetSignature(onGetSignature);\r\n function onGetSignature(sigCtlV, sigObjV, status) {\r\n if (window.sdkPtr.ResponseStatus.OK == status) {\r\n var outputFlags = window.sdkPtr.RBFlags.Render... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SET NAVIGATION LOGO This will adjust the navigation logo to center top/bottom of nav | function setNavigationLogo(nav){
nav.find('>ul li').first().css({'white-space':'nowrap'});
var mxHeight = nav.find('>ul li').first().outerHeight();
var imgMargin = (mxHeight - nav.find('li.logo img').outerHeight())/2.5;
nav.find('>ul li').first().css({'white-space':''});
var mainLogo = nav.find('l... | [
"function centerNavLogo() {\n var navHeight = $(\".navbar\").height();\n $(\".navbar-brand\").css(\"line-height\", navHeight + \"px\");\n $(\".navbar-brand\").css(\"padding-top\", \"0px\");\n $(\".navbar-brand *\").css(\"line-height\", navHeight + \"px\");\n}",
"function CenterLogoHeight(){\n i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Listens for the element selected event and adds the cutom menues of the element to the logickmenu | function on_event_select_add_entry_to_logick_menu(e)
{
/*removes old Logick*/
delete_custom_logick_of_element();
/*sets the new custom elements*/
logick_elements.custom_logick_elements = e.param1.custom_logick_menu;
/*applays the custom logick to the logick menu*/
apply_custom_logick_onsel... | [
"function markingMenuOnSelect(selectedItem){\r\n\r\n\ttracker.recordSelectedItem(selectedItem.name);\r\n\tdocument.getElementById(\"selectedItem\").innerHTML = selectedItem.name;\r\n}",
"onObjectSelected() {\n var index = this.page.panels.indexOf(this);\n $('.controls__menu--panels .controls__menu-i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
========================================== Server ========================================== Constructor( socketio, slots ) Creates a new server listening for clients using the specified socket interface. Slots is an optional maximum amount of clients. | function Server( config ){
var io = this.io = config.socketServer;
var s = this;
io.set( "log level", 1 );
io.sockets.on( "connection", function( socket ) { s.onConnection( socket ); } );
this.eventHandlers = {};
this.activeNicknames = {};
this.activeAddresses = {};
this.maxSlots = config.slots... | [
"function Server( socketio, slots )\n{\n\tvar fs = require('fs');\n\tvar path = require('path');\n\n\n\tvar mimeTypes = {\n html: \"text/html\",\n jpeg: \"image/jpeg\",\n jpg: \"image/jpeg\",\n png: \"image/png\",\n js: \"text/javascript\",\n css: \"text/css\",\n ttf: \"application/x-font-ttf\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generateBreadcrumb Generate the breadcrumb for this page: Home > $TeamName Home links back to pick a team. | function generateBreadcrumb () {
let cloneBreadcrumb = module.exports.internal.breadcrumb.cloneNode(false)
module.exports.internal.breadcrumb.parentNode.replaceChild(cloneBreadcrumb, module.exports.internal.breadcrumb)
module.exports.internal.breadcrumb = cloneBreadcrumb
let spanHome = document.createElement('... | [
"function generateBreadcrumb () {\n let cloneBreadcrumb = module.exports.internal.breadcrumb.cloneNode(false)\n module.exports.internal.breadcrumb.parentNode.replaceChild(cloneBreadcrumb, module.exports.internal.breadcrumb)\n module.exports.internal.breadcrumb = cloneBreadcrumb\n\n let spanHome = document.creat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
writing our own reduce function | function myReduceFunc() {
} | [
"function myreduce(arr,cb,acc){\n for(var i=0;i<arr.length;i++){\n acc=cb(acc,arr[i])\n }\n return acc\n}",
"function reduce (array, func, initialValue) {\n}",
"function usandoReduce() {\n // o arguments substitui o this e o reduce vai somar todos os itens do array\n var result = A... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Virtual methods. Returns the Apollo network interface. | get networkInterface() {
return null;
} | [
"function getNetworkInterface(uri) {\n const networkInterface = (0, _reactApollo.createNetworkInterface)({\n uri,\n opts: _config2.default.apolloNetworkOptions\n });\n\n // Attach middleware\n networkInterface.use(_config2.default.apolloMiddleware.map(f => ({ applyMiddleware: f })));\n networkInterface.u... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get query for creating a foreign key | getCreateForeignKeyQuery(model_name, column, type, references) {
return null;
} | [
"function foreign_key(name) {\n return underscore(name) + '_id';\n}",
"function createFK(remote, tableName, mapping) {\n return kv.runT(remote, function(tx) {\n return internalAddFK(tx, tableName, mapping);\n });\n}",
"foreignKey(key) {\n\t\treturn this.setKey('foreign', key)\n\t}",
"async cre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
place armies based on personality, balance pressures | function placeArmies() {
// console.log("placeArmies");
// the army counterpressure threshold
var threshold = 4;
// extract personality
var placem = this.personality['placement'];
// the pressures and priority list copied for use
var press = this.player.pressures;
... | [
"function afficherPersonnages() {\r\n var leperso;\r\n // Boucle d'affichage : séparation pour éviter qu'un personnage en efface un autre quand ils se croisent\r\n for (var personnage in personnages[zone_map]) {\r\n leperso = personnages[zone_map][personnage];\r\n if (leperso[\"is_alive\"]) {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine if stream is Zlib stream. | function isZlibStream (stream) {
return stream instanceof Zlib.Gzip ||
stream instanceof Zlib.Gunzip ||
stream instanceof Zlib.Deflate ||
stream instanceof Zlib.DeflateRaw ||
stream instanceof Zlib.Inflate ||
stream instanceof Zlib.InflateRaw ||
stream instanceof Zlib.Unzip
} | [
"function isStream(obj) {\n return obj instanceof stream.Stream;\n}",
"function isStream(stream) {\n\t\treturn stream !== null && typeof stream === 'object' && typeof stream.pipe === 'function';\n}",
"function isStream(d) {\n return d.output_type === 'stream';\n }",
"_is_readable_stream(obj) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
event handler that checks if checkbox is checked or not for hide completed tasks for the ReactiveDict | 'change .hide-completed input'(event, instance) {
instance.state.set('hideCompleted', event.target.checked);
} | [
"function checkBoxChecked(e) {\n filters.hideCompleted = e.target.checked;\n}",
"\"click #hide-completed-button\"(event, instance) {\n\n // TODO - If a task is \"Completed\" and the filter turns from \"Show Incomplete\" to \"Show All\", \n // the task checkbox doesn't reflect the completed status, cr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
There was an error executing the script. Display the popup's error message, and hide the normal UI. | function reportExecuteScriptError(error) {
document.querySelector("#popup-content").classList.add("hidden");
document.querySelector("#error-content").classList.remove("hidden");
console.error(`Failed to execute CourseSel content script: ${error.message}`);
return "ok";
} | [
"function reportExecuteScriptError(error) {\n document.querySelector('#popup-content').classList.add('hidden');\n document.querySelector('#error-content').classList.remove('hidden');\n console.error(`Error: ${error.message}`);\n}",
"function reportExecuteScriptError(error) {\n document.querySelector(\"#popup-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Loop through the protocols and connect to the first one possible | function connect() {
var deferred = _core.Deferred();
console.log("Attempting to connect...");
var c = null,
ix = -1,
handshakeComplete = false,
_
function tryNext() {
ix+=1;
if (ix < _preferredClients.length) {
c = new _preferredClients[ix].class(_preferredCli... | [
"function nextProtocol(){\n\tvar foundNextProtocol = false;\n\t// Search for next protocol that has not been completed\n\tfor(var i = 0; foundNextProtocol == false && i < protocolList.length; i++){\n\t\tif(protocolList[i].completeStatus == false){\n\t\t\tfoundNextProtocol = true;\n\t\t\tcurrentExperNum = i + 1;\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
makes a legend with dynamic sizes | function legend_size(svg, x_pos, y_pos, size) {
// creates element for legend
svg.append('g')
.attr('class', 'legendSize')
.attr('transform', 'translate(' + x_pos + ', ' + y_pos + ')');
// legend information
let legendSize = d3.legendSize()
.scale(size)
.shape('circle')
.shapePadding(14)
... | [
"function renderLegend() {\n\n legendSvg.attr('height', heightLegend+(heightLegend/12))\n .attr('width', widthLegend)\n // legendSvg.attr('width', (heightChart/12))\n }",
"function addcolorlegend(cy){\n cy.$('node[id = \"l1\"]')\n .style('color', 'black')\n .style('backgrou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In this simple exercise, you will build a program that takes a value, integer, and returns a list of its multiples up to another value, limit. If limit is a multiple of integer, it should be included as well. There will only ever be positive integers passed into the function, not consisting of 0. The limit will always ... | function findMultiples(int,limit){
let result = []
for (let i = int; i<=limit ; i+=int)
result.push(i)
return result
} | [
"function limit(base) {\n if (base >= 10)\n return Math.pow(base,2) - 1;\n else if (base >= 3)\n return Math.pow(base,4) - 1;\n else\n return Math.pow(base,8) - 1; \n}",
"function powers(base, limit, callback) {\n let currentValue = 1\n while (currentValue <= limit) {\n callback(currentValue)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function's purpose is to create the checkboxes for the years | async function createYearsCheckboxes() {
removedYearsIds = [];
let years;
await getAllPossibleValuesOfFilterHTTPRequest('years').then(yearsArray => {
years = yearsArray;
const container = document.getElementById('yearsCheckboxContainer');
container.innerHTML = '';//clear content
... | [
"function createYearLabel() {\n\n var\n yearFocused = MONTH_FOCUSED.YEAR,\n yearsInSelector = SETTINGS.yearSelector\n\n\n // If there is a need for a years selector\n // then create a dropdown within the valid range\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
formulaire connexion au formlaire inscription | function connexionInscriptionFormControl(){
preInscripionGood();
mdpControl();
nickNameControl();
emailControl();
} | [
"function formulaireConnexion() {\n let modeleConnexion = new ModeleMagasin(\"modele-connexion\");\n modeleConnexion.appliquerModele('', \"milieu-page\");\n}",
"function formulaireConnexion() {\n enTetePiedPage(\"hidden\");\n let modeleConnexion = new ModeleMagasin(\"modele-connexion\");\n modeleCo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Displays the number of notes above and below the viewing window, colorizing based on the ratio of outofbounds notes to total notes in the selected track. | function updateOutOfBoundsNoteCounts() {
let nasText = document.getElementById('noteAboveScreenText');
let nbsText = document.getElementById('noteBelowScreenText');
let denom = tracks[selectedTrack].notes.length;
let nasPercent = Math.round((tracks[selectedTrack].numNotesOffscreen.above * 100) / denom);
if (Number... | [
"function drawNotes(){\n if (state === 'piano'){\n \n fill(255);\n // MAKE A FOR LOOP SOON\n rect(width - 400, height/2, 150, 400);\n rect(width - 550, height/2, 150, 400);\n rect(width - 700, height/2, 150, 400);\n rect(width - 850, height/2, 150, 400);\n rect(width - 1000, height/2, 150, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
unused harmony export SlidingBuffer | function sliding(n) {
return new SlidingBuffer(ring(n), n);
} | [
"function rangeBuffer () {\n\n}",
"get BufferStream() { return require(\"./buffer-stream\"); }",
"function Buffer(){}",
"function sliderInitAnimationBuffer(buffer, anim, z)\n{\n\tvar i, j, libase, li;\n\t\n\t//copiing initial values from Animation object to BufferState object\n\tbuffer.state.values.parts_x = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show a list of all properties. GET properties | async index () {
const properties = Property.all()
return properties
} | [
"function all(options, callback) {\n core.api('GET', '/properties', options, callback);\n }",
"function getProperties() {\n\n PropertyFactory.getProperties()\n .then(function(response) {\n\n vm.properties = response.data;\n toastr.success... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
2. add a ticker to index of stock tickers | function addToStockIndex(ticker){
stockIndex=[];
var stockIndexObj = {ticker:ticker};
if(localStorage.stockIndex){
stockIndex = JSON.parse(localStorage.getItem("stockIndex"));
stockIndex.push(stockIndexObj);
localStorage.stockIndex = JSON.stringify(stockIndex);
console.log("... | [
"addTicker(ticker) {\r\n if (this.isFull()) {\r\n return;\r\n }\r\n this.tickers.push(ticker);\r\n }",
"onTicker(ticker) {\n const tick = ticker.toJS();\n this.state.ticker = this.state.ticker.filter(item => item.symbol !== tick.symbol);\n this.state.ticker.push(tick);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates the visible left position of an element If _noOwnScroll is true, method not include scrollLeft of element itself. | _getVisibleLeftPosition(_id, _noOwnScroll) {
return this._getVisibleLeftOrTop(_id, _noOwnScroll, 'offsetLeft', 'scrollLeft');
} | [
"function xScrollLeft(e, bWin)\n{\n var offset=0;\n if (!xDef(e) || bWin || e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {\n var w = window;\n if (bWin && e) w = e;\n if(w.document.documentElement && w.document.documentElement.scrollLeft) offset=w.document.docu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
In the below scenario, we are trying to increase the counter value by 5 on clicking of the "counter" button. So if you run it in the browser using "Wrong method" below, you will see in the console that, both the Callback value and the Direct value (i.e. basically the previous value) of the state has been logged 5 times... | increaseCounter() {
//Wrong method
this.setState({
count: this.state.count + 1
}, () => {
console.log("Callback value = " + this.state.count);
})
console.log("Direct value = " + this.state.count);
//Correct method
// this... | [
"IncrementCountByFive() {\n this.setState(\n (prevStat, props) => ({\n count: prevStat.count + this.props.value,\n }),\n () => console.log(\"Increment update value by 5\", this.state.count)\n );\n console.log(this.state.count);\n }",
"incrementalHandler() {\n \n // this.setState... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: scrollCheckBoxIntoView Description: scroll till expected row index is visible | function scrollCheckBoxIntoView(id,rowIndex,idx)
{
if (typeof GCMH != "undefined" && GCMH != null)
{
var grid = GCMH.findGrid(id)
if(grid)
{
grid.gridBack.scrollLeft=0
var obj=grid.getR... | [
"scrollIntoView() {\n if (DomUtils.getSelectionType(this.selection) !== \"None\") {\n const elementWithFocus = DomUtils.getElementWithFocus(\n this.selection,\n this.getDirection() === backward,\n );\n if (elementWithFocus) return Scroller.scrollIntoView(elementWithFocus);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a list of IDs of selected Alt BOM in a group. | function _findSelectedAltBomItems(altHeaderId) {
var g = $scope.selectedItems.altbom[altHeaderId.toString()];
if (!g) {
return [];
}
return _.chain(g.parts)
.reduce(function(memo, v, k) {
if (v === true) {
memo... | [
"function getChildrenIds(group) {\n const children = [];\n Object.values(group.children).forEach((value) => {\n if (value.children === undefined) {\n // node\n children.push(value.id);\n } else {\n // group\n const subGroupChildren = getChildrenIds(value);\n subGroupChildren.forEach... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
let S = 'ABC'; permute([...S]) | function permute22(S) { // Refactored and better solution, Easy to understand and easy to Digest
let A = [...S], output = [];
(function permute(l = 0) {
if (l === A.length - 1) output.push(A.toString());
else {
for (let k = l; k <= A.length - 1; k++) {
[A[l], A[k]] =... | [
"function permute(str) {\n var res = str;\n var len = res.length;\n var temp = \"\";\n for (var i = 0; i < (len - 1); i++){\n temp = res.substring(0,i) + swap(res.substring(i,len));\n res = temp;\n }\n return res;\n}",
"function returnPermuted(str, result = [], length = str.length,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define a function that returns a currying calculator. The currying calculator will keep returning a function until 5 parameters are passed in total. Then it returns the sum of all 5 params. | function createCurryCalc() {
var calcArgArray = [];
return function curryCalc(...args){
for (var i=0; i<args.length; i++){
calcArgArray.push(args[i]);
if (calcArgArray.length === 5) {
return calcArgArray.reduce(function(sum, val) { return sum + val });
}
}
return curryCalc;
... | [
"function curry(func){//ai function ta carry function er kase pathabo\n return function curried(...args){//variable number of args receive korbe ...args // ...args er modda (1, 2, 3) ai 3 ta agrs chole ashle ami ekta args array pabo\n if( args.length >= func.length){//arg .length = (curriedSum(1, 2, 3), func.length... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts methods at the specified index. | insertMethods(index, structures) {
return this._insertProperty(index, structures, () => this._context.structurePrinterFactory.forMethodDeclaration({ isAmbient: false }));
} | [
"insertMethod(index, structure) {\r\n return this.insertMethods(index, [structure])[0];\r\n }",
"insertAt(index, data) {}",
"function insertAt(index,value){\n\n}",
"insertOverload(index, structure) {\r\n return this.insertOverloads(index, [structure])[0];\r\n }",
"insertAtIndex(key,index... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates and stores the HSL components of this RGBColour so that they can be returned be the getHSL function. | function calculateHSL(){
// get the maximum and range of the RGB component values
var maximum = Math.max(rgb.r, rgb.g, rgb.b);
var range = maximum - Math.min(rgb.r, rgb.g, rgb.b);
// determine the lightness in the range [0,1]
var l = maximum / 255 - range / 510;
// store the HSL components
... | [
"calcHSL() {\r\n let r = this.r/255;\r\n let g = this.g/255;\r\n let b = this.b/255;\r\n let max = Math.max(r, g, b)\r\n let min = Math.min(r, g, b);\r\n let h, s, l = (max + min) / 2;\r\n if(max == min){\r\n h = s = 0; // achromatic\r\n } else {\r\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
inward edges ( vertex <= x ) in the given graph | indegree(graph){
if ( !(graph instanceof Graph) )
throw new TypeError(ENOTGRAPH)
return graph.indegree(this)
//return graph.edges.filter(edge => edge.in && edge.in.includes(this))
} | [
"inEdges(v,u){var inV=this.#in[v];if(inV){var edges=Object.values(inV);if(!u){return edges}return edges.filter(edge=>edge.v===u)}}",
"nodeEdges(v,w){var inEdges=this.inEdges(v,w);if(inEdges){return inEdges.concat(this.outEdges(v,w))}}",
"inEdges(v, u) {\n var inV = this.#in[v];\n if (inV) {\n var edg... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
elements on the page and add the "prettyprint" style. If at least one prettyprint element was found, call the Google Prettify prettyPrint() API. | function styleCode()
{
if (typeof disableStyleCode != "undefined")
{
return;
}
var a = false;
$("pre code").parent().each(function()
{
if (!$(this).hasClass("prettyprint"))
{
$(this).addClass("prettyprint");
a = true
}
});
... | [
"function styleCode() {\r\n\t\tvar shouldPrettify = false;\r\n\t\t$(\"pre code\").parent().each(function() {\r\n\t\t\tif (!$(this).hasClass(\"prettyprint\")) {\r\n\t\t\t\t$(this).addClass(\"prettyprint\");\r\n\t\t\t\tshouldPrettify = true;\r\n\t\t\t}\r\n\t\t});\r\n\t\tif (shouldPrettify) { prettyPrint(); } \r\n\t}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render the view. Returns: RB.DiffCommitListView: This view, for chaining. | render() {
const commits = this.model.get('commits');
const isInterdiff = this.model.isInterdiff();
const commonContext = {
showExpandCollapse: commits.some(commit => commit.hasSummary()),
showHistorySymbol: isInterdiff,
showInterCommitDiffControls:
... | [
"render() {\n Fields.BaseFieldView.prototype.render.call(this);\n\n /*\n * We needn't render the view because it has already been rendered by\n * the server.\n */\n this._commitListView = new RB.DiffCommitListView({\n el: this.$('.commit-list'),\n m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adaptive histogram equalization, blended with original image amount is between 0 and 1 | function ahe(__src, amount)
{
// find a good window size
var row = __src.h,
col = __src.w;
// tile size
var tilesize = [64, 64];
// number of bins
var num_bins = 256;
// number of tiles in x and y direction
var xtiles = Math.ceil(col / tilesize[0]);
var ytiles = Math.ceil(... | [
"function equalize(__src, amount)\n{\n var h = __src.h,\n w = __src.w;\n\n // grayscale image\n var gimg = grayscale(__src);\n\n // build histogram\n var hist = histogram(gimg, 0, 0, w, h);\n\n var cumuhist = buildcdf( hist );\n\n var total = cumuhist[255];\n for(var i=0;i<256;i++)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO: Does update entity need body and entityID? | updateEntity() {
var req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (this.readyState === READY_STATE_REQUEST_FINISHED) {
if (this.status === 200) {
// TODO: Find out what to do when update entity works
} else if... | [
"function updateEntity(entityId, body, headers = {}) {\n /* return request({\n url: BASE_PATH + '/entities/' + entityId + '/attrs',\n method: 'PATCH',\n body,\n headers,\n json: true,\n });*/\n}",
"update (entityName, body) {\n if (body.id) {\n this.at(body.id)\n }\n this._prepareRe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
On Add & Update User Modal Close | onAddUpdateUserModalClose() {
this.setState({ addNewUserModal: false, editUser: null })
} | [
"onAddUpdateUserModalClose() {\n this.setState({ addNewUserModal: false });\n }",
"onAddUpdateUserModalClose() {\n this.setState({ addNewUserModal: false, editUser: null })\n }",
"closeHandler() {\n UserActions.setIsUpdating(false);\n }",
"function closeUserEditor() {\n $('#userM... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add css animations for delay and duration | function slickAddAnimation(obj, animation, value) {
var delayInAttr = [
'animation-' + animation,
'-webkit-animation-' + animation,
'-moz-animation-' + animation,
'-o-animation-' + animation,
'-ms-animation-' + animation
... | [
"function addAnimationDelay(node, delay) {\n\tnode.style.animationDelay = delay + 's';\n\tnode.style.webkitAnimationDelay = delay + 's';\n}",
"function setAnimTiming() {\n var time = options.animTime,\n transitionDuration = 'webkitTransitionDuration';\n\n if (!time) {\n options... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render login Image function | renderLoginImage () {
return(
<div className="mt-5 pt-5">
<div className="col-md-12 mt-5 pt-5">
<img className="mt-5 pt-5" alt="Login" src={LoginImg} width="100%" />
</div>
</div>
)
} | [
"function check_username_password() {\n change_img_src_based_on_boolean(helper_username_password_length(), \"img username, password length\", \"/images/good.svg\", \"/images/bad.svg\");\n}",
"showLogin({ view, session }) {\n return view.render('auth.login')\n }",
"renderImage(){\n switch(this.st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the board's dimensions based on the number of squares | function setDimensionsFromNumSquares() {
boardWidth = numSquaresX * xIncrement;
headerWidth = boardWidth;
boardHeight = numSquaresY * yIncrement;
} | [
"function setNumSquaresFromDimensions() {\n while (numSquaresX * xIncrement + xIncrement < boardWidth) {\n numSquaresX++;\n }\n\n while (numSquaresY * yIncrement + yIncrement < boardHeight) {\n numSquaresY++;\n }\n}",
"function setSizes(){\n var boardWidth = magicWidth;\n var gridWidth = boardWidt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sticky footer and padding for sticky header | function stickyFooter(){
var topOffset = 0;
if($('#main-header').css('position') != 'absolute' && $('#main-header').css('position') != 'fixed' ){
topOffset = $('#main-header').outerHeight(true);
}else{
}
var bottomOffset = $('#main-footer').outerHeight(true);
... | [
"function stickyHeader() {\n\t\tvar height = $mastheader.height();\n\t\t$content.css( {\"margin-top\": height + \"px\" } );\n\t\t$snap.css( {\"top\": height + \"px\" } );\n\t}",
"function bodyPadding() {\n let headerHeight = $('header').height();\n let footerHeight = $('footer').height();\n $('body').css... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that returns an absolute episode number | function mapEpisodeNumber(epno) {
var firstChar = String(epno);
var result = 0;
switch (firstChar[0]) {
case 'S': result = '1' + epno.substring(1,epno.length); break;
case 'C': result = '2' + epno.substring(1,epno.length); break;
case 'T': result = '3' + epno.substring(1,epno.length); break;
case 'P':... | [
"function getEpisodeIndex(episodeNum, numReversed, episodes) {\n if (numReversed) {\n return episodeNum - 1; // NaN (falsy) if episodeReversed wasn't set\n } else if (episodeNum) {\n return episodes.length - episodeNum;\n } else {\n return null;\n }\n }",
"function incrementEpisode(las... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ADD Data Points to HFEvent (flatJSON format) | async addPointsToHFEvent(eventId, fields, points) {
const res = await this.post('events/' + eventId + '/series',
{
format: 'flatJSON',
fields: fields,
points: points
});
if (!res.status === 'ok') {
throw new Error('Failed loading serie: ' + JSON.stringify(res.status));
... | [
"function appendDatapoint(obj){\n var configFile = fs.readFileSync('./data.json');\n var config = JSON.parse(configFile);\n config.push(obj);\n var configJSON = stringify(config);\n fs.writeFileSync('./data.json', configJSON);\n}",
"function recordData(newData) {\n \"use strict\";\n fullDataSet.push(ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Provides the label for the generic cancel button (Skip / Enroll Manually) During automatic enrollment, the label is 'Enroll Manually'. During manual enrollment, the label is 'Skip'. | getCancelButtonLabel_(locale_, is_automatic) {
if (this.isAutoEnroll_) {
return 'oauthEnrollManualEnrollment';
} else {
return 'oauthEnrollSkip';
}
} | [
"get cancelButtonLabel() {\n if (this._cancelButtonLabel === null) {\n return this.resourceStrings.igx_time_picker_cancel;\n }\n return this._cancelButtonLabel;\n }",
"get cancelLabel() {\n\t\treturn this.nativeElement ? this.nativeElement.cancelLabel : undefined;\n\t}",
"func... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replacement to IRD Function Name: "UTCFromString" Return value type: INTEGER. This function takes string presenting UTC in format YYYYMMDDTHH:MM:SSZ and returns it as number of seconds. | function irdUTCFromString(UTCString)
{
var endResult = 0;
var sArray = null;
var str;
if(UTCString != null && typeof UTCString != 'undefined' ){
str = UTCString.replace(/-|:|t|z/gi,",");
sArray = str.split(",");
endResult = Date.UTC(sArray[0],sArray[1]-1,sArray[2],sArray[3],sArray[4],sArray[5])/1000;
}... | [
"function from_utc_time_string(str) {\n\tvar timeComponents = str.split(\":\");\n\tvar d = new Date();\n\ttimeComponents[1] -= d.getTimezoneOffset();\n\treturn Date.UTC(1970,0,1,parseInt(timeComponents[0]),parseInt(timeComponents[1]));\n}",
"function fnISO8601toMilliSeconds(str) {\n let regex = /^PT(?:(\\d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Flip num_terms_to_flip terms of quantum reg x, conditional on condition | function flip_n_terms(x, num_terms_to_flip, condition)
{
// This is a simple brute-force way to do it, but as this function
// is only used to build the look-up tables, that's ok.
var terms_flipped = 0;
for (var i = 0; i < num_terms_to_flip; ++i)
{
x.not(i);
x.cphase(180, ~0, conditi... | [
"function toggleInvert(x, i) {\n\treturn i * 1 - x * (i * 2 - 1);\n}",
"function flip(x) {\n return x === 1 ? 0 : 1;\n}",
"flip() {\n\n // Flip the sign on the normal and scalar\n this.normal = multiply(this.normal, -1);\n this.scalar = multiply(this.scalar, -1);\n }",
"function flipSign(x) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the most recent styling context value. Note that only one styling context is stored at a given time. | function getCachedStylingContext() {
return stylingContext;
} | [
"function getStylingContext(index) {\n var stylingContext = load(index);\n if (!Array.isArray(stylingContext)) {\n var lElement = stylingContext;\n var tNode = lElement.tNode;\n ngDevMode &&\n assertDefined(tNode.stylingTemplate, 'getStylingContext() called before elementStylin... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Busca o valor selecionado de um select. | function ValorSelecionado(dom_select) {
return dom_select.length > 0 ?
dom_select.options[dom_select.selectedIndex].value : null;
} | [
"function getSelectedValue(select) {\n return select.find('option:selected').attr('value');\n}",
"function getValue(select) {\n // Assigns the arguments children to a variable\n var opt = select.children;\n\n // Loops through each item in the opt variable and returns\n // the value ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initialize Look Up Table(Lut) for Color | initLut() {
this.maxColorNum = this._metadata.maxColorNum;
let lut = new THREE.Lut(this._metadata.colormap, this.maxColorNum);
lut.setMin( 0 );
lut.setMax( 1 );
return lut;
} | [
"initLut() {\n this.maxColorNum = this._metadata.maxColorNum;\n let lut = new Lut(this._metadata.colormap, this.maxColorNum);\n lut.setMin(0);\n lut.setMax(1);\n return lut;\n }",
"initLut() {\n this.maxColorNum = this._metadata.maxColorNum;\n let lut = new THREE.Lut(th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
IS IOS VERSION OLDER THAN 5 ?? | function iOSVersion() {
var oldios = false;
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
if (navigator.userAgent.match(/OS 4_\d like Mac OS X/i)) {
oldios = true;
}
} else {
oldios = false;
... | [
"function iOSVersion() {\r\n\t\t\tvar oldios = false;\r\n\t\t\tif((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {\r\n\t\t if (navigator.userAgent.match(/OS 4_\\d like Mac OS X/i)) {\r\n\t\t \toldios = true;\r\n\t\t\t\t}\r\n\t\t ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Click on the first link from the result page | clickFirstLink() {
return this.resultItem.first().click();
} | [
"clickFirstResultUrl() {\n return this.ResultItemFirst.first().click();\n }",
"clickLink(index) {\n this.getLinkElement(index).waitForDisplayed();\n this.getLinkElement(index).click();\n }",
"clickPromoBanner() {\n this\n .waitForElementVisible('@promoBannerPagination', 10000,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the default material that can be used for rendering normal elements on the Canvas. | static GetDefaultCanvasMaterial() {} | [
"generateDefaultMaterial() {\n var materialDefault = new CGFappearance(this.scene);\n materialDefault.setShininess(1);\n materialDefault.setSpecular(1, 0.078, 0.576, 1); // Hot pink, so its noticeable\n materialDefault.setDiffuse(1, 0.078, 0.576, 1);\n materialDefault.setAmbient(1... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
on page load we then show and select credit card payment as default | function selectCredit() {
paymentfield.value = 'creditcard';
creditDiv.style.display = 'block';
} | [
"function credit_By_Default() {\n document.getElementById('payment').value = 'credit-card';\n class_Paypal[0].style.display = 'none';\n class_Bitcoin[0].style.display = 'none';\n }",
"function payementDefaultOption() {\n creditcardOption.selected = true;\n if (creditcardOption.selected) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Injective Common Service into Constructor to Use Global Variables. | constructor(commonService) {
this.commonService = commonService;
} | [
"constructor() {\n this._services = new Map();\n this._singletons = new Map();\n }",
"constructor() { \n \n ServiceInstance.initialize(this);\n }",
"constructor() {\n if (ServiceManager._instance) {\n return ServiceManager._instance;\n } \n Ser... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function is used to hide using aria the current page when transitioning to a respective side menu. | function hideContentPage(){
$("#user-menu").attr("aria-hidden", "true");
$("#footer").attr("aria-hidden", "true");
$("#content").attr("aria-hidden", "true");
} | [
"function sg_hide_details(){\n\t\t//$('#startup-nav-spa').hide('slide', {direction: 'right'}, 250, function(){\n\t\t$('#startup-nav-spa').hide(50, function(){\n\t\t\t$(this).removeClass('active').attr('rel', '').find('.active').removeClass('active'); // slide out of view then remove all active from nav bar\n\t\t});... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Magic function I borrowed to load fonts without needing fancy css | loadFont(name, url) {
var newFont = new FontFace(name, `url(${url})`);
newFont.load().then(function (loaded) {
document.fonts.add(loaded);
}).catch(function (error) {
return error;
});
} | [
"_loadFont(name, filename) {\n var s = document.createElement('style');\n var fontname = name;\n s.id = fontname;\n s.type = \"text/css\";\n document.head.appendChild(s);\n s.textContent = \"@font-face { font-family: \" + fontname + \"; src:url('\" + filename + \"');}\";\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Hides the image resizer. | hideImageResizer() {
if (!isNullOrUndefined(this.imageResizerDivElement)) {
this.imageResizerDivElement.style.display = 'none';
}
if (!isNullOrUndefined(this.resizeContainerDiv)) {
this.resizeContainerDiv.style.display = 'none';
}
if (!isNullOrUndefined(th... | [
"function hideResizerBar() {\n if (!self.resizing()) {\n $(resizerElement).hide();\n }\n }",
"function hidePreviewImage() {\n previewImage.hide();\n }",
"function uniHide() {\n img.hide();\n}",
"imageHide() {\n return this.set('isImageShowing',... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Init express.Router inistance and use the routes | constructor() {
this.router = express.Router()
this.routes();
} | [
"setupRoutes() {\n let expressRouter = express.Router();\n\n for (let route of this.router) {\n let methods;\n let middleware;\n if (typeof route[1] === 'string') {\n methods = route[1].toLowerCase().split(',');\n middleware = route.slice(2);\n } else {\n methods = ['g... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Connect to kafka server and topics | _connectToKafka(consumerGroup, topic) {
debug("Connecting to Kafka")
this.consumers[consumerGroup][topic] = new kafka.SimpleConsumer(
{
'connectionString': this.kafkaAddress,
'idleTimeout': this.idleTimeout,
'maxBytes': this.maxBytes,
... | [
"connect() {\n\t\tlet address = this.host;\n\t\tif (this.port) address += ':' + this.port;\n\t\tthis.client = mqtt.connect(address);\n\t\tthis.client.on('message', (topic, message) => {\n\t\t\tconst subscriberFns = this.subscribers[topic]\n\t\t\t\t.filter((e) => e && e.callback)\n\t\t\t\t.map((subscriber) => subscr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expand homedir and resolve the path. | function expandPath(inputPath) {
var outputPath = inputPath.replace('~', process.env.HOME);
outputPath = path.resolve(outputPath);
return outputPath;
} | [
"function expandHomePath(path) {\r\n if (path.indexOf(homePathVariable) === 0) {\r\n return path.replace(homePathVariable, homeDir);\r\n }\r\n return path;\r\n }",
"function expandHomeDir(dir) {\n return dir.startsWith(\"~/\") ? path.join(os.homedir(), dir.substring(1)) : dir... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds error messages to a given attribute without sending event. | _add(attribute, messages) {
messages = this._findOrCreateMessages(attribute, messages);
this.addObjects(messages);
Ember.get(this, 'errorsByAttributeName').get(attribute).addObjects(messages);
this.notifyPropertyChange(attribute);
} | [
"_add(attribute, messages) {\n messages = this._findOrCreateMessages(attribute, messages);\n this.addObjects(messages);\n Ember.get(this, 'errorsByAttributeName').get(attribute).addObjects(messages);\n\n this.notifyPropertyChange(attribute);\n }",
"addError(error) {\n this.errors.push(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
constant(c) Constant function. Creates a function that always returns `c`, no matter the argument: forall a b. constant(a)(b) == a | function constant(c) {
return function() {
return c;
};
} | [
"function constant(c) {\n return function() {\n return c;\n };\n}",
"function constFunc(v) { return function() { return v; }; }",
"constant(name, value) {\n return this.singleton(name, () => value);\n }",
"function _constant (value) {\n\treturn function () {\n\t\treturn value;\n\t};\n}",
"f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to apply any URL query value to the map before we start | function applyUrlQueryStrings() {
// if asked, toggle featrues at start
let url = new URL(window.location.href);
let params = new URLSearchParams(url.search);
// be sure we start with a 'clean' layout, but only if we need it
var allOptions = [
'banner',
'altitudeChart',
'air... | [
"function urlQueryFilters() {\n $.each(URLData.f, function(index, value) {\n stateOf.eventMap.set(value.split(\"%20\").join(\" \"), true);\n });\n sendActiveEventList();\n }",
"function urlQueryValues() {}",
"function set_url_params(query, init_query) {\n var base_url = script_vars.current_url... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Valida que el RFC sea correcto. | function validarRFC() {
$("#divRFC").removeClass('has-error has-success has-warning');
let input = $("#altaRFC").val();
let rfc = input.trim().toUpperCase();
$("#altaRFC").val(rfc);
if (input.length < 12 || input.length > 13) {
$("#divRFC").addClass('has-error');
$("#spanIcon").tex... | [
"function validarRFC() {\n let input = $(\"#altaRFC\").val();\n let rfc = input.trim().toUpperCase();\n $(\"#altaRFC\").val(rfc);\n\n if (input.length < 12 || input.length > 13) {\n $(\"#divRFC\").attr('class', 'has-error');\n $(\"#spanIcon\").text('⛔');\n return;\n }\n\n let ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
/ Get Betting Metadata | getBettingMetadataPromise(){
return this.GetPromise('/v3/nfl/odds/{format}/BettingMetadata');
} | [
"function getBattleMetadata() {\n const h4 = document.querySelectorAll(\".unformatted h4[align=center]\");\n let [_, code, number] = h4[0].innerText.match(/:\\s(\\w{1})(\\d*)$/);\n const status = h4[1].innerText.match(/:\\s?(\\d+),\\s(.*)$/);\n const round = status[1].trim();\n const description = status[2].tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggles checked state of all tree nodes to true. | checkAll() {
this.toggleCheckedAll(true);
} | [
"function toggleAllChildrenChecked(children, checked) {\n children.forEach(child => {\n child.checked = checked;\n if (child.children.length > 0) {\n toggleAllChildrenChecked(child.children, checked);\n }\n });\n }",
"setCheck(node, state) {\n no... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a function that displays a message within the specified div retarding the availability of alternate editions of the current book. The function returned expects an Amazon "All Editions" url for this item and will display a message saying the item is available if passed such a url. It will display a message saying... | function getDisplayOtherEditionsInfoFunction(stubDiv) {
return function(allEdUrl) {
clearText(stubDiv);
if(!allEdUrl) {
insertText(stubDiv, 'Alternate editions unavailable at ' + libraryName + ' library.', 'libraryUnavailable');
return;
}
insertText(stubDiv, '<a href="'+allEdUrl+'" title="A... | [
"function getDisplayOtherEditionsInfoFunction(stubDiv) {\n\n return function(allEdUrl) {\n\tclearText(stubDiv);\n\t\n\tif(!allEdUrl) {\n\t insertText(stubDiv, 'Alternate editions unavailable at ' + libraryName + ' library.', 'libraryUnavailable');\n\t return;\n\t}\n\t\n\tinsertText(stubDiv, '<a href=\"'+al... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a new SP.FieldCurrency to the collection | addCurrency(title, minValue, maxValue, currencyLocalId = 1033, properties) {
let props = {
CurrencyLocaleId: currencyLocalId,
FieldTypeKind: 10,
};
if (minValue !== undefined) {
props = extend({ MinimumValue: minValue }, props);
}
if (m... | [
"function addNewCurrencies(){\n\t$.aceOverWatch.field.grid.addNewRecord(objCurrencies.grid);\n}",
"getCurrency(name) {\n let currency = this.currencies.find(c => c.name === name);\n if(!currency) {\n currency = new Currency(name);\n this.currencies.push(currency);\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION 6: Animates the up arrow when a user hovers over the entire "Back to Top" div. I had this originally as a hover effect over the icon, but I felt the icon was too small a target. | function animateUpArrow() {
$(".back-to-top").mouseover(function() {
$(".fa-long-arrow-alt-up").css("animation", "arrow-up 1s ease-in-out infinite");
});
$(".back-to-top").mouseout(function() {
$(".fa-long-arrow-alt-up").css("animation", "none");
});
} | [
"function backToTopOver() {\n document.getElementById(\"arrow-right\").innerHTML = \"Back to top\";\n }",
"function animateArrowUp() {\n\t $('.arrow').animate({'top': VIEWPORT_HEIGHT * 0.84}, 800, animateArrowDown);\n\t}",
"get arrow_upward () {\n return new IconData(0xe5d8,{fontFamily:'MaterialIcons'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
End of Express setup bits Get the soundcloud id from the soudncloud url I have already built a simple web service for this. | function getSoundcloudIDFromURL(url, callback) {
var url = "https://api.soundcloud.com/resolve.json?client_id="+config.soundcloud.id+"&url="+url;
request({url:url, json:true}, function (error, response, data) {
if (!error && response.statusCode == 200) {
callback(data.id);
}
})
} | [
"function getSoundcloudIDfromURL(url,callback) {\n\tvar url = \"https://api.soundcloud.com/resolve.json?client_id=\"+config.soundcloud.id+\"&url=\"+url;\n\trequest({url:url,json:true},function(error,response,data) {\n\t\tif(!error && response.statusCode == 200) {\n\t\t\tcallback(data.id);\n\t\t}\n\t})\n}",
"funct... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This defines a function that takes two inputs: a and b, and returns a minus b | function subtract(a,b){
return a - b
} | [
"function subtract(a, b){\n return a - b;\n}",
"function subtract(a, b) {\n return a - b;\n}",
"function subtract(a, b) {\n return a - b;\n}",
"function subtract(a,b){\n return a - b\n }",
"function subtract (a, b) {\n\treturn a - b;\n}",
"function subtraktion( a , b)\n{\n \n return a-b;\n}"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create an nsIStreamListener object to read String data from an nsIInputStream | newStringStreamListener(onStopCallback) {
let listener = {
data: "",
inStream: Cc["@mozilla.org/binaryinputstream;1"].createInstance(
Ci.nsIBinaryInputStream
),
QueryInterface: ChromeUtils.generateQI([
"nsIStreamListener",
"nsIRequestObserver",
]),
onStar... | [
"function getStreamContent(inputStream)\n{\n var streamBuf = \"\";\n var sis = CC[\"@mozilla.org/scriptableinputstream;1\"].\n createInstance(CI.nsIScriptableInputStream);\n sis.init(inputStream);\n\n var available;\n while ((available = sis.available()) != 0) {\n streamBuf +=... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Atualiza os feiticos conhecidos para uma classe de um determinado nivel. | function _AtualizaFeiticosConhecidosParaClassePorNivel(
chave_classe, nivel, precisa_conhecer, feiticos_conhecidos) {
// Se não precisa conhecer, o jogador pode adicionar feiticos como se fosse um grimório.
if (feiticos_conhecidos.length == 0 && precisa_conhecer) {
return;
}
var div_nivel = Dom('div-fei... | [
"function _AtualizaFeiticosConhecidosParaClasse(chave_classe, div_classe) {\n var feiticos_classe = gPersonagem.feiticos[chave_classe];\n var tabelas_feiticos_classe = tabelas_feiticos[chave_classe];\n var div_conhecidos = Dom('div-feiticos-conhecidos-' + chave_classe + '-por-nivel');\n AjustaFilhos(\n div... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a component dynamically but not attach to any View (this action will be executed when bodyContainer is ready) | createDynamicComponent(component) {
const factory = this.cfr.resolveComponentFactory(component);
const childInjector = Injector.create({
providers: [{ provide: McModalRef, useValue: this }],
parent: this.viewContainer.injector
});
this.contentComponentRef = factor... | [
"function loadComponent() {\n let container = $('#body');\n container.innerHTML = '';\n container.appendChild(window['get' + current_component + 'Content']());\n}",
"function createComponents() {\n newestView = new View.NewestView(document.querySelector(\"#newest-tab\"), document.querySelector(\"#... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Determine whether the given properties match those of a `CloudFrontOriginAccessIdentityConfigProperty` | function CfnCloudFrontOriginAccessIdentity_CloudFrontOriginAccessIdentityConfigPropertyValidator(properties) {
if (!cdk.canInspect(properties)) {
return cdk.VALIDATION_SUCCESS;
}
const errors = new cdk.ValidationResults();
errors.collect(cdk.propertyValidator('comment', cdk.requiredValidator)(pr... | [
"function CfnCloudFrontOriginAccessIdentityPropsValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('cloudFrontOriginAccessIdentityConfig', cdk.requiredValidator)(pro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
import LandingPage from './components/LandingPage/LandingPage'; import SplitText from './components/SplitText/SplitText'; | function App() {
return (
<div className="App">
<Title/>
{/*
<PersonalInfo/>
<VideoBanner/>
<SplitText/>
<LandingPage/>
*/}
</div>
);
} | [
"function App() {\n return (\n <div className=\"App\">\n\n\n<HomePage></HomePage>\n{/* <NewsEvents></NewsEvents> */}\n{/* <ContactFrom></ContactFrom> */}\n\n\n </div>\n );\n}",
"_pageChanged(page) {\r\n\r\n switch (page) {\r\n case 'login':\r\n import('./login-form.js');\r\n break;\r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Select all information from products table to display for Manager, prompt manager for desire to continue | function viewProducts() {
connection.query('SELECT * FROM products', function(err, results){
if (err) throw err;
displayForManager(results);
promptManager();
})
} | [
"function viewProductsForSale() {\n console.clear()\n displayTable(connection, function () {\n promptCB(\"Currently stocked items\".green, managerMenu)\n })\n}",
"function loadManagerOptions(products) {\n inquirer\n .prompt({\n type: \"list\",\n name: \"choice\",\n choices: [\"View Produc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a list of recent fills for a given Product of the API key's profile. | getFillsByProductId(productId, pagination) {
return __awaiter(this, void 0, void 0, function* () {
const resource = FillAPI.URL.FILLS;
const response = yield this.apiClient.get(resource, { params: Object.assign({ product_id: productId }, pagination) });
return {
... | [
"function getAllActiveProducts() {\n let url = `${baseApiUrl}products/getActiveProducts`;\n fetch(url).then(response => response.json()).\n then(data => {\n if (data.status === 200) {\n products = data.data;\n printProducts(products);\n }\n })\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
import Header from "./components/Nav"; import Main from "./components/Main"; import Footer from "./components/Footer"; | function App() {
return (
<div>
<Nav />
<Main />
<Footer />
</div>
)
} | [
"function App() {\n return (\n <div className=\"App\">\n <Header />\n <SearchAll />\n <GithubTrend />\n {/* <AboutUsAndFooter/> */}\n </div>\n );\n}",
"function App() {\n return (\n <div className=\"App\">\n {/*<Table />*/}\n <Sticky />\n {/*<TableExamplePagination /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Appends a number incrementally until a unique taxonym is found. | function appendNumToTaxonym(taxonName, tP) {
var count = 1;
var taxonym1 = taxonName + '-1';
return nextInTaxaObj(taxonName, taxonym1, count, tP);
function nextInTaxaObj(taxonName, taxonym, cnt, tP) {
if (taxonym in t... | [
"function personIncrement() {\n var personValue = parseInt(people.value);\n personValue += 1;\n people.value = personValue;\n calculateTipAndAmount();\n }",
"function getNextWaybill() {\n \n var nextWaybill = parseInt(getLastWaybillCreated()) + 1; \n \n return nextWaybill;\n}",
"function increm... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the outermost parent of a set of elements assume the following tree where the elements marked with "x" are passed as array to this function: ROOT | CHILD 1 | SUB_CHILD 1 | SUB_CHILD 2 (x) | CHILD 2 | SUB_CHILD 1 | SUB_SUB_CHILD 1 (x) The function should now return the "ROOT" elements as this is the outermost pa... | function egwGridData_getOutermostParent(_elements)
{
var minElem = null;
var minCnt = 0;
for (var i = 0; i < _elements.length; i++)
{
var parents = _elements[i].getParentList();
if (i == 0 || parents.length < minCnt)
{
minCnt = parents.length;
minElem = _elements[i];
}
}
return minElem ? (minElem... | [
"function findCommonAncestor(elements) {\n if (elements.length === 0) {\n throw new ReferenceError(\"Cannot get common ancestor of 0 nodes.\");\n }\n // this doesn't handle null nodes, so filter those out first\n elements = elements.filter((el) => el && $(el).parents().length)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |