query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Fonction qui permet de mettre les audio en pause
function pauseAudio() { audioHelp.pause(); audioGood.pause(); audioBad.pause(); audioPlay.pause(); }
[ "function audioPause() {\n\t\t$(\"#audio-player\")[0].pause();\n if(audioInterval != null) {\n window.clearInterval(audioInterval);\n audioInterval = null;\n }\n changeWaveLength();\n //css knoppen\n\t\t$(\"#playbutton\").css(\"display\", \"block\");\n\t\t$(\"#pause...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds some more CSS and tries to center both front and back in the container
function _addCssPositioning(options) { for (const card of options.domObjects.cardList) { // Set container relative card.container.style.position = "relative"; // Get dimensions from front/back let frontBounds = card.front.getBoundingClientRect(); let b...
[ "center() {\n if (this._fromFront) {\n this._updatePositionAndTarget(this._front, this._back);\n } else {\n this._updatePositionAndTarget(this._back, this._front);\n }\n\n this._updateMatrices();\n this._updateDirections();\n }", "function centerField() {\n $(\"#container\").css(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prettierignore Validates block range
function validateBlockNumbers(fromBlock, toBlock, currentBlock) { if (fromBlock > currentBlock || fromBlock < 0) { throw new Error('Invalid fromBlock. It must be less than the currentBlock || it cannot be negative'); } if (fromBlock > toBlock) { throw new Error('Invalid b...
[ "changedRange(blockToCompare) {\n let startIndex = 0;\n let differencesFound = false;\n while (startIndex < this.tokens.length &&\n startIndex < blockToCompare.tokens.length) {\n if (!this.tokens[startIndex].contentEquals(\n blockToCompare.tokens[startIndex])) {\n difference...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return available lang files as options with selected one
DropdownOptionsLANG() { let html = ''; let sel = ''; let fileListData = spx.getJSONFileList('./locales/'); fileListData.files.forEach((element,i) => { sel = ''; if (element.name == config.general.langfile) { sel = 'selected'; } html += '<op...
[ "function availableLanguage (site) {\n // Read the language files available\n var locales = fs.readdirSync(__dirname + '/../sites/' + site + '/locales');\n var html = '';\n // See all file and create the html\n for (var i = 0; i < locales.length; i++) {\n html += '<li><a href=\"/locales/' + lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
indiviual log in validation document.getElementById('IndivisualLog').addEventListener('submit',
function IndivisualLog() { var inFieldU = document.getElementById("in-userf"); var inFieldP = document.getElementById("in-passf"); var inLabelU = document.getElementById("in-user"); var inLabelP = document.getElementById("in-pass"); usernameRegex .exec(inFieldU);//regular expression const vaild=!!usernam...
[ "function handleLogInSubmit() {\n $('body').on(\"submit\", \"#form-log-in\", (event) => {\n event.preventDefault();\n const credentials = {\n username: $('#username-txt').val(),\n password: $('#password-txt').val()\n }\n doUserLogIn({\n credentials,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves the start to the first suitable text node.
function moveStart(rng) { var container = rng.startContainer, offset = rng.startOffset, isAtEndOfText, walker, node, nodes, tmpNode; // Convert text node into index if possible if (container.nodeType == 3 && offset >= container.nodeValue.length) { // Get the parent container location and walk fr...
[ "function findFirstTextNode(element, startIndex) {\n var index = null;\n startIndex = startIndex || 0;\n\n if (startIndex < textNodes.length) {\n for (var i = startIndex; i < textNodes.length; i++) {\n if ($.contains(element, textNodes[i])) {\n index = i;\n break;\n }\n }\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POKEMON OBJECT Update pokemon object
function updatePokemonObject(pokemonData) { PokemonObject.name = pokemonData.name; PokemonObject.height = pokemonData.height; PokemonObject.weight = pokemonData.weight; PokemonObject.frontImgSrc = pokemonData.sprites.front_default; PokemonObject.backImgSrc = pokemonData.sprites.back_default; Pok...
[ "constructor(pokemonObj) {\n this.pokPokemonId = pokemonObj.pokPokemonId;\n this.pokName = pokemonObj.pokName;\n this.pokHeight = pokemonObj.pokHeight;\n this.pokWeight = pokemonObj.pokWeight;\n this.pokAbilities = pokemonObj.pokAbilities;\n this.pokGender = pokemonObj.pokG...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsernew_column_name.
visitNew_column_name(ctx) { return this.visitChildren(ctx); }
[ "visitColumn_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitXml_column_name(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitRename_column_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAdd_column_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitParen_c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function setState of maxPrice to price selected on MaxPrice Dropdown Menu
maxHandleChange(event, index, maxPrice) { this.setState({ maxPrice }); }
[ "useMaxQty(event) {\n this.props.useMaxQty(event.target.checked);\n }", "minHandleChange(event, index, minPrice) {\n this.setState({ minPrice });\n }", "function updateMaxQty(maxQty, upgradePurchased, cost, currency) {\r\n if(currency >= cost) {\r\n maxQty += upgradePurchased;\r\n currenc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adding an observer to this.observers
addObserver(observer){ this.observers.push(observer) }
[ "function addObserver(chain, observer) {\n let tail = chain.tail;\n if (tail) {\n observer.prev = tail;\n tail.next = observer;\n chain.tail = observer;\n } else {\n chain.head = observer;\n chain.tail = observer;\n }\n}", "function runObserver (observer) {\n currentObserver = observer;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
disableOtherElement() : Disables all other operations during the levelup, win all levels, lost because of time, lost because of score scenarios makes the buttons in game header 'back' and 'i will learn' disabled makes the input field to enter the name of current item disabled reduces the opacity of the right and left p...
function disableOtherElement() { //Back, home page, learn and speaker icons are disabled document.getElementsByClassName('backContainer')[0].setAttribute('disabled', 'true'); document.getElementsByClassName('homePageContainer')[0].setAttribut...
[ "function disableInput() {\n if (turn === \"player 1\") {\n document.getElementById(\"ci1a\").disabled = false;\n document.getElementById(\"ci1b\").disabled = false;\n document.getElementById(\"ci1c\").disabled = false;\n document.getElementById(\"ci1d\").disabled = false;\n document.get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return its head. For example, Given linked list: 1 > 2 > 3 > 4 > 5, and n = 2. After removing the second node from the end, the linked list becomes 1 > 2 > 3 > 5. Note: Given n will always be valid. Try to do this in one pass.
function removeNthFromEnd(head, n) { let current = head; let previous = head; let ahead = head; let count = 0; while (count < n && ahead) { ahead = ahead.next; count++; } while (ahead) { ahead = ahead.next; previous = current; current = current.next } if (previous == current) { ...
[ "removeFromFront() {\n\n if(this.isEmpty()) return null;\n\n var nodeToRemove = this.head;\n\n this.head = this.head.next;\n nodeToRemove.next = null;\n this.counter--;\n return nodeToRemove;\n }", "function removeKthNodeFromEnd(head, k) {\n let firstPointer = head;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses align mode from direction if specified with hyphen, defaulting to middle if not e.g. 'leftstart' is mode 'start' and 'left' would be the default of 'middle'
function parseAlignMode(direction) { var directionArray = direction.split('-'); if (directionArray.length > 1) { return directionArray[1]; } return 'middle'; }
[ "function positionMode() {\n var attachment = ($attrs.mdPositionMode || 'target').split(' ');\n\n // If attachment is a single item, duplicate it for our second value.\n // ie. 'target' -> 'target target'\n if (attachment.length == 1) {\n attachment.push(attachment[0]);\n }\n\n return {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FYI The extra complexity in this method is due to the fact that for the block API you are sending the full list rather than individual items you want to unblock / unblock and that gets interesting if you kick off a subsequent request while a previous is still pending and, for example, the previous may fail whereas the ...
function blockUnblock(_block, peerIds) { if (typeof _block !== 'boolean') { throw new Error('Please provide _block as a boolean.'); } if (!isMultihash(peerIds) && !Array.isArray(peerIds)) { throw new Error('Either provide a single peerId as a multihash or an array of peerId ' + 'multihashes.'); }...
[ "function showBlockList () {\r\n $(\"#blocklist\").children().remove();\r\n var i=1;\r\n $.each(BLOCKER.getBlockedSites(), function (index, value) {\r\n\t\t\t\t\r\n\t\t$(\"#blocklist\").append(\"<li id='site-\"+i+\"'> <input type='button' class='pure-button button-remove' id='unblock-\"+i+\"' value='unbloc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create virtual table of cells with all cells, including span cells.
function createVirtualTable() { var rows = domTable.rows; for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) { var cells = rows[rowIndex].cells; for (var cellIndex = 0; cellIndex < cells.length; cellIndex++) { addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]); ...
[ "function generateTable() {\n emptyTable();\n generateRows();\n generateHead();\n generateColumns();\n borderWidth();\n}", "generateCells(){\n for(let row = 0; row<this.rows; row++){\n this.cells[row] = []\n for(let column = 0; column<this.columns; column++){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: hash with /id (cardDetail/id) I have startswith() method to grab the hash and have access to the hash on the controller
function cardDetail() { $('.image').click((event) => { let id = event.target.id; window.location.hash = '#cardDetail/' + id; }); }
[ "handleHashChange() {\n const authorId = window.location.hash.substr(1);\n if (authorId && authorId.length > 0) {\n // save the history!\n this.saveState();\n this.createFeedRequest(`&id=${authorId}`);\n }\n else {\n // mostly like a back butto...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
user has many addresses
static associate(models) { this.hasMany(models.Address, { foreignKey: "user_id", // coluna da tabela addresses que faz o relacionamento as: "addresses" }) this.belongsToMany(models.Tech, { foreignKey: "user_id", through: "user_techs", as: "techs" // quais são as techs...
[ "static async getAddressId(user_id){\n const res = await db.query(`SELECT \n user_id, street_address, address_number, city, state, zip_code, country \n FROM user_address \n WHERE user_id=$1`, [user_id...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Force reload the image
function reloadImage(img) { const src = img.attr('src'); img.removeAttr('src'); setTimeout(() => { img.attr('src', src); }, 500); }
[ "function Refresh_Image(the_id)\n{\n var data = {\n action: 'x2_get_image',\n id: the_id\n };\n\t\t\n jQuery.get(ajaxurl, data, function(response)\n\t\t{\n\n if(response.success === true)\n\t\t\t{\n jQuery('#x2-preview-image').replaceWith( respons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructor for a Garden containing different animals, plants, and other objects. All the arguments for the constructor are optional and will be initialized as an empty array if they are missing
constructor(animals=[], plants=[], randomObjects=[]) { this.animals = animals; this.plants = plants; this.randomObjects = randomObjects; }
[ "function Animal(object){\n this.name = object.keyword;\n this.image = object.image_url;\n this.description = object.description;\n this.hornCount = object.horns;\n this.title = object.title;\n\n animalArray.push(this);\n}", "constructor(size) {\r\n this.birds = [];\r\n this.size = size;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to get streetView, Zomato info (by ajax)
function getStreetView(data, status) { var resId = marker.id; var result = { rating: "", averageCostForTwo: "", currency: "", errMsg: "" }; // Use ajax to get the Zomato restaurant info $.ajax ({ url: "https://developers.zomato.com/api/v2.1/restaurant?", data: { ...
[ "function makeZomatoRequest(){\n\n\tvar zomatoURL = \"https://developers.zomato.com/api/v2.1/search?entity_id=57&entity_type=city&cuisines=148\";\n\n console.log(\"About to make the Ajax request to Zomato\");\n $.ajax({\n url: zomatoURL,\n type: \"GET\",\n headers: {\n 'user-ke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns LContext associated with a target passed as an argument. Throws if a given target doesn't have associated LContext.
function loadContext(target) { var context = getContext(target); if (!context) { throw new Error(ngDevMode ? "Unable to find context associated with " + stringify$1(target) : 'Invalid ng target'); } return context; }
[ "getContextById(context) {\n if (typeof context === 'string' || context instanceof String) {\n return this.contexts[context];\n }\n return context; // might already be a context object\n }", "function getContext(){\n \n if(!domain.active || !domain.act...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function draw// function drawArcade
function drawArcade(x, y) { if(back1){ push(); translate(arcadeVX, 0) scale(arcadeSC) var arcadeX = 0 fill(255, 165, 0) rect(arcadeX, 0, 500, 500) for (i = 0; i < 5; i++) ...
[ "function draw()\r\n\t{\r\n\t\tvar canvas = document.getElementById('canvas');\r\n\t\tif(canvas.getContext)\r\n\t\t{\r\n\t\t\tvar context = canvas.getContext('2d');\r\n\t\t\t// draw body\r\n\t\t\tif(this.state == playerStates.respawning) context.fillStyle= \"rgba(0,200,0,0.4)\"; // set fillStyle to dark green\r\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
w1 ^ w2 :: Word > Word > BigNat
function h$ghcjsbn_pow_ww(w1, w2) { h$ghcjsbn_assertValid_s(w1, "pow_ww w1"); h$ghcjsbn_assertValid_s(w2, "pow_ww w2"); var b = h$ghcjsbn_tmp_2a; h$ghcjsbn_toBigNat_w(b, w1); var t = h$ghcjsbn_pow_bw(b, w2); h$ghcjsbn_assertValid_b(t, "pow_ww result"); return t; }
[ "function XOR() {\n for (var _len15 = arguments.length, values = Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {\n values[_key15] = arguments[_key15];\n }\n\n return !!(FLATTEN(values).reduce(function (a, b) {\n if (b) {\n return a + 1;\n }\n return a;\n }, 0) & 1);\n}", "function dif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When a Wheat is destroyed, decrement the wheat count
onDestroy() { STATE.cows--; }
[ "function countHandTowelHwfMinus() {\n\t\t\tif(instantObj.noOfHandTowelHWF > 0) {\n\t\t\t\tinstantObj.noOfHandTowelHWF = instantObj.noOfHandTowelHWF - 1;\n\t\t\t\tcountTotalBill();\n\t\t\t}\n\t\t}", "function countShirtWwiMinus() {\n\t\t\tif(instantObj.noOfShirtWWI > 0) {\n\t\t\t\tinstantObj.noOfShirtWWI = instan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle tab or enter keypress for new notebooks TODO: add a minimum character limit for new notebooks
keyPress(e) { // If enter or tab key pressed on new notebook input if (e.keyCode === 13 || e.keyCode === 9) { this.addNotebook(e); } }
[ "onKeyPressHandler(event) {\n if(event.key === \"Enter\") {\n this.addToNotes();\n }\n }", "handleBoardKeyPress(e) {\n if (!this.state.helpModalOpen && !this.state.winModalOpen) {\n if (49 <= e.charCode && e.charCode <= 57) {\n this.handleNumberRowClick((e.charCode - 48).toString());\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
class Particle extends Object
function Particle() { }
[ "function Particle(initialPosition, initialVelocity) {\n this.position = initialPosition;\n this.velocity = initialVelocity;\n this.bestPosition = null;\n this.bestFitness = null;\n this.fitness = 0;\n this.dispersion = 0;\n}", "function ParticleCollection(data) {\n this._data = _.map(data, function (p) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Comprueba si el usuario esta bloqueado.
function checKBloq(typeUs) { try { var userId = getUserId(); if (typeUs == 'u') { //Si el usuario es individual //Comprueba bloqueo. Devuelve true si está bloqueado y false si no lo está. var bloqueo = database.getData("Usuarios/" + userId + "/Bloqueo"); ...
[ "function isUserStillWaiting(request) {\n\treturn false; //Allow user to return the pool for selection.\n}", "async blockUserInClass(userId,classId){\n let userInClass = await UserClass.findOne({\n where:{\n userId:userId,\n classId:classId,\n status:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fetch additional photos based on page scroll get Friends
function getFriends() { var query = "SELECT uid, name FROM user WHERE uid IN (Select uid2 from friend where uid1 =me())"; FB.api( { method: 'fql.query', query: query }, function(response) { console.log(response); var html = ""; ...
[ "function friendsLoad() {\n\tsendReq('friends.search',{count: 5, fields: 'photo_50'}, function (data){\n\t\tshowFriends(data.response);\n\t});\n}", "function infiniScroll(pageNumber) {\n \n $.ajax({\n url: \"rest/getMoreImages/\"+pageNumber+\"/\"+uploadCount,\n type:'GET',\n success...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
disable or enable all inline stylesheets.
function toggleInlineStylesheets(toggle) { $("*").each(function () { if (toggle) { if (this.style.cssText != "") { // this tag has an inline style this.style[property] = this.style.cssText; this.style.cssText = ""; } } else { if (this.style[property]) { this.style.css...
[ "function toggleEmbeddedStylesheets(toggle) {\n $(\"style\").each(function () {\n if (this.sheet) { // may be null if the browser ignored its inner text\n toggleStylesheet(this.sheet, toggle);\n }\n });\n}", "function toggleStylesheet(stylesheet, toggle) {\n stylesheet.disabled = toggle;\n styleshe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if invoking `Benchmarkrun` with asynchronous cycles.
function isAsync(object) { // Avoid using `instanceof` here because of IE memory leak issues with host objects. var async = args[0] && args[0].async; return name == 'run' && (object instanceof Benchmark) && ((async == null ? object.options.async : async) && support.timeout || object.de...
[ "isCompletedRunCurrent () {\n return this.runCurrent?.RunDigest && Mdf.isRunCompleted(this.runCurrent)\n }", "function runAsync(func) {\n window.setTimeout(func, 0);\n}", "function krnCheckExecution()\n{\n return _Scheduler.processEnqueued;\n}", "isBusy() {\n return this.totalTasks() >= this.op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Restrict access to editors only, redirecting and returning false if user is not an editor
function restrictedToEditors(lesson,req,res){ if ( lesson.editors.includes(req.user.id) ) return false; res.status(401).json({message: "Access Denied"}); return true; }
[ "ableToEdit() {\n const accountIdForEdit = sessionStorage.getItem(\"accountIdForEdit\");\n if (accountIdForEdit !== null) {\n sessionStorage.setItem(\"accountId\", accountIdForEdit);\n return true;\n } else {\n return false;\n }\n }", "isEditor(value) {\n if (!isPlainObject(value)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enables user to add a new expense item & stores that data
function addExpense() { console.log('Adding expense'); var expense = {}; expense.amount = document.querySelector('#amount').value; expense.date = new Date(document.querySelector('#date').value); expense.date = expense.date.toDateString(); console.log(expense.date); expense.category = document.querySelector('#cat...
[ "function addExpense(){\n var Addexpen = document.getElementById(\"AddExpen\").value\n \n if(Addexpen > 0 ){\n\n setExpense( Addexpen)\n setExpenId( expenId + 1)\n\n }\n }", "function addExpanse(context) {\n if(addAmount.value === \"\" || addDate.value === \"\") {\n return false;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the pageName from the given Url String. By default, this is the part of the url without the host (domain) and without query parameters. You can register a custom extraction function to be used.
function getPageNameFromUrl(urlString) { var urlObject = _url.default.parse(urlString); if ((0, _isFunction.default)(customExtractionFunction)) { return customExtractionFunction(urlObject); } else if (!isValidUrlObject(urlObject)) { return urlString; } else { return buildDefaultPageName(urlObject);...
[ "function findPageNameFromHref( href ) {\n\t\tvar m = pageRE.exec( href );\n\t\treturn m ? decodeURIComponent(\n\t\t\t( m[1] || m[2] ).replace( /\\+/g, '%20' )\n\t\t).replace( / /g, '_' ) : null;\n\t}", "function domainName(url){\n// if url begins with s: followed by wwww\n if (url.includes(\"s:\\//www\")) {\nre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add click functions to "play" and "reset" buttons when clicked, buttons call functions ready() and wipeGameBoard() and wipeGameTimer
function makeReady() { console.log("play ready!"); document.getElementById("play").onclick = function() { //"play" button disabled while game is in play document.getElementById("play").disabled = true; //delays the function that re-enables play button until game timer = 0 setTimeout(enablePlay, 14000); read...
[ "function buildGameButton(){\n\tbuttonStart.cursor = \"pointer\";\n\tbuttonStart.addEventListener(\"click\", function(evt) {\n\t\tplaySound('soundButton');\n\t\tgoPage('tutorial');\n\t});\n\t\n\tbuttonGotIt.cursor = \"pointer\";\n\tbuttonGotIt.addEventListener(\"click\", function(evt) {\n\t\tplaySound('soundButton'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by KotlinParserexplicitDelegation.
enterExplicitDelegation(ctx) { }
[ "enterParenthesizedType(ctx) {\n\t}", "enterOrdinaryCompilation(ctx) {\n\t}", "function pushlex(type, info) {\n var result = function(){\n lexical = new CSharpLexical(indented, column, type, null, lexical, info)\n };\n result.lex = true;\n return result;\n }", "enterExplicitConst...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When you click down on the measurement handler
function measurement_handler(event){ pointer_select_handler(event); }
[ "mDown(e){\n this.xMouseStart=e.offsetX;\n this.yMouseStart=e.offsetY;\n if(this.insideButton){\n Button.shape=this.name;\n }\n }", "function onMouseDownEvent()\n{\n let clickedTime = calculateClickedTime();\n let minute = (30 * clock.indicators.m.angle) / (Math.PI + 1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw the detected facial feature points on the image
function drawFeaturePoints(img, featurePoints) { var contxt = $('#face_video_canvas')[0].getContext('2d'); var hRatio = contxt.canvas.width / img.width; var vRatio = contxt.canvas.height / img.height; var ratio = Math.min(hRatio, vRatio); contxt.strokeStyle = "#FFFFFF"; for (var id in featureP...
[ "function drawFeaturePoints(canvas, img, face) {\n // Obtain a 2D context object to draw on the canvas\n var ctx = canvas.getContext('2d');\n \n ctx.fillStyle = '#13FC00';\n \n // Loop over each feature point in the face\n let ii = 0;\n ctx.font = '8px serif';\n for (var id in face.featurePoints) {\n ii...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw Health Concerns Popup
function drawHealthConcernsPopup(panelId, risk, color, meaning, map_size) { var healthConcernsWrapper = document.getElementById('health_concerns_wrapper_' + panelId); var healthConcerns = document.querySelector('#health_concerns_wrapper_' + panelId + '>div'); var healthConcernsColor = document.querySelector('#hea...
[ "drawExtraUI() {\n // draw the button for canceling ability if an ability is being used if it has not been used partly\n if (this.situation === \"ability\") {\n if (currentAbility.currentStep === 1) {\n push();\n rectMode(CENTER);\n noStroke();\n // if moused over, it is highl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a Rectangle and adds it to canvas
createRect(){ let rect = Rect.createRect(this.activeColor); this.canvas.add(rect); this.notifyCanvasChange(rect.id, "added"); }
[ "function drawRectParams() {\n new_shape = new Rectangle(startX, startY, currentX, currentY, getColor());\n drawRectShape(new_shape)\n}", "function Rectangle(width, height, color) {\n var _this = _super.call(this) || this;\n _this.width = width;\n _this.height = height;\n _this.color...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : rouletteArrPusher AUTHOR : Mark Anthony Elbambo DATE : March 12, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : for pushing objects used in the roulette PARAMETERS : devPath,model,imageObj,manufac,ostyp,prdfmly,ipadd,prot,hostnme,devtype
function rouletteArrPusher(devPath,model,imageObj,manufac,ostyp,prdfmly,ipadd,prot,hostnme,devtype){ if(window['variable' + dynamicGreenRouletteArr[pageCanvas]].length > 0){ var ctr=0; for(var a=0; a < window['variable' + dynamicGreenRouletteArr[pageCanvas]].length; a++){ var roultArr = window['variable' + dyna...
[ "jsonParser(photos){\n let farmIds = [];\n let serverIds = [];\n let ids = [];\n let secretIds = [];\n\n photos.forEach(element => {\n farmIds.push(element.farm);\n serverIds.push(element.server);\n ids.push(element.id);\n secretIds.push(element.secret);\n});\n this.imageLinkBuilder(fa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Collapse the main header search and do some cleanup.
function collapseHeaderSearch() { // Collapse the div $("#header-search").collapse("hide"); // Clear out the input $("input#global-search").val(""); // Clear out the query suggestions $("#header-search table#search_suggest").children().remove(); }
[ "function hsCollapseAllVisible() {\n $('#content .hsExpanded:visible').each(function() {\n hsCollapse($(this).children(':header'));\n });\n}", "function setupHeaderClickHandling()/*:void*/ {var this$=this;\n this.subPanels$v95j.forEach(function (panel/*:Panel*/)/*:void*/ {\n var header/*:Elem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update Firebase high scores
function updateHighScore(path, data) { var leaderRef = firebase.database().ref().child("highscores"); leaderRef.child(path).update(data); }
[ "updateScore() {\n this.serverComm.updateScore(this.userId, this);\n }", "getHighScores() {\n\t\tvar ref = this.database.ref(this.tableName);\n\t\tvar db = this;\n\t\treturn new Promise(function(resolve, reject) {\n\t\t\t(function(db){\n\t\t\t\tref.on(\"value\", function(snapshot) {\n\t\t\t\t\tdb.highSc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SFVFS[] Set Freedom Vector From Stack 0x0B
function SFVFS(state) { var stack = state.stack; var y = stack.pop(); var x = stack.pop(); if (exports.DEBUG) { console.log(state.step, 'SPVFS[]', y, x); } state.fv = getUnitVector(x, y); }
[ "getVariable(index) {\n const depth = this.getLocalDepth(index); // depth of the local in the stack.\n const memoryOffset = this.getMemoryOffset(depth); // actual depth in BF memory.\n const size = this.sizeOfVal(index); // how many byes to copy.\n const type = this.typeOfVal(index);\n\n for (let i =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
autocomplete div from search bar uses artist.name and artist.images
function createAutoCompleteDiv(artist) { if (!artist) { return; } var val = "<div class='autocomplete-item'>" + "<div class='artist-icon-container'>" + "<img src=" + getSuitableImage(artist.images) + " class='circular artist-icon' />" + "<div class...
[ "function searchArtists() {\n\tvar textbox = document.getElementById(\"searchbox-textbox\");\n\tvar listbox = document.getElementById(\"list-box\");\n\n\tvar nameSearched = textbox.value;\n\n\tfor (var i = 0; i < artistNames.length; i++) {\n\t\tif (!artistNames[i].includes(nameSearched)) {\n\t\t\tvar listItem = doc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detects collision between player and different objects that has hitbox.
detectCollisions() { const sources = this.gameObjects.filter(go => go instanceof Player); const targets = this.gameObjects.filter(go => go.options.hasHitbox); for (const source of sources) { for (const target of targets) { /* Skip source itself and if source or target is destroyed. */ ...
[ "hitBox(collision){\n\t\tswitch(collision.closestEdge(this.pos.minus(new vec2(this.vel.x, 0)))){\n\t\t\tcase 't': this.hitGround(collision.top()); break;\n\t\t\tcase 'l': this.hitRWall(collision.left()); break;\n\t\t\tcase 'r': this.hitLWall(collision.right()); break;\n\t\t\tcase 'b': this.hitCeiling(collision.bott...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show/hide all fields needed for not modifying a module
function disableeditfields(moduleid) { Element.addClassName('editmodulenavtype_' + moduleid, 'z-hide'); Element.addClassName('editmoduleenablelang_' + moduleid, 'z-hide'); Element.addClassName('editmoduleaction_' + moduleid, 'z-hide'); Element.addClassName('editmoduleexempt_' + moduleid, 'z-h...
[ "function enableeditfields(moduleid)\n{\n Element.addClassName('modulenavtype_' + moduleid, 'z-hide');\n Element.addClassName('moduleenablelang_' + moduleid, 'z-hide');\n Element.addClassName('moduleaction_' + moduleid, 'z-hide');\n Element.addClassName('moduleexempt_' ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Minimizar la ventana actual
function minimizar() { var win = remote.getCurrentWindow() win.minimize(); }
[ "actualizarCuota () {\n this.interesMensual = this.interes / 1200;\n this.factorFunc();\n this.cuotaFunc();\n }", "function actualizarVentanaMesero(){\n\tswitch(navegarMesero){\n\t\tcase 1: //Se en cuentra en la ventana 1\n\t\t\tnavegar(1);\n\t\tbreak;\n\t\tcase 3:\n\t\t\tnavegar(3);\n\t\tbreak;\n\t}\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
details: reset all hold modal state to default
function resetHoldModalState() { setConfirm(false) setHold(false) setHoldReason(null) }
[ "function handleDetailReset(){\n cnDetailForm.reset()\n returnBtn()\n}", "function f_resetAll(){\n fdoc.find('.spEdit').removeAttr('contenteditable').removeClass('spEdit');\n fdoc.find('.targetOutline').removeAttr('contenteditable').removeClass('targetOutline');\n fdoc.find(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply constraints to a point. These constraints are both physical along an axis, and an elastic factor that determines how much to constrain the point by if it does lie outside the defined parameters.
function applyConstraints(point, _a, elastic) { var min = _a.min, max = _a.max; if (min !== undefined && point < min) { // If we have a min point defined, and this is outside of that, constrain point = elastic ? (0,popmotion__WEBPACK_IMPORTED_MODULE_0__.mix)(min, point, elastic.min) : Math.max(p...
[ "function biasedPoint(point, normal, bias) {\n return vec3.add(vec3.create(), point, vec3.scale(vec3.create(), normal, bias));\n}", "_applyScale(point) {\n let scale = this.getScale()\n return {\n x: point.x * scale,\n y: point.y * scale,\n z: point.z * scale,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function renumbers the IDs of the given circuit so that there are no collisions. This should be called any time a circuit is loaded to avoid collisions. It returns the circuit.
function renumber (circuit) { const clone = { ...circuit } let maxId = currentId const calcNewId = (id) => currentId < (Number.MAX_SAFE_INTEGER - id) ? id + currentId : (id - Number.MAX_SAFE_INTEGER) + currentId const updateId = (object) => { const clone = { ...object, id: calcNewId(ob...
[ "function StickyIdMaker() {\n this.highId = 0;\n this.spare = [];\n}", "arrangeId() {\n const rootNode = this.parent.contentDom.documentElement;\n let id = SlideSet.MIN_ID;\n for (let { slideId } of this.selfElement.items()) {\n const oriId = slideId.id;\n const relEle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function open message lightbox
function openMessage(message) { // var $container = window.parent.$('.container-message-lightbox'); var $container = $('.container-message-lightbox'); $container.find(".js-message").text(message); $container.fadeIn(); //hide fncybox close parent.$("#fancybox-close").css("display", "no...
[ "function display_message_box(){\r\n\t$(\"#new_msg\").click(function(){\r\n\t\t$(\"#popout\").fadeIn(\"slow\");\r\n\t});\r\n}", "function popup (message) {\n $('.pop').show().css('display', 'flex')\n $('.message').html(message)\n }", "function modalBox(msg) {\n\t\tvar boxCSS = \"position:absolute;width:3...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store the users last search to localStorage
function storeLastSearch() { let userSearch = $("#userSearch").val(); localStorage.setItem("lastSearch", JSON.stringify(userSearch)); }
[ "function storeSearchHistory() {\nlocalStorage.setItem(\"searchHistory\", JSON.stringify(userSearchArray))\n}", "function checkSavedSearches() {\n var checkStorage = JSON.parse(localStorage.getItem(\"saved\"));\n if (checkStorage !== null) {\n searchStorage = checkStorage;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shall be used to parse output of the custom `Ptypes` gdb command
consoleParsePtypes(input) { return Parser.parse(input, { startRule: 'PTYPES' }); }
[ "consoleParseTypes(input) { return Parser.parse(input, { startRule: 'TYPES' }); }", "function show(type) { console.log(type.schema({exportAttrs: true})); }", "commandType() {\n const { 0: com } = __classPrivateFieldGet(this, __command);\n // console.log(\"com\", com);\n const type = __class...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create target ul list
function createTarget(t){ var tUl= document.createElement('ul'); var imgSufix='.png'; tUl.id = 'drag2share-targets'; $.each(t.split(','), function(index, value) { var tLi = document.createElement('li'); tLi.id = value; tLi.style.background = 'url('+options.ico...
[ "function createLiElement() {\n const fragment = document.createDocumentFragment();\n sections.forEach((section) => {\n const navListElement = document.createElement('li');\n navListElement.classList.add('nav-list__item');\n const idSection = section.id;\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
run Syncs options and build path, Also prompts user for required info before deploying.
run(config, compilerOptions) { let Uploader = this; // Set output to compiler output object. this.output = compilerOptions.output; // If options are passed, sync with class options. if (config.options) { this._syncOptions(config.options); } if (!this.options.autoRun && !argv.deploy...
[ "function upload(options, git_data) {\n\tvar rsync = new Rsync();\n\n\t// glob files\n\tglob(package_files, {\n\t\tabsolute: true\n\t}, function(error, files) {\n\t\tvar dest, path;\n\n\t\tif (error) throw error;\n\n\t\tconsole.log(chalk.green('Uploading ' + files.length + ' packages to ' + options.host + '...'));\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pop a byte from the stack.
popByte() { const value = this.readByte(this.regs.sp); this.regs.sp = inc16(this.regs.sp); return value; }
[ "pop() {\n if(this.stack.length == 0) {return null\n }\n\n return this.stack[this.top--];\n }", "pop() {\r\n return this._msgStack.pop()\r\n }", "popWord() {\n const lowByte = this.popByte();\n const highByte = this.popByte();\n return word(highByte, lowByte);\n }", "popV...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for postV3UserKeys
postV3UserKeys(incomingOptions, cb) { const Gitlab = require('./dist'); let defaultClient = Gitlab.ApiClient.instance; // Configure API key authorization: private_token_header let private_token_header = defaultClient.authentications['private_token_header']; private_token_header.apiKey = 'YOUR API KEY'; // U...
[ "postV3UsersIdKeys(incomingOptions, cb) {\n const Gitlab = require('./dist');\nlet defaultClient = Gitlab.ApiClient.instance;\n// Configure API key authorization: private_token_header\nlet private_token_header = defaultClient.authentications['private_token_header'];\nprivate_token_header.apiKey = 'YOUR A...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the CommandLineStringParameter with the specified long name.
getStringParameter(parameterLongName) { return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.String); }
[ "getFlagParameter(parameterLongName) {\n return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.Flag);\n }", "getChoiceParameter(parameterLongName) {\n return this._getParameter(parameterLongName, BaseClasses_1.CommandLineParameterKind.Choice);\n }", "getStringLi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper method: checks if there is another shape with the desired prefix, and different suffixes for the various states. In this demo, it looks for faceInitial, faceSecond and faceFinal on the th iteration.
function hasNextShape () { shapeIndex++; startShapeId = startShapePrefix + shapeIndex + startShapeSuffix; intermediateShapeId = intermediateShapePrefix + shapeIndex + intermediateShapeSuffix; endShapeId = endShapeP...
[ "function checkCube() {\n//===============================\n var check = false;\n\n // Check each color\n for(face in colorMap) {\n // Check each sticker from that color\n $(\".color-\"+colorMap[face]).each(function() {\n\n // If the sticker isn't on the right face for its color\n // Then the cub...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a placeholder function to install as a global in place of a function that may be available after snapshot load, at runtime. Uses the current state of globalFunctionTrampoline to either call the real function or throw an appropriate error for improper use.
function makeGlobalPlaceholder(globalFunctionName) { return function() { if (globalFunctionTrampoline === null) { throw new Error(`Attempt to call ${globalFunctionName} during snapshot generation or before snapshotResult.setGlobals()`) } else if (globalFunctionTrampoline[globalFunctionName] === ...
[ "function wrapFunction(fun, contentGlobal) {\n return function () {\n let result = fun.apply(this, arguments);\n if (typeof result === 'object') {\n if (('then' in result) && (typeof result.then === 'function')) {\n // fun returned a promise.\n return createPromiseInPage((resolve, reject) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
chooses theme on load checks for local storage first else uses local time
function modeOnLoad() { const themeUser = localStorage.getItem("themeSave"); //checks for saved theme key if (themeUser === "dark") { switcher(false); } else if (themeUser === "light") { switcher(true); } else { //no saved theme so determines via current time const now = new Date(); consol...
[ "function RetroTheme() {\n if (localStorage.getItem('theme') === 'theme-dark') {\n setTheme('theme-retro');\n } else if (localStorage.getItem('theme') === 'theme-light') {\n setTheme('theme-retro');\n } else {\n setTheme('theme-light');\n }\n}", "function getStoredTheme() {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns 1 if car is not in array, and returns the index of array where it was found if car was found
function checkIfVehicleExists(vehicle, array) { for (var i = 0; i < array.length; i++) { if (vehicle.shortIdentifier == array[i].shortIdentifier) { return i; } } return -1; }
[ "function inArray(value, array) {\n for (var i = 0; i < array.length; i++) {\n if (array[i] == value) return i;\n }\n return -1;\n}", "function findCard(arr, card){\n for (let i = 0; i < arr.length; i++){\n if(cards[i] == card) return i;\n }\n return -1;\n}", "function search_in_array(element,array)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get past meeting details.
getPastMeeting(uuid) { const response = jwtHelper.getApi('past_meetings/' + uuid); return response; }
[ "get meetingTimeZone()\n\t{\n\t\treturn this._meetingTimeZone;\n\t}", "function listUpcomingEvents() {\n const calendarId = 'primary';\n // Add query parameters in optionalArgs\n const optionalArgs = {\n timeMin: (new Date()).toISOString(),\n showDeleted: false,\n singleEvents: true,\n maxResults: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function used as an initial value for watchers. because it's unique we can easily tell it apart from other values
function initWatchVal() {}
[ "function Watcher(watchVar, ChangeTest, Callback) {\n\tthis.watchVar = watchVar;\n\tthis.ChangeTest = ChangeTest;\n\tthis.Callback = Callback;\n\n\tthis.GetValue = function() {\n\t\treturn this.watchVar;\n\t}\n\n\tthis.SetValue = function(val) {\n\t\tthis.watchVar = val;\n\t\tdebugLog('Set value: ' + this.watchVar)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when user clicks the back button in the categories section, displays the original edit and create buttons
function catGoBack() { altCatDivPt1.style.display = "block"; altCatDivPt2.style.display = "none"; altCatDivPt3.style.display = "none"; catBackBtn.style.display = "none"; editCatErrorMessage.textContent = "[error message]"; editCatErrorMessage.style.visibility = "hidden"; }
[ "function display_CategoryView(parentDiv) {\n\t$('.button').removeClass(\"ActiveCategory\");//remove 'active' class on previous parent\n\tvar newParent = $('#categoryView');\n\t\n\tif (newParent.children()[0].id !== 'itemView') {\n\t\tvar parentCategory = newParent.children()[0].id;\n\t\tvar end = parentCategory.in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stacks look like [[y1, y2], [y1, y2] ...] colorFunc is optional; if null it draws increasingly dark gray bands
function drawStack(ctx, stack, x, w, colorFunc) { var gray = void 0; stack.forEach(function (y, i) { if (!colorFunc) { gray = (0, _utils.randomInRange)(0.55, 0.85); ctx.fillStyle = 'rgba(0, 0, 0,' + (i + 1) * gray / stack.length + ')'; } else { ctx.fillStyle =...
[ "function drawGlass(data, color) {\n // sort the array of data from biggest to smallest value\n // consider only the first 5 observations\n const sortedData = data.sort((a, b) => ((a.value > b.value) ? -1 : 1)).slice(0, 5);\n // compute the total for the linear scale\n const total = sortedData.reduce((acc, cur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a user decides to select a preuploaded picture, then the form for inserting a URL will be disabled.
function checker() { var thisSrc = displayPic.src; if (thisSrc.indexOf("#") >= 0) { uploadURL.disabled = false; localURL.disabled = false; } else { upload.style.color = "Grey"; uploadURL.disabled = true; uploadURL.placeholder = ""; localURL.disabled = true; localURL.style.color = "Grey"; localURL.v...
[ "function imageUploaded(error, result) {\n $('#recipe-upload-image').prop(\"src\", result[0].secure_url);\n $('#image_upload_url').val(result[0].secure_url);\n}", "function setThumbnail(url){\r\n\tvar imgUrl = \"\";\r\n\tif(url.match(/youtube/) != null){\r\n\t\timgUrl = \"http://img.youtube.com/vi/\" + getK...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: LookupOASCapableSucceeded This is the AJAX callback function for success. Asks if user wants to leave the test pfratus, 4/7/2010
function LookupOASCapableSucceeded(result, context) { var action='', msf='', oldZipcode='', question=''; if (context!=null && context!='') { var qs = context.split('|') action = qs[0]; msf = qs[1]; oldZipcode = qs[2]; question = qs[3]; } if (result.d) { ...
[ "function LookupOASCapableOnHomePageFailed(result, context) {\n var oldZipcode='', question='', controlName='';\n if (context!=null && context!='') {\n\t var qs = context.split('|')\n oldZipcode = qs[0];\n controlName = qs[2];\n }\n document.getElementById(controlName).value = oldZipcod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Monitor GPRS 3000 7 huboVentas(mes, anio): que indica si hubo ventas en un mes determinado.
function huboVentas (mes, anio) { return ventasMes(mes, anio) > 0; }
[ "function siguienteMes(){\n if (numeroMes !== 11){\n numeroMes++;\n }else{\n numeroMes=0;\n anioCorriente++;\n }\n\n setearFechaNueva();\n}", "async scan() {\n try {\n let that = this\n await waitUntil(() => {\n return (that.state === 'p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates the time necessary to compute the hash in milliseconds (worstcase scenario)
calculateTimeToHash(combinations) { return { md5: combinations / this.calculationTimes.md5, sha1: combinations / this.calculationTimes.sha1, sha256: combinations / this.calculationTimes.sha256, bcrypt: combinations / this.calculationTimes.bcrypt, ntlm: combinations / this.calculationTi...
[ "digesting() {}", "static getHash(block){\r\n const {timestamp, lastHash, data, nonce} = block;\r\n return this.createHash(data, timestamp, lastHash, nonce, difficulty);\r\n }", "function getHashDifficulty(hash) {\n let difficulty = 0\n\n for (let i = 0; i < hash.length; i++) {\n if (hash[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets Resources versions from environmental variable RESOURCES_VERSIONS should be string in format: "resourceOneName=1.0,resourceTwoName=1.1"
function getVersionFromConfig (resourceString) { const resourceVersionMap = {}; resourceString .split(',') .forEach(e => e.split('=') .reduce((p, c) => { resourceVersionMap[p] = { contentVersion: c, acceptVersion: c.split('.')[0...
[ "getResources(includeTs) {\n const resources = this.data.manifest.control.resources;\n let pathsCollection = [];\n Object.keys(resources).forEach(resourceType => {\n let paths;\n if (resourceType !== constants.LIBRARY_ELEM_NAME) {\n paths = (resourceType ===...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
next letter in the alphabet. You will write a function nextLetter to do this. The function will take a single parameter str (string). EXAMPLES: "Hello" > "Ifmmp" "What is your name?" > "Xibu jt zpvs obnf?" "zoo" > "app" "zzZAaa" > "aaABbb" Note: spaces and special characters should remain the same. Capital letters shou...
function nextLetter(str) { // go for it }
[ "function fearNotLetter(str) {\n for (var i = 0; i < str.length - 1; i++) {\n if (str.charCodeAt(i + 1) == str.charCodeAt(i) + 1) {\n console.log(\"next char is next in alphabet\");\n }\n else {\n return String.fromCharCode(str.charCodeAt(i) + 1);\n }\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes the current read stream to the next one if the last one is done and has been cleared, or no source has yet been chosen.
_next() { if (!this._current) { if (!this._streams.length) { this._enabled = false; return this.end(); } this._current = new stream.Readable().wrap(this._streams.shift()); this._current.on('end', () => { this._current = null; this._next(); }); this...
[ "_read() {\n if (this.index <= this.array.length) {\n //getting a chunk of data\n const chunk = {\n data: this.array[this.index],\n index: this.index\n };\n //we want to push chunks of data into the stream\n this.push(chunk);\n this.index += 1;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pass videoservie.ts as a object, when you call toolbar, it will call videoservice too
function ToolbarComponent(videoService) { this.videoService = videoService; // now you can use videoService function on template }
[ "function configurarBarrasVideo(){\n\n ///////////////////////PROGRESO//////////////////////\n //Listener para cuando el usuario arrastre la barra de progreso\n barraProgreso.addEventListener(\"change\", function() {\n //Calcular tiempo exacto\n var tiempo = video.duration * (barraProgreso.va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a middleware for transforming XHR loaded Blobs into more useful objects
function blobMiddlewareFactory() { return function blobMiddleware(resource, next) { if (!resource.data) { next(); return; } // if this was an XHR load of a blob if (resource.xhr && resource.xhrType === _Resource2.default.XHR_RESPONSE_TYPE.BLOB) { ...
[ "function getFileBlob(url, cb) {\n var xhr = new XMLHttpRequest() //creo una nueva instancia de XMLHttpRequest\n xhr.open('GET', url) //inicializo una peticion asincronica del url al server\n xhr.responseType = \"blob\" // declaro que el valor del tipo de respuesta es blob (para luego usarlo mas adel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change heading bg color
function changeHeadingBg(color){ document.getElementById("heading").style.background = color; }
[ "function h1Correct(){\r\n\t\t\th1.style.background = correctColor;\r\n\t\t}", "function colorHeader(i) {\n $(\"#heading\" + i).addClass(\"hasEvent\");\n }", "_applyConfigStyling() {\n if (this.backgroundColor) {\n const darkerColor = new ColorManipulator().shade(-0.55, this.backgroundColor);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a floating GUI box with demolition parameters.
function createDemolishFloat() { var options=document.evaluate('//select[@name="abriss"]/descendant::option', document, null, XPSnap, null); myoptions=""; for (var i=0; i<options.snapshotLength; i++) { if(options.snapshotItem(i).innerHTML.indexOf(aLangGameText[16]) != -1) { continue; } myoptions+="<o...
[ "function FluidPanel() {}", "onDemandCreateGUI() {\n \n if (this.internal.parentDomElement===null)\n return;\n \n this.internal.parentDomElement.empty();\n \n let basediv=webutil.creatediv({ parent : this.internal.parentDomElement});\n this.internal.domE...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the name of the current matrix class
getClassName() { return 'Matrix'; }
[ "static get screenName() {\n return this.__proto__.constructor.name;\n }", "processNamedClass() {\n if (!this.tokens.matches2(tt._class, tt.name)) {\n throw new Error(\"Expected identifier for exported class name.\");\n }\n const name = this.tokens.identifierNameAtIndex(this.tokens.curren...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of "chunks". A chunk is an array consisting of many stacks. A stack is an array consisting of many events.
collect() { // Join active and finalized stacks. We want to make sure we iterate over // every event. const stacks = [...this.finalizedStacks]; Object.values(this.activeStacks).forEach((s) => stacks.splice(s.id, 0, s.events) ); return stacks.reduce((chunks, stack) => { if (stack.len...
[ "chunk(arr, size) {\n if(typeof size === 'undefined') {\n size = 1;\n }\n let arrayChunks = [];\n for(let i = 0; i < arr.length; i+=size) {\n let arrayChunk = arr.slice(i, i+size);\n arrayChunks.push(arrayChunk);\n }\n return arrayChunks;\n }", "function chunk(array, chunkSize, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a JavaScript program to find ALL the Armstrong numbers between 0 and 999, store them in array an output that array to the console. Note : An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 3^3 ...
function findArm(){ let armstrongNumbers = []; for (let num = 0; num<1000 ; num++) { let numA = (num.toString()).split(''); let x = numA.length; let sum = 0 for (let i = 0 ; i < x ; i++) { if (numA[i] >= 0 ) { sum += (Math.pow(numA[i], x)); ...
[ "function findArmstrongNumbers(num1, num2) {\n // num1 and num2 are Numbers\n\n let newArray = [];\n for (let i = num1; i <= num2; i++) {\n let strArray = [];\n\n strArray = i.toString().split('');\n let intArray = [];\n for (let j = 0; j < strArray.length; j++) {\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render Initial Bookmarks Control
function controlRenderInitialBookMarks() { bookMarksView.render(model.state.bookmarks); }
[ "function bbedit_components_draw_menu() {}", "onRender() {}", "render() {\n if (this.selected) {\n // If selected, fill the note as such and ignore everything else.\n this.fill(SELECTED);\n this.opacity(1);\n } else {\n if (this.playing) {\n // If the note is playing, fill the n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a line for a commit contains, commit log, revision details, review state and action buttons TODO fusion with commits.js version
function createItem(revision) { var block = $('<div></div>').attr('class', 'commit-item2'); var actions = $('<div></div>'); var title = $('<div></div>') .text(revision.Message) .attr('class', 'commit-title2') .appendTo(block); $('<div></div>') .text("Revision : " + revi...
[ "function formatCommitInfo( line ) {\n // Result is in format e.g. d748d93 1465819027 committer@email.com A commit message\n // First field is the truncated hash; second field is a unix timestamp (seconds\n // since epoch); third field is the committer email; subject is everything after.\n let fields = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the pandoc AST generated from the file tokens and the converter options
getPandocAst() { return tokens && markdownItPandocRenderer(tokens, this.converter.options); }
[ "generate() {\n var ast = this.ast;\n\n this.print(ast);\n this.catchUp();\n\n return {\n code: this.buffer.get(this.opts),\n tokens: this.buffer.tokens,\n directives: this.directives\n };\n }", "function generateDocumentation(fileNames, options) {\n // Build a program using the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code Example 8.18 Return an array of File objects for a given Folder argument.
function getFilesForFolder(folder) { var fileIt = folder.getFiles(), file, files = []; while(fileIt.hasNext()) { file = fileIt.next(); files.push(file); } return files; }
[ "getFiles(dir) {\n return (new fs.Dir(this.dst, dir)).files;\n }", "function LerArquivos(folderPath) {\n fs.readdirSync(folderPath).forEach(file => {\n console.log(file);\n });\n}", "async getFolderChildren(params) {\n const folderId = params.parentId;\n const response = await ApiMiddlewa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
description checks if someone has won the game paramaters: plays (array) collection of 9 character values that are all 'x', 'o', or '_' for blank returns: (string) 'x' or 'o' if the respective player won, 't' for tie, or '_' if game isn't over
function checkForWin(plays) { let matches = getPossibleMatches(plays); //scans the object for any instances of 'xxx/' or 'ooo/' which indicates a //win const winner = Object.values(matches).reduce((result, direction) => { if(result !== '_') { return result; } ...
[ "function searchForPlay(plays)\n{\n //all possible win combinations\n let matches = getPossibleMatches(plays);\n //a dumbed down version of possible win combinations (Basically, a count\n //of numbers of x's, o's, and blanks of each win combination on the board)\n let simplifiedMatches = simplifyMatc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Match respondents to project parameters
matchRespondentsToProjectParams() { this.results = matchRespondents(this.parsedData, this.projectParams); }
[ "function annoyEveryoneWithResponse(res) {\n var target = res.message.room.toLowerCase();\n roomAssociations.forEach(function (association, i, associations) {\n association.rooms.forEach(function (room, j, rooms) {\n if (room.name.toLowerCase() == target || (room.old_name && room.old_name.toLowerC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
scroll down to project information
function showProjectInfo() { if (localStorage.getItem("aProjectIndex") != -1) { var aProject = document.getElementsByClassName("a-project"); aProject[localStorage.getItem("aProjectIndex")].scrollIntoView(); window.scrollBy(0, -80); localStorage.setItem("aProjectIndex", -1); } toTopWhenRelo...
[ "function goProjects()\n\t{\n\t\tif (window.location == \"https://www.jasonbergland.com/projects\")\n\t\t{\n\t\t\tlet projectsY = document.getElementById('projects').offsetTop; // returns the distance of the outer border of the current element relative to the inner border of the top of the offsetParent node. \n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Requests server to send folder contents. Populates folderArr with folder contents. refreshCallback is a function which can be called after asynchronous server call is completed.
function listCall(path, refreshCallback){ Meteor.call("listContents", path, "d", function(error, result){ if(error){ console.log(error.reason); return; } Session.set("folderArr", result.split('\n')); Meteor.call("listContents", path, "f", function(error, result){ if(error){ console.log(e...
[ "onUpdateFolder() {\n this.store.query(\"folder\", {})\n .then((results) => {\n // Rebuild the tree\n this.send('buildTree', { folders: results });\n })\n .catch(() => {\n this.growl.error('Error', 'Erro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Custom type guard for Method. Returns true if node is instance of Method. Returns false otherwise. Also returns false for super interfaces of Method.
function isMethod(node) { return node.kind() == "Method" && node.RAMLVersion() == "RAML10"; }
[ "function isMethod(node) {\n\t return node.kind() == \"Method\" && node.RAMLVersion() == \"RAML08\";\n\t}", "_handles_method(method) {\n if (this.methods._all) {\n return true;\n }\n\n let name = method.toLowerCase();\n\n if (name === 'head' && !this.methods['head']) {\n name = 'get';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isFunctor : a > Boolean
function isFunctor(m) { return !!m && hasAlg('map', m) }
[ "function ISFUNCTION(value) {\n return value && Object.prototype.toString.call(value) == '[object Function]';\n}", "hasCallback() {}", "function isCallback(node) {\n return node && node.type === typescript_estree_1.AST_NODE_TYPES.TSFunctionType;\n }", "function isApplicativeRepr(Repr) {\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions used to change the vertex count of the displayed graph.
function increaseVertexCount() { let vertexCount = retrieveVertexCount(); if (vertexCount < 100) { ++vertexCount; document.getElementById("vertices").value = vertexCount.toString(); document.getElementById("vertices").dispatchEvent(new Event("change")); } }
[ "_changeVertexCount(count, semantic) {\r\n\r\n // update vertex count and validate it with existing streams\r\n if (!this.vertexCount) {\r\n this.vertexCount = count;\r\n } else {\r\n this._validateVertexCount(count, semantic);\r\n }\r\n }", "set_cellCount(newv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define transform stream structure
function Transform() { stream.Transform.call(this, {objectMode: true}); }
[ "function createSplitter() {\n let transform = new stream_1.Transform();\n let buffer = Buffer.alloc(0);\n transform._transform = (chunk, _encoding, callback) => {\n buffer = Buffer.concat([buffer, chunk]);\n let offset = 0;\n while (offset + 4 < buffer.length) {\n const len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when the duration of the video changes. Updates the duration text as appropriate.
function onDurationChange(e) { var newDuration = Math.floor(video.duration); if (newDuration != durInt) { durInt = newDuration; dur_str = " / " + toTimeString(durInt); updateTimeBar(); } }
[ "function updateTimeElapsed() {\n var time = formatTime(Math.round(video.currentTime));\n timeElapsed.innerText = formatTimeHumanize(time);\n timeElapsed.setAttribute('datetime', `${time.hours}h ${time.minutes}m ${time.seconds}s`);\n }", "function updateDurationLabel() {\n if (dataAvail...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
De fibbonacci getallen is een rij getallen die begint met 1, 1. Het volgende getal is steeds de som van de twee vorige getallen, dus 1, 1, 2, 3, 5, 8, 13 enz. Deze functie geeft een array terug met daarin de fibbonacci reekst tot en met het getal n. De reeks begint met n = 0, dus fibbonacci(8) geeft [1, 1, 2, 3, 5, 8, ...
function fibbonacci(n) { var uitkomst = []; // the magic starts here... return uitkomst; }
[ "function fibonacciSequence(n) {\n let fibs = [1, 1];\n for (i = 2; i < n; i++) {\n fibs.push(fibs[fibs.length - 2] + fibs[fibs.length - 1] % 10)\n }\n return fibs;\n}", "function fibb() {\n var list = [0,1];\n for( i = 2; i < 100; i++) {\n\tlist[i] = list[i-1] + list[i-2];\n }\n return list;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if user list box is already open
function checkUserAccessVal(resource_id) { // If user list box is already open on same row, then close it (i.e. user clicked the link to close it) if ($('#input_linkusers_selected_id_'+resource_id).prop('checked') && $('#user_current_resource_id').val() == resource_id && $('#choose_user_div').css('display') != 'non...
[ "function checkDagAccessVal(resource_id) {\r\n\t// If user list box is already open on same row, then close it (i.e. user clicked the link to close it)\r\n\tif ($('#input_linkdags_selected_id_'+resource_id).prop('checked') && $('#dag_current_resource_id').val() == resource_id && $('#choose_dag_div').css('display') ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a util function checks whether the campaign is in contractual status. if true, then the contract information cannot be modified.
function check_contract_signing_status(brand_campaign_id, account_id){ return get_inf_status(brand_campaign_id, account_id) .then(res => { if (res.inf_status && res.inf_status.indexOf('contract') !== -1){ return true; } return false; }); }
[ "checkContract() {\n if (!isDef(this.contract)) {\n throw new Error('Contract not defined. It was probably never deployed');\n }\n }", "function isContractPayable(definition) {\n let fallback = definition.nodes.find(node => node.nodeType === \"FunctionDefinition\" &&\n functionKind(n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the value of the current input focused or 1 if not found any
async getFocusedValue() { const focusedInput = await this.getFocusedInput(); if (focusedInput) { return focusedInput.getValue(); } return undefined; }
[ "focusedTabIndex() {\n\t\tvar index = this.tabs.findIndex(function(tab) {\n\t\t\treturn tab === document.activeElement;\n\t\t});\n\n\t\treturn (index === -1) ? 0 : index;\n\t}", "function spinputvalue () {\n if (!isContentEditable) return element.value;\n return element.innerText;\n }", "function i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Triggered when an external subject token is needed to be exchanged for a GCP access token via GCP STS endpoint. This uses the `options.credential_source` object to figure out how to retrieve the token using the current environment. In this case, this uses a serialized AWS signed request to the STS GetCallerIdentity end...
async retrieveSubjectToken() { // Initialize AWS request signer if not already initialized. if (!this.awsRequestSigner) { this.region = await this.getAwsRegion(); this.awsRequestSigner = new awsrequestsigner_1.AwsRequestSigner(async () => { // Check environment va...
[ "async getSecurityToken() {\n if (isSasTokenProvider(this._context.tokenCredential)) {\n // the security_token has the $management address removed from the end of the audience\n // expected audience: sb://fully.qualified.namespace/event-hub-name/$management\n const audiencePa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hideMask_YearMonthDate() ================ Remove the Mask 'YYYY/MM' from a Date field Parameters Return value
function hideMask_YearMonthDate(oElement) { var lstrValue = oElement.value; re = new RegExp("/","g"); oElement.value = lstrValue.replace(re,""); oElement.select(); }
[ "function putMask_YearMonthDate(oElement)\n{\n var lstrValue = oElement.value;\n if(lstrValue == \"\" || !isInteger(lstrValue))\n return;\n\n re = new RegExp(\"/\",\"g\");\n lstrValue = lstrValue.replace(re,\"\");\n if (lstrValue.length == 6) {\n partOne = lstrValue.substring(0,4);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
replenish card to it's original index
function takeCardAndReplenish(db, card) { const rank = card.rank; const cards = db.get(['game', 'cards' + rank]); let index = -1; for(let i = 0; i < cards.length; i ++) { if(cards[i].key == card.key) { index = i; break; } } if(index < 0) { return; } const nextCard = db.get(['game...
[ "function addFlippedCard(card) {\n flippedCards.push(card);\n}", "add(card, index = 0){\n if(card instanceof Card){\n this._cards.splice(Math.min(index, this._cards.length -1), 0, card);\n }\n }", "function discardCard(card, index)\n { \n if(card.discard === true)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }