query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
/ ajax_populate_object() / send request to get all schemas. / this function sends a request to get / the schemas that are linked to the / selected form. the handler for the / request sends a second req for the / unlinked schemas
function ajax_populate_schemas(){ var form_list = document.getElementById('form_list'); // clear linked and unlinked schema // lists when first option is chosen. // note - first option is a dummy option // 'Select a Form' if (form_list.selectedIndex == 0){ var blank_xml = "<?xml version=\"1.0\" encoding=\"ISO-...
[ "function handler_ajax_populate_schemas(){\n\tif(xmlHttp.readyState == 4 && xmlHttp.status == 200){\n\t\t// populate 'linked' select list\n\t\tpopulate_list_from_xml(xmlHttp.responseText, 'linked_schema_list');\n\t\t// now that this request is complete,\n\t\t// send another request to get unlinked schemas\n\t\tcrea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new menu button with the provided string label Has an initial value initVal and ranges between minVal and maxVal. isInt should be set to true of the value is integer. updateCallback is called to report a value entered. updateCallback is called once by this constructor and then each time the value changes.
constructor(label, initVal, minVal, maxVal, isInt, updateCallback){ super(); this.label = label; this.val = initVal; this.minVal = minVal; this.maxVal = maxVal; this.isInt = isInt; this.updateCallback = updateCallback; this.updateCallback(this.val); this.w = 1; this.h = 0.2; // Create canvas that will dis...
[ "function createSlider({label, min,max, defaultValue, step=1}) {\n\tSLIDERS[label] = mainP5.createSlider(min, max, defaultValue, step)\n\n\tlet controls = document.getElementById(\"controls\")\n\tlet holder = document.createElement(\"div\");\n\tholder.className = \"slider\"\n\tholder.innerHTML = label\n\n\t// Add t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Translates whatever is drawn in 'drawFunc' to (x, y)
function drawTranslated(x, y, drawFunc) { context.translate(x, y); drawFunc(); context.translate(-x, -y); }
[ "function trans(transx, transy)\n{\n // Use for loop to translate position by a certain amount\n for (var i = 1, size = positions.length; i <= size; i++)\n {\n // If odd, add x value\n if (i % 2 != 0)\n {\n positions[i-1] += parseFloat(transx);\n }\n // If even, add y value\n else\n {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compare the base estimate to the adjusted estimate
function updateAdjustedEstimate() { // Recalculate the estimate data $scope.selectedEstimate = $scope.truckCost * (1 + $scope.markupIncrements[$scope.selectedIndex]); }
[ "function updateDifference() {\n // Adjust the base estimate vs adjusted estimate difference\n $scope.adjustedPercentage = (($scope.selectedEstimate - $scope.baseEstimate) / $scope.baseEstimate) * 100;\n }", "function realEarnings(estimate,s) { //I set short parameters for the two\n var to...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete msg from other users
function deletemessagefromotherusers({ id }) { messagestore.map((msg, index) => { if (msg.id === id) { messagestore.splice(index, 1); } }) filteredmessages = messagestore; setchats([messagestore]) scrollmessages(); }
[ "async deleteMessagesOfUserFromLobby()\n\t{\n\t\tawait DB.q(`\n\t\t\tDELETE FROM c_messages\n\t\t\tWHERE created_by = ?\n\t\t\t\tAND lobby_id = ? ;\n\t\t`, [\n\t\t\tthis.user,\n\t\t\tthis.lobby,\n\t\t])\n\t}", "function delete_message(message) {\n admin_bot._api('chat.delete', {\n \"token\": admin_setti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pass this PointString3d to the handler's `handlePointString` method.
dispatchToGeometryHandler(handler) { return handler.handlePointString3d(this); }
[ "static create(...points) {\n const result = new PointString3d();\n result.addPoints(points);\n return result;\n }", "handleLineString3d(ls0) {\n if (this._geometry1 instanceof LineString3d_1.LineString3d) {\n const ls1 = this._geometry1;\n if (ls0.numPoints() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove preloader activate start button
letStart() { this._preloader.remove(); this._view.showButton(); }
[ "function hidePreloader() {\r\n\t\t\tslider.find('.preloader').stop().remove();\r\n\t\t}", "function _unloadPreloadPanle() {\r\n spinner = null;\r\n $(\".preloader\").hide();\r\n $(\".preloader-blocker\").hide();\r\n }", "deactivateStartButton() {\n const startButton =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluate a parameter in the given environment.
function evalParameter(param,env) { var pname = param.pname.trim(); var value; value = lookup(pname,env); if (value!==null) return value; // If we didn't find it, return the original syntax. return "{{{"+pname+"}}}"; }
[ "function eval_argument(env) {\r\n return env.get(\"___ARGUMENT___\")\r\n}", "function evaluateParameterDeclarations({ node, evaluate, environment, statementTraversalStack, typescript }, boundArguments, context) {\n // 'this' is a special parameter which is removed from the emitted results\n const parame...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fluRadio colorize nodes by flu symptom
function fluRadio(radio) { var sympArray = d3.values(symptom); var selectUI = d3.select("body") .selectAll("svg#graph") .selectAll("g") .selectAll("circle, rect") .style("fill", function (d) { if (radio.value == "sore" && sympArray[d.index].symp[0] == "1") { ...
[ "function colorStars() {\n conf.selectAll(\"label\")\n .style(\"color\", function (d) {\n var here = d3.select(this.parentNode.parentNode.parentNode.parentNode).attr(\"token_id\");\n if (!hasSense(here, type) ||\n d3.keys(text[type][here]).indexOf('confidence') === -1 ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends the "joinTable" task, that is a request to the server of this user to join in another table. If the user in already in a table, displays an error message. parameters: tableId (int): the table id.
function sendJoinTable(tableId) { if (sittedTable == null) { var task = new Task("joinTable"); task.table_id = tableId; task.guest_id = user.id; var jsonStringTask = JSON.stringify(task); webSocket.send(jsonStringTask); } else { displayError("Debes salir de la...
[ "static join(tableId, user) {\n if (!Tables.tables[tableId]) {\n console.log(`Cannot join to not existing table ${tableId}, \n user ${JSON.stringify(user)}`);\n return;\n }\n\n Tables.tables[tableId][user.uid] = user;\n }", "function handleJoinTableClick(e) {\n\tvar name = $(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when you refresh remove the select on radio button
function removeSelect(){ answerEls.forEach(x=>{ x.checked=false }) }
[ "resetSelections() {\n this.lastSelectedRadioButtonOption = null;\n this.setTabIndexes();\n this.options.forEach(option => {\n option.uncheck();\n option.enable();\n });\n }", "function cleanGroupSelected() {\n\tvar allRadios = document.getElementsByName('optradio');\n\tfor (var i = 0; i< a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show settings dialog from template above.
function showSettingsDialog() { var html = getSettings(); html.setWidth(400); html.setHeight(300); SpreadsheetApp.getUi() .showModalDialog(html, 'Fuzzy.ai Settings'); }
[ "function showSettings(){\r\n\t\tshowModal('settingsScreen');\r\n\t\tesc = closeSettings;\r\n\t}", "showSettings() {\n this.show('Header');\n HeaderTemplate.showLogo();\n this.show('Avatar');\n this.show('UploadAvatar');\n this.show('EditNickname');\n this.show('EditEmail...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add/edit competition FeeDeatils Action
function add_editcompetitionFeeDeatils(data, key) { return { type: ApiConstants.API_ADD_EDIT_COMPETITION_FEES_DETAILS, data, key, }; }
[ "function getAllCompetitionFeesDeatilsAction(\n competitionId,\n hasRegistration,\n sourceModule,\n affiliateOrgId,\n yearRefId,\n isEdit,\n) {\n return {\n type: ApiConstants.API_GET_COMPETITION_FEES_DETAILS_LOAD,\n competitionId,\n hasRegistration,\n sourceModule,\n affiliateOrgId,\n year...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch custom sample names and replace the default names.
function fetch_sample_names() { var input_id = 'name_input_SAMPLEID'; var valid = true; var names = {}; for (var id in proj.samples) { var input = $('#' + input_id.replace('SAMPLEID', id)); var val = input.val(); input.removeClass('is-invalid'); // If the input is empty, just use default (i.e....
[ "get defaultSampleSettings() {}", "function applyDefaultNamesData() {\n // name, method, min length, max length, letters to allow dublication, multi-word name rate\n nameBases = [ // min; max; mean; common\n {name: \"German\", method: \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
main function for moment normalization
function momentNormalize() { newHeight = 256; newWidth = 256; xMin = 256; xMax = 0; yMin = 256; yMax = 0; // first determine drawn character width / length for(var i = 0;i<recordedPattern.length;i++) { var stroke_i = recordedPattern[i]; for(var j = 0; j<stroke_i.length;j++) { x = stroke_i...
[ "function normalization() {\n data.forEach(function (sample, p) {\n sample.forEach(function (variable, v) {\n let numNonNegative = 0;\n var svariable = variable.filter(function (d) {return d !== - Infinity});\n var mymax = Math.max(....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to check the format and assign the correct datatype for the ajax call
function datatypeHandler(format) { var dt; if (format == 'json') { dt = 'json'; } else if (format == 'xml') { dt = 'xml'; } else { dt = 'text'; } return dt; }
[ "function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={}, // Work with a copy of dataTypes in case we need to modify it for conversion\ndataTypes=s.dataTypes.slice(); // Create converters map with lowercased keys\nif(dataTypes[1]){for(conv in s.converters) {converters[conv.toL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throw if the action payload is not an array of update responses with valid keys (ids)
mustBeUpdateResponses(action) { const data = this.extractData(action); if (!Array.isArray(data)) { return this.throwError(action, `should be an array of entity updates`); } data.forEach((item, i) => { const { id, changes } = item; const id2 = this.sele...
[ "mustBeUpdates(action) {\n const data = this.extractData(action);\n if (!Array.isArray(data)) {\n return this.throwError(action, `should be an array of entity updates`);\n }\n data.forEach((item, i) => {\n const { id, changes } = item;\n const id2 = this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show chart at root DOM element of this component
_showChart() { if (this.isDestroyed || this.isDestroying) { return; } // destroy existing chart if any this._destroyChart(); // create and show the chart try { // get chart constructor options from properties and create the chart // TODO: tooltip as property const suppo...
[ "function displayChart() {\n clientWidth = document.querySelector('body').getBoundingClientRect().width * 0.7;\n drawChart(clientWidth);\n setChartTitles();\n document.querySelector('.chart-container').classList.add('displayed');\n document.querySelector('.output').scrollIntoView();\n}", "showGraphs(){\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
You are given money in nominal value of n with 1<=n<=1500. Try to find minimal number of notes that must be used to repay in dollars, or output 1 if it is impossible.
function solve (n) { const notes = [500, 200, 100, 50, 20, 10] let counter = 0 for (let i = 0; i < notes.length; i++) { while (n >= notes[i]) { n -= notes[i] counter += 1 } } if (n !== 0) { return -1 } return counter }
[ "function bigestDenomChange(payment, price) {\n// Keep track of the folllowing\n// how many bills we're receiving\n// remember denominations\n// find difference and keep track of it\n// keep track of which bills we're giving as change\n if (isNaN(payment) || isNaN(price)) {\n console.log(`Entered ${paymen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_calculateBlockIndex Based on the font metrics, compute the width of the strings and glyph that make up this block.
_calculateBlockIndex() { var curX = this.startX; var maxH = 0; let superXAlign = 0; let superXWidth = 0; let prevBlock = null; let i = 0; this.textFont.setFontSize(this.fontSize); this.blocks.forEach((block) => { // super/subscript const sp = this.isSuperscript(block); ...
[ "_calculateCharSize() {\n // Note: We calculate char size with every redraw. Size may change, for\n // example when any of the timelines parents had display:none for example.\n\n // determine the char width and height on the minor axis\n if (!this.dom.measureCharMinor) {\n this.dom.measureCharMinor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns array of values for xpath from XMLElement. xpath can contain attributes. Returned array could be empty
function getValues(element, xpath) { var values = []; var cacheKey = "getValues." + element.getName().getLocalName() + "." + xpath; if ( getCache().getItem(cacheKey) ) { values = getCache().getItem(cacheKey); } else { var elemPath = xpath.split("@")[0]; var attrName = xpath.split("@")[1]; var el...
[ "search(xpath) {\n var results = [];\n var xpathresults = document.evaluate(\n xpath, this.doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);\n for (var i = 0; i < xpathresults.snapshotLength; i++) {\n results.push(xpathresults.snapshotItem(i));\n }\n debug(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns which day of the week is the most profitable;
function mostProfitableDay(list){ //declaring and initialisation of necessary variables to be used; var listObject ={}; var profitable_day=""; var totalSales=0; for(var i=0;i < list.length;i++){ //check for specific day in an object of days; if(list[i].day in listObject){ //access sales ...
[ "function mostProfitableDepartment(salesData){\n var maxDep = 0;\n var daySales = {};\n var department;\n // Calculating totals with for-loop\n for (i in salesData){\n if(daySales[salesData[i].day] == undefined){\n daySales[salesData[i].day] = salesData[i].sales;\n }\n else {\n daySales[sale...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setter of the Client ID of application on
set clientId(value) { this._clientId = value; }
[ "setClientId(client_id) {\n this._client_id = client_id;\n }", "setClientId(clientId_) {\n clientId = clientId_;\n }", "function setAPP_ID(pApp) {\r\n\tAPP_ID = pApp;\r\n}", "function set_client_auth(env, id, auth_code) {\n env.auth.client = {\n id: id,\n auth_code: auth_code\n }\n}", "g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: support multiple fields for `on`
on(field) { return this.addOption('on', field); }
[ "on(first) {\n if (typeof first === 'object' && typeof first.toSQL !== 'function') {\n const keys = Object.keys(first);\n let i = -1;\n const method = this._bool() === 'or' ? 'orOn' : 'on';\n while (++i < keys.length) {\n this[method](keys[i], first[keys[i]]);\n }\n return th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validate the recipient registration form
function validateUserRegistrationForm() { console.log(`# validating recipient registration...`); }
[ "function receiverRegisterValidation(){\n\n\tvar email = document.getElementById(\"email\").value.trim();\n var password = document.getElementById(\"password\").value.trim();\n var cnfPassword = document.getElementById(\"cnfPassword\").value.trim();\n\tvar phone = document.getElementById(\"phone\").value.trim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines if the value is a reference element
function isReferenceElement(value) { return !!value._tippy && !matches.call(value, POPPER_SELECTOR); }
[ "function isReferenceElement(value) {\n return !!(value && value._tippy && value._tippy.reference === value);\n }", "function isReferenceElement(value) {\n return !!(value && value._tippy && value._tippy.reference === value);\n }", "function isReferenceElement(value) {\n return !!(value && value._t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to create the input element for capturing the Transition action Publishing State
function createTransitionActionPublishing(figure) { const userdata = figure.getUserData(); var publishing = ""; if (userdata !== undefined && userdata.actionPublishing !== undefined) { publishing = userdata.actionPublishing; } var html = '<br><p>Transition Actions<br>Define the state an item should be set, when ...
[ "createInput()\n\t\t{\n\t\t\tvar input = new E.Input();\n\t\t\tinput.setup(document.body);\n\t\t\treturn input;\n\t\t}", "function createInputWidgetNode() {\n var node = document.createElement('div');\n var prompt = document.createElement('span');\n prompt.className = STDIN_PROMPT_CLASS;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send text to and receive the converted img from backend call API params: text, refid internal params: imgContainer, uuid, type
function convertToImg(text, font_family, font_size, refid, $imgContainer, uuid, type) { if (text == "") { return; } console.log("convert to img"); var api = 'https://boosend.com/getImg'; $.ajax({ type: 'POST', url: api, crossDomain: true, withCredentials: true, data: { 'text': text, ...
[ "async textToImage(args, options) {\n const res = await this.request(args, {\n ...options,\n blob: true\n });\n const isValidOutput = res && res instanceof Blob;\n if (!isValidOutput) {\n throw new TypeError(\"Invalid inference output: output must be of type object & of instance Blob\");\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process KVM control channel data
function kvmCtrlData(channel, cmd) { if (cmd.length > 0 && cmd.charCodeAt(0) != 123) { // This is upload data if (this.fileupload != null) { cmd = Buffer.from(cmd, 'base64'); var header = cmd.readUInt32BE(0); if ((header == 0x01000000) || (header == 0x010000...
[ "function kvmCtrlData(channel, cmd) {\n if (cmd.length > 0 && cmd.charCodeAt(0) != 123) {\n // This is upload data\n if (this.fileupload != null) {\n cmd = Buffer.from(cmd, 'base64');\n var header = cmd.readUInt32BE(0);\n if ((header == 0x01000000) || (header == 0x0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
See internalAddFK for details. This function will start a new transaction by default, unless called from inside another transaction (given that the current API doesn't allow nested transaction). In that case, all operations will be executed in the current transaction. TODO: Move this to table creation
function createFK(remote, tableName, mapping) { return kv.runT(remote, function(tx) { return internalAddFK(tx, tableName, mapping); }); }
[ "enterAlterByAddForeignKey(ctx) {\n\t}", "async add_foreign_keys(){\n var query1 = null\n var query2 = null\n for(let field of Object.keys(this.fields)){\n\n if(this.fields[field].constraints[0] === 'FOREIGN KEY'){\n query1 = `ALTER TABLE ${this.table_name} ADD COLUMN ${field} ${this.fields[f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1 Using the varabile persons Create a function called avgAge that accept an array and return average age of this array Ex: avgAge(persons) => 41.2
function avgAge (arr) { // debugger var total = arr.reduce( (total, x) => { var y =x.age; return total+ y; }, 0 ) var avg = total/(arr.length); return avg; }
[ "function avgAge (persons){\nvar sum = persons.reduce((accu, current)=>{\n\treturn accu + current.age;\n},0);\nreturn sum/persons.length;\n}", "function averageAge (arr)\n{\n var sum = 0;\n for (var i = 0; i<arr.length ; i++)\n {\n sum = sum + arr[i].age;\n }\n var avg = sum / arr.length;\n return avg;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_show Hide the advertisement container
_show() { if (this.activeAdContainer) this.activeAdContainer.style.visibility = "visible"; }
[ "_show() {\n this.adContainer.style.display = 'block';\n setTimeout(() => {\n this.adContainer.style.margin = '0 0 1rem 0';\n this.adContainer.style.padding = '0 0 56.25% 0'; // 16:9\n this.adContainer.style.opacity = '1';\n }, 10);\n }", "_hide() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mana Regeneration Rate Class
function ManaRegenerationRate(level, amount, text) { //Mana regeneration rate is the affix which decreases the amount of time that it takes for the hero to regenerate mana Suffix.call(this); this.level = level; this.text = text; this.amount = _.random(amount[0], amount[1]); ...
[ "regenerateMana(amountToRegenerate){\n\n //Determine maximum\n let maxToRegen = this.props.stats_current.mana - this.props.mana_points;\n\n //If trying to regenerate more than maximum, only regen up to maximum\n let appliedAmountToRegenerate = ((amountToRegenerate > maxToRegen) ? maxToRe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Directs control flow of the calibration task as determined by the independent variables (interaction and stimuli).
function start_calibration_task() { // Stimuli switch - How do we check if the calibration is finished? check_calibration_finished(); // Interactivity switch - How are we collecting gaze training data? collect_training_data(); // 2nd stimuli switch - How are we progressing further into the calibration s...
[ "function start_calibration_exp(i, s, f) {\n // Define independent variables for this run\n interaction = i;\n stimuli = s;\n first_validation_task = f;\n\n remaining_tasks = [\"static\", \"pursuit\"];\n paradigm = \"calibration\";\n setup_calibration_html();\n}", "function runSimulation() {\n var m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Async Helper to get contentID.
async function getContentIDAsync() { if (!currentContentID) await updateContentID(); // Ensure contentID is populated. return currentContentID; }
[ "function getContentID() {\n if (!currentContentID) updateContentID(); // Ensure contentID is populated, even if late.\n return currentContentID;\n}", "async function updateContentID() {\n // const start = performance.now();\n try {\n const newContentID = await getContentIDImpl();\n // console.log('upda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API test for 'AddCrl', Add new CRL (Certificate Revocation List) entry
function Test_AddCrl() { return __awaiter(this, void 0, void 0, function () { var in_rpc_crl, out_rpc_crl; return __generator(this, function (_a) { switch (_a.label) { case 0: console.log("Begin: Test_AddCrl"); in_rpc_crl = new VPN....
[ "async function updateCRL() {\n const crlResp = await fetch(CRL_URL)\n if (crlResp.status == 200) {\n const buf = await crlResp.arrayBuffer()\n const asn1 = asn1js.fromBER(buf)\n const crlSimpl = new CertificateRevocationList({\n schema: asn1.result,\n })\n const newCRL = {\n nextUpdate: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Performs feature detection on the Node crypto interface.
function _detectNodeCrypto(fn) { return forge.util.isNodejs && typeof _crypto[fn] === 'function'; }
[ "function supportsCrypto () {\n return window.crypto && crypto.subtle && window.TextEncoder;\n }", "function _detectNodeCrypto(fn) {\n return forge.util.isNodejs && typeof _crypto[fn] === 'function';\n}", "function _detectSubtleCrypto(fn) {\n return (typeof util.globalScope !== 'undefined' &&\n typeof ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inform renderer process to click FileExportAsHTML menu.
function callExportAsHTML() { let win = BrowserWindow.getFocusedWindow(); win.webContents.send('export-html-click'); }
[ "onExport(e) {\n e.preventDefault();\n\n if (!e.target.dataset.action) {\n return;\n }\n\n switch (e.target.dataset.action) {\n case 'copy':\n this.onCopyButtonClick();\n break;\n case 'open-viewer':\n this.sendJSONReport();\n break;\n case 'print':\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hasCATEGORY(element) returns true if the element has a PARENTCAT value
function hasCATEGORY(element) { if (!element || !element.tagName) return false; if (element.tagName != "TD") { if (element.parentNode) { element = element.parentNode; } } if (!element.PARENTCAT) return false; return true; }
[ "hasParentCategory() {\n return !!this._parent.length;\n }", "hasCategories() {}", "hasCategory(category) {\n if(this.Categories.length == 0) {\n this.addCategory(Category.Default, this.Type);\n }\n returnVal = _.find(this.Categories, function (catId) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Main Menu's Class // ///////////////////// Author: Jarod Kachovich Description: Main menu class for setting up the menu's scene and any interaction the user has with this scene.
function MainMenu () { // Link State's constructor State.call(this,"MainMenu"); // An array to hold the buttons this.ButtonList = []; this.waveTimer = 0; // Check for the options menu this.optionsEnabled = false; // Sorage for the raycaster this.raycaster = new THREE.Raycaster(); }
[ "function Scene_Menu() {\n this.initialize.apply(this, arguments);\n}", "function Scene_Menu() {\r\n this.initialize.apply(this, arguments);\r\n}", "function initMainMenu() {}", "function initMainMenu() {\n\t}", "function _main_menu_initialize() {\n var title = entity_manager_create_entity();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Metodo que carga las opciones del sort en base a las opciones de Metricas y Dimensiones
cargarSort(){ //Variables para agregar opciones var oDesc = "-"; var asc = " (ascending)"; var dsc = " (descending)"; //Se carga el sort en base a las metricas y dimensiones seleccionadas var metDim = this.state.selectedMetricas.concat(this.state.selectedDimensions); ...
[ "function getSortingParams(sortCriterion) {\n let firstCriterion;\n let secondCriterion;\n let factor;\n\n if (sortCriterion === SortCriterions.COUNT) {\n // Sort by -count, then +label.\n firstCriterion = SortCriterions.COUNT;\n secondCriterion = SortCriterions.ALPHA;\n fact...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the next page URL on the collection from link headers See: This method is looking for a link header with `rel="next"` An set's it as the next page's URL. If it doesn't find a next page, and current page is set by a link header it assumes we are at the last page and deletes the current `next`
function setLinkHeadersPagination(collection, xhr) { try { var links = parseLinkHeader(xhr.getResponseHeader('link')); collection[STATE].set(LINK_BY_HEADER, true); collection.setPagination(links['next'].href); } catch (e) { if (collection[STATE].get(LINK_BY_HEADER)) { coll...
[ "function setLinkHeadersPagination(collection, xhr) {\n try {\n var links = parseLinkHeader(xhr.getResponseHeader('link'));\n collection[STATE].set(LINK_BY_HEADER, true);\n collection.setPagination(links['next'].href);\n }\n catch (e) {\n if (collection[STATE].get(LINK_BY_HEADER)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
does the user own the story true or false
static isUserOwner(story) { if (!story) return false // doing string compare because of auth payload return story.postedBy._id === Auth.getPayload().sub }
[ "isOwnedBy(user){\n for (let ownStory of user.ownStories){\n if (ownStory.storyId === this.storyId) return true;\n }\n return false;\n }", "isOwnStory(story) {\n for (let i = 0; i < this.ownStories.length; i++) {\n if (this.ownStories[i].username === story.username) {\n return true\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw a circle of a given size on the given context.
function drawCircle(ctx, size) { ctx.beginPath(); ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2, true); ctx.closePath(); }
[ "function drawCircleAndFill(ctx, size, color) {\n drawCircle(ctx, size);\n ctx.fillStyle = color;\n ctx.fill();\n}", "function drawCircle(context,circle) {\n context.beginPath();\n context.arc(circle.x,circle.y,circle.r,0,Math.PI*2,true);\n context.closePath();\n context.stroke();\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call to refresh cut status of bookmark rows in bookmark panel a_bnId = list of BookmarkNodes Ids on which to modify cut status status = Boolean, if true set cut status on (dim), else set it off
function refreshCutPanel (a_bnId, status) { let row; let len = a_bnId.length; for (let i=0 ; i<len ; i++) { row = curRowList[a_bnId[i]]; if (row != undefined) { // There is a result in search pane corresponding to that BTN // Update only the row, do not change anything else if (status) { row.classList.a...
[ "function refreshCutSearch (a_bnId, status) {\n if (SearchTextInput.value.length > 0) { // Refresh only if a search is active\n\tlet row;\n\tlet len = a_bnId.length;\n\tfor (let i=0 ; i<len ; i++) {\n\t row = curResultRowList[a_bnId[i]];\n\t if (row != undefined) { // There is a result in search pane correspondi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add entry to Service Item Table in PSC it is a variant of addSI function as it takes httpclient as input.
function addSIwithClient(httpsClient,PSCIP,PSCPort,PSCUser,PSCProtocol,PSCPassword,SITableName,SIData,action){ //Create the JSON estructure var jsonData = new HashMap(); var serviceitem = new HashMap(); var serviceItemData = new HashMap(); var serviceItemAttribute = util.createNameValueList(); for (var i=0;i<SID...
[ "function addItem() {}", "function addItemToICS(id, newItemToICS){\n\t\t\t\tvar deferred = $q.defer();\n\t\t\t\tvar ITEMS_URL = ICS_URL+\"/\"+id+\"/items\";\n\t\t\t\t$http.post(ITEMS_URL, newItemToICS)\n\t\t\t\t.success(function(data){\n\t\t\t\t\tdeferred.resolve(data);\n\t\t\t\t})\n\t\t\t\t.error(function(data,s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creating an immutable Pirate Map object with random name and appellation
function _random() { var rndName = _getRandom(_pirateNames), rndAppellation = _getRandom(_pirateAppellations); _pirate = Immutable.Map({ name: rndName, appellation: rndAppellation }); }
[ "function createMap(){return new ts.Map();}", "function createUnderscoreEscapedMap(){return new ts.Map();}", "function DefaultMap() {}", "function MapBuilder() {}", "function createMap() {\n return new MapCtr();\n }", "function createUnderscoreEscapedMap() {\n return new MapCtr();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
number: The GUID for this command/response pair command_path: The URL of the command to be sent, e.g. /session/ (for new session) method: The method of http request, e.g. POST, GET, or DELETE json_object: The JSON parameters. session: The Session object, which keeps track of the port number and prefix to which commands...
function send_request(number, command_path, method, json_object, session) { session = JSON.parse(session); var http = require('http'); var headerobject = { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(json_object, 'utf8') }; var options = { host: ...
[ "_build_request(command) {\n // Convenience variable for the corresponding dictionary entry for the\n // API to which the command relates.\n const base = Headless.apis[command.api];\n\n // Assemble the HTTP header list.\n const headers = new Headers(base.headers);\n [comman...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
input: ary, or not ary, or empty ary output: new ary rotated once, or undefined, or empty ary (respective to input) assume: If the input is not an array, return undefined. If the input is an empty array, return an empty array. Review the test cases below, then implement the solution accordingly. do not mutate input log...
function rotateArray(ary) { return Array.isArray(ary) ? ary.slice(1).concat(ary[0]) : undefined; }
[ "function rotateArray(array) {\n let resultArray = array.slice(0);\n let holdingArray = [];\n\n if (array.length === 0) {\n return undefined;\n }// if empty array\n\n // if (array !== typeOf) {\n // return undefined;\n // } // if not array\n\n holdingArray.push(resultArray[0]);\n resultArray.push(hold...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates if id is defined in body, else creates
createOrUpdate(body, res) { if (body.id !== undefined) { this.update(body, res) } else { this.create(body, res); } }
[ "update(id, body) {\n return this.http.request('POST', `/apps/${id}`, body);\n }", "update(body, res) {\n this.model.findOne({where: {id: body.id}}).then(object => {\n if (object !== null) {\n object.update(body).then(object => res.status(200).json({\n type: 'success',\n messa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the build resource ID for a specific build beta detail.
function getBuildIDForBuildBetaDetail(api, id) { return api_1.GET(api, `/buildBetaDetails/${id}/relationships/build`) }
[ "function getBuildBetaDetailsResourceIDForBuild(api, id) {\n return api_1.GET(api, `/builds/${id}/relationships/buildBetaDetail`)\n}", "function getBuildIDForBetaBuildLocalization(api, id) {\n return api_1.GET(api, `/betaBuildLocalizations/${id}/relationships/build`)\n}", "function getBuildIDForBetaAppRev...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
dispatcher = null; stores = [];
constructor(){ this.dispatcher = this; this.stores = []; }
[ "function storesInit(){\n//nothing to do\n}", "clearStore() {}", "initStore()\n {\n this.store_ = new StoreFacade(this.reducers_);\n\n for (var moduleName in this.dispatchers_) {\n this.dispatchers_[moduleName].setStore(this.store_);\n }\n }", "constructor() {\n th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the smallest used well in the given group of pipettinginstructions
function getSmallestWell(instructionGroup) { let ret = instructionGroup[0].well; for (let i = 0; i < instructionGroup.length; i++) { if (instructionGroup[i].well < ret) { ret = instructionGroup[i].well; } } return ret; }
[ "function lowestBuilding(arr,group){\n\tif (arr[0] !== undefined) {\n\t\tfor (var i = 0; i < arr.length; i++) {\n\t\t\tif (arr[i].type === group && arr[i].level < 5) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\telse {\n\t\treturn false;\n\t}\n}", "function minStepsToGroup (input) {\n var array = input.split(''...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create session storage object for menu state and/or update state with any new menu items
function initMenu() { const hasState = sessionStorage.getItem(MENU_STATE_KEY); let items = document.querySelectorAll('.group-name'); let state = !hasState ? {} : JSON.parse(hasState); if (!hasState) { // initialize menu state console.log('ApexDox: initializing menu state'); items.forEach(item => state[item.i...
[ "function persistMenuState() {\n\tlet items = document.querySelectorAll('.group-name');\n\tlet state = JSON.parse(sessionStorage.getItem(MENU_STATE_KEY));\n\n\titems.forEach(item => {\n\t\tlet isOpen = item.getAttribute('open');\n\t\tconsole.log(isOpen);\n\t\tstate[item.id] = isOpen === '' && true;\n\t});\n\n\tsess...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: updateScreenOnFooter(oCase) Display the Screen in the footer. Parameters: oCase The case object. Page Actions: Step 1 LHS Document Ready Step 1 RHS Display Thumbnails Step 1 RHS Document Ready via Display Thumbnails Step 1 RHS Sort via Display Thumbnails Step 2 LHS Document Ready Step 2 RHS Display Thumbnails...
function updateScreenOnFooter(oCase) { $("#screen").html("<b>Screen:</b><i>"+oCase.stage.name+"</i>"); }
[ "function afterFooter() {\n // Get Cartridge Cache\n var cache = dw.system.CacheMgr.getCache('DevToolsCache');\n\n // Write log types to their own cache key ( 128KB max per key )\n cache.put('debug', Debugger.debug);\n cache.put('error', Debugger.error);\n cache.put('fatal', Debugger.fatal);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open the dialog for info about Shared Library
function openLibInfoPopup(action_text) { $.post(app_path_webroot+'SharedLibrary/info.php?pid='+pid, { action_text: action_text }, function(data){ // Add dialog content if (!$('#sharedLibInfo').length) $('body').append('<div id="sharedLibInfo"></div>'); $('#sharedLibInfo').html(data); $('#sharedLibInfo').d...
[ "function openAboutDialog() {\n var userId = Utilities.loadSettings(\"Standalone_Telemetry_UserId\");\n var detailMessage = \"\\nVersion: \" + electron_1.remote.app.getVersion() + \"\\n\"\n + (\"\\nPlatform: \" + (packageInfo.platform ? packageInfo.platform : \"\"))\n + (\"\\nBuild Number: \" + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Saves the database to a string in localStorage
function saveDB(name, db){ //Save the database as a string to localStorage localStorage[name] = JSON.stringify(db); }
[ "function writeLocalStorage(databaseName, database) {\n // writes the database object to the local storage\n window.localStorage.setItem(databaseName, JSON.stringify(database));\n}", "function saveLocalStorage(stringToSave) {\n localStorage.setItem(listOnScreen,stringToSave);\n}", "function saveDbToLocalSt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given two buckets (arrays of 26 elements), do they have the same values? Does not type check its arguments; caller is trusted.
function doBucketsMatch(b1, b2) { // I suspect that checking if toString() produces the same value for each arg, // that would probably produce accurate results, but it probably wouldn't be as efficient. // Optimization: start from the end because the letters Q and U-Z are less often used in English. ...
[ "function same(arr1, arr2){\nif(arr1.length !== arr2.length){\n return false;\n}\nlet counter1 = {};\nlet counter2 = {};\nfor(let val of arr1){\n counter1[val] = (counter1[val] || 0)+1\n}\nfor(let val of arr2){\n counter2[val] = (counter2[val] || 0)+1\n}\nfor(let key in counter1){\n if(!(key**2 in count...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset to the north.
resetNorth() { super.setHeading(super.getHeading()); }
[ "reset() {\n\t\tthis._orbitCenter = this._resetOrbitCenter;\n\t}", "reset () {\n this.skierDirection = DIRECTION.RIGHT;\n this.skierSpeed = 8;\n this.x = 0;\n this.y = 0;\n }", "reset () {\n this.leaveStation()\n this.position = 0\n this.finalStationReached = false\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parameters reObj: The regular expression object used to match (Do add global flag). hint: The message shows near cursor when hover on matched text. link: The hyperlink binds to matched text. className: Used to explicitly set wrapElem's class. rootElem: The node under which the text nodes are found. Return values count:...
async function highlightText({ reObj, color = "yellow", hint = undefined, link = undefined, className = undefined }, rootElem = document) { if (!className || !className.length) { className = reObj.toString().replace(/\s/g, ""); } let wrapElem = document.createElement("a"); wrapElem.classList.a...
[ "function highlight(regex, highlightColor, selectedColor, textColor, maxResults, web_link) {\n\n function highlightRecursive(node) {\n if (searchInfo.length >= maxResults) {\n return;\n }\n if (isTextNode(node)) {\n var index = node.data.search(regex);\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Summary: Accepts three parameters evaluated result for conditions, id of the target select box, filtered values. Iterates through all the options in the target select box and adds class: hideoption when option not part of filtered values.
function filterOptions(result, key, filteredValues) { let i = 0; let arraysed = new Array(); if (result == true) { // break; $("#" + key).find("option").each(function () { if (filteredValues.indexOf($(this)[0].innerText) == -1) { if (navigator.platform.in...
[ "function filterSelectClass(){\n \n }", "function filterCells(selectObject, filterID) { // eslint-disable-line no-unused-vars\n 'use strict';\n var i, elements, tableRowIDs;\n tableRowIDs = [\"natural\", \"fan-Assisted\", \"electric\", \"heating\"];\n\n for (i = 0; i < tableRowIDs.length; i ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to handle removing an occluded tile from the list of tiles tile > the tile to check if it should be removed
function removeHelper(tile){ if(parseInt(tile.attr('sizex')) <= 0 || parseInt(tile.attr('sizey')) <= 0){ $.when(tile.fadeOut()).then(function(){ tile.remove(); }); for (var i = tiles.length - 1; i >= 0; i--) { if(tiles[i] == tile.attr('id')){ tiles.splice(i, 1); brea...
[ "removeExtraTiles() {\n var tileCount = this.getTilesCount();\n var tiles = this.getTiles();\n while (tiles.length > tileCount) {\n var extraTile = tiles.pop();\n jQuery(extraTile).remove();\n }\n }", "removeTile(tile: MdGridTile) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This gets called from the host hardware sim every time there is a hardware clock pulse.
function krnOnCPUClockPulse() { if (_KernelInterruptQueue.getSize() > 0) { // Process the first interrupt on the interrupt queue. // TODO: Implement a priority queue based on the IRQ number/id to enforce interrupt priority. var interrupt = _KernelInterruptQueue.dequeue(); krnInterrup...
[ "_startClock () {\n this.setRegister(REG_STOP, 0x00);\n }", "function ClockChanged(time) {\n if (System.my_clock_handler != null) {\n System.my_clock_handler(time);\n }\n}", "function update_clock() {\n that.read[that.CLOCK_24MHZ]();\n setTimeout(update_clock, 1000);\n }", "clockTick...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Input Value Taker Function Area
function inputValueTaker(userInput){ document.getElementById('displayInputValue').value += userInput; document.getElementById('displayInputValue').style.color = "white"; document.getElementById('displayInputValue').style.textAlign = "center"; document.getElementById('displayInputValue').style.fon...
[ "function question2(input) {\n\n console.log('Inputted value: ' + input);\n\n}", "function getValue(inputOp){\n readline.question(\"Enter value:\", inputVal => {\n calculation(placeholder, inputVal, inputOp);\n} );\n}", "function input() {\n let betamt = 10000\n let bet = getInput('How much are you...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Konfiguriert Spielfeld, Paddel und Ball
function SetConfig(data){ $('#Field').width(data['FIELD_WIDTH']); $('#Field').height(data['FIELD_HEIGHT']); $('#ball').width(data['BALL_RADIUS']*2); $('#ball').height(data['BALL_RADIUS']*2); $('#ball').css('left', (data['FIELD_WIDTH'] / 2 - data['BALL_RADIUS'])); $('#ball').css('bottom', (data['FIELD_...
[ "function configure_plane_size(){\n\tplane_width = global.stage.width;\n\tconfigure_plane_height();\n\tconfigure_plane_offset();\n}", "function setupPaddles () {\n rightPaddle = new Paddle(width-20,height/2,10,60,10,40,38);\n // Create the left paddle with W and S as controls\n // Keycodes 83 and 87 are W and ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a list of scores.
function makeScores(scoresData) { return _.map(scoresData, Score.makeScore); }
[ "function getScores() {\n return scores;\n}", "function generateScores() {\n\tvar scores = [];\n\tfor (var i = 0; i < 10; i++) {\n\t\tscores.push((Math.floor((Math.random() * 5)+1)).toString());\n\t}\n\treturn scores;\n}", "getScores() {\n var scores = [];\n for (var p of this.players) {\n scores....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load a selected object from results
function loadObject() { console.log("loadObject()"); if(vm.results.length == 0) { return; } if(vm.selectedIndex < 0) { return; } NonMutantCellLineGetAPI.get({ key: vm.results[vm.selectedIndex].cellLineKey }, function(data) { vm.apiDomain = data; refreshMCLCount(); }, function(err...
[ "function loadObject() {\n\t\t\tconsole.log(\"loadObject()\");\n\n\t\t\tif (vm.results.length == 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (vm.selectedIndex < 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tMPAnnotGetAPI.get({key: vm.results[vm.selectedIndex].genotypeKey}, function(data) {\n\t\t\t\tvm.apiDomain = data;\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to get data from APEX
function getData() { $(parentID).css("min-height", "120px"); var submitItems = items2Submit; try { apex.server.plugin( ajaxID, { pageItems: submitItems }, { s...
[ "function getData() {\n $(parentID).css(\"min-height\", \"120px\");\n util.loader.start(parentID);\n\n var submitItems = items2Submit;\n try {\n apex.server.plugin(\n ajaxID, {\n pageItem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show the given menu element at the given offset from the topleft corner of the viewport. The menu will appear belowright of this point and will flip to belowleft if there is not enough room onscreen. The optional callback will be invoked when this menu closes.
function show(menu, offset, onClose) { if (contextMenu == null) { var contextMenuElement = document.createElement("div"); contextMenuElement.classList.add(Classes.CONTEXT_MENU); document.body.appendChild(contextMenuElement); contextMenu = ReactDOM.render(React.createElement(ContextMe...
[ "function repositionMenu(menu, offset)\n\t\t{\n \n \t\t// the new left position should be the center of the window + the offset\n\t\t\n\t\tvar newLeft = getWindowWidth() / 2 + offset;\n\n \t\t// setting the left position in netscape is a little different than IE\n\t\t\tmenu.container.style ? menu.con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For completed workouts, identify and return the user's workout choice; each of the nine workouts (swim: beginner, swim: intermediate, etc.) has its own index within the list array, and all are returned, with the user's choice indicated by 'chosen' attribute
getChoice(val) { var list = [] // These if statements determine which types of workouts are included in the // day if (this.state.temp.hasOwnProperty('swimWorkout')) { // If the swim workout exists, add each level to the list list[0] = { title: 'SWIM: Beginner', workout: th...
[ "pickWorkout() {\n if (this.rest) {\n return exercises[exercises.length - 1]; // returns rest data if this.rest is true\n } else {\n return exercises[Utility.random(exercises.length - 2, 0)]; // returns a random workout with no regard for what has already been selected. Excludes rest.\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reorderFaceAnchor accepts an array of 4 points. First two points must be anchors of eyes, last two points must e anchors of mouth. It returns an array of 4 points in special orders: [left_eye, right_eye, mouth_left, mouth_right].
reorderFaceAnchor(array) { const eyeCenter = this.midPoint(array[0], array[1]); const mouthCenter = this.midPoint(array[2], array[3]); // direction vector is a vector from eye center to mouth center, indicate downward of a face. const directionVector = this.minus(mouthCenter, eyeCenter); const resul...
[ "function orderFaces(){\n\telementorder = [];\n\t\n\t// If faceOrderMethod is 1, this is the more reliable method but may take a little longer as less optimisation\n\tif (faceOrderMethod===1){\n\t\t\n\t\t// For every face (F) in the scene, find its square distance to the camera, label its index and indicate that it...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
async function to SELECT data from the shopping_cart db
async function shoppingCartView(column) { let response = await new Promise((resolve, reject) => { db.query(`SELECT ${column} FROM shopping_cart Where ?`, { user_name: username }, (error, results) => { if (error) { reject(error) } else { resolve(results...
[ "async function getCart() {\n // console.log('getCart()');\n \n // let timeDiff = timer.toc();\n // console.log(`BEGIN AJAX request @ ${timeDiff.toFixed(0)}ms.`);\n const response = await fetch('/cart.js');\n const data = await response.json();\n // console.log(data);\n // ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the number of currently connected users element (adds to the current value).
function addToUsersCount(addedValue) { CONNECTED_COUNT += addedValue; CONNECTED.innerText = CONNECTED_COUNT.toString(); }
[ "function setTotalUsers() {\n var userCountEl = d.querySelector('#user-count');\n var count = usersElement.querySelectorAll('.user-item');\n userCountEl.innerHTML = count.length;\n }", "function updateCount(count) {\n self.usersOnline = count;\n }", "function updateUser...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function will be called when each subtitle starts this time we'll search the text for instances of [[someelementid]] someelementid refers to an element in the DOM, like that element will be shown when its id is found in the subtitle
function cueEnter(){ let subtitleText = this.text; // Check if the subtitle text contains double brackets if(subtitleText.includes('[[')) { // Use a 'Regular Expression' to check if the subtitle contains a text like [[some-element-id]] const matches = this.text.match(/\[\[(.*)\]\]/); if(matches[1]){ ...
[ "function revealSubtitle() {\n for (let i = 0; i < subtitles.length; i += 1) {\n this.element.classList.add('is-subtitle_shown');\n this.destroy();\n }\n}", "_setTextualInformationVisible(visible) {\n const textElement = this.$.simple_text_content;\n if (textElement) {\n visible ? textElement.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var theta1 = Math.atan2(y, x); // (1) var r1 = Math.sqrt(x x + y y); // (2) var r2 = z a1; // (3) var phi2 = Math.atan2(r2, r1); // (4) var r3 = Math.sqrt(r1 r1 + r2 r2); // (5) var phi1 = Math.acos((a3 a3 a2 a2 r3 r3) / (2 a2 r3)); // (6) var theta2 = phi2 + phi1; // (7) theta2 = phi2 phi1 var phi3 = Math.acos((r3 r3 ...
function position(a1, a2, a3, x, y, z) { var theta1 = Math.atan2(y, x); var r1 = Math.sqrt(x * x + y * y); var r2 = z - a1; var c = Math.sqrt(r1 * r1 + r2 * r2); //r3 var alpha = Math.acos((a3 * a3 - a2 * a2 - c * c) / (-2 * a2 * c)); //phi1 var phi = Math.acos((c * c - a2 * a2 - a3 * a3) / (-2...
[ "angle(p1, p2){\n const a = this.distanceTo(p2); // a\n const b = p1.distanceTo(p2); // b\n const c = p1.distanceTo(this); // c\n let cos = ((a * a) + (c * c) - (b * b)) / (2 * a * c);\n console.log(180 / Math.PI);\n return Math.acos(cos) * 180 / Math.PI;\n }", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to add a node at a particular x,y coordinate
function addNodeOnto(x,y,name){ var index = node_dataOnto.length; node_dataOnto.push({x:x,y:y,name:name,index:index}); refreshGraphOnto(node_dataOnto,link_dataOnto); }
[ "function addNode(){\r\n\t\t\r\n\t}", "function addNode(localNodes, id, label, x, y){\n var color = {background: '#00BCD4', border: '#00BCD4',\n highlight: { background :'#757575', border: '#212121'},\n hover: { background :'#757575', border: '#212121'}\n },\n font = {color:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw bird according to currentDate
function drawBird(bird, currentDate) { bird.forEach(d => { if(d.timestamp === currentDate){ if(d3.select('#'+d['individual-local-identifier']).empty()){ //if bird is not shown on map yet d3.select('.leaflet-birds-pane svg') //create a new circle ...
[ "function drawBird(){\n cntxt.beginPath();\n // cntxt.arc(startPositionX, startPositionY, 15, 0, Math.PI*2);\n // //cntxt.rect(startPositionX-20, startPositionY,birdHeight-10,birdHeight-10);\n // cntxt.fillStyle = \"gold\";\n // cntxt.fill();\n cntxt.drawImage(image, startPositionX, startPositionY...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clamp a number n between l and h
function clamp(n, l, h) { if (n < l) return l; if (n > h) return h; return n; }
[ "function clamp(n, l, h) {\r\n if (n < l)\r\n return l;\r\n if (n > h)\r\n return h;\r\n return n;\r\n}", "clamp (n, lower, upper) {\n const clampDown = Math.max(n, lower)\n return Math.min(clampDown, upper)\n }", "function clampValue(min, n, max) {\n\t return Math.min(Math.max(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the user custom action with the specified id
getById(id) { const uca = new UserCustomAction(this); uca.concat(`('${id}')`); return uca; }
[ "getAction(id) {\n return this.rest.get(`${this.baseUrl}/actions/${id}`);\n }", "get userCustomActions() {\r\n return new UserCustomActions(this);\r\n }", "getUserAction ( a_key ) {\n return m_config && m_config.actions ? m_config.actions[ a_key ] : undefined;\n }", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====== Create the Euclidean Projection for the flat map ====== == Constructor ==
function EuclideanProjection(a){ this.pixelsPerLonDegree=[]; this.pixelsPerLonRadian=[]; this.pixelOrigo=[]; this.tileBounds=[]; var b=256; var c=1; for(var d=0; d<a; d++) { var e=b/2; this.pixelsPerLonDegree.push(b/360); ...
[ "function EuclideanProjection(maxzoom){\n this.pixelsPerLonDegree = [];\n this.pixelsPerLonRadian = [];\n this.pixelOrigo = [];\n this.tileBounds = [];\n var b = 256;\n //var b = 256;\n var c = 1;\n for(var d = 0; d < maxzoom ; d++){\n var e = b/2;\n //this.pixelsPerLonDegree.push(b / 360);\n //thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Problem 2: We have too many cans of cocacola, fanta, and sprite in the kitchen. Let's build a pyramid out of them! A pyramid will square the number of cans in each level: 1 can in the top level, 4 in the second, 9 in the next, 16, 25, ... Complete the pyramid function to return the number of complete levels of a can py...
function pyramid(cans){ var total = 0; var counter = 1; var result = 0; while(total <= cans){ total += Math.pow(counter,2); result = counter; counter++; } return --result; }
[ "function pyramidScheme(base) {\n\n}", "function pyramid(n) {\n // looping through the levels\n for (let i = 0; i < n; i++) {\n\n var output = ''; // reset each level of the loop\n for (let j = 0; j < n - i; j++) output += ' '; //\n for (let k = 0; k <= i; k++) output += '# '; //Add the...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate string for section of html document displaying a rule/proposal. args: rules list of rule items (from a json file) rule_key index in rules of the item to render id_prefix DOM id prefix of created section (usually "rule" or "prop") toggle_notes boolean, true display of associated notes may be toggled show_notes ...
function GenerateRuleBox(rules,rule_key,id_prefix/*="rule"*/, toggle_notes/*=true*/, show_notes/*=false*/, rule_lookup_url/*=""*/, rule_name_lookup/*=null*/, details/*=true*/, show_author/*=false*/){ var rule=rules[rule_key]; var dom_id=id_prefix+rule_key; var S="<section class=\"rulebox\" id=\""+dom_id+"\">"+ "<...
[ "function ruleAsMarkdown(rule) {\r\n let markdown = `## Rule: ${asUrl(rule)}\\n\\n`;\r\n let targetEnumeration = \"\";\r\n if (hasPublic$1(rule)) {\r\n targetEnumeration += \"- Everyone\\n\";\r\n }\r\n if (hasAuthenticated$1(rule)) {\r\n targetEnumeration += \"- All authen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pedir por prompt el precio y el porcentaje de descuento, mostrar el precio final con descuento por id.
function mostrar() { var precio; var porcentaje; var descuento; var precioFinal; precio = prompt('Ingrese el precio: '); porcentaje = prompt('Ingrese el porcentaje de descuento: '); precio = parseFloat(precio); porcentaje = parseInt(porcentaje); descuento = (precio * porcentaje) /...
[ "function Ejercicio1()\n{\n\tvar nombre;\n var importe;\n var valorAumento;\n var porcentajeAumento;\n var precioFinal;\n \n nombre = prompt(\"Ingrese el nombre de un producto\");\n importe = prompt(\"Ingrese el precio de este producto\");\n valorAumento = prompt(\"Ingrese porcent...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stanton measure Task 17 / function: stantonMeasure input: integer array output: stanton measure of the array
function stantonMeasure(myArray){ let counterOnes = 0; let foundNumberCounter = 0; myArray.forEach(element => { if(element === 1){ counterOnes++ } }); myArray.forEach(element => { if(element === counterOnes) { foundNumberCounter++; } ...
[ "function stantonMeasure(arr){\n var number = 0;\n var answer = 0;\n for (var i = 0; i < arr.length; i++){\n if(arr[i] === 1 ){\n number ++;\n }\n }\n for(var j = 0; j < arr.length; j++){\n if(arr[j] === number){\n answer ++;\n }\n }\nreturn answer;\n}", "function stantonMeasure(arr)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rotate a point by r degrees
function rotate(p, r) { var th = r / 180 * π; var cos = Math.cos(th); var sin = Math.sin(th); return { x: p.x * cos - p.y * sin, y: p.x * sin + p.y * cos }; }
[ "function rotate(r,p) {\n\tvar temp = this.sub(r);\n\tvar rotated = new Vector2D(temp.x * Math.cos(p) - temp.y * Math.sin(p),\n\t\t\ttemp.x * Math.sin(p) + temp.y * Math.cos(p));\n\treturn rotated.add(r);\n}", "rotateTo(r) {\n if (r[1] < -90) {\n r[1] = -90\n }\n if (r[1] > 90) {\n r[1] = 90\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filtra la lista dejando los elemento para los cuales la funcion fn da verdadero. Te modifica la lista original a diferencia de [].filter Ejemplo para quedarse con los pares: > filtrarLista([1,2,3,4], n => n%2 == 0)
function filtrarLista(lista, fn) { for(let i = 0; i < lista.length; i++) { if (!fn(lista[i])) { lista.splice(i, 1); i--; } } return lista }
[ "function myFilter(list, fn) {\n let filtered = [];\n for (let i = 0; i < list.length; i++) {\n if (fn(list[i])) {\n filtered.push(list[i])\n }\n }\n return filtered;\n}", "function filter(list, fcn) {\n\n}", "function inpares(aDatos = []) {\n return aDatos.filter( item => (item%2) )\n}", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
extract audio. it is stored to MP4 container.
function extractAudio(bytes) { var tree = helpers_1.parse(bytes); var finder = new finder_1.Finder(tree); var offset = 8 * 6; var ftyp = { majorBrand: "M4A ", minorVersion: 1, compatibleBrands: ["isom", "M4A ", "mp42"] }; ftyp.bytes = new composer_box_1.FileTypeBoxBuilder...
[ "function audio() {\n const toConvert = getFilesToConvert('ogg');\n\n if (toConvert.length === 0) {\n return Promise.resolve();\n }\n\n return src(['_audio/final/'])\n .pipe(ffmpeg('ogg', (cmd) => {\n return cmd\n .audioChannels(2)\n .audioCodec('libvorbis');\n }))\n .pipe(dest('_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decides who goes first for SP and DP mode
function goesFirst() { const firstWho = Math.floor(Math.random() * 2); // Returns either 0 to 1 if (firstWho == 1 && singlePlayer) { //compGoes first alert("Computer is going first, symbol: O"); currSymbol = "X"; // Allows comp to make move playerTurn = false; ...
[ "function getLaunchedMode(){\n\tvar bres=\"ON-DEMAND\";\n\tvar dm=navigator.deviceModel;\n\tif( dm != null && inOnDemandList(dm)==true ){\n\t\tbres=\"ON-DEMAND\";\n\t}else if( dm != null && inFullSSPList(dm)==true){\n\t\tbres=\"FULL-SSP\";\n\t}else if( dm != null && inEVOList(dm)==true){\n\t\tbres=\"EVO\";\n\t}\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Submits vin number to track one shipment.
function single_tracker_submit() { trackOneVin($("#vinNumber").val().trim()); }
[ "function trackOneVin(vinNumber) {\n if (getCookie(\"access_token\") == null) return;\n setStatusText(\"Loading...\", \"text-primary\");\n displayStatus(vinNumber, shipments_array);\n /*\n $.ajax({\n url: (API_PATH_FL + \"?fromDate=2000-01-01&toDate=\" + dateTodayStr()),\n dataType: 'json',\n ty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Global functions convert marker wkt
function convertMarkerWKT(wkt) { var begginning = "POINT ("; var ending = ")"; wkt = wkt.replace(begginning, "").replace(ending, ""); var latlng = wkt.split(" "); latlng = { lat: parseFloat(latlng[1]), lng: parseFloat(latlng[0]) } var newShape = new google.maps.Marker({ position: latlng,...
[ "function CueMarker() {}", "function getCustomMarker(theCustomMarker) {\n customMarkers = theCustomMarker;\n}", "function createMarkers() {\n\n}", "function markerToSymbol(e, elm) {\n if (isDragging) return;\n\n MAP_DIV.style.cursor = '';\n\n var that = this instanceof Element ? this : elm;\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Restores cache from keys
function restoreCache(paths, primaryKey, restoreKeys, options) { return __awaiter(this, void 0, void 0, function* () { checkPaths(paths); restoreKeys = restoreKeys || []; const keys = [primaryKey, ...restoreKeys]; core.debug('Resolved Keys:'); core.debug(JSON.stringify(keys))...
[ "async function resetRegistry() {\n const keys = await registry.find('*');\n await Promise.all(_.map(keys, (key) => (async () => {\n try {\n const data = await registry.get(key);\n if (data && data.cacheKey) {\n await cache.delContent(data.cacheKey);\n }\n } catch (err) {\n // thr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for updatePipelineVariableForUser / Update a user level variable.
updatePipelineVariableForUser(incomingOptions, cb) { const Bitbucket = require('./dist'); let apiInstance = new Bitbucket.PipelinesApi(); // String | The account // String | The UUID of the variable // PipelineVariable | The updated variable. /*let username = "username_example";*/ /*let variableUuid = "var...
[ "updateRepositoryPipelineVariable(incomingOptions, cb) {\n const Bitbucket = require('./dist');\n\n let apiInstance = new Bitbucket.PipelinesApi(); // String | The account // String | The repository // String | The UUID of the variable to update // PipelineVariable | The updated variable\n /*let username =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ToDo use exam type
function ExamType(type) { this.type = type; }
[ "function MAG_get_sel_examtype (open_mode, examperiod, auth_index) { // PR2023-02-03 PR2023-06-13\n //console.log(\"=== MAG_get_sel_examtype =====\") ;\n //console.log(\" mod_MAG_dict.examperiod\", mod_MAG_dict.examperiod);\n //console.log(\" mod_MAG_dict.auth_index\", mod_MAG_dict.aut...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[19] PathExpr ::= LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath Unlike most other nodes, this one always generates a node because at this point all reverse nodesets must turn into a forward nodeset
function pathExpr(stream, a) { // We have to do FilterExpr before LocationPath because otherwise // LocationPath will eat up the name from a function call. var filter = filterExpr(stream, a); if (null == filter) { var loc = locationPath(stream, a); if (null == loc) { throw new Error ...
[ "function pathExpr(stream,a){// We have to do FilterExpr before LocationPath because otherwise\n// LocationPath will eat up the name from a function call.\nvar filter=filterExpr(stream,a);if(null==filter){var loc=locationPath(stream,a);if(null==loc){throw new Error();throw new XPathException(XPathException.INVALID_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Let's the action be executed if robot is present
_shallExecute() { return !_.isEmpty(this.robot); }
[ "function callRobot(index, button) {\r\n\tif (robots[index].broken == null) {\r\n\t\trobots[index].goalX = robots[index].homeX;\r\n\t\trobots[index].goalY = robots[index].homeY;\r\n\r\n\t\tmoveRobotTo(index, button, LOADED_REFRESH_SPEED);\r\n\t} else if (!robots[index].broken) {\r\n\t\t//If the robot is working fin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Swaps the letter frame back, if not in selecting mode.
outLetter(letter) { if (!this.isSelecting) { letter.frame = 0 } }
[ "function switchSettings2Back() {\n /* Reset Focus */\n Draw.resetFocus();\n }", "static moveBackwardOneChar() {\n const manager = TextNavigationManager.instance;\n if (manager.currentlySelecting_) {\n manager.setupDynamicSelection_(true /* resetCursor */);\n }\n EventGenerator.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function Creates catgirl and returns the configured object.
function makeCat() { VCAT = new Catgirl(); return VCAT; }
[ "function catFactory() {\n return {\n legs: 4,\n tail: true,\n isAsleep: function() {\n return true\n },\n say: function() {\n return 'meow'\n }\n }\n}", "function catBuilder(name, color, toys) {\n let cat = {\n name: name,\n color: color,\n toys: toys\n };...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populates the font lists with the list of system fonts from |fonts|.
function populateLists(fonts) { for (var i = 0; i < genericFamilies.length; i++) { var list = document.getElementById(genericFamilies[i].fontList); // Add special "(none)" item to indicate fallback to the non-per-script // font setting. The Font Settings API uses the empty string to indicate // fallb...
[ "function loadFonts() {\n var list = document.fonts.values();\n var item = list.next();\n while (! item.done) {\n item.value.load();\n item = list.next();\n }\n }", "function populateFonts() {\n const fonts = ['Arial', 'Book Antiqua', 'Charcoal', \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shows insert table dialog
showTableDialog() { if (this.tableDialogModule && !this.isReadOnlyMode && this.viewer) { this.tableDialogModule.show(); } }
[ "function openDialogInsert()\r\n{\r\n\tconsole.log(\"ok\");\r\n\tcleanDialogFields();\r\n\t$(\"#dialogInsertArtwork\").dialog('open');\r\n\t$(\"#btnModifica\").hide();\r\n\t$(\"#btnInsert\").show();\r\n}", "function TableInsertDialogController($scope, $mdDialog, table, schema, database, runQuery) {\n\tschema = an...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads the hash in the page address and returns an integer page index. Defaults to page 1 if there's no hash or if it's not a number.
function getHashPage(lastPage) { var hashPage = window.location.hash.replace('#', ''); hashPage = hashPage ? parseInt(hashPage) : 1; // Could be 'NaN'. return Math.max(Math.min(hashPage || 1, lastPage), 1); }
[ "function slideNumFromHash(hash) {\n\t\t\tindex = /\\d+/.exec(hash)[0];\n\t\t\tvar slideNum = (parseInt(index) || 1) - 1; // slides are zero-based\n\t\t\tif (slideNum < 0) slideNum = 0;\n\t\t\treturn slideNum\n\t\t}", "function extractPageIndex(url) {\n\tvar param = url.split(\"?\")[1];\n\tif(param) {\n\t\tvar pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }