query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Function is to view employees in the form of a table in the command line
function viewEmployees() { db.query('SELECT * FROM employee', function (err, results) { console.table(results); goPrompt(); }); }
[ "function viewEE() {\n console.log(\"Viewing employees\\n\");\n\n\tconst query = `\n SELECT e.id AS employee_id, e.first_name, e.last_name, d.name AS department_name, r.title AS job_title, r.salary, CONCAT(x.first_name, \" \", x.last_name) AS manager_name \n FROM employee e\n LEFT JOIN role r\n ON e....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an instance of study summary service.
function StudySummaryService(payloadCommandService, baseConnectionService) { this.payloadCommandService = payloadCommandService; this.baseConnectionService = baseConnectionService; this.studySummaryData = {}; this.sourceSummaryData = {}; console.log('SO COMMON LIB Study Summary s...
[ "study(id) {\n return new Study({ clientSession: this.clientSession, id, parent: this });\n }", "function StudyFactory($q,\n $log,\n biobankApi,\n ConcurrencySafeEntity,\n DomainError,\n StudySta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the responsive menu class.
function _addResponsiveMenuClass() { $( _getMenuSelectorString( genesisMenus ) ).addClass( responsiveMenuClass ); }
[ "function _addResponsiveMenuClass() {\n $(_getMenuSelectorString(genesisMenus)).addClass(responsiveMenuClass);\n }", "function responsiveMenu() {\n\t\tif(window.innerWidth <= 768) {\n\t\t\t$('.koningsschutters-site-sidebar ul').addClass('alien').detach().appendTo('.koningsschutters-navbar-collapse ul.navbar-n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the new instance for `imagedecoder` class.
function ImageDecoder(stream){/** * Start of file markers. * @hidden * @private */this.sof1Marker=0x00C1;this.sof2Marker=0x00C2;this.sof3Marker=0x00C3;this.sof5Marker=0x00C5;this.sof6Marker=0x00C6;this.sof7Marker=0x00C7;this.sof9Marker=0x00C9;this.sof10Marker=0x00CA;this.sof11Marker=...
[ "function ImageDecoder(stream) {\n /**\n * Specifies `format` of image.\n * @hidden\n * @private\n */\n this.mFormat = ImageFormat.Unknown;\n /**\n * `Bits per component`.\n * @default 8\n * @hidden\n * @private\n */\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
JS Objects / Returns global variable with given name.
function lisp_js_global(name) { lisp_assert(lisp_is_instance(name, Lisp_String)); return window[lisp_string_native_string(name)]; }
[ "function getGlobal(name) {\n\treturn globalVarBank[\"_\" + name];\n}", "function lookup (name) {\n return globalScope[name];\n }", "function lisp_js_global(name) {\n lisp_assert(lisp_is_instance(name, Lisp_String));\n return window[name];\n}", "get(name) {\r\n var _a;\r\n return (_a =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Old JS FUNCTION Define the (local) variable "plyr1Dam" to which is "equal to" the (damage) value of "20" in the scope of the selfexecuting function "function". var plyr1Dam = 20; Define the (local) variable "plyr2Dam" to which is "equal to" the (damage) value of "20" in the scope of the selfexecuting function "function...
function duel() { // Console log "Duel". console.log("READY TO DUEL!!!"); // OLD ALERT Method within the "duel" function. // alert(plyr1Name[0]+ ": " +plyr1Name[2]+ " * START THIS DUEL * " +plyr2Name[0]+ ": " +plyr2Name[2]); plyr1name_txt.innerHTML = rivals[0].name + ": " + riv...
[ "function duel()\r\t\r\t{\r // Console log \"Duel\".\r console.log(\"READY TO DUEL!!!\");\r\r\t \t// \"alert\" is a built-in function within the local scope of the \"duel\". function that outputs a dialog box displaying the variables \"plyr1Name\", in the array which uses the plus sign operater to add...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Need to create a function. The function name will be "dayFinder". The goal is to return the day of the week from the date given. The function will receive a date in the format "MM/DD/YYYY" and return the day of the week. /// Pseudo code ////// Create a function named "dayFinder" and add one date parameter. Within the f...
function dayFinder(date) { var newDate = new Date(date); switch(newDate.getDay()) { case 0: return "Sunday"; case 1: return "Monday"; case 2: return "Tuesday"; case 3: return "Wednesday"; case 4: return "Thursday"; case 5: return "Friday"; case 6: ...
[ "function getDayofDate(day) {\n if (day > 6) day = day % 6 - 1;\n if (day == 1 || day == 2 || day == 3 | day == 4) return \"Monday to Thursday\";\n else if (day == 5) return \"Friday\";\n else if (day == 6) return \"Saturday\";\n else return \"Sunday\";\n}", "function Date(num, weekday){\n\n}", "function f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a DocumentReferenceContent resource
static get __resourceType() { return 'DocumentReferenceContent'; }
[ "provideTextDocumentContent(uri) {\n // already loaded?\n let document = this._documents.get(uri.toString());\n if (document) {\n return document.value;\n }\n // Decode target-uri and target-position from the provided uri and execute the\n // `reference provider`...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get list of bicycles for customer with input arg's id will populate lists with id="bikeList"
function getBikeList(custId) { // Get a reference to the DOM element var element = document.querySelector('#bikeList');// NOTE the '#' preceding the name of the div we're updating // create an xhr object var xhr = new XMLHttpRequest(); // configure its handler xhr.onreadystatechange = function () { ...
[ "function breweryDbBeersByBreweryId(brewery)\n{\n //Jquery AJAX\n $.get('/beersForBrewery?breweryId=' + brewery.breweryId,\n listBeers(brewery),\n \"json\");\n}", "list(bikeId) {\n if (!bikeId) {\n throw boom.badRequest('Bike id is required')\n }\n return knex(ridesTable)\n .whe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches a single experiment from API. Relies on the custom API middleware defined in middleware/api.js.
function fetchExperiment(experimentId) { return { [CALL_API]: { types: [EXPERIMENT_REQUEST, EXPERIMENT_SUCCESS, EXPERIMENT_FAILURE], endpoint: `experiments/${experimentId}`, schema: Schemas.EXPERIMENT, }, }; }
[ "function getExperiment(idExp, cbSuccess, cbError){\n\t\tvar xhttp = new XMLHttpRequest();\n\t\txhttp.onreadystatechange = function(){\n\t\t\tcallbackAJAX(xhttp, cbSuccess, cbError);\n\t\t\t};\n\t\t\n\t\txhttp.open('GET', aponeURL+\"/service/experiment/get/\"+idExp, true);\n\t\txhttp.responseType = \"json\";\n\t\tx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
watches the form for an input of coins from the user
function watchForm() { //listen for submit  $('#js-form').submit(event => { event.preventDefault(); let coinAinput = $('#js-coin-a').val(); coinAinput = coinAinput.toLowerCase(); let coinBinput = $('#js-coin-b').val(); coinBinput = coinBinput.toLowerCase(); let cu...
[ "function inputAmount(multiplier) \r\n\t{\t\r\n\t\tvar curLevel = $(\"#curlevel\").html();\r\n\t\tvar curCoins = $(\"#curcoins\").html().replace(/[,\\.]/g,\"\");\r\n\t var amount = (multiplier*(HP_VALUES_ARRAY[parseInt(curLevel)-1])+1);\r\n\t\t\r\n\t if (HP_VALUES_ARRAY[parseInt(curLevel)-1] >= 0)\r\n\t {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function checkSpam (str), which returns true if the string str contains "XXX", and otherwise false. The function must be case insensitive.
function checkSpam(str) { if (str.match(/xxx+/i)) { return true; } return false; }
[ "function checkSpam(str) {\n let lowerStr = str.toLowerCase();\n \n return lowerStr.includes('viagra') || lowerStr.includes('xxx');\n }", "function spamDetector(string){\n input = string.toLowerCase();\n if(input.indexOf('fake') < 0){\n return false;\n }\n return true;\n}", "function checkSpam(st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pluralize a singular name using common English language pluralization rules Examples: "company" > "companies", "employee" > "employees", "tax" > "taxes"
pluralize(name) { const plural = this.pluralNames[name]; if (plural) { return plural; } // singular and plural are the same if (uncountable.indexOf(name.toLowerCase()) >= 0) { return name; // vowel + y } else if (/[aeiou]y$/.tes...
[ "computePluralName(singular) {\n var plural;\n if (singularName.endsWith('y')) {\n // remove y and add ie\n plural = singular.substring(0,singular.length-1) +\"ie\";\n } else {\n plural = singular;\n }\n plural = plural.toLowerCase();\n plur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a function that converts [lat, lng, depth] into 3D coordinates (instance of THREE.Vector3). This function depends on latLngToPoint function provided by Leaflet map, and screen width and height.
function getLatLngDepthToPoint (latLngToPoint, height) { // latLngDepth is an array: [latitude, longitude, depthInKm] return function (latLngDepth) { const point = latLngToPoint(latLngDepth) return new THREE.Vector3( point.x, height - point.y, 0 ) } }
[ "function getLatLngDepthToPoint(latLngToPoint, height) {\n // latLngDepth is an array: [latitude, longitude, depthInKm]\n return function(latLngDepth) {\n const point = latLngToPoint(latLngDepth)\n return new THREE.Vector3(\n point.x,\n height - point.y,\n 0\n )\n }\n}", "function depth...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a PlanDefinitionGoalTarget resource
static get __resourceType() { return 'PlanDefinitionGoalTarget'; }
[ "function createTarget(opts, request, done) {\n var targetDoc = mustache.render(\n '<TargetEndpoint name=\"default\">' +\n '<PreFlow name=\"PreFlow\"/>' +\n '<PostFlow name=\"PostFlow\"/>' +\n '<ScriptTarget>' +\n '<ResourceURL>node://{{main}}</ResourceURL>' +\n '</ScriptTarget>' +\n '</Target...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a malicious organization, the full version of the malicious organization with its malicious causes, the org_cause connecting the organization to a malicious cause, the sanitized organization, and the sanitized full organization with its causes
function makeMaliciousOrg() { const { maliciousCause, sanitizedCause } = makeMaliciousCause(); const maliciousOrg = { id: 1, org_name: ( `Humane Society of Fairfax County <img src="doesn't exist" ` + `onerror="alert('malicious stuff')" />` ), website: `https://hsfc.org/ <script>alert('m...
[ "function tidyOrganisations(orgArray) {\n\n logger.info('Start tidying mamber data', {system: 'c2i'});\n\n\n for (var i = 0; i < orgArray.length; i++) {\n\n if (hasValue(orgArray[i].slogan)== false){ //slogan is blank -> fix it\n orgArray[i].slogan = \".\";\n logMsg = \"Organisation \"+ orgArra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
selectMatchingOptions(select_object,regex) This function selects all options that match the regular expression passed in. Currentlyselected options will not be changed.
function selectMatchingOptions(obj,regex) { selectUnselectMatchingOptions(obj,regex,"select",false); }
[ "function selectMatchingOptions(obj,regex) {\n\tselectUnselectMatchingOptions(obj,regex,\"select\",false);\n\t}", "function selectMatchingOptions(obj,regex) {\n selectUnselectMatchingOptions(obj,regex,\"select\",false);\n }", "function selectOnlyMatchingOptions(obj,regex) {\n\tselectUnselectMatchi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LOOPING OVER DATA \\ Create a loop to read which candies were sold by store1 on Jan 8. After simply outputting the data, try creating an array that contains the candy names.
function loopingData1() { var candies = []; var date = store1["2015-01-08"] for (var i = 0; i < date.length; i++){ console.log(date[i][0]) candies.push(date[i][0]) } return candies; }
[ "function loopingData1() {\n let candyNames = []\n let sales = store1['2015-01-08']\n sales.forEach((arr) => {\n candyNames.push(arr[0])\n })\n return candyNames\n}", "function loopingData1() {\n const salesDay = store1['2015-01-08'];\n let candiesSold = [];\n for (let i = 0; i < salesDay.length;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Algorithm which calculates base^exponent % modulus
function powerMod(base) { if (modulus === 1n) return 0; var result = 1n; base = base % modulus; while (exponent > 0n) { if (exponent % 2n === 1n) //odd number result = (result * base) % modulus; exponent = exponent >> 1n; //divide by 2 base = (base * base) % modulus;...
[ "function modularExponentiate(base, exponent, modulus)\n{\n return Math.pow(base, exponent) % modulus;\n}", "function powerMod(base, exponent, modulus) {\r\n if (modulus === 1) return 0;\r\n var result = 1;\r\n base = base % modulus;\r\n while (exponent > 0) {\r\n if (exponent % 2 === 1) //od...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the first placeholder
function findFirstPlaceholder() { var i; for (i = 0; i < fmt.integral.length; i++) { if (fmt.integral[i].type === 'placeholder') { return i; } ...
[ "function getFirstVisiblePlaceholder(placeholders) {\n var first;\n placeholders.each(function () {\n first = $(this);\n firstLeft = first.position().left;\n if (firstLeft > 0 || firstLeft * -1 < first.width() / 2)\n return false;\n });\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get todoactivity by id
function getTodoById(id) { for (const i in todos) { const todo = todos[i]; debugVar = todo; return todo; } if (todo.id === id) { return todo; } return null; }
[ "function getTodo(id) { \n return whishlist.task.find((task) => {\n return task.id == id;\n });\n}", "function findToDo(id){\n return lsHelpers.loadToDoList().find(toDo => toDo.timestamp == id);\n}", "getById(db, id) {\n return db\n .from('activity')\n .select('*')\n .where({ id })\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
findIndex: return the index of val in arr (or 1 if val is not present).
function findIndex(arr, val) { }
[ "function findIndex(arr, val) {\n // Index of val found\n if (arr[0] === val) return 0;\n // Keep searching\n if (arr.length > 1) {\n const idx = findIndex(arr.slice(1), val);\n return (idx < 0 ? idx : idx + 1);\n }\n // Val not in arr\n return -1;\n}", "function findIndex(arr, val) {\n let result =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================== from functions/interpreted/optimise/Bind_A_Oother.java =================================================================== Needed early: InterpretedFunction Needed late: Symbol LexicalClosure BindAndRun Nil
function Bind_A_Oother() { }
[ "function Bind_A_Obound() {\r\n}", "function Bind_A_A_R() {\r\n}", "function Bind_A_A_A() {\r\n}", "function Bind_Obound() {\r\n}", "function IncSpecialBinds() {\r\n\r\n}", "function simpleBind(fn, thisArg){\n\n}", "function bind(contextObj, fn) {\n\n}", "function Bind_A_Oliteral() {\r\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compare(other_queue) return true if this queue and the other_queue have the same values in the same order and false otherwise do not modify either queue in this instance remember: var x = new ListNode(7); var y = new ListNode(7); x == y? false x.value == y.value? true
compare(other_queue) { // If sizes of queue aren't the same size, don't bother if (this.size() != other_queue.size()) { return false; } var runner = this.head; var runner2 = other_queue.head; while (runner != null && runner2 != null) { // Constantly compare values in order // If this fails at any ...
[ "compare(other_queue) {\n // checks for equal size\n if(this.size() != other_queue.size()) {\n return false;\n }\n\n var runner_this = this.head;\n var runner_other = other_queue.head;\n\n // set number of iterations to compare, based on queue length\n for...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Is this Rational BSpline Curve. Determined based on whether weights were specified while constructing this BSplineCurve
isRational() { return !!this.weights; }
[ "isBSpline(precision = 0) {\n const [minWeight, maxWeight] = minAndMax(this.points.map(p => p.w));\n return ts3dutils.eq(minWeight, maxWeight, precision);\n }", "function getIsCurve()\n{\n return isCurve;\n}", "isBezier(precision = 0) {\n if (this.degree + 1 != this.points.length)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send list of brands
function getBrands(req, res) { return sendJsonFile('brands.json', res); }
[ "function loadBrands() {\n CrudService.getItems(CrudService.endpoints.BRANDS_ENDPOINT).success(function (data) {\n CrudService.response.brands = JSON.parse(JSON.stringify(data));\n }).error(function (data) {\n Flash.clear();\n Fl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
make info panel that corresponds to the clicked tank row active
function tanksTableRowClick(e) { // e is the target row // not a tank info panel if ($(e).attr("id") === undefined) return; let tank_id = $(e).attr("id").substr(4); // hiding current info panel $('.tank-info-panel.active').removeClass("active"); // showing new info panel ...
[ "function topRowGameInfo() {\n $('.tile.top-row').on('click', function() {\n\n $('.tile__info.top-row').toggleClass('top-row--open');\n $('.game-tiles__columns').toggleClass('info-open');\n $('.tile.selected').toggleClass('info-open');\n });\n}", "rowLabelClickHandler(rowLabel) {\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets if the provided structure is a DecoratableNodeStructure.
static isDecoratable(structure) { switch (structure.kind) { case StructureKind_1.StructureKind.Class: case StructureKind_1.StructureKind.GetAccessor: case StructureKind_1.StructureKind.Method: case StructureKind_1.StructureKind.Property: case Str...
[ "static isDecorator(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.Decorator;\r\n }", "static isDecoratableNode(node) {\r\n switch (node.getKind()) {\r\n case typescript_1.SyntaxKind.ClassDeclaration:\r\n case typescript_1.SyntaxKind.ClassExpression...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes a span by id
function removeSpan(id) { for( var i=0; i<spans.length; i++){ if ( spans[i].id === id) { spans.splice(i,1); } } }
[ "function eliminarSpan(inputID)\n{\n var input = document.getElementById(inputID); \n if(input.nextSibling != null){\n input.parentNode.removeChild(input.nextSibling);\n }\n}", "function removeSpanElement() {\n if (spanElement && spanElement.remove) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the base service path
function createServiceBasePath(cb) { self.client .getClient() .mkdirp(self.path, cb); }
[ "function createServiceBasePath(cb) {\n var servicePath = [ self.basePath, self.serviceInstance.name ].join('/');\n\n self.client\n .getClient()\n .mkdirp(servicePath, cb);\n }", "function createServiceBasePath(callback) {\n var servicePath = [self.basePath, self.serviceInstance.name].join...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adjust the max domain based on the current series. Set the display domain if it isn't already set
function trackMaxDomain(chartData, series) { var maxDomain = keyRange(series); chartData.maxDomain = maxDomain; chartData.displayDomain = chartData.displayDomain || maxDomain; }
[ "function updateDomains() {\n xScale.domain(cur_display.map(function(d) { return d.name; }));\n yScale.domain([0, d3.max(cur_display, function(d) { return d.percentage})]);\n }", "setXYDomains() {\n const xExtent = d3.extent(this.data, d => { return d.get(this.xyInfo.xColumnName); });\n\n let...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TYPE POST URL /mc/publish/getPublishsByCampaignIdPagination
getPublishsByCampaignIdPagination(data){ return this.post(Config.API_URL + Constant.PUBLISH_GETPUBLISHSBYCAMPAIGNIDPAGINATION, data); }
[ "async getAllCampaign(req, res) {\n try {\n const {\n page = 1, limit = 10\n } = req.query;\n\n const gettingCampaignDonation = await donation.find({\n \"campaign._id\": req.query.campaign_id,\n isVerified: true\n }, '_i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a convenience method; if you already have an ODM instance of the object you want to update from .find(), you should just call .update() on that. Note that if the query you provide returns more than one object, only the first returned from the query will be updated.
updateOne(query, updateObj) { return this.findById(query) .then((doc) => { if (doc) { return doc.update(updateObj).exec(); } else { return Promise.reject("document not found"); } }); }
[ "update(query, updateObj) {\n return this.find(query)\n .then((docs) => {\n const promises = docs.map((doc) => {\n return doc.update(updateObj).then(() => Promise.resolve(doc)).catch((e) => Promise.reject(e));\n });\n return Promise.all(promises);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if no environment mismatch is found. If environment mismatches are found, throws an INVALID_ANALYTICS_CONTEXT error that also lists details for each mismatch found.
function warnOnBrowserContextMismatch() { const mismatchedEnvMessages = []; if ((0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.isBrowserExtension)()) { mismatchedEnvMessages.push('This is a browser extension environment.'); } if (!(0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.areCookiesEna...
[ "function warnOnBrowserContextMismatch() {\n var mismatchedEnvMessages = [];\n\n if ((0, _util.isBrowserExtension)()) {\n mismatchedEnvMessages.push('This is a browser extension environment.');\n }\n\n if (!(0, _util.areCookiesEnabled)()) {\n mismatchedEnvMessages.push('Cookies are not available.');\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mount the menu as hidden and compute its optimal size. If the vertical scrollbar become visible, the menu will be expanded by the scrollbar width to prevent clipping the contents of the menu.
function mountAndMeasure(menu, maxHeight) { var node = menu.node; var style = node.style; style.top = ''; style.left = ''; style.width = ''; style.height = ''; style.visibility = 'hidden'; style.maxHeight = maxHeight + 'px'; phosphor_widget_1.attachWidget(menu, document.body); if...
[ "_update_menu_min_size () {\n let work_area = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.findIndexForActor(this.menu.actor));\n let monitor = Main.layoutManager.findMonitorForActor(this.menu.actor);\n let scale_factor = St.ThemeContext.get_for_stage(global.stage).scale_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CALCULATES INVERSE OF VECTOR OUTPUT OF TRANSFORM
inverseTransformVector(vec){ let result = p5.Vector.sub(vec, this.position); result.rotate(-this.rotation); vec.div(this.scale); return result; }
[ "multiplyInverseTranspose(vector, result) {\n this.computeCachedInverse(true);\n if (this.inverseCoffs) {\n const x = vector.x;\n const y = vector.y;\n const z = vector.z;\n return Point3dVector3d_1.Vector3d.create((this.inverseCoffs[0] * x + this.inverseCof...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funciton to view all employees from the database
function viewAllEmployees() { db.query(employeeQuery, function (err, res) { if (err) throw err; console.log( "---------------------------------------------------------------------------------------------------------------------------------------" ); console.table(res); console.log( "--...
[ "function viewEmployees() {\n console.log(\"Selecting all employees...\\n\");\n connection.query(\"SELECT * FROM employees\", function(err, res) {\n if (err) throw err;\n console.log(res);\n console.table('All employees:', res);\n \n });\n runSearch();\n }", "function viewAllEmplo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
grant permission to the team creator to subscribe to the team broadcaster channel
async grantUserMessagingPermissions () { const granterOptions = { data: this.data, broadcaster: this.api.services.broadcaster, team: this.model, members: [this.user], request: this.request }; try { await new TeamSubscriptionGranter(granterOptions).grantToMembers(); } catch (error) { throw...
[ "async grantTeamChannel () {\n\t\tif (this.tokens.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\tconst channel = 'team-' + this.team.id;\n\t\tconst func = this.revoke ? 'revoke' : 'grant';\n\t\ttry {\n\t\t\tawait this.broadcaster[func](\n\t\t\t\tthis.tokens,\n\t\t\t\tchannel,\n\t\t\t\t{\n\t\t\t\t\t//includePresence: tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function changes the list of darts of the current player depending on the last turn he did.
function changePlayerScore(lastDarts) { if (Object.keys(lastDarts).length > 0) { Object.keys(lastDarts).forEach((dart) => { if (listPlayers[lastPlayer].darts[dart] < 3) { if (listPlayers[lastPlayer].darts[dart] + lastDarts[dart] <= 3) { listPlayers[lastPlayer].darts[dart] += lastDarts[dart...
[ "function shufflePlayerList() {\r\n shuffle(players);\r\n\r\n playerInTurn = 0;\r\n}", "function updateTurn() {\n if (playerTurn === 0) {\n $('#player-turn').html(player[0].name);\n } else {\n $('#player-turn').html(player[1].name);\n }\n }", "changeTurn() {\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns `true` if `element` exists in `array`.
function has(array, element) { return indexOf(array, element) !== -1; }
[ "function inArray(array, element) {\n for ( var i=0; i<array.length; i++ )\n if ( array[i] === element )\n return true;\n return false;\n }", "function has(array, element) {\n return indexOf(array, element) !== -1;\n }", "function has(array, element) {\r\n return indexOf(array, ele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes a string and adds it to matchedWordsList array
function addWord(aString) { matchedWordsList.push(aString); console.log("Matched words list: " + matchedWordsList); }
[ "function matchWords(input, words){\n //for each word, traverse input and try to match letter by letter the word to that part of the string\n return words.filter( word => {\n return input.indexOf(word) !== -1\n })\n}", "wordsAreMatched(word){\n this.matchedWords.unshift(word)\n return this.m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Normarize Salesforce API host name
function normalizeApiHost(apiHost) { var m = /(\w+)\.(visual\.force|salesforce)\.com$/.exec(apiHost); if (m) { apiHost = m[1] + ".salesforce.com"; } return apiHost; }
[ "get apiHostname() {\n return url.format({\n protocol: this.apiProtocol,\n host: this.apiHost\n });\n }", "function get_api_url() {\n if (location.hostname === \"localhost\" || location.hostname === \"127.0.0.1\" || location.hostname === \"\") {\n return \"http://localhost:3000/\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper method for switching planes. sets all elements with the class of tile to display. recommend passing either "none" or "block" to make tiles appear or disappear
function setTiles(to){ var alltiles = document.querySelectorAll(".tile"); for(var n = 0; n < alltiles.length; n++){ alltiles[n].style.display = to; } }
[ "function hardModeShow(){\n if (hard != true) {\n console.log(\"hard mode is false\");\n for (var i = 0; i < extraTiles.length; i++) {\n extraTiles[i].style.visibility = \"hidden\";\n }\n } else {\n console.log(\"hard mode is true\");\n for (var i = 0; i < extraTi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to check collision between ball and one of the paddles
function collides(b, p) { if (b.y + ball.r >= p.y && b.y - ball.r <= p.y + p.h) { if (b.x >= (p.x - p.w) && p.x > 0) { paddleHit = RIGHT; return true; } else if (b.x <= p.w && p.x == 0) { paddleHit = LEFT; return true; } else...
[ "function collides(b, p) {\n if(b.x + ball.r >= p.x && b.x - ball.r <=p.x + p.w) {\n if(b.y >= (p.y - p.h) && p.y > 0){\n paddleHit = 1;\n return true;\n }\n \n else if(b.y <= p.h && p.y == 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
| lint:stream | | Lint the sass.
function lint(){ return gulp.src( config.assetPath + "/styles/**/*.sass") .pipe(sassLint({ options: { configFile: path.resolve(__dirname,"..","..") + "/.sass-lint.yml", formatter: "stylish" } })) .pipe(sassLint.format()) .pipe(sassLint.failOnError()) }
[ "function lintScss() {\n return gulp.src(config.src)\n .pipe(gulpScssLint({\n config: config.file,\n }))\n .pipe(gulpScssLint.failReporter());\n }", "function lintSass(cb) {\n gulp.src(\"./src/sass/**/*.scss\").pipe(\n $.stylelint({\n reporters: [{ formatter: \"string\", console...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extend selection to line end
extendToLineEnd() { if (isNullOrUndefined(this.start)) { return; } this.end.moveToLineEndInternal(this, true); this.upDownSelectionLength = this.end.location.x; this.fireSelectionChanged(true); }
[ "extendToNextLine() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n this.end.moveToNextLine(this.upDownSelectionLength);\n this.fireSelectionChanged(true);\n }", "navigateLineEnd() {\n this.selection.moveCursorLineEnd();\n this.clearSelection();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
listeners return index of target square
function getSquareIndex(target){ for (var j=0;j<9;j++){ if(squares[j] == target){ return j; } } }
[ "function getSquareIndex(target) {\n for (var j = 0; j < 9; j++) {\n // Check if the current iterated square is the square that was clicked.\n if(squares[j] === target) {\n return j;\n }\n }\n}", "clicked() {\n let d = dist(mouseX, mouseY, this.x, this.y);\n if (d <...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function to process emails with the label paystub
function processPayStubs() { var threads = label.getThreads(); for (var i = threads.length - 1; i >= 0; i--) { var message = threads[i].getMessages()[0]; var plainMessageBody = message.getPlainBody(); var response = UrlFetchApp.fetch('http://174.89.83.19:39444/paystub/', { 'method': 'post', ...
[ "function processTransactionEmails()\n{\n var messages = getRelevantMessages();\n var records = parseMessageData(messages);\n saveDataToSheet(records);\n}", "function CWM_ELP_1452_SendNotificationWhenBadAddressCondIsPlaced(){\r\n try{\r\n var CondType = \"Notice\";\r\n var CondDesc = \"Bad Address\";\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Original Function to build new initAlphaArray data type for the letters of the alphabet
function initAlphaArray() { this.length = 26; this[0] = "A"; this[1] = "B"; this[2] = "C"; this[3] = "D"; this[4] = "E"; this[5] = "F"; this[6] = "G"; this[7] = "H"; this[8] = "I"; this[9] = "J"; this[10] = "K"; this[11] = "L"; this[12] = "M"; this[13] = "N"; ...
[ "function createAlph() {\n var alph = [];\n for (var i = 0; i < 26; i++) {\n var char = String.fromCharCode(97 + i);\n alph.push(char);\n }\n\n return alph;\n }", "create_alphabet_array() {\n var alphabet = \"abcdefghijklmnopqrstuvwxyz\";\n var alpha_arra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Method to convert an array to the same AgentSet type as this.
asAgentSet (array) { return Object.setPrototypeOf(array, Object.getPrototypeOf(this)) }
[ "asArray (agentSet = this) {\n return Object.setPrototypeOf(agentSet, Array.prototype)\n }", "arrayToSet(setArray) {\n return new Set(setArray);\n }", "static convertFromArray(arr){\n return new Matrix(1,arr.length,[arr]);\n }", "toSet() {\n return new Set(this._iterable);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display current entering employee's name
function displayName(fname,mname="",lname) { $('#current_employee_name').text(fname+" "+mname+" "+lname); }
[ "function getEmployeeName(eid){\n\t\t\tvar empObj = {};\n\t\t\tvar inactive = '';\n\t\t\tempObj = employeesobj.find(function(emp){return emp.employeeId == eid});\n\t\t\tif(empObj != undefined){\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\tinactive = '**';\n\t\t\t\tempObj = employeesobj_inactive.find(function(emp){return emp....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
STORE/DATA OBJ(S) SET/UPDATE / sets object property/properties, returns display value (should be editing only) ex. ? REQUIRES valobjs; used in updateFormDataProp, ? CANNOT update TableID or OrderID fields
updateObjProp(payload){ // payload = {storeName (req), id, propname (req), valObj (req), isOrig} [valObj MUST include displayVal update] var returnVal; var compStateName = 'database' var compPayload; var updateObj, compObj; var compareResult; // copies payload, but reque...
[ "setFormValues() {\n let me = $(this);\n let controls = me.find('[property]');\n //let objDef = null;\n let obj;\n if (this.isClone) {\n obj = new flexygo.obj.Entity(this.objectname);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reparameterize: Given set of points and their parameterization, try to find a better parameterization.
function Reparameterize(d, first, last, u, bezCurve) { var i; var uPrime = []; /* New parameter values */ for (i = first; i <= last; i++) { uPrime[i-first] = NewtonRaphsonRootFind(bezCurve, d[i], u[i - first]); } return uPrime; }
[ "function reparameterize(points, first, last, u, curve) {\n for (var i = first; i <= last; i++) {\n u[i - first] = find_root(curve, points[i], u[i - first]);\n }\n }", "function reparameterize(points, first, last, u, curve) {\n for (var i = first; i <= last; i++) {\n u[i - first] = find_root(curve...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
next turn, switch player and print who's next to play
function nextTurn() { if (turnX === true) { turnX = false; turnO = true; $("#currentPlayer").text("Current player: O"); } else if (turnO === true) { turnO = false; turnX = true; $("#currentPla...
[ "function nextTurn() {\n console.log ('nextTurn called');\n if(currentPlayer.name === \"Computer\" && difficultyLevel === \"easy\") {\n changePlayerHeader();\n setTimeout(easyComputerTurn, 1500);\n\n }\n else if(currentPlayer.name === \"Computer\" && difficultyLevel === \"impossible\") {\n changePlayer...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the current page
function getCurrentPage() { // Gets the URL of the current page var link_url = document.URL; // splits on '/' var temp = link_url.split('/'); // gets the page label || need to check when live var currentPage = temp[3]; return currentPage; }
[ "function get_currentpage()\n{\n\tvar loc = window.location;\n\tp = loc.href.substring(loc.href.indexOf(loc.host) + loc.host.length + folder.length );\n\tif(p == '') p = 'inicio';\n\treturn p;\n}", "function get_currentpage() {\n var loc = window.location;\n p = loc.href.substring(loc.href.indexOf(loc.host) + l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that enables the 'Create Custom Field' button if the Name input is populated and a type has been selected.
function wpbooklistCustomFieldsNameChange() { $( document ).on( 'keydown', '#wpbooklist-customfield-input-fieldname', function( event ) { if ( '' !== $( this ).val() && undefined !== $( this ).val() && null !== $( this ).val() ) { if ( null !== $( '#wpbooklist-customfield-input-fieldtype' ).val() ) { $( ...
[ "function teamNameOnInput () {\n if (module.exports.internal.teamName.value.length === 0) {\n module.exports.internal.teamAddButton.className = 'button new-item-button-disabled'\n } else {\n module.exports.internal.teamAddButton.className = 'button new-item-button'\n }\n}", "creationTypeSelected(toEnable...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
delete ingredient from state
deleteIngredient(ingredient){ const ingredientToDelete = ingredient const currentIngredients = this.state.ingredients const newIngredients = currentIngredients.filter(ingredient => ingredient !== ingredientToDelete) this.setState({ingredients: newIngredients}) }
[ "deleteIngredient(ingredientId) {\n let ingredients = this.state.ingredients;\n\n ingredients.splice(ingredientId,1);\n\n this.setState({ingredients: ingredients})\n\n }", "removeIngredient(oldIngredient, id) {\n const newState = { ...this.state };\n newState.recipes.forEach(s => {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the Highcharts chart for the tune tab
function createHighChartsTune() { $('#highchartTune').highcharts({ chart: {zoomType: 'xy', alignTicks: false, type: 'line'}, credits: {enabled: false}, exporting: {enabled: false}, legend: {enabled: false}, title: {text: null, style: {fontSize: "12px", color: "black"}}, too...
[ "function renderPitchSpeeds()\n {\n new Highcharts.Chart(\n {\n chart:\n {\n type: 'area',\n zoomType: 'x',\n renderTo: 'pitchSpeeds',\n spacingLeft: 0,\n spacing...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show show ViewHigh Score Result Section
function showViewHighScoreResultSection() { for (var i = 0; i < viewHighScoreResult.length; i++) { viewHighScoreResult[i].style.display = "block"; } }
[ "function viewHighScore() {\n showHide(highScoreScreen, gameOverScreen);\n showHide(highScoreScreen, getQuiz);\n showHide(highScoreScreen, introEl);\n}", "function showHighScores() {\n display.set(\"highScores\").show();\n }", "function showHighScores() {\n display.set(\"highScores\")....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if collide with an obstacle
collideObstacle(obstacle) { let posx = this.x; let posy = this.y; for (let asteroid of obstacle) { if (Math.abs(posx - asteroid.x) <= (HULL_WIDTH / 2 + asteroid.radius) && Math.abs(posy - asteroid.y) <= (HULL_LENGTH / 2 + asteroid.radius)) { this.healt...
[ "checkIfHitObstacle() {\n const skierBounds = this.getBounds();\n\n const collision = this.obstacleManager.getObstacles().find((obstacle) => {\n const obstacleBounds = obstacle.getBounds();\n\n return intersectTwoRects(skierBounds, obstacleBounds);\n });\n\n if(coll...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show a list of test apps (if given). mApps must be a map from name to an array of URLs: the app, the app with realOData, the OPA and (optionally) the OPA with realOData
function showApps(mApps) { var oTable = document.getElementById("apps"); function addCell(oRow, sText, sUrl) { var oCell = document.createElement("td"), oTextNode = document.createTextNode(sText), oContent = oTextNode; if (sUrl) { oContent = document.createElement("a"); oContent.setAttribute...
[ "function listApplications() {\n var result = [], k;\n for (k in apps)\n result.push(k);\n return result;\n }", "getApps () {\n this._checkProfile()\n return this._getResources('apps')\n }", "async showInstalledApps() {\n // Check if we have p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Packs the falling piece for the server.
packPiece() { return this.piece.packServerUpdate(); }
[ "function Pack(){}", "upgrade() {\n this.tile = Piece.tiles[Piece.tiles.indexOf(this.tile) + 1];\n if (!this.tile) this.explode();\n }", "function buildFishery() {\n\n if (checkSurroundingTilesFor(\"Fishery\") < 1) {\n\n if (housingPoints >= fisheryCost) {\n\n $(`#${clickedTile}`).css(\"backgrou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears the navPoints and removes some of the elements.
function clearNavMarkers() { dirDisplay.setMap(null); dirDisplay.setPanel(null); finishID= null; resetSearch(); searchNearby(); map.setZoom(12); }
[ "function clearNavigation(){\n\t$(\"#nav_election_list\").empty();\n\t$(\"#logout\").empty();\n\t$(\"#user_infos\").empty();\n}", "function reset_navigation() {\n if (!(polyline == null))\n polyline.remove();\n if (!(start_node == null))\n start_node.remove();\n if (!(end_node == null))\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Worker function to recursively copy source, omitting functions. those functions are returned (optionally) in outFuctions, which is augmented outFunctions[functionName] = funcion for each such function.
function copyData(source, outFunctions) { var key, i, src, newData = { }; for(i = 0; i < source.length; i++) { src = source[i]; if( !src) throw GSP.createError("copyData() from undefined source!"); for(key in src) { copyDatum(newData, src, key, outFunctions); } }...
[ "function _filteredDeepCopy(src, dst) {\n if (Array.isArray(src)) {\n src.forEach(function (item) {\n switch (typeof item) {\n case 'function':\n ABeamer.throwI8n(ABeamer.Msgs.NoCode);\n break;\n cas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assign shortcuts to document.
function assignShortcuts() { $(document).keydown(function(e) { switch (e.key) { case 'Enter': // For following focused elements Enter should not be used as // shortcut for "submitting" the dialog. var active = document.activeElement; if (active.tagName == 'BUTTO...
[ "function fillShortcuts() {\n \tvar shortcut = pref.getPref(\"shortcut\"),\n \t\tscatform = document.querySelectorAll(\"#shortcut span[id]\");\n\n \tArray.prototype.forEach.call(scatform, function (element) {\n \t\treplaceShortcut(element, shortcut[element.id]);\n \t});\n\n \tlog.info(\"opt-shortc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================================ Refresh scrollSpy function ==============================================
function scrollSpyRefresh(){ setTimeout(function(){ $('body').scrollspy('refresh'); },1000); }
[ "function updateScrollSpy () {\n $('body').scrollspy('refresh');\n }", "function scrollSpyRefresh(){\n\t\tsetTimeout(function(){\n\t\t\tjQuery('body').scrollspy('refresh');\n\t\t},1000);\n\t\t\n\t}", "function scrollSpyRefresh(){\n\t\tsetTimeout(function(){\n\t\t\t$('body').scrollspy('refresh');\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate list of all homophones for each unique plaintext letter in the 408 solution
function homophonesFor408() { var d = interestingHash[1][0]["decoder"]; var u = {}; for (i=0;i<alphabet[1].length; i++) { var symbol = alphabet[1][i]; var plaintext = d[i]; if (u[plaintext]) u[plaintext].push(symbol); else u[plaintext] = [symbol]; } return u; }
[ "function getHomophones() {\n\t\t// German + English Homophones\n\t\tvar homophones = [\"Aale, Ahle\",\"Ai, Ei\",\"Annalen, analen\",\"aß, Aas\",\"Bad, bat\",\"bald, ballt\",\"Bällen, bellen\",\"Band, bannt\",\"Beete, bete\",\"bis, Biss\",\"Block, Blog\",\"Boot, bot\",\"Boote, Bote\",\"Bug, buk\",\"Bund, bunt\",\"C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the focused editor
getFocusedEditor() { if (this.general && this.general.isFocused()) return Promise.resolve(this.general.getModel()); if (this.connection.isAvailable()) { return this.connection.access().then(editor => { if (editor.isFocused()) return editor.getM...
[ "function focused(editor)\n\t{\n return focusObj;\n }", "getActiveTextEditor() {\n for (let ed of this.editors) {\n let editorElement = ed.getElement();\n let current = xedel.window.getFocus();\n while (current) {\n if (current === editorElement) {\n return ed;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A InfiniteCylinder3D is a 3D line with a radius. axis: BoundVector3D. r: radius of the cylinder.
function InfiniteCylinder3D( x , y , z , nx , ny , nz , r ) { this.axis = new BoundVector3D( x , y , z , nx , ny , nz ).normalizeCheck() ; this.r = + r ; }
[ "function f3d_draw_cylinder(x, y, z, r, height, outline)\n{\n var xx, yy;\n\n draw_primitive_begin();\n for(var i = -360 / 10; i < 360; i += 360 / 10)\n {\n xx = x + lengthdir_x(r, i);\n yy = y + lengthdir_y(r, i);\n\n f3d_draw_vertex(xx, yy, z);\n f3d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the in_section field value
function updateInSectionValue( fieldId, sectionId ) { document.getElementById( 'frm_in_section_' + fieldId ).value = sectionId; }
[ "_updateSection(section) {\n const intSection = parseInt(section);\n if (!isNaN(intSection) && intSection >= constants.minSection && intSection <= constants.maxSection) {\n if (this.shouldLoadSection(section)) {\n this.loadSection(section);\n } else {\n this._updateStudents(constants.d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create popup element on flood risk area on the map
function onEachfloodriskFeature(feature, layer) { bo_name = feature.properties.NAME ; floodrisk = feature.properties.percent; onpopup = "<b>Borough Name:</b>"+bo_name +"<br />"+"<b>Flood Risk Area:</b>"+floodrisk +"%" layer.on({ mouseover: highlightFeature, mouseout: resetfloodriskHighlight, click: sele...
[ "function createPopup(feature) {\n empty=true;\n //console.log(feature.attributes);\n content = '<div>';\n if (feature.layer.name.substr(0,3) == \"poi\"){\n if (feature.attributes.title){\n content = content + '<h3>' + feature.attributes.title + '</h3>';\n empty = f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the highlight color of selected contents.
set highlightColor(value) { if (value === this.highlightColorIn) { return; } this.highlightColorIn = value; this.notifyPropertyChanged('highlightColor'); }
[ "set selectionColor(value) {}", "function setHighlight (value) {\n\n options.settings.highlight = value;\n storeOptions(options);\n\n if (value)\n $('#main').addClass('mm-highlight');\n else\n $('#main').removeClass('mm-highlight');\n\n }", "function setColor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add tainting logic relating to variable declaration
function taintVariableDeclaration(tree, i) { var decl = tree[i].declarations[0]; // If prefixed by TSsecure_, then taint if (decl.id.name.substring(0,'TSsecure_'.length) == 'TSsecure_') { tree.splice(i, 0, esprima.parse('TSobjects.push("' + decl.id.name + '")')); return 1; } // Propagate taint from right to le...
[ "enterVariable_declaration(ctx) {\n\t}", "function hoistVariableDeclaration(name){ts.Debug.assert(state>0/* Uninitialized */,\"Cannot modify the lexical environment during initialization.\");ts.Debug.assert(state<2/* Completed */,\"Cannot modify the lexical environment after transformation has completed.\");var d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init user name field
function _init_user_name_field(){ try{ var username_field = Titanium.UI.createTextField({ hintText:'Username', width:240, height:40, ...
[ "function init() {\n if (storedUserName !== \"\") {\n $(\"#user-name\").val(storedUserName);\n }\n }", "function initName() {\n name = \"\";\n if (localStorage[\"user\"] == null)\n name = \"Annonymous\";\n else\n name = user.First_name + \" \" + user.Last_name;\n}", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stops the session recording process
function stopRecording(){ clearInterval(timer); $("#infoScreen").html("Session stopped"); getSessions(); }
[ "stopRecording() {\n this.debug('stopRecording');\n if (this.getAmRecording() == false) {\n return;\n }\n // Turn off recording\n this.setAmRecording(false);\n // Stop the stream writing\n this.recordStream.end();\n // Tell the web client that recording has been turned off\n this.top...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Component to render all the deck.gl map and reactmapgl stuff The purpose of this MapWrapper is to enclose the state that is specific to the map, i.e. the viewport, which will be updatet A LOT. The Map itself has other state and logic which doesn't need to update as often, which is why the wrapper makes sense from a per...
function MapWrapper({ hoverData, layers, tooltip, legend, layerSelector }) { const [viewport, setViewport] = useState({ latitude: 59.305477, longitude: 18.105203, zoom: 15, bearing: 0, pitch: 0, width: 1000, height: 1000 }); // NOTE: add a file .env in the root directory w...
[ "function renderMap() {\n const { width, height } = mapConfig.size;\n\n // Clear children\n mapPanelEL.innerHTML = '';\n\n // We also need to arrange the boxes\n mapPanelEL.style.gridTemplateColumns = `repeat(${width}, 1fr)`;\n mapPanelEL.style.gridTemplateRows = `repeat(${height}, 1fr)`;\n\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a transaction of the provided ID
getTransaction(id) { if (typeof(id) == "object") id = id.id return this.transactions.find(x => x.id == id) || null }
[ "get_transaction(transaction_id) {\r\n return this.call(\"/get_transaction\", {transaction_id});\r\n }", "findTransaction(id) {\n return this.transactions.find((tx) => tx.id === id);\n }", "function getTransactionId (transactionId) {\n return connection.transactionHttp.getTransaction(transactionId)\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the number of days in a specific Hebrew year. `year` is any Hebrew year.
function getDaysInHebrewYear(year) { return numberOfFirstDayInYear(year + 1) - numberOfFirstDayInYear(year); }
[ "function getDaysInHebrewYear(year) {\n return numberOfFirstDayInYear(year + 1) - numberOfFirstDayInYear(year);\n }", "function getDaysInHebrewYear(year) {\n return numberOfFirstDayInYear(year + 1) - numberOfFirstDayInYear(year);\n }", "function getDaysInHebrewYear(year) {\n return numberOf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles all markers on the aladin viz toShow = True : show all toShow = False: hide all
function aladin_markerToggleAll( marker_list, toShow ) { for (var i = 0; i < marker_list.length; i++) { markerlayer = marker_list[i].markerlayer if (toShow) { markerlayer.show() } else { markerlayer.hide() } } }
[ "showAllMarkers() {\n\t\tthis.showMarkers(this.markers);\n\t}", "function showAllMarkers() {\n\tcenterMap();\n\tfor (var i = 0, len = mapMarkers.length; i < len; i++) {\n\t\tmapMarkers[i].setVisible(true);\n\t}\n}", "function showMarkers() {\n\t setMapOnAll(map);\n\t}", "function toggleMarkers(){\n\n\tif(s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a warning message.
function addWarningMessage(warningMessage) { let warningHolder = document.getElementById('warnings-holder'); let warningMessageParagraph = document.createElement('p'); warningMessageParagraph.innerHTML = warningMessage; warningHolder.appendChild(warningMessageParagraph); }
[ "addWarning(message) {\n this.addMessage(cxschema.ArtifactMetadataEntryType.WARN, message);\n }", "function AddWarningMessage(InMessage) {\r\n AddMessage(\"Warning\", InMessage);\r\n}", "function warning(message) {\n command_1.issue('warning', message);\n}", "function addWarning(id, message) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply the cohesion behavior to a boid, given its neighbours.
cohesion(i, neighbours) { let total = createVector(0, 0); let count = 0; for (let j = 0; j < neighbours.length; j++) { if (this.boids[i].pos.dist(this.boids[neighbours[j]].pos) < neighbourRadius) { total.add(this.boids[neighbours[j]].pos); count++; } } ...
[ "cohesion(boids) {\n this.neighbordist = 50;\n this.sum = vector2d(0, 0); // Start with empty vector to accumulate all locs\n this.count = 0;\n for (var i in boids) {\n this.d = vector2d(this.loc.x,this.loc.y).dist(boids[i].loc);\n if ((this.d > 0) && (this.d < this.neighbordist)) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simple helper function that adds a parameter or does nothing at all depending on the provided predicate and totalExpectedArgs values
function addParam(params,predicate,value,argNumber,totalExpectedArgs){if(predicate){params.push(value);}else if(argNumber<totalExpectedArgs){params.push(NULL_EXPR);}}
[ "function addParam(params,predicate,value,argNumber,totalExpectedArgs){if(predicate&&value){params.push(value)}else if(argNumber<totalExpectedArgs){params.push(NULL_EXPR)}}", "function addParam(params, predicate, value, argNumber, totalExpectedArgs) {\n if (predicate && value) {\n params.push(value);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Metodo: Actualizar producto de media res
actualizarMediaRes(req, res) { return __awaiter(this, void 0, void 0, function* () { try { const productos = req.body; productos.forEach((producto) => __awaiter(this, void 0, void 0, function* () { yield mediaRes_model_1.default.findByIdAndUpdate(p...
[ "function imagenProducto(id, res, nombreArchivoFinal) {\n Producto.findById(id, (err, productoDB) => {\n if (err) {\n borrarArchivo(nombreArchivoFinal, 'productos');\n res.status(500).json({\n ok: false,\n err: {\n message: 'Error en e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets json data using request calls function with html string and passes in this data for display of station station data at google map icon on click
function get_station(station_num) { var ourRequest = new XMLHttpRequest(); ourRequest.open('GET', '/station/' + station_num); ourRequest.onload = function() { var ourData = JSON.parse(ourRequest.responseText); renderHTML(ourData, station_num); }; ourRequest.send(); }
[ "function getTrafficEventsData() {\n $.ajax({\n url: \"eventsData\",\n dataType: \"json\",\n cache: false\n }).done(function(data) {\n if (data.error) {\n window.alert(\n \"QldTraffic server is not responding. Please refresh the page.\"\n );\n return;\n }\n //console.log(da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders button with the selected 's innerText in a comma seperated list. If nothing is selected 'All' is displayed.
function renderButton(component) { var selectedLabels = getSelectedLabels(component); var label = isImplicitAll(component) ? getImplicitAllLabel(component) : selectedLabels.join(', '); component.$btn.text(label); }
[ "function renderButton(component) {\n var selectedLabels = getSelectedLabels(component);\n var label = isImplicitAll(component) ? getImplicitAllLabel(component) : selectedLabels.join(', ');\n component.$btn.text(label);\n }", "selectMultipleOptions() {\n const nChecked = this.dom.dropdown.query...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Invokes the callback passed in as onSearch, allowing this component to be used in different ways. I personally think this makes it more reusable.
onSearch() { const { onBarsSearch, location } = this.props; onBarsSearch(location); }
[ "performSearch(){\n\t\tthis.props.onUserSearch(this.refs.searchField.value);\n\t}", "initiateSearch(event){\n\t\t// stop the form from reloading the page\n\t\tevent.preventDefault();\n\t\t// create the search parameters from the current state\n\t\tlet searchParams = {\n\t\t\tterm: this.state.input\n\t\t};\n\t\t//...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculates the x and y position of the walkers Also checks to see if they are close to the player and will hunt the player instead of moving randomly.
calculateNewPosition(player){ let newX = 0; let newY = 0; //checks to see the distance away from the plyaer //and if the distance away is within a range, //then we calculate the new x and y in the direction of the player. let distanceAway = utils.distanceAway(this.x, thi...
[ "function moveWalkers(){\r\n for(let i = 0; i < listOfWalkers.length; i++){\r\n let direction = jjfLIB.getRandomInt(0,3);\r\n let newX, newY;\r\n switch(direction){\r\n case 0:\r\n //go up\r\n newX = listOfWalkers[i].xPos;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether the production propagating.
isPropagating() { if (this._isPropagating == null) { this._isPropagating = this.getRHS().length === 1 && /\$\$\s+=\s+\$1/.test(this._rawSemanticAction); } return this._isPropagating; }
[ "function isProd() {\n return production;\n}", "hasDressing() {\n const {product} = this.props;\n return !!product.extras && !!product.extras.dressing;\n }", "function propagator_is_solved(S, p, dont_mark_solved) {\n var i, len, b;\n \n if (p.solved) {\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get name of current open file in the editor. Filters nonproject files: dotfiles, files without extension and other: json, yml, etc.
getActiveFileName() /*:string*/ { const activeFilePath = this.getActiveFilePath(); if (!activeFilePath) { return ''; } const basename = path.basename(activeFilePath); let ext = basename.split('.').slice(1).join('.'); // Detection dot-files. if ('.' +...
[ "function getFileName()\r\n{\r\n var ed = newEditor();\r\n ed.assignActiveEditor();\r\n\r\n return ed.fileName();\r\n}", "function findNameInProject() {\n // check for any files in project that end with the right path.\n var fileName = name.substring(name.lastIndexOf(\"/\") ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate user registration data and if successful, send it to server
function validate_register() { var form = get_form_data('#register_form'); if (check_field_empty(form.email, 'email')) return false; if (check_field_empty(form.name, 'full name')) return false; if (check_field_empty(form.nick, 'nick')) return false; if (check_field_empty(for...
[ "_checkRegistration() {\n if (!this._checkEmail()) return;\n if (!this._checkUsername()) return;\n if (!this._checkPasswords()) return;\n this._registerUser();\n }", "function registerUser() {\n if(!firstName || !lastName || !username || !password || !email || !ssn) { //check if all required fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cycle through cryptobot quotes unless he performs a task
function cycleQuotes() { var i = vm.quotes.indexOf(vm.currentQuote); if(!vm.currentQuote || i >= 0){ vm.currentQuote = i === vm.quotes.length-1? vm.quotes[0]: vm.quotes[i+1]; changeQuoteHeader(); $timeout(cycleQuotes, 5000); } }
[ "function intentToBuyLoop() {\n\n //Try to buy something\n intentToBuy();\n }", "function loadquote() {\n quote = global_quotes[index].title;\n //var regexNum = /\\d/g;\n var check = quote.indexOf(\"quotes\");\n var infinite_loop_prevent = 0;\n while (check > -1 && infinite_loop_pr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create playlist list outer list
function createPlaylist() { var html = '<li data-i="all">All</li>'; $.each(playlistsData, function(k, v){ html += '<li data-i="'+ k +'">'+ v.title +'</li>'; }); $playlist.html(html); }
[ "function buildPlaylist() {\n if (playlist && playlist.length > 0) {\n return playlist.map((song, index) => {\n const trackNumber = (index + 1).toLocaleString(\"en-US\", {\n minimumIntegerDigits: 2,\n useGrouping: false,\n });\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function counts how many skill points have been used. It also sets a visual representation on each skill and perk div
function setPoints() { let points = 0; $('body').find('input.skillLevelNumber, input.perkLevelNumber').each(function () { points = points + parseInt($(this).val()); // count points // Change visual indicators let level = $(this).val(); let cssClass = $(this).hasClass('skillLevel...
[ "function setPointsUsed(){\n\n\t// Set text with current and max points\n\t$(\"#skill_points > #skillPointNumber\").text( getSkillpoints() );\n\n}", "function countSkills() {\r\n count = jQuery('.charbottom .skill').length;\r\n return count;\r\n }", "function changePointCount() {\n\tdocument.getElementBy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3. Print One, Return Another: Build a function that takes in an array of numbers. The function should print the SECOND TO LAST value in the array, and return the FIRST ODD value in the array.
function print1ReturnAnother(arr){ console.log("Second to last value: " + arr[arr.length - 2]); for(var i = 0; i < arr.length; i++){ if(arr[i] % 2 != 0){ return arr[i] } } return "No odd numbers in array" }
[ "function printOneReturnAnother(arr) {\n for(var j = 0; j < arr.length; j++) {\n if(arr[j] % 2 !== 0) {\n var first_odd = arr[j];\n }\n }\n console.log(`This is the second to last number in the array: ${arr[arr.length -2]}`);\n return first_odd;\n}", "function printOneReturnAn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refresh current round (Display)
function refreshRound(){ if(!lastRound()){ titleDisplay.textContent = "Round #" + nthRound; } else{ titleDisplay.textContent = "Final Round"; } }
[ "function updateRound() {\n $('#roundCount').text(gameRound);\n }", "function displayRefresh() {\r\n g.clear(true);\r\n drawBackground();\r\n drawHands();\r\n Bangle.drawWidgets();\r\n\r\n let Pause = 1000 - (Date.now() % 1000);\r\n Timeout = setTimeout(displayRefresh,Pause);\r\n}", "function di...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the callback that wil be called when a client is connected to the broker
onClientConnected(callback) { this.connCallback = callback; }
[ "onConnect(callback) {\n this.connectCallback = callback;\n }", "onClientSubscribed(callback) {\n this.subCallback = callback;\n }", "function onConnect() {\n // Once a connection has been made, make a subscription and send a message.\n console.log(\"onConnect\");\n clie...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test whether x is greater than y.
function greater(x, y) { return !less_equal(x, y); }
[ "function greaterThan(x, y) {\n return (y > x);\n}", "function greaterThan(x,y){\n if (x < y) {\n return true\n } else {\n return false\n }\n}", "function caml_greaterthan (x, y) { return +(caml_compare_val(x,y,false) > 0); }", "function caml_greaterthan (x, y) { return +(caml_compare(x,y,false) > 0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
is this a field event code? HJ, PV, TJ, LJ etc
function isFieldEvent(eventCode) { const firstTwo = normalizeEventCode(eventCode).slice(0, 2) return (FIELD_EVENTS.indexOf(firstTwo) > -1) }
[ "function isEvent(opc) {\n\tif (opc < OPC_ACON) return false;\n\tif ((opc & 150) != 144) return false;\n\treturn true;\n}", "valid(event){if(this.eventList[event]){return!0}return!1}", "function fieldChanged(type, name, linenum) {\r\n\r\n}", "isCorrectEventType() {\n return true;\n }", "function Par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[0,n) without repetition. Precondition that n >= k.
function getRandomNumbersWithoutRepetition(n, k) { var random_numbers = []; while (random_numbers.length < k) { let i = Math.floor(Math.random() * n); if (random_numbers.indexOf(i) === -1) { random_numbers.push(i); } } return random_numbers; }
[ "function s(n, k) {\n const res = [];\n helper(1, []);\n return res;\n\n function helper(i, list) {\n if (list.length === k) {\n res.push(list.slice());\n }\n\n for (let j = i; j <= n; j++) {\n if (!list.includes(j)) {\n list.push(j);\n helper(j + 1, list);\n list.pop();\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
randomWord returns a random word drawn from the ngrams table.
function randomWord(ngrams) { var len = Object.keys(ngrams).length var key = Object.keys(ngrams)[Math.round(Math.random() * len)] return key }
[ "function random_word(){\n var n = 4 + Math.floor(Math.random() * 6);\n return random_text(n);\n }", "function getRandomWord() {\n const index = Math.floor(Math.random() * dictionary.length);\n return dictionary[index];\n}", "function getRandomWord() {\n\t\t\tvar random_index = Math.floor(Math.random()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }