query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
return true/false if this body is orbiting the requested body
isOrbitAround(celestial) { return celestial.name === this.relativeTo; }
[ "hasCollision() {\n return this.collision != null && this.collision != undefined;\n }", "isIntersecting(_molecule) {\n //creates new vector without affecting the other vectors weve created\n let resultantV = p5.Vector.sub(this.position, _molecule.position);\n //distance is length of resultant\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse keyValueObject to get the array of key:value strings to use in Datadog metric submission
function makeTagStringsFromObject(keyValueObject) { return Object.entries(keyValueObject).map(function (_a) { var _b = __read(_a, 2), tagKey = _b[0], tagValue = _b[1]; return tagKey + ":" + tagValue; }); }
[ "values (obj) {\n\t\tlet values = [];\n\t\tfor (let key in obj) {\n\t\t\tvalues.push(obj[key]);\n\t\t}\n\t\treturn values;\n\t}", "formatResponseObject(nasdaqValue, nasdaqKey) {\n return {\n 'key' : 'key' in nasdaqValue ? nasdaqValue['key'] : '',\n 'name' : 'name' in nasdaqKey ? nasda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Port of python random.gammavariate
function gammavariate(alpha, beta) { SG_MAGICCONST = 2.504077396776274; ainv = Math.sqrt(2.0 * alpha - 1.0); bbb = alpha - 1.3862943611198906; ccc = alpha + ainv; while (1) { u1 = Math.random(); if (u1 <= 1e-7 || u1 >= .9999999) { continue; } u2 = 1.0 - Ma...
[ "static gaussRand() {\n return Math.sqrt(2 * Ex.expRand()) * Math.sin(2 * Math.PI * Math.random());\n }", "function getRandomGaussian(){\n\treturn NormSInv(Math.random());\n}", "static expRand() {\n return -Math.log(Math.random());\n }", "static cauchyRand() {\n return Math.tan(Math.PI * (Math.rand...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Language: Microtik RouterOS script
function routeros(hljs) { const STATEMENTS = 'foreach do while for if from to step else on-error and or not in'; // Global commands: Every global command should start with ":" token, otherwise it will be treated as variable. const GLOBAL_COMMANDS = 'global local beep delay put len typeof pick log time set find e...
[ "function menutoshowlang(){\n}", "function helloWorld(language) {\r\n if (language === 'fr') {\r\n return 'Bonjour tout le monde';\r\n }\r\n else if (language === 'es') {\r\n return 'Hola, Mundo';\r\n }\r\n else (language === '') {\r\n return 'Hello, World';\r\n }\r\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is called when an error is thrown by the player
function onPlayerError(errorCode) { alert("An error occured of type:" + errorCode); }
[ "function onSetupError () {\n\n popup\n .showConfirm('Something went wrong while loading the video, try again?')\n .then(function (result) {\n if (true === result) {\n $state.reload();\n }\n });\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
given a info of prices change the exchanges from null to aggregated.
function eliminateNulls(info){ for(i = 0 ; i < info.length ; i++){ if (info[i].exchange == null){ info[i].exchange = "Aggregated" } } return info }
[ "function convertPrices(price) {\n if (price !== undefined) {\n if (vat['show']) {\n price = parseFloat(price) * vat['quote'];\n }\n dataPrice = price.toFixed(2).toString().split('.');\n dataPrice[0] = dataPrice[0].replace(',', '.');\n if(dataPrice[1] === undefined){...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an element and mounting it.
injectElement() { document.body.innerHTML = ` <${this.tagName}></${this.tagName}> `; mount(this.tagName); }
[ "static attach(element) {\n return new DomBuilder(element);\n }", "mount() {\n // call this object's render method to create its HTML element\n // call this object's update method to show the current (initial) state\n // return this object's element property\n this.render();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the last candidate position from the list of candidate positions
function removeCandidatePosition() { candidatePositions.pop(); numCandidates -= 1; } // removeCandidatePosition
[ "popBack() {\n const last = this.length - 1;\n const value = this.get(last);\n this._vec.remove(last);\n this._changed.emit({\n type: 'remove',\n oldIndex: this.length,\n newIndex: -1,\n oldValues: [value],\n newValues: []\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
next and prev function to loop through the list of showingvideo functions
function nextVideo() { index == 2 ? index = 0 : index++; //loop counter functions[index](); //run //loop first before running because first func is to show vid 1 }
[ "function mouse_in_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" ] ] } }
Optional Custom function : make secure ivr session by default
function transferIVRSession() { console.log('transferIVRSession (defaults)'); loadConversationList(); let flowId = secureIdentificationFlow; makeSecureIVRSession( flowId, defaultUserData); console.log('Finish (use defaults)'); }
[ "renewSession() {\n // implement in concrete authenticator\n }", "function setSSIDCookie(req, res) {\n // res.cookie('ssid', id, { httpOnly: true });\n //when we get a new user, we get a new SSID cookie with userID\n //then we create a session with the cookie/ssid id\n sessionController.startSession(req.n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get number of customers:
function getNumberOfCustomers() { //Gives a random number return Math.floor(Math.random() * 36); }
[ "function GetCountforContractAddress(req,callback){\n\tcontractInfo.getCount(req.body.contractNumber,(error, numOfDocs)=>{\n\t\tif(error) {\n\t\t\treturn callback(error);\n\t\t} else {\n\t\t\tcallback(null, numOfDocs);\n\t\t} \n\t});\n}", "function numContacts() {\n const totalContacts = document.querySelec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a function called `printer` which logs to the console the input parameters (can have multiple number of arguments)
function printer(...args) { console.log(...args); }
[ "function multiPrint(a, b, c) {\n console.log(a)\n console.log(b)\n console.log(c)\n}", "function write() {\n var length = arguments.length;\n for (var i = 0; i < length; i++) {\n output.print(String(arguments[i]));\n if (i < length - 1)\n output.print(' ');\n }\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion Summon skill list region Summon skill show Window_SummonList region Window_SummonList
function Window_SummonList() { this.initialize(...arguments); }
[ "function showSkill(skill) {\n var content =\n '<p>' + skill.title + '</p>' +\n '<div class=\"w3-light-grey w3-round-xlarge w3-small\" style=\"color:#52B77C;\">' +\n '<div class=\"w3-container w3-center w3-round-xlarge w3-teal\" style=\"width:' + skill.skill_level + '%\">' + skill.skill_level + '%</div>' +\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates and returns an array of meshes used as shells for the Fur Material that can be disposed later in your code The quality is in interval [0, 100]
static FurifyMesh (sourceMesh, quality) { let meshes = [sourceMesh] let mat = sourceMesh.material if (!(mat instanceof FurMaterial)) throw new Error('The material of the source mesh must be a Fur Material') for (let i = 1; i < quality; i++) { let offsetFur = new BABYLON.FurMaterial(mat.na...
[ "generate() {\n\n\t\t\tlet level, scale, geometry, material;\n\n\t\t\t// Clean up.\n\t\t\tif(this.previousResolution !== this.resolution) {\n\n\t\t\t\t// Make new geoemtries and delete the old ones.\n\t\t\t\tif(this.centerGeometry !== null) { this.centerGeometry.dispose(); }\n\t\t\t\tif(this.surroundingGeometry !==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`` helper for persisting the current instance context over async/await flows.
function withAsyncContext(getAwaitable) { const ctx = getCurrentInstance(); if (( true) && !ctx) { warn(`withAsyncContext called without active current instance. ` + `This is likely a bug.`); } let awaitable = getAwaitable(); unsetCurrentInstance(); if ((0,_vue_shared__WEBPAC...
[ "static async insertContext(req, res) {\n const contextDomain = new ContextDomain();\n contextDomain.insertContext(req, res);\n }", "async makeEdgeContext() {\n const context = await makeEdgeUiContext(contextOptions)\n console.log(\"setting Context\");\n this.props.setEdgeContext(context)\n \n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
binary_media_types computed: true, optional: false, required: false
get binaryMediaTypes() { return this.getListAttribute('binary_media_types'); }
[ "get ACCEPT_UPLOAD_FILETYPES () { return OVERRIDE_OR_DEFAULT('ACCEPT_UPLOAD_FILETYPES', acceptFiletypes) }", "addmedia( sdp, codec )\n {\n switch( codec )\n {\n case \"pcmu\":\n {\n sdp.m[ 0 ].payloads.push( 0 );\n sdp.m[ 0 ].rtpmap[ \"0\" ] = { encoding: \"PCMU\", clock: \"8000\" ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read the payload from a buffer and write it into the frame. Only applies to frame types that MAY have both metadata and data.
function readPayload(buffer, frame, encoders, offset) { if ((0, _RSocketFrame.isMetadata)(frame.flags)) { const metaLength = (0, _RSocketBufferUtils.readUInt24BE)(buffer, offset); offset += UINT24_SIZE; if (metaLength > 0) { frame.metadata = encoders.metadata.decode( buffer, offset, ...
[ "bufferData(gl, funcName, args) {\n const [target, src, /* usage */, srcOffset = 0, length = undefined] = args;\n let obj;\n switch (target) {\n case ELEMENT_ARRAY_BUFFER:\n {\n const info = webglObjectToMemory.get(sharedState.currentVertexArray);\n obj = info.el...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The number of ICMP Address Mask Reply messages sent.
async getIcmpOutAddrMaskReps() { return Promise.resolve() .then(() => getNetSnmpInfo4()) .then((info) => +info.Icmp.OutAddrMaskReps % COUNTER_WRAP_AT); }
[ "function maskLength(mask, count) {\n if (mask) {\n /*jshint bitwise:false*/\n mask >>>= count;\n /*jshint bitwise:true*/\n return (Math.log(mask + 1) / Math.log(2));\n }\n return 0;\n}", "function bitCount(msg, encoding) {\n\tif (defs.encodings[encoding] === undefined) {\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the relative mouse coordinates from a mouse event
function get_relative_mouse_coordinates(event) { var mouse_x, mouse_y; if(event.offsetX) { mouse_x = event.offsetX; mouse_y = event.offsetY; } else if(event.layerX) { mouse_x = event.layerX; mouse_y = event.layerY; } return { x: mouse_x, y: mouse_y }; }
[ "function getRawCoords(e){\n \tvar mousePos = canvas.getBoundingClientRect();\n \tvar coords = {\n \t\tx : e.clientX - mousePos.left,\n \t\ty : e.clientY - mousePos.top\n \t}\n\n \treturn coords;\n }", "function canvas_mouse_coords(event, element) {\n var rcoords = relative_mouse_coords(ev...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the card field complete status to TRUE/FALSE.
function bluesnapSetFieldStatus(tagId, status) { switch (tagId) { case 'ccn': isCardNumberComplete = status; case 'exp': isExpiryComplete = status; case 'cvv': isCVVComplete = status; } }
[ "static reflectClass() {\n if (this.classList.contains('complete') !== this.complete) {\n this.classList.toggle('complete');\n }\n }", "toggle() {\n\t\tthis.save({\n\t\t\tcompleted: !this.get('completed')\n\t\t});\n\t}", "function changeStatus() {\t\n\t\tseatNum = this.querySelector(\".seat-number\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save all of the layout information currently on the screen
function saveLayoutInformation() { PM.saveProjectData({nodeData: topLevelNodes, linkData: topLevelLinks}); }
[ "save() {\n for (let id in this.windows_) {\n let elem = this.windows_[id];\n let name = elem.id;\n saveConfig(name+\"-visible\", elem.check.checked);\n saveConfig(name+\"-width\", elem.style.width);\n saveConfig(name+\"-height\", elem.style.height);\n saveConfig(name+\"-top\", elem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Strip and collapse whitespace according to HTML spec
function stripAndCollapse(value){var tokens=value.match(rnothtmlwhite)||[];return tokens.join(" ");}
[ "function collapse(value) {\n return String(value).replace(/\\s+/g, ' ')\n }", "function normaliseContentEditableHTML(html) {\n html = html.replace(openBreaks, '')\n .replace(breaks, '\\n')\n .replace(allTags, '')\n .replace(newlines, '<br>')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================== Interactions with html page Setting Up Boards ============================== removes elements of menu and calls function to create new board
function startSetUpBoard() { $('#menu').remove(); // add buttons here createOppoBoard(); createMyBoard(); $('#status').text('Pick 15 locations on your board to place your ships'); isSettingUp = true; }
[ "initBoard() {\n\n // Create the chess board.\n SHTML.Divs(8, function(index, div) {\n div.classList.add(\"chess-board-row\");\n\n // Create 8 tiles in that row.\n SHTML.Divs(8, function(letterIndex, currDiv, numberIndex) {\n currDiv.classList.add(\"ches...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method which returns the highestScoringWord score
highestWordScore() { let highestWord = this.highestScoringWord(); return Scrabble.score(highestWord); }
[ "highestScoringWord() {\n let example = Scrabble.highestScoreFrom(this.plays);\n return example;\n }", "relevance(that){cov_25grm4ggn6.f[9]++;let total=(cov_25grm4ggn6.s[47]++,0);let words=(cov_25grm4ggn6.s[48]++,Object.keys(this.count));cov_25grm4ggn6.s[49]++;words.forEach(w=>{cov_25grm4ggn6.f[10]++...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show that the mood the user selected was registered by the system
function showMoodSelectionConfirmation() { // change the color of the checkmark to reflect the mood of the user colorCheckMark(); // show the mood confirmation window switchScreens(activeWindow, document.getElementById("mood-logged-screen")); }
[ "function showMoodConfirmation(moodProposed)\n{\n document.getElementById(\"mood-image-confirmation\").href = moodNameToFilename(moodEnumToName(moodProposed));\n document.getElementById(\"mood-description-confirmation\").text = moodEnumToName(moodProposed);\n switchScreens(activeWindow, document.getElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Writes the opening tag of the current node or the entire node if it has no child nodes
openNode(node) { var att, chunk, name, ref; if (!node.isOpen) { if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) { this.root = node; } chunk = ''; if (node.type === NodeType.Element) { this.writerOptions.state = WriterState.Open...
[ "function stateSelfClosingStartTag(char) {\n if (char === '>') {\n currentTag = new CurrentTag(__assign(__assign({}, currentTag), { isClosing: true }));\n emitTagAndPreviousTextNode(); // resets to Data state as well\n }\n else {\n state ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Performs swipe left by subtracting days from displayDay and updating displayWeek
doSwipeLeft() { // If going back from Monday, need to subtract 2 days since Sundays are not displayed let daysToSubtract; if (getDay(this.displayDay) == 1) { daysToSubtract = 2; } else { daysToSubtract = 1; } this.displayDay = this.convertSunday( addDays(this.displayDay, -daysT...
[ "doSwipeRight() {\n this.displayDay = this.convertSunday(addDays(this.displayDay, 1));\n this.displayWeek = this.createDisplayWeek(this.displayDay);\n }", "setWeekDates(){\r\n\t\t$('.day-nav').find('span').each((i, el) => $(el).html(this.week[i]));\r\n\t}", "function updateUI() {\n const birthday = mo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an iterable containing all the nodes that are known.
get nodelist() { return this.nodes.values(); }
[ "function flattenIterNodes(nodes) {\n var result = []\n for (var i = 0; i < nodes.length; ++i) {\n if (nodes[i]._node.ctorName === \"_iter\") {\n result.push.apply(result, flattenIterNodes(nodes[i].children))\n } else {\n result.push(nodes[i])\n }\n }\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a new `Time` with the given duration subtracted from it.
subtract(duration) { return (0, $5c0571aa5b6fb5da$export$fe34d3a381cd7501)(this, duration); }
[ "subtract(duration) {\n return (0, $5c0571aa5b6fb5da$export$6814caac34ca03c7)(this, duration);\n }", "subtract(duration) {\n return (0, $5c0571aa5b6fb5da$export$4e2d2ead65e5f7e3)(this, duration);\n }", "subtractTime() {\n this.endTime -= 2000;\n }", "function decreaseDuration() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion para carga de datos del sistema
function cargarDatos(){ console.log("Cargando registro...") fs.readFile('../personajes/partidas/registros.json', (err, data) => { if (!err){ //fichero existe registro = JSON.parse(data); } }); console.log("Registro Cargado"); console.log('Cargando personajes...'); fs.readFile('../personajes/partida...
[ "function cargarDatosAModificar() {\n cargarDatosPersonales();\n cargarDatosDelPuesto();\n cargarFotoPerfil();\n cargarCV(); \n}", "function CargarAlumnos() {\r\n var params = \"Accion=ListarAlumnos\";\r\n var json = cargarArchivoPost(\"Default.aspx\", params);\r\n try {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display fields on the card
function displayOnCard() { nameDisplay.innerText = nameField.value; if (nameField.value.length == 0) { nameDisplay.innerText = "________________"; } cvvDisplay.innerText = cvvField.value; if (cvvField.value.length == 0) { cvvDisplay.innerText = "____"; } expiresDisplay.innerText = expiresField.val...
[ "function showCardReading(carddiv) {\r\n\t\r\n}", "renderField() {}", "function displayCard(tsv, prepend=false) {\n let curId = idCounter++\n let node = createCard(tsv, curId, true)\n if (prepend) {\n $(\"#deck-display\").prepend(node)\n } else {\n $(\"#deck-display\").append(node)\n }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the position of the corners of the object (calculates them if necessary)
getCorners() { if(!this.areCornersCorrect) this.calcCorners(); return this.corners; }
[ "calcCorners() {\n\n let degR = this.rotation*Math.PI/180;\n\n this.corners[0] = new Vector(\n this.position.x + this.length*Math.cos(degR) - this.width*Math.sin(degR),\n this.position.y + this.length*Math.sin(degR) + this.width*Math.cos(degR)\n );\n\n this.corners[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initGallery / Blog Masonry Layout
function initBlogMasonry () { var $container = $('.blog-container'); // init $container.isotope({ // options itemSelector: '.blog-selector', percentPosition: true }); }
[ "function load_masonry(nav, nxt, item, sz){\n\n if( $('#px-container').length > 0 ) {\n var $container = $('#px-container');\n \n $container.imagesLoaded( function(){\n $container.masonry({\n itemSelector : '.item',\n\tgutter : 10,\n\tisFitWidth: true,\n columnWidth : sz,\n\ttransitionDura...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
defining what Quest is
function Quest(Type, Name, Level, Experience, Item) { function mainQuest() { var main = (Type == true) ? "Main Quest":"Side Quest"; return main } this.questType = mainQuest(); this.questName = Name; this.questLevel = Level; this.questExperience = Experience; this.questItem =...
[ "function Quests(id, title, context, objective, type, required, killId, available, preQuest, turnInId, complete){\r\n\t\tthis.id = id || 1;\r\n\t\tthis.title = title || undefined;\r\n\t\tthis.context = context || undefined;\r\n\t\tthis.objective = objective || undefined;\r\n\t\tthis.type = type || 1; // 1: Kill, 2:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TransferDataSet is a list (array) of TransferData objects, which represents data dragged from one or more elements.
function TransferDataSet(aTransferDataList) { this.dataList = aTransferDataList || []; this._XferID = "TransferDataSet"; }
[ "function TransferData(aFlavourDataList)\n{\n this.dataList = aFlavourDataList || [];\n\n this._XferID = \"TransferData\";\n}", "function DataTransfer() {\r\n this._dropEffect = 'move';\r\n this._effectAllowed = 'all';\r\n this._data = {};\r\n }", "function copyDrumsList(drumList) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by KotlinParsermultiLineStringContent.
exitMultiLineStringContent(ctx) { }
[ "exitLineStringContent(ctx) {\n\t}", "exitMultiLineStringExpression(ctx) {\n\t}", "exitLineStringExpression(ctx) {\n\t}", "exitMultiVariableDeclaration(ctx) {\n\t}", "exitMultiLineStringLiteral(ctx) {\n\t}", "visitExit_statement(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "exitBlockLevelExpressio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Split this BSplineSurface into two at vk, by refining vknots
splitV(vk) { let r = this.v_degree; // Count number of times vk already occurs in the v-knot vector // We have to add vk until it occurs r-times in the v-knot vector, // where r is the v-degree of the curve // In case there are knots in the v-knot vector that are equal to vk ...
[ "splitU(uk) {\n let r = this.u_degree;\n // Count number of times uk already occurs in the u-knot vector\n // We have to add uk until it occurs r-times in the u-knot vector,\n // where r is the u-degree of the curve\n // In case there are knots in the u-knot vector that are equal ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
draw the progress pie
function draw(percent){ if(!percent) var percent = 0; var radius = Math.min(g_options.slider_progresspie_width, g_options.slider_progresspie_height) / 2; var ctx = g_objPie[0].getContext('2d'); //init the context if(g_isInited == false){ g_isInited = true; ctx.rotate(Math.PI*(3/2)...
[ "function renderPieChart() {\n var i, x, y, r, a1, a2, set, sum;\n\n i = 0;\n x = width / 2;\n y = height / 2;\n r = Math.min(x, y) - 2;\n a1 = 1.5 * Math.PI;\n a2 = 0;\n set = sets[0];\n sum = sumSet(set);\n\n for (i = 0; i < set.length; i++) {\n ctx.fillStyle = getColorForIndex(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract information for all indicators for a city from its respective ONS website
function get_site (input, city) { request({ uri: input, }, function(error, response, body) { if (error) { console.log(error); } else { var regex; var regex1 = /^<td>([0-9a-zA-Z.]+)<\/td>$/; var result; var result1; var lines = body.split("\n"); var lines_len...
[ "async getInfo(city) {\n // complete request\n const query = `?action=query&formatversion=2&format=json&origin=*&prop=extracts|info|pageimages&inprop=url&piprop=thumbnail&pithumbsize=300&exchars=500&explaintext&exintro&exsectionformat=plain&redirects=1&titles=${city}`;\n const response = await fetch(this.w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
doubleD Function doubleD stands for done / delete if the event / action of the parameter is done then done ajax will run if the parameter is delete then the delete ajax will run
function doubleD(evt) { evt.preventDefault(); var action = evt.data.action; // ACCESS THE PARAMETER HERE var $clicked = $(this); //Making sure only work with the current element var $cLI = $clicked.closest('li'); //Find the closest li element clicked //Goes to the closest li ...
[ "function del_step(id_etape,resulat_test,reponse)\r\n{\r\n\tif(typeof(reponse) == \"undefined\")\r\n\t{\r\n\r\n\t\t/**==================================================================\r\n\t\t * Vérification ok, suppression possible\r\n\t\t ====================================================================*/\t\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function requests new data from Live.getLastVisitsDetails and updates the symbols on the map. Then, it sets a timeout to call itself after the refresh time set by Piwik If firstRun is true, the SymbolGroup is initialized
function refreshVisits(firstRun) { if (lastTimestamp != -1 && doNotRefreshVisits && !firstRun ) { return; } /* * this is called after new visit reports came in *...
[ "function gotNewReport(report) {\n // if the map has been destroyed, do nothing\n if (!self.map || !self.$element.length || !$.contains(document, self.$element[0])) {\n return;\n }\n\n // successful request, so set ti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a contact in your device contacts database
function createContact() { var contacts = new Appworks.AWContacts(); // Gather properties from your form var name = document.getElementById("contact-name").value; var number = document.getElementById("contact-number").value; // Create a new contacts object var contact = new Contact(); // Set properties...
[ "async function createContact(client, contact) {\n const res = await client.request('POST', '/contacts', { contact: contact });\n\n return res.contacts[0];\n}", "function createContact(custCode,so,callback){\n\t// Create contactCode\n\tvar genCode=new Request(\"DECLARE @docCode NVARCHAR(30);EXEC [dbo].GenerateD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine which icon to display depending on whether the app is run on an Android or iOS device
displayDeviceIcon() { if (isiOS) { return ( <Ionicons style={styles.iconMore} name="ios-more" size={20} color="rgba(50, 50, 50, 0.4)" /> ); } else { return ( <Ionicons style={styles.iconMore} name="md-more" ...
[ "get icon_type() {\n return this.args.icon_type;\n }", "function fnIconize(tipo) {\n var icon = '';\n switch (tipo) {\n case 'skill':\n icon = 'flash_on';\n break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function loading 3 buttons on the page
function loadContentThreeButtons() { //start buttons html var btnHtml = ''; btnHtml += '<fieldset class="ui-grid-b">'; btnHtml += '<div class="ui-block-a"><button id="searchBtn" data-theme="a" value="1" class=" ui-btn ui-btn-a ui-shadow ui-corner-all">搜尋日期</button></div>'...
[ "function dl_buttons() {\r\n\t// button for each story\r\n\tfor (var set of set_list.sets) {\r\n\t\tvar set_i = set_list.sets.indexOf(set);\r\n\t\tvar set_ele = gcl(\"set\")[set_i];\r\n\t\tfor (var story of set) {\r\n\t\t\tvar story_i = set.indexOf(story);\r\n\t\t\t// story text button\r\n\t\t\tvar button = documen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a GoogleMaps marker based on the provided vessel
function convertToGoogleMarker( map, vessel){ // Sample custom marker code created with Google Map Custom Marker Maker // http://www.powerhut.co.uk/googlemaps/custom_markers.php // marker images taken from or inspired by http://mapicons.nicolasmollet.com/markers/ var image = new google.maps.MarkerImage...
[ "function convertToGoogleMarkers(map, vessels){\n var googleMarkers = [];\n $(vessels).each(function () {\n var marker = convertToGoogleMarker(map, this);\n googleMarkers.push(marker);\n });\n\n console.log(\"Add markers to map\");\n\n return googleMarkers;\n}", "function markerMaker(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : getDomainInfo AUTHOR : Mark Anthony Elbambo DATE : January 07, 2013 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : gets the info of the Active Resource Domain PARAMETERS :
function getDomainInfo(){ var url = getURL("ConfigEditor","JSON"); if(globalDeviceType == "Mobile"){ loading('show'); } var InfoType = "JSON"; var query = {"QUERY":[{"user":globalUserName}]}; query = JSON.stringify(query); console $.ajax({ url: url, data : { "action": "domaininfo", "quer...
[ "function getSelectedDomain() {\n var dName = document.getElementById(\"domainName\"); \n var selectedDomain = dName.options[dName.selectedIndex].value;\n \n return selectedDomain;\n} // end of \"getSelectedDomain\" function", "get domain() {\n var result = 'unknown';\n if (this.sourceInf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `CfnResolverProps`
function CfnResolverPropsValidator(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.strin...
[ "function CfnGatewayRoute_GatewayRouteMetadataMatchPropertyValidator(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('Expe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of function close_OnClick / Name: eject_OnClick / Description: Ejects the disk and resets the bookmark.
function eject_OnClick() { try { DVD.Stop(); DVD.Eject(); DVD.ResetState(); } catch(e) { e.description = L_ERROREject_TEXT; HandleError(e, true); return; }/* end of function eject_Onclick */ }
[ "function clearBookmarks()\n{\n\n for (ii = 0; ii < maxChapters; ii++)\n {\n\n for (jj = 0; jj <= maxSections; jj++) //Since there are six sections (include chapter start page)\n {\n var name = chapterIDs[ii][jj];\n\n window.localStorage.removeItem(name); //Go through and r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
give this entity an AI and set it as an AI object
giveAI() { this.isAI = true; this.AIcontroller = new AIController(this); }
[ "function addAI() {\n\n\tif (!availableIDs.length) {\n\t\t// No more room\n\t\treturn;\n\t}\n\n\tlogger.info(\"Adding AI\");\n\n\tclientCount++;\n\tvar playerID = availableIDs.pop();\n var newHand = new Hand(0);\n\tvar ai = new Player(playerID, null, \"Agent \" + playerID, newHand);\n\n\t// Give hand to new player...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET DATES FORM getDatesForm gets dateselector form
function getDatesForm(use_tiled_background, cb) { _self.emit("log", "DateSelector.js", "getDatesForm()", "info"); var dataToSend = {}; dataToSend.device = _device; dataToSend.use_tiled_background = use_tiled_background; dataToSend.token = _token; dataToSend.what = 'GET_DATES_SELECTOR_FORM'; ...
[ "function captureDateArray( dayControlName, monthControlName )\n{\n\tvar day_elem\t= eval ('document.skylightsForm.' + dayControlName);\n\tvar mon_elem\t= eval ('document.skylightsForm.' + monthControlName);\n\tvar dateArray\t= [];\n\tdateArray[0]\t= mon_elem.options[ mon_elem.selectedIndex ].value.substr(0,4);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set accesstoken to local storage
setAccessToken(token) { localStorage.setItem('accessToken', token); }
[ "function storeAccessToken(token) {\n console.log('Storing access token');\n chrome.storage.local.set({token: token}, function() {\n if (chrome.runtime.lastError) {\n console.log('Error: unable to store access token');\n console.log(chrome.runtime.lastError);\n document.getElementById('oauthMess...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fills the placeholders in the message.
function fillPlaceholders(message, params) { return Function(...Object.keys(params), `return \`${message}\``)(...Object.values(params)); }
[ "function fillData(key, values) {\n\t\tvar fields = \"\";\t\n\t\tvar type = \"\";\n\t\tvar tagName = \"\";\n\t\tvar pathFields = null;\n\t\tvar instanceObject = [];\n\t\t\n\t\tif(key === 'statusCode'){\n\t\t\tfields = \"\";\t\n\t\t\ttype = \"CS\";\n\t\t\ttagName = \"statusCode\";\n\t\t\tpathFields = fields.split(',...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
How to test for valid selector syntax
function isValidSelector( selector ) { try { $( selector ) } catch ( error ) { return false }; return true; }
[ "function isNotValidSelector(selector) {\n return !_.isString(selector) && !(_.isObject(selector) && _.isString(selector.every));\n}", "matches (selector) {\r\n const el = this.node;\r\n return (el.matches || el.matchesSelector || el.msMatchesSelector || el.mozMatchesSelector || el.webkitMatchesSelector ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
May 4 Challenge Create a function that returns the sum of the two lowest positive numbers given an array of minimum 4 integers. No floats or empty arrays will be passed. For example, when an array is passed like [19, 5, 42, 2, 77], the output should be 7. [10, 343445353, 3453445, 3453545353453] should return 3453455. S...
function sumTwoSmallestNumbers(numbers) { let arrayNumFour = [55, 87, 2, 4, 22] //set the order of the array, either < , >, or vice versa arrayNumFour.sort() console.log(arrayNumFour) //write a line of code to find the lowest values // return sum of lowest values }
[ "function sumPositiveNumbers(array) {\n function compare(num1,num2){\n if(num2>0){\n return num1+num2;\n }else {\n return num1;\n }\n }\n return array.reduce(compare,0);\n }", "function findMinimumValue(array) {\n\n}", "solution(arr, x) {\n\n // Sort the arr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserunit_statement.
visitUnit_statement(ctx) { return this.visitChildren(ctx); }
[ "function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseCounter][1]; //check type of token\n\n\tif (tempDesc == ' print' || tempType == 'identifier' || tempType == 'type' || tempDesc == ' while' || tempDesc == ' if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : limitiPortTabsShow AUTHOR : Krisfen G. Ducao DATE : March 7, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : PARAMETERS :
function limitiPortTabsShow(val,id,limit,type,tabnum){ if (type == 'slotmodule'){ if(limit=="empty"){ var limit = $("#inputSlotModule").val(); } var limit = parseInt(limit); var tabsetmax = val*7; var tabsetmin = val*7-6; $(".plimitshow").hide(); for(var a=1; a<=limit; a++){ if(a<=tabsetmax && a>=t...
[ "function dynamicPortTab(num,id,name,limit){\n\tvar tab = \"\";\n\tvar msg = \"Port per device is over the limit.\\n\"\n\tmsg += \"Maximum ports perr device is 256.\"\n\tif (num>=limit) {\n\t\terror(msg,\"Notification\")\t\n\t\tvar val = 0;\t\n\t\treturn 0;\n\t}\n\tif(num==\"\"){return 0;}\n\tfor(var a=1; a<=num; a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets a global script lock to prevent concurrent runs, throws exception if lock could not be acquired
function getScriptLock(){ if (constants.lock) throw new Error('Global script lock already exists'); constants.lock = LockService.getScriptLock(); constants.lock.waitLock(10000); }
[ "function SingletonLock() {}", "get locked() { return false }", "get locker() {\n return this._locker || (this._locker = new InMemoryLock())\n }", "lock() {\n const iab = this.iab;\n const stateIdx = this.ibase;\n var c;\n if ((c = Atomics.compareExchange(iab, stateIdx,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parser for table where both rows and columns are labeled
function parseLabeledRowsCols(entries) { var res = {}; entries.forEach(function (entry) { res[entry.title.$t] = parseLabeledRow(entry.content.$t); }); return res; }
[ "function parseLabeledCols(entries) {\n return entries.map(function (entry) {\n return parseEntry(entry);\n });\n }", "function parseTable() {\n var name = t.identifier(getUniqueName(\"table\"));\n var limit = t.limit(0);\n var elemIndices = [];\n var elemType = \"a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
15. Write a function called padEnd, which accepts a string and a number and pads the string on the right side if it's shorter than the length. By default, it will pad the string with whitespace. However, you can also provide a third argument to padEnd which will specify how it should pad the output string. Padding char...
function padEnd(str,num, pad){ if (num < str.length) return str; if (str.length < num){ if (arguments.length === 3){ let diff = Math.ceil((num-str.length)/pad.length); for (let i = 0; i < diff; i++){ str += pad; } } else if ( arguments.length === 2) { let diff2 = num-st...
[ "function pad(input, length, padWith)\n{\n var blank = \"\";\n for (var i=0; i<length; i++)\n {\n blank += String(padWith);\n }\n return (blank + String(input)).slice(length * -1);\n}", "function pad_right(s, width, fill) /* (s : string, width : int, fill : ?char) -> string */ {\n var _fil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selecciona o deselecciona el segundo dado
function seleccion1(){ if (juego.getContador() !=0 && juego.getContador() !=3){ tmpDados=juego.getDados(); if(tmpDados[1].seleccionarDado()){ img="Imagenes/" + tmpDados[1].getValor() + ".png" $("#dado1").attr("src",img); } else{img="Imagenes/" + tmpDados[1].getValor() + ".gif" $("#dado1").attr("src",i...
[ "selectNext() {\n\n // select the next, or if it is the last entry select the first again\n if (this.selected >= this.sequence.length - 1) {\n this.selected = 0;\n }\n else {\n this.selected++;\n }\n\n // highlight the selected entry\n this.high...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The AWS::Neptune::DBSubnetGroup type creates an Amazon Neptune DB subnet group. Subnet groups must contain at least two subnets in two different Availability Zones in the same AWS Region. Documentation:
function DBSubnetGroup(props) { return __assign({ Type: 'AWS::Neptune::DBSubnetGroup' }, props); }
[ "function SubnetGroup(props) {\n return __assign({ Type: 'AWS::DAX::SubnetGroup' }, props);\n }", "function SubnetGroup(props) {\n return __assign({ Type: 'AWS::ElastiCache::SubnetGroup' }, props);\n }", "function ClusterSubnetGroup(props) {\n return __assign({ Typ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
security_groups computed: true, optional: false, required: false
get securityGroups() { return this.getListAttribute('security_groups'); }
[ "function userform_addGroupToUser() {\n\tvar RN = \"userform_addGroupToUser\";\n\tvar su = userform_lookupSelectedUser();\n\tvar agl = document.getElementById('AvailableGroupList');\n\tvar gl = document.getElementById('GroupList');\n\tif (agl && gl) {\n\t\tunHighLightList(\"GroupList\");\n\t\tunHighLightList(\"A...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a collection from the DB, based on its name. If the required collection doesn't exist, it will be created with the given options, then returned.
function getCollection(name, options) { return start(name).then(function() { // db.removeCollection(name); var coll = db.getCollection(name); if (coll) return coll; $log.log(TAG + 'getCollection:' + name + ' options', options); coll = db.addCollection(name, options); ...
[ "async createCollection(name) {\n\t \tthis.db.createCollection( name )\n\t}", "createNewCollection(){\n // return this.db.createCollection(name)\n }", "function prefixModuleContext(collectionName, res) {\n if (db._collection(collectionName) != null) {\n return db._collection(collection...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Edit a subtask record
editSubtask (subtaskId, key, value) { console.log('editSubtask:', subtaskId, key); let user = Auth.requireAuthentication(); // Validate the data is complete check(subtaskId, String); check(key, String); check(value, Match.Any); // Load the subtask to authorize the edit let subt...
[ "function editGoal() {\n\t\tprops.editTask(props.goalId);\n\t}", "update(_task) {\n const { id, task, date, process } = _task\n let sql = `UPDATE tasks\n SET task = ?,\n date = ?,\n process = ?\n WHERE id = ?`;\n return this.dao.run(sql, [task, date...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends the week number to the document body
function show_me_the_week_number() { var d = new Date(); var s = "WEEK #" + d.getWeek(); var e = document.createTextNode(s); document.body.appendChild(e); }
[ "function formatWeek( week ) {\n var week$ = {\n days: [],\n number: parseInt( weekNum ) + 1\n };\n\n for ( var dayKey in week ) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that is executed on the document.ready() event of the landing results page This function gets the email from the url and makes the AJAX petition to the provided API. With the obtained data, it prints the user information with template literals.
function userSearch(){ email= location.search.split('email=')[1]; $.ajax({ url: `https://ltv-data-api.herokuapp.com/api/v1/records.json?email=${email}`, cache: false, contentType: false, processData: false, method: 'GET', type: 'GET', success: function(dat...
[ "function emailCheck(){\r\n\tvar valueOfEmail = $(\"email\").value;\r\n\t\r\n\tnew Ajax.Request(\"registration_data3.php\",\r\n\t{\r\n\tmethod: \"post\",\r\n\tparameters: {email:valueOfEmail},\r\n\tonSuccess: displayResult2\r\n\t} );\r\n}", "function showPatientInformation() {\n jQueryWriteTextToHTML(\"#patien...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============ 4.FUNCTION MOBIL MENU===========
function sgny_mobil_menu(){ $('#mobil_menu').slimmenu({ resizeWidth: '800', collapserTitle: '', animSpeed: 'medium', easingEffect: null, indentChildren: false, childrenIndenter: '&nbsp;', expandIcon: '<i class="fa fa-angle-down"></i>', collapseIcon: '<i class="fa fa-angle-up"></i>' }); $("#mobil_men...
[ "function AddCustomMenuItems(menu) {\r\n menu.AddItem(strHelp, 0, OnMenuClicked);\r\n}", "static onSelect() {\n const node = Navigator.byItem.currentNode;\n if (MenuManager.isMenuOpen() || node.actions.length <= 1 ||\n !node.location) {\n node.doDefaultAction();\n return;\n }\n\n Act...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If there is a weapon, handle it by removing the class and replacing it with the current one of the player
function weaponChange(element, player){ let playerWeapon = player.currentWeapon; if(element.hasClass("weapon-1")){ element.removeClass("weapon-1"); element.addClass(playerWeapon.className); player.currentWeapon = weapons[0]; weaponDisplay(player); getItem.play(); } else if(elem...
[ "function replaceWeapon(value, weapon, num) {\n let tile = $('.box[boxID= ' + num + ']');\n whoIsActive();\n tile.removeClass(weapon).addClass(playerActive.weapon);\n playerActive.weapon = weapon; \n playerNotActive.power = value; \n}", "function weaponSwitch($clickedSquare, weaponString...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This streams in a value into the filter and outputs the next computed value
stream(value) { let out = 0; this.filter.pop(); this.filter.unshift(value); for (let i = 0, end = this.coefficients.length; i < end; ++i) { out += this.coefficients[i] * this.filter[i]; } this.filter.shift(); this.filter.unshift(out); return out; }
[ "run(start, values) {\n const current = this.filter.slice(0);\n const toProcess = values.slice(0);\n this.reset(start);\n const out = [];\n\n while (toProcess.length > 0) {\n out.push(this.stream(toProcess.shift() || 0));\n } // Reset the filter back to where it was\n\n\n this.filter = cur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a command line argument calculate the result of operations on the given fractions. Example run: 1/2 3_3/4 = 1_7/8 2_3/8 + 9/8 = 3_1/2 The general algorithm is 1. convert the string fractions to floating point numbers 2. do the specified operation on the two floats 3. convert the result back to a string fraction r...
function calcFractions(argArr) { const [a, operator, b] = argArr const result = calcRaw(fracToFloat(a), operator, fracToFloat(b)) console.log(`${a} ${operator} ${b} = ${floatToFrac(result)}`) }
[ "function mixedFraction(s){\n //Split into array of two numbers\n var numbers = s.split('/');\n \n //If denominator of fraction is zero, throw error\n if (numbers[1] === '0') {\n throw \"zero division error\";\n //If numerator of fraction is zero, return 0\n } else if (numbers[0] === '0') {\n return '0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsertruncate_table.
visitTruncate_table(ctx) { return this.visitChildren(ctx); }
[ "truncate() {\n const table = this.tableName\n return {\n sql: `delete from ${table}`,\n output() {\n return this.query({\n sql: `delete from sqlite_sequence where name = ${table}`\n }).catch(noop)\n }\n }\n }", "visitDrop_table(ctx) {\n\t return this.visitChildren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bindings for the GaemWorld to Ammo.js
function AmmoBinding () { var collisionConfiguration = new Ammo.btDefaultCollisionConfiguration(); var dispatcher = new Ammo.btCollisionDispatcher(collisionConfiguration); var overlappingPairCache = new Ammo.btDbvtBroadphase(); var solver = new Ammo.btSequentialImpulseConstraintSolver(); this.dynamicsWorld ...
[ "load () {\n this.world = new window.World(this.game.ressources['map'])\n }", "function GizmoManager(scene){var _this=this;this.scene=scene;this._gizmosEnabled={positionGizmo:false,rotationGizmo:false,scaleGizmo:false,boundingBoxGizmo:false};this._pointerObserver=null;this._attachedMesh=null;this._boundingBox...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
low and high are ints representing roll results val is rollable, obj, or string
function row(val, low, high) { var args = args_array(arguments, 1).map(make_int).filter(is_not_NaN); var min = smallest(args); var max = biggest(args); var value = val; var roll = function() { return value; }; var check = function(n) { return min <= n && n <= max; }; var ...
[ "function recursiveHighLow(data){if(data===void 0){return void 0}else if(babelHelpers.instanceof(data,Array)){for(var i=0;i<data.length;i++){recursiveHighLow(data[i])}}else{var value=dimension?+data[dimension]:+data;if(findHigh&&value>highLow.high){highLow.high=value}if(findLow&&value<highLow.low){highLow.low=value...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Paste your function create_dtmf_tone from Task 2 here
function create_dtmf_tone(frequency_pair) { return simultaneously(list(sine_sound(head(frequency_pair), 0.5), sine_sound(tail(frequency_pair), 0.5))); }
[ "constructor () {\r\n this.context = new AudioContext(); //AudioContext for Oscillators to generate tones\r\n this.debug = false;\r\n this.duration = Piano2.DEFAULT_DURATION;\r\n this.toneType = Piano2.DEFAULT_TONE;\r\n }", "function texttoMusic(string) {\n \n //There are three different synths use...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Interactively select a team from the API
async function selectTeamFromAPI() { let competitionId; let competitions = await Api.getCompetitions(); let captions = competitions.map((competition) => { return competition.caption; }); let ids = competitions.map((competition) => { return competition.id; }); let compIndex =...
[ "function goToTeamSelection(){\n clientValuesFactory.setActiveWindow(windowViews.selectTeam);\n }", "function selectTeam(team) {\n selectedTeam = team;\n team.classList.add(\"select\");\n\n const opponent = team == teamA ? teamB : teamA;\n if (opponent.classList.contains(\"select\")) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hides the tooltip after the delay in ms, defaults to tooltipdelayhide or 0ms if no input
hide(delay = this.hideDelay) { if (this._tooltipInstance) { this._tooltipInstance.hide(delay); } }
[ "function toolTipMiss(tooltip,formatTime,d) {\t\r\n\ttooltip.html(formatTime(d.Day) + \"<br/>mean: \" + d.Temperature + \"&degF\" + \"<br/><i>(imputed: \" + d.Orig + \"&degF)</i>\"); \r\n\t//tooltip.html(formatTime(d.Day) + \"<br/>mean: \" + d.Temperature + \"&degF<br/><i>user-placed dot</i><br/><i>(orig loc: \" +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
preload a given list of groups
static async load({ groups = [], onProgress = null, onComplete = null } = {}) { const promises = []; let progress = 0; for (let audioName in SuperAudioManager.audios) { const audio = SuperAudioManager.audios[audioName]; const hasGroup = group...
[ "function applyGrouping(groups) {\n var order = 0;\n groups.forEach(function (group, groupNumber) {\n group.forEach(function (player) {\n player.grouping = groupNumber;\n player.start_order = order;\n\n order++;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if any tile's visibility changed
updateTileStates() { const refinementStrategy = this.opts.refinementStrategy || STRATEGY_DEFAULT; const visibilities = new Array(this._cache.size); let i = 0; // Reset state for (const tile of this._cache.values()) { // save previous state visibilities[i++] = tile.isVisible; tile....
[ "isCurrentlyDisplayed() {\n //Get current zoom level\n let zoomLevel = this.map.getView().getZoom();\n //Check visibility\n return this.isVisibleAtZoomLevel(zoomLevel);\n }", "updateVisibility() {\n //Get current zoom level\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the title of the current HTML document.
setTitle(newTitle) { this._doc.title = newTitle || ''; }
[ "_updateTitle() {\n let ttl = '';\n if (this._curPage) {\n ttl = this._curPage.title();\n }\n document.title = this._rootArea.title(ttl);\n }", "set title(title) {\n if (Lang.isNull(title)) {\n this._study.title = null;\n return;\n }\n let titleObj = ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
widgetID: A sdk/widget ID Returns: The ID of the corresponding element.
function getWidgetId(widgetId) { // This method is based on code in sdk/widget.js, look for setAttribute("id", id); // Temporary work around require("self") failing on unit-test execution ... let jetpackID = "testID"; try { jetpackID = require("sdk/self").id; } catch(e) {} return "widge...
[ "function getWidget(inside, name, entry_id) {\n\tif (entry_id == undefined) {\n // We expect an element which has a form_number in it somewhere but we don't know\n\t\t// what number. So if there is a form_number in there, we'll use a querySelector\n\t\t// to find the first element that matches the pattern.\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refresh the plot with a new width
function resizedw(){ resizegraph(); plotWithOptions(wg(formatedData), options); }
[ "function redrawChart() {\n\tif ($(window).width() != windowWidth) {\n\t\tinit();\n\t\twindowWidth = $(window).width();\n\t}\n}", "function updateLineWidth(size) {\r\n clearCanvas(); /* Clear the Canvas first */\r\n sliderInt = size;\r\n drawcells(); /* Redraw the cells */\r\n}", "function resizeGraph() {\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get cached clean board, using memoize from ramda.
function getCleanBoard(boardSize) { return _getCleanBoard(boardSize); }
[ "getRandomEmptyBoardPiece() {\n\t\tconst b = this.board;\n\t\tconst s = this.boardSize;\n\t\tconst r = Math.floor(Math.random() * s);\n\t\tconst c = Math.floor(Math.random() * s);\n\t\tif (b[r][c]) return this.getRandomEmptyBoardPiece();\n\t\telse return {r, c}\n\t}", "function getBoard(){\n\tvar size = 8;\n\tvar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO Functional Programming: Remove Elements from an Array Using slice Instead of splice A common pattern while working with arrays is when you want to remove items and keep the rest of the array. JavaScript offers the splice method for this, which takes arguments for the index of where to start removing items, then th...
function nonMutatingSplice(cities) { return cities.splice(0, 3); }
[ "function dropElements(arr, func) {\n var startArray = arr;\n var finalArray = startArray;\n for (var i=0; i<startArray.length; i++) {\n if (!(func(arr[i]))) {\n finalArray = startArray.slice(i+1, startArray.length);\n } else {\n return finalArray;\n }\n }\n return [];\n}", "function array...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
transpile the input string, using the input options
function transform(string, options) { return Promise.resolve().then(() => { try { let result = transpiler.transform(string, ParallelApi.deserialize(options)); return { code: result.code, metadata: result.metadata }; } catch (error) { return { error: error.messa...
[ "function precompileTemplate(templateString, importIdentifiers = [], precompileOptions = {}) {\n const scope = t.objectExpression(\n importIdentifiers.map((id) => t.objectProperty(t.identifier(id), t.identifier(id)))\n );\n\n let ast = _precompileTemplate(parse, templateString, scope, precompileOptions);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a new ``bytes16`` type for %%v%%.
static bytes16(v) { return b(v, 16); }
[ "static bytes24(v) { return b(v, 24); }", "static bytes17(v) { return b(v, 17); }", "static bytes(v) { return new Typed(_gaurd, \"bytes\", v); }", "static bytes15(v) { return b(v, 15); }", "static bytes8(v) { return b(v, 8); }", "static bytes21(v) { return b(v, 21); }", "static bytes23(v) { return b(v, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create webtypes.json to provide autocomplete in JetBrains IDEs
function genWebTypes(tags, options) { return { $schema: 'https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json', framework: 'vue', name: options.name, version: options.version, contributions: { html: { tags, ...
[ "function buildWebTypes() {\n const analysis = loadAnalysis();\n\n const packageJson = JSON.parse(fs.readFileSync(`./package.json`, 'utf8'));\n const entrypoints = analysis.modules.filter((el) => !el.path.startsWith('lib'));\n\n const plainWebTypes = createPlainWebTypes(packageJson, entrypoints);\n const plain...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an object containing the table entries, indexed by objectID, for serializing an Automerge document to JSON.
toJSON() { const rows = {} for (let id of this.ids) rows[id] = this.byId(id) return rows }
[ "function DataObject()\n{\n this.tableToRowList = new Object(); //Contains the mapping between tables and rows\n this.tableArray = new Array(0);\n this.getRowsForTable = getRowsForTable;\n this.addRowsForTable = addRowsForTable; \n this.containsTable = containsTable; \n this.getTableIndex = getTableIndex;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Vuex init hook, injected into each instances init hooks list.
function vuexInit () { var options = this.$options; // store injection if (options.store) { this.$store = typeof options.store === 'function' ? options.store() : options.store; } else if (options.parent && options.parent.$store) { this.$store = options.parent.$store; ...
[ "initServices () {\n this.services.db = new DBService({\n app: this,\n db: this.options.dbBackend\n })\n this.services.rpcServer = new RPCServerService({\n app: this,\n port: this.options.rpcPort\n })\n this.services.jsonrpc = new JSONRPCService({\n app: this\n })\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the name of the unit's homecity.
function get_unit_homecity_name(punit) { if (punit['homecity'] != 0 && cities[punit['homecity']] != null) { return decodeURIComponent(cities[punit['homecity']]['name']); } else { return null; } }
[ "function getLocationName() {}", "function getCityCurrent(){\n \n}", "function getSearchLocation() {\n\tvar city = $('.location').val();\n\tcity = toTitleCase(city).replace(/\\s+/g, '+');\n\treturn city;\n}", "function cityFacts(city) {\n let output = city.name + \" has a population of \" + city.populatio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions builds masterDeck for game, used in tempDeck and for shuffledDeck previously provided JClark code
function buildMasterDeck() { const deck = []; // Use nested forEach to generate card objects suits.forEach(function (suit) { ranks.forEach(function (rank) { deck.push({ // The 'face' property maps to the library's CSS classes for cards face: `${suit}${rank...
[ "function generateDeck(){\n // Generate a card number holder so we never re-use cards\n for(i=0;i<52;i++){\n app.unpickedCards.push({cardNumber:i});\n }\n\n var suits = [\n { name:'S','display':'Spades'},\n { name:'H','display':'Hearts'},\n { name:'D','display':'Diamonds'},\n { name:'C','display'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show icon if checked when answer is checked / selected / filled
function showIconIfChecked() { showIconIfCheckedQ1(); showIconIfCheckedQ2(); showIconIfCheckedQ3(); showIconIfCheckedQ4(); showIconIfCheckedQ5(); }
[ "showCorrectUpvoteIcon(answerid) {\n const upvotedAnswers = this.props.auth.user.upvotedAnswers\n if (upvotedAnswers.includes(answerid)) {\n return (\n <>\n <i className=\"material-icons float-left mr-2\" style={upvotedStyle}>arrow_upward</i>\n </>\n )\n } else {\n ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update global variable of selectedJSON from app.mapN.geojson.eachLayer
function updateSelectedGeoJSON(mIDX) { app.selectedGeoJSON = {"type":"FeatureCollection", "features":[]}; app[mIDX].geojson.eachLayer(function(layer) { app.selectedGeoJSON.features.push(layer.feature); }) }
[ "function change_geojson(evt) {\n var ctl = $(evt.target),\n value = ctl.val();\n\n\n fromGeojsonUpdate = true;\n var result = layer.geojson(value, 'update');\n if (query.save && result !== undefined) {\n var geojson = layer.geojson();\n query.geojson = g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
deleteManifest does a `kubectl delete` of the RateLimit manifest
deleteManifest() { console.log(">>> Deleting manifest in " + kubectlURL) fetch(kubectlURL, { method: 'DELETE', body: this.props.manifest, }); }
[ "function deleteManifest() {\n if (manifestExists()){\n fs.unlinkSync(testManifestPath);\n }\n}", "static deleteAction(drmPolicyId){\n\t\tlet kparams = {};\n\t\tkparams.drmPolicyId = drmPolicyId;\n\t\treturn new kaltura.RequestBuilder('drm_drmpolicy', 'delete', kparams);\n\t}", "function AM_policy_delete(a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
writeLength write an MQTT style length field to the buffer
function writeLength(buffer, pos, length) { var digit = 0 , origPos = pos do { digit = length % 128 | 0 length = length / 128 | 0 if (length > 0) { digit = digit | 0x80 } buffer.writeUInt8(digit, pos++, true) } while (length > 0) return pos - origPos }
[ "char_length() {\n return [...this.buf].length;\n }", "_ensureCanWrite(length) {\n const increaseBy = this._byteOffset + length - this._buffer.length;\n if (increaseBy > 0) {\n this._increaseBuffer(increaseBy);\n }\n }", "function length () {\r\n return this.node....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filter the Deckbuilder cards
function filterDeckbuilder(data, search) { console.log("filderDeckbuilder('"+data+"', '"+search+"')"); // grab all the cards so we can modify them const cards = document.querySelectorAll('.decklist'); // grab only the cards that match the data-attribute=value condition const matches = document.qu...
[ "filterCards(searchName) {\n Array.from(this.cards).forEach(card => {\n const name = card.querySelector(\".card-name\").innerText.toLowerCase();\n card.style.display = name.includes(searchName.toLowerCase())\n ? \"flex\"\n : \"none\";\n });\n }", "function renderFilteredCards(e) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prints the entire network
print() { for (let layer = 0; layer < this.nodes.length; layer++) { for (let node = 0; node < this.nodes[layer].length; node++) this.nodes[layer][node].print(); } }
[ "printConsole() {\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].printConsole();\n }\n }", "printNodes() {\n for (let layer = 0; layer < this.nodes.length; layer++) {\n for (let node = 0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NOTE! Due to the inability to guarantee real constant time evaluation of anything in JavaScript VM, this is module is the best effort. Returns resultIfOne if subject is 1, or resultIfZero if subject is 0. Supports only 32bit integers, so resultIfOne or resultIfZero are not integers, they'll be converted to them with bi...
function select(subject, resultIfOne, resultIfZero) { return (~(subject - 1) & resultIfOne) | ((subject - 1) & resultIfZero); }
[ "function Logical (type, ax, bx) {\n var result = {value: null, // the result of the Logical operation\n diff : 0, // number of bits that are different between ax and bx\n change : 0, // estimate of the number of bits that need to be changed to get to eaither ax or bx from .value\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_timeChecked getter and setter
get timeChecked() { return this._timeChecked; }
[ "updateTimeField(timeField) {\n const me = this;\n\n timeField.on({\n change({ userAction, value }) {\n if (userAction && !me.$settingValue) {\n const dateAndTime = me.dateField.value;\n me._isUserAction = true;\n me.va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functien trigered when an item is clicked ==> add color primary to list items and toggle hide/show subfolders
function itemClicked(){ $(".listing-container li > div").off().on("click",function(){ if ($(this).children("i:first-child").hasClass("permision_ok") ){ ulelment=$("[path='"+$(this).parent("li").attr("path")+"']").find("ul") //ajaxGetChildren($("#"+$(this).parent(...
[ "function onFolderIconClick() {\n const folderId = $(this).siblings('a').attr(\"data-id\");\n if (fileSystem.hasSubfoldersById(folderId)) {\n $(this).parent().toggleClass(\"collapsed\");\n }\n }", "function onFolderNameClick() {\n var clickedLink = $(this);\n if (c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function that generates a default pin template for the specific pin required
function generatePinTemplate(location, pinImg) { var pin = new Microsoft.Maps.Pushpin({ latitude: location.latitude, longitude: location.longitude }, { anchor: new Microsoft.Maps.Point(8, 8), icon: "/images/" + pinImg + ".png", width: 40, height: 40 }); return pin; }
[ "function generatePin() {\n document.getElementById('show-pin').value = getPin();\n}", "getTemplate(type) {\n switch (type) {\n case SHIP_TYPE_1:\n return SHIP_TYPE_1_TEMPLATE;\n\n case SHIP_TYPE_2:\n return SHIP_TYPE_2_TEMPLATE;\n\n case SHIP_TYPE_3:\n return SHIP_TYPE_3...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }