query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Set stem (w/o extname) (`index.min`). Cannot be nullified, and cannot contain path separators.
set stem(stem) { assertNonEmpty(stem, 'stem'); assertPart(stem, 'stem'); this.path = path__default["default"].join(this.dirname || '', stem + (this.extname || '')); }
[ "set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = _minpath_js__WEBPACK_IMPORTED_MODULE_4__.path.join(this.dirname || '', stem + (this.extname || ''))\n }", "set stem(stem) {\n assertNonEmpty(stem, 'stem')\n assertPart(stem, 'stem')\n this.path = path.join...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bias the autocomplete object to the user's geographical location, as supplied by the browser's 'navigator.geolocation' object.
biasAutocompleteLocation () { if (this.enableGeolocation) { this.updateGeolocation((geolocation, position) => { let circle = new google.maps.Circle({ center: geolocation, radius: position.coords.accuracy ...
[ "function geolocate() {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n var geolocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);\n autocomplete.setBounds(new google.maps.LatLngBounds(geolocation, geolocation));\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
scenario(string, function) Takes a scenario name and a function that returns the result of the test
function scenario(name, func) { suite.push({ name: name, run: func }); }
[ "function createTestFromScenario(scenario) {\n\ttest(`Scenario: ${scenario.name}`, t => Promise.all(scenario.steps.map(\n\t\tstep => resolveAndRunStepDefinition(t, step)\n\t)));\n}", "function getScenario(scenario, isPassed) {\n var template = fs.readFileSync(templates.scenarioTemplate),\n compiled = lodash...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes the matching socket instances join the specified rooms
socketsJoin(room) { this.adapter.addSockets({ rooms: this.rooms, except: this.exceptRooms, }, Array.isArray(room) ? room : [room]); }
[ "function joinRooms(rooms, socket, device) {\n const allRooms = rooms;\n\n allRooms.push(databasePopulation.rooms.important.roomName);\n allRooms.push(databasePopulation.rooms.broadcast.roomName);\n allRooms.push(databasePopulation.rooms.morse.roomName);\n\n if (device) {\n allRooms.push(device + appConfig....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Should always be called as the second part of && so that eval(objName) isn't attempted on undeclared ojbects if ( isDeclared("x") && isDefined("x") )
function isDefined(objName) { return ( "undefined" !== typeof eval(objName) ) ? true : false; }
[ "function defined(obj) {\n return typeof obj !== 'undefined';\n }", "function defined(obj) {\n return typeof obj !== 'undefined';\n }", "function $defined(obj){\r\n return (obj != undefined);\r\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provided required arguments A field or directive is only valid if all required (nonnull without a default value) field arguments have been provided.
function ProvidedRequiredArgumentsRule(context) { return _objectSpread(_objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context)), {}, { Field: { // Validate on leave to allow for deeper errors to appear first. leave: function leave(fieldNode) { var _fieldNode$arguments; va...
[ "function ProvidedRequiredArgumentsRule(context) {\n return {\n // eslint-disable-next-line new-cap\n ...ProvidedRequiredArgumentsOnDirectivesRule(context),\n Field: {\n // Validate on leave to allow for deeper errors to appear first.\n leave(fieldNode) {\n var _fieldNode$arguments;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ENVIA MENSAJES A LA API DE WHATSAPP VIA POST
async function SendMensajesClientesWsp(data) { url = ""; if( typeof data.type !="undefined"){ url = urlChatApiArchivo; console.log(data.type); }else{ url = urlChatApiTexto; } console.log(url); request({ url: url, method: "POST", json...
[ "renderApiCreateEntrie(){\n this.server.post('/api/create-entrie', (req, res) => {\n if (!req.isAuthenticated()){\n this.renderForbidden(res);\n return;\n }\n\n //HYDRATE tags\n req.body.tags = req.body.tags.replace(\"[\", \"\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes an array of bookings and presents them to the user though the console
function presentAlternatives(bookings) { for (let i = 0; i < bookings.length; i += 1) { console.log("Alternative #" + (i + 1)) console.log("Day: " + bookings[i].day) console.log("Movie: " + bookings[i].movie.title) console.log("Restaurant booking: " + bookings[i].table.from + " to " ...
[ "function showBooks(bookArray) {\n for (let i = 0; i < bookArray.length; i++) {\n addBook(bookArray[i]);\n }\n}", "function showAllBooks() {\n //must be at least one shelf to have at least one book to show\n var empty = libraryEmpty();\n if (!empty) {\n var showBooks = \"\";\n for (var shelf in libr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get info about gallery name and current index from url
function parseUrl() { var hash = window.location.hash.substr( 1 ); var rez = hash.split( '-' ); var index = rez.length > 1 && /^\+?\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1; var gallery = rez.join( '-' ); // Index is starting from 1 ...
[ "function parseUrl() {\n var hash = window.location.hash.substr( 1 );\n var rez = hash.split( '-' );\n var index = rez.length > 1 && /^\\+?\\d+$/.test( rez[ rez.length - 1 ] ) ? parseInt( rez.pop( -1 ), 10 ) || 1 : 1;\n var gallery = rez.join( '-' );\n\n // Index is start...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return an iterator on all process objects.
get processes() { return this._processes.values(); }
[ "function getProcesses() {\n\t\treturn procs;\n\t}", "static getAllProcesses() {\n\n let processes = [];\n\n // Reading finished processes\n let processDirectory = QueueConfigurations.get('process_directory');\n\n let files = fs.readdirSync(processDirectory);\n files.forEach(fil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add wei xin share tip
function addWeixinTip(){ $('.container').append("<div class='weixin-tip'></div>"); var $weixin_tip = $('.weixin-tip') .append('<div class="absolute tip-arrow"></div>') .append('<div class="mt100"><p>请点击右上角</p><p>【分享到朋友圈】</p><p>或</p><p>【发送给朋友】</p></div>') ...
[ "function addWeixinTip(){\r\n $('.main').append(\"<div class='weixin-tip'></div>\");\r\n var $weixin_tip = $('.weixin-tip')\r\n .append('<div class=\"absolute tip-arrow\"></div>')\r\n .append('<div class=\"mt100\"><p>请点击右上角</p><p>【分享到朋友圈】</...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for updatePullRequestHostedPropertyValue / Update an application property value stored against a pull request.
updatePullRequestHostedPropertyValue(incomingOptions, cb) { const Bitbucket = require('./dist'); let apiInstance = new Bitbucket.PropertiesApi(); // String | The account // String | The repository // String | The pull request ID // String | The key of the Connect app // String | The name of the property. /...
[ "updateUserHostedPropertyValue(incomingOptions, cb) {\n const Bitbucket = require('./dist');\n\n let apiInstance = new Bitbucket.PropertiesApi(); // String | The user // String | The key of the Connect app // String | The name of the property.\n /*let username = \"username_example\";*/ /*let appKey = \"app...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stringify values. Single quotes for strings, functions are kept intact, everything is JSONified.
function rstStringify(value) { if (typeof value === 'string') { return `'${value}'`; } if (typeof value === 'function') { return value; } return JSON.stringify(value); }
[ "function toSafeJSON (val) {\r\n\tvar json = \"\";\r\n\t\r\n\tif (val && (val instanceof Boolean || val instanceof Number\r\n\t\t\t|| val instanceof String)) {\r\n\t\tjson = toSafeJSON(val.valueOf());\r\n\t}\r\n\telse {\r\n\t\tswitch (typeof(val)) {\r\n\t\t\tcase \"undefined\":\r\n\t\t\tcase \"boolean\":\r\n\t\t\tc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new GetAccountCreditsResponse.
constructor() { GetAccountCreditsResponse.initialize(this); }
[ "getCredits() {\n return this._fetch({\n method: 'get',\n url: `${this.endpoint}/${this.version}/account/credits/available`,\n })\n .then(res => res.data.response);\n }", "static from(getBalanceResponse) {\n return new AccountBalance({\n accountI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move the robot, given some parameters, including steps and direction
async function moveRobot(name, xV, yV, dir, steps, fb){ // If it's forward, perform additions to either the yVal or xVal depending on direction if(fb == "forward" || fb == "forwards"){ if(dir == "N"){ console.log(fb + " " + steps + " steps "); await updateRobot(name, xV, yV + steps, dir) console.log("Done!"); ...
[ "function move(stepper, dir, speed, steps) {\n console.log(\"move\", dir || CLOCKWISE, steps || 1020);\n stepper.setSpeed(5);\n stepper.setDirection(dir || CLOCKWISE);\n stepper.stepperSteps(steps || 1020);\n}", "function move(direction) {}", "function move() {\r\n const speed = 2.9;\r\n //Spe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to be called when pattern loads
function onload() { // Create pattern pattern = context.createPattern(img, repeat); element.set('pattern', pattern); // be a cache element.set('patternSource', patternStr); }
[ "function onload() {\n // Create pattern\n pattern = context.createPattern(img, repeat);\n element.set('pattern', pattern); // be a cache\n\n element.set('patternSource', patternStr);\n }", "function onload() {\n // Create pattern\n pattern = context.createPattern(img, repeat);\n self.setSil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This defines a function which turns off every light by removing the "on" class from the HTML elements.
function allOff() { for (var i = 0; i < LIGHTS.length; i = i + 1) { LIGHTS[i].classList.remove("on"); } }
[ "function allOff() {\n for (var i=0; i<LIGHTS.length; i = i+1) {\n LIGHTS[i].classList.remove(\"on\");\n }\n}", "function lightsOff() {\n for (var i = 0; i < allLights.length; i++) {\n allLights[i].classList.remove(\"light-visible\");\n }\n}", "function turnOffAllLights() {\n // Main Lights\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_normalizeBounds /\ MapControls.add [ function ] Add a new control of `controlType` to the specified `target` element. > Arguments target (DOMElement) the element that the control will be added to controlType (string) the type of control we are creating opts (object) options that will be passed onto the control = (DOME...
function add(target, controlType, opts) { // ensure the options have been defined // (we pass these by reference) opts = opts || {}; // get the control var control = get(controlType, opts); if (control && target) { // get the first child in the target...
[ "addControl(ctrlType, bounds) {\n const resIdPrefix = 'k' + ctrlType;\n const resId = this._dlgResource.generateUnusedControlResourceId(resIdPrefix);\n this.controller.notifyAddControl(resId, ctrlType, bounds);\n\n const ctrlDefinition = this._dlgResource.controlByResourceId(resId, 0);\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a type similar to refstruct's StructType used for types refType name property test
function StructType() {}
[ "function RefType(type) {\n this.type = type;\n}", "readTypeName(typeTable)\r\n {\r\n var isSynthetic = false;\r\n var typeName = \"\";\r\n if (this.__curToken.__tokenType == __tokenTypes.Identifier)\r\n {\r\n typeName = this.__resolveTypeName(this.__curToken.__tokenStri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove all values in the array which are equal to the target value For items which are not equal to the target value, square it Return the new array
function arrayEqualTo(arr, target) { return arr.filter(function(val) { if(val != target) { return true; } }).map(function(val) { return val**2; }) }
[ "function arraySquare(array, targetValue) {\n removeTarget = array.filter(function(ele) {\n return ele != targetValue;\n });\n square = removeTarget.map(function(ele) {\n return ele ** 2;\n });\n console.log(square);\n}", "function arrayEqualTo(array, target) {\n var result = array\n .filter(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
zoto_user_albums_info_strip Top info strip that appears above the pagination
function zoto_albums_info_strip(options){ this.options = options ||{}; this.glob = this.options.glob || new zoto_glob(); //str this.str_albums = _(' albums'); this.str_photos = _(' photos'); this.str_all_albums = _('all albums'); this.str_all_sets = _('all sets'); this.all_albums_link = A({'href': "javascript:v...
[ "function zoto_user_tags_info_strip(settings){\n\tthis.settings = settings ||{};\n\t\n\tthis.total_tags = null;\n\tthis.total_untagged_images = null;\n\t\n\tthis.glob = new zoto_glob();\n\tthis.glob.settings.count_only = true;\n\tthis.glob.settings.is_tagged = 0;\n\n\t//str\n\tthis.str_tags = _(' tags');\n\tthis.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCIONES DEL TEMPLATE Evaluar El Campo Phone y establecer si es un Celular o un Fijo
function evaluatePhone(phone){ if(phone){ var countPhone = countDigitsNumber(phone); if (countPhone == 7 || countPhone==10){ var codPhone = phone %100; Session.set('NewCustomerCodPhone', codPhone); Meteor.call('customersFindPhone', phone, function (error, result) { if(error){ console.log('----ER...
[ "function _checkUserPhone(){\n if (document.documentElement.lang == \"de\"){\n if(_validatePhone($(\".phone-input\")[1].value)){\n $(\".phone-input:eq( 1 )\").css(\"color\", \"green\");\n }else{\n $(\".phone-input:eq( 1 )\").css(\"color\", \"red\");\n }\n }else{\n if(_validat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
list := (tasks:Array>) => Continuable>
function list(tasks) { return function continuable(callback) { var result = [] var count = 0 if (tasks.length === 0) { return callback(null, result) } tasks.forEach(function invokeSource(source, index) { source(function continuation(err, value) { ...
[ "function listTasks(){\n}", "function listAllTasks() {\n array.forEach(function (task) {\n return console.log(task);\n });\n}", "function Tasks() {\n this.list = [];\n return this;\n}", "function TaskList(){\n this.tasks = [];\n}", "function getTaskLists() {\n\n}", "function listAllTasks()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests that we load the accounts and display them in the account richlistbox in the correct order (by displayName, caseinsensitive)
function test_load_accounts_and_properly_order() { open_cloudfile_manager(function(w) { let richList = w.e("cloudFileView"); assert_equals(4, richList.itemCount, "Should be displaying 4 accounts"); // Since we're sorting alphabetically by the displayName, // case-insensitive, the it...
[ "function loadAccounts() {\n if (STORE.selectedProfile) {\n const floodyAccounts =\n common.FLOODY_API_ENDPOINT + '/user/accounts/' + STORE.selectedProfile;\n fetch(floodyAccounts, common.floodyGetConfig())\n .then(response => response.json())\n .then(dcmObjectList => {\n STORE.accounts = d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pull out keys from a regexp.
function regexpToRegexp(path, keys) { if (!keys) return path; // Use a negative lookahead to match only capturing groups. var groups = path.source.match(/\((?!\?)/g); if (groups) { for (var i = 0; i < groups.length; i++) { keys.push({ name: i, ...
[ "function getAllRegexes() {\r\n var keys = Object.keys(regexes)\r\n return keys\r\n}", "function list(regExp){\n regExp = regExp || /.*/;\n var result = [];\n var prev = top.prev;\n if (!length) return [];\n var i=0;\n while (i < maxLen) {\n var entry = s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return the (first) key of an object; intended for convenient fetching of the key name of an object (verticalaxis or horizontalaxis) that contains only one key
function key(obj) { return (Object.keys(obj))[0]; }
[ "getSingleKey(obj) {\n const keys = Object.keys(obj);\n if (keys.length !== 1) {\n throw `Object ${obj.toString()} needs to have only 1 key`;\n }\n return Object.keys(obj)[0];\n }", "static getFirstKey(obj) {\n const firstKey = typeof obj === 'object' && Object.keys(ob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Query: Deletes a doctor visit row from doctorvisit table Returns: affected rows, if its zero it means operation was invalid or nothing changed Return Value: INT
async function deleteDoctorVisit(ids) { const [ results ] = await mysqlPool.query( 'DELETE FROM doctorvisit WHERE visitId=? AND userId=?', [ids.visitId, ids.userId] ); if(results.affectedRows == 0) { throw new Error("No doctor visit was deleted"); } return results...
[ "function deleteVisit(visit){\n dataService.delete('visit', {KEYID: visit.KEYID}).then(function(msg) {\n console.log(msg);\n dataService.delete('visitType', {KEYID: visitType.KEYID}).then(function(response){\n console.log(response);\n });\n });\n }", "async deleteDoctor(req, res) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file e...
function getScaleExtent(scale, model) { var scaleType = scale.type; var min = model.getMin(); var max = model.getMax(); var originalExtent = scale.getExtent(); var axisDataLen; var boundaryGap; var span; if (scaleType === 'ordinal') { axisDataLen = model.getCategories().length; } else { bound...
[ "function getScaleExtent(scale,model){\nvar scaleType=scale.type;\n\nvar min=model.getMin();\nvar max=model.getMax();\nvar originalExtent=scale.getExtent();\n\nvar axisDataLen;\nvar boundaryGap;\nvar span;\nif(scaleType==='ordinal'){\naxisDataLen=model.getCategories().length;\n}else\n{\nboundaryGap=model.get('bound...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set or update a Gauge
function gaugeUpdate(gauge, opts){ $('.val-min .metric-small', $('#'+gauge)).html(opts.minVal); $('.val-max .metric-small', $('#'+gauge)).html(opts.maxVal); cf_rGs[gauge].maxValue = opts.maxVal; cf_rGs[gauge].minValue = opts.minVal; cf_rGs[gauge].set(opts.newVal); }
[ "function gaugeUpdate(gauge, opts){\n\tif(opts.minVal){\n\t\t$('.val-min .metric-small', $('#'+gauge)).html(opts.minVal);\t\t\n\t\tcf_rGs[gauge].minValue = opts.minVal;\n\t}\n\tif(opts.maxVal){\n\t\tcf_rGs[gauge].maxValue = opts.maxVal;\n\t\t$('.val-max .metric-small', $('#'+gauge)).html(opts.maxVal);\n\t}\n\tif(op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the number of documents to skip based on page number and limit
function Skip(page,limit) { var skip = 0; if (page > 1) { skip = (page - 1) * limit; } return skip; }
[ "resetPaginationOptions() {\n this._odataService.updateOptions({\n skip: 0\n });\n }", "_setStartIndex(currentPage, itemsPerRequest) {\n const isValidNumber = numValue => Number(numValue) > 0;\n\n if (!isValidNumber(currentPage) || !isValidNumber(itemsPerRequest)) {\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set new properties on one of the selection's points.
setPoint(editor, props, options) { var { selection } = editor; var { edge = 'both' } = options; if (!selection) { return; } if (edge === 'start') { edge = Range.isBackward(selection) ? 'focus' : 'anchor'; } if (edge === 'end') { edge = Range.isBackwar...
[ "set(options) {\n\n if (\"point1\" in options) {\n var copyPoint = options[\"point1\"];\n this.point1.set({x: copyPoint.getX(), y: copyPoint.getY()});\n }\n if (\"point2\" in options) {\n var copyPoint = options[\"point2\"];\n this.point2.set({x: copy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the array [interval, switchTimeout] `interval` is the refresh rate (hourly or per minute) `switchTimeout` is the time before the refresh rate should change (or expiration)
function getRefreshIntervals(a) { const minute = 60 * 1000; const halfhour = 30 * minute; const hour = 2 * halfhour; let msecs = alarm.getTimeToAlarm(a); if(typeof msecs == "undefined" || msecs == 0) return []; if(msecs > hour) { //refresh every half an hour let remain = (msecs+minut...
[ "get refreshRate() {}", "get refreshInterval() {\n if (this.refreshUrl) {\n return this.polling.seconds;\n }\n }", "function getSessionPollIntervalTime() {\r\n // Time in seconds\r\n return 180;\r\n}", "function getTimes(time, interval) {\n if (interval > 1000) {\n // esl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the location of origin when provided with a LatLng destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available.
function computeOffsetOrigin(to, distance, heading) { heading = toRadians(heading); distance /= EARTH_RADIUS; // http://lists.maptools.org/pipermail/proj/2008-October/003939.html var n1 = Math.cos(distance); var n2 = Math.sin(distance) * Math.cos(heading); var n3 = Math.sin(distance) * Math.sin(heading); ...
[ "function getDestination(origin, heading, distance, units) {\n\t units = units || \"meters\";\n\t origin = getPosition(origin);\n\t var radius = getEarthRadius(units);\n\t // convert latitude, longitude and heading into radians\n\t var latRad = _toRadians(origin[1]);\n\t var lonRad = _toRadians(or...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
String: split() Write a function addsum that takes a string with a summation task and returns its result as a number. A finite number of natural numbers should be added. The summation task is a string of the form '1+19+...+281'. Example: addsum('7+12+100') should return 119.
function addsum(n) { let sum = 0; let parts = n.split('+'); console.log(parts.length); for (let i = 0; i < parts.length; i++) { let num= parseInt(parts[i]); sum += num; } return sum }
[ "function add (s){\n\n let summand1 = parseInt(s, 10);\n let indexPlus = s.indexOf('+');\n let sAfterPlus = s.substr(indexPlus + 1);\n let summand2 = parseInt(sAfterPlus, 10);\n return summand1 + summand2;\n\n}", "function string_to_Sum(str_input) {\n var str_num = \"\",\n str_del = \",\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Navigate to addTransect transect creation screen
function addBtn(){ //disable add button until screen is returned to focus. Issue #28 $.addTransect.enabled = false; var addTransect = Alloy.createController("addTransect", {siteGUID: $.tbl.siteGUID}).getView(); var nav = Alloy.Globals.navMenu; nav.openWindow(addTransect); }
[ "goToAddHousehold() {\n this.props.setPage(<AddHousehold addHouse={this.props.addHouse} setPage={this.props.setPage}/>);\n }", "ClickOnAddScene(){\n // Load add Scene Config\n this._Scene.RenderAddModScene(this._DeviceConteneur, this._DeviceConfig.Electrovannes)\n }", "navigateToNewOp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluates to a lens that can be used with ramda lenses to view/set/over value of other trees. Think about this as a branch that you overlap on another tree, the place where the branch ends is the focus point.
get lens() { let get = tree => { let found = tree.treeAt(this.path); invariant(found instanceof Tree, `Tree at path [${this.path.join(', ')}] does not exist. Is path wrong?`); return found.prune(); } let set = (tree, root) => { let nextValue = lset(lensPath(this.path), tree.value, r...
[ "function lens(f) {\n if(!(this instanceof lens))\n return new lens(f);\n \n this.run = function(x) {\n return f(x);\n };\n \n this.compose = function(l) {\n var t = this;\n return lens(function(x) {\n var ls = l.run(x),\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
handle visibility of intro calls listing
function handleIntroCallsListVisibility(flag) { if(flag == 'N') { $("#VerticalTab6").hide(); } else { $("#VerticalTab6").show(); } }
[ "function novisibleLista() {\n visibilidad('capaLista','O');\n}", "function novisibleLista() {\n \n visibilidad('capaListado','O');\n}", "function course_intro() {\n if(window.location.pathname === '/protected/course/' && $('.logged-in').length > 0){\n $.getJSON(\"/site/public/json-data...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turn Profile HId into PId string
function getProfilePIdString(hId) { return strPadZeroes(profileHashIds.decode(hId)[0], parseInt(process.env.PID_LENGTH)); }
[ "function getTeamPIdString(hId) {\n return strPadZeroes(teamHashIds.decode(hId)[0], parseInt(process.env.PID_LENGTH));\n}", "function getProfileID(){\n\n\t\treturn Ulo.get(\"profile\").getAttribute(\"data-user-id\");\n\n\t}", "_extractUserIdentifier(path) {\n\n\t\tlet extractor = (path.startsWith('/profile.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
global CriteriaItem / exported RepeatableCriteriaItem
function RepeatableCriteriaItem() { CriteriaItem.call(this, {}); this.list = []; }
[ "addMappingCriteria() {\n let items = this.items;\n items.push(AdvancedSearch.create.operator('AND'));\n items.push(AdvancedSearch.create.mappingCriteria());\n }", "get item()\n\t{\n\t\treturn this._recurrenceInfo.item;\n\t}", "get criteria() {\n const criteria = new Map(this.textCriteria);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Middleware that checks if a user is logged in. If so, the request continues to be processed, otherwise a 403 is returned.
function isLoggedIn(req, res, next) { if (res.locals.currentUser) { next(); } else { res.sendStatus(403); } }
[ "async function isAuthenticatedMiddleware(req, res, next) {\n if (req.userId) {\n return next();\n }\n \n res.status(401);\n res.json({ error: 'User not authenticated' });\n }", "function restrictMiddleware(req, res, next) {\n // if path contains '/api/restricted', no matter what follows, runs...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populating country location filters
function populateLocCountryFilters(countryList){ if(countryList.length > 0){ $('#sector-country-filter').show(); var tempCountryLocations = ''; $.each(countryList,function(i, val){ tempCountryLocations = tempCountryLocations + '<li><label for="location_country...
[ "function getFilteredLocations()\n{ \n RMPApplication.debug(\"begin getFilteredLocations\");\n\n // reset WI in case end-user change current filter, which be validated again !\n resetWI();\n\n // Retrieving user's input values \n var country_value = $(\"#id_countryFilter\").val();\n var affiliat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts the basic component parts of a date (day, month and year) to the expected format.
static _extractDateParts(date){return{day:date.getDate(),month:date.getMonth(),year:date.getFullYear()}}
[ "static _extractDateParts(date) {\n return {\n day: date.getDate(),\n month: date.getMonth(),\n year: date.getFullYear()\n };\n }", "static _extractDateParts(date) {\n return {\n day: date.getDate(),\n month: date.getMonth(),\n year: date.getFullYear()\n };\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
zoto_modal_sets_for_album Allows the user to specify which sets the album(s) belongs to. This modal can work standalone, in a wizard or in bluk edit mode.
function zoto_modal_sets_for_album(options){ this.options = options ||{}; this.$uber(options); this.options.in_wizard = this.in_wizard || false; this.__init = false; this.options.album_glob = this.options.album_glob || new zoto_album_data(); this.album_glob = this.options.album_glob; this.album_glob.settings....
[ "function zoto_list_album_sets(options){\n\toptions = options || {};\n\toptions.no_results_msg = ' ';\n\toptions.expand = true;\n\n\tthis.zapi_str = 'sets.get_list';\n\tthis.total_sets = 0;\n\t\n\tthis.str_return = _('back to albums');\n\tthis.glob = options.glob || new zoto_glob();\n\n\tthis.$uber(options);\n\tthi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ INROUND FUNCTIONS /////////////////////// Clientside function that votes for a participant to be killed. Meant for both mafia and villagers.
function voteForUser() { console.log("entering"); // sanity check // if (isDead) // return; var participantName = $('#voteBox').value var reverseMap = getNameToIDMap(); var participantID = reverseMap[participantName]; console.log("Voting function entered"); // Locals var votes...
[ "function voteForSelfToDie() {\n voteForUser(getParticipantID());\n stopTimer();\n}", "voteKill (player, vote) {\n var response;\n var colors = Object.values(this.colorMap).map(a => a.toLowerCase());\n\n if (!this.game.players.includes(player))\n console.log('Tried to set a k...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Events for clicks inside the suggestion box
function clickEvents(e) { if (isSuggestion(e)) { e.preventDefault(); doClick(e); } }
[ "function onClick() {\n\t\tshowAllSuggestions();\n\t\tsetSelectionToCurrentValue();\n\t}", "suggestionListClick(liNumber) {\n this.listClickandEnterFunction(mosqueList[liNumber].mosquename);\n }", "onSuggestionMouseDown(e) {\n this.pickValue(e.target.getAttribute('data-value'));\n e.preventDefault()\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Token Check Callback for Admin
function callBackForadmin(bool,localToken,adminObj){ if(bool==true){ var token=adminObj.token; var res=compareToken(localToken,token); if(res==false){ location.href="login.html"; } } }
[ "function verifyToken(){\n \n}", "function verifyToken( ) {\n\n }", "function verifyToken(req,res,next){\n\n}", "function verifyAdminToken(req, res, next){\n jwt.verify(req.token, secretAdminKey, (err, authData) => {\n if(err){\n next(err);\n } else{\n next();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds new list to local storage and calls populate with new info
function createList(name, type, listEntries = []){ val = {listName: name, type: type, entries: listEntries} window.localStorage.setItem(name,JSON.stringify(val)) populate() }
[ "addToStorage(list = this._list) {\n localStorage.setItem(this._storageKey, JSON.stringify(list));\n }", "function storeData() {\n localStorage.setItem('list-' + listId, JSON.stringify(list));\n }", "function saveList() {\n storage.put(ListName, masterList);\n}", "function add_new_list(){\n\tvar ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get open item in a given group
function getOpenItem(itemGroup){ openItem = $('.is-open[data-open-target-group="'+itemGroup+'"]'); openItemSelector = openItem.data('open-target'); openItemContent = $('*[data-target="'+openItemSelector+'"]'); }
[ "async getOpenItem() {\r\n return this.openItem;\r\n }", "function getLatestOpenItem() {\n var $openItem;\n do {\n $openItem = $openItemContents.pop();\n } while ($openItem && !$openItem.is(':visible'));\n return $openItem;\n }", "function findGroupItemByName(name) {\n $.writeln(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to find if array one is superset of array two
function supersetArray(x,y){ first=objectOne(x) second=objectTwo(y) combined=object(x,y) lFirst=Object.keys(first).length lSecond=Object.keys(second).length lCombined=Object.keys(combined).length if(lCombined==lFirst){ return true; } else{ ret...
[ "isSuperset(...otherArrays) {\r\n return otherArrays.every(other => other.every(item => this.includes(item)));\r\n }", "function isSupersetOf(s1, s2){\n return isSubsetOf(s2, s1);\n }", "function isSubset(setA, setB){\n\n\n}", "function is_a_superset(decimal_set1, decimal_set2) {\n var rc = f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether or not the given value is a keyword.
function _isKeyword(v) { if(!_isString(v)) { return false; } switch(v) { case '@base': case '@context': case '@container': case '@default': case '@embed': case '@explicit': case '@graph': case '@id': case '@index': case '@language': case '@list': case '@omitDefault': case '@preserve'...
[ "function _isKeyword(v) {\n if(!_isString(v)) {\n return false;\n }\n switch(v) {\n case '@base':\n case '@context':\n case '@container':\n case '@default':\n case '@embed':\n case '@explicit':\n case '@graph':\n case '@id':\n case '@index':\n case '@language':\n case '@list':\n case '@omitDefault...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new InstantWorldTracker.
constructor(_pipeline) { this._pipeline = _pipeline; /** * The instant world tracking anchor. */ this.anchor = { poseCameraRelative: mirror => this._anchorPoseCameraRelative(mirror), pose: (cameraPose, mirror) => this._anchorPose(cameraPose, mirror) ...
[ "destroy() {\n this._z.instant_world_tracker_destroy(this._impl);\n }", "function WorldFactory() {}", "initTracker() {\n this.tracker = new clm.tracker();\n this.tracker.init(model);\n }", "initializeWorld() {\n this.world = new World(this.seed);\n }", "function createMap(){\n\t\tworldM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts the possible Proto values for a timestamp value into a "seconds and nanos" representation.
function $(t) { // The json interface (for the browser) will return an iso timestamp string, // while the proto js library (for node) will return a // google.protobuf.Timestamp instance. if (O(!!t), "string" == typeof t) { // The date string can have higher precision (nanos) than the Date class ...
[ "function tt(t) {\n // The json interface (for the browser) will return an iso timestamp string,\n // while the proto js library (for node) will return a\n // google.protobuf.Timestamp instance.\n if (P(!!t), \"string\" == typeof t) {\n // The date string can have higher precision (nanos) than th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the default hub instance. If a hub is already registered in the global carrier but this module contains a more recent version, it replaces the registered version. Otherwise, the currently registered hub will be returned.
function getCurrentHub() { // Get main carrier (global for every environment) var registry = getMainCarrier(); // If there's no hub, or its an old API, assign a new one if (!hasHubOnCarrier(registry) || getHubFromCarrier(registry).isOlderThan(exports.API_VERSION)) { setHubOnCarrier(registry, new...
[ "function getCurrentHub() {\n // Get main carrier (global for every environment)\n var registry = getMainCarrier();\n // If there's no hub, or its an old API, assign a new one\n if (!hasHubOnCarrier(registry) || getHubFromCarrier(registry).isOlderThan(exports.API_VERSION)) {\n setHubOnCarrier(reg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for creating shaders, based on the ones already defined on the top of the code (vertexShaderSource, fragmentShaderSource) Input parameters: canvas context for webgl, string with code for shader, type of shader Output parameter: shader
function createShader(gl, str, type) { let shader; // Checking the type of shader if (type == "fragment") { shader = gl.createShader(gl.FRAGMENT_SHADER); } else if (type == "vertex") { shader = gl.createShader(gl.VERTEX_SHADER); } else { return null; } gl.shaderSour...
[ "createShaderProgram(vShaderCode, fShaderCode) {\n let webGL = this.webGL;\n //Create a vertex shader object\n //Attach vertex shader source code\n //Compile the vertex shader\n let vertShader = webGL.createShader(webGL.VERTEX_SHADER);\n webGL.shaderSource(vertShader, vShaderCode);\n webGL.comp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addPageStyle, addStyle WRITE any CSS Rule into tag NOTICE : TODO add chainable function who'll use callback() NOTE: that 'rule' can contain any css props
function addPageStyle(selector, rule){pageStyle().innerHTML+=selector+'{'+rule+'}';seelog('addPageStyle '+selector+'{\n'+rule+'}');return pageStyle();}
[ "function addStyle(rule)\r\n\t{\r\n\t\tif (!style)\r\n\t\t{\r\n\t\t\tstyle = document.createElement('style');\r\n\t\t\tstyle.setAttribute('type', 'text/css')\r\n\t\t\tstyle.setAttribute('id', 'style');\r\n\t\t\t\r\n\t\t\tvar head = document.head || document.getElementsByTagName('head')[0];\r\n\t\t\thead.appendChild...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates the is favorite button
function createIsFavoriteButton(restID, is_fav) { let button = document.createElement("button"); // make button id unique for aria accessibility button.setAttribute("id", `isYourFavorite${restID}`); button.setAttribute("title", "My Favorite Restaurants!"); button.innerHTML = "&#9829;"; // &#9829; html entity...
[ "function addFavoriteButton() {\n\n}", "static favoriteButton(restaurant) {\r\n const button = document.createElement('button');\r\n button.innerHTML = `<i class=\"fas fa-star\"></i>`;\r\n button.className = \"fav\";\r\n button.dataset.id = restaurant.id;\r\n button.setAttribute('aria-label', `Mark...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper method to take x,y and r and return a path instruction string. x and y are center and r is the radius
function getCircletoPath(x , y, r) { return "M"+ x + "," + (y - r) + "A" + r + "," + r + ",0,1,1," + (x - 0.1) + "," + (y - r) +" z"; }
[ "function circlePath(cx, cy, r){\n return 'M '+cx+' '+cy+' m -'+r+', 0 a '+r+','+r+' 0 1,0 '+(r*2)+',0 a '+r+','+r+' 0 1,0 -'+(r*2)+',0';\n}", "function getCirclePath(cx, cy, r) {\n var d = factor * r;\n return 'M' + p(cx, cy - r) +\n ' c' + [p(d, 0), p(r, r - d), p(r, r)].join(', ') +\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parentElement; currentBulletElement; currentPositionIndex; bulletPositionX; bulletPositionY; isActive;
constructor(parentElement, className){ this.parentElement = parentElement; this.currentBulletElement = document.createElement("div"); this.currentBulletElement.classList.add(className); this.parentElement.appendChild(this.currentBulletElement); this.isActive = false; }
[ "function moveBullet() {\n\n if (state === \"game\") {\n stroke(0, 0, 255);\n\n //moves each bullet in the array bullets, defined at the beginning, according to the class code above\n for (let i = 0; i < bullets.length; i++) {\n if (!shopSubstate) {\n bullets[i].move();\n }\n\n //dis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
half the FFT size.
get frequencyBinCount() { return this.fftSize / 2; }
[ "function fft_bin_count(fft_size) { return fft_size / 2; }", "get halfWidth() {\n return Math.round(this._frame.size.width/2);\n }", "function calculateRealFrequency(frequency){\n\n\n\tif(frequency!=50)\n\t{\n\t\tconsole.warn('It is advided to use a frequency between 50 to 100ms. Also remeber to adapt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
make a box to grab import data
function importBox() { const options = $("#options-para"); let importDiv; let importArea; const isImportDiv = $("#import-div"); const isExportDiv = $("#export-div"); if (isImportDiv.length === 0) { // there's no import div importDiv = buildImportBox(); importArea = $(importDiv.children()[2]); ...
[ "function buildImportBox()\n{\n const importDiv = $(\"<div id='import-div'></div>\");\n const instructions = $(\"<button>Instructions</button>\");\n const buttonsSpan = makeSpan();\n buttonsSpan.attr(\"id\",\"import-buttons\");\n instructions.data(\"open\",0);\n instructions.click\n (\n function()\n {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
accepts a coordinate and provides back with a fleet name from all the deployed fleets on the map grid
reportFleetName(indexCoordinate){ for (const fleetName in this.deployedFleets){ if (this.deployedFleets[fleetName].deployedCoordinates.includes(indexCoordinate)){ return fleetName } } }
[ "placeFleet() {\r\n for (let i = 0; i < this.fleet.ships.length; i++) {\r\n this._placeShip( this.fleet.ships[i] );\r\n }\r\n }", "function launchFleet(planetA, planetB, player)\n{\n // TODO: This function launches a fleet from planet A to planet B,\n // controlled by player.\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adjusts [x, y] toward each other by zoomInPercentage% Split it so the left/bottom axis gets xBias/yBias of that change and tight/top gets (1xBias)/(1yBias) of that change. If a bias is missing it splits it down the middle.
function zoom(g, zoomInPercentage, xBias, yBias) { xBias = xBias || 0.5; yBias = yBias || 0.5; function adjustAxis(axis, zoomInPercentage, bias) { var delta = axis[1] - axis[0]; var increment = delta * zoomInPercentage; var foo = [increment * bias, increment * (1-bias)]; return [ axis[0] + foo[0],...
[ "adjustByPercent() {\n const { x: maxX, y: maxY } = this.max()\n\n this.setPosition({\n x: maxX * this.data.xPercent,\n y: maxY * this.data.yPercent,\n })\n }", "function zoomRange(g, zoomInPercentage, xBias, yBias) {\n xBias = xBias || 0.5;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is used as reference to show how to export the current kepler.gl instance configuration Once exported the configuration can be imported using parseSavedConfig or load method from KeplerGlSchema
getMapConfig() { // retrieve kepler.gl store const {keplerGl} = this.props; // retrieve current kepler.gl instance store const {map} = keplerGl; // create the config object return KeplerGlSchema.getConfigToSave(map); }
[ "getMapConfig() {\n // retrieve kepler.gl store\n const {keplerGl} = this.props;\n // retrieve current kepler.gl instance store\n const {map} = keplerGl;\n\n // create the config object\n return KeplerGlSchema.getConfigToSave(map);\n }", "getMapConfig() {\n // retrieve kepler.gl store\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Have the function AdditivePersistence(num) take the num parameter being passed which will always be a positive integer and return its additive persistence which is the number of times you must add the digits in num until you reach a single digit. For example: if num is 2718 then your program should return 2 because 2 +...
function AdditivePersistence(num) { var counter = 0; while (num > 9) { num = sumDigits(num); counter++; } return counter; }
[ "function AdditivePersistence(number, persistenceCount) { \n if(persistenceCount === undefined) { //By keeping persistence count as a parameter, it can keep an ongoing count while being used recursively\n persistenceCount = 0;\n }\n \n number = number.toString(); ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `CapacityUnitsConfigurationProperty`
function CfnIndex_CapacityUnitsConfigurationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, b...
[ "function CfnConnector_CapacityPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format items from firestore to stripe line items
function generateLineItems(items) { const lineItems = items.map(item => { return { price_data: { currency: 'usd', product_data: { name: item.name, images: item.imageUrls, }, unit_amount: item.hasOwnProperty('salePrice') ? parseInt(item.salePrice) * 100 : p...
[ "function decorateDeliveryItems(items) {\n angular.forEach(items, function(delivery) {\n delivery.items.map(function(item) {\n item.itemName = item.quantity + (item.unitOfMeasure ? ' ' + item.unitOfMeasure.uomDescription : '') + ' ' + item.productName;\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
rotates the array by given steps
function rotate(array, steps) { var i = Math.abs(steps); while (i > 0) { var x; if (steps < 0) { x = array.shift(); array.push(x); } else if (steps > 0) { x = array.pop(); array.unshift(x); } i--; } }
[ "function rotate(array, steps) {\n let startInd = array.length - mathModulo(steps, array.length)\n return [...array.slice(startInd), ...array.slice(0, startInd)]\n}", "function rotate(arr, steps) {\n\t\n\t// write a small function that rotates once \n\tfunction rotateOnce(arr) { \n\tvar endItem = arr.pop(); // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the next powerof2 >= size
function nextPow2(size) { return Math.pow(2, Math.ceil(Math.log(size) / Math.LN2)); }
[ "function getNextPowerOf2(n) {\n return Math.pow(2, Math.ceil(Math.log2(n)));\n}", "function nearestPowerOf2(n) {\n return 1 << 31 - Math.clz32(n);\n}", "function nextPow2(val) {\n --val;\n val = val >> 1 | val;\n val = val >> 2 | val;\n val = val >> 4 | val;\n val = val >> 8 | val;\n val ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if a is the undefined value. You can get the undefined value from an uninitialized variable or from a missing member of an object.
function isUndefined(a) { return a == undefined; }
[ "function isUndefined(a) {\n return a === undefined;\n}", "function isUndefined(a) {\n return a === void(0);\n}", "function isDefined(a) {\r\n return a != undefined;\r\n}", "function isUndefined(value) {\n return value === undefined;\n }", "function isUndefined(something) {\n\tif ( ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parseFloat :: String > Maybe Number . . Takes a string and returns Just the number represented by the string . if it does in fact represent a number; Nothing otherwise. . . ```javascript . > S.parseFloat ('123.45') . Just (123.45) . . > S.parseFloat ('foo.bar') . Nothing . ```
function parseFloat_(s) { return validFloatRepr.test (s) ? Just (parseFloat (s)) : Nothing; }
[ "function parseFloatOrNullOrString(str) {\n let str2 = str.trim().toLowerCase();\n if (str2 === '' || str2 === 'null')\n return undefined;\n let val = parseFloat(str2);\n return isNaN(val) ? str : val;\n}", "function parseF(s) {\n if(!isNaN(parseFloat(s))){\n return parseFloat(s)\n }else if(isNaN(pars...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Summary: Grabs floor plan image from database Parameters: floor: floor object Returns: adds image to carousels
function getFloorImage(floor) { activeAJAX++; $.ajax({ type: "GET", url: '/image', async: true, data:{ imageId: floor.imageId, }, success: function(response) { floorImages[this] = response; if (--activeAJAX == 0) { ...
[ "function addFloorImages() {\n // images from preview pane\n var currentImages = $('#currentImages');\n // images from navigation carousel\n var navigationImages = $('#navigationImages');\n var floorNames = Object.keys(buildingFloors);\n floorNames.alphanumSort(true);\n // add floor images to c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an item from items via typpe and id Returns null if it doesn't exist
getItem(type, id) { let key = this.getKey(type) return this.items[key] && this.items[key].includes(id) || null; }
[ "static findItemById(id) {\n let foundItem = null;\n data.items.forEach((item) => {\n if (item.id === id) {\n foundItem = item;\n }\n });\n return foundItem;\n }", "function getItemByID(id, items) {\n for (i = 0; i < items.length; i++) {\n if (items[i].ID === id) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a integer value fullfill the predicate
function checkInteger(predicate, cardValue) { if (predicate == null) return true; // Always match the empty predicate if (cardValue == null || cardValue == undefined) return false; // Never match if the value doesn't exists var int = parseInt(cardValue, 10); if (int == NaN) retur...
[ "isInteger(value) {\n return this.isNumber(value) && value % 1 === 0;\n }", "function integer(data) {\n return typeof data === \"number\" && data % 1 === 0;\n}", "function verifyInputValue(input){\n return((input > 0) && (input <= 10) && (Number.isInteger(input)));\n}", "function integer(data) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start offline stream processors
function startOfflineStreamProcessors() { for (var i = 0; i < offlineStreamProcessors.length; i++) { offlineStreamProcessors[i].start(); } }
[ "function startOfflineStreamProcessors() {\n for (var i = 0; i < offlineStreamProcessors.length; i++) {\n offlineStreamProcessors[i].start();\n }\n }", "function stopOfflineStreamProcessors() {\n for (var i = 0; i < offlineStreamProcessors.length; i++) {\n offlineStreamProcesso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Should be called to get hex representation of utf8 string
function fromUtf8(value) { let eValue = (0, _utf.encode)(value); let hex = ""; // remove \u0000 padding from either side eValue = eValue.replace(/^(?:\u0000)*/, ""); eValue = eValue.split("").reverse().join(""); eValue = eValue.replace(/^(?:\u0000)*/, ""); eValue = eValue.split("").reverse().join(""); f...
[ "static utf8ToHex(utf8) {\r\n return Converter.bytesToHex(Converter.utf8ToBytes(utf8));\r\n }", "static utf8ToHex(utf8) {\r\n return Converter.bytesToHex(Converter.utf8ToBytes(utf8));\r\n }", "function hexStrToUtf8Str(hex) {\n var str = stringTransform_1.safeBufferFromTo(hex, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the model will store time in seconds and have methods to return it as min and sec The examples on show get sets on the model itself, so I'll try this...
function timerModel() { this.time = 0; this.defaultTime = 0; }
[ "constructor (seconds, minutes, hours){\n\n //set the time properties on the new object instance that is created \n this.seconds = seconds\n this.minutes = minutes\n this.hours = hours\n \n }", "get seconds() {\n var seconds = Math.ceil((new Date().getTime() - t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the part for creating the column selection area. The options are taken from the csvData object fields. This option specifies which column's values create the fill colors used in the program. Specification also generates the fillColFilter, and the altColFilters.
createSelector() { // get rid of previous select dropdown if it exists if (this.paneOb.paneDiv.querySelector("#fillCol")) { this.paneOb.paneDiv.querySelector("#fillCol").remove() } // this is the selection element that is populated by the column names in the csv let...
[ "columnSelector() {\n /** The drop down selector for the column of the csv data to use as the alternate column filter */\n this.altColSelect = document.createElement(\"select\")\n // the column names of the csv\n this.altColSelect.id = \"colname\"\n for (let colOption in this.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mark task as important// delete button
function deleteNewTask(e){ const item = e.target; if(item.classList[0] === 'btnDelete'){ const todo = item.parentElement; todo.remove(); } if(item.classList[0] === 'imp-task'){ item.classList.toggle('fas'); } }
[ "markTaskForRemove(e) {\n const { target } = e;\n\n if (target.classList.contains('delete-elem')) {\n if (target.classList.contains('active__btn')) {\n eventbus.dispatch('subRemoveTasks', target.parentElement.dataset.id);\n target.classList.remove('active__btn');\n } else {\n ev...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if this is the main frame of its target. For example, this returns true for the main frame of an outofprocess iframe (OOPIF).
isMainFrame() { return !this.#sameTargetParentFrameInternal; }
[ "function isInFrame() {\n try {\n return self !== top && parent !== self;\n } catch (e) {\n return true;\n }\n}", "function isMainFrame(_frame){\n\treturn _frame.labelType == LABEL_TYPE_NAME && !isNoEasingFrame(_frame) && !isSpecialFrame(_frame, EVENT_PREFIX) && !isSpecialFrame(_frame, MOVEMENT_PREFIX);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a list of CMake generators, returns the first one available on this system
pickGenerator(candidates) { return __awaiter(this, void 0, void 0, function* () { // The user can override our automatic selection logic in their config const generator = this.config.generator; if (generator) { // User has explicitly requested a certain genera...
[ "function chooseCMakeVSgenerator(logger, callback) {\n\tvar generators = {\n\t '12.0':'Visual Studio 12 2013',\n\t '14.0':'Visual Studio 14 2015'\n\t};\n\n\twindowslib.detect(function (err, results) {\n\t\tif (err) {\n\t\t\tlogger.err(err);\n\t\t}\n\t\tvar generator = generators['12.0'],\n\t\t\tsdks = {\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
You will be given an array of strings. The words in the array should mesh together where one or more letters at the end of one word will have the same letters (in the same order) as the next word in the array. But, there are times when all the words won't mesh. Examples of meshed words: "apply" and "plywood" "apple" an...
function wordMesh(arr) { let result = ""; for (let i = 0; i < arr.length - 1; i++) { let part = (arr[i] + " " + arr[i + 1]).match(/(.+) \1/); if (!part) { return "failed to mesh"; } result += part[1]; } return result; }
[ "function wordMesh(arr){\n let res = \"\";\n for (let i = 1; i < arr.length; i++) {\n for (let j = 0; j < arr[i - 1].length + 1; j++) {\n const part = (arr[i - 1]).slice(j);\n if (part === \"\") {\n return \"failed to mesh\";\n } \n else if (arr[i].startsWith(part)) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display the side nav , function the pass to aother conponents with the display functionality
displaySideNav(){ if(this.state.showSideNav){ console.log('side nav show') this.state.showSideNav(); } }
[ "showSideNav(){\n var sideNavDisplay = document.getElementById('sideNavMenu');\n sideNavDisplay.style.display = 'block';\n this.props.display(sideNavDisplay.style.display);\n }", "function sideNavControl() {\n\n sideNavBlock.each((i, sideMenuTitleToggle) => {\n\n $(sideMe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
force sell (from player perspective). Force sell means selling even if the store has insufficient credits. The store will buy, and pay what it can afford.
async forceSell(item, quantity) { const res = await this.client.action("forceSell", { itemName: item, quantity: quantity, storeName: this.store, }); if (res.success) { this.editCache(item, quantity); await this.client.update(res.playerS...
[ "function sellItem(args) {\n\tvar itemIndex = player.hasItem(args);\n\tif(itemIndex > -1) {\n\t\tvar curItem = player.backpack[itemIndex];\n\t\tif(curItem.value > 0) { //prevent selling of key items - make value below 0\n\t\t\tbasicEcho((\"You sold a \" + curItem.name + \" for $\" + curItem.value));\n\t\t\tplayer.m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adjusts the number of remaining closed doors, and if all doors have been opened, ends the game
function playDoor(num) { numClosedDoors -= 1; if (numClosedDoors===0){ gameOver('win'); } else if(isBot(num)){ gameOver(); } }
[ "function areAllOpen(door) {\n numOfClosedDoors--;\n\n if (numOfClosedDoors === 0) {\n gameOver(\"win\");\n } else if (isTheDoorWrong(door)) {\n gameOver();\n }\n}", "function getFinalOpenedDoors(numDoors) {\n // Assigned an empty array for printing the \"open\", \"close\" value.\n var arr = [];\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Drop the temporary collection
function dropTemp(cb) { db.collection(clTempName, {strict: true}, function(err, clTemp) { if (err) return cb() // strict will return an error if the collection does not exist clTemp.drop(cb) }) }
[ "dropCollection(name) {\n this.collections.delete(name);\n }", "async dropCollection() {\n await this.database.dropCollection(QuizDatabaseService.getCollection());\n }", "function dropDatabase() {\n common.dropCollection(data.mongo_url.test, 'questqs', addFirstEntry);\n }", "function dro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all the values for the key status, from the Ticket History Results
@action getAllStatusesFromTicketHistoryResult() { return this.getAllValuesForKeyFromJSONObjectArray(this.TicketHistoryAPIResult, 'status'); }
[ "function getTicketsStatus() {\r\n var result = [];\r\n debugger;\r\n result.push(['Status', 'Number of Tickets']);\r\n if (numberOfTicketsStatus != \"undefiend\" && numberOfTicketsStatus != null) {\r\n numberOfTicketsStatus.forEach(function (o) {\r\n var status;\r\n if (o.S...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
console.log('cat outside scoper ', cat);
function scoper() { // let cat = 'Toby'; console.log('cat inside scoper ', cat); function innerScope() { console.log('cat inside innerScope ', cat); } innerScope(); }
[ "function cat(){}", "function catTalk() {\n console.log('Meow');\n}", "function catTalk ( ) {\n // code to run\n console.log (\"Meow\" );\n}", "function foo() {\n console.log('aloha');\n }", "function printIt() {\n console.log(message);\n var message = 'bar';\n}", "function bar(c) {//...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the 2 products would be added to same weather products branch based on matching parameters.
function sameBranch(p1, p2) { if (p1.type == p2.type && (p1.parameter == p2.parameter) && (p1.location && p2.location) && (p1.location == p2.location) && (p1.modelName && p2.modelName) && (p1.modelName ==...
[ "newProductEnsureSelection () {\n // Now see if this combo exists\n let itemId = this.newProductItem.id\n let vendorId = this.newProductVendor.id\n let unique = true\n\n // See's if the product already exists\n this.productsActual.forEach(p => {\n if (itemId === p.item.id && ven...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get note options and handle change
get noteOptions(){ return [ {label:'Other/None' , value: 'Other' }, {label:'Irrigate w/in 24 hours' , value: 'Irrigate w/in 24 hours' }, {label:'Irrigate Immediately' , value: 'Irrigate Immediately' }, {label:'Syring prior to app' , value: 'Syringe prior to app' }...
[ "function handleNoteClick (e) {\n \n}", "handleNote(note){\n /* Determines if the parameter is an integer, a chord, or a string and handles accordingly */\n if(note instanceof String){\n this.handleNoteHelper(note);\n } else if (Array.isArray(note)){\n for (let i = 0; i < note....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tell the server that the player missed.
function miss() { view.fadeOut(); ws.send(JSON.stringify({ action: "miss", })); }
[ "function onMiss(party) {\n //console they missed\n console.log(`${party.name} nuke missed and instead landed in the ocean`);\n callAtack(party.name)\n}", "function miss() {\n view.fadeOut();\n\n ws.send(JSON.stringify({\n type: \"miss\",\n }));\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function is make request for eletric charger stations
function searchEletric(location) { hideListings(); var eStationsURL = "http://api.openchargemap.io/v2/poi/?output=json&countrycode=HU&maxresults=10&latitude=" + location.lat + "&longitude=" + location.lng + "&distance=" + radius / 1000 + "&distanceunit=KM"; // the request itself $.getJSON(eStationsUR...
[ "function requestData() {\n req.get('http://'+adapter.config.hostname+'/sc2_val.xml',\n {'auth':\n {\n\t\t 'user':adapter.config.user,\n\t\t 'pass':adapter.config.password,\n\t\t 'sendImmediately': false\n }\n },function(error,response,data) {\n\t\t if(!error && response.statusCode == 200...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function that modifies the display array if the user correctly guesses a letter
function modifyDisplay(indexArray, display, letterGuess) { if (indexArray.length > 0) { for (var i = 0; i < indexArray.length; i++) { if (display[indexArray[i]] === '_') { display[indexArray[i]] = letterGuess; } } } return display; }
[ "function letter(isGuessed){\n\t\t\t\tif(isGuessed) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tvar guessed = event.key.toUpperCase();\n\t\t\t\tfor(var i = 0; i < solved.length; i++) {\n\t\t\t\t\tif(guessed == solved.substring(i, i + 1)) {\n\t\t\t\t\tplaceHolder = placeHolder.substring(0, i) + guessed + placeHolder.su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Export data in csv Task 3
async function exportCSV(req, res) { try { let data = await pool.query("SELECT * FROM client_income_data"); data = data.rows; var file = fileSystem.createWriteStream("public/data.csv"); fastcsv .write(data, { headers: true }) .on("finish", function() { ...
[ "exportCSV() {\n let csvContent = `data:text/csv;charset=utf-8,Title,${this.getDateHeadings(false).join(',')}\\n`;\n\n // Add the rows to the CSV\n this.outputData.listData.forEach(page => {\n const pageName = '\"' + page.label.descore().replace(/\"/g, '\"\"') + '\"';\n\n csvContent += [\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Will return true if the call is on hold, otherwise false
function isonhold () { if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null) return webphone_api.plhandler.IsOnHold(); else return false; }
[ "checkOnHoldStatus() {\n\n\t\tif (this.isOnHold) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.isOnHold = true;\n\n\t\tsetTimeout(() => {\n\t\t\tthis.isOnHold = false;\n\t\t}, 700);\n\n\t\treturn true;\n\t}", "isLocalOnHold() {\n if (this.state !== CallState.Connected) return false;\n let callOnHold = true; // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decode a single table of order0 frequences, filling out the F and C arrays.
function ReadFrequencies0(src, F, C) { // Initialise; not in the specification - implicit? for (var i = 0; i < 256; i++) F[i] = 0; // Fetch alphabet var A = ReadAlphabet(src); // Fetch frequencies for the symbols listed in our alphabet for (var i = 0; i < 256; i++) { if (A[i] > 0) F[i] ...
[ "function ReadFrequencies0(src, F, C) {\n // Initialise; not in the specification - implicit?\n for (var i = 0; i < 256; i++)\n\tF[i] = 0;\n\n var sym = src.ReadByte();\n var last_sym = sym;\n var rle = 0;\n\n // Read F[]\n do {\n\tvar f = src.ReadITF8();\n\tF[sym] = f;\n\tif (rle > 0) {\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
emit usersCount to all sockets
function emitUsersCount(io) { io.sockets.emit('usersCount', { totalUsers: io.engine.clientsCount }) updateUserLeds(io.engine.clientsCount) }
[ "function emitUsersCount(io) {\n io.sockets.emit('usersCount', {\n totalUsers: io.engine.clientsCount\n })\n}", "function updateUserCount() {\n io.sockets.emit(chat.PACKETS.USER_COUNT, {count: userCount});\n}", "function usersConnected(){\n io.sockets.emit('usersConnected', io.engine.clientsCount);\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the second step to understanding FizzBuzz. Your inputs: a positive integer, n, greater than or equal to one. n is provided, you have NO CONTROL over its value. Your expected outputs: n, "Fizz", "Buzz", or "FizzBuzz" depending on the following rules: Multiples of 5 and 3 return "FizzBuzz" Multiples of 3 return "...
function preFizz(n) { for(let i = 0; i < n; i++) { if(n % 3 === 0 && n % 5 === 0) return 'FizzBuzz'; if(n % 3 === 0) return 'Fizz'; if(n % 5 === 0) return 'Buzz'; return n } }
[ "function fizzBuzz(n) {\n\n /*\n O - output ''\n I - input -> number\n C - constraints/cases/ conditions ---- none\n E -\n */\n\n //result [holder/ container]\n let result = []\n\n\n // [ 1, 2, fizz, 4, buzz]\n for (let i = 1; i <= n; i++) {\n\n // if statement --- ( % )\n if (i % 3 === 0 && i %...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deals player another card and runs _playerScoreLogic
_hitMe() { this._getPlayerCards() this._playerScoreLogic() }
[ "function score(){\n\t\t\tif(computerCard.value > userCard.value){\n\t\t\t\tconsole.log('computerCard wins');\n\t\t\t\tcomputerHand += computerCard;\n\t\t\t} else{\n\t\t\t\tconsole.log('userCard is winner')\n\t\t\t\tuserHand += userCard;\n\t\t\t}\n\t\t}", "function updateScore(card, activePlayer) {\n activePla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a renameVideo request
function renameVideo(oldVideoName, newVideoName) { var requestData = '{' + '"command" : "renameVideo",' + '"arguments" : {' + '"oldVideoName" : "' + oldVideoName + '",' + '"newVideoName" : "' + newVideoName + '"' + '}' + '}'; makeAsynchronousPostRequest(requestData, refresh...
[ "function renameMovie(id){\n showTheRenameDialog(id);\n}", "function deleteVideo(videoName) {\r\n\tvar requestData = '{'\r\n\t\t\t+ '\"command\" : \"deleteVideo\",'\r\n\t\t\t+ '\"arguments\" : {'\r\n\t\t\t+ '\"video\" : \"' + videoName + '\"'\r\n\t\t\t+ '}'\r\n\t\t\t+ '}';\r\n\tmakeAsynchronou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether the two dates represent the same view in the current view mode (month or year).
_isSameView(date1, date2) { if (this.calendar.currentView == 'month') { return this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2) && this._dateAdapter.getMonth(date1) == this._dateAdapter.getMonth(date2); } if (this.calendar.currentView == 'year') { ...
[ "isSameView(firstDate, secondDate) {\n const firstYear = this.dateAdapter.getYear(firstDate);\n const secondYear = this.dateAdapter.getYear(secondDate);\n const firstMonth = this.dateAdapter.getMonth(firstDate);\n const secondMonth = this.dateAdapter.getMonth(secondDate);\n if (th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }