query stringlengths 9 34k | document stringlengths 8 5.39M | negatives listlengths 19 20 | metadata dict |
|---|---|---|---|
Function checklnr() retrieves the Last Name of Recorder value entered by the user. The funcion checks to make sure that the value entered only contains letters, apostrophes, and end spaces.Submit button is disabled or enabled depending on the status of the validation. | function checklnr() {
var lnr = document.getElementById('lnameofrecorder').value;
if( lnr == null || lnr == ""){
return;
}
var regex = /^([a-zA-Z' ])+$/
if (!new RegExp(regex).test(lnr)) {
alert("Your spelling contains numerics or special characters. Only letters and... | [
"function checkfnr() {\r\n \r\n var fnr = document.getElementById('fnameofrecorder').value;\r\n\r\n if (fnr == null || fnr == \"\") {\r\n return;\r\n }\r\n\r\n var regex = /^([a-zA-Z' ])+$/\r\n\r\n if (!new RegExp(regex).test(fnr)) {\r\n\r\n alert(\"Your spelling contains numerics or... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
method to view all of the stories associated with an event | function storyView(event_name) {
relatedStories(event_name);
} | [
"function relatedStories(event_id) {\n console.log(\"relatedSTories\");\n narray = [];\n dbPromise.then(function (db) {\n var tx = db.transaction(STORY_OBJECT_STORE, 'readonly');\n var storyOS = tx.objectStore(STORY_OBJECT_STORE);\n // var index = storyOS.index('eventname');\n /... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a drag ends, we uninstall the handlers we had to add to its parent. | function endDrag () {
$element.parents().off( "mousemove", handleDrag );
$element.parents().off( "mouseup", endDrag );
$element[0].dispatchEvent( new CustomEvent(
( $element[0].dragType == 4 ) ? 'moved' : 'resized',
{ bubbles : true } ) );
} | [
"endDrag_() {\n const doc = this.ownerDocument;\n for (const eventType in this.handlers_) {\n doc.removeEventListener(eventType, this.handlers_[eventType], true);\n }\n this.handlers_ = null;\n this.handleSplitterDragEnd();\n }",
"endDrag_() {\n this.removeAllHandlers_();\n this.handleS... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace the given range with the given content, which may be a fragment, node, or array of nodes. | replaceWith(from2, to, content) {
return this.replace(from2, to, new Slice(Fragment.from(content), 0, 0));
} | [
"overwrite(start: number, end: number, content: string) {\n if (typeof start !== 'number' || typeof end !== 'number') {\n throw new Error(\n `cannot overwrite non-numeric range [${start}, ${end}) ` +\n `with ${JSON.stringify(content)}`\n );\n }\n this.log(\n 'OVERWRITE', `[${st... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns function to populate relations TODO: composed keys TODO: nested population TODO: optimalization: when populating collection of data, target models should be queried only once using IN operator. To restrict amount of DB queries. | function factory(schema, getModel, ds) {
return async (relations, dataList, trx) => {
// Nothing to populate?
if (!dataList) {
return
}
if (!(dataList instanceof Array)) {
dataList = [dataList]
}
trx = ds.getTrx(trx)
const toPopulate = parseRelations(relations)
// Iterat... | [
"initRelations() {\n const me = this,\n relations = me.constructor.relations;\n if (!relations) return; // TODO: feels strange to have to look at the store for relation config but didn't figure out anything better.\n // TODO: because other option would be to store it on each model instance, not be... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
return map of valid training types TODO Figure out the calculations in the multitrain section | function getValidTrainingTypes() {
// calc max gain not including the next training
var maxPossible = calcMaxPossibleBTGain();
var validTrainingTypes = {
intense : false,
normal : false,
light : false,
multi4 : false,
multi3 : false,
multi2 : false
};
var neededFromNextTrain = getDesire... | [
"function CheckIfTrainingParamsValid() {\n\tlet valid = true;\n\tObject.keys(TRAINING_P).forEach(function (p) {\n\t\tif ((TRAINING_P[p] == undefined) || (TRAINING_P[p] == \"\") || isNaN(parseFloat(TRAINING_P[p]))) {\n\t\t\tvalid = false;\n\t\t}\n\t});\n\treturn valid;\n}",
"function train() {\n // don't allow ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This functions takes the divs corresponding with the values of the greeting options that were not selected and hides them. | function hideUnselectedOptions() {
var i, divId, div;
for(i = 0; i < divs.length; i++) {
divId = divs[i];
div = document.getElementById(divId);
if(visibleDivId === divId) {
div.style.display = "block";
} else {
div.style.display = "none";
}
}
} | [
"function hideOptions() {\n $('.meeting-options, .local-user-name, .remote-user-name, .meeting-info, .kick').hide();\n }",
"function hidden() {\n $(\"#player1choices\").attr(\"style\", \"visibility:hidden\");\n $(\"#player2choices\").attr(\"style\", \"visibility:hidden\");\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get the data of the random pokemon | async function getRandomPokemonData (randomPokemon) {
console.log(randomPokemon)
try {
const response = await axios.get(`${randomPokemon.url}`)
randomPokemonAllMoves = response.data.moves
// console.log(`This is all random's moves: ${randomPokemonAllMoves}`)
assignPokemonStats(response... | [
"getRndmPokeData() {\n let rndmPokeNum = Math.floor(Math.random() * Math.floor(807));\n\n return Axios.get('https://pokeapi.co/api/v2/pokemon/' + rndmPokeNum);\n }",
"async function FindRandomPokemon() {\n let id = getRandomIntInclusive(1, 300);\n let randomPokemon = await axios.get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Writes assembly code that effects the VM initialization, also called bootstrap code. This code must be placed at the beginning of the output file. | writeInit() {
const instructions = [
this._addComment('bootstrap'),
// SP = 256
'@256',
'D=A',
'@SP',
'M=D',
...this._getCallInstructions('Sys.init', 0),
]
this._writeAhead(instructions.join(EOL))
} | [
"writeInit() {\n this.lines.splice(\n 0,\n 0,\n `// bootstrap`, // comment\n '@256',\n 'D=A',\n '@SP',\n 'M=D' // initialize SP\n );\n this.currentFunction = 'Main';\n this.writeCall('Sys.init', 0); // add asm for Sys.init call with zero arguments\n }",
"function bo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to format and display the remaining time. | function displayRemainingTime() {
minutesEl.textContent =
Math.floor(time / 60) < 10
? "0" + Math.floor(time / 60)
: Math.floor(time / 60);
secondsEl.textContent = time % 60 < 10 ? "0" + (time % 60) : time % 60;
} | [
"function formatTimeRemaining (time) {\n var timeRemaining = new StringBuilder();\n timeRemaining.append(\"{b}({c}\");\n if (time > 3600) {\n timeRemaining.append(format(\n \"%dh%dm\", time / 3600, (time % 3600) / 60));\n } else if (time > 60) {\n timeRemaining.append(format(\"%dm%ds\", time / 60, ti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uploads the last file fragment and commits the file. The current file content is changed when this method completes. Use the uploadId value that was passed to the StartUpload method that started the upload session. This method is currently available only on Office 365. | finishUpload(uploadId, fileOffset, fragment) {
return this.clone(File, `finishUpload(uploadId = guid'${uploadId}', fileOffset = ${fileOffset})`, false)
.postCore({ body: fragment })
.then(response => {
return {
data: response,
file: new F... | [
"finishUpload(uploadId, fileOffset, fragment) {\n return __awaiter(this, void 0, void 0, function* () {\n const response = yield spPost(this.clone(File, `finishUpload(uploadId=guid'${uploadId}',fileOffset=${fileOffset})`, false), { body: fragment });\n return {\n data: re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets your order from the session storage or makes an empty order if there is none | function getStorage() {
if (sessionStorage.getItem("order") != null) {
var storage = JSON.parse(sessionStorage.getItem("order"));
} else {
var storage = {
"custom": []
};
}
return storage;
} | [
"function getCachedOrder(id) {\n\ttry {\n\t\torder = sessionStorage.getItem(id);\n\t\torder = JSON.parse(order);\n\t\treturn order;\n\t}\n\tcatch (error) {\n\t\tconsole.log(error);\n\t\treturn dummy;\n\t}\n}",
"function getStoredOrders() {\n return JSON.parse(localStorage.getItem('order'));\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Toggles generate button off. Toggles clear and read text on | function generateOff() {
handleClearButton.disabled = false;
handleReadTextButton.disabled = false;
handleSubmitButton.disabled = true;
} | [
"function generateOn() {\n handleClearButton.disabled = true;\n handleReadTextButton.disabled = true;\n handleSubmitButton.disabled = false;\n}",
"function toggle_buttons() {\n clear_btn.disabled = generate_btn.disabled;\n read_text_btn.disabled = generate_btn.disabled;\n voice_options.disabled ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Copy response data as a string. | copyResponse() {
const { text } = this.selectedRequest.responseContent.content;
getString(text).then(string => {
copyToClipboard(string);
});
} | [
"rawData () {\n return this.responseData\n }",
"function concatenateResponse(callback, res) {\n var stringData = \"\";\n\n res.on(\"data\", function(chunck) {\n stringData += chunck;\n });\n\n res.on(\"end\", function() {\n var json = JSON.parse(stringData);\n callback(json);\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Go through all the commands removing any that are associated with the given front. The method of association is the hack in addLocalFunctions. | function removeItemsFromFront(system, front) {
system.commands.getAll().forEach(function(command) {
if (command.front === front) {
system.commands.remove(command);
}
});
} | [
"undo() {\n // ˅\n if (this.pastCommands.length !== 0) {\n this.pastCommands.pop();\n }\n // ˄\n }",
"function Interpreter_PurgeMiniActions()\n{\n\t//loop through the active mini actions\n\twhile (this.MiniActions.Active.length > 0)\n\t{\n\t\t//get this miniAction\n\t\tva... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a button that plays a replay of all the past moves that have happened in the game | addReplayButton() {
this.interface.gui.add(this.gameOrchestrator, 'replayMoves').name('Replay Moves');
} | [
"function replay() {\n $('#replay-container').removeClass('hide');\n $('#replay-score').text(_GAME.score);\n $('#replay-time').text(_GAME.time);\n $('#replay-moves').text(_GAME.moves);\n}",
"function replayGame() {\n\tresetGame();\n\ttoggleModal();\n}",
"function replay(){\n $('#replay-container'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
split one layer into two layers containing the same number of shapes (+1), either horizontally or vertically | function divideLayer(lyr, arcs, bounds) {
var properties = lyr.data ? lyr.data.getRecords() : null,
shapes = lyr.shapes,
lyr1, lyr2;
lyr1 = {
geometry_type: lyr.geometry_type,
shapes: [],
data: properties ? [] : null
};
lyr2 = {
geometry_type: lyr.geometry_type,
... | [
"function createShapesFromOne(i) {\n // Start Point for the Path: middle of comp = anchor point\n var pathBeginX = 0,\n pathBeginY = 0;\n \n // Create Shape Layer\n newShapeLayer[i] = currentComp.layers.addShape();\n // Give a Name\n newShapeLayer[i].name = \"Line-\"+i;\n // Give a La... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
const userTerritory = JSON.parse(localStorage.getItem('userTerritory')); let selected = userTerritory.id; | function renderOption() {
const userTerritoryList = JSON.parse(localStorage.getItem('userTerritoryList'));
return userTerritoryList.map((item) => {
return (
<Option value={item.id} key={item.id}>
{item.name}
</Option>
);
});
} | [
"function get_selected_option() {\n options = JSON.parse(localStorage.getItem('booking_options'));\n selected_option = localStorage.getItem('selected_option');\n }",
"function getSelectFromStorage (id) {\n let value = localStorage.getItem(id);\n if (value !== null){\n document.getEle... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if Song has changed | function songchanged() {
if ($('#playlist li.active').attr('id') !== currentsongtemp.attr('id')) {
currentsongtemp = $('#playlist li.active');
return true;
} else {
return false;
}
} | [
"function check_playing(){\n\t\t\t\t\tlet current_title = $(\".track-info__name div a:eq(0)\").text();\n\t\t\t\t\tlet current_artist = $(\".track-info__artists span span a:eq(0)\").text();\t\t\t\t\t\n\n\t\t\t\t\tif(cur_song.title !== current_title || cur_song.artist !== current_artist){\n\n\t\t\t\t\t\tcur_song.titl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Print object to output. | print(obj) {
if (obj == null) {
this.write("nil");
} else if (obj instanceof Frame) {
this.print_frame(obj);
} else if (typeof obj === 'string') {
this.write(JSON.stringify(obj));
} else if (Array.isArray(obj)) {
this.print_array(obj);
} else if (obj instanceof QString) {
... | [
"print(obj) {\n if (obj == null) {\n this.write(\"nil\");\n } else if (obj instanceof Frame) {\n this.printFrame(obj);\n } else if (typeof obj === 'string') {\n this.write(JSON.stringify(obj));\n } else if (Array.isArray(obj)) {\n this.printArray(obj);\n } else if (obj instanceof ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Since views are vinyl files and paths are getters/setters, we need to copy paths from `view` onto a plain object | function copyPaths(view, fn) {
var paths = {};
paths.cwd = view.cwd;
paths.base = view.base;
paths.path = view.path;
paths.absolute = path.resolve(view.path);
paths.dirname = view.dirname;
paths.relative = view.relative;
paths.basename = view.basename;
paths.extname = view.extname;
paths.ext = view.... | [
"function prepare_view(req, view) {\n\tdebug.assert(req).is('object');\n\tdebug.assert(view).is('object').instanceOf(nopg.View);\n\tvar tmp;\n\ttry {\n\t\ttmp = JSON.parse(JSON.stringify(view));\n\t} catch(e) {\n\t\tdebug.log('Failed to copy: ', view);\n\t\tthrow e;\n\t}\n\tvar meta = tmp.$meta;\n\tdelete tmp.$even... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this is the recursive function to check if a hex is completely surrounded by a path hexes checked is an array of hexes we know we've already checked | checkIfNeighborsAreWithingBoundry(boundry, hexesChecked, innerSet){
//if we are on an edge
//return false if at any point during the recursion we find that we've reached an edge, this means it is impossible for it to be full now
//console.log("recurse on: " + this.index.col + ", "+ this.index.row)
if(th... | [
"arrayOfHexesIncludesHex (sourceHexes, targetHex) {\n let filteredHexes = sourceHexes.filter((hex) => {\n return this.hasSameCoordinates(hex, targetHex);\n });\n return filteredHexes.length > 0;\n }",
"function hasPath(startHex, goalHex) {\n var frontier = [startHex];\n var reached = new Set();\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Will perform recalibration when this.data is available | recalibrate() {
this.recalRequested = true;
} | [
"performRecalibration() {\n this.sensorRotations.setRotationFromEuler(this.eulerOrigin);\n\n // Apply gyroscope rotations\n this.sensorRotations.rotateZ(this.data.alpha * this.RAD);\n this.sensorRotations.rotateX(this.data.beta * this.RAD);\n this.sensorRotations.rotateY(this.data... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TODO Support byteOffset and byteLength (enabling parsing of embedded binaries without copies) TODO Why not support async loader.parse funcs here? TODO Why not reuse a common function instead of reimplementing loader.parse selection logic? Keeping loader small? TODO Lack of appropriate parser functions can be detected w... | async function parseData({loader, arraybuffer, byteOffset, byteLength, options, context}) {
let data;
let parser;
if (loader.parseSync || loader.parse) {
data = arraybuffer;
parser = loader.parseSync || loader.parse;
} else if (loader.parseTextSync) {
const textDecoder = new TextDecoder();
data ... | [
"async function parseData(loader, arraybuffer, byteOffset, byteLength, options) {\n let data;\n let parser;\n if (loader.parseSync || loader.parse) {\n data = arraybuffer;\n parser = loader.parseSync || loader.parse;\n } else if (loader.parseTextSync) {\n const textDecoder = new TextDecoder();\n dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Static store of oauth clients | function ostore(config) {
var base = this;
//Init the store
base.store = [];
//Create the store from the config file
for(var kind in config) {
base.store[kind] = new oauth(config[kind]);
}
} | [
"getOauthClients() { \n\n\t\treturn this.apiClient.callApi(\n\t\t\t'/api/v2/oauth/clients', \n\t\t\t'GET', \n\t\t\t{ },\n\t\t\t{ },\n\t\t\t{ },\n\t\t\t{ },\n\t\t\tnull, \n\t\t\t['PureCloud OAuth'], \n\t\t\t['application/json'],\n\t\t\t['application/json']\n\t\t);\n\t}",
"function getOauth() {\n return init()... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
b. change the min and max for y | function yMinMax() {
// min will grab the smallest datum from the selected column.
yMin = d3.min(theData, function(d) {
return parseFloat(d[curY]) * 0.90;
});
// .max will grab the largest datum from the selected column.
yMax = d3.max(theData, function(d) {
return parseFloat(d[curY]) * ... | [
"limits() {\n var keys = Object.keys(this.data);\n var min = parseInt(this.data[keys[0]]); // ignoring case of empty list for conciseness\n var max = parseInt(this.data[keys[0]]);\n var i;\n for (i = 1; i < keys.length; i++) {\n var value = parseInt(this.data[keys[i]]);... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Processes form data from AdvancedSchedule menu option / sidebar | function processAdvancedForm(formData) {
eval(UrlFetchApp.fetch('https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js').getContentText());
data = formData;
let prange = SpreadsheetApp.getActive().getSheetByName('players').getDataRange();
data['players'] = prange.getValues();
let sched = getAdvancedSchedul... | [
"function formProcessor() {\n contents = {};\n let title = $(\"#title\").val();\n if(!title) {\n displayText(\"Your poll doesn't have a title\", \"error\");\n return false;\n }\n let description = $(\"#description\").val();\n if(description.length > 240) {\n displayText(\"Can'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
sorts elemnents of 2D array[[_,_,...,_],[],...,[]] at array[][index] | function sortMultiArrayAtIndex(array, index, section) {
// make array in 2D first
var array2D = [];
for (var i = 0; i < array.length; i+=section) {
var innerArray = [];
for (var j = 0; j < section; j++) {
innerArray.push(array[i+j]);
}
array2D.push(innerArray);
}
// put elements to be s... | [
"function sort2DArray(arr) {\n return arr.sort(function(a, b) {\n if (a[1] < b[1]) return -1;\n if (a[1] > b[1]) return 1;\n return 0;\n });\n}",
"function sortBy(thisarray,index) {\n var newarray = [];\n for (i = 0; i<=index.length-1;i++) {\n newarray.push(thisarray[index[i]])\n }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a string from objects containing media values. Such a string may be used as the value of the Accept family of HTTP headers. | function stringifyMediaValues(values, typeSeparator) {
return values.map(function (mediaValue) {
return stringifyMediaValue(mediaValue, typeSeparator);
}).join(', ');
} | [
"function toMediaObj(val) {\n if (typeof val === 'number' || typeof val === 'string' || typeof val === 'boolean') return { xs: val };\n if ((typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object' && Object.keys(val).length) return val;\n return {};\n}",
"toString() {\n return cobalt.mime.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
converts the legend into a simple tooltip | function legendAsTooltipPlugin(
{
className,
style = { backgroundColor: "rgba(255, 249, 196, 0.92)", color: "black" },
} = {},
) {
let legendEl;
function init(u, opts) {
legendEl = u.root.querySelector(".u-legend");
legendEl.classList.remove("u-inline");
className && legendEl.classList.add... | [
"function addToolTipsToTraceLegends() {\n\t$(\"g.legend g.traces\").each(function() {\n\t\tvar pvName = $( this ).children('.legendtext').attr('data-unformatted');\n\t\tif('DESC' in viewerVars.pvData[pvName]) {\n\t\t\tvar ttip = document.createElementNS(\"http://www.w3.org/2000/svg\", 'title');\n\t\t\tttip.appendCh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function to append modal window with All player bans Call while user click on getAllBans button | function getAllBansSaPi() {
setTimeout(function() {
$('#bInfo_full').text('');
var table = $('<table/>', {"id": 'SaPi_Bans'});
$.each($tElement, function(row, value) {
var newRow = $('<tr/>');
if (row == 0){
$.each($(value).find('td'), function(cell, value) {
newRow.append($('<th/>').text(chrome.i... | [
"function getBanned() {\n $('#bannedModal').modal({backdrop: 'static', keyboard: false, show: true});\n}",
"function loadMapBans() {\n mapBanUserList();\n $('#edit-user-bans-button').html(\"Edit bans for \" + sessionStorage.getItem(\"username\"));\n}",
"function showAllUsers (func){\n\tconsole.log('sho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This function deletes the current active note | function deleteCurrentNote() {
// console.log(window.currentNote);
// Make a confirm message for delete of a note
var onDeletePromise = deleteNotefunction(window.currentNote);
document.getElementById('note-description-content').innerHTML = '';
document.getElementById('note-description-editor').innerHTML = '... | [
"function deleteNote() {\n if (currentNote) {\n delete window.notes[currentNote];\n renderNotes();\n }\n\n $('#curtain').classList.add('hidden'); // hide the curtain\n currentNote = null; // note is no longer open so...\n}",
"function deleteCurrentNote(){\n myNotebook.notes[currentNot... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reveal mobile menu on click & hide scroll btn | function mobileMenu() {
if (nav.style.display === "flex") {
document.body.style.overflow = "initial";
nav.style.display = "none";
nav.style.height = "0";
navBtn.style.marginRight = "0";
scrollBtn.style.zIndex = "initial";
} else {
document.body.style.overflow ="hidden";
nav.style.display... | [
"function toggleMobileMenu() {\n if (mobileMenuVisible) {\n //close menu\n nav.style.removeProperty(\"top\");\n } else {\n //open menu\n nav.style.top = \"0px\";\n }\n mobileMenuVisible = !mobileMenuVisible;\n}",
"function mobMenu(){\n\t\t$('#mob-menu-contacts').click(function(e){\n\t\t\t$('.open-... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the quality setting. | function getQuality()
{
return quality;
} | [
"get quality() {\n return this.media.quality;\n }",
"set quality(value) {}",
"loadQuality() {\n return config.quality.concat([config.originQuality]);\n }",
"function _getRoomQuality() {\n var room_quality = document.querySelector(\n 'input[name = \"optquality\"]:checked'\n ).value;\n if (!... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets or sets the mapping mode to use to evaluate whether the mapping applies. | get mappingMode() {
return this.i.bh;
} | [
"get mappingMode() {\r\n return this.i.bh;\r\n }",
"function getMode()\r\n\t{\r\n\t\treturn metaData.mode;\r\n\t}",
"set lightmappingMode(value) {}",
"function getMode(mode) {\n switch (mode) {\n default: return null;\n case 'home':\n return 0;\n\n case 'breako... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create pseudo elements & add them to a job queue. | function createPseudoElements(el) {
var before = getPseudoElement(el, ':before'),
after = getPseudoElement(el, ':after');
if(before) {
jobs.push({type: 'before', pseudo: before, el: el});
}
if (after) {
jobs.push({type: 'after', pseudo: after, el: el});
}
} | [
"function createPseudoElements(el) {\n var before = getPseudoElement(el, ':before'),\n after = getPseudoElement(el, ':after');\n\n if (before) {\n jobs.push({ type: 'before', pseudo: before, el: el });\n }\n\n if (after) {\n jobs.push({ type: 'after', pseudo:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
see if anything in the SQL array requires a write | function needsWrite(SQLObject) {
var sqlObj = SQLObject
if(!Array.isArray(sqlObj)) sqlObj = [ sqlObj ]
for(var i = 0; i < sqlObj.length; i++) {
var perms = tablePerms(sqlObj[i].sql)
if(perms && perms.write && perms.write.length > 0) return true
}
return false
} | [
"function check_queue_write() {\n\tif (intf.intf.queue_write.length < 1) {\n\t\tintf.intf.writing = false;\n\t\treturn false;\n\t}\n\n\tintf.intf.writing = true;\n\treturn true;\n}",
"hasWriteErrors() {\n return this.result.writeErrors.length > 0;\n }",
"function isParmArrayValidForStatement( sqlState... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return random number of a particular length of digits | function getRandomDigits (length) {
return Math.floor(Math.pow(10, length-1) + Math.random() * (Math.pow(10, length) - Math.pow(10, length-1) - 1));
} | [
"genRandNumber(digitlength){\n var myNum = \"\"\n while(myNum.length < digitlength){\n myNum = (Math.round(Math.random() * Math.pow(10,digitlength))).toString()\n }\n return Number(myNum) \n }",
"function getRandomNumber(length) {\n return Math.floor(Math.pow(10, lengt... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get all games with referee openings | async function getGamesWithOpenings(callback) {
let availGamesArray = [];
let dbGames = await db.Games.findAll({});
for (let i = 0; i < dbGames.length; i++) {
let game = dbGames[i];
let refInGames = await game.getReferees();
let numOfRefInGames = refInGames.length;
if (numOfRefInGames < dbGames[i]... | [
"async getAllListedGames() {\n const gameCollection = await games();\n const available_games = await gameCollection.find({ available: true });\n return available_games;\n }",
"function getGames () {\n let avGames = []\n for (let game of games) {\n if (game.available) {\n avGames.push({... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
gets an array of the data of all tags corresponding to the given tag | function getTagsData(node,tag) {
var tags = (node.tree.filter(e => e.tag ===tag) || []);
return tags.map(t=>t.data);
} | [
"function getTags() {\n\ttags = [];\n\tdata.forEach(element => { tags = _.union(tags, element.tags); });\n\treturn tags;\n}",
"getTags() {\n const tagList = [];\n for (const tag in this.tagDictionary) {\n tagList.push(tag);\n }\n return tagList;\n }",
"function allTagsA... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates client report envelope | function createClientReportEnvelope(
discarded_events,
dsn,
timestamp,
) {
const clientReportItem = [
{ type: 'client_report' },
{
timestamp: timestamp || time.dateTimestampInSeconds(),
discarded_events,
},
];
return envelope.createEnvelope(dsn ? { dsn } : {}, [clientReportItem]);
} | [
"function createClientReportEnvelope(\n\t discarded_events,\n\t dsn,\n\t timestamp,\n\t) {\n\t const clientReportItem = [\n\t { type: 'client_report' },\n\t {\n\t timestamp: timestamp || dateTimestampInSeconds(),\n\t discarded_events,\n\t },\n\t ];\n\t return createEnvelope(dsn ? { dsn } : ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
accepts unit object and returns array of unit's base growth rates | function getGRBaseArr(unit) {
return [unit.baseHPGR, unit.baseStrGR, unit.baseMagGR, unit.baseSklGR, unit.baseSpdGR, unit.baseLckGR, unit.baseDefGR, unit.baseResGR];
} | [
"function getGrowthRates(unit) {\r\n return [unit.hp, unit.str, unit.mag, unit.dex, unit.spd, unit.lck, unit.def,unit.res, unit.cha];\r\n}",
"function getUnits () {\n return units;\n }",
"function getMaxStatArr(unit) {\n return [unit.maxHP, unit.maxStr, unit.maxMag, unit.maxSkl, unit.max... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Start of test command Runs the listProjectsOf function from projects to select project that user wants to be tested | function test() {
console.log('Beginning test process!'.blue);
projects.action = 'test';
github.getCredentials()
.catch(janitor.error('Failure getting credentials'.red))
.then(greenlight.getGradable)
.catch(janitor.error('Failure getting sessions'.red))
.then(sessions.selectSession)
.catch(jan... | [
"function pwi_test_project() {\n\t// Find parent folder of file\n\tlet x = pwi_current_path.lastIndexOf('/');\n\tif (x==-1) { \n\t\tpwi_tests_total = pwi_tests_passed = false;\n\t\tdocument.getElementById('phpwebide_test_results').style.display = \"none\";\n\t\treturn;\n\t}\n\t\n\tbuildserviceStartTest(pwi_current_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disconnected nodes Connections between nodes can be removed by providing the nodes and ports to disconnect. myGraph.removeEdge 'Display', 'out', 'Foo', 'in' Removing a connection will emit the `removeEdge` event. | removeEdge(node, port, node2, port2) {
this.checkTransactionStart();
port = this.getPortName(port);
port2 = this.getPortName(port2);
let toRemove = [];
let toKeep = [];
if (node2 && port2) {
for (var index = 0; index < this.edges.length; index++) {
var edge = this.edges[index];
... | [
"disconnect() {\n if (this.from) {\n this.from.detachEdge(this);\n this.from = undefined;\n }\n if (this.to) {\n this.to.detachEdge(this);\n this.to = undefined;\n }\n\n this.connected = false;\n }",
"disconnect() {\n if (this.from) {\n this.from.detachEdge(this);\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Global variables, seen by other instances (var) / Global variables, private to including page (let) / Functions / Select closest xicon image as possible to 16x16, and return it as an Uint8ClampedArray uri = a data:image/xicon base64 string describing the image Returns null if no choice to make, e.g. only 1 image or wro... | function selectXIconImg (uri) {
let pos = uri.indexOf("base64,");
if (pos == -1) {
// console.log("not an x-icon: "+uri);
return(null);
}
let str = atob(uri.slice(pos+7)); // Get the binary part
// Explore structure, as documented here: https://en.wikipedia.org/wiki/ICO_(file_format)
// console... | [
"function selectIconPath() {\n\t\tif (_title === 'Feed & Care') {\n\t\t\treturn imagePath.feed;\n\t\t} else if (_title === 'Training') {\n\t\t\treturn imagePath.train;\n\t\t} else if (_title === 'Health') {\n\t\t\treturn imagePath.health;\n\t\t} else if (_title === 'Gestation') {\n\t\t\treturn imagePath.gestation;\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stop nfc service. Remove all FIDO2 cards. | async stop() {
/**
* Only stop service when service is running.
*/
if (this.state === transport_1.DeviceState.off)
return;
debug_1.logger.debug('stop nfc service');
/**
* Update service state.
*/
this.state = transport_1.DeviceState... | [
"destroy () {\n this._socket.close()\n this._rtc.close()\n this._removeEventListeners()\n }",
"function _shutdownBluetooth() {\n bluetooth.stopScanning();\n }",
"disconnectRTC() {\n this.rtcDestroy();\n this.uiCommunicator(this.lifeCycle.RtcDisconnectEvent);\n this.applyDatahandlers(JSON.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reduce /Write a high order function that counts all the vowels of the following text. | function countvowels(text){
var character = text.toLowerCase().split('')
var vowels = 'aeiou';
var countvowels = character.reduce(function(acc,current){
return vowels.indexOf(current) > -1 ? acc + 1 : acc;
},0);
return countvowels;
} | [
"function reduceText(text) {\r\n var regEx = /[aeiouAEIOUáéíóúàèìòùäëïöü]/gi;\r\n return text.split('').reduce(function (vowelsCount, letter) {\r\n if (letter.toLowerCase().match(regEx)) {\r\n return vowelsCount += 1;\r\n }\r\n return vowelsCount;\r\n }, 0);\r\n}",
"functi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get index of least fittest individual | getLeastFittestIndex() {
var minFitVal = 100;
var minFitIndex = 0;
for (var i = 0; i < this.individuals.length; i++) {
if (minFitVal >= this.individuals[i].fitness) {
minFitVal = this.individuals[i].fitness;
minFitIndex = i;
}
}
return minFitIndex;
} | [
"getFittest() {\n var maxFit = 0;\n var maxFitIndex = 0;\n for (var i = 0; i < this.individuals.length; i++) {\n if (maxFit <= this.individuals[i].fitness) {\n maxFit = this.individuals[i].fitness;\n maxFitIndex = i;\n }\n }\n // console.log(maxFitIndex);\n // this.fittest ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get URL of Album List page. | function getAlbumListUrl(world) {
const root = world.getRoot();
let url;
if (root) {
// Parent's Albums tab.
url = `${root}/albums`;
} else {
// Main Album List page.
url = world.routes.albums;
}
return url;
} | [
"function getAlbumListUrl(world) {\n const root = world.getRoot();\n let url;\n if (root) {\n // Parent's Albums tab.\n url = `${root}/albums`;\n } else {\n // Main Album List page.\n url = routes.albums;\n }\n return url;\n}",
"latestAlbumUrl() {\n\t\treturn this.stack.apiUrl + \"/latest-album\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renders the AWS CloudFormation properties of an `AWS::Serverless::Api` resource | function cfnApiPropsToCloudFormation(properties) {
if (!cdk.canInspect(properties)) {
return properties;
}
CfnApiPropsValidator(properties).assertSuccess();
return {
StageName: cdk.stringToCloudFormation(properties.stageName),
AccessLogSetting: cfnApiAccessLogSettingPropertyToClo... | [
"renderProperties(x) { return ui.divText(`Properties for ${x.name}`); }",
"function versionResourcePropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n VersionResourcePropsValidator(properties).assertSuccess();\n return {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function that selects a particular flight from the list | async selectFlight(flight) {
console.log(flight)
var url = "https://flightstats.glitch.me/flex/flightstatus/rest/v2/json/flight/status/" + flight.carrierFsCode + "/" + flight.flightNumber + "/arr/" + this.year + "/" + this.month + "/" + this.day
var myHeaders = new Headers({})
var fetchData = {
method: ... | [
"function selectFlight(flightId) {\n selected = flightId;\n // color selected flight in list:\n const list1 = document.getElementById('list1');\n const list2 = document.getElementById('list2');\n colorList(list1, flightId);\n colorList(list2, flightId);\n // delete previous details from details table:\n if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Simple Proof of Work Algorithm: Find a number p' such that hash(pp') contains leading 4 zeroes, where p is the previous p' p is the previous proof, and p' is the new proof | proofOfWork(lastProof) {
let proof = 0;
while (!Blockchain.validProof(lastProof, proof)) {
proof += 1;
}
return proof;
} | [
"async function hashProof(proof, progress) {\n // Get the text to be hashed over\n const text = proof['text'] || KNOWN_TEXTS[proof['textId']]\n \n // And the timestamp text\n const timestamp = proof['timestamp']\n \n // And the user nonce\n const petitioner = proof['petitioner']\n \n // And the iteration ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
8 Function to set Format of Number | function setFormat(num) {
return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
} | [
"function format(number){\n if(number<10){\n return '0' + number;\n }\n else{\n return number;\n }\n }",
"formatNumber (format: string, number: number): string {\n return numeral(number).format(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given a list of institutions, create units of html for each of them | function buildList(institutions) {
$('#institutions')
.empty()
.append(
makeInstitutionsLabel(institutions),
makeInstitutionsList(institutions)
)
addInstitutionsToInput()
} | [
"function outputMultipleInstitutions(parents) {\n var content = \"\";\n for (var i = 0; i < parents.length; i++) {\n var obj = parents[i];\n // use name of institution from first collection\n if (obj instanceof Array) {obj = obj[0]}\n // skip collections with no institution\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
var testChoice = choiceShuffle() //tester | function choiceShuffle() {
let rand = randomizer(2)
if ( rand == 1 ) {
return {
'rand': 1,
'ca1' : 'a',
'ca2' : 'b'
}
} else
if ( rand == 2 ) {
return {
'rand': 2,
'ca1' : 'b',
'ca2' : 'a'
}
}
} //tester | [
"function MachineChoice(){\r\n\r\n return choices[RandomChoice()];\r\n\r\n}",
"function shuffleFunc() {\n\tresetFunc();\n\tshuffle();\n}",
"setShuffle() {\n setShuffle();\n }",
"function shuffle2() {\n return shuffle(this);\n}",
"getCorrectChoice() {\n return this.getShuffledChoice(0);\n }",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Change the state of the button and expandBlock when the button is clicked. | handleExpand() {
if (this.state.button === "+") {
this.setState({ button: "-", expandBlock: "block" });
} else {
this.setState({ button: "+", expandBlock: "none" });
}
} | [
"_expand() {\n if (!this._showState) {\n select(this._button)\n .style(\"display\", \"none\");\n select(this._container)\n .selectAll('svg')\n .style(\"display\", \"block\");\n select(this._closeButton)\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Allows access to the web's all properties collection | get allProperties() {
return this.clone(SharePointQueryableInstance, "allproperties");
} | [
"function getAllProperties() {\n return PropertyService.getAllProperties().then(function (allProperties) {\n vm.allProperties = allProperties;\n });\n }",
"function getProperties() {\n return properties;\n }",
"function all(options, callback) {\n core.api... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a dependency entry for the specified code. | static createEntry(name, pack, code) {
return `"${name}":{pack:${pack ? 'true' : 'false'}, invoke:function(exports, require){${code}}}`;
} | [
"static createEntry(name, pack, code) {\n return `\"${name}\":{pack:${pack ? 'true' : 'false'}, invoke:function(module, exports, require){\\n${code}\\n}}`;\n }",
"createDependency(data) {\n const source = data.source,\n target = data.target,\n fromSide = data.sourceTerminal.dataset.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render JSON data getting from server and render to html table Will render for: 1. ordered data 2. shipping data 3. delivered data | function renderTableData (data) {
// JAX-RS serializes an empty list as null, and a 'collection of one' as an object (not an 'array of one')
var list = data == null ? [] : (data.orders instanceof Array ? data.orders : [data.orders]);
var table = $ ('#orderTbl').DataTable ();
// var shippingTable = $('#s... | [
"function RackDetailedTableContent(jsonData,html){\n\n\n\tfor (a=0; a< jsonData.root.row.length; a++){\n\t\thtml += \"<tr class='trStat' id='\"+jsonData.root.row[a].ProductIdentifier+\"'>\";\n\t\tvar ProductIdentifier = jsonData.root.row[a].ProductIdentifier;\n\t\tif (ProductIdentifier == ''){\n\t\t\tProductIdentif... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add tracks to playlist. Operation is batched to adhere to rate limits. | async function addAllTracksToPlaylist (uid, pid, tracks) {
try {
const spotify = createSpotify()
// Batch size.
const limit = 100
while (tracks.length) {
const batch = tracks.splice(0, limit)
// Add tracks.
await spotify.addTracksToPlaylist(uid, pid, batch)
.catch(e => consol... | [
"async function addTracksToPlaylist(playlist, trackPositions) {\n for (const { pos, ids } of trackPositions) {\n for (const tracks of chunk(ids.map(id => `spotify:track:${id}`), 100).reverse()) {\n await request(\"POST\", `https://api.spotify.com/v1/users/${playlist.owner.id}/playli... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Updates the internal data "config" with values given by external "value" | updateInternalConfig () {
// If the given external and internal configs are the same, do nothing
if (_.isEqual(this.config, this.value)) return
// Go through all config keys defined on *this* chart
// All other elements of config will be ignored
_.each(this.config, (val, key) => {
... | [
"function updateConfig(key, value) {\n\t\tconfig[key] = value;\n\t}",
"function setConfig(config, value){\n var newConfig = Object.assign({},config);;\n newConfig.valueField = value;\n return newConfig;\n }",
"async setConfig(value) {\n await this.store.update({type: 'config', plugin:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that blocks with one field have the text cursor style. | function test_oneFieldBlock_blockCursorStyleIsText() {
svgTest_setUp();
try {
var block = svgTest_newOneFieldBlock();
assertEquals('text', block.getSvgRoot().style.cursor);
} finally {
svgTest_tearDown();
}
} | [
"function test_twoFieldBlock_fieldCursorStyleIsText() {\n svgTest_setUp();\n\n try {\n var block = svgTest_newTwoFieldBlock();\n\n assertEquals('text', block.getField('FIELD').getSvgRoot().style.cursor);\n } finally {\n svgTest_tearDown();\n }\n}",
"function validateCursor (text) {\n var pipes = tex... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Examples: isSubsequece('hello', 'hello world'); // true isSubsequece('sing', 'sting'); // true isSubsequece('abc', 'abracadabra'); // true isSubsequece('abc', 'acb'); // false (order matters) Your solution MUST have AT LEAST the following complexities: Time Complexity O(N + M) Space Complexity O(1) My Solution | function isSubsequece(string1, string2) {
if(string1.length > string2.length) {
return false;
}
let j = 0;
let i = 0;
while(j < string2.length) {
if(string1[i] === string2[j]) {
j++;
i++;
}
if(string1[i] !== string2[j]) {
j++;
}
if(i === strin... | [
"function isSubsequence(inputSubsequence, inputArray) {\n\tlet subsequenceIndex = 0;\n\tinputArray.forEach((inputElem) => {\n\t\tif (subsequenceIndex < inputArray.length && inputElem === inputSubsequence[subsequenceIndex]) {\n\t\t\tsubsequenceIndex += 1;\n\t\t}\n\t});\n\treturn subsequenceIndex === inputSubsequence... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets or sets the channel with which to synchronize. Synchronization is the coordination of zooming, panning and crosshairs events between multiple charts. Multiple chart controls can be synchronized horizontally (along XAxis), vertically (along YAxis), or both. If you want to synchronize a set of charts, assign them th... | get syncChannel() {
return this.i.syncChannel;
} | [
"configureSynchronization() {\n\n // the reflect syncronizer is just interpolate strategy,\n // configured to show server syncs\n let syncOptions = this.options.syncOptions;\n if (syncOptions.sync === 'reflect') {\n syncOptions.sync = 'interpolate';\n sy... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Builds a URI string from alreadyencoded parts. No encoding is performed. Any component may be omitted as either null or undefined. | function _buildFromEncodedParts(opt_scheme,opt_userInfo,opt_domain,opt_port,opt_path,opt_queryData,opt_fragment){var out=[];if(opt_scheme!=null){out.push(opt_scheme+':');}if(opt_domain!=null){out.push('//');if(opt_userInfo!=null){out.push(opt_userInfo+'@');}out.push(opt_domain);if(opt_port!=null){out.push(':'+opt_port)... | [
"function _buildFromEncodedParts(opt_scheme,opt_userInfo,opt_domain,opt_port,opt_path,opt_queryData,opt_fragment){var out=[];if(opt_scheme!=null){out.push(opt_scheme+\":\")}if(opt_domain!=null){out.push(\"//\");if(opt_userInfo!=null){out.push(opt_userInfo+\"@\")}out.push(opt_domain);if(opt_port!=null){out.push(\":\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
_______________________________________________________// getCredits function // to give ajax request for Credits, get the credits json and show it in the popover box | function getCredits() {
//to close CGPA's popver box in case if it is open
$('#cgpa_btn').popover('hide');
//if there is no successful ajax request-response for Credits
if(credits == Infinity) {
//sending ajax request to '/credits'
var request = $.ajax({
url: window.location.pathname + ... | [
"function renderCredits(data){\n\tfor(i = 0; i < data.length; i++){\n\t\t$(\"#js-credits-holder\").append(`<p>${data[i].artist}</p>`);\n\t}\n}",
"function retrieveCreditCardsAsync(id)\n{\n $.ajax({\n \"type\":\"GET\",\n \"url\":\"auth/CreditCards\",\n \"success\":function(data)\n {\n visualizeCr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
crossfilterServer.dimension.filterRange(range) Filters records such that this dimension's value is greater than or equal to range[0], and less than range[1], returning this dimension. For example: ```js countries.filterRange(["Belgium", "France"]); // selects countries beetween "Belgium" and "France" ``` Calling filter... | function filterRange(range) {
emptyDatasets();
return filterFunction(function(d) {
return d >= range[0] && d <= range[1];
});
} | [
"function filterRange(range) {\n return filterIndexBounds((refilter = crossfilter_filterRange(bisect, range))(values));\n }",
"function filterRange(range) {\n return filterIndexBounds((refilter = crossfilter_filterRange(bisect, range))(values));\n }",
"function filterRange(range) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Semigroup returning the leftmost `Left` value. If both operands are `Right`s then the inner values are concatenated using the provided `Semigroup` | function getApplySemigroup(S) {
return T.getSemigroup(E.getApplySemigroup(S));
} | [
"function getSemigroup() {\n return {\n concat: concat\n };\n}",
"function getDualSemigroup(S) {\n return {\n concat: function (x, y) { return S.concat(y, x); }\n };\n}",
"function getSemigroup(S) {\n return T.getSemigroup(E.getSemigroup(S));\n}",
"function getTupleSemigroup() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Called by .run Function to make the POST request to the Clarifai API using credentials somehow INPUTS: imgurl the url of the image to be parsed for color | function postImage(imgurl, token) {
var data = {
'url': imgurl
};
// Changed url to use color model instead of regular tag
return $.ajax({
'url': 'https://api.clarifai.com/v1/color',
'headers': {
'Authorization': 'Bearer ' + token
},
'data': data,
... | [
"function postImageColor(imgurl, token) {\n var data = {\n 'url': imgurl\n };\n\n // Changed url to use color model instead of regular tag\n return $.ajax({\n 'url': 'https://api.clarifai.com/v1/color',\n 'headers': {\n 'Authorization': 'Bearer ' + token\n },\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
able/disable addBtn based on value of user input | function changeAddBtn(){
if(userSnack.value.length > 0 && userDescription.value.length > 0){
addBtn.disabled = false;
} else if (userSnack.value.length < 1 || userDescription.value.length < 1){
addBtn.disabled = true;;
}
} | [
"function enable()\n{\n if(input.value!=\"\"){\n addBtn.removeAttribute(\"disabled\");\n }\n else{\n addBtn.setAttribute(\"disabled\", null);\n }\n}",
"function manageAddButton(){\n\n\n\tif(temp>0){\n\n\t\tdocument.getElementById(\"submit_btn\").disabled=false;\n\n\t}else{\n\n\t\tdoc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method: versionBoilerplateGulpfile Parent: version the gulpfile. Parameters: (string) inputPath Path to wpdtrtpluginboilerplate/ (string) outputPath Path to wpdtrtpluginboilerplate/ output directory (object) packageBoilerplate A reference to the package.json file Returns: (array) src files Output: ./gulpfile.babel.js T... | function versionBoilerplateGulpfile(
inputPath,
outputPath,
packageBoilerplate
) {
const files = `${inputPath}gulpfile.babel.js`;
const { version } = packageBoilerplate;
const re = new RegExp(
/(\* @version\s+)([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/
);
logFiles( files );
retu... | [
"function versionBoilerplateSrcPlugin(\n inputPath,\n outputPath,\n packageBoilerplate,\n packageVersionBoilerplateNamespaced\n ) {\n const files = `${inputPath}src/Plugin.php`;\n const { version } = packageBoilerplate;\n const versionNamespaceSafeStr = packageVersionBoilerplateNamespaced;\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
pwGetCurrentSelection() Fills currentSelection with ids of all selected products | function pwGetCurrentSelection() {
if($('#filter input[type=checkbox]').is(':checked')) {
var vals = pwGetColVals(null, 'category');
vals = pwGetColVals(vals, 'volume');
vals = pwGetColVals(vals, 'type');
vals = pwGetColVals(vals, 'location');
vals = pwGetColVals(vals, 'shape');
... | [
"function getCurrentSelections() {\n\t\t\t\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t\t\t\tapp.createGenericObject({\n\t\t\t\t\t\t\t\tcurrentSelections: {\n\t\t\t\t\t\t\t\t\tqStringExpression: \"=GetCurrentSelections('', '', '', 100)\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}, function (reply) {\n\t\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Maptimize.Proxy.GoogleMapgetZIP(placemark) > String placemark (Object): object representing Google Map placemark (get by calling getPlacemarks) Returns ZIP (postal code) name of a placemark. Returns an empty string if not found. | function getZIP(placemark) {
return _getPlacemarkAttribute(placemark, 'PostalCodeName');
} | [
"function getAddress(placemark) {\n return placemark.address;\n }",
"function getCountry(placemark) {\n return _getPlacemarkAttribute(placemark, 'CountryName');\n }",
"function getCity(placemark) {\n return _getPlacemarkAttribute(placemark, 'LocalityName');\n }",
"function getLng(placemark) {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
OpType.mapType create a map that could resolve the operation types. The operation types are encoded as numbers in update_metadata.proto and must be decoded before any usage. | constructor() {
let /** Array<{String: Number}>*/ types = update_metadata_pb.InstallOperation.Type
this.mapType = new Map()
for (let key in types) {
this.mapType.set(types[key], key)
}
} | [
"constructor() {\n let /** Array<{String: Number}>*/ types =\n update_metadata_pb.CowMergeOperation.Type\n this.mapType = new Map()\n for (let key in types) {\n this.mapType.set(types[key], key)\n }\n }",
"function _convertMap(map) {\n let retMap = new Map();\n map.forEach((av, p) => ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make sure the CSS variables are set (Chrome hack for styling progress track) when the props are updated | componentDidUpdate() {
this.setCSSVariables();
} | [
"_setCSSVariables() {\n this.sliderElement.style.setProperty(\n \"--card-width\",\n `${this.cardWidthValue}${this.cardWidthUnits}`\n );\n this.sliderElement.style.setProperty(\n \"--num-visible-cards\",\n this.numVisibleCards\n );\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Options for the form, including validation options | options() {
return {
validateOnInit: false,
validateOnChange: true,
showErrors: true
};
} | [
"_setFormOptions () {\n this.formOptions = {\n limit: this._get('limit'),\n strict: this._get('strict')\n }\n }",
"_getFormOptions() {\n return {\n error: this.state.errors,\n fields: {\n tipo_de_documento__c: {\n label: 'Document Type'\n },\n notes__c: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
send ajax request and check dates | static checkAndPaintDays(url,date) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
let a = JSON.parse(this.response);
Infrastructures.checkWeekDates("#calendar_content div", date,... | [
"function request_notify_winners(){\r\n var date_range = $('[custom=\"range\"]').text();\r\n date_range = date_range.search('|') > 0 ? date_range : (current_date() == date_range ? 'current' : date_range);\r\n /* get user action confirmation */\r\n var r=confirm(\"Are you sure to notify winners? Once not... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Authentication and WebID profile retrieval | async function loadProfile(webId) {
try {
var rc = await fetchProfile(webId);
if (!rc)
return null;
var uriObj = new URL(webId)
uriObj.hash = uriObj.search = uriObj.query = '';
var base = uriObj.toString()
const kb = $rdf.graph()
$rdf.parse(rc.profile, kb, base, rc.content_type);
... | [
"function getProfile() {\n if (!userProfile) {\n var accessToken = localStorage.getItem('access_token');\n\n if (!accessToken) {\n console.log('Access token must exist to fetch profile');\n }\n\n webAuth.client.userInfo(accessToken, function(err, pro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Function: setStoreListBlind parameters : response > blind list data display blind store list data | function setStoreListBlind(response) {
// Ti.API.info('set stringlist blind'+JSON.stringify(response));
var storeList = response;
var blindListData = [];
blindListLocationData = [];
var emptyBlindList = true;
$.listSection2.setItems(blindListData);
_.each(storeList, function(value, k) {
... | [
"function onSaveWhiteList() {\n var wList = document.getElementById(\"whiteListAbURI\");\n var wlArray = [];\n\n for (let i = 0; i < wList.getRowCount(); i++) {\n // Due to bug 448582, do not trust any properties of the listitems\n // as they may not return the right value or may even not exist.\n // Al... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
definition of the results controller function itself. Taking quizMetrics as an argument | function ResultsController(quizMetrics, DataService){
var vm = this;
/*
* The pattern used in the controllers in this app puts all the
* properties and methods available to the view at the top of the
* function. Any methods are referenced as named functions which are
... | [
"function ResultsController(quizMetrics, DataService){\n var vm = this;\n\n /*\n * The pattern used in the controllers in this app puts all the \n * properties and methods available to the view at the top of the \n * function. Any methods are referenced as named functions which... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Given an event, returns another event which only fires once. | function once(event) {
return (listener, thisArgs = null, disposables) => {
// we need this, in case the event fires during the listener call
let didFire = false;
let result = undefined;
result = event(e => {
if (didFire) {
retu... | [
"function once(event) {\n return (listener, thisArgs = null, disposables) => {\n // we need this, in case the event fires during the listener call\n let didFire = false;\n let result;\n result = event(e => {\n if (didFire) {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
adds a Path to the Engine World | function addToWorld(path){
var vertices = paper2matter(path);
var body = Bodies.fromVertices(path.bounds.center.x, path.bounds.center.y, vertices);
if(body !== undefined){ //path with too few points can not be made to a body
body.friction = friction;
body.frictionStatic = staticFriction;
body.density = d... | [
"appendPath(path) {\n if (path) {\n let currentPath = this.getPath();\n if (currentPath) {\n if (!currentPath.endsWith(\"/\")) {\n currentPath += \"/\";\n }\n if (path.startsWith(\"/\")) {\n path = path.s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
FUNCTION: checkIfScriptExists DESCRIPTION: ARGUMENTS: RETURNS: | function checkIfScriptExists(theId, cfTag, aPatt, aVal, bPatt, bVal) {
var dom = dw.getDocumentDOM();
var retVal = false;
var patt = getServerData("patt",theId);
if (aPatt) patt = patt.replace(RegExp(aPatt,"g"),aVal);
if (bPatt) patt = patt.replace(RegExp(bPatt,"g"),bVal);
nodes = findNodes(dom, cfTag);
f... | [
"function script_exists(url) {\n\treturn document.querySelectorAll('script[src=\"' + url + '\"]').length > 0;\n}",
"hasScript(name) {\n return name in this.scripts;\n }",
"async validateScriptPath() {\n\t\t// Check against the local files\n\t\tif( this.testCodeDir != null ) {\n\t\t\tlet check = await ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removing Card on Unfollow | function removeCard(id, obj) {
$(obj).html(spinner);
company_cards_present = company_cards_present.filter(function (e) {
return e !== parseInt(id);
});
fetchData(
`http://${hostname}/corpann/api/unfollow/?company=${id}`,
checkUnfollowStatus
);
} | [
"function ProfileCardUnFollow(){\n PeopleService.UnFollow($rootScope.UserCard.id)\n .then(\n resolve => {\n $rootScope.UserCard.fav = false ;\n $rootScope.User.favs = resolve.data ;\n }\n );\n }",
"removeCard() {\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
endAddParamsetObjects Get value paramsets and add them | async function getValueParamsets(valueParamsets) {
for (const obj of valueParamsets) {
try {
const cid = `${obj.native.PARENT_TYPE}.${obj.native.TYPE}.${obj.native.VERSION}`;
adapter.log.debug(`getValueParamsets ${cid}`);
// if meta values are cached for E-paper we extend... | [
"async getValueParamsets(valueParamsets) {\n for (const obj of valueParamsets) {\n try {\n const cid = `${obj.native.PARENT_TYPE}.${obj.native.TYPE}.${obj.native.VERSION}`;\n this.log.debug(`getValueParamsets ${cid}`);\n // if meta values are cached for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The classes of the framework ///////////////////////////////////////////////////////////////////////////// The Efw class | function Efw() {
} | [
"function CEEE_Class() {\n /** @const */ this.TAB_STATUS_LOADING = 'loading';\n /** @const */ this.TAB_STATUS_COMPLETE = 'complete';\n\n // Internal constants used by implementation.\n /** @const */ this.API_EVENT_NAME_ = 'ceee-dom-api';\n /** @const */ this.API_ELEMENT_NAME_ = 'ceee-api-element';\n /** @cons... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
set the name of the channel to listen for the message on | setChannelName (callback) {
// we'll listen on our me-channel, but no message should be received since we're not a member of the stream
this.channelName = `user-${this.currentUser.user.id}`;
callback();
} | [
"setChannelName (callback) {\n\t\t// listen on the current user's me-channel, they should get a message that they have been\n\t\t// added to the team\n\t\tthis.channelName = `user-${this.currentUser.user.id}`;\n\t\tcallback();\n\t}",
"setChannelName (callback) {\n\t\t// expect on the \"everyone\" team channel\n\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Read the module EVs and store them in the module data structure. enn/en are the event identification | function evEditorRead(nn, enn, en) {
// start reading the EVs
learn(nn);
var req = {direction:'tx', message:':S0FC0NB2'+number2hex4(enn)+number2hex4(en)+'01;'};
console.log("req="+req+" req.direction="+req.direction);
gcSend(req);
} | [
"function evEditorWrite(nn, enn, en) {\n\tconsole.log(\"Writing all EVs\");\n\tvar module = findModule(nn);\n\tif (module == undefined) return;\n\tif (module.evsperevent == 0) return;\n\t\n\tvar event = findEvent(module, enn, en);\n\t\n\tlearn(nn);\n\t// start writing the first vv\n\t// This uses globals which mean... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return all online connections regardless of type. | get onlineConnections() {
const online = [];
this.connections.forEach((connections) => {
connections.forEach((connection) => {
if (typeof connection.offline === "undefined") {
online.push(connection);
}
... | [
"getAll() {\n return this.connections;\n }",
"getOnlineClients() {\n return r.db(this.opts.db)\n .table(this.table)\n .filter({ online: true })\n .run(this.opts.conn)\n .then(cursor => cursor.toArray());\n }",
"getOpenConnections() {\n\t\treturn th... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
These parameters are named like such in order to support PreLoadJS and the loadfile/loadmanifest methods id: an id used to identify the asset src: path to download the asset | function Asset(id, src) {
this.id = id;
this.src = src;
} | [
"LoadAsset() {}",
"loadAssets(id, callback) {\r\n\t\tthis.downloadPage(id, callback);\r\n\t}",
"LoadAssetWithSubAssets() {}",
"load(file, params) {\n\t\tvar ext = Path.extname(file) || '';\n\t\tvar slotName = _beforeLast(Path.basename(file), '.').toLowerCase();\n\t\tif (ext in Bundler.mime) {\n\t\t\treturn as... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render a new `SVGElement` for a given `IconDefinition`, or make a copy from cache. | _loadSVGFromCacheOrCreateNew(icon, twoToneColor) {
let svg;
const pri = twoToneColor || this._twoToneColorPalette.primaryColor;
const sec = getSecondaryColor(pri) || this._twoToneColorPalette.secondaryColor;
const key = icon.theme === 'twotone'
? withSuffixAndColor(icon.name,... | [
"getIcon(){\n if( !this.props.icon ){\n return;\n }\n let props = {\n key:'icon',\n size:'intrinsic',\n outline: this.props.outline,\n color: ( this.state.focus ? this.getHighlightColor() : this.getTextColor() ),\n };\n if( this.props.icon instanceof Function ){\n let Ic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a price radio button | function createPriceSection() {
const section = document.querySelector('.section');
for (let i = -4; i < 5; i++) {
const input = document.createElement('input');
const label = document.createElement('label');
input.setAttribute('value', price + i);
input.setAttribute('name', 'price');
input.s... | [
"function newProduct_2_7_radioBtn(rdoName, rdoValue, checked){\n var label = document.createElement(\"label\");\n var radio = document.createElement(\"input\");\n radio.type = \"radio\";\n radio.name = rdoName;\n // radio.checked = (rdoValue == \"1\")? true:false;\n if(checked){\n radio.se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Prompt Object to show id when hover | function showID(object) {
$(object).hover(
function () {
var pc_name = $(this).attr('id');
$(this).append($("<span class = \"pc-name\">" + pc_name + "</span>"));
},
function () {
$(this).find("span:last").remove();
}
... | [
"interactHover(obj) {\n if (obj.object.state === 'idle') {\n obj.object.material.color.setHex(obj.object.hoverColor);\n }\n }",
"isHover(id) {}",
"function mouseOver(elem) {\n let place = (elem.id);\n console.log(place);\n addColor(place);\n return place;\n}",
"function hover() {\n co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If the hotspot did not have a side or anchor originally, they will be removed. | _removeContentPosition() {
if (this.side === null) {
this.wrapper.classList.remove(
settings.ClassName.HOTSPOT_LEFT,
settings.ClassName.HOTSPOT_RIGHT,
);
}
if (this.anchor === null) {
this.wrapper.classList.remove(
settings.ClassName.HOTSPOT_TOP,
settings.C... | [
"function destroyHotSpots() {\n var hs = config.hotSpots;\n hotspotsCreated = false;\n delete config.hotSpots;\n\n if (hs) {\n for (var i = 0; i < hs.length; i++) {\n var current = hs[i].div;\n\n if (current) {\n while (current.parentNode && current.parentNode... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
[ServerObject] getAsServerTurnoutObject() Return PanelTurnout as a server object, preset as a get (null state) | function getAsServerTurnoutObject()
{
var turnoutAddr = this.getDCCID();
return new ServerObject(JMRI_TURNOUT_OBJID_PREFIX + turnoutAddr, SERVER_TYPE_TURNOUT, getTurnoutState(turnoutAddr));
} | [
"function PanelTurnout(normalRouteID, divergingRouteID)\n{\n this.normalRouteID = normalRouteID;\n this.divergingRouteID = divergingRouteID;\n\t\n\tthis.getInstanceID=getInstanceID;\n this.getDCCID=getDCCID;\n this.getAsServerObject= getAsServerTurnoutObject;\n this.getSVGState=getSVGState;\n this... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Authenticate balenaSDK with API key | async authenticate(apiKey) {
await this.sdk.auth.loginWithToken(apiKey);
console.log(`Logged in with ${await this.sdk.auth.whoami()}'s account using balenaSDK`);
} | [
"function jbauthenticate(appid,apikey,callback) {\n dbt.authenticate(appid,apikey,function(result) {\n if(result) { // api key is valid so create token\n const token = jbt.createToken(appid);\n ActiveTokens[token.access_token] = new Object({\"app_id\":appid,\"expires\":token.expires});\n callbac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A formatter which may shorten hostnames. Returns null if the formatter won't shorten the hostname. Registers a host formatter for nuclideUriToDisplayString | function registerHostnameFormatter(formatter) {
hostFormatters.push(formatter);
return {
dispose: () => {
const index = hostFormatters.indexOf(formatter);
if (index >= 0) {
hostFormatters.splice(index, 1);
}
}
};
} | [
"getHost() {\n let host = super.getAsNullableString(\"host\");\n host = host || super.getAsNullableString(\"ip\");\n return host;\n }",
"function prettifyHost(host) {\n return host === '::' ? 'localhost' : host;\n}",
"function nuclideUriToDisplayString(uri) {\n _testForIllegalUri(uri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
retrieves correct image for current featured person and updates DOM | function updateFeaturedImage() {
var $parentEl = $(".image-block");
var $el = $parentEl.children().first().next();
var featuredImageSource = currentFeaturedPerson.imageSource;
var featuredPersonFirstName = currentFeaturedPerson.personInfo.name.split(" ")[0];
var imageHTML = "<img src='" +
fe... | [
"function doFetchFeaturedImage() {\n $.post(ajaxurl, {\n action : 'dgd_get_featured_image',\n post_id: dgd_post_id\n }, function (response) {\n\n // Parse response AS JSON:\n var response = $.parseJSON(response);\n // Valid response:\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create an angle sweep from strongly typed start and end angles | static createStartEnd(startAngle, endAngle, result) {
result = result ? result : new AngleSweep();
result.setStartEndRadians(startAngle.radians, endAngle.radians);
return result;
} | [
"static angle(start, end) {\n var tDot = start.x * end.x + start.y * end.y;\n var tDet = start.x * end.y - start.y * end.x;\n var tAngle = -Math.atan2(tDet, tDot);\n return tAngle;\n }",
"static createStartEndDegrees(startDegrees = 0, endDegrees = 360, result) {\n return Angl... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete a habit from habitList and append to deletedHabits | async function deleteHabit(_, args) {
const db = getDb();
// save deleted habit
const deleteObject = await db
.collection("users")
.findOneAndUpdate(
{ email: args.email },
{ $pull: { habitList: { _id: ObjectID(args._id) } } },
{ returnOriginal: true }
);
// Get the deleted habit ... | [
"removeHabit(habit){\n\t\tremoveFromArray(this.habits, habit);\n\t}",
"function deleteHabit(habit) {\n const options = {\n method: \"DELETE\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer \" + tokenService.getToken()\n },\n body: JSON.stringify(habit)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |