query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Approves the file submitted for content approval with the specified comment. Only documents in lists that are enabled for content approval can be approved.
approve(comment = "") { return this.clone(File, `approve(comment = '${comment}')`).postCore(); }
[ "approve(comment = \"\") {\n return spPost(this.clone(File, `approve(comment='${escapeQueryStrValue(comment)}')`));\n }", "function approveComment(comment_id) {\n\tjs_path_put = functions_path + \"/ajax.php\";\n\tsend_data = \"action=approve_comment&comment_id=\" + comment_id;\n \t$.post(js_path_put,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subclass of CanvasImage that draws the results screen. I do this to avoid lots of fillText calls which slow the game down
function ResultsScreen(width, height) { CanvasImage.call(this, width, height); }
[ "display() {\n\n ctx.drawImage(this.image, this.x - this.width / 2, this.y - this.height / 2, this.width, this.height);\n }", "function RedDrawTexts(photo, frame, x, y) {\n this.photo = photo;\n this.frame = frame;\n this.left = x;\n this.top = y;\n\n const board = document.createElement(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets members of a family
async getFamilyMembers(familyid){ data = { URI: `${FAMILIES}/members/${familyid}`, method: 'GET' } return await this.sendRequest(data) }
[ "getFamilyMembers() {\n this.familyMembers.forEach(person => {\n console.log(person.name);\n });\n return this.familyMembers;\n }", "function getFamilyMembers() {\n $scope.fullFamilyDetails = [];\n\n //I decided to use the word as I don't have to worry about conver...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to obtain the quadrupole electric field
function quadrupoleEField(initVoltage,position,dsqrd){ const cylin=getCylindricalCoords(position); const r=cylin[0]; const theta = cylin[1]; const z=cylin[2]; // The electric field formula is then given by -V0/2([-r,0,2z]) let Ecylin = vecScalMultiply([-r,0,2*z],-initVoltage/(2*dsqrd)); ...
[ "get quadrant() {\n const a = this.normalize().value;\n\n if (a > 0 && a < Angle.SPI) return 1;\n if (a > Angle.SPI && a < Angle.PI) return 4;\n if (a > -Angle.PI && a < -Angle.SPI) return 3;\n if (a > -Angle.SPI && a < 0) return 2;\n return undefined;\n }", "function calculationElectricField( ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if called, takes the previous state and sets overCharLimit to equal the OPPOSITE of the previous state's OverCharLimit. Since it's a boolean, it flips it.
toggleCharLimit() { this.setState((prevState) => ({ overCharLimit: !prevState.overCharLimit })); }
[ "shiftIn() {\n this._charsetService.setgLevel(0);\n return true;\n }", "function reconsumeCurrentCharacter() {\n charIdx--;\n }", "function reconsumeCurrentCharacter() {\n charIdx--;\n }", "function reconsumeCurrentCharacter() {\n charIdx--;\n }", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accepts: tested_state: State for which we want to commit result. Could be my_state or last_non_verification_state is_result_significant: true or false Returns: false: Reset to start state has NOT happened true: Reset to start state has happened
function new_commit_result(tested_state, is_result_significant) { if (tested_state == "st_suspected_cookies_pass_test") { // do nothing } else if (tested_state == "st_suspected_cookies_block_test") { if (!is_result_significant) { if (pending_bool_pwd_box_present_first_verification == false && pendi...
[ "function commit_result(tested_state) {\n\tvar rs = \"continue_testing\";\n\tif (tested_state == \"st_suspected_cookies_pass_test\") {\n\t if (pending_are_usernames_present != undefined) {\n\t\tif(!pending_are_usernames_present) {\n\t\t console.log(\"APPU DEBUG: Switching to expand state from 'st_suspected_co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an attribute. Attributes are the core of Ivy, they are observable through the `on` listener. Ivy attributes implement both `valueOf` and `toJSON`, so they can usually be used like JavaScript primitives. var a = Ivy.attr(4), b = Ivy.attr(5); console.log(a+b); //=> 9 An optional `parseFn` may be passed in to help...
function IvyAttr(value, parseFn){ if (!(this instanceof IvyAttr)) return new IvyAttr(value, parseFn); this.value = value; this.parseFn = parseFn; this.callbacks = {}; this._id = Ivy._id++; }
[ "_createAttribute({\n localName,\n value,\n namespace,\n namespacePrefix\n }) {\n return generatedAttr.createImpl(this._globalObject, [], {\n localName,\n value,\n namespace,\n namespacePrefix,\n ownerDocument: this\n });\n }", "function Attribute() {\n\n var ho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add an individual match element to the list of matches
function addMatch(match) { const matchElement = document.createElement('li'); matchElement.dataset.location = match.l; // location used to find match matchElement.dataset.citation = formatCitation(match); // displayed location if (match.i) { // stage direction matches have an index matchElement.dataset....
[ "function addMatch(match) {\n const matchElement = document.createElement('li');\n matchElement.dataset.location = match.l; // location used to find match\n matchElement.dataset.citation = formatCitation(match); // displayed location\n if (match.x) {\n // stage directions and scene location matches have an '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle search form submission: get shows from API and display. Hide episodes area (that only gets shown if they ask for episodes)
async function searchForShowAndDisplay() { const term = $("#searchForm-term").val(); const shows = await getShowsByTerm(term); $episodesArea.hide(); populateShows(shows); }
[ "async function searchForShowAndDisplay() {\n const term = $(\"#searchForm-term\").val();\n const shows = await getShowsByTerm(term);\n\n // $episodesArea.hide();\n populateShows(shows);\n}", "function searchEpisodes(){\n searchBar = document.getElementById(\"searchBar\");\n // allEpisodes = getEpisodes();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show status (Success, Failed, custom message, ...) and reset the status variable to get ready for the next source. Empty the object in which external pages are loaded (no reason to keep the external page running). Keep listening for paste event.
function finishSourceProcessing() { if (sourceStatus == unknownURL) { setStatus(unknownURL); } else { setStatus(loading + " " + sourceStatus); } sourceStatus = 0; loadSrc.innerHTML = ""; }
[ "function loadPaste() {\n\tdocument.getElementById('pasteArea').setAttribute('placeholder', 'Loading...');\n\tXMLHttpRequest({\n\t\tmethod: 'POST',\n\t\turl: 'http://pastebin.com/api/api_post.php',\n\t\tdata: 'api_dev_key=0b6ec26f1d74dc65399691fcda219676' +\n\t\t '&api_user_key=e20b48a53479ac2634b7e25ecc9baff8...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function creates the statistics section inside the site info section of a given site. It will add information like the name, description, number of different users, number of different arthropod orders and number of surveys contained in that site.
function createStatisticsSection(data, siteId){ if(!data.siteDescription){ data.siteDescription = "(No description available)"; } $('#siteInfo #content', window.parent.document).prepend("<h2 id='contentHeader'>" + data.siteName + "</h2>"); $('#statistics', window.parent.document).append("<p><span class=''>Si...
[ "function getAnalyticsData() {\n\n\tif (siteID && siteID > 0 && timeDiff(lastChecked, getCurrentTime()) > updateFreq ) {\n\t\t$('sitelink').innerHTML = siteName;\n\n\t\tif (window.widget)\n\t\t\twidget.system(\"./Dashalytics.php \\\"\" + encodeURIComponent(username) + \"\\\" \\\"\" + encodeURIComponent(password) + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for creating a confirm dialog for deleting the user type Deleting a user type will also delete the users under that type
function userTypeDeleteConfirm(ut_id,user_type,update_url){ var confirm_title = '<b>Confirm Deletion??<br> User Type :' +'<label style="font-size:20px">' +'"'+user_type+'"</label> User ID : '+ut_id+'</b>'; var confirm_message="Deleting a User Type will <b>also delete all the users " +" of that type '"+user_ty...
[ "function confirmDelete(typeCategoryName, typesList, data) {\n var entityTypeId = data.id;\n var entityTypeName = \"\";\n\n //Determines the entity type's name by checking the given list\n for (var i = 0; i < typesList.length; i++) {\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loadShader 'shaderId' is the id of a element containing the shader source string. Load this shader and return the WebGLShader object corresponding to it.
function loadShader(ctx, shaderId) { var shaderScript = document.getElementById(shaderId); if (!shaderScript) { shaderScript = {text : shaderId, type : undefined}; if (shaderId.trim().toLowerCase().startsWith("//vertex")) { shaderScript.type = "x-shader/x-verte...
[ "function loadShader(_id, _type) {\n\tif (!webGLContextExists(\"loadShader\"))\n\t\treturn null;\n\t//Check to see if the element actually exists first\n\tvar elem = document.getElementById(_id);\n\tif (!elem) {\n\t\tconsole.log(\"No element with id \\\"\" + _id + \"\\\" for shader source.\");\n\t\treturn null;\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Push a tensor to the end of the list.
pushBack(tensor) { if (tensor.dtype !== this.elementDtype) { throw new Error(`Invalid data types; op elements ${tensor.dtype}, but list elements ${this.elementDtype}`); } assertShapesMatchAllowUndefinedSize(tensor.shape, this.elementShape, 'TensorList shape mismatch: '); if (...
[ "pushBack(tensor) {\n if (tensor.dtype !== this.elementDtype) {\n throw new Error(`Invalid data types; op elements ${tensor.dtype}, but list elements ${this.elementDtype}`);\n }\n Object(_tensor_utils__WEBPACK_IMPORTED_MODULE_1__[\"assertShapesMatchAllowUndefinedSize\"])(tensor.shape...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
iterate through areaMap adding areas
function addSurveyedAreas(){ areaMap.forEach(function(key, value, map){ drawArea(key).addTo(mymap); }); }
[ "function addAreas(){\n //draws the areas\n areaMap.forEach(function(item, key, mapObj){\n polyArea = drawArea(item);\n polyArea.addTo(areaLayer);\n })\n}", "function initMapAreas()/*:void*/ {var this$=this;\n var currentIdSuffixes/*:Array*/ = [];\n\n this.structValueExpression$AoGC.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Time: O(n m) + O(n), where n is persons.length and m is habits length. The + O(n) is from the .map. Space: O(n) linear.
function santasNaughtyListFunctional(persons, badHabit) { return persons .filter((person) => person.habits.includes(badHabit)) .map((person) => `${person.firstName} ${person.lastName}`); }
[ "function task25() {\n const persons = new Map();\n // generate 50 random birth months\n const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n for(let i=1; i<=50; i++) persons.set(`Person${i}`, months[Math.floor(Math.random()*12)]);\n \n // separate persons acc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CONCATENATED MODULE: ./src/cluster/components/Dashboard/OperationList/UserCell.jsx / Copyright 2019 Gravitational, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable l...
function UserCell(_ref) { var rowIndex = _ref.rowIndex, data = _ref.data; var _data$rowIndex = data[rowIndex], isSession = _data$rowIndex.isSession, operation = _data$rowIndex.operation, session = _data$rowIndex.session; if (isSession) { return renderSessionUser(session); } retur...
[ "function UserRow(props) {\n const user = props.user;\n return(\n <tr>\n <td>{ user.companyName }</td>\n <td>{ user.name }</td>\n <td>{ user.city }</td>\n <td>{ user.website }</td>\n </tr>\n );\n}", "function adjustUserComponent(generator, disable...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds and sets the headers of the table.
function _setHeaders() { // if no headers specified, we will use the fields as headers. _headers = (_headers == null || _headers.length < 1) ? _fields : _headers; var h = _buildRowColumns(_headers); if (_table.children('thead').length < 1) _table.prepend('<thead></thead>'); _tab...
[ "function _setHeaders() {\n // if no headers specified, we will use the fields as headers.\n _headers = (_headers == null || _headers.length < 1) ? _fields : _headers;\n var h = _buildRowColumns(_headers);\n if (_table.children('thead').length < 1) _table.prepend('<thead></thead>');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a saved question view
function addSavedQuestionView(id){ document.getElementById(id).setAttribute("class", "p-3 mb-2 bg-success text-white") document.getElementById(id).setAttribute('value', 'saved'); }
[ "function saveQuestion(){\n rightPane.innerHTML = templates.renderQuestionForm();\n var questionForm = document.getElementById(\"question-form\");\n questionForm.addEventListener('click', function(event){\n event.preventDefault();\n var target = event.target;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds or removes nanoseconds.
addNanoseconds(value, createNew) { return this.addFractionsOfSecond(value, createNew, '_nanosecond', '_microsecond', 'addMicroseconds'); }
[ "addYoctoseconds(value, createNew) {\n return this.addFractionsOfSecond(value, createNew, '_yoctosecond', '_zeptosecond', 'addZeptoseconds');\n }", "addPicoseconds(value, createNew) {\n return this.addFractionsOfSecond(value, createNew, '_picosecond', '_nanosecond', 'addNanoseconds');\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion para ir a la vista Agregar, cuanto se esta en Modificar X
function irAAgregarMaestro(){ var msg = "Desea Agregar un NUEVO REGISTRO?.. "; if(confirm(msg)) Cons_maestro("", "agregar",tabla,titulo); }
[ "function Agregar_movimiento(){\r\n\t\tvar msg = \"Desea Agregar un NUEVO REGISTRO?.. \";\r\n\t\tif(confirm(msg)) Form_movimiento('', 'agregar');\r\n\t}", "function AgregarNuevoLibro(_titulo, _tema, _autor, _existencia, _ubicacion, _fecha_ingreso) {\n var nuevo_libro = Object.create(libro);\n if (Libros.len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When large text button is tapped
function largeTxtBtn(args) { if(largeTxt){ if(darkMode){ var text = args.object; text.text = "Disabled" largeTxt = false; application.setCssFileName("smallDark.css"); } else{ var text = args.object; text.text = "Disabled...
[ "function handleClickIncrement() {\n if (fontSize < 20) {\n setFontSize(fontSize + 1);\n }\n }", "iconClicked(e) {\n sounds.playSelect();\n const id = e.target.id;\n const { toolClick } = this.props;\n const getInsertText = {\n 'bold-text': '**Strong Text**',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a fragment from something that can be interpreted as a set of nodes. For `null`, it returns the empty fragment. For a fragment, the fragment itself. For a node or array of nodes, a fragment containing those nodes.
static from(nodes) { if (!nodes) return Fragment.empty; if (nodes instanceof Fragment) return nodes; if (Array.isArray(nodes)) return this.fromArray(nodes); if (nodes.attrs) return new Fragment([nodes], nodes.nodeSize); throw new RangeError("Can not convert " + nodes + " to a...
[ "createFragment(nodes) {\n const fragment = document.createDocumentFragment();\n for (const node of nodes)\n fragment.appendChild(node);\n return fragment;\n }", "static fromArray(array) {\n if (!array.length)\n return Fragment.empty;\n let joined, size = 0;\n for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Middleware: Sets `res.locals.sid` if user request provided a proper cookie.
async function getCookie(req, res, next) { if (req.cookies.sid) res.locals.sid = req.cookies.sid; return next(); }
[ "function setSSIDCookie(req, res, next) {\n // write code here\n function cb() {\n next();\n }\n User.findOne(req.body, function(error, user) {\n res.cookie('ssid', user._id, {httpOnly: true});\n res.locals.cookieId = user._id\n cb();\n })\n}", "function setExpressSessionId(req, sessionId) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DATA TYPES Tree class Each tree has a number of nodes, a list of nodes (of type node), and a 2D array of the probability of a fish swimming from one node to another (probability of passing a barrier)
function Tree(numNodes, nodeList, nodeHash, edgeProbs, root){ //properties //number of nodes in the tree this.numNodes = numNodes; //list of nodes in the tree (of type Node) this.nodeList = nodeList; this.nodeHash = nodeHash; this.root = root; //2-D array of the different edge probabilities //edgeProbs[i...
[ "function generate_tree() {\n\tgod_nodes.length = 0;\n\tlet num_of_nodes = 0;\n\n\tlet num_in_row = 1;\n\tlet current_y_pos = top_and_bottom_margin;\n\n\tfor(var row=0; row<depth; row++) {\n\t\tfor(var pos_in_row=0; pos_in_row<num_in_row; pos_in_row++) {\n\t\t\tnum_of_nodes++;\n\t\t\t//calculate center of square\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the random shorturl associated with a longurl, creating one first if none exists, and then calls callback(randomurl, longurl).
async function getOrCreateRandomMapping(longUrl) { // test if random shortening exists let randomUrl = await db.getRandomShortening(longUrl); if (randomUrl !== null) { console.log("got random shortening"); return randomUrl; } else { console.log("no shortening found"); // make new random shorteni...
[ "function getShortUrl() {\n return (Math.floor(Math.random() * (10000 - 1) ) + 1).toString();\n}", "function short(url, callBack) { \n getJSON({ host: 'www.googleapis.com', path: '/urlshortener/v1/url?key='+conf.googKey\n , port: 443, head: {'Content-Type':'application/json'}, post: '{\"longUrl\":\"'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! FUNCTIONS ____________________________________________________________________________________________________________________________ deals with actions that HTML calls apon addTask: a...
function addTask() { console.log('addTask called') if (!!taskInputValue) { // makes sure that taskInputValue is not blank setToDoArray(toDoArray.concat(taskInputValue)) setTaskInputValue('') } }
[ "function AddTask() {\n var task = AddTaskInput.value;\n if(!task) {\n return;\n }\n\n RemoveEmpty();\n\t\n\t//to reuse task or create a new temporary variable? JS allows us todo this. But changes meaning of object. Future iterations will help.\n\ttask = CreateTaskElement(task);\n\tList.append(ta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resample coordinates, creating great arcs between each.
function resample(coordinates) { var i = 0, n = coordinates.length, j, m, resampled = n ? [coordinates[0]] : coordinates, resamples, origin = arc.source(); while (++i < n) { resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates; for (...
[ "function resample(coordinates) {\r\n var i = 0,\r\n n = coordinates.length,\r\n j,\r\n m,\r\n resampled = n ? [coordinates[0]] : coordinates,\r\n resamples,\r\n origin = arc.source();\r\n\r\n while (++i < n) {\r\n resamples = arc.source(coordinates[i - 1])(coord...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes the check state on mouse down.
_downHandler(event) { const that = this, target = that.enableShadowDOM ? event.originalEvent.composedPath()[0] : event.originalEvent.target; if (that.disabled || that.readonly || that.checkMode === 'input' && target !== that.$.checkBoxInput || that.checkMode === 'lab...
[ "_downHandler(event) {\n const that = this,\n target = that.enableShadowDOM ? event.originalEvent.composedPath()[0] : event.originalEvent.target;\n\n if (that.disabled || that.readonly ||\n that.checkMode === 'input' && target !== that.$.checkBoxInput ||\n that.checkMo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
kvm_Input2 End kvm_Input3 Start
function kvm_input3(device_id) { console.log("kvm_input3 clicked: " + device_id); kvm3_post_data = { device_type: "kvmswitch", device_id: device_id, command: JSON.stringify({status: "INPUT3"}) }; // console.log("POST kvm_input3 method by jQuery"); jQuery.ajax({ ...
[ "function kvm_input2(device_id) {\n console.log(\"kvm_input2 clicked: \" + device_id);\n kvm2_post_data = { \n device_type: \"kvmswitch\",\n device_id: device_id, \n command: JSON.stringify({status: \"INPUT2\"})\n };\n //\n console.log(\"POST kvm_input2 method by jQuery\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prompt for a new developer and store it.
async function createNewDeveloper() { if(isStorytellerCurrentlyActive) { try { //prompt for the dev info let devInfoString = await vscode.window.showInputBox({prompt: 'Enter in a single developer\'s info like this: Grace Hopper grace@mail.com'}) //if there is anything in...
[ "async function createFirstDeveloper() {\n if(isStorytellerCurrentlyActive) {\n try {\n //prompt for the dev info\n let devInfoString = await vscode.window.showInputBox({prompt: 'Enter in a single developer\\'s info like this: Grace Hopper grace@mail.com'})\n\n //if there ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name : Oleg Mitrakhovich // zenit login : int222_161a17 // // // Do not modify any statements in detailPaymentCalculation function //
function detailPaymentCalculation(mortAmount,mortDownPayment,mortRate,mortAmortization) { //********************************************************************************// //* This function calculates the monthly payment based on the following: *// //* ...
[ "function detailPaymentCalculation(mortAmount,mortDownPayment,mortRate,mortAmortization) {\r\n\r\n //********************************************************************************//\r\n //* This function calculates the monthly payment based on the following: *//\r\n //* ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Question 5 a. Create a constructor function called `Movie` that has properties for `name`, `year`, `genre`, `cast`, and `description`. Create an instance of your `Movie`
function Movie(name,year,genre,cast,description){ this.name = name this.year = year this.genre = genre this.cast = cast this.description = description }
[ "function Movie(name, year, genre, cast, description){\n this.name = name;\n this.year = year;\n this.genre = genre;\n this.cast = cast;\n this.description = description;\n}", "function Movie (name, year, genre, cast, description){\n this.name = name;\n this.year = year;\n this.genre = genre;\n this.cast...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add props to state, update completion progress for preprogrammed tasks
componentDidMount() { var completed = 0; var total = this.props.subtasks.length; for (let i = 0; i < total; i++) { if (this.props.subtasks[i].completed) completed++; } var totalProgress = total === 0 ? 0 : Math.round((completed * 100) / total); thi...
[ "updateProgress() {\n var completed = 0;\n var total = this.state.subtasks.length;\n for (let i = 0; i < total; i++) {\n if (this.state.subtasks[i].completed) completed++;\n }\n var totalProgress =\n total === 0 ? 0 : Math.round((completed * 100) / total);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches the url for the passed in pref name and uses the URL formatter service to process it.
function getFormattedRegionURL(aPrefName) { var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]. getService(Components.interfaces.nsIURLFormatter); return formatter.formatURLPref(aPrefName); }
[ "function openFormattedURL(aPrefName) {\n var urlToOpen = Services.urlFormatter.formatURLPref(aPrefName);\n\n var uri = Services.io.newURI(urlToOpen);\n\n var protocolSvc = Cc[\n \"@mozilla.org/uriloader/external-protocol-service;1\"\n ].getService(Ci.nsIExternalProtocolService);\n protocolSvc.loadURI(uri);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_ESAbstract.IteratorClose / global GetMethod, Type, Call 7.4.6. IteratorClose ( iteratorRecord, completion )
function IteratorClose(iteratorRecord, completion) { // eslint-disable-line no-unused-vars // 1. Assert: Type(iteratorRecord.[[Iterator]]) is Object. if (Type(iteratorRecord['[[Iterator]]']) !== 'object') { throw new Error(Object.prototype.toString.call(iteratorRecord['[[Iterator]]']) + 'is not an Object.'); }...
[ "function iteratorClose(iteratorRecord, completion) {\n\t\t// 1. Assert: Type(iteratorRecord.[[Iterator]]) is Object.\n\t\tif (typeof iteratorRecord['[[Iterator]]'] !== 'object') {\n\t\t\tthrow new Error(Object.prototype.toString.call(iteratorRecord['[[Iterator]]']) + 'is not an Object.');\n\t\t}\n\t\t// 2. Assert:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the pool profiles stored locally
returnPoolProfiles() { return this.poolProfiles }
[ "async getProfiles () {\n return this._getProfilesFromLocalStorage()\n }", "static getProfiles() {\r\n let profiles;\r\n if (localStorage.getItem('profiles') === null) {\r\n profiles = [];\r\n } else {\r\n profiles = JSON.parse(localStorage.getItem('profiles'));\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates and element of type, assigns it under parent, and adds a class of classname to it
function createElementModAddClass(type, parent, classname) { var telem = document.createElement(type); telem.classList.add(classname); parent.appendChild(telem); }
[ "function elementBuilder (elType, className, parent) {\n const newElement = document.createElement(elType);\n newElement.classList.add(className);\n parent.appendChild(newElement);\n return newElement;\n}", "function makeEmnt(parent, elTyp, className, inText) {\n const tempELm = document.createElem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FIND CUSTOMERS FRIENDS WITH MATCHING LETTER
function matchingFriendsLetter(array, person, letter){ var messg; var count = 0; var wholeMssg; var matchingFriends; customers.filter(function(value, index, arr){ if(value.name === person){ matchingFriends = value.friends; } return matchingFriends; }); matchingFriends.filter(functi...
[ "function friendsWith(people, person){ //@params: list of people, customer whose name we're looking for in friends lists\n var customersFriends = [];\n _.each(people, function(customer, i , people){\n if (people[i].hasOwnProperty(\"friends\")){\n _.each(people[i][\"friends\"], function(frien...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init the current view as the Bottom left view of the quad view
initBottomLeft(){ this._config = { left: 0.0, bottom: 0.0, width: 0.5, height: 0.5, position: [ 0, 0, -this._objectSize ], up: [ 0, 1, 0 ], // init with a given angle to correct issues initAngle: { axis: new THREE.Vector3( 1, 0, 0 ), angle: 0 } ...
[ "initBottomLeft(){\n this._config = {\n left: 0.0,\n bottom: 0.0,\n width: 0.5,\n height: 0.5,\n position: [ 0, 0, -this._objectSize ],\n up: [ 0, 1, 0 ],\n // init with a given angle to correct issues\n initAngle: {\n axis: new THREE.Vector3( 1, 0, 0 ),\n an...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transfer from "Damage info" page
function damageinfo_submit() { current_shipment.damage = $('#damage_info').val(); show('page-image-box'); }
[ "function attackShow(matches,msg){\r\n //get the damage details obj\r\n var details = damDetails();\r\n //quit if one of the details was not found\r\n if(details == undefined){\r\n return;\r\n }\r\n\r\n if(matches && matches[1] && matches[1].toLowerCase() == \"max\"){\r\n var value = \"max\";\r\n } els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw front doors for ETR 480
function generateFrontDoors480(){ var front1 = generateFrontDoor480(); var front2 = STRUCT([T([0,1])([4,trainWidth]),R([0,1])(PI),front1]); var frontDoors = COLOR([0.8,0.8,0.8])(STRUCT([T([2])([-0.9]),front1,front2])); return frontDoors; }
[ "function generateFrontDoor480(){\r\n\tvar c3 =BEZIER(S0)([[0,0,0.2],[0.4,0,0.2],[0.8,0,0.2],[0.4,0.3,0.2],[0.4,(trainHeight*2/3)-0.3,0],[0.4,(trainHeight*2/3)-0.2,0],[0.8,(trainHeight*2/3)-0.2,0.2],[0.4,(trainHeight*2/3),0.2],\r\n\t\t\t\t\t\t[0,(trainHeight*2/3)-0.2,0.2]]);\r\n\tvar c4 =BEZIER(S0)([[0,0,0.2],[-0.4...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Performs the click action, this can be called for any event you want to recreate a click action for.
function doClick(e) { options.onClick(e); }
[ "performClickFunctionality(){}", "function handler_click() {\n\t\t//\tStuff to do on the click\n\t}", "click() {\n const pos = this.getTargetPosition();\n pos.x += pos.width / 2;\n pos.y += pos.height / 2;\n const fakeEventObject = getFakeMouseEvent('click', pos);\n fireEventO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internals Find the first overflowing linebox obeying widow and orphan rules
findLineBoxRange(relaxWidowsAndOrphans) { let { widows, orphans } = this.containerRules; widows = widows || 2; orphans = orphans || 2; if (relaxWidowsAndOrphans) { widows = 1; orphans = 1; } let lineBoxes = []; let overflow = false; let overflowIndex; for (const lineB...
[ "getHorizontalLine(slab) {\n // console.log(\"getHorizontalLine() -- \" + this.arrAllLines.length);\n let retElement;\n if (this.arrAllLines.length > 0) {\n this.arrAllLines.forEach((element) => {\n if (element.topY === slab.yPosition) {\n retElement = element;\n }\n });\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selects a topic to be active (may be the current active topic)
function selectTopic() { //Topic is different than existing active topic if (selectedTopicID != $(this).val()) { if (selectedTopicID != null && selectedTopicID != "") { stopTimer(); unsetActiveTopic(); } selectedTopicID = $(this).val(); storeSelectedTopicID(); setActiveTopic(); startTimer(); do...
[ "function updateActiveTopic(topic) {\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.select(\"#g-topic\").text((topic.count > maxMentions ? \"A sampling of \" : topic.count || \"No\") + \" mentions of \" + topic....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates map with databases and their photos which are going to be deleted and in which galleries they are
function getGalleriesToClear(photosToDelete) { var deleteDatabaseMap, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, filename, photo, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, database; return regeneratorRuntime.async(function getGall...
[ "async function getGalleriesToClear(photosToDelete) {\n const deleteDatabaseMap = new Map()\n for (const filename of photosToDelete) {\n const photo = await findPhotoByFileName(filename)\n for (const database of photo.galleryTitles) {\n if (!deleteDatabaseMap.has(database)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for filling the second FLOT chart with the medians of the selected school(s) total scores
function showMedianTotalScoreChart() { var dataValues = []; var dataSet = []; var dataSeries = []; var satObject; var currentYear = ""; var nextYear = ""; var currentSchool = ""; var nextSchool = ""; var seriesCount = 0; var median = 0.0; if (filteredSatArray.length > 0) {...
[ "function showMeanMathScoreChart() {\n var dataValues = [];\n var dataSet = [];\n var dataSeries = [];\n\n var satObject;\n var currentYear = \"\";\n var nextYear = \"\";\n var currentSchool = \"\";\n var nextSchool = \"\";\n\n var average = 0.0;\n\n if (filteredSatArray.length > 0) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes the turn and turn timer, returns timerId
function startTurnTimer(timerId, turnDuration, socketId) { // If turn timer isn't already running if (!timerId) { console.log('Initializing turn timer!'); // Initialize time of next turn change (will use this to sync the clients) nextTurnChangeTimestamp = Date.now() + turnDuration; console.log( new Date(nex...
[ "initTimer() {\n this.timer = setInterval(() => {\n this.currTime--;\n if (this.currTime <= 0) {\n this.createGame();\n this.resetMatchmaking();\n }\n }, 1000);\n }", "function initializeTimer() {\n if (!currentTimerIntervalID){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remember that it's no longer the first app launch
unsetFirstAppLaunch() { return AsyncStorage.setItem(kKeyFirstLaunch, kFalse); }
[ "relaunch() {}", "function restartApp() {\n\tclear(); // native processing clear\n\tclearAppData();\n\tsetup();\n}", "function clearFirstBoot() {\r\n\t//window.localStorage.clear();\r\n\tnavigator.app.exitApp();\r\n}", "afterLaunch() {}", "function reinitApp() {\n initApp()\n}", "static onShutdown() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the new position in the source after reading digits.
function readDigits(source, start, firstCode) { var body = source.body; var position = start; var code = firstCode; if (code >= 48 && code <= 57) { // 0 - 9 do { code = body.charCodeAt(++position); } while (code >= 48 && code <= 57); // 0 - 9 return p...
[ "_calculateNewCursorPosition() {\n var valuePartBeforeCursor = String(this._rawViewValue).slice(0,this._cursor);\n valuePartBeforeCursor = this._removeThousandSeparator(valuePartBeforeCursor);\n valuePartBeforeCursor = this._removeLeadingZero(valuePartBeforeCursor);\n\n var currentPosition = valuePartBe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================= Funcion para hacer un select a la tabla puertas_valores_maniobras que recibe por parametro el codigo de la inspeccion ==============================================
function obtenerValoresManiobras(cod_usuario,cod_inspeccion){ db.transaction(function (tx) { var query = "SELECT k_coditem,v_calificacion,o_observacion FROM puertas_valores_maniobras WHERE k_codusuario = ? AND k_codinspeccion = ?"; tx.executeSql(query, [cod_usuario,cod_inspeccion], function (tx, resultSet) { ...
[ "function obtenerValoresMecanicos(cod_usuario,cod_inspeccion){\n db.transaction(function (tx) {\n var query = \"SELECT k_coditem,v_calificacion,o_observacion FROM puertas_valores_mecanicos WHERE k_codusuario = ? AND k_codinspeccion = ?\";\n tx.executeSql(query, [cod_usuario,cod_inspeccion], function (tx, res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=== Functions that require jQuery but have no place on this Earth, yet === here we change the link of the Edit button in the Admin Bar to make sure it reflects the current page
function adminBarEditFix(id) { //get the admin ajax url and clean it var baseURL = ajaxurl.replace('admin-ajax.html','post.html'); $('#wp-admin-bar-edit a').attr('href',baseURL + '?post='+ id +'&action=edit'); }
[ "function adminBarEditFix(id) {\n\t//get the admin ajax url and clean it\n\tvar baseURL = rosaStrings.ajaxurl.replace('admin-ajax.php', 'post.php');\n\n\t$('#wp-admin-bar-edit a').attr('href', baseURL + '?post=' + id + '&action=edit');\n}", "function adminBarEditFix(id) {\n\t//get the admin ajax url and clean it\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====================================================================== Creates an index builder.
function IndicesBuilder() { this._indices = []; this._indexObjs = []; }
[ "function createIndex() {\n var index = elasticlunr(function() {\n this.addField('file');\n this.addField('data');\n this.setRef('hash');\n this.saveDocument(false);\n });\n /*\n * We dont need to store the original JSON document. This reduces the index\n * size and we can already refer to the do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Window_JunctionActor This window lists the actor junctioned to the currently ed GF.
function Window_JunctionActor() { this.initialize.apply(this, arguments); }
[ "function Window_SkillListJunction() {\n this.initialize.apply(this, arguments);\n}", "function displayActor(actor) {\n\t\tvar entry = document.createElement(\"li\");\n\t\tentry.innerHTML = actor.firstName +\" \"+ actor.lastName +\" (\"+ actor.filmCount +\" films)\";\n\t\tdocument.getElementById(\"celebs\").appe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update tech assigned to ticket
async function updateTech(id, tech) { const ticket = await Ticket.findById(id) console.log('into uppdateTech') // TODO save tech id in this space as well // tricky to pass through the select dialog // unless select dialog values array is changed to {id, label} format ticket.tech = { "i...
[ "function setTechId(ticketId, techName){\n\t\t var jsonObj = {\"customFields\": [{\"definitionId\": 30, \"restValue\": techName}]}\n\t\t var jsonStr = JSON.stringify(jsonObj);\n\t\t\t$.ajax({\n\t\t\t\t url: \"http://helpdesk/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets/\"+ticketId+\"?apiKey=GTxT2m6i2rEw4bnbaQ7H...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tilex v1.0 (tilex_v1.min.js) Available under MIT License
function tilexContract(e){var t=document.getElementsByClassName("tilex-tile-current")[0],i=t.getBoundingClientRect(),l=i.top,n=i.left,s=(t.getElementsByClassName("tilex-large-content")[0],getComputedStyle(t)),a=document.getElementById("tilex-expanded-tile"),d=a.getElementsByClassName("tilex-small")[0],o=a.getElementsBy...
[ "function TileRenderer(){var _this;_classCallCheck(this,TileRenderer);_this=_super.call(this);_this[TILE_INDEX]=new Map();_this[TILE_UNINDEX]=new Map();_this.layer=null;return _this;}", "function getTileElement(x, y) {\n return element(\"tile-\" + x + \"-\" + y);\n}", "defineTile(name, x, y) {\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if variable is a valid object
function validObject(A) { return A === Object(A); }
[ "function objectCheck() {\n\tvar someInput = buildObject();\n\tif (typeof someInput == 'object' ) {\n\t\tconsole.log( 'everything is an Object' );\n\t\t// this will never not be an object\n\t} else {\n\t\tconsole.log( 'That\\'s not an object!')\n\t}\n}", "function isObj(Variable) {\n return Variable instanceof...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the data of a new appointment
setAppointmentNewData(state, appointmentNewData) { state.appointmentNewData = appointmentNewData; }
[ "function appointmentData(company, date,number){\n this.company = company;\n this.date = date;\n this.number = number;\n }", "function setMeetingData()\n\t\t{\n\t\t\tmeetingData[\"subject\"] = inputSubject.value;\n\t\t\tmeetingData[\"starttime\"] = inputStartDate....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FIN LISTE DES GROUPES DE L'UTILISATEUR /LISTE DES ENTREPRISES
function listEntreprise() { $http({ method: 'GET', url: baseUrl + 'admin/entreprise/list', data: {}, headers: { 'Authorization': 'Bearer ' + localStorage.getItem('jeton') } }).then(function successCallback(response) { ...
[ "function listarInstrutores () {\n instrutorService.listar().then(function (resposta) {\n //recebe e manipula uma promessa(resposta)\n $scope.instrutores = resposta.data;\n })\n instrutorService.listarAulas().then(function (resposta) {\n $scope.aulas = resposta....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a specific square's data to the store chr: the character of the square data to save sze: the size of the square
function addSquare(chr, sze,next, errFunc) { console.log('adding square char:' + chr + ' size:' + sze); var db = new Db(dbName, new Server(host, port)); db.open(function(err, db){ // Fetch the collection var collection = db.collection(collectionName); collection.save({_id:chr,char:ch...
[ "function addPiece(piece, square) {\n board[square] = piece;\n hashKey ^= pieceKeys[piece * 128 + square];\n pieceList.pieces[piece * 10 + pieceList[piece]] = square; \n pieceList[piece]++;\n }", "function Square() {\n this.symbol = \"\";\n this.isOccupied = false;\n }", "addSquareToBoard...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unwraps a result, returning the content of an `Ok`. If the value is an `Err` then it calls `fn` with its value.
unwrapOrElse(fn) { if (this.isOk()) { return this.value } return fn(this.error) }
[ "function maybeUnwrapFn(value) {\n if (value instanceof Function) {\n return value();\n }\n else {\n return value;\n }\n}", "unwrap() {\n if (this.isOk()) {\n return this.value\n }\n throw Error('Called `Result#unwrap()` on an `Err` value: ' + this.error)\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For the basic usage of CSelect simply pass an array of cases as created by ccase(...). However, to provide some flexibility the parameter of CSelect is processed as follows: For an array, process all its elements recursively. For a function, apply the function to the context and process the return value recursively. An...
function CSelect(rawCases) { return new Type("select", function makeSelect(ctx) { var value = ctx.value; var updateTo = ctx.updateTo; var problems = ctx.problems; var cases = processCases(ctx, rawCases); var defaultCase = cases.find(function (x) { return x.isDefault; }) || findCaseWithBestMode...
[ "enterSimpleSelect(ctx) {\n\t}", "function selectCaseAndChildren( iCase) {\n var tChildren = iCase.get('children'),\n tCollection = this_.getCollectionForCase( iCase),\n tController = tCollection && tCollection.get('casesController');\n if( tController) {\n var tSelection = tCon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a grid of buttons, assigning key values based on key matrix
_renderButtonGrid() { return inputButtons.map((row, index) => { let rowComponents = row.map((keyValue, columnIndex) => { return <CalcButton value={keyValue} key={ 'key-' + columnIndex} handleKeyPress={this._handleK...
[ "function generateButtons() {\n var startNote = 261.6;\n for (var i = 0; i < numBtns; i++) {\n //Calculate which octave this is in (every 7 notes)\n var octave = Math.floor(i / Key.length);\n //Calculate what the new base note is (doubled for every octave)\n var note = startNote * Math.pow(2, octave);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate if text position is in field forward
validateForwardFieldSelection(currentIndex, selectionEndIndex) { let textPosition = new TextPosition(this.owner); textPosition.setPositionForCurrentIndex(currentIndex); textPosition.isUpdateLocation = false; let isPositionMoved = false; while (currentIndex !== selectionEndIndex &...
[ "function check_and_move() {\n if (this.value.length == max_length) {\n move_to_next_field(this);\n }\n}", "validateBackwardFieldSelection(currentIndex, selectionEndIndex) {\n let textPosition = new TextPosition(this.owner);\n textPosition.setPositionForCurrentIndex(currentIndex);\n text...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new GatewayListSubAdmins. gatewayListSubAdmins is a command that returns list sub admins
constructor() { GatewayListSubAdmins.initialize(this); }
[ "function listSubAccounts() {\n const data = new BinRequest().get(\"wapi/v3/sub-account/list.html\");\n return data && data.subAccounts ? data.subAccounts : [];\n }", "function makeSubAdmin(req, res, next) {\n makeAccountSubAdmin(req, res).then((result) => {\n return res.status(200).json(result);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build rectangle object, based on its parameters
function build_rect(rect_params, long, short, long_pos, short_pos) { return { [rect_params['long_dim']]: long, [rect_params['short_dim']]: short, [pos_dim[rect_params['long_dim']]]: long_pos, [pos_dim[rect_params['short_dim']]]: short_pos }; }
[ "function createRectangle() {\n new Rectangle(rectangleHeight.value, rectangleWidth.value);\n }", "function Rectangle(_x, _y, _width, _height, _colour) {\n \n // Return a rectangle object\n return {x: _x, y: _y, width: _width, height: _height, colour: _colour};\n \n}", "createRectangle()\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the shift in coordinates of the center when item is rotated, moved and scaled at the same time.
function getCenterShift(center, point1, startPoint1, point2, startPoint2) { // Get angle var angle = getRotation(point1, startPoint1, point2, startPoint2) - 90; if (angle < 0) { angle += 360; } // Get distance between new position var distance = getDistance(point1, point2); // Calcul...
[ "function getCenterShift(center, point1, startPoint1, point2, startPoint2) {\n // Get angle\n var angle = getRotation(point1, startPoint1, point2, startPoint2) - 90;\n\n if (angle < 0) {\n angle += 360;\n } // Get distance between new position\n\n\n var distance = getDistance(point1,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Traverses the root node to locate preliminary elements/data. Looks for the first instance. If no `href` attribute exists, the element is ignored and possible successors are considered. Looks for all robot instances and cascades the values.
function findPreliminaries(rootNode, robots) { var name; var find = { base: true, robots: robots != null }; var found = { base: false }; var result = { base: null }; walk(rootNode, function(node) { switch (node.nodeName) { // `<base>` can be anywhere, not just within `<head>` case "base": ...
[ "function scrapeHtml(document, robots)\n{\n\tvar link,links,preliminaries,rootNode;\n\t\n\trootNode = findRootNode(document);\n\t\n\tif (rootNode != null)\n\t{\n\t\tpreliminaries = findPreliminaries(rootNode, robots);\n\t\tlinks = [];\n\t\t\n\t\tfindLinks(rootNode, function(node, attrName, url)\n\t\t{\n\t\t\tlink =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a follower record in the leancloud and also create a default user
function createAndSave( openId, pubAccoutId, createTime){ var follower = new Follower(); follower.set("openId",openId); follower.set("pubAccoutId", pubAccoutId); follower.set("createTime", createTime); follower.save(null, { success: function(follower) { console.log('New object created with objectId: ' + f...
[ "async function createNewFollow() {\n await createFollow(follow);\n }", "async insert(follower) {\n\n // just reserve table followers' attributes\n follower = this._formatTableValue(this.table, follower);\n\n // token or email doesn't exist\n if (!follower.token...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if speech is valid and extract command
function checkWord({ results }) { const word = results[results.length - 1][0].transcript; let isValid = false; commands.forEach((command) => { if (word.includes(command)) { isValid = true; detectedSpeech = command; } }); return isValid; }
[ "function checkCommand(){\n if(command === \"movie-this\"){\n movieThis(search);\n }\n else if(command === \"concert-this\"){\n concertThis(search);\n }\n\n else if(command === \"spotify-this-song\"){\n spotifyThis(search);\n }\n}", "function valid_command() {\n\n\tvar typed = handler.consoleLine.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
knock enemy back, this.hero.direction == true : forwoard(right); this.hero.direction == false : backward(left) TODO this shouldn't necessarily be dependet on player direction, based on hitbox presented
knockEnemyBack(v){ this.knockEnemy = true; this.hero.direction ? this.knockVelocity = v : this.knockVelocity = -v; //this line is too hacky, this.body.velocity.y = -60 * (10*Math.random()); this.knockBackFor = this.setDelay(this.knockbackSet); this.animations.play('knock'); // console.log('knock...
[ "function goBackward(rover) {\n switch(rover.direction) {\n case 'N':\n rover.position[1]--;\n break;\n case 'E':\n rover.position[0]--;\n break;\n case 'S':\n rover.position[1]++;\n break;\n case 'W':\n rover.position[0]++;\n break;\n }\n}", "function goBac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a hex string to an HSB object
function hex2hsb(hex) { var hsb = rgb2hsb(hex2rgb(hex)); if(hsb.s === 0) hsb.h = 360; return hsb; }
[ "function hex2hsb(hex) {\n var hsb = rgb2hsb(hex2rgb(hex));\n if(hsb.s === 0) hsb.h = 360;\n return hsb;\n }", "function hex2hsb(hex) {\nvar hsb = rgb2hsb(hex2rgb(hex));\nif( hsb.s === 0 ) hsb.h = 360;\nreturn hsb;\n}", "function hex2hsb(hex) {\n var hsb = rgb2hsb(hex2rgb(hex));\n if( hsb.s ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get total length of the IHM showPanel animation
get _animationShowLength() { if (_WinRT.Windows.UI.Core.AnimationMetrics) { var a = _WinRT.Windows.UI.Core.AnimationMetrics, animationDescription = new a.AnimationDescription(a.AnimationEffect.showPanel, a.AnimationEffectTarget.primary); ...
[ "get _animationShowLength() {\r\n if (!WinJS.Utilities.hasWinRT) {\r\n return 0;\r\n }\r\n\r\n var a = Windows.UI.Core.AnimationMetrics,\r\n animationDescription = new a.AnimationDescription(a.AnimationEffect.showPanel, a.AnimationEffectTarget.primary);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
I build a week title for a give start date
function buildWeekTitle( start_date ){ var week_from = moment( start_date ).startOf( 'week' ).add( 1, 'days' ); var week_to = moment( start_date ).endOf( 'week' ).add( 1, 'days' ); var week_title = week_from.format( 'Do' ) + ' - ' + week_to.format( 'Do MMMM' ); ret...
[ "function fillWeekTitle(){\n\tvar str = starttime;\n\tvar title;\n\tvar tempId ;\n\tvar weekTimeShow;\n\tvar titleDate = new Date(str.split(\"-\")[0],(str.split(\"-\")[1]-1),str.split(\"-\")[2].split(\" \")[0]);\n\tfor(var i=1;i<=7;i++){\n\t\ttempId = \"weektitle_\"+i;\n\t\ttitle = weekDays[i-1] ;//+ titleDate.getY...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reports the current component's ready state to the parent once all sub components are ready
reportComponentReadiness() { if (this.is_loading) {return;} let parent_component_obj = this.getParentComponent(); if (this.sub_component_definitions.length === 0) { if (parent_component_obj != null) { parent_component_obj.reportSubComponentReady(this.getUid()); } else { if (this.getUid() === page_ui...
[ "ready() {\n // if (!this.isReady) {\n this.ancestor.dispatchEvent(Events.createReady(this));\n // this.isReady = true;\n // }\n }", "ready() {\n this._root = this._createRoot();\n super.ready();\n this._firstRendered();\n }", "updateReadyEvents() {\n if (this.isR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to Update employee records
function updateEmployee() { }
[ "function updateEmployee(req, res) {\n var fields = [\n req.query.sam_account_name,\n req.query.first_name,\n req.query.middle_name,\n req.query.last_name,\n req.query.display_name,\n req.query.job_title,\n \n req.query.employee_no // Employee No is primary key used for update\n ];\n\n da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the next format index left of a specified index. If no index exists, returns the leftmost index.
function getLeftFormatIndex(maskCharData, index) { for (var i = maskCharData.length - 1; i >= 0; i--) { if (maskCharData[i].displayIndex < index) { return maskCharData[i].displayIndex; } } return maskCharData[0].displayIndex; }
[ "leftOf(index) {\n return (index % stonesPerLine === 0 ? -1 : index - 1);\n }", "function getLeftFormatIndex(maskCharData, index) {\n for (var i = maskCharData.length - 1; i >= 0; i--) {\n if (maskCharData[i].displayIndex < index) {\n return maskCharData[i].displayIndex;\n }\n }\n\n return maskC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scan a BN tree for unsuccessful favicons to fetch, and trigger updates as needed function of options.disableFavicons. BN = BN tree to scan faviconWorker = function to post favicons fetching to setFavicon = function to call for directly setting favicon
function scanFavBNTree (BN, faviconWorker, setFavicon) { if (!options.disableFavicons && !options.pauseFavicons) { let type = BN.type; if (type == "folder") { let children = BN.children; if (children != undefined) { let len = children.length; for (let i=0 ; i<len ;i++) { scanFavBNTree(childr...
[ "function menuRefreshFav (BN_id) {\n let BN = curBNList[BN_id];\n\n // Trigger asynchronous favicon retrieval process\n let url = BN.url;\n if ((url != undefined)\n\t && !url.startsWith(\"file:\")\t // file: has no favicon => no fetch\n\t && !url.startsWith(\"about:\")) { // about: is protected - security er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renames a named range
function renameTableRange(ss, oldName, newName) { var matchingRange = findTableRange(ss, oldName) if (null != matchingRange) { matchingRange.setName(buildTableRangeName_(newName)) } }
[ "function setRangeName () {\n var ss = \n SpreadsheetApp.getActiveSpreadsheet(),\n sh = ss.getActiveSheet(),\n rng = sh.getRange('A1:B10'),\n rngName = 'MyData';\n ss.setNamedRange(rngName, rng);\n}", "function setNamedRanges () {\n this.prefix = prefix\n this.sh = template_sheet\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle map container, render map only once.
function toggleMap() { $map.toggleClass('js-show'); $('#js-map') .toggleClass('fa-map') .toggleClass('fa-map-o'); if ($map.is('.js-show') && !map_initd) { setTimeout(function () { window.initMap(); map_initd = true; }, $.flatfindr.BASE_DURATION * 2); } if ($...
[ "function mapToggle() {\n var trafficMap = document.getElementById(\"trafficMap\");\n\n if (mapOn) {\n console.log(\"Map was visible\");\n trafficMap.style.display = \"none\";\n\n mapOn = false;\n}\nelse {\n console.log(\"Map was not visible\");\n trafficMap.style.display = \"\";\n\n // Reload t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
determines if the context is that of an activitybuilder app
function isActivityBuilder() { return /https:\/\/.*\.desmos\.com\/activitybuilder\/custom\/\w*\/edit.*/.test(document.URL); }
[ "function isApp(app) {\n return app && app.context && app.response && app.request\n}", "async seeCurrentActivityIs(currentActivity) {\n onlyForApps.call(this, 'Android');\n const res = await this.browser.getCurrentActivity();\n return truth('current activity', `to be ${currentActivity}`).assert(res === ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the name of SASL realm for given bind principal
function getSASLRealm(bindPrincipal){ return "nightlabs.de"; }
[ "function saslName(aName) {\n // RFC 5802 (5.1): the client SHOULD prepare the username using the \"SASLprep\".\n // The characters ’,’ or ’=’ in usernames are sent as ’=2C’ and\n // ’=3D’ respectively.\n let saslName = saslPrep(aName)\n .replace(/=/g, \"=3D\")\n .replace(/,/g, \"=2C\");\n if (!saslName)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the shipping line items
function getShippingLineItems() { return ensureArray(_.filter(this.items, function (item) { return item.lineItemTypeField.alias === 'Shipping'; })); }
[ "function getShippingAddresses() {\n return getAddressesByAddressType.call(this, 'Shipping');\n }", "getLineItems() {\n let items = [];\n this.lineItems.forEach(item =>\n items.push({\n type: 'sku',\n parent: item.sku,\n quantity: item.quantity,\n })\n );\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On finishing the loading of the records: use the last tr id to select a tr set the focus to the client hint
function OnFinishLoading() { // //Get the last tr id that was edited or selected var last_tr_id = window.localStorage.last_tr_id; // //Retrieve the last identified tr var tr = document.getElementById(last_tr_id); // //Ch...
[ "next(){let allTr=this.shadowRoot.querySelector(\"tbody\").querySelectorAll(\"tr\");if(allTr.length>this._selectedIndex){this._focusRowByIndex(this._selectedIndex+1)}}", "prev(){if(0<=this._selectedIndex){this._focusRowByIndex(this._selectedIndex-1)}}", "next() {\n const allTr = this.shadowRoot.querySelector...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write to either dashboard or stdout.
function stdout (data) { if (dashboard) { dashboard.log(data); } else { process.stdout.write(data); } }
[ "_stdout(toggle) {\n try {\n const outputs = ['stdout', 'stderr'];\n if (toggle) {\n if (this.stdmocks)\n return;\n this.stdmockOrigs = {\n stdout: process.stdout.write,\n stderr: process.stderr.write...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throws an error if the passed recipeName is not a defined Recipe recipeName.
assertName(recipeName) { this.findDoc(recipeName); }
[ "async findRecipeByName(recipeName) {\n const recipes = await knex.select()\n .from('personal_recipe')\n .where({ 'name': recipeName });\n return recipes.length === 0 ? null : this._recipeTableToModel(recipes[0]);\n }", "validateName() {\n const name = this.state.newName;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mark the selected page
function set_page(page) { selected = page; }
[ "selectPage (which) {\n this.selectedPage = which;\n }", "function _selectPage(self, page) {\n self.selected = self._valueForItem(page);\n}", "function setPage(number){\n window.editor.SetSelectedPage(number);\n}", "function setPage(value) {\n currentPage = value;\n}", "function setActivePa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate the Winning Number
function generateWinningNumber(){ return Math.ceil(Math.random() * (1,100)); }
[ "function generateWinningNumber(){\n\t\t// add code here\n\t\treturn Math.floor(Math.random() * (100 - 1 + 1)) + 1;\n\t}", "function generateWinningNumber(){\n //Use random function generator to generate number unique for each game.\n return Math.floor(Math.random() * 100);\n }", "function generateWinnin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the select2 options
function getOptions(select2_) { var select2 = _getSelect2(select2_); var data = select2.data('select2'); if (!data) return undefined; return data.options.options; }
[ "_getSelect2Options() {\n // Compose options\n const options = Object.assign(\n {},\n _.result(this, 'defaultOptions'),\n _.pick(this.options, this.configurableOptions)\n )\n\n options.multiple = this.$el.prop('multiple')\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to set motor speed
function setSpeed(speed){ for (m in motors){ ms.setMotorSpeed(motors[m], speed); } //currentSpeed = speed; console.log("Speed set to" + speed); }
[ "function setSpeed() {}", "setMotorSpeed () {\n var tickDelta = this.tickDelta()\n\n switch (true) {\n case (tickDelta <= 3):\n this.motor.speed = SPEEDS.SINGLE_KERNEL\n break\n case (tickDelta > 3 && tickDelta <= 8):\n //this.motor.speed = SPEEDS.VERY_SLOW\n this.motor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function generates the dropdowns for the findProject search criteria INNER FUNCTION CALLS: none
function generateDropdowns_FIND_PROJECTS(jsonData, field) { let json = JSON.parse(jsonData); let d = document.createDocumentFragment(); let sorted = false; for (var i = 0; i < json.length; i++) { if (field == 'Manager' || field == 'Supervisor') { if (json[i].name == 'Bart' || json[i].name == 'Lillian...
[ "function generateDropdowns_FIND_PROJECTS(jsonData, field) {\n\t\n\tlet json = JSON.parse(jsonData);\n\t\n\tlet d = document.createDocumentFragment();\n\tlet sorted = false;\n\tfor (var i = 0; i < json.length; i++) {\n\t\t\n\t\tif(field == \"Manager\" || field == \"Supervisor\") {\n\t\t\tif(json[i].name == \"Bart\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adding ccs height of the mapdiv and legalcontent dynamicly.
function mapAndContentOnload() { if (windowWidth > 1189) { legalContentHeight = Math.round($(window).height() * 0.28); legalMapHeight = Math.round($(window).height() * 0.51); } else if ((windowWidth < 1189) && (windowWidth > 889)) { legalContentHeight = Math.round($(window).height() * 0.28);...
[ "function setMapHeight()\n {\n var iH = window.innerHeight - document.getElementById(\"cssmenu\").offsetHeight - 2;\n\n// document.getElementById(\"map\").style.height = iH+\"px\";\n $('#browse-map').height(iH);\n }", "function setMapHeight() {\n\t\tvar window_height = $(window).height();\n\t\t$('#content...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates watchers on scope and newScope that ensure that for any $digest of scope, newScope is also $digested.
function connectScopes() { var scopeDigesting = false; var newScopeDigesting = false; scope.$watch(function() { if (newScopeDigesting || scopeDigesting) { return; } scopeDigesting = true; scope.$$postDigest(function() { if (!newSc...
[ "function connectScopes() {\r\n var scopeDigesting = false;\r\n var newScopeDigesting = false;\r\n\r\n scope.$watch(function() {\r\n if (newScopeDigesting || scopeDigesting) {\r\n return;\r\n }\r\n\r\n scopeDigesting = true;\r\n scope.$$postDigest(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if any of the input states have the error flag set to true; returns false if there are no states, or the input states are set to undefined or false.
function haveInputErrors(states) { if (_.isArray(states)) { return _.reduce(states, function(result, state) { return result || state.error; }, false); } else if (_.isObject(states)) { return (states.error === true); } return false; }
[ "isErrorState() {\n return this.currentStates.length === 0;\n }", "hasErrors() {\n let found = false;\n for (let key of Object.keys(this.state.errors)) {\n if (this.state.errors[key]) {\n found = true;\n break;\n }\n }\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: testFloat(valueOFinput, plusORnegative, decimal). Description: Check out that if the parameter valueOFinput is a float number with its sign according to parameter plusORnegative and its max decimal digits is parameter decimal. Param: A string or a number deing tested. A string implies plus ,negative or throw ...
function testFloat(valueOFinput, plusORnegative, decimal){ valueOFinput = valueOFinput.replace(/(^\s*)|(\s*$)/g, ""); plusORnegative = plusORnegative.replace(/(^\s*)|(\s*$)/g, ""); decimal = decimal.replace(/(^\s*)|(\s*$)/g, ""); if(valueOFinput==null || valueOFinput==""){ alert("Illegimate number input!"...
[ "function isPlusFloat(valueOfStr){\r\n\tvar patrn1 = /^(\\d+)(\\.\\d+)?$/;\r\n\ttry{\r\n\t\t//alert(\"isPlusFloat(\"+valueOfStr+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t}catch(e){\r\n\t\tretur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert `value` is a `JsonRpcResponsePayload` object.
function isJsonRpcResponsePayload(value) { if (isNil(value)) return false; return (!isUndefined(value.jsonrpc) && !isUndefined(value.id) && (!isUndefined(value.result) || !isUndefined(value.error))); }
[ "function isJsonRpcRequestPayload(value) {\n if (isNil(value))\n return false;\n return (!isUndefined(value.jsonrpc) && !isUndefined(value.id) && !isUndefined(value.method) && !isUndefined(value.params));\n}", "verifyValue(value, path) {\n if (this.devtools && !isSerializable(value, this.devtools....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Synchronizes the positions of the scroller to the current shown page index.
_refreshScrollerPosition() { this.__carouselScrollerWidth = qx.bom.element.Dimension.getWidth( this.__carouselScroller.getContentElement() ); this._scrollToPage(this.getCurrentIndex()); }
[ "queueSyncScroll() {\n this.queueRenderUpdate().syncScroll = true;\n }", "function syncVisualPanelScroll() {\n const visualPanelEl = document.querySelector('.visual-panel');\n const currentScroll = visualPanelEl.scrollTop;\n const targetScroll = calcScrollPosition();\n const difference = targetScrol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset DomVerticalMiniMap component and remove it from DOM.
destroy () { const mapElement = this._mapElement const isScrollElementEnabled = this._isScrollElementEnabled this._mutationObserver.disconnect() this._mutationObserver = null /* eslint-disable-next-line */ mapElement.removeEventListener('click', DomVerticalMiniMap.scrollDocumentTo.bind(event))...
[ "destroy () {\n const mapElement = this._mapElement\n const isScrollElementEnabled = this._isScrollElementEnabled\n\n this._mutationObserver.disconnect()\n this._mutationObserver = null\n\n /* eslint-disable-next-line */\n mapElement.removeEventListener('click', DomVerticalMiniMap.scrollTargetTo.b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets if the provided structure is a ParameterDeclarationStructure.
static isParameter(structure) { return structure.kind === StructureKind_1.StructureKind.Parameter; }
[ "static isParametered(structure) {\r\n switch (structure.kind) {\r\n case StructureKind_1.StructureKind.Constructor:\r\n case StructureKind_1.StructureKind.ConstructorOverload:\r\n case StructureKind_1.StructureKind.GetAccessor:\r\n case StructureKind_1.StructureKi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the index of the element searching by the Id of the task
function findElement(id){ var found = false; var i = 0; while(!found){ if($scope.tasks[i].id == id){ found=true; }else{ i++; } } return i; }
[ "getTaskPosition(taskId) {\n let foundIndex = 0;\n \n // Loops through task array\n for (let i=0; i<this.tasks.length; i++) {\n const task = this.tasks[i]\n // When task selected is the same as array, return index number\n if(task.id === taskId) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }