query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
PURPOSE: Adds a directory to the breadcrumb. PARAMS: dir = the directory to add
function addCrumb(dir) { var crumb = '<span><a class="breadcrumbs-item change" href="" data-path="' + dir + '">' + getDirName(dir) + '</a> / </span>'; crumbarray.push(crumb); $('.breadcrumb').append(crumbarray[crumbarray.length - 1]); }
[ "addToTree({ state, commit, getters }, { parentPath, newDirectory }) {\n // If this directory is not the root directory\n if (parentPath) {\n // find parent directory index\n const parentDirectoryIndex = getters.findDirectoryIndex(parentPath);\n\n if (parentDirectoryIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds and removes animations for projects screen
function projectScreenAnimations() { // add animations nextButton2.classList.add('animate__animated', 'animate__fadeInRight', 'animate__delay-1s'); // removes after 1s setTimeout(function() { nextButton2.classList.remove('animate__fadeInRight', 'animate__delay-1s'); }, 2000); }
[ "function aboutScreenAnimations() {\n for (var icon=0; icon < icons.length; icon++) {\n icons[icon].classList.add('animate__fadeInLeft');\n }\n\n for (var item=0; item < navItems.length; item++) {\n navItems[item].classList.add('animate__fadeInDown');\n }\n\n setTimeout(function() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function, called from stopbutton; removes SensorEventListeners from DOM, can optionally save a String created in the ListenerHandlerFunctions above to a .csv file by posting it to the express()server
function stop() { /** * optional, e.g. for analysis: * post the String created along the lines ("measure", not in this file) to the server, and save as .csv file */ /**if (measure != "#Measurement, Acceleration X, Acceleration Y, Acceleration Z, Rotation Alpha, Rotation Beta, Rotation Gamma, Orientation Alpha, ...
[ "_removeServiceStreamDataListener ( ) {\n\n this.serviceStream.removeListener(\n 'data'\n , this.boundStreamListener\n );\n }", "function removeEventListeners(){\n\t\t/*console.log(\"starting arrays for clear\");\n\tconsole.log(\"remove listeners ok\");\n\tconsole.log(eventL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HjPd6MV8aX ZLLoFv2DlAt UJ290CqETc6p zUPhZTqUZQNK WTsSr7vXde Cj7AhJ8vpW ZFa1P5T3br g8rA5M0wYGph qQXx4yCTnb oTvtNnrootSt zcQp3lvgUAf dXFt1WgJrTHV b1OcLR7VbxlX jUxdDd3BN1bI 1a2C1E0hxS wIF6FdBKaTf3 mNV6rASYIlP m8rwRr5kPw b0G4xZRQ05 bgo9kllaO9 EE7hIIB5Sb wQNSMBDkhpw riSFprJHr4dn LADj4Ch7Gz EyuNREHM2bA AGSURmuwE2Q 9BVEMnPXQE...
function XujWkuOtln(){return 23;/* HjPd6MV8aX ZLLoFv2DlAt UJ290CqETc6p zUPhZTqUZQNK WTsSr7vXde Cj7AhJ8vpW ZFa1P5T3br g8rA5M0wYGph qQXx4yCTnb oTvtNnrootSt zcQp3lvgUAf dXFt1WgJrTHV b1OcLR7VbxlX jUxdDd3BN1bI 1a2C1E0hxS wIF6FdBKaTf3 mNV6rASYIlP m8rwRr5kPw b0G4xZRQ05 bgo9kllaO9 EE7hIIB5Sb wQNSMBDkhpw riSFprJHr4dn LADj4Ch7Gz...
[ "function XujWkuOtln(){return 23;/* B3UWQ1mbO0eo K6YGIfgn0p 862fhnhxy6o UVVW8zAe2kE TGe6vR9ghL OQRwbmlw7uYc 5HVl97ZQXw c8NuCZR63Gh AZszPfgLZNw fNdxAUTyPL Yr9FRSkFhONm sDp5DXwp9EtJ tfzkSaEswAZ kVkEIUq9SX Q0dqwaYXI0 jlkNyyEo7q Af7L4vZnwNM x9x9nlqRb9Af gWS2TZlW3Y mjxhTtvKm1DY yvJ6k9B73QK Fqi4StHPiL J7ghPZP2WbYw 4zIwZv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the body of the pendulum
set pendulumBody(body) { this._pendulumBody = body; }
[ "function setupPhysics(world){\n var fixDef = new b2FixtureDef;\n fixDef.density = DENSITY;\n fixDef.friction = this.isGround ? GROUND_FRICTION : FRICTION;\n fixDef.restitution = RESTITUTION;\n\n var bodyDef = new b2BodyDef;\n bodyDef.type = b2Body.b2_staticBody;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate main interface for withhold messages
function withholdMessagesGenerateUI(modal) { withholdMessages_cookieCheck(); var thisID = 'WithholdMessages_'+randomString(8); var withholdMessagesUIBegin = '<div id="'+thisID+'" style="display: none;" class="WithholdMessages"><div id="WithholdMessagesMinimizedWrapper">Show Withhold Messages Injector</div><div id=...
[ "function main() {\n\tlog.verbose( 'main', 'Begin' );\n\tui.init({main: Notification});\n}", "function massage() {\n console.log(\"****************************************************************\")\n console.log(\"Sorry honey, that service isn't digital\")\n console.log(\"But I'd recommend going to a really n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. Support boolean input list: `true | True | TRUE | false | False | FALSE` . The return value is also in boolean type. ref:
function getBooleanInput(name, options) { const trueValue = ['true', 'True', 'TRUE']; const falseValue = ['false', 'False', 'FALSE']; const val = getInput(name, options); if (trueValue.includes(val)) return true; if (falseValue.includes(val)) return false; throw new TypeError(`In...
[ "castToBoolean(value) {\n if (typeof value === 'boolean') {\n return value;\n }\n if (value === 'true' || value === '=true') {\n return true;\n }\n return undefined;\n }", "BooleanLiteral(type) {\n const token = this._eat(type);\n return {\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subscribes to bulkpinning events to ensure the store is kept up to date. Also tries to retrieve a first bulk pinning progress to populate the store. Does nothing if bulkpinning is disabled.
async initBulkPinning_() { if (!util.isDriveFsBulkPinningEnabled()) { return; } try { const promise = getBulkPinProgress(); chrome.fileManagerPrivate.onBulkPinProgress.addListener((progress) => { console.debug('Got bulk-pinning event:', progress); this.store_.dispatch(upd...
[ "function processTasksInPollingMode() {\n\t\t\tif (__connectionState !== state.authenticated || __outboundMessages.length !== 0 || __paused) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t__pendingTasks = [];\n\n\t\t\tvar quoteBatches = getSymbolBatches(getProducerSymbols([__listeners.marketUpdate, __listeners.cumulativeVolu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
steps 1.split text into array 2.Create an alphabet array 3.Loop thru getting the letter at each position in an array and convert it to lowercase 4.if the letter has an index in the alphabet array greater than 1 then push it into new array 5.Join the array to convert it back to a string
function alphabetPosition(text) { test.split(); var char = ""; var alphabet = "abcdefghijklmnopqrstuvwxyz".split(''); for (var i = 0;i < text.length;i++) { char = text.charAt(i).toLowerCase(); if(alphabet.indexOf(char) > -1) { arr.push(alphabet.indexOf(char) + 1); var arr2 = arr.join(""); } } return...
[ "function swap(text) {\n let words = [];\n text.split(\" \").forEach(word => words.push(switchLetters(word)));\n console.log(words.join(\" \"));\n}", "function alphaCount (alphabet, text) {\n alphabet = alphabet.toLowerCase();\n text = text.toLowerCase();\n var result = alphabet.split(\"\").map(elem => [ele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true from onshow/hide to take responsibility for showing/hiding the alert element Return false from onclose or onsave to stop the dismissal Returns boolean result
function dismiss(isSaving) { var good, result; if (shown) { if (isSaving) { if (onsave && callback(onsave, el) === false) { return false; } isDirty = false; } if (onclose && callback(onclose, el) === false) { return false; } if (!onhide) { hideAlert(); go...
[ "function showMessageOk() {\n var alert = $mdDialog.alert()\n .title('Alerta guardada')\n .htmlContent('La alerta ha sido guardada de forma correcta.')\n .ariaLabel('save alert')\n .ok('OK');\n\n $mdDialog.show(alert);\n $state.reload();\n }", "canDismiss() {\n return true...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Query to get current humans. Add promises for both queries.
function showHumans(selectHumans){ return new Promise(function(resolve, reject){ db.pool.query(selectHumans, function(err, rows){ if(err){ next(err); return; } // populate page_data with Humans, where e...
[ "queryRemoteContent() {\n var query = this.get('query'),\n lastSearch = this.get('lastSearch') || {};\n query = query.trim();\n if (query === lastSearch.query) {\n return lastSearch.promise;\n }\n lastSearch.query = query;\n lastSearch.promise = Diagno...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the URL for the given frame image. theFrame the frame to get the source file name for
function AO_timrGetFrameSrc(theFrame) { var iTest, numberStr; with (this) { numberStr = (_reverseFrames) ? (_numberOfFrames - theFrame) : (theFrame + 1); // add pad zeros for (iTest=10; (this._numberOfFrames >= iTest); iTest*=10) if (numberStr < iTest) numberStr = "0" + numberStr; } return thi...
[ "get imageURL() {\n this._logger.debug(\"imageURL[get]\");\n return this._imageURL;\n }", "getSrc(){\n\t\tif( this.props.activeTrack ) {\n\t\t\treturn this.props.activeTrack.url;\n\t\t}\n\t}", "function getSource() {\n const queryString = window.location.search;\n const urlParams = new URLSearchPar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
translateStaticElements(container, language) finds every child element of container with data tag 'datastrname' and replaces its innerHTML content with according language strname string.
function translateStaticElements(container, language) { let keyEls = Array.from(container.querySelectorAll('[data-strname]')); for (let el of keyEls) { let key = el.dataset['strname']; el.innerHTML = language.getString(key, language.getActiveLang()); } }
[ "addTranslatedMessagesToDom_() {\n const elements = document.querySelectorAll('.i18n');\n for (const element of elements) {\n const messageId = element.getAttribute('msgid');\n if (!messageId)\n throw new Error('Element has no msgid attribute: ' + element);\n const translatedMessage =\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6. Write a program that draws a horizontal chart representing three given values. For example, if values are 5, 3, and 7, the program should draw: bolji nacin:
function horizontalChart() { var result = ''; var numOfArgs = arguments.length; for (var i = 0; i < numOfArgs; i++) { for (var j = 0; j < arguments[i]; j++) { result += '*' } result += '\n'; } return result; }
[ "function horizontalChart() {\r\n var row = '';\r\n for (var i = 0; i < arguments.length; i++) {\r\n for (var j = 0; j < arguments[i]; j++) {\r\n row += '*';\r\n }\r\n row += '\\n'\r\n }\r\n return row;\r\n}", "function Draw3PL(c,x,y,w,h,myArray){\n\tvar canvas = docume...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
what to do when the slide changes
function slideChanged(evt) { if (!printMode) { // hide pen dialog hideColorPicker(); // determine current fragment index currentFragmentIndex = Reveal.getIndices().f; // hide all SVG's slides.querySelectorAll("svg.whiteboard").forEach((svg) => { svg.style.display = "non...
[ "moveToSlide( slide) {\n console.debug( \"dia-show › moveToSlide()\", slide);\n this.slide = slide != undefined ? slide : null;\n }", "function intervalCallback() {\n if (currentSlide === 4) {\n changeSlides(currentSlide, 0);\n } else {\n changeSlides(currentSlide, currentSlide + 1);\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns JWT promise based on cognito user pool
async function cognitoLogin({userPoolId, clientId, username, password, region, identityPoolId} ) { const poolData = { UserPoolId: userPoolId, ClientId: clientId }; const userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData); return new Promise((resolve, reject) => { const authenticationDe...
[ "function fromCognitoIdentityPool(_a) {\n var _this = this;\n var accountId = _a.accountId, _b = _a.cache, cache = _b === void 0 ? Object(_localStorage__WEBPACK_IMPORTED_MODULE_4__[\"localStorage\"])() : _b, client = _a.client, customRoleArn = _a.customRoleArn, identityPoolId = _a.identityPoolId, logins = _a....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FixedUpdate is a builtin unity function that is called every fixed framerate frame. We use FixedUpdate instead of Update here because the docs recommend doing so when dealing with rigidbodies. For more info, see: We limit the velocity here to account for gravity and to allow the drag to be relaxed over time, even if no...
function FixedUpdate(){ var v = rb.velocity; // We use sqrMagnitude instead of magnitude for performance reasons. var vSqr = v.sqrMagnitude; //Initializing new velocity values if the speed limit changes. Initialize(dragStartVelocity, dragMaxVelocity, maxVelocity, maxDrag); if(vSqr > sqrDragStartVelocity){ i...
[ "applyFriction(){\n\t\tthis.vel.x *= ((0.8 - 1) * dt) + 1;\n\t}", "updateGroundSpeedPhysics() {\n // TODO: Much of this should be abstracted to helper functions\n\n // Calculate true air speed vector\n const indicatedAirspeed = this.speed;\n const trueAirspeedIncreaseFactor = this.alti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw waveform to canvas
function drawWave() { requestAnimationFrame(drawWave); analyser.getByteTimeDomainData(dataArray); canvasCtx.fillStyle = "rgb(0,0,0)"; canvasCtx.fillRect(0, 0, canvas.width, canvas.height); canvasCtx.lineWidth = 2; canvasCtx.strokeStyle = "rgb(255,255,255)"; canvasCtx.beginPath(); const s...
[ "draw() {\n for (const waveform of this.waveforms) {\n this.drawInCanvas(waveform.canvas, waveform.samples);\n }\n }", "function createChannelWaveform(canvas, channelData) {\n var drawLines = 1000;\n\n let canvasWidth = canvas.width, canvasHeight = canvas.height;\n let context...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
next flareon function begins here spawns the next sprite once one sprite has reached an end point + decreases number of lives when player is in enemy collision and water danger zone
function nextFlareon() { //* need to fix this function so that it doesn't decrease life when reaching end points and respawning!!!!!!! flareonPosition = startingPosition //* takes player back to starting position if (!playerWinFlag) { playerLives-- //* so player lives will decrease when you "di...
[ "nextLevel() {\n // show all the stars again\n this.stars.children.iterate(\n /**\n * Make each star visible again\n * @param {Phaser.Physics.Arcade.Image} star \n */\n function (star) {\n star.enableBody(true, star.x, 0, true, true);\n }\n );\n\n // add a new bom...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function creates 10 differernt patreon factories the consolelog is explored to see that state is properly getting filled. omly on last test, as array will be full
function loop10Creations(i) { it(`Contract creator is correctly stored for #${i} contract. Creator is ${accounts[i]}`, function () { return PatreonFactorySolFile.deployed().then(function (instance) { patreonFactoryInstance = instance; return patreonFactoryInstance.createContract(`Contract ${i}...
[ "function preCreateWidgets(numberOfWidgets) {\r\n console.log(\"Creating test widgets...\");\r\n\r\n const widgets = [];\r\n for( i=0; i<numberOfWidgets; i+=1 ) {\r\n const newWidget = createRandomWidget();\r\n widgets.push( newWidget );\r\n }//for\r\n\r\n console.log(`Created ${widgets...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Print the best result
function printTheBestResult(){ var edgesMap = new Object(); $.map(edges, function(value, key){ edgesMap[value.id] = value; }); for(var i in bestPath){ var key = bestPath[i]['id']; edgesMap[key]['color'] = '#006400'; } edges = []; for(var key in edgesMap){ edges.push(edgesMap[key]); } plotGraph(node...
[ "displayTopEightMatchedRespondents() {\n console.log(\"\\nTop 8 matches- by matching scores:\");\n console.log(\"===================================\\n\");\n\n for (let i = 0; i < 8; i++) {\n const curr = this.results[this.results.length - 1 - i];\n console.log(i);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turns the page. direction: Direction to move the page, 1 or 1
turnPage(direction) { let nextPage = (this.state.currentPage + direction) % rules.length; if(nextPage < 0) nextPage = rules.length - 1; this.setState({currentPage: nextPage}); }
[ "function go(direction) {\n\t\n\t\tif (Array.isArray(direction)){\n\t\n\t\t\t// If the array has length of 1, the player didn't specify a direction\n\t\t\tif (direction.length == 1) {\n\t\t\t\toutput.before(\"Which direction?<br /><br />\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tgo(direction[1]);\n\t\t\t}\n\t\t}\n\t\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OSTAJE MI JOS DA DEFINISEM attributesChangedCallback AKO SE PODSETIM, SETICU SE DA SAM DODELU STILOVA (ZA INSTANCE DivRipple KLASE) DEFINISAO U POSEBNOJ METODI, KOJU SAM ONDA POZVAO U OBIMU attributesChangedCallback, KLASE DivRipple REC JE O METODI whenAttributeChange
attributeChangedCallback(name, oldval, newval){ //E PA POMENUTU METODU I OVDE POZVATI this.whenAttributeChange(name, oldval, newval); //ALI POZVACU I NOVU METODU, KOJU SAM DEFINISAO ISPOD OVOG LIFECYCLE CALLBACK-A //JASNO MI JE DA CODE TE METODE DEFINISE DODELU STILOVA, U RELACIJI SA sha...
[ "attributeChangedCallback(name) {\n // Because both `checked` and `disabled` are booleans, the callback\n // determines their values by checking to see if the attributes are\n // present.\n const value = this.hasAttribute(name);\n if (this[name] !== value) this[name] = value;\n }", "__...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the quick order modal handle for the selected coffee
get quickOrderModal() { return 'div#modal' }
[ "function popupFindItem(ui) {\n\n v_global.event.type = ui.type;\n v_global.event.object = ui.object;\n v_global.event.row = ui.row;\n v_global.event.element = ui.element;\n\n switch (ui.element) {\n case \"emp_nm\":\n case \"manager1_nm\":\n case \"manager2_nm\":\n case \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FRAME TAG UTILS Sets the html content of a Frame tag
function setFrameContent(frameClass, content) { $('.' + frameClass + '.' + FRAME_SELECTOR + ' .' + FRAME_CONTENT_SELECTOR).html(content); }
[ "function loadFrameFromHTML(src, frame, callback) {\n var fn = function () {\n Monocle.Events.deafen(frame, 'load', fn);\n frame.whenDocumentReady();\n Monocle.defer(callback);\n }\n Monocle.Events.listen(frame, 'load', fn);\n if (Monocle.Browser.env.loadHTMLWithDocWrite) {\n frame.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a time value from the given string in the QLC+ format. Time example: 2h34m12s870ms Beats example: 5 1/4 Returns 2 on infinite time string
function qlcStringToTime(str, type) { if (str === "" || str === "0") { return 0; } else if (str === "∞") { return -2; } var finalTime = 0; var currStr = ""; if (type === 0 /*Function.Time */) { for (var i = 0; i < str.length; i++) { if (str[i] >=...
[ "function parseTime(str) {\n\t if (!str) {\n\t return 0;\n\t }\n\t\n\t var strings = str.split(\":\");\n\t var l = strings.length, i = l;\n\t var ms = 0, parsed;\n\t\n\t if (l > 3 || !/^(\\d\\d:){0,2}\\d\\d?$/.test(str)) {\n\t throw new Error(\"tick on...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GESTION DES DATES ze_Date_to_timestamp_v1 ze_Date_to_timestamp_v2 ze_Timestamp_input ze_Secondes_date ze_Generation_date_v1 ze_Generation_date_precise / Transforme une date au format JJ/MM/AA HH:MM en un timestamp str > int
function ze_Date_to_timestamp_v1(date) { if(date.match(new RegExp('([0-9]{2})\/([0-9]{2})\/([0-9]{2,4})(( | | à |)([0-9]{2})(h|:)([0-9]{2})(:([0-9]{2})|)|)'))) { var donnees = new RegExp('([0-9]{2})\/([0-9]{2})\/([0-9]{2,4})(( | | à |)([0-9]{2})(h|:)([0-9]{2})(:([0-9]{2})|)|)').exec(date); if(typeof donnees[6] =...
[ "function toTimeStamp(date) {\n\t\t\ttry {\n\t\t\t\tvar x=\"\";\n\t\t\t\tif(date!=\"\"){\n\t\t\t\t\tx= new Date(date).getTime()/1000;\n\t\t\t\t}\n\n\t\t\t\t// console.log('try'+x +' '+date);\n\t\t\t\treturn x;\n\t\t\t} catch (e) {\n\t\t\t\t// console.log(e);\n\t\t\t\tvar x= new Date().getTime()/1000;\n\t\t\t\t// ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return the last column in a group
getLastColumn(){ if(!this.isGroup){ return this; }else{ if(this.columns.length){ return this.columns[this.columns.length -1].getLastColumn(); }else{ return false; } } }
[ "isLastColumn(): boolean {\n return this.getColumnIndex() === this.getWidth() - 1;\n }", "getTopColumn(){\n\t\tif(this.parent.isGroup){\n\t\t\treturn this.parent.getTopColumn();\n\t\t}else{\n\t\t\treturn this;\n\t\t}\n\t}", "function getSheetEndColumn() {\r\n\t\r\n\tif(sheetEndColumns.length==0){\r\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles grid transitions (and drawing new state) based on key presses. If the key pressed was the left or right arrow, repeatedly calls previous or next step, respectively, for as long as the key is down. If the key pressed was the space button, either pauses or unpauses the grid.
function keydownHandler(event) { const key = event.code; if (key === 'ArrowLeft') { event.preventDefault(); // Prevents key from executing its default action. clickAndHold(document, [pause], [boundPreviousStep, boundDrawPreviousGrid], 'keyup'); } else if (key === 'ArrowRight') { event.preventDefault()...
[ "function redrawAfterKey() {\r\n\r\n var sO = CurStepObj;\r\n\r\n if (sO.focusBoxId == CodeBoxId.Index) \r\n\tredrawGridIndexExpr(sO); // redraw the index *cell*\r\n else\r\n\tdrawCodeWindow(sO); // redraw code window\r\n\r\n}", "function keyPressed() {\n\tif (keyCode == 32) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes a pdf through given Data
function pdfMaker(listData, topic, level){ let pdfDoc = new PDFDocument({ size: "A4", margin: 40, }); // generateTable(pdfDoc, listData); generateDoc(pdfDoc, listData); pdfDoc.end(); if(level!=undefined){ topic =topic+level; } pdfD...
[ "function createPDF(body) {\n var doc = new PDFDocument;\n doc.pipe(fs.createWriteStream('ticket.pdf'));\n\n var text = 'Hi, ' + body.name + ' Ticket has been booked from ' + body.location.from.name + ' to ' +\n body.location.to.name + ', Enjoy your flight';\n console.log('text',text);\n\n doc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsersynonym_name.
visitSynonym_name(ctx) { return this.visitChildren(ctx); }
[ "visitCreate_synonym(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitSchema_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitQuery_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitProcedure_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitRecord_name(ctx) {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
eveIntercept Sent by either Alice or Bob, the message being intercepted by Eve. Eve will add the message to her list of intercepted messages, waiting to intercept.
function eveIntercept(message, to) { messageList.names.push(to); messageList.messages.push(message); addToTable(to, message); }
[ "function sendAlice() {\n let message = document.getElementById(\"aliceMessage\").value;\n document.getElementById(\"bobMessage\").value = message;\n document.getElementById(\"aliceMessage\").value = \"\";\n eveIntercept(message, \"Bob\");\n }", "function sendBob() {\n let me...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This code adds a buttons to collapse or expand all elements and to sort items.
function addButtons() { const buttonFrame = document.createElement("DIV"); buttonFrame.classList.add("buttonFrame"); detailButton = document.createElement("P"); detailButton.textContent = "Show Details"; detailButton.classList.add("detailButton"); sortButton = document.createElement("P"); sortButton.textC...
[ "addToolBarItems() {\n // Ignore if the buttons are already there\n if (document.getElementsByClassName('rvt-tools').length !== 0) {\n return;\n }\n\n let btnGroup = `<div class=\"BtnGroup rvt-tools\">\n <a id=\"${Constants.SHOW_ALL_BUTTON_ID}\" class=\"${Constants.TOOL_BUTTON_CLASS}\" href=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by Java9ParserunannClassType_lfno_unannClassOrInterfaceType.
enterUnannClassType_lfno_unannClassOrInterfaceType(ctx) { }
[ "enterUnannClassType_lf_unannClassOrInterfaceType(ctx) {\n\t}", "enterUnannInterfaceType_lfno_unannClassOrInterfaceType(ctx) {\n\t}", "enterUnannInterfaceType_lf_unannClassOrInterfaceType(ctx) {\n\t}", "enterClassType_lfno_classOrInterfaceType(ctx) {\n\t}", "exitUnannClassType_lfno_unannClassOrInterfaceType...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the point on the segment (vx,vy)(wx,wy) closest to (px,py).
function projectPointOntoSegment(px, py, vx, vy, wx, wy) { var l2 = dist2(vx, vy, wx, wy); if (l2 === 0) return new Point(vx, vy); var t = ((px - vx) * (wx - vx) + (py - vy) * (wy - vy)) / l2; if (t < 0) return new Point(vx, vy); if (t > 1) return new Point(wx, wy); return new Point( vx + t * (wx - vx), ...
[ "function nearestPointOnLine(px,py,x1,y1,x2,y2){\n\n\tvar lx = x2 - x1;\n var ly = y2 - y1;\n\t\n if ( lx == 0 && ly == 0 ) {//If the vector is of length 0,\n\t\t//the two endpoints have the same position, so the nearest point is at that position\n return {\n\t\t\tx: x1,\n\t\t\ty: y1\n\t\t};\n } els...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enables and disables recommender engine
function recommenderEnablerListener() { var checkboxRecommendations = document.getElementById("checkboxRecommendations"); // Get the setting if it has already been set chrome.storage.local.get(function(storage) { var settings = storage["settings"]; if (!settings) { settings = initialSettings; } ...
[ "function toggleRecommendations() {\n chrome.storage.local.get(function(storage) {\n var cachedSettings = storage[\"cachedSettings\"];\n if (!cachedSettings) {\n var settings = storage[\"settings\"];\n if (!settings) {\n settings = initialSettings;\n chrome.storage.local.set({ \"setti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a random hexadecimal value pair as a string:
function rdm_hex_pair(){ var pair = Math.floor(Math.random() * 256).toString(16); if (pair.length < 2){ pair = "0" + pair } return pair; }
[ "function randomHexNumberGenerator() {\n return '#' + Math.random().toString(16).substr(2, 6).toUpperCase();\n}", "function generateHex() {\n return chroma.random();\n\n}", "function generateGuid() {\n var buf = new Uint16Array(8);\n buf = crypto.randomBytes(8);\n var S4 = function(num) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes a list of drums and returns an independant copy of the list
function copyDrumsList(drumList) { var drumListCopy = []; var drumCopy; for (var i = 0; i < drumList.length; i++) { drumCopy = new Drum(drumList[i].name, drumList[i].sample); drumCopy.playTriggers = drumList[i].playTriggers.slice(); drumListCopy.push(drumCopy); } return drumListCopy; }
[ "setItems(items){\n const currentFiller = this.numberLeftWithOddEnding()\n /**\n * Will return the indexes (from the old array) of items that were removed\n * @param oldArray\n * @param newArray\n */\n const removedIndexes = (oldArray, newArray) => {\n let rawArray = oldArray.map((oldI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
verify Post token from any client CORS () kiem tra du lieu kieu JSON.stringify
tokenPostCheck(req, res, next) { let postDataString = ''; // Get all post data when receive data event. req.on('data', (chunk) => { postDataString += chunk; }); // When all request post data has been received. req.on('end', () => { //chuyen doi Object JSON tu chuoi data nhan duoc ...
[ "_postWithToken(url, token) {\n return fetch(url, {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({token: token})\n });\n }", "function tokenFunc() {\n\tlet data = {username : process.env.WOR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to get parked slots from color
getSlotNoFromColor(color) { try { const slots = this.parkingManager.getSlotNoFromColor(color); if(slots.length === 0) console.log('Not Found'); else { console.log(slots.join(",")); } } catch(e) { throw new Except...
[ "function createPallet(){\n\tfor(let i = 0; i < numColor; i++){\n\t\tswatches.push(new ColorSwatch(\t((i*colorSwatchRadius)+colorSwatchRadius/2), \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolorSwatchRadius/2, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolorSwatchRadius/2, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t colorArray[i]));\n\t}\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs additional search against acitity and transaction records to find latestdate/latesttype/latestid to use
function getLatestTrxAndActivityDate(jsonClient, arClientIds) { //3. Search for Latest Transaction Date of any kind for all client //order the search in trandate Latest. //array to keep track of already used client id var arTrx = new Array(); var tflt = [new nlobjSearchFilter('entity', null, 'anyof', arClient...
[ "async function current_latestamounttoday_await() \n{\n\tlet today = new Date();\n\tlet year = today.getFullYear();\n\tlet month = today.getMonth(); \n\tlet date = today.getDate();\n\n return await CurrentModel.\n\t\tfindOne().\n\t\twhere(\"time\").gte(new Date(year, month, date)).\n sort({time: -1}).\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get currency from the current tier, or fallback on collective currency
getCurrency() { const tier = this.getTier(); return get(tier, 'currency', this.props.data.Collective.currency); }
[ "function getCurrency(){\n //selected currencies\n fromCurr = selects[0].selectedOptions[0].textContent;\n toCurr = selects[1].selectedOptions[0].textContent;\n \n //get currency code according to currency name\n if(fromCurr !== ''){\n const index = currencies.findIndex((obj) => obj.currency_name == fromCu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if dino hits cactus
function checkColision(cactus){ const dinoY = dino.style.bottom.split('px')[0] const cactusX = cactus.offsetLeft; if(cactusX <= divSize && cactusX >= -divSize && dinoY<= divSize){ //log(true) inGame = false; }else{ //log(false); } }
[ "has_ace() {\n if (this.mycards.includes(1)) return true;\n return false;\n }", "function checkUEC(targetBlock) {\n if (targetBlock.id.equals('mekanism:ultimate_energy_cube')) {\n if (!!targetBlock.entityData.EnergyContainers[0]) {\n if (!!targetBlock.entityData.EnergyContainers[0]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Goes to the next icon
goToNextIcon() { let current = this.currentIcon.name(); let next = this.nextIcon[current]; this.currentIcon = this.icons[next]; this.controlText(this.currentIcon.name().replace(/([A-Z])/g, '$1')); this.changeContent(next); return this.currentIcon; }
[ "function nextClicked() {\n if (currentFeed && currentItemIndex < currentFeed.items.size - 1) {\n currentItemIndex++;\n displayCurrentItem();\n }\n }", "function handleNextBtn() {\n // Move the pointer back\n util.movePtr(\"next\");\n\n // Extract the index and url ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sample custom transition using scrollUp effect inspired by Karl Swedberg's Scroll Up Headline Reader jQuery Tutorial[1] [1]
function transitionScrollUp( $from, $to ) { var cheight = $from.outerHeight(); // hide scrollbar during animation $( 'body' ).css( 'overflow-y', 'hidden' ); $to.css( 'top', cheight+'px' ); $to.show(); $from.animate( {top: -cheight}, 'slow' ); $to.animate( {top: 0}, 'slow', function() { $from.hide()...
[ "scrollUp() {\n let x = this.scrollElement.scrollLeft;\n let y = this.scrollElement.scrollTop - this.scrollElement.clientHeight;\n this._scrollTo(x, y);\n }", "function scrollUp(){\n startY += 15;\n createSVGOutput();\n}", "function scrollUp(amount) {\n moveTo(curren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ajax call for infoWindow's contents
function infoWindowContents(index, data) { var restaurant = data.restaurants[index]; var mymap = data.restaurants[index].mymap; $.ajax({ type: 'GET', url: '/home/info_window', data: { id: restaurant.id, mymap_id: mymap.id } }); }
[ "function showInfoWindow() {\n var marker = this;\n hotels.getDetails({placeId: marker.placeResult.place_id}, function(place, status) {\n if (status !== google.maps.places.PlacesServiceStatus.OK) {\n return;\n }\n hotelInfoWindow.open(hotelMap, marker);\n buildIWContent(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transforms the tokens of the winning streak to uppercase in the field array and sets the winner to the current player if a player has won. If no player has won the winner will be set to 'true' for the program to notify that the game is over. Triggers the 'finish' function to update the Viewclass.
finishGame(streak){ let winner = this.currentPlayer; if(streak){ for(let i=0; i<streak.length; i++){ this.field[streak[i][0]][streak[i][1]] = "<span class='winner'>"+winner.toUpperCase()+"</span>"; } this.winningStreak = streak;...
[ "checkFinished(row, col, player){\n let winningStreak = [];\n\n //Checking for a streak vertically in the column of the inserted token\n let streak = [];\n let streakReached = false;\n for(let i=0; i<this.rows; i++){\n if(this.field[i][col] == pl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sendResult function executes the POST request to save the data to the server (and subsequently the results.json file)
async function sendResult(result) { // Transfers the result to string format result = JSON.stringify(result); // Error handling ensures graceful handling of any problems try { // Sends POST request containing the result in the body let response = await fetch('./result', { ...
[ "function __saveResults(bSubmit){\n \n var activityBodyObjectRef = $(__constants.DOM_SEL_ACTIVITY_BODY).attr(__constants.ADAPTOR_INSTANCE_IDENTIFIER); \n /*Getting answer in JSON format*/\n var answerJSON = __getAnswersJSON(false);\n\n if(bSubmit===true) {/*Hard Submit*/\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display picture and restaurant name and rating function
function displayRestaurantDetails(restaurant) { let avrageRating = generateAvrageRating(restaurant) const commentsDiv = document.getElementById('comments') commentsDiv.classList.add('container', 'text-center', "principal", "border", 'rounded', "border-primary", 'mt-2') commentsDiv.classList.remove('...
[ "function showRating(ratings) {\n let oneStars = +ratings.one \n let twoStars = +ratings.two *2\n let threeStars = +ratings.three*3\n let fourStars = +ratings.four*4\n let fiveStars = +ratings.five*5\n\n let totalRatings = +ratings.one + +ratings.two + +ratings.three + +ratings.four + +ratings.five\n\n let averageR...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Encrypt payment password(DES) by RSA
function encryption() { var DES_key = document.getElementById("payment_password").value; if (DES_key.length != 0) { var encrypted_des_key = RSA_encryption(DES_key); document.getElementById("payment_password").value = encrypted_des_key; } }
[ "function RSA_encryption(deskey) {\n var pubilc_key = \"-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzdxaei6bt/xIAhYsdFdW62CGTpRX+GXoZkzqvbf5oOxw4wKENjFX7LsqZXxdFfoRxEwH90zZHLHgsNFzXe3JqiRabIDcNZmKS2F0A7+Mwrx6K2fZ5b7E2fSLFbC7FsvL22mN0KNAp35tdADpl4lKqNFuF7NT22ZBp/X3ncod8cDvMb9tl0hiQ1h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses and returns a group.
parseGroup() { const startPos = this.tok.pos; this.tok.consume("("); let items = []; while (true) { const next = this.tok.peek(); if (next == "(") items.push(this.parseGroup()); else if (next !== null && /^[A-Z][a-z]*$/.test(next)) ...
[ "groupSpecifier() {\n this._lastStrValue = \"\";\n if (this.eat(unicode_1.QuestionMark)) {\n if (this.eatGroupName()) {\n if (!this._groupNames.has(this._lastStrValue)) {\n this._groupNames.add(this._lastStrValue);\n return;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find the closestspelled synonym to a keyword cutoff: the tolerance, words must be below this to count as spelled similarly to the keyword thesynonyms: multidimensional array of synonyms, first cell in each subarray will be treated as the primary term
function findclosestsynonym(keyword, cutoff, thesynonyms){ keyword = keyword.toLowerCase(); var ret = "", parentID = -1, childID = -1; for(var synonymparentindex = 0; synonymparentindex< synonyms.length; synonymparentindex++){ for(var synonymchildindex = 0; synonymchildindex < synonyms[synonymparent...
[ "function findsynonym(keyword, thesynonyms, cutoff){\n if(isUndefined(thesynonyms)){thesynonyms = synonyms;}\n if(isUndefined(cutoff)){cutoff = 0;}\n keyword = keyword.toLowerCase();\n var ret = \"\", parentID = -1, childID = -1, wordfound = \"\";\n for(var synonymparentindex = 0; synonymparentindex<...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test: createQueryFromJson(jsonQuery) Creating query for: TREND
function testCreateQueryFromJsonTrend() { // Call the function to test var generatedOutput = createQueryFromJson(jsonQueryTrend); var expectedOutput = 'Monthly trend of Sum of Units where Item is In Binder, Pencil, Pen' + ' from OrderDate 2019-01-06 to 2019-07-12'; // Checking if generated output is...
[ "function testCreateQueryFromJsonTimeCompare() {\n // Call the function to test\n var generatedOutput = createQueryFromJson(jsonQueryTimeCompare);\n var expectedOutput = \n 'Compare the Mean of Unit Cost for the OrderDate 2019-01-06 to 2019-03-15' +\n ' and 2019-04-01 to 2019-07-12 by Region';\n \n // Ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an eosjs authority provider using this link.
makeAuthorityProvider() { const { rpc } = this; return { async getRequiredKeys(args) { const { availableKeys, transaction } = args; const result = await rpc.fetch('/v1/chain/get_required_keys', { transaction, available_k...
[ "newAuthorisedCapability (holder, id, type, location, sphere, validFrom, validTo) {\n const subject = {\n id: 'did:caelum:' + this.did + '#issued-' + (id || 0),\n capability: {\n type: type || 'member',\n sphere: (['over18', 'oidc'].includes(type) ? 'personal' : 'professional')\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
singleClickFunc function hides and shows an indivdual card
function singleClickFunc() { //TODO add your code here to get the desired functionality $('.cardImg', this).toggle(); console.log('Running singleClickFunc()') }
[ "function handletoggleUserCard() {\n userCard.style.visibility = 'visible';\n}", "function toggleCardTools() {\n if (cardTools.css('display') == 'none') {\n cardTools.slideDown(400);\n } else if (cardTools.css('display') == 'block') {\n cardTools.slideUp(150);\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the given litemessage id is in LevelDB's litemessage index (only opn main branch), or it's in the pending pool, the return value will be `true`.
async hasLitemsg(litemsgId) { return (await this.blockchain.litemsgOnMainBranch(litemsgId)) || this.inLitemsgPool(litemsgId); }
[ "function isState(message){\n console.log(states.indexOf('' + message) + ' ' + message);\n if (states.indexOf(message) != -1){\n return true;\n } else {\n return false;\n }\n}", "isSaved(id) {\n if ( id in this.state.savedItems ) {\n return true\n }\n else {\n return false...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Post a xmlhttp request on server to save company data, reset page content accordingly
function saveCompanyData (callback) { const xhr = new XMLHttpRequest(); xhr.open('POST', `/settings?id=${companyId}`); xhr.setRequestHeader('Content-type', 'application/json'); xhr.send(JSON.stringify({ company_name: document.getElementById('company-name-input').value, country: document.getElementById('...
[ "function saveCompany(company) {\n\n // update the target URL\n var targetUrl = CompanyUrl;\n\n // Update the stored data\n $.ajax({\n url: targetUrl,\n type: 'POST',\n dataType: 'json',\n data: company,\n success: function (data, tx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if there are any modified records before OOSE risk/coverage/class/component data
function preOoseChangeValidation(type, gridId, baseRecordIdColumnName) { isForOose = "Y"; var valid = true; var XMLData = getXMLDataForGridName(gridId); var rowIndex = 0; var currentRowId = getSelectedRow(gridId); var baseRecordId = XMLData.recordset(baseRecordIdColumnName).value; var...
[ "haveChanges() {\n return this.code !== this.codeFromTableau;\n }", "_isModify(orgUnit) {\n return Object.keys(orgUnit).length > 0;\n }", "_checkEmberModelsOnDirty() {\n let checkresult = false;\n\n let editformIsDirty = this.get('model.editform.hasDirtyAttributes');\n\n let dataobjec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an element, color it by inlining a fill or stroke attribute. If color isn't define, it will use the current computed style for use when applying styles via CSS
function svgcolor(el, color) { var fill = $(el).attr('fill'); var stroke = $(el).attr('stroke'); var isFill, isStroke; if (!fill && !stroke) { isFill = true; } else { if (fill && fill !== 'none') { isFill = true; } if (stroke && stroke !== 'none') { isStrok...
[ "function svgColorHandler(svgId, color) {\n document.getElementById(svgId).getSVGDocument().getElementsByTagName(\"g\")[0].style.fill = color;\n }", "set strokeColor(color) {\n var hex = STYLE_UTIL.getHexColor(color);\n if (hex) {\n var stroke = SLD.stroke(this._symbolizer);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generic event dispatcher for ui:compose:recordpage resource type This is used when deleting, updating, creating records and where validation errors occur
dispatchUiEvent (eventType, record = this.record, args = {}) { const resourceType = `ui:compose:${this.getUiEventResourceType || 'record-page'}` const argsBase = { errors: this.errors, validator: this.validator, ...args, } return this .$EventBus .Dispatc...
[ "handleNavigationToRecord(){\n this[NavigationMixin.Navigate]({\n type:'standard__recordPage',\n attributes:{\n recordId:this.recordId,\n objectApiName:CAR_OBJECT.objectApiName,\n actionName:'view'\n }\n })\n }", "navig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apply action to decisionTreeNode.state, returns resulting state
apply(decisionTreeNode) { throw new Error("SmartAction is abstract class, should not be instantiated"); }
[ "apply(state) {\n let newCanvas = state.canvas.clone().drawStep(this)\n return new State(state.target, newCanvas, this.distance)\n }", "function changestate(){\n let stateplot=d3.select('#state_selected').node().value;\n buildplot(stateplot)}", "function StateCondition(actionManager,target,/*...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks to see if the value entered in the text box is valid. Valid values are positive dollar amounts. Displays an error on the page if value is invalid. Returns false if value is invalid, returns true if value is valid.
function is_valid_value() { var value = $('#valueInput')[0].value; var error = $("#errorAlert"); // Make sure value contains only numbers and up to one decimal point var valid_characters = "0123456789."; var char_result = true; var point = 0; // Check each character for validity, decimal points for (var i...
[ "function isValidAmount(element){\n\t\n\t\t// user's amount\n\t\tvar amount = element.value;\t\n\t\t\n\t\t// parse amount as float\n\t\tamount = parseFloat(amount);\n\t\t\n\t\t// if amount is number, parse amount\n\t\tif(!isNaN(amount) && amount > 0.0 && amount < 100000){\n\t\t\n\t\t\t// test passed\n\t\t\treturn t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prepare5secSegmentsCMD function agreggates the commands for each resolution/bitrate for the 5 seconds segments into one command Command outputs are surpressed, except for the frame information
function prepare5secSegmentsCMD(inputFilePath, renditionsArray, audioCodec, videoCodec, audioSampleRate) { let durationString = "segment_5"; let assetFolder = "hls_assets"; let cmd = `${ffmpegPath} -i ${inputFilePath} -hide_banner -y -loglevel quiet -stats `; for (let rendition of renditionsArray) { ...
[ "async function run() {\n\n var cmd_6sec = \"\";\n var cmd_5sec = \"\";\n\n\n await prepareEnvironment(renditions);\n\n try {\n cmd_6sec = prepare6secSegmentsCMD(inputFilePath, renditions, audioCodec, videoCodec, audioSampleRate);\n cmd_5sec = prepare5secSegmentsCMD(inputFilePath, renditio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract the pii for ScienceDirect articles and use it to form a new URL
function get_ScienceDirect(theURL) { var searchfor = "piikey%3D" var mypiiTMPi = theURL.indexOf(searchfor) var mypiiTMP = theURL.substring(mypiiTMPi+searchfor.length,theURL.length) var mypiiTMPi = mypiiTMP.indexOf("%26") var mypii = mypiiTMP.substring(0,mypiiTMPi) var theNewURL = "http://...
[ "function makeExtractURL(numPages, pageParams) {\n var extractURL = 'http://en.wikipedia.org/w/api.php?action=query&' +\n 'prop=extracts&format=json&exsentences=3&explaintext=&exintro=&' +\n 'exlimit=' + numPages + '&titles=' + pageParams + '&callback=?';\n return extractURL;\n}", "function sc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decodes the specified string by replacing all _ with it's original value \" \' etc It will also decode the \" \' if keep_slashes is set to fale or omitted
function decode(str, keep_slashes) { if (isEncoded) { str = str.replace(/\uFEFF[0-9]/g, function(str) { return encodingLookup[str]; }); } if (!keep_slashes) str = str.replace(/\\([\'\";:])/g, "$1"); return str; }
[ "function parsestr (c, s) {\n var encodeUtf8 = function (s) {\n return unescape(encodeURIComponent(s));\n };\n var decodeUtf8 = function (s) {\n return decodeURIComponent(escape(s));\n };\n var decodeEscape = function (s, quote) {\n var d3;\n var d2;\n var d1;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This fx will reset a specific position of the current tab
reloadTabPosition(position = null) { if (typeof this.asset.resetOutlet === 'function') this.asset.resetOutlet(position); }
[ "reset(){\n this.setSpeed();\n this.setStartPosition();\n }", "function resetTabs(){\n var homeTabs = $(\".section-tab__item\");\n homeTabs.each(function(){\n $(this).css(\"background-color\", \"#D5D7D8\");\n })\n }", "function setRovingTabindex(active)\n\t{\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds "a" or "an" to a word for readability.
function a(word) { if (word === 'undefined' || word === 'null') return word; return `${('aeiou').includes(word[0]) ? 'an' : 'a'} ${word}`; }
[ "function insert_a(text, script) {\r\n const a = (script == Script.CYRL) ? '\\u0430' : 'a'; // roman a or cyrl a\r\n text = text.replace(new RegExp(`([ක-ෆ])([^\\u0DCF-\\u0DDF\\u0DCA${a}])`, 'g'), `$1${a}$2`);\r\n text = text.replace(new RegExp(`([ක-ෆ])([^\\u0DCF-\\u0DDF\\u0DCA${a}])`, 'g'), `$1${a}$2`);\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show all readings saved by user
function index(req, res){ Reading.find({user: req.user.name}, function(err, readings){ res.render(`readings/index`, { user: req.user, readings }); }); }
[ "function getReadings(token) {\n\t\tvar readingsURL = \"https://api.readmill.com/v2/users/\"+userObj.id+\"/readings?states=reading,finished,abandoned&access_token=\"+token;\n\t\t$.getJSON( 'functions.php', { url: readingsURL, apiRequest: true, clientId: true }, function(data) {\n\t\t\t\treadingsObj = data.requested...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the content element placement.
get placement() { return this.skeleton.placement; }
[ "get positionStrategy() {\n if (this._positionStrategy) {\n return this._positionStrategy;\n }\n if (!this.position) {\n return undefined;\n }\n const positionList = [...this.position];\n const positionStrategy = this._positionStrategy = [];\n w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when mouse enters video
function mouse_in_video() { $(".chalk_player .media_controls").addClass("media_show"); if($(".chalk_player video").attr("data-diy")=="1") $(".chalk_player .diy_wrapper .steps_container").removeClass("hidden"); setTimeout(function() { if($(".chalk_player .media_controls").attr("data-mouse-in")=="0") if(Date.no...
[ "function mouse_move_video()\n{\n\t$(\".chalk_player .media_controls\").addClass(\"media_show\");\n\tif($(\".chalk_player video\").attr(\"data-diy\")==\"1\")\n\t\t$(\".chalk_player .diy_wrapper .steps_container\").removeClass(\"hidden\");\n\tsetTimeout(function() {\n\t\tif($(\".chalk_player .media_controls\").attr(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Grab a connection, run the query via the MySQL streaming interface, and pass that through to the stream we've sent back to the client.
_stream(connection, obj, stream, options) { options = options || {} return new Promise((resolver, rejecter) => { stream.on('error', rejecter) stream.on('end', resolver) connection.query(obj.sql, obj.bindings).stream(options).pipe(stream) }) }
[ "function src(pretendFilePath, options) {\n let result;\n try {\n let conn = mysql.createConnection(options.connection);\n let vinylFile;\n // create a file wrapper that will pretend to gulp that it came from the path represented by pretendFilePath\n vinylFile = new Vinyl({\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a map containing resources of a specified name from all drawable folders in a directory.
function mapImageResources(rootDir, subDir, type, resourceName) { var pathMap = {}; shell.ls(path.join(rootDir, subDir, type + '-*')) .forEach(function (drawableFolder) { var imagePath = path.join(subDir, path.basename(drawableFolder), resourceName); pathMap[imagePath] = null; }); re...
[ "loadCubemap(name, directory) {\n\t\treturn new Promise(resolve => {\n\t\t\tlet upImage = this.loadImage(directory + \"posy.jpg\");\n\t\t\tlet bottomImage = this.loadImage(directory + \"negy.jpg\");\n\t\t\tlet rightImage = this.loadImage(directory + \"posx.jpg\");\n\t\t\tlet leftImage = this.loadImage(directory + \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: deployCFC DESCRIPTION: ARGUMENTS: RETURNS:
function deployCFC() { invokeMethodOnCurrentCFC("deploy"); }
[ "function deployChaincode() {\n\t// Construct the deploy request\n\tvar deployRequest = {\n\t\t// Path (under $GOPATH/src) required for deploy in network mode\n\t\tchaincodePath: \"crowd_fund_chaincode\",\n\t\t// Function to trigger\n\t\tfcn: \"init\",\n\t\t// Arguments to the initializing function\n\t\targs: [\"ke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Take the jiffserver base instance and options for this extension, and use them to construct an instance for this extension.
function make_jiff(base_instance, options) { var jiff = base_instance; // Parse options if (options == null) { options = {}; } /* socketMaps now stores a reference directly to a socket rather than a socketId To avoid naming confusion, this is still referred to as socketId */ ...
[ "function buildExtension() {\n return {\n name: 'extension',\n entry: './server/src/index.ts',\n output: {\n filename: 'extension.js',\n path: path.resolve(__dirname),\n\n // Important; this needs to be a umd library or it won't export a function\n // and nodecg will poop its pants.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a slider change object from the specified value.
_createChangeEvent(value = this.value) { let event = new MatSliderChange(); event.source = this; event.value = value; return event; }
[ "function createSlider() {\n\n //the value that we'll give the slider - if it's a range, we store our value as a comma separated val but this slider expects an array\n var sliderVal = null;\n\n //configure the model value based on if range is enabled or not\n if ($scope.model.config.enab...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scene_DvLyonPromo The scene class for showing the DvLyon Games splash screen.
function Scene_DvLyonPromo() { this.initialize.apply(this, arguments); }
[ "function show(splash) {\n var extendedSplashImage = document.getElementById(\"extendedSplashImage\");\n\n // Position the extended splash screen image in the same location as the system splash screen image.\n extendedSplashImage.style.top = splash.imageLocation.y + \"px\";\n extendedSpl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
chain() connects an array of `soundNodes` into a chain. If there are three nodes in `soundNodes`, the output of the first will be the input to the second, and the output of the second will be the input to the third.
function chain(soundNodes) { for (var i = 0; i < soundNodes.length - 1; i++) { soundNodes[i].connect(soundNodes[i + 1]); } }
[ "connectEffectLeft(...nodes) {\n this._split.connect(nodes[0], 0, 0);\n\n (0, _ToneAudioNode.connectSeries)(...nodes);\n (0, _ToneAudioNode.connect)(nodes[nodes.length - 1], this._merge, 0, 0);\n }", "connectEffectRight(...nodes) {\n this._split.connect(nodes[0], 1, 0);\n\n (0, _ToneAudioNode.conn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends calls to training api for multiple users
function trainAllUsernames(users) { //Each call the training api creates a new promise which is appended to this array of promises. Only once all the training promises are resolved is the Markov chain generated var trainingPromises = []; for (user of users) { var trainUrl = "/api/tw...
[ "function trainFace(username_email, cb) {\n var trained = false;\n console.log('training started>>>>>');\n // lighting\n var a = 180;\n var a2 = 0;\n var l = setInterval(function() {\n matrix.led([{\n arc: Math.round(180 * Math.sin(a)),\n color: 'blue',\n st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Modify the gulp config after construction but before running tasks
cb(config) { //you have access to the gulp config here for //any extra customization after merging => don't forget to return config return merge(config, serverConfig); }
[ "_applyCustomConfig() {\n\n this._backupSPFXConfig();\n\n // Copy custom gulp file to\n this.fs.copy(\n this.templatePath('gulpfile.js'),\n this.destinationPath('gulpfile.js')\n );\n\n // Add configuration for static assets.\n this.fs.copy(\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
simple industry details card
async IndustryCard(context) { const card = CardFactory.heroCard( 'Main Business Details', 'Find more about Industry Details.....', ['https://3er1viui9wo30pkxh1v2nh4w-wpengine.netdna-ssl.com/wp-content/uploads/prod/sites/43/2020/06/Fortude-AI4A-Sri-Lanka.jpg'], [ ...
[ "function internCard(internObj) {\n var name = internObj.getName();\n var id = internObj.getID();\n var email = internObj.getEmail();\n var school = internObj.getSchool();\n var role = internObj.getRole();\n\n var html = `<div class=\"card\">\n <h4 class=\"card-header\" id=\"name\">`+ name + `<...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init the next planets
function load_next_planet() { gamer.planet.type = gamer.next.type; gamer.planet.assigned = false; gamer.planet.removed = false; gamer.planet.checked = false; gamer.planet.x = gamer.x; gamer.planet.y = gamer.y; var sun = random(1,100); ...
[ "function ResetPlanets()\n\t{\t\n\t\tplanets = new Array();\n\t\tAddPlanets();\n\t}", "function render_next_planet() {\n var imgNext = new Image();\n imgNext.src = 'assets/img/planets.png';\n imgNext.onload = function() {\n var crop = get_planet_crop(gamer.next.type);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
replace BigNumbers with numbers, returns true if size contained BigNumbers
function _normalize(size) { var hasBigNumbers = false; size.forEach(function (value, index, arr) { if (value && value.isBigNumber === true) { hasBigNumbers = true; arr[index] = value.toNumber(); } }); return hasBigNumbers; }
[ "function is_large( vp_width ) {\n return vp_width > $(58.75).toCleanPx(); \n}", "isBigInt() {\n return !!(this.type.match(/^u?int[0-9]+$/));\n }", "function isThereEnoughChocolateBags(small, big, total){\n const maxBigBoxes = total / 5;\n const bigBoxesWeCanUse = maxBigBoxes < big ? maxBigBo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets current theme string
getCurrentTheme() { return this.isDarkTheme ? 'dark' : 'light'; }
[ "function lookupThemeName() {\n // As a few components (dialog) add their controllers later, we should also watch for a controller init.\n return ctrl && ctrl.$mdTheme || (defaultTheme == 'default' ? '' : defaultTheme);\n }", "get name () {\n\t\t\treturn app.settings.Theme;\n\t\t}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refresh the height of the list item.
refreshItemHeight() { this.virtualizationModule.refreshItemHeight(); }
[ "_updateHeight() {\n this._updateSize();\n }", "function saveListSize() {\n var $this = $(this);\n $this.css('min-height', $this.height());\n }", "set requestedHeight(value) {}", "function reduce() {\n $(\".carousel-item\").css(\"height\", \"20vh\");\n }", "function init...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IBC CRITERIA Now we are matching the RRM with the Sales Order Criteria.
function IBCMatching() { var asoFilters = new Array(); aSOFilters = ibcCriteria(idrrm, salesOrderCompare); var aSearchResults = findMatchingRecord(aSOFilters); if (aSearchResults != null && aSearchResults != '') { idrrm = aSearchResults[0].getId(); revRec = ...
[ "function SetAPClerk(vbRec,vbSubs,vbOwner,k) {\t\t\t\n\tvar f3 = new Array();\n\tf3[0] = new nlobjSearchFilter('custrecord_spk_sr_ap_clerk_ons_sub',null,'anyof',vbSubs);\n\tf3[1] = new nlobjSearchFilter('isinactive',null,'is','F');\t\t\t\t\t\n\tvar col3 = new Array();\n\tcol3[0] = new nlobjSearchColumn('custrecord_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Transform payment mean to payment method. The goal is to have a coherent object structure between api calls (/me/payment/method and /me/paymentMean/)
transformUSPaymentMethodToPaymentMethod(usPaymentMethod) { const paymentType = get(usPaymentMethod, 'paymentType', null); const paymentStatus = get(usPaymentMethod, 'status', null); return { paymentSubType: get(usPaymentMethod, 'paymentSubType', null), icon: { name: null, data: ...
[ "PayWithAnAlreadyRegisteredPaymentMean(orderId, paymentMean, paymentMeanId) {\n let url = `/me/order/${orderId}/payWithRegisteredPaymentMean`;\n return this.client.request('POST', url, { paymentMean, paymentMeanId });\n }", "getManualPaymentMethod() {\n const pm = get(this.props.data, 'Collect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Video and Image Product
function fnVideoImage(ProductId,videoProduct,ImagemProdPri,NomeProd){ var replaceNomeProd = NomeProd.replace(/-/g,' '); if (videoProduct==""){ document.getElementById("id-video-image"+ProductId).innerHTML="<div class='ImgCapaListProd DivListproductStyleImagemZoom'><img src="+ ImagemProdPri +" alt=\""+ ...
[ "function cargarVideo(url,imagen){\r\n var v = document.createElement(\"video\"); \r\n //if ( (!v.play) && (!Liferay.Browser.isSafari())) { // If no, use Flash.\r\n if(!Modernizr.video){\r\n var params = {\r\n allowfullscreen: \"true\",\r\n allowscriptaccess: \"always\",\r\n wmod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reset pipeline and special nodes cnt data
function resetData() { specialNodesMap = {}; pipelinedStageInfo = {}; pipelineNodeInfo = [[], []]; pipelineEdgeInfo = []; }
[ "resetNodes() {\n for (let layer = 0; layer < this.nodes.length; layer++) {\n for (let node = 0; node < this.nodes[layer].length; node++) {\n this.nodes[layer][node].input = 0;\n this.nodes[layer][node].weight = 0;\n }\n }\n this.biasNode.weight = 1;\n }", "function resetGraphVar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the margin to be used based on the tooltipElement adds left margin to allow center placement
function getTooltipMargin(tooltipElement) { var tooltipElementWidth = (jQuery(tooltipElement).width()) / 2; return "0 0 0 " + (tooltipElementWidth - 20) + "px"; }
[ "function tooltipXposition(d){\n\t\t\treturn x(d)+leftOffset(\"stage_wrapper\")+\"px\";\n\t\t}", "function tooltip_placement(context, source) {\n\t\tvar $source = $(source);\n\t\tvar $parent = $source.closest('table')\n\t\tvar off1 = $parent.offset();\n\t\tvar w1 = $parent.width();\n\n\t\tvar off2 = $source.offse...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OG Calls the loadMessages function after the user is logged into firebase. This is to ensure that the loadMessages does not get called prematurely.
function loadMessagedAfterStateChange() { firebase.auth().onAuthStateChanged(function (somebody) { if (somebody) { loadMessages(); } }) }
[ "setMessagesListener(listener) {\n _messagesDb.collection('messages').orderBy('createdAt', 'desc').limit(10).onSnapshot(listener);\n }", "_onMessagesChanged() {\n if (!this.thread) {\n return;\n }\n if (this.thread.mainCache !== this) {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to set day costs/hours to 0 if no information.
function _resetDayCosts(date) { for (var department in departments) { if (!departments.hasOwnProperty(department)) { continue; } var $depRow = $dayCostTable.find("tr[data-dep-id="+department+"]"); var $depHours = $depRow.find("td[data-col=hours]"); var $dep...
[ "function clearTotals() {\n for (var i = 0; i < numOpenHours; i++){\n totals[i] = 0;\n tosserTotals[i] = 0;\n }\n}", "function reRenderAllCostsHours() {\r\n var date = $addScheduleDate.val();\r\n renderDayAndWeekCosts(date);\r\n reRenderMonthlyCosts();\r\n }", "function updateHoursAndCost(hour...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The person at the head of the line can buy exactly one ticket and must then exit the line. if a person needs to purchase additional tickets,they must reenter the end of the line and wait to be sold their next ticket(assume exit and reentry takes zero seconds). Each ticket sale takes exactly one second. We express initi...
function waitingTime(array, p) { let tickectsAmout = array[p]; let result = 0; let personLocation = p; while(tickectsAmout > 0) { let reducedValue = array.shift(); reducedValue--; result = result + 1; if(personLocation === 0) { personLocation = array.length; ...
[ "function get_time_left() {\n return (total_paid / price_per_second) - time_spent;\n}", "function scheduleJob(jobs) {\n let sortedByProfit = jobs.sort((a, b) => b[2] - a[2]);\n let time = 1;\n let maxProfit = 0;\n let result = [];\n console.log(sortedByProfit)\n\n for (let i in sortedByProfit)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gnuplot version 5.2.7 short forms of commands provided by gnuplot_common.js
function DT (dt) {gnuplot.dashtype(dt);}
[ "function plot(func, atts) {\n if (atts==null) { return addCurve(board, func, {strokewidth:2});\n } else { return addCurve(board, func, atts); } \n }", "function usageString(cmd, style) {\n var com = COMMANDS[cmd];\n var usage = (style ? tt(cmd,'cmd') : cmd)+\" \";\n $.each(com.args, functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CODING CHALLENGE 531 Create a function which validates whether a number n is exclusively within the bounds of lower and upper. Return false if n is not an integer.
function intWithinBounds(n, lower, upper) { return n >= lower && n < upper && Number.isInteger(n); }
[ "function checkRange(value, lowerBounds, upperBounds) {\n if (value >= lowerBounds && value <= upperBounds)\n return value;\n else\n return !value;\n}", "function between(i, min, max) {//check if int provided is within provided range. https://alvinalexander.com/java/java-method-integer-is-betw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initializes the keyboard gets any mapped keys from the local storage and sets default keys if there are none
function initKeyboard(){ myKeyboard = null; myKeyboard = input.Keyboard(); var fireKey = JSON.parse(localStorage.getItem('fireKey')); var rotateLeftKey = JSON.parse(localStorage.getItem('rotateLeftKey')); var rotateRightKey = JSON.parse(localStorage.getItem('roateRightKey')); var accelKey = JSON.pa...
[ "function initKeyboard(){\n\tkeyStates = {\n\t\t'Left': false,\n\t\t'Right': false,\n\t\t'Up': false,\n\t\t'Down': false,\n\t\t'Shift': false,\n\t\t'Control': false,\n\t\t'Space': false,\n\t\t'E': false,\n\t}\n\n\tconsole.log(\"Now listening for keyboard presses...\");\n\tdocument.addEventListener('keydown', functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for auto refreshing the page
function AutoRefresh(t) { setTimeout("location.reload();", t); }
[ "function refresh() {\n\tsetInterval(function() {\n\t\tconsole.log(\"refresh\");\n\t\twindow.location.reload();\n\t}, 20000);\n}", "function clickedRefresh(event) {\n console.log(\"refresh\")\n window.location.reload();\n}", "function refreshPage() {\r\n var url = location.href;\r\n // Strip of info...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Integer GetListIndex(String prElement, String prList) Gets the 0based index of a specified element inside of a string. Returns 1 if item not found.
function GetListIndex(prElement, prList) { var cReg = ""; var szElement = ""; var nIndex = -1; //Loop over the length of the passed list for(var nIndexStr = 0; nIndexStr <= prList.length; nIndexStr++) { //Get the current character in this list cReg = prList.charAt(nIndexStr); if(cReg == "," ||...
[ "function getElIndex(nList, el){\n\n var index = 0\n\n for(element of nList){\n\n if(element == el){\n return index\n }\n index++\n }\n\n}", "getIndexOfLI (librin)\n {\n const my = this\n const LIs = my.LIlist\n let i = 0, len = LIs.length\n for (;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Goes through the graph and draws lines onto the map
function draw_lines(results){ for(i in results.distances){ for(j in results.distances[i]){ var line = results.distances[i][j].line; // Construct the polygon var poly = new google.maps.Polyline({ path: google.maps.geometry.encoding.decodePath(line), ...
[ "function load_graph_to_map(results){\n load_markers(results.locations);\n //draw_lines(results);\n draw_spanning_tree(results);\n\n}", "function drawPolyLine() {\n\n\n //Keys of the station objects in order from north to south so that the polyline\n //connects them in the right order. \n //Note...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Encodes a single segment of a resource path into the given result
function encodeSegment(segment, resultBuf) { var result = resultBuf; var length = segment.length; for (var i = 0; i < length; i++) { var c = segment.charAt(i); switch (c) { case '\0': result += escapeChar + encodedNul; break; c...
[ "function encodeUriPath(pathParam) { \n /*if (uriPath.indexOf(\"/\") === -1) {\n return encodeUriPathComponent(uriPath);\n }\n var slashSplitPath = uriPath.split('/');\n for (var pathCptInd in slashSplitPath) {\n slashSplitPath[pathCptInd] = encodeUriPathComponent(slashSplitPath[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check XRef types (whether the file uses tables or streams)
checkXrefType() { // check for xref .... trailer occurrences in file const xrefTableMatch = /[^start]xref(.*?)(?=trailer)/gs this.xrefTables = this.docString.match(xrefTableMatch) // check for /XRef dictionary entries const xrefStreamMatch = /\/XRef/gms this.xrefStreams = this.docString.match(x...
[ "function isReqXml( req ) {\n\tlet headers = req.headers;\n\treturn ( 'content-type' in headers\n\t\t\t && ( headers['content-type'].includes( 'xml' ) ||\n\t\t\t\t headers['content-type'].includes( 'XML' )));\n}", "function fileTypeValidate(fileName,fileType){\r\n\r\n\t//get file name and extention name\r\n\t//v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }