query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
/move from a folder to another
async function Move( auth, hId, folderForm, folderIdTo){ const drive = google.drive({version: 'v3', auth}); var house = await sqlpromise(`select * from house, location where house.id=location.id and house.id = ${hId}`); drive.files.update({ fileId: house[0]['folderId'], addParents: folderIdTo, removeP...
[ "function fs_move(action, relative_from_path_src, relative_from_path_dest, relative_to_path) {\n if (relative_to_path === void 0) { relative_to_path = \".\"; }\n relative_to_path = fs_areSame.get_relative_to_path(relative_from_path_src, relative_from_path_dest, relative_to_path);\n var src_path = path.join...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compile an Angular directive according to its decorator metadata, and patch the resulting directive def onto the component type. In the event that compilation is not immediate, `compileDirective` will return a `Promise` which will resolve when compilation completes and the directive becomes usable.
function compileDirective(type, directive) { var ngDirectiveDef = null; addDirectiveFactoryDef(type, directive || {}); Object.defineProperty(type, NG_DIR_DEF, { get: function get() { if (ngDirectiveDef === null) { // `directive` can be null in the case of abst...
[ "function compileDirective(type,directive){var ngDirectiveDef=null;Object.defineProperty(type,NG_DIRECTIVE_DEF,{get:function get(){if(ngDirectiveDef===null){var facade=directiveMetadata(type,directive);ngDirectiveDef=getCompilerFacade().compileDirective(angularCoreEnv,\"ng://\"+(type&&type.name)+\"/ngDirectiveDef.j...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end function getData() / Description: Takes the divId from admin.htm. Sets a connection to getBookings.php to get current bookings. Displays the result in the divId provided from admin.htm
function getBookings(div){ var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) { document.getElementById(div).innerHTML = xhr.responseText; } // end if } // end anonymous call-back function xhr.open("GET", "getBookings.php", true); xhr.sen...
[ "function getdata(){\n\t\n\tif(!flag){\n\t\tgetjson(page);\n\t\tpage++;\n\t } \n\telse {\n\tvar subsets = combine(pdt_arr, giftnum, 0);\n\t\n\t\tfor(var i=0; i < subsets.length; i++)\n\t\t{\t\n\t\t\tfor(var j = 0; j < subsets[i].length; j++){\n\t\t\t\tvar htmlstr = \"Id:\" + subsets[i][j][\"productId\"] + \" Produc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate table with exchange rate history
generateHistoryTable(currencyHistory) { let resultDiv = document.getElementsByClassName('search-result'); let table = document.createElement('TABLE'); let day = 30; let period = 10; for (let i = 10; i > 0; i--) { var tr = document.createElement('TR'); for (let j = 0; j < 3; j++) { ...
[ "function buildLatestRatesTable(dataLatest, data3DaysBack) {\n let data_table = \"\"; \n\n for (var key in dataLatest) {\n var trend;\n if (dataLatest.hasOwnProperty(key)) {\n if (dataLatest[key] - data3DaysBack[key] > 0) {\n trend = `<span style=\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
walks all child elements and finds all elements with multilingual in them
function ls_getAllMultilingualElements(n) { var elements = new Array(); // possible bug if we have a classname that includes the word multilingual // but it's unlikely if (n.className && n.className.indexOf('multilingual') != -1) { elements = elements.concat(n); } var children = n.childNodes; for (v...
[ "function translate_elements()\r\n {\r\n for(var n=0; n<elist.length;n++)\r\n {\r\n element = elist[n]; \r\n cNodelist = element.childNodes;\r\n for(var i=0; i<cNodelist.length;i++)\r\n {\r\n try{\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hides a game field
function hideGameField(follower) { toggleHideElements([DOM.game.score, DOM.game.pauseButton], animation.duration.hide, true, follower); }
[ "function hide() {\n isVisible = false;\n\n quickAccessMenu.stop(true).slideUp(animTime / 2);\n quickAccessField.stop(true).delay(animTime / 2).slideUp(animTime / 2);\n }", "function hideOpt() {\n document.getElementById(\"preGame\").setAttribute(\"hidden\", \"hidden\");\n document.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The core function that calculates the "velocity" with which a voice should be driven given the various rhythm parameters and info about the current musical time.
function velocity(rhythm, time) { var timeStruc = kTimeStruc[time.struc]; // time.struc = "simple" or "compound". var gridPos = time.pos % timeStruc.cycleLength; var pspos = (gridPos + timeStruc.phase[Math.floor(rhythm.phase)]) % timeStruc.cycleLength; var straigh...
[ "function calculateVelocity() {\n\t\t\t\tcurrentTime = (new Date).getTime();\n\t\t\t\tperiod = currentTime - previousTime;\n\t\t\t\tpreviousTime = currentTime;\n\t\t\t\tif (numSamples++) {\n\t\t\t\t\tvelocityX = (velocityX * (numSamples - 1) + numSamples * (translationX - previousTranslationX) / period) / 2 / numSa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: Add Nary limits. For now only binary limits are supported TODO: Add illustrative diagrams describing all objects and morphisms. Especially for complements. TODO: Add prefix I to mixins to distinguish them from classes? TODO: Don't create instances of categories? Export SetCategory.prototype, GraphCategory.prototy...
function Category() { }
[ "function Category() {\n _classCallCheck(this, Category);\n\n Category.initialize(this);\n }", "function Category() {\n }", "function Category() {\n this.id;\n\n this.name;\n this.descripstion;\n\n this.createdDate;\n this.modifiedDate;\n this.deletedDate;\n\n this.parentCateg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function performs the iterated inversion algorithm on the point (x,y) and returns an array of points.
function iterativeInversion(x,y,circles) { if(sqrt(x*x + y*y) > 1.0) { return []; } let flag = true ; let points = [createVector(x,y)]; const iterations = 10; for(let i = 0; i<iterations; i++) { var k; flag = true; for ( k in circles ) { let ci...
[ "getVertIgnitionPoints () {\n // const spacing = this.bounds().ySpacing()\n const pts = []\n this._vert.forEach((line, lineIdx) => {\n const x = line.anchor()\n // const left = (lineIdx === 0) ? null : this.vertLine(lineIdx - 1)\n // const right = (lineIdx >= this._vert.length - 1) ? null : ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check whether CORS should be allowed for a given request.
function checkShouldAllowCors(request) { return corsUrls.some(url => testString(url, request.url)); }
[ "function checkCorsSupport() {\n\tvar xhr = new XMLHttpRequest();\n\tif (\"withCredentials\" in xhr)\n\t\treturn true;\n\telse if (typeof XDomainRequest != \"undefined\")\n\t\treturn true;\n\telse\n\t\treturn false;\n}", "function isCorsEnabled(src) {\n return !!src && src.search(corsMatch) === 0;\n}", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the (X,Y,Z) average of all points in a Mesh loaded from OBJ/MTL files. Expects a Object3D containing a BufferGeometry.
function centroidOfVertexSet(obj) { var centroid = new THREE.Vector3(0,0,0); if(!obj.children[0].isMesh) { console.error('Objects first child is not a mesh...'); return centroid; } var mesh = obj.children[0]; var geometry = mesh.geometry; var vertices = geometry.getAttribute('position') var npts ...
[ "function averagePoints(vertices, tl, tr, bl, br, elevation) {\n let sum = vertices[tl].z + vertices[tr].z + vertices[bl].z + vertices[br].z;\n return (sum / 4) + rr() * elevation;\n}", "static average(vertices) {\n let xSum = 0, ySum = 0, zSum = 0;\n\n for (let i = 0; i < vertices.length; i++) {\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test DB state after update and reload
function testPostUpdateState (cb) { d.find({}, function (err, docs) { var doc1 = _.find(docs, function (d) { return d._id === id1; }) , doc2 = _.find(docs, function (d) { return d._id === id2; }) , doc3 = _.find(docs, function (d) { return d._id === id3; }) ; ...
[ "function testPostUpdateState (cb) {\n d.find({}, function (err, docs) {\n var doc1 = _.find(docs, function (d) { return d._id === id1; })\n , doc2 = _.find(docs, function (d) { return d._id === id2; })\n , doc3 = _.find(docs, function (d) { return d._id === id3; })\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract the scheme of a URL.
function getUrlScheme(url) { var match = _split(url); return match && match[_ComponentIndex.Scheme] || ''; }
[ "function getUrlScheme(url) {\n\t var match = _split(url);\n\t return match && match[_ComponentIndex.Scheme] || \"\";\n\t}", "function getUrlScheme (url) {\n var match = _split (url);\n return (match && match[_ComponentIndex.Scheme]) || \"\";\n }", "function getUrlScheme(url) {\n var m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets the Application player
function resetPlayer() { audioPlayer.resetSrc(); trackInfo.resetTrackInfo(); metadata.reset(); errorContainer.hide(); audioImage.setImage(); }
[ "function resetApp() {\n stopPlaying();\n app.currentLevelNum = 0;\n app.score = 0;\n resetLevel(true);\n $('#crashed-popup').hide();\n $('#finished-level-popup').hide();\n $('#finished-game-popup').hide();\n $('#gl-canvas').hide();\n $('#hud').hide();\n $('#menu').css('display','block...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Normalizes URL parameters by prepending with `?` if needed.
function normalizeQueryParams(params) { return params && params[0] !== '?' ? '?' + params : params; }
[ "function normalizeQueryParams(params) {\n return params && params[0] !== '?' ? '?' + params : params;\n }", "function normalizeQueryParams(params) {\n return params && params[0] !== '?' ? '?' + params : params;\n}", "function normaliseQueryParam (previous, current) {\n return [\n hasQueryParam(p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to filter the table by id
filterTableById(filterId) { let filteredResult = this.props.persons.filter(person => { return person.id.toString().includes(filterId.toString()); }) this.setState({ currentlyDisplayed:filteredResult}); }
[ "filterTableById(filterId) {\n let filteredResult = this.props.persons.filter(person => {\n return person.id.toString().includes(filterId.toString());\n })\n this.setState({ personDisplayed:filteredResult});\n }", "function findByFilter(id, filter) {\n return db(\"tickets a t\")\n .join(\"use...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get timestamp of a specific event on the blockchain
async getEvent(eventType, itemUPC) { const events = await this.contract.getPastEvents(eventType, { fromBlock: 0, filter: { upc: parseInt(itemUPC) }, }); if (events.length > 0) { const blockNumber = events[0].blockNumber; const blockDetails = await this.contract.eth.getBlock(blockNumb...
[ "function getTimestamp(rawTx) {\n const timestamp = get(\n rawTx,\n ['meta', 'metronome', 'export', 'blockTimestamp'],\n null\n )\n return timestamp ? Number(timestamp) : null\n}", "async function currentBlockTimestamp() {\n const blockNumber = await sendRPC(web3, \"eth_blockNumber\", []);\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Common Target Mark System Only work with object which has id property Creep Memory Path: .memory.targetMark = %id%
function ensureTargeMarktInitialize(creep) { if(_.isUndefined(creep.memory.targetMark)) creep.memory.targetMark = {}; if(!_.isObject(creep.memory.targetMark)) creep.memory.targetMark = {}; }
[ "setNEOTarget(target) {\n App.pathFinder.data.target.coordinates = target.mercator;\n\n App.targeting.setTarget(target.mercator[0], target.mercator[1]);\n App.pathFinder.data.target.translate = true;\n }", "function checkpointontarget(target,x,y) {\n\t\tif (ggbApplet.getObjectType(obj) == \"poin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate the centroid using the bbox
function getMyCentroid(element) { var bbox = element.getBBox(); return [bbox.x + bbox.width/2, bbox.y + bbox.height/2]; }
[ "get centroid() {}", "function centroid(){\n var xc = 0;\n var yc = 0;\n for(var i = 0; i < conHull.length; i++){\n xc += conHull[i].x;\n yc += conHull[i].y;\n }\n xc = xc/conHull.length;\n yc = yc/conHull.length;\n return {\n x: xc,\n y: yc\n };\n}", "centroid(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
xWalkTree3, Copyright 20052007 Michael Foster (CrossBrowser.com) Part of X, a CrossBrowser Javascript Library, Distributed under the terms of the GNU LGPL
function xWalkTree3(n,f,d,l,b) { if (typeof l == 'undefined') l = 0; if (typeof b == 'undefined') b = 0; var v = f(n,l,b,d); if (!v) return 0; if (v == 1) { for (var c = n.firstChild; c; c = c.nextSibling) { if (c.nodeType == 1) { if (!l) ++b; if (!xWalkTree3(c,f,d,l+1,b)) ...
[ "function xWalkTree(n, f)\r\n{\r\n f(n);\r\n for (var c = n.firstChild; c; c = c.nextSibling) {\r\n if (c.nodeType == 1) xWalkTree(c, f);\r\n }\r\n}", "function xWalkTree(n, f)\n{\n f(n);\n for (var c = n.firstChild; c; c = c.nextSibling) {\n if (c.nodeType == 1) xWalkTree(c, f);\n }\n}", "function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throw if the action payload is not a single, valid key
mustBeKey(action) { const data = this.extractData(action); if (data === undefined) { throw new Error(`should be a single entity key`); } if (this.isNotKeyType(data)) { throw new Error(`is not a valid key (id)`); } return data; }
[ "mustBeKeys(action) {\n const data = this.extractData(action);\n if (!Array.isArray(data)) {\n return this.throwError(action, `should be an array of entity keys (id)`);\n }\n data.forEach((id, i) => {\n if (this.isNotKeyType(id)) {\n const msg = `${th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
infer types from an array of array
__get_t(arr_val) { if (this.__is_1D_array(arr_val)) { const dtypes = [] let int_tracker = [] let float_tracker = [] let string_tracker = [] let bool_tracker = [] let lim; //remove NaNs from array let arr = [] ...
[ "function arrayValuesTypes(arr) {\n return arr.map(value => typeof value)\n}", "function toFieldTypes(arr) {\n res = []\n for (e of arr) {\n res.push(types[e]);\n }\n return res;\n}", "function logArrTypes(arr){\n\tforEachElem(arr, (elem) => (console.log(elem + ' is a ' + typeof elem)));\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: _fnDrawHead Purpose: Create the HTML header for the table Returns: Inputs: object:oTable jQuery object for the target int:iSortCol column being sorted on
function _fnDrawHead( oTable, iSortCol ) { var nTr = document.createElement( "tr" ); var nTh; for ( var i=0 ; i<_aoColumns.length ; i++ ) { if ( _aoColumns[i].bVisible ) { nTh = document.createElement( "th" ); if ( i == iSortCol ) { nTh.className = "sorting_asc"; ...
[ "function _fnDrawHead( oSettings )\n\t\t{\n\t\t\tvar nThOriginals = oSettings.nTable.getElementsByTagName('thead')[0].getElementsByTagName('th');\n\t\t\tvar nTr = document.createElement( \"tr\" );\n\t\t\tvar nTrFoot = document.createElement( \"tr\" );\n\t\t\tvar nTh;\n\t\t\t\n\t\t\t/* Create header elements */\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: userLogin Processes the user login event from the login button or enter key.
function userLogin() { /**-----------------------------------------------------------------------*/ /** Get the user's name and password as entered into the login form: */ /**-----------------------------------------------------------------------*/ var name = document.querySelector('[name="username...
[ "function org_shaolin_vogerp_herewego_page_Login_Login(eventsource,event) {/* Gen_First:org_shaolin_vogerp_herewego_page_Login_Login */\n\n var UIEntity = this;\n\n this.Submit_OutFunctionName(eventsource);\n }", "function keyUsername(e) {\n if (e.keyCode == 13) {\n doLogin();\n }\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function filters through the projects based off of the given search criteria and then displays the appropriate projects INNER FUNCTION CALLS: updateDisplayableProjects(), clearAndAddSingleRow()
function filterProjects(filter) { if (filter != undefined) console.log(filter); updateDisplayableProjects(); let json = DISPLAYABLE_PROJECTS.slice(0); let outputs = new Array(); let parameters = $('.paramHolder').children('select'); let remaining = json.length; if (paramNum != 0) { for (var i = 0;...
[ "function searchProjects() {\n\tgrabProjectList();\n}", "function filterProjects () {\n\n\tupdateDisplayableProjects();\n\t//let json = JSON.parse(projects['projects']);\n\tlet json = DISPLAYABLE_PROJECTS;\n\tconsole.log(\"DISPLAYABLE \" , DISPLAYABLE_PROJECTS);\n\tlet parameters = $('.paramHolder').children('sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return all cell references for all tabs.
_allCellRefs() { return this.sheet.allCellRefs().toSet(); }
[ "allCellRefs() {\n return this.tabsById.valueSeq().flatMap(tab => (\n tab.rows.flatMap((row, rowIdx) => (\n row.map((cell, colIdx) => CellRef.of(tab, rowIdx, colIdx))\n ))\n ));\n }", "function allTabIDs() {\n return $('.tablink').map(function getTabId() {\n return $(this).attr('href')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a thumbnail URL, get the video id and initiate playback. TODO: Use something other than string splitting.
function playVideoFromThumbnailUrl(thumbnailUrl) { var videoId = thumbnailUrl.split('/')[4]; if (videoId != null) { playVideo(videoId); } }
[ "function useVideoThumbnail(videoUrl){\n const [thumbnailUrl, setThumbnailUrl] = useState()\n\n useEffect(() => {\n const video = document.createElement('video')\n video.src = videoUrl\n video.onloadedmetadata = () => {\n video.currentTime = video.duration / 2\n }\n video.onseeked = async () =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to display plots from a country from dropdown menu selection
function optionChanged() { // Assign dropdown menu to variable using D3 and ID for menu given in HTML let dropdownMenu = d3.select("#dropdown"); // Assign the value of the country dropdown menu option to a variable let country = dropdownMenu.property("value"); // Clear the already displayed c...
[ "function optionChanged() {\n\n // Assign dropdown menu to variable using D3 and ID for menu given in HTML\n let dropdownMenu = d3.select(\"#dropdown\");\n\n // Assign the value of the country dropdown menu option to a variable\n let cyclone = dropdownMenu.property(\"value\");\n \n // Clear the al...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allows an admin to create a sport
async function createSport({ name, gender, icon }) { return await api.post(`/sports`, { name, gender, icon }).then((res) => { if (indexedDbExists()) { insertSportIndexedDB(res.data); } return res.data; }); }
[ "function createTeam(req, res) {\n const { season, team } = req.body;\n\n const newTeam = new Team(team);\n // pass a season object to the save method\n // the teamSchema has a pre-save hook that creates a brand\n // new season for a new team\n newTeam.save({ season })\n .then(() => \n res.send(newTea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes all of the tokens from the json blob and turns them into an array of axios calls
function createArrayOfCalls() { let callsArr = []; for (let key in tokens) { callsArr.push(axios.get(`${apiBaseUrl}${tokens[key].url}?${convertCADUrl}`)); } return callsArr; }
[ "function xformTokens(metadata, tokens) {\n var valid = __WEBPACK_IMPORTED_MODULE_3__type__[\"j\" /* isString */](tokens) && tokens.length > 0;\n if (!valid) {\n // This can happen if objects are uploaded through GCS and retrieved\n // through list, so we don't want to throw an E...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disables the button. When disabled, the button's `onClick` event is suspended.
disable() { this.outerElement.classList.add('disabled'); this.onClick.suspend(); }
[ "function disableButton(button) {\n button.style.pointerEvents = \"none\";\n button.style.opacity = \"0.4\";\n}", "disable() {\n this.unpressButton();\n\n this.enabled_ = false;\n this.addClass('vjs-disabled');\n\n this.menuButton_.disable();\n }", "disable() {\n this.unpressButton();\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ShowAgeGroupChart function calls when the user selects an option from dropdown. It will display data in a pie chart.
function showAgeGroupChart(selectedVal) { vm.dataPieChart = []; if(selectedVal){ ChartFactory.getBookingDetails().then(function (response) { angular.forEach(response.data[0][vm.currentY][0], function (key, value) { var color = Math.floo...
[ "function createPieChart(){\n switch (select.value) {\n case \"Population\":\n afficherDiagrammeCirculaire(Population);\n break;\n case \"Volume_Baseline_Recontract\":\n afficherDiagrammeCirculaire(Volume_Baseline_Recontract);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exercise 4: Deep Comparison function takes x and y values
function deepEqual(x, y){ //console.log('x '+x+'y '+y); //if x equals y in value and typeof then return true if(x===y){ return true; //if x and y are both objects then }else if (typeof(x)==="object" && typeof(y)==="object"){ // x = {here: "an", abhi: "neely"} // y = {here: "an", abhi: "neely"} //for l...
[ "function deepCompare() {\n // ...\n}", "function deepCompare () {\n var i, l, leftChain, rightChain;\n\n function compare2Objects (x, y) {\n var p;\n\n // remember that NaN === NaN returns false\n // and isNaN(undefined) returns true\n if (isNaN(x) && isNaN(y) && typeof x === 'number' && typeof ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================================================================== LTrim(string) : Returns a copy of a string without leading spaces. ==================================================================
function LTrim(str) /* PURPOSE: Remove leading blanks from our string. IN: str - the string we want to LTrim */ { var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(0)) != -1) { // We have a string with leading blank(s)... var j=0,...
[ "function LTrim(str)\n/*\n PURPOSE: Remove leading blanks from our string.\n IN: str - the string we want to LTrim\n*/\n{\n var whitespace = new String(\" \\t\\n\\r\");\n\n var s = new String(str);\n\n if (whitespace.indexOf(s.charAt(0)) != -1) {\n // We have a string with leading blank(s)...\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a resize dummy that's used during resizing ( if liveResize is off ).
_handleWindowResizeDummy() { const that = this; if (!that._resizeDummy) { that._resizeDummy = document.createElement('div'); that._resizeDummy.classList.add('jqx-window-resize-feedback'); } if (!that.hasAttribute('resized')) { if (that._resizeDummy.p...
[ "_handleWindowResizeDummy() {\n const that = this;\n\n if (!that._resizeDummy) {\n that._resizeDummy = document.createElement('div');\n that._resizeDummy.classList.add('smart-window-resize-feedback');\n }\n\n if (!that.hasAttribute('resized')) {\n if (tha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUBLIC Sets the connection's weight. The default value for each connection is 1.
function setConnectionWeight(weight) { this.weight = eval(weight); if (document.getElementById(this.id) != null) { document.getElementById(this.id).strokeWeight = eval(weight); } }
[ "setWeight(weight) {\n this.weight = weight;\n }", "set weight0(value) {}", "changeWeight(weight) {\n this._currentWeight = weight\n }", "set weight1(value) {}", "_mutateWeights() {\n\t\tvar genomeEntries = this._genome.getEntries();\n\t\tfor (var i = 0; i < genomeEntries.length; i++) {\n\t\t\tvar g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clear all letter highlighting
function unhighlightAll() { for (var row=0; row<cipher[which].length; row++) { for (var col=0; col<cipher[which][row].length; col++) { u(row+"_"+col); } } }
[ "function clearHighlights() {\n $('.highlightWord').each(function () {\n $(this).removeClass('highlightWord');\n });\n}", "clearHighlight() {\n\t\tthis.setHtml()\n\n\t\tthis.updateRootHtml()\n\t}", "function clearAll() {\n if (activeHighlight && activeHighlight.applied) {\n active...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If an end event happens of the right type, update the pointer, run endHandlers, and save the pointer as 'lastPointer'
function gestureEnd(ev) { if (!pointer || !typesMatch(ev, pointer)) return; updatePointerState(ev, pointer); pointer.endTime = +Date.now(); runHandlers('end', ev); lastPointer = pointer; pointer = null; }
[ "function gestureEnd(ev) { // 1664\n if (!pointer || !typesMatch(ev, pointer)) return; // 1665\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if given tile is moveable for us
function isTileMoveable(x,y) { var tile = civ.map.getTile(x,y); if (!tile) return false; var type = TileTypesList[tile.type]; switch (unit.type.moveType) { case UnitMoveType.Land: return (type != TileTypes.Ocean); case UnitMoveType.Sea: return (type == TileTypes.Ocean); // TODO: check if rive...
[ "function movable(tile) {\n\t\tvar tileTop = parseInt(window.getComputedStyle(tile).top);\n\t\tvar tileLeft = parseInt(window.getComputedStyle(tile).left);\n\t\tvar yDiff = Math.abs(tileTop - BLANK_TOP);\n\t\tvar xDiff = Math.abs(tileLeft - BLANK_LEFT);\n\n\t\t// returns true if clicked tile is movable\n\t\treturn ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ConnectedCallBack Verify Components Width and set the class for each Div
connectedCallback(){ //"slds-text-align_center slds-size_1-of-1 slds-medium-size_6-of-12 slds-large-size_4-of-12" if(!this.flexipageRegionWidth){ this.flexiClass = 'slds-size_6-of-12 '+'SMALL'; } switch(this.flexipageRegionWidth) { case 'LARGE': th...
[ "updatePanelWidth(width) {\n this.width = width\n this.container.style.width = `${width}px`\n this.updateResponsiveClassNames()\n }", "updateInnerWidthDependingOnChilds(){}", "onWidthChanged(/*width*/) {\n }", "innerWidthDependsOnChilds(){if(this.__controlStretchedWidth)return!0;if(this.__columnO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets NIS Node extended information
function getExtendedInfo() { _doGet('/node/extended-info'); }
[ "function getNodeInformation() {\r\n _doGet('/node/info');\r\n }", "async getNodeInfo() {\r\n return this.sendCommand(\"getNodeInfo\", {});\r\n }", "getNodeInfo() {\n return {\n id: this.ls.get(\"node_id\").data,\n address: this.ls.get(\"node_address\").data,\n ppk: this.ls...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function that gives random number between 0 and 50
function getRandomNumber() { return Math.floor(Math.random() * 50); }
[ "getRandomNumber() {\n var max = 300,\n min = 50;\n return Math.round((max - min) * Math.random() + min);\n }", "function randomNumber (){\n return Math.floor(Math.random() * 50 + 1);\n}", "function random50to100() {\n return 50*Math.random() +50;\n}", "function generarRand(){\r\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
QUESTION 2: Given an int n, return the absolute difference between n and 21, except return double the absolute difference if n is over 21.
function diff21(n){ if (n <= 21){ return Math.abs(21 - n) } else if (n > 21){ return Math.abs((21 - n) * 2) } }
[ "function diff21(n){\n if (n <= 21){\n return 21 - n\n } else {\n return (Math.abs(21-n) *2)\n }\n}", "function diff21(n)\n {\n if (n > 21) {\n return 2 * Math.abs(21 - n)\n } else {\n return Math.abs(21 - n)\n }\n }", "function diff21(n){\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends the request, merging the result data with a new instance of factory
sendGet(factory) { const ops = this._objectPaths.clone().appendActionToLast(opQuery(this.getSelects())); return this.send(ops).then(r => extend(new factory(this), r)); }
[ "Request()\n\t{\n\t\tif(this.#Pending.length > 0)\n\t\t{\n\t\t\tlet obj = this.#Pending.pop();\n\t\t\tthis.#Active.push(obj);\n\t\t\tif(typeof obj.OnSummonedFromPool === 'function')\n\t\t\t\tobj.OnSummonedFromPool(this);\n\t\t\treturn obj;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlet outterThis = this;\n\t\t\t\n\t\t\t//alloc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the highlight class to each in a list of elements.
function highlightElements(elms) { for (var i in elms) { var elm = elms[i]; elm.classList.add(kHighlightMeClass); } }
[ "function setHighlight(item_ids, color){\r\n var item;\r\n var count;\r\n var class_names;\r\n for (count = 0; count < item_ids.length; count++){\r\n item = item_ids[count];\r\n if($(item)){\r\n class_names = $(item).className.split(' ');\r\n for(i = 0; i < class_name...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====== Exported Functions ===== / Close =========================================================================================== Description: Closes the Loading Screen.
function close() { let $loadingScreenContainer = $('.loadingScreenContainer'); $loadingScreenContainer.trigger('close'); }
[ "close() {\n\t\tthis._closeDialog();\n\t\tthis.loading = false;\n\t}", "function close() {\r\n progress.setValue(0);\r\n setLoad(false);\r\n setModalVisible(false);\r\n }", "function closeLoaderFile() {\n // reset the loader after closing the panel\n stepper.reset().start();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pure function. Returns true if charCode passed in maps to a lower case alphabetical key, false otherwise.
function isLowerCaseAlphaKey(charCode) { return (charCode >= 97 && charCode <= 122); }
[ "function isLower(letter){\n var charNum = letter.charCodeAt();\n if (charNum >= 97 && charNum <= 122){\n return true;\n }\n else{\n return false;\n }\n}", "function isLowercaseLetter(code) {\n return code >= 0x0061 && code <= 0x007A;\n}", "function isLowerCase(chr) {\n return chr == chr.toLowerC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
authorization checking middleware applicable on deleting polls created by the loggedin user
function checkAuthorization(req, res, next) { // if user is authenticated (logged-in) if (req.isAuthenticated()) { // find the poll to check for authorization as well Poll.findById(req.params.id, (err, foundPoll) => { if (err) { res.redirect('back'); } else { // if current user is the one who added ...
[ "destroy(user) {\n// return this.isAllowed('update', article);\n return this.isAdmin()\n }", "delete(req, res) {\n db.polls.destroy({\n where: {\n id: parseInt(req.params.id)\n }\n })\n .then(poll => {\n res.json({\n msg: \"Successful DELETE to '/po...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if this interval overlaps the other.
overlaps(other) { return (this.low <= other.high && other.low <= this.high) }
[ "isOverlapping(otherRange) {\n let thisFirst = this.getFirst();\n let thisLast = this.getLast();\n let otherFirst = otherRange.getFirst();\n let otherLast = otherRange.getLast();\n return (thisLast.isGreaterThan(otherFirst) && thisLast.isLessThanOrEquals(otherLast) && thisFirst.is...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pause animation and clear canvas
stop() { clearInterval(this.animation); this.canvas.clear(); }
[ "function pauseAnimation() {\n cancelAnimationFrame(FrameID);\n}", "pause() {\n this._animationState = 2 /* paused */;\n this._clearAnimation();\n }", "pauseAnimation() {\n\t\tthis.Grid.pause();\n\t}", "unpauseAnimation() {\n\t\tthis.Grid.unpause();\n\t}", "function stopAnimation() {\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of attributes corresponding to the registered properties.
static get observedAttributes() { this.finalize(); const attributes = []; this.elementProperties.forEach((v, p) => { const attr = this.__attributeNameForProperty(p, v); if (attr !== void 0) { this.__attributeToPropertyMap.set(attr, p); attributes.push(attr); } }); r...
[ "static get observedAttributes() {\n // note: piggy backing on this to ensure we're _finalized.\n this._finalize();\n\n const attributes = [];\n\n for (const [p, v] of this._classProperties) {\n const attr = this._attributeNameForProperty(p, v);\n\n if (attr !== undefined) {\n this._att...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render welcome screen template
function renderWelcomeScreen(){ getTemplateAjax('./templates/welcome.handlebars', function(template) { welcomeData = {welcomeTitle: "Hey. Where do you want to park?", welcomeMessage: "Single-origin coffee portland squid tofu 3 wolf moon fixie thundercats single-origin coffee tofu ...
[ "function renderView() {\r\n var templates = [welcomeTmpl(null)];\r\n appContainerEl.innerHTML = templates.join('\\n');\r\n }", "function showWelcomeScreen(){\r\n $('main').html(welcomeTemplate()); \r\n}", "function renderWelcome () {\n \n var welcomeHTML = `\n <div class=\"curriculum_imag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draws the ship based on angle
drawShip(angle,shipFront) { var addY = (Math.sin(angle)*this.shipWidth); // used for ship rear var addX = (Math.cos(angle)*this.shipWidth); // used for ship rear var xRear = shipFront*Math.sin(angle)*this.shipLength; var yRear = shipFront*Math.cos(angle)*this.shipLength; ctx.beginPath(); ctx.moveT...
[ "function drawShip() {\n\n\tvar ship = JSON.parse(sessionStorage.getItem(\"ship\"));\n\tvar ctx = canvas.getContext(\"2d\");\n\tvar img = new Image();\n\timg.src = \"./oldSpice.png\";\n\n\tvar x;\n\tvar y;\n\n\tif(ship.inOrbit)\n\t{\n\t\tx = ship.xPos + 40 * Math.cos(animateAngle);\n\t\ty = ship.yPos + 60 * Math.si...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines which language definition to use and returns it. With no parameters, it will return the global language. If you pass in a language key, such as 'en', it will return the definition for 'en', so long as 'en' has already been loaded using moment.lang.
function getLangDefinition(key) { if (!key) { return moment.fn._lang; } if (!languages[key] && hasModule) { try { __webpack_require__(43)("./" + key); } catch (e) { // call with no params to set to default return...
[ "function getLangDefinition(key) {\n if (!key) {\n return moment.fn._lang;\n }\n if (!languages[key] && hasModule) {\n try {\n require('./lang/' + key);\n } catch (e) {\n // call with no params to set to default\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function check if a column is defined as sortable
function isColumnSortable(columnSequence, column) { var columnSort = {}; if(column.isSortable == undefined || (column.isSortable && !column.isSortable())) { columnSort["sorter"] = false; } return (columnSort); }
[ "get hasSortableColumns() {\n return this.columnList.some((col) => col.sortable);\n }", "isSortableColumn(index$$1) {\n const { sortable } = this.columns[index$$1];\n const isSortable = typeof sortable === 'boolean' ? sortable : this.sortable;\n return isSortable;\n }", "_isSorting(c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
13. Write a function that accepts a pokemon image url, pokemon name, and an array of abilities and adds to the page: an added to pokemonlist an witht their name and tag with their image url an and of abilities
function addPokemonToPage(pokemonName, pokemonImageUrl, abilities){ }
[ "function addListItem(pokemon) {\n pokemonButtonCreator(pokemon);\n }", "function add(pokemon) {\n pokemonList.push(pokemon);\n }", "function showPokemon() {\n console.log(\"showPokemon()\");\n pokemonArray.forEach((pokemon) => {\n if (pokelist) {\n // define and create elements\n let e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `CfnIndexProps`
function CfnIndexPropsValidator(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, but received: ' + JSON.stringif...
[ "function CfnPlaceIndexPropsValidator(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 received: '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: pickValue DESCRIPTION: ARGUMENTS: RETURNS: boolean
function TagMenu_pickValue(theValue) { var retVal = false; var index = -1; var theList = this.listControl.getValue("all"); for (var i=0; index == -1 && i < theList.length; i++) { if (theList[i].isRadio) { for (var j=0; j < theList[i].length; j++) { if (theList[i][j] == theValue) { ...
[ "function RecordsetFieldMenu_pickValue(theValue)\r\n{\r\n var retVal = this.listControl.pickValue(theValue);\r\n\r\n if (retVal && window.updateUI != null)\r\n {\r\n window.updateUI(this.paramName, \"onPickValue\");\r\n }\r\n \r\n return retVal;\r\n}", "function returnGivenValue(value) {}", "function g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The DateFormat class references to java.text.SimpleDateFormat of J2SE1.4 constructor
function DateFormat(){ this.jsjava_class="jsjava.text.DateFormat"; }
[ "function DateFormat() {\n _classCallCheck(this, DateFormat);\n\n this['display'] = undefined;\n this['export'] = undefined;\n this['extended_display'] = undefined;\n }", "function DateFormat(pattern) {\n\t\tthis.pattern = pattern;\n\t}", "function SimpleDateFormat(){\n this.j...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle the board owners' request denying a request to join their board
function onDenyRequestReceived (connection, data) { var sender = data.client_username;//This is the username of the the guest user sending the request to join an existing board var guestUserCon = users[sender]; sendTo(guestUserCon, { type: "requestDenied", board_owner: connection.name }...
[ "function handleJoinRequestDenied(msg){\n //warn this player and change the page\n alert(msg+\" rejected your request...\");\n window.location.replace(\"/lobby\");\n}", "function handleRequestToJoinABoard(con, data) {\n var boardId = data.board_id;\n var username = getBoardOwner(boardId);\n if(u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a session url.
function getSessionUrl(baseUrl, id) { return coreutils_1.URLExt.join(baseUrl, SESSION_SERVICE_URL, id); }
[ "function getSessionUrl(baseUrl, id) {\n\t return utils.urlPathJoin(baseUrl, SESSION_SERVICE_URL, id);\n\t }", "function getSession(url)\r\n{\r\n var fragmento = url.substring( url.search(\"session=\") );\r\n partes = fragmento.split(\"&\");\r\n return partes[0];\r\n}", "function getSession(r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render the contents of this in the preferred mime type. This is a generic function that can be used to render text, HTML or even React.
render(context, mimeType='text/plain') { if (mimeType === 'text/plain') return this.toString(); }
[ "get rendermime() {\r\n return this.content.rendermime;\r\n }", "function _createRenderMime() {\n var transformers = [\n new renderers.JavascriptRenderer(),\n new renderers.MarkdownRenderer(),\n // new renderers.HTMLRenderer(),\n // NOTE: The HTMLRender...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copies mod files to be saved in the modPack.7z into a temporary directory. Valheim's assumes the presense of a gmanman/gamesetups/valheim/modpackbase/ containing the latest Windows binaries for BepInEx
async prepareModPackTempDir(packTempPath) { const archiveRootPath = `${packTempPath}/Valheim`; await fse.copy( path.join(__dirname, `../../../game-setups/${game}/modpack-base`), archiveRootPath ); await fse.copy( path.join(gameDir, "server/BepInEx/config"), path.join(archiveRootPath, "BepInEx/confi...
[ "async #buildModPack() {\n\t\tconst modPackFilePath = generateBackupFilename(`${gameId}-mods`, gameDir);\n\t\tconst modPackFilename = path.basename(modPackFilePath);\n\t\tconst packTempPath = `/tmp/modpacks/${modPackFilename}`;\n\n\t\tconst archiveRootPath = await this.prepareModPackTempDir(packTempPath);\n\t\tawai...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reset function, changes img to backs, and wipes the cards in play
function resetFunc() { var cardArray = document.getElementsByTagName('img'); for (i = 0; i < cardArray.length; i++) { cardArray[i].setAttribute('src', 'images/back.png'); } cardsInPlay = []; }
[ "function resetEverything(){\n resetImages();\n resetPlay();\n resetPause();\n }", "function resetCards() {\n cards = [];\n numCards = 0;\n }", "resetCards()\n {\n randomiseArray(this.cards);\n this.loadCard(this.cards[0]);\n this.curr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update the PATH variable in the given terminal to default to the currently selected Go
function updateIntegratedTerminal(terminal) { return __awaiter(this, void 0, void 0, function* () { if (!terminal) { return; } const gorootBin = path.join(pathUtils_1.getCurrentGoRoot(), 'bin'); const defaultGoRuntime = pathUtils_1.getBinPathFromEnvVar('go', defaultPathEn...
[ "function addGoRuntimeBaseToPATH(newGoRuntimeBase) {\n if (!newGoRuntimeBase) {\n return;\n }\n const pathEnvVar = pathEnvVarName();\n if (!pathEnvVar) {\n goLogging_1.logVerbose(`couldn't find PATH property in process.env`);\n return;\n }\n if (!defaultPathEnv) { // cache the...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the tables movies and awesome in the database
function createTables(db) { db.run('CREATE TABLE IF NOT EXISTS movies(link varchar(30), id varchar(30), metascore integer, rating float, synopsis varchar(30), title varchar(30), votes float, year integer)'); db.run('CREATE TABLE IF NOT EXISTS awesome(link varchar(30), id varchar(30), metascore integer, rating f...
[ "function createTables() {\n createUsersTable();\n createMembersTable();\n createCommunitiesTable();\n}", "function createDBTables() {\n\t\tvar db = Titanium.Database.open('Horsecount');\n\t\ttry {\n\t\t\tdb.execute('BEGIN');\n\t\t\tif (_title === 'Feed & Care') {\n\t\t\t\tdb.execute('CREATE TABLE IF NOT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the product object from the basket
function productInBasket(id) { basketProduct = null; if (localStorage.BASKET) { var basket = JSON.parse(localStorage.BASKET); // checks if product id matches any product in basket for (var i = 0; i < basket.length; i++) { var product = JSON.parse(basket[i]); if (p...
[ "static async retrieve(basketId) {\n const basket = await Collection.retrieveOne(basketId);\n\t\tif(!basket) throw new Error(`No basket with that id: ${basketId}`) // TODO: Correct error handling?\n const { id, products } = basket;\n return new Basket(id, products).serialize();\n }", "getBasket() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hide or shows the mail editor
function showHideEditor() { if (document.getElementById("isSendMail").checked) { document.getElementById("editorDiv").style.display='block'; } else { document.getElementById("editorDiv").style.display='none'; } }
[ "function displayGmailContent() {\n show('gmail-content');\n hide('gmail-settings');\n}", "function showEditor() {\n document.querySelector('.meme-editor').style = ('display: flex;');\n document.querySelector('.main-page').style = ('display:none;');\n}", "function displayGmailSettings() {\n show('gmail...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
onclick of the confirm order button, it will check if an eta for that order has been entered
function confirmOrder(qNum, rowIdx){ var eta=new Date(etaArray[qNum]) if(eta =="Invalid Date"){ alert ("Please enter valid date") } else{ alert("Order: "+qNum+" has been confirmed with an ETA of: "+eta) //enter code for uploading the ETA and confirmation of order to the database ...
[ "function confirmOrder() {\n \n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"orderPlace\",\n message: \"Please confirm the order above.\",\n default: false\n }\n \n ]).then(function(order) {\n if (order.orderPlace == false)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create select pickers for locations, industries and currencies
function selectPickers() { selectPicker.locations('.location-0', "", "", 0, 'location_text'); selectPicker.industries('.industry-0', "", "", 0, 'industry_text'); selectPicker.currencies('.currency-0', "", "", 0, 'currency_text'); }
[ "function populateCurrencySelector(currencySelector, currencies) {\n Object.keys(currencies).map(function(currencyCode) {\n let option = document.createElement('option');\n option.setAttribute('value', currencyCode);\n option.innerText = currencyCode + ' - ' + currencies[curr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reset list scroll top and highlight
reset () { this.$refs.list.scrollTop = 0 this.$emit('input', -1) }
[ "function ScrollTopList(){\n document.getElementById('js-body').scrollTop = 0;\n }", "function update_scroll_position()\n\t{\n\t\tif ( List.selection < List.scroll ) {\n\t\t\tList.scroll = List.selection;\n\t\t}\n\n\t\tif ( List.selection >= ( List.scroll + List.height ) ) {\n\t\t\tList.scroll = 1 + Lis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get profile by given id, retrieves or sets cache as needed
async getById(profileId) { log('info', 'calling getById in profiles model'); if (!profileId || typeof profileId != 'number') { log('error', 'Invalid Profile Id'); throw new Error('Invalid Profile Id'); } let profiles = this.cache; let foundProfile; if (this.isCacheInvalid()) { ...
[ "static fetchProfile(id) {\n // Fetch profile by id from network\n // todo\n }", "function fetch(id) {\n let result;\n if (id) {\n result = storage.find(profile => profile.id === id);\n }\n\n return result;\n}", "get(id) {\n if (renege(this, this.get, ...arguments)) return;\n\n if (!checkId(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle Crashlytics Velocity Alert events.
onVelocityAlert(handler) { return this.onEvent(handler, 'issue.velocityAlert'); }
[ "function OnExternalVelocity(){\n }", "onAlertRequest (alert) {\n this.trigger(alert)\n }", "function realtimeMonitoring() {\n checkScriptVersion()\n var alerts = getAlerts();\n alerts.forEach(function (alert) {\n try {\n checkAlert(alert);\n } catch(e) {\n MailApp.sendEmail(USER_EMAIL, \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================================================================================================ AJAX CALLS ================================================================================================ get all the photos for a different user not the one currenly logged on
function getDifferentUsersPhotos() { // ALL AJAX Calls automaticallt get secure token placed in header $.ajax({ type: "GET", url: "/api/photo", datatype: "application/json", success: (photos) => { console.log(photos); }, error: (err) => { c...
[ "function getPhotos(){\n\t$(\"#photos-div\").empty();\n\tvar url = serviceCA + methodGetPhotos + \"?\" + parameterServiceId + \"=7&\" + parameterDataGroups + \"=\" + defaultDataGroups + \"&\" + parameterUserId + \"=\" + getUserId(); // limit to url storage and to the currently logged in user\n\tconsole.log(\"Callin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle Player 2 between Human and AI
function p2Toggle(){ if(player2IsHuman == true){ player2IsHuman = false; document.getElementById("player2Tag").innerHTML = "Player 2: AI"; document.getElementById("AI2Btn").style.display = "inline"; document.getElementById("player2Level").style.display = "block"; } else{ player2IsHuman = true; document.g...
[ "function p1Toggle(){\n\tif(player1IsHuman == true){\n\t\tplayer1IsHuman = false;\n\t\tdocument.getElementById(\"player1Tag\").innerHTML = \"Player 1: AI\";\n\t\tdocument.getElementById(\"AI1Btn\").style.display = \"inline\";\n\t\tdocument.getElementById(\"player1Level\").style.display = \"block\";\n\t}\n\telse{\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if the user is in call, false otherwise
function isincall () // boolean { if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null) return webphone_api.plhandler.IsInCall(); else return false; }
[ "canDial(call) {\n\t\treturn (call && (this.isTerminalState(call) ||\n\t\t\tcall.callStatus === \"\")) ? true : false\n\t}", "function active_chat_with(user){\n return user_is_in_list(user) && user==currentRecipient;\n}", "function userHasAccess() {\n if ($scope.user.emailNotVerified()) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transforms options (a simple keyvalue object) into an acceptable value for a body. This can be either a string, used when posting with a contenttype of urlencoded. Or, it can be a readable stream, used when the options contain a binary (a stream or a buffer) and the upload should be done with contenttype multipart/form...
serializeApiCallOptions(options, headers) { // The following operation both flattens complex objects into a JSON-encoded strings and searches the values for // binary content let containsBinaryData = false; const flattened = Object.entries(options) .map(([key, value]) => { ...
[ "serializeApiCallOptions(options) {\n // The following operation both flattens complex objects into a JSON-encoded strings and searches the values for\n // binary content\n let containsBinaryData = false;\n const flattened = objectEntries(options)\n .map(([key, value]) => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
torna o elemento visivel
function visivel(elemento) { if (elemento != null) { elemento.style.display = ""; } else { alert("Elemento " + elemento + " não encontrado.") } }
[ "elem(a) {\n const ret = this.model.elementById(a.of) || this.model[a.of] || undefined;\n // Get the corresponding property from a to show on the graph\n return ret ? ret[a.show] : undefined;\n }", "function novisibleLista() {\n \n visibilidad('capaListado','O');\n}", "static...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the saved trigger ID.
function removeTriggerId() { var properties = PropertiesService.getUserProperties(); properties.deleteProperty(SCHEDULE_TRIGGER_ID); }
[ "remove() {\n HashTrigger.removeListener(this.event, this.id);\n }", "function remove_trigger()\n {\n var trigger = get_trigger();\n\n trigger.remove();\n }", "function deleteTrigger() {\r\n var triggers = ScriptApp.getProjectTriggers();\r\n for (var i = 0; i ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return random integer between 0 and N1, with potential bias (1: prefers higher indices)
function random_index( N, bias ) { if (bias == undefined) bias = 1 return Math.min(N-1, Math.floor(Math.pow(Math.random(), 1/bias) * N)) }
[ "sample(n){\n if(n === 0) {\n return 0;\n }\n\n let nums = random(0,1,n=n).map(x => x - 0.5);\n let value = this.b/Math.sqrt(2);\n let second = nums.map(x => value * sign(x) * Math.log(1 - 2 * Math.abs(x)));\n return second.map(x => this.mu - x); \n }", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove Trigger_loaded triggers for this project. return true
function removeTriggers() { var myTriggers = ScriptApp.getProjectTriggers(); for ( var i = 0; i < myTriggers.length; i++ ) { if ( myTriggers[ i ].getHandlerFunction() == 'Trigger_loaded' ) { ScriptApp.deleteTrigger( myTriggers[ i ] ); } } return true }
[ "function clearTrigger() {\n\tvar triggers = ScriptApp.getProjectTriggers();\n\tfor(var i = 0; i < triggers.length; i++) {\n\t\tif(triggerFunctionList.indexOf(triggers[i].getHandlerFunction()) != -1){\n\t\t\tScriptApp.deleteTrigger(triggers[i]);\n\t\t}\n\t}\n\treturn;\n}", "function clearTrigger() {\n var trigge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Value Hook The getValue hook retreives the value of the passed in referance. It will return the propper value regardless of if the referance passed is the value itself, or a LazyValue.
function getValue(referance) { return referance && referance.isLazyValue ? referance.value : referance; }
[ "_get_value() {\n return this._has_value() ? this._value : undefined;\n }", "getValue() {\n if (this.props.valueLink) {\n return this.props.valueLink.value;\n }\n\n return this.props.value;\n }", "function getValue() {\r\n return applyEachValue(variable, (v) => v.Value);\r\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deselects all of the options.
deselectAll() { this._setAllOptionsSelected(false); }
[ "deselectAll() {\n return this._setAllOptionsSelected(false);\n }", "function DeselectAllOptions(campo_select) {\n if (!campo_select) {\n return;\n }\n var j = campo_select.options.length;\n for (var i = 0; i < j; i++) {\n campo_select.options[i].selected = false;\n }\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ensure the encoded size of the writeBuffer is below the maxPayload value sent by the server (only for HTTP longpolling)
getWritablePackets() { const shouldCheckPayloadSize = this.maxPayload && this.transport.name === "polling" && this.writeBuffer.length > 1; if (!shouldCheckPayloadSize) { return this.writeBuffer; } let payloadSize = 1; // first packet type for (...
[ "getWritablePackets() {\n const shouldCheckPayloadSize = this.maxPayload && this.transport.name === \"polling\" && this.writeBuffer.length > 1;\n if (!shouldCheckPayloadSize) {\n return this.writeBuffer;\n }\n let payloadSize = 1; // first packet type\n for (let i = 0; i < this.writeBuffer.lengt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Let's rotate the eyes in the same direction based on x, y, z parameters...
function AnimateEyes(x, y, z) { var newRotationMatrix; //Set the newRotationMatrix variable: newRotationMatrix = mat4.create(); mat4.identity(newRotationMatrix); mat4.rotate(newRotationMatrix, degToRad(100/10), [x, y, z]); mat4.multiply(newRotationMatrix, rightEyeRotationMatrix, rightEyeRotationMatrix); ...
[ "rotateTurtle(x, y, z) {\n var e = new THREE.Euler(x * 3.14/180, y * 3.14/180, z * 3.14/180);\n this.state.splits += 1;\n this.state.dir.applyEuler(e);\n }", "rotateTurtle(x, y, z) {\n var e = new THREE.Euler(\n x * 3.14/180,\n\t\t\t\ty * 3.14/180,\n\t\t\t\tz * 3.14/180);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete Function calls Todos Factory to DELETE item from Database and splices object from model array
function deleteTodo(data) { var index = vm.todos.indexOf(data); TodosFactory.deleteTodo(data.todoId).then(function(response) { vm.todoDel = response.data; toastr.success('Todo Successfully Deleted!'); }, function(error) {...
[ "deleteTodo(todo) {\r\n this.todos.splice(todo, 1);\r\n // console.log(todo);\r\n }", "function deleteTodo(data) {\n var index = vm.data.indexOf(data);\n mainFactory.deleteTodo(vm.data, index);\n }", "deleteTodo(todoID) {\n // delete a tod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the type of the record.
getType(): string { return RelayModernRecord.getType(this._record); }
[ "get recordType() {\n return this._recordType;\n }", "function RecordType(){\n\tthis.astObject = RecordExpression;\n\t\n\tthis.toString = function(){\n\t\treturn 'record'\n\t}\n}", "_getRecordTypeIdFromRecord(record){// TODO W-6281152 - if the recordTypeInfo is undefined, the record has been l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simple token object that holds key and secret
function OAuthToken( key, secret ){ if( ! key || ! secret ){ throw new Error('OAuthToken params must not be empty'); } this.key = key; this.secret = secret; }
[ "generateToken() {\n const token = generateToken();\n this.secret = token.secret;\n this.token = token.token;\n\n return token.token;\n }", "constructor () {\n this._tokenHelper = new TokenHelper()\n this._tokenSecret = process.env.TOKEN_SECRET\n }", "getToken() {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a cluster layer to the map.
function addClusterLayer({ title = 'cluster', url, styleFunction = clusterStyle, visible = true, attribution = '', }) { const style = (feature, resolution) => styleFunction(feature, resolution, Style); const format = new GeoJSON(); const attributions = [attribution]; const centroidSource = new VectorSource({ ...
[ "function addLayer(layer) {\n map.add(layer);\n }", "function createClusterLayer() {\n // Add default cluster layer containing all stations\n clusterLayer = L.markerClusterGroup({\n maxClusterRadius: 150,\n disableClusteringAtZoom: 15,\n spiderfyOnMaxZoom: false\n });...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
numberFact Write a function called numberFact which takes in a number and a callback and returns the result of the callback with the number passed to it
function numberFact(num, cb) { return cb(num); }
[ "function numberFact(num, callback) {\n\t\treturn callback(num);\n\t}", "function numberFact(val, callback) {\n\treturn callback(val);\n}", "function numberFact(number, func){\n\treturn func(number);\n}", "function numberFact(number,fn){\n return fn(number);\n}", "function numberFact(num, fn){\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the "Back to homepage" button on 404.html with a randomly chosen gaming term from a predefined list
function updateHomepageButton() { const homepageBtn = document.querySelector(".homepage-button"); const phrases = ["Rocket Jump", "Bunny Hop", "Auto Run", "Fast Travel", "Teleport", "Strafe Jump", "Barrel Roll", "Shootdodge", "Noclip"]; const choice = phrases[Math.floor(Math.random() * phrases.length)]; homepag...
[ "function openOne() {\n if(rBrewArray.length > 0) {\n var choose = Math.floor(Math.random() * rBrewArray.length);\n rBrewArray = rBrewArray[choose];\n window.location.replace(rBrewArray.page);\n }else {alert('Sorry, no brew match your description');\n return;\n }\n}", "function place_word(word) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We attempt to autobuild Go to preserve compatibility for users who have set up Go using a legacy scanning style CodeQL workflow, i.e. one without an autobuild step or manual build steps. We detect whether an autobuild step is present by checking the `CODEQL_ACTION_DID_AUTOBUILD_GOLANG` environment variable, which is se...
async function runAutobuildIfLegacyGoWorkflow(config, logger) { if (!config.languages.includes(languages_1.Language.go)) { return; } if (process.env[environment_1.EnvVar.DID_AUTOBUILD_GOLANG] === "true") { logger.debug("Won't run Go autobuild since it has already been run."); return;...
[ "triggerBuildCheck() {\n let builder = this.serviceManager.builder;\n if (builder.isAvailable && !this.promptBuild) {\n const completed = builder.getStatus().then(response => {\n if (response.status === 'building') {\n // Piggy-back onto existing build\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a listener to the end of the listeners array for the specified event
addListener(event, listener) { this.ee.addListener(event, listener); }
[ "addListener(event, callback) {\n this.callbacks[event].push(callback);\n }", "function addOnEvent(eventListener) {\n eventQueue.push(eventListener);\n }", "addEventListener(event, listener) {\n\t\tthis.events.on(event, listener);\n\t}", "function registerListener(event, fn){\r\n if(!listeners[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Object Definition Zone // ////////////////////////// Defines the Hexagon
function hexagon(c) { this.axial = new axialCoords(c[0], c[1]); this.cube = new cubeCoords(c[0], c[1]); //this.grid = new gridCoords(c[0], c[1]); // does not work as i would of hoped, fix later, unnecisary atm. //this.biome = document.getElementById(c); //consider moving biome to object tied to hexagon; //thi...
[ "function hexagon() {\n push();\n polygon(0, 0, 50, 6);\n pop();\n }", "createHexagonMap() {\n var points = hexagonMap.points;\n points = points.map(point => this.hexSize*point)\n points = Perspective.isometric2d(points);\n\n for(var i = 0; i < points.length; i+= 2) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear all nodes from body of document.
function emptyBody() { var node = document.body; while (node.hasChildNodes()) { node.removeChild(node.lastChild); } }
[ "function clearBody(){\n var el_body = document.getElementById(\"body\");\n for(var i = 0; i < el_body.childNodes.length; i++){\n el_body.removeChild(el_body.childNodes[i]);\n }\n}", "flushBody() {\n while (document.body.firstChild) {\n document.body.removeChild(document.body.firstChild);\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createImages Adds the image to the game board
createImages() { this.room2_e_pressed = false; this.room2_papers_moved = false; this.returnDoor = this.add.image(113, 385, 'returnDoor'); this.room2_background = this.add.image(768, 432, 'room2_one_lesson_BG'); this.room2_character_north = this.add.image(768, 432, 'room2_characte...
[ "function createImages(){\n new Img('Bag','./assets/bag.jpg');\n new Img('Banana','./assets/banana.jpg');\n new Img('Bathroom','./assets/bathroom.jpg');\n new Img('Boots','./assets/boots.jpg');\n new Img('Breakfast','./assets/breakfast.jpg');\n new Img('Bubblegum','./assets/bubblegum.jpg');\n new Img('Chair'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new aircraft in the database
function newAircraft(name, tankSize, emptyWeight, takeoffWeight) { var aircraft = {}; aircraft['name'] = name; aircraft['tankSize'] = tankSize; aircraft['emptyWeight'] = emptyWeight; aircraft['takeoffWeight'] = takeoffWeight; dbRef.push(aircraft); } // newAircraft
[ "function createFlight(flight) {\n console.log('Mongoose: createFlight() called');\n return flightModel.create(flight);\n}", "async createFlight(req, res) {\n const { Year, Month, DayofMonth, DayOfWeek, DepTime,\n CRSDepTime, ArrTime, CRSArrTime, UniqueCarrier, FlightNum,\n TailNum, ActualElaps...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the commonly used items
getCommonItems() { return new TotoAPI().fetch('/supermarket/commonItems').then((response) => response.json()); }
[ "getAvailableItems() {\n // Call the function to load all available items\n var data = autocomplete.cloudLoadAvailableItems();\n return data;\n }", "function getItems(){\n return items\n }", "function getResources () {\n\tvar flags = wialon.item.Item.dataFlag.base | // 0x1 - base informatio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Arrange node lists so that the output is easy to read.
function arrangeNodes(nodeList, varList) { var arranged= []; for (var i= 0; i < nodeList.length; i++) { if (!varList.includes(nodeList[i])) { arranged.push(nodeList[i]); } } return varList.concat(arranged.reverse()); }
[ "function sortNodes(){\n\tfor(var index in nodes){\n\t\tid = nodes[index].properties.id;\n\t\tsortedNodes[id] = nodes[index];\n\t}\n}", "function sortNodes(entries) {\n var orderCSV;\n for (var i = entries.length-1; i>=0; i--)\n if (!metricsDef.isNumeric(entries[i]._id)) //remove non-numeric id nodes\n {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the object from the repository for the given name value
function search(name) { for (var i = 0; i < repository.length; i++) { if (repository[i].name === name) { return repository[i]; } } return null; // if no match found }
[ "static getByName(name) {\n return Instance.findByPk(name);\n }", "getObjectByName (name) {\n return this.scene.getObjectByName(name)\n }", "function getObjByName(json) {\n console.log(\"attempting to get via name=\" + json.name)\n let obj = data.find(o => o.name === json.name)\n console....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }