query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Stacked bar chart summarizing the status (functional/non functional) of all the waterpoints by the given group field
function plotStatusSummary(selector, data, groupField) { data.forEach(function(group) { var y0 = 0; //status type is not always in the same order due to mongo, sort here group.waterpoints = _.sortBy(group.waterpoints, "status"); group.waterpoints.forEach(function(x) { x.y0 = y0; x.y1 = (y...
[ "function plotStatusSummary(selector, data, groupField) {\n\n data.forEach(function(group) {\n var y0 = 0;\n //status type is not always in the same order due to mongo, sort here\n group.waterpoints = _.sortBy(group.waterpoints, \"status\");\n group.waterpoints.forEach(function(x) {\n x.y0 = y0;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Map ROM into address space using LoROM method
map_lorom(bank_start, bank_end, addr_start, addr_end) { let offset = 0; for (let c = bank_start; c <= bank_end; c++) { for (let i = addr_start; i <= addr_end; i += 0x1000) { let b = (c << 4) | (i >>> 12); //console.log('MAPPING ROM', hex0x6(b << 12), 'offset', hex0x6(offset)); this.readmap[b].kind = ...
[ "map_lorom_sram() {\n\t\tlet hi;\n\t\tif (this.ROMSizebit > 11 || this.SRAMSizebit > 5)\n\t\t\thi = 0x7FFF;\n\t\telse\n\t\t\thi = 0xFFFF;\n\n\t\t// HMMM...\n\t\thi = 0x7FFF;\n\t\tthis.map_sram(0x70, 0x7D, 0x0000, hi);\n\t\tthis.map_sram(0xF0, 0xFF, 0x0000, hi);\n\t}", "setup_mem_map_lorom() {\n\t\tthis.clear_map(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LOGIN_SUCCESS: set token, user, and household(optional) from server's response into store
function loginSuccess(data) { return { type: 'LOGIN_SUCCESS', payload: { token: data.token, user: data.userData, household: data.household || null, roommates: data.roommates || null, invitations: data.invitations || null, }, }; }
[ "AUTH_SUCCESS(state, token, user) {\n state.token = token // <-- assign state token dengan response token\n state.user = user // <-- assign state user dengan response data user\n }", "auth_success(state, data){\n state.status = 'success'\n state.token = data.token\n stat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display relative directions to five known points of interest: Great Pyramid, Taj Mahal, Niagara Falls, Golden Gate Bridge and Stonehenge
function displayDirections(coordinates) { try { var directions = "<h3>Directions:</h3>"; var user_lat = coordinates.latitude; var user_lon = coordinates.longitude; //Niagara Falls is located at (43.08337, -79.073925) directions += "<div>Niagara Falls is " + northOrSouth(user_lat, 43.08337) +...
[ "function displayDirections(directions) {\n var displayStr = \"\";\n var counter = 1;\n var route = directions.routes[0].legs;\n for (i = 0; i < route.length; i++) {\n var steps = route[i].steps;\n for (j = 0; j < steps.length; j++) {\n displayStr = displayStr + counter + \". \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Like [`create`]( but check the given content against the node type's content restrictions, and throw an error if it doesn't match.
createChecked(attrs = null, content, marks) { content = Fragment.from(content); this.checkContent(content); return new Node$1(this, this.computeAttrs(attrs), content, Mark$1.setFrom(marks)); }
[ "node(type, attrs = null, content, marks) {\n if (typeof type == \"string\")\n type = this.nodeType(type);\n else if (!(type instanceof NodeType$1))\n throw new RangeError(\"Invalid node type: \" + type);\n else if (type.schema != this)\n throw new RangeError(\"Node type from different schem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assert that a value passes a `Struct`, throwing if it doesn't.
function assert(value, struct) { const result = validate(value, struct); if (result[0]) { throw result[0]; } }
[ "function validate(value, struct, coercing = false) {\n if (coercing) {\n value = struct.coercer(value);\n }\n\n const failures = check(value, struct);\n const failure = iteratorShift(failures);\n\n if (failure) {\n const error = new StructError(failure, failures);\n return [error, undefined];\n } el...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
restore default microdata view
async restoreDefaultView () { // select default microdata view from inxeded db let dv try { const dbCon = await Idb.connection() const rd = await dbCon.openReadOnly(Mdf.modelName(this.theModel)) dv = await rd.getByKey(this.entityName) } catch (e) { console.warn('U...
[ "function revert_metadata() {\n show_edit_metadata(edit_exp_id);\n }", "function restoreView(viewToRestore) {\n contextViewData = viewToRestore;\n}", "function restoreView(viewToRestore){contextLView=viewToRestore;}", "function restoreView(viewToRestore) {\n contextLView = viewToRestore;\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Measures the produced KWH from the past hour and executes the produce function on the smart contract
function producedPastHour() { let currentTime = new Date(); let hourago = new Date(currentTime.getTime() - (60 * 60 * 1000)); let producedKWH = 0; //Get the production readings from the past hour on phase 1 request('http://raspberrypi.local:1080/api/chart/1/energy_pos/from/' + hourago.toISOString() ...
[ "function consumedPastHour() {\n let currentTime = new Date();\n let hourago = new Date(currentTime.getTime() - (60 * 60 * 1000));\n let consumedKWH = 0;\n //Get the consumption readings from the past hour on phase 1\n request('http://raspberrypi.local:1080/api/chart/1/energy_neg/from/' + hourago.toI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Buzz if not already buzzing
function buzz() { try { Bangle.buzz(); } catch (e) { } }
[ "function buzz(){\n if (buzzerEnabled && inBuzzerView && blockerDisabled)\n connectFactory.buzzBuzzTrial(buzzRound);\n $rootScope.$emit(rootScopeEvents.buzzTriggered);\n }", "function isFruitTooLow() {\r\n var remainingHearts;\r\n if ($(Strings.fruit).posi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TAPI Base class, support OAuth v1.0
function TBase() { this.config = { host: 'api start url', result_format: '.json', appkey: '', secret: '', oauth_host: '', oauth_callback: 'oob or url', oauth_version: '1.0', request_timeout: 20000, count_max_number: 100, userinfo_has_counts: true, // 用户信息中是否包含粉丝数、微博数等信息 ...
[ "function OAuthPrototype() {}", "function OktaAPIOAuth2(apiToken, clientId, clientSecret, domain, preview)\n{\n if(clientId == undefined || clientSecret == undefined) {\n throw new Error(\"OktaAPI requires an clientid, clientsecert\");\n }\n this.domain = domain.replace(\"-admin\", \"\");\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets all the surveys a user has
static getAllSurveys(userId) { return (axios.get(LOCAL_URL + SURVEY + USER + userId)); }
[ "function getallsurveys() {\n var url = BASEURL + '/surveys';\n console.log('Getting url: ' + url);\n request.get({url: url}, function(error, response, body) {\n if (handleError(error, response, body)) return;\n\n var surveys = JSON.parse(body).surveys;\n console.log('Got ' + surveys.length + ' surveys:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the game. Shuffle the cards and initialize the score panel.
function init() { const newCardList = createNewDeck(); insertNewDeck(newCardList); initScorePanel(); // Show game and hide result page document.querySelector('header').classList.remove("hide"); document.querySelector('.score-panel').classList.remove("hide"); document.querySelector('.deck').classList.remov...
[ "function initializeGame() {\r\n // shuffle the deck then split the deck in half\r\n shuffle(deck);\r\n\r\n // assign the cards\r\n firstSet = deck.slice(0, 26);\r\n secondSet = deck.slice(26);\r\n\r\n // update the state\r\n setState({\r\n ...state,\r\n playerDeck: firstSet,\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate fake assignment_id, worker_id, and hit_id
function create_test_assignment() { var characters = 'ABCDEFGHIJoKLMNOPQRSTUVWXYZ0123456789'; characters = characters.split(''); suffix = shuffle(characters).slice(0, 12).join(''); return {assignmentId: 'ASSIGNMENT_' + suffix, hitId: 'HIT_' + suffix, turkSubmitTo: 'https://workersandbox.mtur...
[ "function genWorkerId() {\n return `worker_${uuidv4()}`;\n}", "function idGen(){\n\t//return job_history[job_history.length-1].jobID + 1;\n\tjob_id += 1;\n\tconsole.log(\"== idGen: job_id: \" + job_id);\n\treturn job_id;\n}", "getWorkerId() {\n return \"worker_\" + this.workerCounter++;\n }", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats the contents of a grid as either a CSV file or as an HTML file for Excel.
function formatGridAsCsvOrHtml(grid, startCol, type) { ogrid = grid; ostartCol = startCol; otype = type; var gridTbl = getSingleObject(grid); var retVal = ''; var gridRecCount = eval(gridTbl.id + '1.recordset.RecordCount'); if(isFullyExport || exportFromXML(grid)) { ...
[ "function sendGridToServerAsExcelHtml(grid, url, dispType) {\r\n ourl = url;\r\n odispType = dispType;\r\n formatGridAsCsvOrHtml(grid, 0, \"HTML\");\r\n}", "function Export_Grid_TO_CSV(Grid, colsToShow, colsTitles, ReportTitle, showLabels) {\n var cm = colsToShow; // Columnas\n var cols = colsToSho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function stores the previuos coordinates of ther worms
function storePreviuosCoordinates(currentWorm) { for(var i = histotyDotsSaved; i > 0; i--) { currentWorm.previousX[i] = currentWorm.previousX[i-1]; currentWorm.previousY[i] = currentWorm.previousY[i-1]; } currentWorm.previousX[0] = currentWorm.x; currentWorm.previousY[0] = currentWorm.y; }
[ "function getWormCoords()\n{\n xyCoords = [];\n for(var i = 0; i < infections.length; i++)\n {\n xyCoords.push({id: i, targetX: infections[i].x\n , targetY: infections[i].y\n , sourceX: infections[i].infectedByx\n , sourceY: infections[i].infectedByy});\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Middleware that uses ExpressValidator to validate the registration form
function registerValidation(req, res, next) { // perform express-validation on all of the POSTed form fields (using the form names) req.checkBody('username', 'Username cannot be blank').notEmpty(); req.checkBody('username', 'Username must be between 4-15 characters long').len(4, 15); req.checkBody('email', 'Email m...
[ "async function validateRegisterMiddleware(req, res, next) {\n console.log(req.body)\n const { errors, isValid } = await validateRegisterInput(req.body);\n //check Validation\n if (!isValid) {\n logger.error(\"validateRegisterMiddleware: \" + errors);\n return ResErr(res, { message: errors }, 400);\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the nth element as DomQuery from the internal elements note if you try to reach a nonexisting element position you will get back an absent entry
get(index) { return (index < this.rootNode.length) ? new DomQuery(this.rootNode[index]) : DomQuery.absent; }
[ "nth(index) {\n const root = this.allElements[ index ];\n return new PageSelector(null, root);\n }", "function getNthElementOfType(context, element, index) {\n /* jshint boss:true */\n let nthOfType = 0;\n for (let i = 0, child; child = context.children[i]; i++) {\n if (child.nodeType === chi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Usage: wordObjArray = analyzeWord("bachwI'", rules); Return an array of word interpretation objects which all are possible interpretations for 'word' (given the specified 'rules'). If no intepretations can be found, an empty array is returned. For description of the word interpretation object, see analyzeWord2() (which...
function analyzeWord(word, rules) { var syllables = splitSyllable(word), head = syllables[0], // syllable to process results = []; // result if (rules[head]) { // if 1st syllable exist in rules ...
[ "function analyzeWord(word, rules) {\n var syllables = splitSyllable(word.replace(/[\\u2018\\u2019]/g, \"'\")),\n head = syllables[0], // syllable to process\n results = []; // result\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats the given value to numSigFigs significant figures WARNING: Javascript 1.5 only!
function toNSigFigs(value, numSigFigs) { if (!value.toPrecision) { // TODO: do this somewhere more useful alert("Your browser doesn't support Javascript 1.5"); return value; } else { return value.toPrecision(numSigFigs); } }
[ "function roundToSigFig(num, sigFigs) {\r\n\tlet currentFigs = getSigFig(num);\r\n\tlet counter = 0;\r\n\tnum = num.toExponential(getSigFig(num) - 1);\r\n\tlet exponent = +num.split('e')[1];\r\n\tnum = ((+num.split('e')[0]).toFixed(sigFigs - 1)).split('');\r\n\tnum.splice(1, 1);\r\n\tif (exponent >= -1) {\r\n\t\tif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tileMap: string represents the level map rows: rows number cols: columns number matrix: 2d array containing the tiles width: map width in pixels height: map height in pixels
constructor(tileMap) { this.tileMap = tileMap; let line = tileMap[0].split(' '); this.rows = tileMap.length; this.cols = line.length; this.matrix = new Array(this.rows); this.width = this.cols * TILE_SIZE; this.height = this.rows * TILE_SIZE; for (let i = 0; i < this.rows; i++) { t...
[ "function TileMap()\n{\n\tthis.map\t= [];\n\tthis.w\t\t= 0;\n\tthis.h\t\t= 0;\n\tthis.levels\t= 4;\n}", "function set_level_tiles()\r\n{\r\n game.tilemap.setIndexCoords(1, 0, 0x20);\r\n game.tilemap.setIndexCoords(2, 0, 0);\r\n game.tilemap.setIndexCoords(3, 0x40, 0x40);\r\n game.tilemap.setIndexCoord...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check the order of the list
function checkOrder() { //gets the name and index of each item in the list listItems.forEach((listItem, index) => { const personName = listItem .querySelector(".draggable-list__detail") .innerText.trim(); // if the item does not match the name in the original list at the same index, adds the 'w...
[ "function checkOrder() {\n listItems.forEach((listItem, index) => {\n const personName = listItem.querySelector('.draggable').innerText.trim();\n \n if (personName !== headOfState[index]) {\n listItem.classList.add('wrong');\n } else {\n listItem.classList.remove('wrong');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check valid booking period for the property
function _validPeriodValidator(err, done) { var criteria = { where: { and: [{ propertyId: this.propertyId }, { start: { lte: this.start } }, { end: { gte: this.end } }] } }; Booking.app.mo...
[ "function isValidBooking(startAt, endAt, pet) {\n let isValid = true;\n\n if (pet.bookings && pet.bookings.length > 0) {\n isValid = pet.bookings.every((booking) => {\n if (booking.status === bookingService.STATUS.CANCELLED) return true;\n\n const proposedStart = moment(startAt, \"MM/DD/YYYY\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles the popover visibility depending on if it's visible or not. Adds class sldsisopen if popover visible and removes if not.
toggleMenuVisibility() { if (!this.disabled) { this.popoverVisible = !this.popoverVisible; if (this.popoverVisible) { this._boundingRect = this.getBoundingClientRect(); this.pollBoundingRect(); } this.classList.toggle('slds-is-ope...
[ "togglePopover() {\n var _a, _b;\n const location = this.getTargetLocation();\n const { left, right, y, width } = location;\n this.setPopoverLocation(left, right, y, width);\n let popBody = (_b = (_a = document\n .querySelector(`#${this.id}`)) === null || _a === void 0 ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an array of episodes info, populate details into episodesList of DOM
function populateEpisodes(episodes) { const $episodesList = $("#episodesList"); // empty the episodes list before adding new episodes of a show $episodesList.empty(); // loop thru episodes, creating li's for each with the information provided for (let episode of episodes) { let $newEpItem = $(`<li data-e...
[ "function populateEpisodes(episodes) {\n const $episodesList = $(\"#episodes-list\");\n $episodesList.empty();\n for (let ep of episodes) {\n let $item = $(`<li>${ep.name} - (Season ${ep.season}, Episode ${ep.number})</li>`);\n\n $episodesList.append($item);\n }\n}", "function populateEpisodes(episodes)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve the audiences of a decoded JWT based on the audiences and scopes in the token.
function audiences(decodedToken) { if (audiencesFromAud(decodedToken).length) { return new Set(audiencesFromAud(decodedToken)); } return new Set(audiencesFromScope(decodedToken)); }
[ "async audiences(ctx, id, token) { // eslint-disable-line no-unused-vars\n // token is a reference to the token used for which a given account is being loaded,\n // is undefined in scenarios where claims are returned from authorization endpoint\n return undefined;\n }", "async audiences(ctx, sub, token,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a shape from the index.
remove(shape) { if (!this.shapeExists(shape)) { throw Error("Shape does not exist in this index."); } var index = this._shapeIndexes[shape.uuid]; this._allShapes[index] = null; }
[ "removeShape(shape) {\n _.pull(this.shapes, shape);\n }", "function removeShape(s) {\n var i = shapes.indexOf(s);\n shapes.splice(i, 1);\n}", "removeShape(shape) {\n const index = this.shapes.indexOf(shape);\n\n if (index === -1) {\n console.warn('Shape does not belong to the body');\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the user repository list.
getRepoList(opts) { const query = encodeQueryString(opts); return this._get(`/api/user/repos?${query}`); }
[ "getRepoList(opts) {\n\t\tvar query = this._query(opts);\n\t\tvar endpoint = [\"/api/user/repos\", query].join(\"\");\n\t\treturn this._get(endpoint);\n\t}", "listAuthUserRepos(params) {\n\t\t\treturn minRequest.get('/user/repos', params)\n\t\t}", "getRepoList(username){\n\t\tvar self = this,\n\t\t\tapiUrl = co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
==================== API PARA DELETAR AS RESPOSTAS DO ALUNO========================
async deletar(req, res) { await db("resposta") .where({ idresposta: req.params.idresposta }) .del() .then(() => res.status(200).send({ Status: "OK" })) .catch(() => res.status(400).send({ status: "ERRO" })); }
[ "function deletResRequest() {\n containOfResult.innerHTML = \" \";\n offsetRes = 0;\n}", "static clear() {\n this.resp = {};\n }", "async deletarImovel(req, res){\n await Imobiliaria.findOne(req.params.id).then(\n imobiliaria =>{\n imobiliaria.imoveis.remove(req.params...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
google maps of restaurant locations
function initMap() { var map = new google.maps.Map(document.getElementById('map_canvas'),{ center: {lat: 20.5937, lng: 78.9629} , zoom: 5, }); var location = gon.locations var restaurant = gon.restaurant var restaurant_dish = gon.restaurant_dish var pictures = gon.pictures for(var i = 0 ; i < lo...
[ "function showRestaurantMarkers() {\n for (var i = 0; i < restaurantMarkers.length; i++) {\n restaurantMarkers[i].setMap(map);\n }\n }", "function initMap() {\n $.ajax({\n url: `/api/restaurant`,\n method: 'GET',\n })....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[START admin_sdk_reports_quickstart] List login events for a Google Workspace domain.
function listLogins() { const userKey = 'all'; const applicationName = 'login'; const optionalArgs = { maxResults: 10 }; try { const response = AdminReports.Activities.list(userKey, applicationName, optionalArgs); const activities = response.items; if (!activities || activities.length === 0) {...
[ "function generateLoginActivityReport() {\n var now = new Date();\n var oneWeekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);\n var startTime = oneWeekAgo.toISOString();\n var endTime = now.toISOString();\n\n var rows = [];\n var pageToken;\n var page;\n do {\n page = AdminReports.Activities.li...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resolves the node curState[n] into a single lima value curState[n] should be a number, string, object, or superExpression ast node (not a variable ast node) allowRemainingParts If true, allows additional superExpression parts to result from curState[n] This should be true only for argument space (and maybe parameter sp...
function resolveValue(context, curState, n, allowProperties, implicitDeclarations, allowRemainingParts) { var item = curState[n] var value = basicValue(item) if(value !== undefined) { curState[n] = value } else if(utils.isNodeType(item, 'object')) { var objectNode...
[ "function resolveBinaryOperandFrom(context, curState, index, options) {\n var n=index\n while(n<curState.length) {\n var item = curState[n]\n if(utils.isSpecificOperator(item, '(')) {\n resolveParens(context, curState, n)\n } else if(!utils.isNodeType(item, 'operator')) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear all enter key contexts that have been created
static clearAllEnterContexts() { Utils.enterFunction = null; Utils.enterFunctionStack = []; }
[ "clearEnter() {\n this._clearEvent(this.enterEvents);\n }", "static clearAllKeyBindings() {\n Input.keyMap.clear();\n }", "clearContext(){\n this.context = null;\n this.context = new Map();\n }", "function clearAllKeyboardEvents() {\n mem.clear();\n mt.reset();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this moves all mushrooms!
function moveMush() { $('.left-mushroom').each(function(index){ var mushroom = $(this); var currentLeft = parseInt(mushroom.css('left')); var newLeft = currentLeft + 1; mushroom.css('left', newLeft); if (currentLeft > 950){ mushroom.remove(); } }) $('.right-mushroom').each(function(index){ ...
[ "moveFairy() {\n //KEYCODES\n //w 87\n //a 65\n //s 83\n //d 68\n if (keyIsDown(65)) { //A Key (go left)\n this.x -= this.speed;\n\n if (this.mushroom !== null) { //carries mushroom with it\n this.mushroom.x -= this.speed;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
List existing project results
function listProjects() { $.ajax({ url: '/api/results', type: 'get', //data: null, contentType: 'application/json', complete: null }).done(function(results) { for (var i = 0; i < results.length; i++) createProjectVignette(results[i].key, results[i]); }); }
[ "function listProjects () {\n\t$.ajax ({\n\t\turl: '/api/results',\n\t\ttype: 'get',\n\t\t//data: null,\n\t\tcontentType: 'application/json',\n\t\tcomplete: null\n\t}).done (function (results) {\n\t\tfor ( var i =0 ; i < results.length ; i++ )\n\t\t\tcreateProjectVignette (results [i].key, results [i]) ;\n\t}) ;\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
inserts a users registration information into the database and callsback. Accepts the transaction method object and user object with user's registration data, returns nothing.
function insertDB(tx, user) { // store the template SQL string var sql = 'INSERT INTO users (role, name, username, email, password, description) VALUES (?,?,?,?,?,?)'; // execute the query with user information from the user object tx.executeSql(sql, [user.role, user.name, user.username, user.email, u...
[ "function insertUser(tx, results) {\n\t//alert('results.rows.length' + results.rows.length);\n\t\tif (results.rows.length == 0) {\n\t\t\ttx.executeSql('INSERT INTO user VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',\n\t\t\t[user_id, first_name, middle_name, last_name, gender, age, weight, created_by, updated_by, (new D...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends ellipses and first/last page number to the displayed pages
_applyEllipses(start, end) { if (this.ellipses) { if (start > 0) { // The first page will always be included. If the displayed range // starts after the third page, then add ellipsis. But if the range // starts on the third page, then add the second pa...
[ "function getPageNumbers(pages){\n var result = [];\n //if we can display all of the pages, do that\n if(pages <= maxDisplayPages){\n result.push({text:\"<\",value:-1});\n for(var i=1;i <= pages;i++){\n result.push({text:i,value:i});\n }\n result.push({text:\">\",valu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Take a method name and return a function that will call that method on any given object. The method must be the same e.g. var str = invoker('toString', Array::toString) str(['asdf','qwer']) //=> "asfd,qwer" str('asdf') //=> undefined defined p76
function invoker(name, method) { return function(target /* args... */) { if (!existy(target)) intro.fail("Must provide a target"); var targetMethod = target[name], args = _.rest(arguments); return intro.doWhen( (existy(targetMethod) && (method === targetMethod)), ...
[ "function invoker(name, method) {\n return function(target) {\n if (!existy(target)) throw new Error(\"Must provide a target\");\n\n const targetMethod = target[name];\n const args = _.tail(arguments);\n\n if (existy(targetMethod) && method === targetMethod) {\n return targetMethod.apply(target, a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if a given side is vertical, i.e., top or bottom.
function isVerticalSide(side) { return !isHorizontalSide(side); }
[ "function isVertical(scrollbar) {\n if (!__check(scrollbar)) return 0;\n return _obj.vertical;\n}", "function isVerticalPosition(position){return position==='top'||position==='bottom';}", "function IsVertical(){\n\t\tif (skel.breakpoint('small').active)\n\t\t\t{ return true }\n\t\telse\n\t\t\t{ return fal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
'numero()' check first the current number is too large and resize it util length of 15 characters. After this size, warns that the calculator will be redefined. 'numero()' check then if 'total' is empty, if true 'total' receives current value and prints it. Else if 'value' is 0 and total's length is equal to 1, prevent...
function numero(value) { if (value == '.' && numberNow.indexOf('.') > 0){ Continue; } if (total && (total.length > 12 && total.length <= 15)) { $results.css({ "font-size": "-=0.1em" }); $processed.css({ "font-size": "-=0.1em" }); } if (total && total.length >= 16) { al...
[ "function mascaraNumeroReal(numero, quantidadeCasasDecimais, tamanho) {\n campo = eval(numero);\n\n separador = '.';\n if (mascaraInteiro(numero) == true) {\n if (campo.value.length <= quantidadeCasasDecimais){\n campo.value = limparZeroEsquerdaDecimal(campo.value);\n w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle stream event sent from MCU. Some stream events should be publication event or subscription event. It will be handled here.
_onStreamEvent(message) { let eventTarget; if (this._publication && message.id === this._publication.id) { eventTarget = this._publication; } else if ( this._subscribedStream && message.id === this._subscribedStream.id) { eventTarget = this._subscription; } if (!eventTarget) { ...
[ "_onStreamEvent(message) {\n let eventTarget;\n\n if (this._publication && message.id === this._publication.id) {\n eventTarget = this._publication;\n } else if (this._subscribedStream && message.id === this._subscribedStream.id) {\n eventTarget = this._subscription;\n }\n\n if (!eventTarge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles click event on report diagnostic popup see all button.
function onReportDiagnosticPopupSeeAllBtnClick() { seeAllClicked = true; tau.closePopup(); }
[ "function onReportClick() {\n\tTi.API.info('ente onReportClick');\n\t$.trigger(\"reportButtonClick\");\n}", "function onReportDiagnosticClick() {\r\n if (reportDiagnosticInput.checked) {\r\n reportDiagnosticToggleSwitch.click();\r\n } else {\r\n tau.openPopup(re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All the project types
function projectTypes(projectDir) { var _supports = _.partial(supports, projectDir); // Try all our project types, return first supported // if none supported return NONE return Q.all(_.map(SUPPORTED, _supports)) .then(function(supported_list) { var idx = supported_list.indexOf(true); ...
[ "function getProjectType() {\r\n return activeProjectType;\r\n}", "getAppTypes() {\n const appTypes = [];\n this.$platform.forEach((platform) => {\n appTypes.push(platform.getAppType());\n });\n return appTypes;\n }", "getProjectType() {\n const {\n projectTy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the node has a honeypot adjacent
function honeypot_adjacent(node) { var adjacent_node; var honeypots = []; for(var i = 0; i < node.adjacent_to.length; i++) { adjacent_node = node.adjacent_to[i]; if(gnodes.data()[adjacent_node].honeypot == " true") honeypots.push(adjacent_node); } return honeypots; }
[ "function isAttacking(target_square){\n //target_square.repr.hasChildNodes() ? console.log(target_square.name) : console.log('does not');\n if(target_square.repr.hasChildNodes()){\n //console.log(\"is attacking works\");\n return true; \n }\n return false;\n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes the messagebox element disappear through css class
function clearInfoMessage() { var messageBox = document.getElementById('message-box'); messageBox.className = 'alert'; }
[ "function hideMessageDialog() {\n $(\"#msg-dialog\").addClass(\"hidden\");\n $(\"#msg-dialog\").removeClass(\"error\");\n $(\"#msg-dialog #msg-title\").html('');\n $(\"#msg-dialog #msg-body\").html('');\n }", "static hideMessageBox() {\n const messageBox = document.querySelector(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Conver format price to price
function convertPrice(formatPrice){ str = formatPrice.substring(0,formatPrice.length - 4); str1 = str.replace('.',''); str2 = str1.replace('.',''); str3 = str2.replace('.',''); return str3; }
[ "function to_price(p) {\n return convert_from_unicode(p) / 100;\n}", "function parsePrice(price) {\n if(price) price = price + '€';\n return price;\n}", "function formatedPrice(price) {\n price = price.toString().replace('.', ',');\n var hasComma = price.toString().indexOf(',');\n if (hasComma > -1) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bottom Menu controller for the Avatar Actions
function PageMenuController( $mdBottomSheet ) { this.page = page; this.items = [ { name: 'Phone' , icon: 'phone' , icon_url: 'assets/svg/phone.svg'}, { name: 'Twitter' , icon: 'twitter' , icon_url: 'assets/svg/twitter.svg'},...
[ "function AvatarSheetController( $mdBottomSheet ) {\n this.items = [\n { name: 'Share', icon: 'share' },\n { name: 'Copy', icon: 'copy' },\n { name: 'Impersonate', icon: 'impersonate' },\n { name: 'Singalong', icon: 'singalong' },\n ];\n this.pe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete Old Letter (deletes first element of letters once it passes a certain y coordenate)
function deleteOldLetter(){ if(letters[0].y > 410){ letters.shift() } }
[ "replace(){\n if(this.x>windowHeight){\n currentLetters.splice(0,1);\n }\n }", "clearWord(word) {\n let tempWord = word;\n tempWord = tempWord.toUpperCase().split('');\n tempWord.forEach((el) => {\n let removed = false;\n for (let i = 0; i < this.grid[0].length; i++)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
recieve value and key of selected list item, creates temp array and removes value at that index, then sets list to listarray
removeItem(val, key){ //console.log("VALUE " + val + " KEY " + key); let listArray = [...this.state.list]; listArray.splice(key,1); this.setState({ list: listArray, }); }
[ "function _cleanSelectedList() {\n let i = _selectedList.length;\n while (i--) {\n if (_selectedList[i].value === 'index') {\n _selectedList.splice(i, 1);\n }\n }\n }", "deleteFromList(map, index) {\n map.list.splice(index, 1);\n }", "function unselectElement(key){\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FMG utils related to strings round numbers in string to d decimals
function round(s, d = 1) { return s.replace(/[\d\.-][\d\.e-]*/g, function (n) { return rn(n, d); }); }
[ "function round(s, d) {\n var d = d || 1;\n return s.replace(/[\\d\\.-][\\d\\.e-]*/g, function(n) {return rn(n, d);})\n }", "function round(s, d = 1) {\n return s.replace(/[\\d\\.-][\\d\\.e-]*/g, function(n) {return rn(n, d);})\n}", "function roundit(x,d) {\n\tif(x+''=='') return '';\n\tx=x-0;\n\tif(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
7.1 Type Conversion 7.1.1 ToPrimitive(input [, PreferredType])
function ToPrimitive(input, PreferredType) { switch (Type(input)) { case 0 /* Undefined */: return input; case 1 /* Null */: return input; case 2 /* Boolean */: return input; case 3 /* String */: return input; case 4 /* Sy...
[ "function ToPrimitive(input, PreferredType) {\n\t switch (Type(input)) {\n\t case 0 /* Undefined */: return input;\n\t case 1 /* Null */: return input;\n\t case 2 /* Boolean */: return input;\n\t case 3 /* String */: return input;\n\t case 4 /* Symbol */...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
comment: compute the occurence of task by person
function nbOccurance(person, task) { var wl = model.getWorkingList(); var counter = 0; for (var i = 0; i < wl.length; i++) { var dataSet = wl[i]; if (dataSet[1] === person) { if (dataSet[0] === task) { counter++; } } }; return counter; ...
[ "function taskTallyT (tasks) {\n //iterate over tasks\n let allTally = 0\n for(let t of tasks){\n if (t){\n //console.log(t)\n allTally += 1\n } \n }\n return allTally ;\n}", "function calculateTaskDifficulties(){\n for (var i=0; i<tasksList.length; i++){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get cell by coordinations
function getCellByCoord(i, j) { var elCell = document.querySelector(getSelector({ i: i, j: j })); return elCell; }
[ "function findCellByCoords(x, y, cells){\n let cell;\n for (cell of cells){\n if(cell[1] === x && cell[2] === y){\n return cell;\n }\n }\n return null;\n}", "cellFor (latLng) {\n // convert to hex coordinates\n var hexCoords = this.toHex(latLng)\n\n // apply the offse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the query in this URL.
setQuery(query) { if (!query) { this._query = undefined; } else { this._query = URLQuery.parse(query); } }
[ "function setQueryString() {\n const parts = [];\n\n Object.keys(selectedFilters).forEach(filter => {\n const value = selectedFilters[filter];\n\n if ('all' === value) {\n // This doesn't need to be in the query string as it's the default.\n return;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the window size between 0 and max_window_size based upon remaing requests
setWindow(adder) { adder = (this.async_requests>=0?adder:adder*-1); this.window_size = Math.min(Math.max(this.window_size + adder,0),max_window_size); }
[ "SetNextWindowSize(size, cond=0)\n {\n let g = this.guictx;\n g.NextWindowData.SizeVal.Copy(size);\n g.NextWindowData.SizeCond = cond ? cond : CondFlags.Always;\n }", "SetNextWindowSizeConstraints(size_min, size_max, custom_callback, custom_callback_data)\n {\n let g = this.gu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the user input for the amount of the item that they want from the store, and setting up the html for it on the store page if user input is outside of min & max, return 1
function getValuesAndSetupHomepage(inputId, itemPrice, min, max, rowIndex){ amount = parseInt($(inputId).val()); if(amount != NaN && amount <= max && amount >= min){ setHTML(rowIndex, itemPrice * amount); return amount; } // end if return -1; }
[ "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" ] ] } }
.rateStudent(StudentID, rating, faculty) anvita
function rateStudent(StudentID, rating1) { var url = "/api/rateStudent/" +StudentID; return $http.put(url, rating1); }
[ "function setRating ( newRating ) {\n \n}", "function updateRating() {\n if (score >= 1000) {\n stars = 3;\n } else if (score <= 999 && score >= 500) {\n stars = 2;\n } else {\n stars = 1;\n }\n genStars(stars);\n}", "function currentGrade(student, improvement) {\n // con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reusable Donut Chart Label Component
function componentDonutLabels () { /* Default Properties */ var width = 300; var height = 300; var transition = { ease: d3.easeBounce, duration: 500 }; var radius = 150; var innerRadius = void 0; var classed = "donutLabels"; /** * Initialise Dat...
[ "function DataLabel(chart){_classCallCheck(this,DataLabel);this.errorHeight=0;this.chart=chart;}", "function componentLabel () {\r\n\r\n\t/* Default Properties */\r\n\tvar dimensions = { x: 40, y: 40, z: 40 };\r\n\tvar color = \"black\";\r\n\tvar classed = \"d3X3domLabel\";\r\n\tvar offset = 0;\r\n\r\n\t/* Scales...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the given quaternion vector to represent a rotation on the given unit vector axis by the given angle, and returns the quaternion vector itelf.
static setAxisAngleQV(qv, xyz, angle) { var halfA, sinHA, ux, uy, uz; //-------------- // The quaternion representing the rotation is // q = cos(A/2) + sin(A/2)*(x*i + y*j + z*k) // ASSERT: xyz.length() == 1; [ux, uy, uz] = xyz; halfA = 0.5 * angle; sinHA = Math.sin(halfA); return this.setQV_xyzw(qv, sinHA * ux, sinH...
[ "function quatrot(rotAng, rotAxis , globalRotation) \r\n{ \r\n var quatvector = quat.create();\r\n quat.setAxisAngle(quatvector, rotAxis, degToRad(rotAng));\r\n quat.normalize(quatvector,quatvector);\r\n quat.multiply(globalRotation,quatvector,globalRotation);\r\n quat.normalize(globalRotation,glo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all Potential Move Locations.
getPotentialMoveLocations(x, y, forceJump) { let [potentialSpots, opponentColor] = this.getPotentialPieceInfo(x, y); let moves = [] for (let [i, j] of potentialSpots) { if (this.checkSingleMoveBounds(x, y, i, j)) { let checker = this.getChecker(x+i, y+j); ...
[ "#getUnavailableLocations() {\n let res = [];\n for (let player of this.allPlayers) {\n res.push(...player.snake.place);\n }\n if (this.foods) {\n res.push(...this.foods.getFoodCurrentLocations());\n }\n return res;\n }", "getAllPotentialMoves(com...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Public API Returns whether or not there are any animations
hasAnimations() { return !!Object.keys(this.__animations).length; }
[ "hasAnimations() {\n return this.animations.length > 0;\n }", "isAnimating() {\n return this.animations.length > 0;\n }", "hasAnimations() {\n return this.animations.length > 0 || this.someChildren(child => child.hasAnimations());\n }", "isAnimated()\n {\n if(this.anima...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates announcer objects for every unique twitch channel in the database
async function createAnnouncerObjects() { let twitchChannels = await getTwitchChannels(); let announcers = twitchChannels.map(async twitchChannel => { return await createAnnouncerObject(twitchChannel); }); return Promise.all(announcers); }
[ "async function processAnnouncers() {\n\n let announcers = await createAnnouncerObjects();\n announcers.forEach(announcer => {\n announceAllDiscordChannels(announcer);\n });\n\n}", "function announceAllDiscordChannels(announcer) {\n \n announcer.announceChannels.forEach(async discordChannel => {\n\n le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
m_getAppWindowHandle Recursively get the window handle of the Chrome application.
function m_getAppWindowHandle(pInst, onHandle, onError) { var windowTitleFound = false; function lookForAppWindow(recursionDepth) { pInst.driver.getAllWindowHandles().then(function (handles) { // XXX Uncomment for debugging // debugWindowHandles(pInst, recursionDepth, handles); /...
[ "function getChromeWindowOfHtmlWindow(/*HTML Window*/ win) {\r\n return getTab(win).ownerDocument.defaultView;\r\n}", "function getDisplayedApp() {\n return displayedApp || null;\n }", "getParentHandle() {\n return browser.getWindowHandle();\n }", "get applicationWindows()\n {\n let {isKnow...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if user is logged, else returns false. Use cookies to define logging.
static isLogged() { return document.getCookie('userId') !== undefined && document.getCookie('userFirstName') !== undefined; }
[ "isLoggedIn() {\n if (user) {\n return true\n } else {\n return false\n }\n }", "function logged_in() {\n if (user) return true;\n else return false;\n }", "function isLoggedIn() {\n return !!user;\n }", "isLoggedIn() {\n const ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all texts from an article and split into words
function getSentences(tag) { for (i = 0; i < tag.length; i++) { var text = tag[i].textContent if (text.indexOf(" ") !== 1) { if (text !== "") { allTexts.push(text); } } } for (i = 0; i < allTexts.length; ...
[ "function getSentences(tag) {\n for (i = 0; i < tag.length; i++) {\n var text = tag[i].textContent\n if (text.indexOf(\" \") !== 1) {\n if (text !== \"\") {\n allTexts.push(text);\n }\n }\n }\n\n for (i = 0; i < ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define a function with the identifier "concatenatePrint" Parameters: "string1" (string), "string2" (string) Definition: Prints the combined text of the strings provided Return type: (void) Example: "FOO", "BAR" > print "FOOBAR"
function concatenatePrint(string1, string2) { console.log(string1 + string2); }
[ "function concatenate(firstWord, secondWord, thirdWord) {\n return '\"'+firstWord.concat (secondWord,thirdWord)+'\"';\n}", "function concatenateString(a,b, c) {\n return a + \" \" + b + \" \" + c;\n}", "function concat(input1, input2) {\n return \"\" + input1 + input2;\n}", "function concatenateStr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the rosters from the roster forms TODO match up the middle lines with forms
function updateRosters_R(num){ for (var r = 0; r<24; r++){ var team=""; tsl = document.getElementById("allItems team_sort_list"+r); tsl_players= tsl.children; for (var p =0;p<9;p++){ team+= tsl_players[p].innerHTML.substring(0,2); } var midline=""; midline+=roster_te...
[ "function updateRosters(num){\n\n for (var r = 0; r<24; r++){\n var offense=\"\"\n var defense=\"\"\n for (var o =1;o<10;o++){\n offense+= intToPair(parseInt($(\"#\"+o+\"_form\"+r)[0].value));\n }\n defense+=intToPair(parseInt($(\"#LF_form\"+r)[0].value));\n defense+=intToPair(parseI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setTransform inputs: tr vec3: translation vector ax vec3: rotation axis vector ro float: rotationangle
setTransform(tr,ax,ro){ this.translate[0] = tr[0]; this.translate[1] = tr[1]; this.translate[2] = tr[2]; this.rotAxis[0] = ax[0]; this.rotAxis[1] = ax[1]; this.rotAxis[2] = ax[2]; this.angle = ro; }
[ "function setTransformation(x, y, z, rx, ry, rz){\n var tempPosition =new THREE.Vector3(x,y,z);\n var tempRotation = new THREE.Quaternion();\n tempRotation.setFromEuler(new THREE.Euler(rx * (Math.PI/180),ry * (Math.PI/180),rz * (Math.PI/180)));\n transformationMatrix.compose(tempPosition,tempRotation,ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create new rock at position x
function createRock(x) { const rock = document.createElement('div') rock.className = 'rock' rock.style.left = `${x}px` var top = 0 //Add rock to DOM GAME.appendChild(rock); //Move rock down the screen function moveRock() { //Check for collision if(checkCollision(rock)){ endGame(); ...
[ "function createRock(x, y){\n let newRock = {};\n newRock.centerPoint = vec2(x, y);\n newRock.vertices = [];\n let randomLength = Math.random() * (rockRadius / 1.5) + rockRadius / 1.6;\n let randomVertexCount = Math.round(Math.random() * 4 + 5);\n let randomDegrees = [];\n for (let i = 0; i < r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Performs a request to check in a specific user. On success the specific list item will be removed
checkIn(userId, container) { request.addUserToGroup(this.checkinGroup, userId).then((response) => { if (response.status === 200 && container) { //Remove the html element representing the list item of the user container.remove(); //If the user was the l...
[ "function removeUserFromElement(userID,itemNo) {\n\t\tvar idListLength, i;\n\t\tidListLength = gapi.hangout.data.getValue(\"listTxt\" + itemNo + \"listID\") || \"0\";\t\t\t// get length of current list ID list\n\t\tfor (i = 1; i <= idListLength; i++){\t\t\t\t\t\t\t\t\t\t\t\t\t\t// ---\n\t\t\tif (userID == gapi.hang...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add function inputs to the state manager object. The changing values of inputs needs to be tracked as well as the changing values of variables!
function addInputsToStateManager(node, fxnName) { const params = isAnonymizedFunction(node) ? node.init.params : node.params; for (let param of params) { stateManager[`${fxnName}:${param.name}`] = null; } }
[ "addInput(){\r\n //Here we need to change all the weights which use the input values.\r\n this.Wf = Matrix.addInput(this.Wf);\r\n this.Wi = Matrix.addInput(this.Wi);\r\n this.Wo = Matrix.addInput(this.Wo);\r\n this.Wg = Matrix.addInput(this.Wg);\r\n this.netconfig[0]++;\r\n }", "updateInputs (i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
betterHash() avoid hashing collisions by computing a better hash value. Algorithm known as Horner's method. Still sum up ASCII values of the characters, then multiply total by a prime constant. Chosen 37 as the prime constant
function betterHash(string) { const H = 37; var total = 0; for (var i = 0; i < string.length; ++i) { total += H * total + string.charCodeAt(i); } total = total % this.table.length; if (total < 0) { total += this.table.length-1; } return parseInt(total); }
[ "hashFunction(key){\n var hash = 0;\n for (var i = 0; i < key.length; i++){\n hash += key.charCodeAt(i);\n }\n // use modulo of prime # 37\n return hash % 37;\n }", "hash(key) {\n return key.split('').reduce((anwserSoFar, value) => {\n return anwserSoFar + value.charCodeAt(0);\n },...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RTHG[] Round To Half Grid 0x19
function RTHG(state) { if (DEBUG) console.log(state.step, 'RTHG[]'); state.round = roundToHalfGrid; }
[ "function RTHG(state) {\n\t if (exports.DEBUG) { console.log(state.step, 'RTHG[]'); }\n\n\t state.round = roundToHalfGrid;\n\t}", "function RTHG(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'RTHG[]');\n }\n\n state.round = roundToHal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loop through list make sure all passed
function verifyPassed(item, index, list){ if (list.length > 0 && list[index].innerHTML.localeCompare("passed") != 0) {flag = false} }
[ "checkListValues() {\n for(var entangle of this.list)\n entangle.checkValues(this.sheet);\n }", "function each(list, fn) {\n\t\t\tfor (var i = 0, l = list.length; i < l; ++i) {\n\t\t\t\tif (fn(list[i], i, list) === false) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function each(list, fn) {\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UPDATE CHMOD NUMBER FROM CHECKBOXES
function updateChmodNum(cbId,n) { var c = document.getElementById("chmodNum").value; if (c == "") c=0; if (document.getElementById(cbId).checked == true) c = parseInt(c) + n; else c = c - n; document.getElementById("chmodNum").value = c; }
[ "function updateMultiChk(id) {\r\n\tvar obj = document.getElementById(id),\r\n\t\tsize = document.getElementById(id+'_size').value,\r\n\t\ttmpStr='',tmpList = [];\r\n\t\r\n\tfor(var i=0;i<size;i++) {\r\n\t\ttmpList[i] = document.getElementById(id+i).checked;\r\n\t}\r\n\t\r\n\tfor(i in tmpList) {\r\n\t\tif(tmpList[i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
drawMeter will take in a corner gauge object and apply final settings for this gauge representing the TSH Level and draw it
function drawMeter(gauge) { gauge.Set("chart.value.text.units.post", " %") .Set("chart.value.text.boxed", false) .Set("chart.value.text.size", 14) .Set("chart.value.text.font", "Verdana") .Set("chart.value.text.bold", true) .Set("chart.value.text.decimals", 2) .Set("chart.shadow.offsetx", 5) ...
[ "function drawMeter(gauge) {\r\n gauge.Set(\"chart.value.text.units.post\", \"mmHg\")\r\n .Set(\"chart.value.text.boxed\", false)\r\n .Set(\"chart.value.text.size\", 14)\r\n .Set(\"chart.value.text.font\", \"Verdana\")\r\n .Set(\"chart.value.text.bold\", true)\r\n .Set(\"chart.value.text.decimals\",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prepares address for url (arcgis uses + instead of %20)
function prepAddress(param) { return $.param(param).replace("%20", "+"); }
[ "function getAddressFromURL(){\n\tvar address = getParam('addressLine1') + \" \" + getParam('addressLine2') + \" \" + getParam('city') + \" \" + getParam('state') + \" \" + getParam(\"zipcode\");\n\treturn address.replace(new RegExp(\"\\\\+\", 'g'), \" \")\n}", "encodeURL(address=null, city=null, state=null){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Affichage du nombre d'article dans le panier
function nombreIndexPanier() { let indexPanier = document.getElementById("indexPanier"); indexPanier.textContent = panier.length; }
[ "function nombreArticlePanier() {\n let indexPanier = document.getElementById(\"indexPanier\");\n indexPanier.textContent = panierUtilisateur.length;\n }", "function changePanierNb() {\n document.querySelector(\".headerPanierNumber\").innerHTML = `${contenuPanier.length}`;\n}", "function getArticleNbr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Performs a 2level object merge of a scene's configuration with the root one, applying templates as they are available
mergeNodeConfig(nodeConfig, base = this.config) { if (!nodeConfig) { Object.keys(base).forEach((configKey) => { nodeConfig[configKey] = base[configKey]; }); return; } if (nodeConfig._merged) { // This node config has already merged with the top level configuration and any te...
[ "function updateTemplObj()\n {\n templObj.Template.regionTree.rootRegion = P.treeFromRegions( root, true );\n templObj.Template.regionTree.regionWidgetAssociations = createRegionWidgetAssociations( root );\n // templObj.Template.cssRegion = \"\";\n var cssObj = get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Complete the given todo.
function complete(todo) { vm.error = undefined; service.complete(todo, function() { _fetch(); }, function() { vm.error = 'An error occurred when completing a todo'; }); }
[ "function _completeTodo(id)\n\t{\n\t\tvar req = db.get('todoList', id);\n\t\t\n\t\treq\n\t\t\t.done(function(record) \n\t\t\t{\n\t\t\t\trecord.completed = !(record.completed); //invert the 'completed' value\n\t\t\t\tdb.put('todoList', record)\n\t\t\t\t\t.fail(function(e) {\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t})\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Hotel UI states will be handled. TODO: Consider move states to constants.
function getStates() { return hotelStates; }
[ "getState() {\r\n if (this.stateView === \"all\") {\r\n return \"Österreich\";\r\n } else {\r\n let state = \"\";\r\n for (let key in stateIsoMap) {\r\n if (stateIsoMap[key] === this.stateView) {\r\n state = key;\r\n }\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates the maximum of several layers
function stackMax(layer) { let data = layer.data; return d3.max(data, function(d) { return Math.max(d[1], d[2]); }); }
[ "function xMax(layer) {\n let data = layer.data;\n return d3.max(data, function(d) {\n return d[0];\n });\n }", "function findMax(arr) {\n return d3.max(arr, innerArray => d3.max(innerArray[1]));\n }", "function maxScore(){\n var max = networks[0].score;\n for (var n = 0; n < networ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Demo is a functional component. It returns a button to switch the app to "Demo" mode.
function Demo({ setMode, userID }) { const demo = () => { setMode("Demo"); } return <button className="menuButton" onClick={demo}>Demo</button> }
[ "setupForDemoMode() {\n this.demoMode = true;\n }", "function startDemo() {\n View.set('Demo');\n }", "function activateDemo() {\n\n\t\t\tdemo.initialise();\n\n\t\t\tdemo.camera.aspect = window.innerWidth / window.innerHeight;\n\t\t\tdemo.camera.updateProjectionMatrix();\n\n\t\t\tgui = new dat.GUI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Play a song at an index in the current queue
playSongAtQueueIndex(index) { // Update the queue index app.queueIndex = index; this.playSong(app.playQueue.get(index)); }
[ "async playIndex(index) {\n if (index >= this.queue.data.length || index < 0) return;\n this.queue.index = index;\n await this.playTrack(this.queue.data[this.queue.index]);\n this.play();\n this.savePlaybackInfo();\n }", "playSong(index) {\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks if tweet is a retweet
function onlyRetweets(tweet){ if(tweet.hasOwnProperty('referenced_tweets')){ for(let j=0;j<tweet.referenced_tweets.length;j++){ if(tweet.referenced_tweets[j].type==='quoted'||tweet.referenced_tweets[j].type==='replied_to'){ return false; } } return true; }else{ ...
[ "isRetweet(tweet) {\n if (tweet.substring(0,2) === \"RT\") {\n return true;\n }\n return false;\n }", "function _isRetweet(tweetText) {\n //All retweets begin with 'RT @'\n return tweetText.indexOf(\"RT @\") > -1;\n}", "function onTweet(tweet) {\n // if it's flagged as a retweet or has RT\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resetCandidate Input: None Results: None Side Effects: All elements of this.candidates will be set to 511 and reculculate this.candidates
resetCandidate(){ this.candidates.fill(0b111111111); this.candidates_row.fill(0b111111111); this.candidates_column.fill(0b111111111); this.candidates_block.fill(0b111111111); for(let i=1; i<=9; i++){ for(let j=1; j<=9; j++){ if(this.getNumber(...
[ "reset() {\n this.candidates = []\n }", "resetCandidate(){\r\n this.candidates.fill(0b111111111);\r\n this.candidates_row.fill(0b111111111);\r\n this.candidates_column.fill(0b111111111);\r\n this.candidates_block.fill(0b111111111);\r\n\r\n this.shadow.candidates.fill(0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creats all the finger onjects and returns an array of finger data
function createAllFingerData() { var fingerData=[]; for (var i=0; i<=5; i++) { fingerData.push({ start:{ x: 0, y: 0 }, end:{ x: 0, y: 0 }, identifier:0 }); } return fingerData; }
[ "function createAllFingerData() {\n var fingerData=[];\n for (var i=0; i<=5; i++) {\n fingerData.push({\n start:{ x: 0, y: 0 },\n end:{ x: 0, y: 0 },\n identifier:0\n });\n }\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sensors holds a list of all possible sensors // createSensorList runs once after the version number is discovered. It creates the list of sensors.
function createSensorList() { sensors.push( new Sensor(1, "Input 1", 0, 1023, true) ); sensors.push( new Sensor(2, "Input 2", 0, 1023, true) ); sensors.push( new Sensor(3, "Keyboard", 0, 255, false) ); sensors.push( new Sensor(4, "Accel-X", -16000, 16000, true) ); sensors.push( new Sensor(5, "Accel-Y", -16000, 160...
[ "function createSensorList() {\n sensors.push( SENSOR_1A );\n sensors.push( SENSOR_1B );\n sensors.push( SENSOR_2A );\n sensors.push( SENSOR_2B );\n sensors.push( SENSOR_3A );\n sensors.push( SENSOR_3B );\n sensors.push( SENSOR_USB );\n sensors.push( SENSOR_ACCEL_X );\n sensors.push( SENS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function for constructing the Token object.
function makeToken(kind, start, end, value) { return { kind: kind, start: start, end: end, value: value }; }
[ "function createToken() {\n if (value) {\n return { value, type };\n }\n return { type };\n }", "function Token() {\n}", "function createToken(type, value) {\n var token = new Token(type);\n if (value) {\n for (var i in value)\n if (value.hasOwnProperty...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Are progress events supported?
function supportAjaxUploadProgressEvents() { var xhr = new XMLHttpRequest(); return !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload)); }
[ "function supportAjaxUploadProgressEvents() {\n\t\tvar xhr = new XMLHttpRequest();\n\t\treturn !! (xhr && ('upload' in xhr) && ('onprogress' in xhr.upload));\n\t}", "function supportAjaxUploadProgressEvents() {\n var xhr = new XMLHttpRequest();\n return !! (xhr && ('upload' in xhr) &...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if there is more than one entry in the model where the FHIR path is the same as the one here, then a discriminator is needed
function isDiscriminatorRequired(){ $scope.discriminatorReq = false; if ($scope.input.mappingPath) { //there is a mapping var cnt = 0; treeData.forEach(function (node) { if (node.data) { ...
[ "function l(t,e){const n=t.schema.options.discriminatorKey;return null!=e&&e.hasOwnProperty(n)&&(t=r(t,e[n])||t),t}", "function l(e,t){const n=e.schema.options.discriminatorKey;return null!=t&&t.hasOwnProperty(n)&&(e=r(e,t[n])||e),e}", "function c(e,t){const r=e.schema.options.discriminatorKey;return null!=t&&t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selectbox manager. Use the singleton instance of this class, $.selectbox, to interact with the select box. Settings for (groups of) select boxes are maintained in an instance object, allowing multiple different settings on the same page
function Selectbox() { this._state = []; this._defaults = { // Global defaults for all the select box instances classHolder: "sbHolder", classHolderDisabled: "sbHolderDisabled", classSelector: "sbSelector", classOptions: "sbOptions", classGroup: "sbGroup", classSub: "sbSub", classDisab...
[ "function Selectbox() {\r\n this._state = [];\r\n this._defaults = { // Global defaults for all the select box instances\r\n classHolder: \"sbHolder\",\r\n classHolderDisabled: \"sbHolderDisabled\",\r\n classSelector: \"sbSelector\",\r\n classOptions: \"sbOptions\",\r\n classGroup: \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
darken the symbols at the given row,col
function darkenrc2(row, col) { var e = document.getElementById(row+"_"+col); if (e == null) return; e.innerHTML = getImgDarker(cipher[which][row].charAt(col)); }
[ "function darkenrc(row, col) {\n\t\tvar e = document.getElementById(row+\"_\"+col);\n\t\tif (e == null) return;\n\t\te.className = \"dimmed\";\n\t\te.innerHTML = getImgDarker(cipher[which][row].charAt(col));\n\t}", "function darken(rc) {\n\t\tvar maxrow = -1;\n\t\tvar minrow = 100000;\n\t\tvar maxcol = -1;\n\t\tv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ctor method for the RemoveCompanyCtrl
function RemoveCompanyCtrlCtor(mockServiceHTTP) { this.success = false; this.failure = false; this.removeCompany = function () { console.log(this.newCompany); if (this.newCompany != undefined || this.newCompany.id != undefined || this.newCompany.name != undefined) ...
[ "function DeleteCompanyCtrlCtor(mockServiceHTTP) {\r\n\t\tthis.success = false;\r\n\t\tthis.failure = false;\r\n\t\tthis.deleteCompany = function() {\r\n\t\t\tconsole.log(this.newCompany);\r\n\t\t\tif (this.newCompany == undefined || this.newCompany.id == undefined\r\n\t\t\t\t\t|| this.newCompany.name == undefined)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_calcCoordinates Calculates the coordinates of the leaf nodes
_calcCoordinates(dataNodes) { let distScale = linear().range([20, this._innerRadius]).domain([0, this._dataLinks.heightTree]); this._vOrder.forEach((d, i) => { dataNodes[d].x = this._vAngle[i]; dataNodes[d].y = this._innerRadius; }); posOrdem(this._dataLinks.tree); function posOrdem(raiz...
[ "function computeCoords(multiTree, path, startCoord, level, nodesList) {\n var totalWidth = 0;\n for (let i = 0; i < multiTree.length; i++) {\n var currNode = {};\n currNode.span = multiTree[i].span;\n currNode.className = multiTree[i].className;\n currNode.path = path.slice();\n currNode.path.push...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
execute bash/shell command asynch.
execute_async(command, handler) { exec(command, (error, stdout, stderr) => { if (error) { console.log(`error: ${error.message}`); handler(null, error) return; } if (stderr) { console.log(`stderr: ${stderr}`); handler(stderr, null) return; } console.log(`stdout: ${stdout}`); h...
[ "function asyncExec(commandLineString) {\n return new Promise((resolve, reject) => {\n exec(commandLineString).on('exit', (code) => {\n resolve(code)\n }).on('error', () => {\n resolve('error')\n });\n });\n}", "function execute() {\n command.exec(env, reque...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
greater of m + n + 1 space. linear time too set list1 and list2 to their respective nexts set carriedOver to 0 create result list, in which we always have a pointer to the node before tail, so we can create new nodes when necessary while at least one pointer is not at its tail or carriedOver is not zero, do the followi...
function sumListsForwardOrder(list1, list2){ //FORWARD ORDER IMPLEMENTATION }
[ "function sumListsFollowUp(l1, l2) {\n const l1Length = getLength(l1);\n const l2Length = getLength(l2);\n\n if (l1Length < l2Length) {\n l1 = padList(l1, l2Length - l1Length);\n } else if (l1Length > l2Length) {\n l2 = padList(l2, l1Length - l2Length);\n }\n\n let result = recurse(l1, l2);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a parituclar wf
function get_wf(wf_id) { return decode(store.getItem(workflow_key(wf_id))); }
[ "function GetWFFrameDoc() {\n if (el(\"wfFrame\" + pdf(\"CurrentDesk\")))\n return el(\"wfFrame\" + pdf(\"CurrentDesk\")).contentWindow.document;\n else if (pel(\"wfFrame\" + pdf(\"CurrentDesk\")))\n return pel(\"wfFrame\" + pdf(\"CurrentDesk\")).contentWindow.document;\n else\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is called when the Print Photo button is clicked.
function printPhoto() { // If an operation is in progress, usually involving the server, don't do it. if (processing) { return false; } if (currentPhoto == null) { alert("Please select a photo first."); return false; } // If photo happens to be growing, cut it short. snapImageToLandingPad(); // Op...
[ "printPhotostripPDF() {\n this.pdf.internal.scaleFactor = photobooth.Main.ui.canvas.height * 0.00274177456;\n this.pdf.addImage(this.img, \"JPEG\", 10, 10);\n this.pdf.autoPrint();\n window.open(this.pdf.output(\"bloburl\"), \"_blank\");\n }", "printRecipeClicked...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the rule applies to the given path.
function applyXPathRule_(rule, path, options) { return path.indexOf(rule) == 0; }
[ "function applyXPathRule_(rule, path, options) {\n return path.indexOf(rule) == 0;\n}", "function applyXPathRule_(rule, path, options) {\n return path.indexOf(rule) == 0; \n}", "function validatePath(path) {\n if (path == name)\n return true\n}", "inPath(path) {\n return this.currentPath.indexO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END CLASS: rGraph //////////////////////////////////////////// DefaultGraphModel //////////////////////////////////////////// constructor
function DefaultGraphModel(domain) { if (arguments.length > 0) { this.init(domain); } }
[ "function rGraph(model, view) \r\n{\r\n if (arguments.length > 0) {\r\n\tthis.init(model, view);\r\n }\r\n}", "function createDefaultGraph(){\n currentGraph = new Graph(['a','c','d','e']);\n addEdge('a','c');\n addEdge('c','d');\n addEdge('d','e');\n addEdge('e','a');\n showGraph();\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }