query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
show how many item left
function showItemLeft() { const items = document.querySelectorAll(".list ul li"); const leftItem = (document.querySelector( ".list h5" ).innerHTML = `${items.length} items left`); }
[ "function itemsLeft() {\n const endP = endList.children[0];\n const li = list.children;\n\n if (li.length === 0) {\n endP.textContent = \"No items left\";\n } else if (li.length === 1) {\n endP.textContent = `1 item left`;\n } else {\n endP.textContent = `${li.length} items left`...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This will be called when the Transfer API detects network connectivity is restored The Signiant App should recover and continue transfer
function networkConnectivityRestoredCallback() { console.log("Network Connectivity Restored"); alert("Network Connectivity Restored"); if (transferObject === 'undefined') { alert("transfer object undefined") } else { if (transferObject.currentTransferState == Signiant.Mst.transferState.T...
[ "_onOffline() {\n // this._connection.disconnect(\"gone_offline\");\n this._connection._doDisconnect();\n }", "_changeToOffline() {\n if (this.isOnline) {\n this.isOnline = false;\n this.trigger('disconnected');\n logger.info('OnlineStateManager: Connection lost');\n }\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
refresh lease associated panels
function refreshPanels(ls_id){ var restriction = new Ab.view.Restriction(); restriction.addClause("ls.ls_id" , ls_id); var controller = abRepmAddEditLeaseInABuilding_ctrl; controller.abRepmAddEditLeaseInABuildingLeaseInfo_form.refresh(restriction); if(controller.abRepmAddEditLeaseInABuildingCtryTree.lastNo...
[ "function refreshPanels(ls_id){\n var restriction = new Ab.view.Restriction();\n restriction.addClause(\"ls.ls_id\", ls_id);\n\n var controller = abRepmAddEditLeaseInAProperty_ctrl;\n\n controller.abRepmAddEditLeaseInAPropertyLeaseInfo_form.refresh(restriction);\n controller.leaseId = ls_id;\n\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change character pic depending on gender selected
function genderSelect(gender) { if (gender == "m"){ document.getElementById("charImage").src = 'images/MainChar-Male1.png'; document.getElementById('female').style.border = '1px solid grey'; document.getElementById('other').style.border = '1px solid grey'; document.getElementById('male').style.border = '...
[ "pickGender() {\n let imgsrc;\n\n if (this.state.thirst < 1) {\n imgsrc = tombstone;\n } else if (this.props.millennial.gender === \"Male\") {\n imgsrc = man;\n } else {\n imgsrc = woman;\n }\n return imgsrc;\n }", "function showGender(ans) {\n var dictGend = {\n 'm': 'man',\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the task attribute with the specified id. Returns null if no attribute with that id is found.
function getTaskAttr(id) { var attr = null; var options = area.taskAttr1.options; for (var i=0; i< options.length; i++) { if (options[i].id == id) { attr = options[i]; break; } } return attr; }
[ "getAttribute(id) {\n return this.attributes[id];\n }", "function getTask(id) {\n for (i = 0; i < tasks.length; i++) {\n if (tasks[i].tId == id) {\n return tasks[i];\n }\n }\n }", "function get_task(id) {\n return $('.task[id=\"' + id + '\"]');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Short function that removes the shuffle class from deck, so that it can be reapplied the next time the restart button is clicked
function removeDeckShuffleClass() { DECK.classList.remove('shake-to-shuffle'); }
[ "function removeDeckShuffleClass() {\r\n DECK.classList.remove('shake-to-shuffle');\r\n}", "function addShuffleClass(card) {\n card.classList.add(shuffleArr.pop());\n }", "#reshuffleDeck() {\n let lastCard = this.#discardDeck.shift();\n this.#Deck.setDeck(this.#discardDeck);\n this.#di...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add AFrame coordinates (only x, z) Regular coordinates consider 0,0 in the bottom left corner of a rectangle AFrame coordinates consder 0,0 in the center of the enclosing rectangle depth, width are dimensions of the enclosing rectangle
function aframe_coord(rectangle, parent) { let pwidth = parent.getAttribute('width'); if (pwidth) { rectangle.aframe_x = rectangle.x + rectangle.width / 2 - pwidth / 2; } else { rectangle.aframe_x = rectangle.x; }; let pdepth = parent.getAttribute('depth'); if (pdepth) { rectangle.aframe_z = -1 ...
[ "function addAlignment(x, y) {\n var j;\n frameBuffer[x + width * y] = 1;\n for (j = -2; j < 2; j++) {\n frameBuffer[(x + j) + width * (y - 2)] = 1;\n frameBuffer[(x - 2) + width * (y + j + 1)] = 1;\n frameBuffer[(x + 2) + width * (y + j)] = 1;\n frameBuffer[(x + j +...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change visibility from files
async changePermission(filesVisibility) { const result = await this.doRequest({ path: "/files/permission", method: "PUT", body: filesVisibility, }); return result; }
[ "function visualizza_mod_file(){\n\tvar obj=getObj(\"span_modifica_file\");\n\t\n\t//Se lo span è invisibible\n\tif (obj.style.display==\"none\"){\n\t\tobj.style.display=\"block\"\n\t}\n\telse{\n\t\tobj.style.display=\"none\";\n\t}\n}", "function showReadFile(){\n\t\tlet isVis=document.getElementById('read-file-l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize flags, args, the loglevel, and attach process handlers to allow commands to seemlessly cleanup on interupt or termination
init() { let { args, flags } = this.parse(); this.flags = flags; this.args = args; // sets the log level from verbose, quiet, and silent flags _logger.default.loglevel('info', flags); // ensure cleanup is always performed let cleanup = () => this.finally(new Error('SIGTERM')); ...
[ "init() {\n let { args, flags } = this.parse();\n logger.loglevel('info', flags);\n this.flags = flags;\n this.args = args;\n\n // log and map deprecated flags\n for (let f in this.constructor.flags) {\n let { deprecated } = this.constructor.flags[f];\n\n if (deprecated && flags[f] != nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get recipes from f2f by using api
function getRecipes(ingredient, res,method) { const options = { host: 'www.food2fork.com', path: `/api/search?q=${ingredient}&key=${API_KEY}` }; https.request(options, function (apiResponse) { parseData(apiResponse, res,method) }).end() }
[ "fetchRecipes() {\n const getApi = this.environmentapiUrl + '/getRecipes';\n return this.http.get(getApi);\n }", "getRecipes () {\n return this.execute('get', '/recipes');\n }", "function listRecipes() {\n\n request_params = {\n url: 'http://food2fork.com/api/search?key=ef82898c8dec1bd9...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds and displays the playerScoreMessage showing the player their total number of wins and losses
function playerScoreMessage() { let scoreMessage = document.getElementById("score") let playerWinsMessage = ""; let playerLossesMessage = ""; switch (playerWins) { case 0: playerWinsMessage = "You have not won yet"; break; case 1: playerWinsMessage = "You have won 1 time"; break;...
[ "function winnerUpdate(player){\n\t lastScore = player;\n\t if(player === player1){\n\t\twiningMessage = player1Name + \" \" + \"Won!!\";\n\t\tplayer1Score++;\n\t }\n\t\tif(player === player2){\n\t\twiningMessage = player2Name + \" \" + \"Won!!\";\n\t\tplayer2Score++;\n\t } \n\t\tscoreInfo();\n retu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Imports a Selenium2 file.
function import_sel2_file() { var script = builder.selenium2.loadScriptJSON(); if (script) { open_file(null, builder.convertSel2To1(script)); } }
[ "function WebDriver() {}", "function importFile() {\n\t\topenDialog({\n\t\t\tfilters: [{ name: 'Javascript', extensions: ['js'] }],\n\t\t})\n\t\t\t.then(filename => filename && run('import_extension', { srcPath: filename }))\n\t\t\t.catch(e => alert(e));\n\t}", "function import_suite() {\n var suite = builde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a list of teams for the teamsMenu if there are any keys that begin with 'TEAM' in Twilio configure
function buildManualTeamList (context) { log('buildManualTeamsList', context); const arrayOfTeams = []; Object.keys(context).forEach((key) => { if (key.substring(0, 5).toLowerCase() === 'team2') { const name = context[key]; const keyId = key.substring(5); let escPolicyName; Object.ke...
[ "function setTeams(){\n var i=0;\n \n while(detailService.list.data.rounds[0].matches[i])\n {\n m.teams.push(\n detailService.list.data.rounds[0].matches[i].team1.name\n );\n m.teams.push(\n detailService.list.data.rounds[0].matches[i]....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
code to add Hot image to hot products / Function to manage Hot div and detail on every transition start
function manageImageTransition(){ max = 0; itemdata = ""; $(".slideItem").each(function(){ if($(this).css("z-index") > max){ max = $(this).css("z-index"); itemdata = this; } }); $(".productDesc").remove(); $(itemdata).children("a").append('<div class="productDesc">'+$(itemdata)....
[ "function appendFeatured(response) {\n let sneakers = response;\n for (let i = 0; i < sneakers.length; i++) {\n let sneaker = sneakers[i];\n let product = gen(\"div\");\n product.classList.add(\"featured\");\n let name = sneaker.name;\n product.style.backgroundImage = \"url('img/sneak...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Displays a menu to the |currentPlayer| with the most recent sessions of the target.
async displaySessions(currentPlayer, targetPlayer) { const player = targetPlayer || currentPlayer; const sessions = await this.database_.getPlayerSessions({ userId: player.account.userId, limit: this.getSettingValue('session_count'), }); if (!sessions.length) { ...
[ "function _showMenu(playerId) {\n let html = '';\n\n // Menu options\n let actionsHtml = '<div style=\"text-align: center;\">[Follow](' + FOLLOW_CMD + ' &#64;{selected|token_id} &#64;{target|token_id})</div>';\n\n // Cardinal directions (GM only)\n if(playerIsGM(playerId)) {\n actionsHtml += '<d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1) msg is a string 2) callback is a function
function addMessage(msg,c1) { var myMessage="Be safe "+msg; c1(myMessage); // making a call to callback function }
[ "function callback(){}", "function userCallbackFunction(msg){\n\n msg.content = eval(\"(\"+msg.content+\")\");\n\n var action = msgRules[msg.content.target];\n\n if(action && action.targetUser)\n\taction.targetUser(msg);\n}", "onMessage(callback) {\n this.messageCallback = callback;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
4. Function to multiply three numbers & return the result
function multiplyThree(num0, num1, num2){ let answer = num0 * num1 * num2; return answer; }
[ "function multiplyThree(firstNumber, secondNumber, thirdNumber){\n return firstNumber * secondNumber * thirdNumber;\n}", "function multiplyThree( firstNumber, secondNumber, thirdNumber ){\n let answer = firstNumber * secondNumber * thirdNumber\n return answer;\n}", "function multiplyThree( num1, num2, num3){...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add clusters for one tile
addClusters(tileId, clusters) { const tileClusters = [] clusters.forEach(d => { const cluster = this.createCluster(d) if (this._tiles[tileId]) { // If tile still present this._clusters.addLayer(cluster) } tileClusters.push(...
[ "createCluster(obj, startpoint){\n\n // format and translate the startpoint into something we can use\n // (get an integer that is a multiple of our tilesize)\n let y = Math.floor(startpoint.y / this.tilesize);\n let x = Math.floor(startpoint.x / this.tilesize);\n y *= this.tilesize;\n x *= this.t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses VMAP AdBreaks TODO Detailed documentation can be written
function VMAPAdBreak(xml) { var j = void 0; var k = void 0; var len = void 0; var len1 = void 0; var node = void 0; var ref1 = void 0; var subnode = void 0; var pseudoVast = {}; this.timeOffset = xml.getAttribute('timeOffset'); this.breakType = xml.getAttribute('breakType'); pseudoVast....
[ "function unpackBreakMap() {\n /**\n * Set of of Unicode ranges for a break category.\n * Range can be: a single codepoint (denoted by skip since the last), [start,count] range, or repeating range [start, count, spacing, repeat-count]\n * @type {{\n * [breakCategory: string]: (\n * nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ATI: Update the status of all balls in play.
function updateBalls() { updateObjects('balls'); }
[ "function updateBulbsStatus() {\n \t\tvar bulbsContainer = document.querySelector('#bulbs');\n \t\tvar uiBulbs = bulbsContainer.querySelectorAll('.bulb');\n \t\tvar i = bulbs.length;\n \t\twhile (0 < i) {\n \t\t i--;\n \t\t uiBulbs[i].querySelector('#bulb-off').style.display = bulbs[i].onOff...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
No Spaces Add onkeyup="nospaces(this)" to input fields
function nospaces(t){ if(t.value.match(/\s/g)){ alertify.error('Sorry, no spaces allowed!'); t.value=t.value.replace(/\s/g,''); } }
[ "function no_around_spaces( selector )\n{\n\t$( selector+\">input[type=text]\" ).keyup(function(){\n\t\tthis.value=this.value.trim();\n\t});\n}", "function NoSpaces(e) {\n\tif (e.charCode == 32) e.preventDefault();\n}", "function preventSpaces() {\n\t$('#js-search').on('keypress', '#input', e => {\n\t\tconst ke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a list of available professions from json file
function getProfessionList(filePath, callback) { d3.json(filePath, function(error, data) { callback(data) }) }
[ "function getProfessions() {\n CustomerService.getProfessions().then(function (response) {\n $scope.ProfessionList = response.data;\n },\n function (err) {\n console.log(\"error in getting dropdown : \" + err);\n });\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SERIALIZATION OF MANGA OBJ (NODE > OBJ)
function serializeMangaNode($node){ let obj = {} obj.title = $node.find('#title').html() obj.image = $node.find('img').prop('src') obj.latestChapter = $node.find('#latestChap').html() obj.rating = $node.data('rating') obj.href = $node.data('href') ...
[ "get serializedObject() {}", "static serialize() {\n let serialization = { characters: [] };\n for (let pose of Base.middle.getChildren()) {\n let poseUrl = pose.getComponent(ƒ.ComponentMaterial).material.getCoat().texture.url;\n let origin = Reflect.get(pose, \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send keyvalue targeting in ad request.
function setTargeting() { googletag.cmd.push( function () { var targeting = Config.get( 'targeting' ); if ( $.isEmptyObject( targeting ) ) { return; } $.each( targeting, function ( key, value ) { googletag.pubads().setTargeting(...
[ "function BMLTPlugin_PropagateAPIKey( in_key_value ///< The value of the API Key to spread.\n )\n{\n for ( var option_index = 1; option_index <= c_g_BMLTPlugin_coords.length; option_index++ )\n {\n var apiKeyTextObject = document.getElementById ( 'BMLTPlugin_goo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Uncenter landmark (used for rendering the points)
function uncenterLandmark(landmark) { return [ landmark[0] + palmBase[0][0], landmark[1] + palmBase[0][1], landmark[2], ] }
[ "unproject(xy) {\n const {viewport} = this.context;\n return viewport.unproject(xy);\n }", "clearLevelSetCenter() {\n if (this.m_levelSetCircle !== null) {\n this.m_scene.remove(this.m_levelSetCircle.getRenderObject());\n this.m_levelSetCircle = null;\n this.m_levelSetCenterPoint = null;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
public/javascripts/verify_fonts.js (last modified: 20151110 00:53:02 +0000)
function activate_font_verification() { var counter = 0; var all_ok = false; var error = null; var body = null; var fonts = null; var interval_id = null; function check_fonts() { var hairspace_ff = document.getElementById("hairspace_ff"); counter += 1; var bad_font_...
[ "fontLoadListeners(){this.document&&this.document.fonts&&this.document.fonts.ready.then(function(){this.resizeCheck()}.bind(this))}", "function preload() {myFont = loadFont(\"aller.ttf\");}", "function checkFont() {\n for (glyph in drawnGlyphs) {\n if (drawnGlyphs[glyph].length === 16) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes selection to the end of the body (or right before the signature if there is a signature).
function initSelection() { if (isSelectionInitialized()) { // if initialized already, do nothing return; } var signature = document.body.querySelector(GMAIL_SIGNATURE_SELECTOR); if (signature) { var node; var prevSibling = signature.previousSibling; if (isBreakTag...
[ "function restoreBodyRelativeSelection()\n{\n var sel = CURRENT_SEL;\n CURRENT_SEL = null;\n \n if (sel)\n {\n var dom = dw.getDocumentDOM();\n \n var bodyOffset = dom.nodeToOffsets(dom.body);\n \n sel[0] = sel[0] + bodyOffset[0];\n sel[1] = sel[1] + bodyOffset[0];\n \n if(dom.getView('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method updates the position of the knob based on the change in angle between the mouse and the centre of the slider.
updateKnob(e) { var knobNewX = this.state.knobX; var knobNewY = this.state.knobY; if (e.detail.angleStatus === "VALID") { knobNewX = this.alignKnobSliderX() + this.getSliderRadius() * Math.cos(e.detail.rad); knobNewY = this.alignKnobSliderY() + this.getSliderRadius() * Ma...
[ "function Knob(props) {\n \n const [isHighlighted, setIsHighlighted] = useState(props.isHighlighted);\n const [outputValue, setOutputValue] = useState(props.value);\n const [dragActive, setDragActive] = useState(false);\n const [dragStartY, setDragStartY] = useState(0);\n const [knobImage] = useSt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
is called when the user selects the option to look for POIs along the route shows an error message, if necessary (if no route is present) triggers a service call to look for the POIs
function handleSearchPoiNearRoute(e) { searchPoiAtts[0] = e.currentTarget.checked; if (!routeIsPresent) { $('#checkboxWarn').text(preferences.translate('noRouteFound')); $('#checkboxWarn').show(); } else if (searchPoiAtts[3].length > 0 && routeIsPresent) { theInterface.emit('ui:searchPoiRequest', ...
[ "function findRouteClicked() {\n\t\t// Validate\n\t\tvar cancel = false;\n\t\t$.each(['start', 'finish'], function(sfIndex, sfValue) {\n\t\t\tif ($('#' + sfValue + 'Input').val() === '') {\n\t\t\t\tclearSecondaryAlerts();\n\t\t\t\tshowAlert(messageFillBoth, 'alert');\n\t\t\t\tcancel = true;\t\t\n\t\t\t\treturn;\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
3^(4^2) = 3^16 = 43046721 > 1 console.log(lastDigit([3, 4, 5])); // 3^ 1024 >1 console.log(lastDigit([4, 3, 6])); //4 console.log(lastDigit([7, 6, 21])); //1 Function to find b % a
function Modulo(lastNum, secondToLastNum) { // Initialize result let result = 0; // calculating mod of b with a to make // b like 0 <= b < a for (let i = 0; i < secondToLastNum.length; i++) result = (result * 10 + secondToLastNum[i] - '0') % lastNum; return result; // return modulo }
[ "function lasttDigitt(firstNum, secondNum) {\n\n const a = firstNum.toString();\n const b = secondNum.toString();\n\n let len_a = a.length;\n let len_b = b.length;\n console.log('***', a.length);\n\n // if a and b both are 0\n if (len_a == 1 && len_b == 1 &&\n b[0] == '0' && a[0] == '0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the Fees and Set the Amount
addFees() { if (!this.getFee()) return; const amount = this.getAmount(); const transaction_fee = (parseFloat(this.options.percent) / 100) * amount + parseFloat(this.options.fixed); // Update Cookies Before Changing Amount this.createCookies(); return this.setAmount(amount + transacti...
[ "function updateFee() {\n\n\t}", "function setCurrentOtherFees(){\n\tif (totalVmdVolume < 1000) {\n\t\tmonthlyFees.value = 9.95;\n\t\tmonthlyPciFee.value = 0;\n\t\tnumberOfBatches.value = 20;\n\t\tbatchFee.value = 0.30;\n\t} else if (totalVmdVolume < 10000) {\n\t\tmonthlyFees.value = 9.95;\n\t\tmonthlyPciFee.valu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create node in repository
function createRepositoryItem() { var ref = $('#node-repository-tree').jstree(true); sel = ref.create_node("#", {"type": "file", "text": "A new node"}, "first"); if (sel) { ref.edit(sel); } }
[ "function create_node(error, result) {\n if(error) {\n callback(error);\n } else {\n parentNodeData = result;\n node = new Node(undefined, mode);\n node.nlinks += 1;\n context.put(node.id, node, update_parent_node_data);\n }\n }", "function createNode() {\n if(Graph.newNodeEx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
bonus attack damage [ 1 in 3 chance ]
bonusAttack(bonusDamage){ let chance = Math.floor(Math.random() * 3); return chance === 2 ? bonusDamage = 2 : false; }
[ "attack1(){\n\t\tlet damage = Math.floor(Math.random() * (this.attack1Max-this.attack1Min+1)) + this.attack1Min;\n\t\treturn damage; \n\t}", "function trump2fight() {\n trump2health = trump2health - Math.floor(Math.random() * 30) - (atk*3);\n callGifAttack();\n \n \n hp = hp - Math.floor(Math.random() * ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
4 5 Initially we define the variables required for the elements and then we select the values from the JSON object passed to this function and then put the values in their respective HTML elements.
function displayResults(aq){ let aqi=document.querySelector(".aqi");//selecting the aqi element from HTML aqi.innerHTML=`${aq.list[0].main.aqi}`;//passing the json value in it let co=document.querySelector(".co-util");//selecting the aqi element from HTML co.innerHTML=`${aq.list[0].components.co}`//pas...
[ "_buildDOMElements() {\n let containerElement = document.createElement('div');\n containerElement.id = this.id;\n containerElement.className = 'seelect-container';\n this.containerElement = containerElement;\n\n let selectedElement = document.createElement('div');\n selecte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Writes RDF files per agent, based on their read permissions
async writeGraphs({ filter = RDF_FILES } = {}) { // Empty and recreate the destination folder await rmrf(this.destination).catch(e => null); mkdir(this.destination); // Append each RDF graph to a combined file per agent this.agentFiles = {}; for await (const file of this.reader.getFiles({ filte...
[ "function fSetWriters() {\n wsGotSome = fs.createWriteStream(sOutputFileLocation);\n wsErrorLog = fs.createWriteStream(sResultDir + '/errors.txt');\n}", "function writeRulesToFile() {\n\n let introduction = \"Summary: \\nTotal rows in the original set: \" + transactions.length + \"\\nTotal Rules Disc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
if no recording credit, disable the radio button
function DisableRecordClass() { if(document.getElementById("statusrecording")!=null) { var status=document.getElementById("statusrecording").value; if(status==0) { document.getElementById("rdtypeyes").disabled="disabled"; document.getElementById("rdtypeno").disabled="disabled"; } } else { document.getEleme...
[ "function disableMoneyRadio() {\n document.getElementById(\"colones\").disabled = true;\n document.getElementById(\"dolars\").disabled = true;\n showConvertedTotal();\n showConvertedAdvanced();\n}", "function printradioDisabled() {\n\n\t$('.record-sections input[type=radio]').on( 'change', function() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When user wants to checkin, take all highlighted rows and turn them green
function checkIn(){ var table = document.getElementById('appointment-list'); for(var i=0; i<table.rows.length;i++){ var row = table.rows[i]; if(row.hilite){ row.style.backgroundColor="green"; } } }
[ "function checkOut(){\n var table = document.getElementById('appointment-list');\n for(var i=0; i<table.rows.length;i++){\n var row = table.rows[i];\n if(row.hilite){\n row.style.backgroundColor=\"red\";\n }\n }\n}", "function initRowStyles() {\n // Run once at init...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set a style on the actual element for the control and any repeated elements.
function setStyle(ctrl, name, value) { if (!ctrl || !ctrl.domElement) { return; } ctrl.domElement.css(name, value); if (ctrl.repeatedElements && ctrl.repeatedElements.length) { _.each(ctrl....
[ "styleElement(elem, style) {\r\n let element = elem;\r\n for (let i = 0; i < elem.length || i < 1; i ++) {\r\n if (elem.length) element = elem[i];\r\n for (let key in style) {\r\n element.style[key] = style[key];\r\n }\r\n }\r\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Launch external url this used to facilitate command action url external/command url
function launchExternalUrl(url) { var link = document.createElement('a'); link.href = url; document.body.appendChild(link); link.click(); }
[ "function setupLaunchUrl(){\r\n $(\"body a.external-url[href]\").click(openExternalUrl);\r\n\r\n}", "function openURL(url,winBrowserCmd,macBrowserCmdStart,macBrowserCmdEnd){\r if ($.os.indexOf(\"Windows\") != -1){\r system.callSystem(\"cmd /c \\\"\"+winBrowserCmd + \"\\\" \" + url);\r } else {\r ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Drain the handler queue entirely, being careful to allow the queue to be extended while it is being processed, and to continue processing until it is truly empty.
function drainQueue() { runHandlers(handlerQueue); handlerQueue = []; }
[ "function drainQueue() {\r\n\t\trunHandlers(handlerQueue);\r\n\t\thandlerQueue = [];\r\n\t}", "function drainQueue() {\n\t\trunHandlers(handlerQueue);\n\t\thandlerQueue = [];\n\t}", "drainQueue() {\n while (!this.queue.isEmpty()) {\n this.emit(kDrainMessage, this.queue.dequeue());\n }\n this.emit(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Agrego evento click a las filas de la tabla de la funcion ejercicios para alumnos
function addEventsTablaEj(){ let filasDeTabla = document.querySelectorAll(".filaEjercicioAlumno"); //Sumo funcionalidad para mostrar ejercicio al alumno for(let i=0; i<filasDeTabla.length; i++){ const element = filasDeTabla[i]; element.addEventListener("click", mostrarEjElegido); } }
[ "function iniciar() {\n $(\"#tabla_ciudad_body tr td\").click(clickTabla);\n}", "function handleTableClick() {\n $('.clickable-row').on('click', (e) => {\n const $target = $(e.currentTarget);\n const rowId = $target.data('id');\n\n toggleReader([rowId], []);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open a new 3pane window while the custom mode is selected, and make sure that the mode displayed in the new window is the custom mode.
function test_open_new_window_with_custom_mode() { // Our selection may get lost while changing modes, and be_in_folder is // not sufficient to ensure actual selection. mc.folderTreeView.selectFolder(folder); plan_for_new_window("mail:3pane"); mc.window.MsgOpenNewWindowForFolder(null, -1); let mc2 = wait_f...
[ "setSingleWindowUI() {\r\n Tabmix.singleWindowMode = Tabmix.prefs.getBoolPref(\"singleWindow\");\r\n var newWindowButton = document.getElementById(\"new-window-button\");\r\n if (newWindowButton)\r\n newWindowButton.setAttribute(\"disabled\", Tabmix.singleWindowMode);\r\n\r\n var items = document.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Dispatch action to query remote storage for the entity with this primary key. If the server returns an entity, merge it into the cached collection.
getByKey(key, options) { options = this.setQueryEntityActionOptions(options); const action = this.createEntityAction(EntityOp.QUERY_BY_KEY, key, options); this.dispatch(action); return this.getResponseData$(options.correlationId).pipe( // Use the returned entity data's id to get ...
[ "async fetch () {\n\t\tif (this.notFound.length === 0) {\n\t\t\treturn;\t// got 'em all from the cache ... yeehaw\n\t\t}\n\t\telse if (this.notFound.length === 1) {\n\t\t\t// single ID fetch is more efficient\n\t\t\treturn await this.fetchOne();\n\t\t}\n\t\telse {\n\t\t\treturn await this.fetchMany();\n\t\t}\n\t}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when "Add another toy" is clicked. Adds new tab with blank form. Assigns a toy number to relevant fields so data can be tracked with respect to a specific toy.
function addAnotherToy(e) { if (numToys>0) { e.preventDefault(); } numToys++; trackedToys++; toyIDs.push(numToys.toString()); // Tab is the label that a user clicks var tab = defaultTab.clone(); var tabID = defaultTab.attr('id') + numToys; tab.attr('id', tabID); tab.html('<button type="button" class="c...
[ "function addAnotherToy() {\n\tnumToys++;\n\ttrackedToys++;\n\ttoyIDs.push(numToys.toString());\n\n\t// Tab is the label that a user clicks\n\tvar tab = defaultTab.clone();\n\tvar tabID = defaultTab.attr('id') + numToys;\n\ttab.attr('id', tabID);\n\ttab.html('<button type=\"button\" class=\"close\" onClick=\"closeT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getWordObject for every word in the allSpans array
function getAllWordsTimestamps(){ for(var i = 0; i < allSpans.length;i++){ if(allSpans[i].innerHTML[0] === ' '){ getWordObject(allSpans[i].innerHTML) } } }
[ "resetWordSpans() {\n const ce = this.contextedEval_;\n ce.redrawCurrSentence();\n\n this.tokenSpans_ = ce.getCurrTokenSpans();\n\n const allowSpaceStart = ce.config.ALLOW_SPANS_STARTING_ON_SPACE || false;\n\n this.tokenSpanColors_ = [];\n const spanClassSuffix = (this.startSpanIndex_ < 0) ? '-beg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines the circle's stroke width, based on the provided diameter.
function getStroke(diameter) { return $mdProgressCircular.strokeWidth / 100 * diameter; }
[ "_circleStrokeWidth() {\n return this.strokeWidth / this.diameter * 100;\n }", "_getCircleStrokeWidth() {\n return this.strokeWidth / this.diameter * 100;\n }", "_getStrokeWidth(size){var width=4;if(\"tiny\"==size){width=3}else if(\"small\"==size){width=4}else if(\"medium\"==size){width=5}else if(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets array of objects and builds gets tree using mged's tree command and parses it into json
function getModelTree(objectsArray, filePath) { const tree = {}; const treeCommand = part => `mged -c ${filePath} tree -a -i 2 ${part} 2>&1`; for (const obj of objectsArray) { const currentObject = (tree[ obj[obj.length - 1] === "/" ? obj.substring(0, obj.length - 1) : obj ] = {}); if (obj[obj.l...
[ "function buildingObjectTree(array, obj = {}) {\r\n for (let i = 0; i < array.length; i++) {\r\n if (array[i].parent === null) {\r\n obj[array[i].id] = {};\r\n array.slice(i, 1);\r\n break;\r\n }\r\n }\r\n for (let i = 0; i < array.length; i++) {\r\n tr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
default config for toolbar with default a custom group of style buttons, default link button group, default script button group, and a custom list button groups
get miniConfig() { return [ { type: "button-group", buttons: [ this.boldButton, this.italicButton, this.removeFormatButton, ], }, this.linkButtonGroup, this.scriptButtonGroup, { type: "button-group"...
[ "get defaultConfig() {\n return [\n this.historyButtonGroup,\n this.basicInlineButtonGroup,\n this.linkButtonGroup,\n this.clipboardButtonGroup,\n this.scriptButtonGroup,\n this.insertButtonGroup,\n this.listIndentButtonGroup,\n ];\n }", "updateToolbar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cleanUp Elimina el contenido del historial y los datos de formularios almacenados.
function cleanUp() { setStore(); historyStorage.init(); }
[ "function _customClean() {\n datasetMemories = [];\n datasetArray = [];\n aliasMap = [];\n hdUnionFiles = [];\n\n isHadoopSet = false;\n domStyle.set(dom.byId(constants.FIRST_TABLE_CONTAINER), \"visibility\", \"hidden\");\n domConstruct.em...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new CompactNameplate instance.
function CompactNameplate(index, alignment) { /* jshint -W106 */ this.Container_constructor(); this.setup(index, alignment); /* jshint +W106 */ }
[ "static create() {\n\t\tlet name, muts, atoms;\n\n\t\tcl(`Creating new molecule. \"Ctrl+c\" to exit`.gray);\n\n\t\trl.question(`Name » \\n`.green, molName => {\n\t\t\tname = molName;\n\n\t\t\trl.question(`Mutates (space separated)» \\n`.green, molMutate => {\n\t\t\t\tmuts = molMutate.split(' ');\n\n\t\t\t\trl.quest...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Au clique les tshirts s'affiche en fonction de la recherche $("formrecherche inputafficheTshirt").on("click",affichageTshirt);
function affichageTshirt(){ $.getJSON( "dispatcher.php", { // Je veux que DISPATCHER me donne une info spécifique operation : "tri", createur : $($selectCreateurs+" option:selected").text(), matiere : $($selectMatieres+" option:selected").text(), categorie : $($selectCategories+" o...
[ "function onClick_btRechercher() {\n\tdocument.getElementById('btRechercher').onclick = function() {\n\t\t// Construction du morceau de l'URL correspondant aux filtres de recherche\n\t\t// ?<nom du filtre 1>=<valeur du filtre 1>&<nom du filtre 2>=<valeur du filtre 2>...\n\t\tvar filtres = '?';\n\n\t\t// Ajout du fi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remeasure an li and tab width for spacing, remeasure num of tabs displayed
function set_sizes() { tab_width = $nav_tab.outerWidth(); list_width = $nav_list.outerWidth(); tabs_displayed = list_width / tab_width; //recalculate height of the currently displayed slide var this_sectionHeight = $('.slick-active').outerHeight(); $sections.css('height', this_sectionHeight + 'p...
[ "function setTabWidth(){\r\nvar totalTabs = $('.ms-widget ul.x620').children().length;\r\nif(totalTabs >= 6){\r\n var tabWidth = Number((100/totalTabs).toString().match(/^\\d+(?:\\.\\d{0,2})?/));\r\n $('.ms-widget ul.x620 li').css('width',tabWidth+'%');\r\n $('.ms-widget ul.x620 li .selBg').css('width',tabWidth+'%'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HOURGLASS NAVBRAND Animation to fill the hourglass
function hourglassFill() { let hourglass = document.getElementById('hourglass'); hourglass.innerHTML = "&#xf251"; // half setTimeout(function () { hourglass.innerHTML = "&#xf252"; }, 1000); // end setTimeout(function () { hourglass.innerHTML = "&#xf253"; }, 2000); ...
[ "function dimPie1(){\n let ini = 1;\n let opacityLowerV = setInterval(opacityLower, 10); // gradually lower opacity. could also use CSS animation for this. will run 5 times and each takes 10ms, altogether 60, add to the 540 on line 79 = 600, so when pie1 finish turning, it will...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Safely install process exit listener.
function _safely_install_exit_listener() { const listeners = process.listeners(EXIT); // collect any existing listeners const existingListeners = []; for (let i = 0, length = listeners.length; i < length; i++) { const lstnr = listeners[i]; /* istanbul ignore else */ // TODO: remove support for lega...
[ "setupExitListeners() {\r\n process.on('beforeExit', () => this.destroyConnections());\r\n }", "function processExitHook(fn) {\n // @ts-ignore\n process.on('exit', fn);\n return () => {\n // @ts-ignore\n process.off('exit', fn);\n };\n}", "setupExitListeners() {\n proc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get Setores to fill a select
function getSetores(id) { if (id == "null") { $('#setor').children().remove().end().append('<option value="" disable selected>Selecione o setor</option>'); } //Load Json setor $.ajax({ url: urlApi + "setor", type: 'GET', dataType: 'json', success:...
[ "_fillSelects() {\n\t\t// octaves\n\t\tfor (let i = 1; i <= 7; i++) {\n\t\t\tlet option = document.createElement(\"option\");\n\t\t\toption.value = i;\n\t\t\toption.textContent = i;\n\t\t\tthis._octaveSelectEl.appendChild(option);\n\t\t}\n\n\t\t// keys\n\t\tCHORDS_KEYS.forEach(key => {\n\t\t\tlet option = document....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle fetching an unencrypted file, its associated signature and then validate it. Handles both multiplayer reads and reads from own storage.
function getFileSignedUnencrypted(caller, path, opt) { // future optimization note: // in the case of _multi-player_ reads, this does a lot of excess // profile lookups to figure out where to read files // do browsers cache all these requests if Content-Cache is set? return Promise.all([getFileConten...
[ "async unprotect(){\n try{\n if(this.config.isEncrypted == true && this.config.handler.file_protector !== null){\n // If a file protector is assigned.\n // If config approves contents to be encrypted.\n // Config is synced with the database.\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Step 8: Cancel the editing of a card.
function cancelEditCard() { // 8-1 Set isEditing flag to update the view. this.isEditing = false // 8-2 Reset the id we want to edit. this.idToEdit = false // 8-3 Clear our form. this.clearForm() }
[ "handleCancelNewCard() {}", "cancel() {\n this._cancelWizard.next();\n }", "cancel() {\n let comment = get(this, 'comment');\n comment.rollbackAttributes();\n set(this, 'isEditing', false);\n }", "cancelEditResource() {\n $('#edit-resource-card input').val('')\n $('#edit-reso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rename and copy .gitignore to project root
_writingGitIgnore() { this.fs.copy(this.templatePath('gitignore'), this.destinationPath('.gitignore')); }
[ "function createGitIgnore(targetDir) {\n fs.copyFile(\n path.join('.', 'gitignore.template'),\n path.join(targetDir, '.gitignore')\n );\n}", "function updateGitignoreFile() {\n const gitignoreFile = '.gitignore';\n lightjs.info(`${swProjectConst.UPDATE} '${gitignoreFile}'`);\n\n const backendConfig = p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stackedBarChart is a function called by drawBarChart to draw the chart area for a stacked bar chart. The function takes in three parameters: data: object with five properties: values, labels, scale, title, and legend (as defined for drawBarChart) options: object with seven properties: width, height, spacing, labelColou...
function stackedBarChart(data, options, element) { // extracts needed information from data var values = data.values; var scale = data.scale; var legend = data.legend; // extracts needed information from options var chartWidth = options.width; var chartHeight = options.height; var space = options.spac...
[ "function createStackedBars() {\n //manipulate chart data\n chart.data.forEach(function(d) {\n //set first y value\n var y0 = 0;\n\n //set series\n d.values = axis.serieNames.map(function(name) {\n //set value objec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves bookings from the server.
function getBookings() { const request = new XMLHttpRequest(); let bookings = []; // Request Bookings request.open("GET", "./booking.php"); request.setRequestHeader("Content-Type", "application/json"); request.onreadystatechange = () => { if (request.readyState == 4 && request.status == 200) { bo...
[ "static async fetchAllBookings() {\n return api.get('/booking').then((response) => {\n return response.data.map((b) => new Booking(b));\n });\n }", "static getAllBookings() {\n BookingService.fetchAllBookings().then((b) => {\n BookingStore.bookings = b;\n });\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hides the entire selected Tweet card
function hideTweetCard(index) { const selectedCard = document.querySelector(`#tweetCard${index}`); selectedCard.style.display = 'none'; }
[ "function deselectTweet(){\n $('#tweet-box').hide();\n}", "function hideTweet() {\n document.getElementById('block-twitter').style.opacity = '0';\n return;\n}", "function unhideTanzakus() {\n let cards = document.querySelectorAll('.card-body.hidden');\n for (let i = 0; i < cards.length; i++)\n car...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Example 1 Add file to IPFS and return a CID
saveToIpfs (file) { let ipfsId const fileStream = fileReaderPullStream(file) this.ipfsApi.add(fileStream, { progress: (prog) => console.log(`received: ${prog}`) }) .then((response) => { console.log(response) ipfsId = response[0].hash console.log(ipfsId) this.setState({a...
[ "async addFile(file) {\n const node = await ipfs.create();\n const version = await node.version();\n console.log(\"Version:\", version.version);\n // Upload the file\n const uploadedFile = await node.add(file, { pin: true });\n console.log(`Added file content ${uploadedFile...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all elements that match the given selector. Used for removing choices after you've picked one, as well as for the CLEAR and RESTART tags.
function removeAll(selector) { var allElements = timelineContainer.querySelectorAll(selector); for(var i=0; i<allElements.length; i++) { var el = allElements[i]; el.parentNode.removeChild(el); } allElements = choicesContainer.querySelectorAll(selector); ...
[ "function removeAll(selector)\n {\n var allElements = storyContainer.querySelectorAll(selector);\n for(var i=0; i<allElements.length; i++) {\n var el = allElements[i];\n el.parentNode.removeChild(el);\n }\n }", "removeElements(selector, howMany = undefined)\n\t{\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show itinerary info in the 'itineraryContainer' html container
function showItineraryInfo(){ if(directionsDisplay){ var html = ''; html += '<div id="intinerary"><ul>Your Itinerary:'; var letter = 'A'; for(var i=0;i<itinerary.length;i++){ html += '<li>'+letter+': '+results[itinerary[i]].name+'</li>'; letter = String.fromCharCode(letter.charCodeAt(0) + 1); } html ...
[ "function ViewItineraryPage() { }", "function jnRenderGetItineraryDetailsAsHTML(jnItObj, renderHTML)\n{\n\tvar itName = jnItObj.getName();\n\tvar itNumDays = jnItObj.getNumDays();\n\t\n\trenderHTML.str = renderHTML.str + \"\\n\";\n\trenderHTML.str = renderHTML.str + \"<h3> Itinerary Name: \" + itName + \"</h3>\";...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true or false if Percy has not been disabled
isPercyEnabled() { return process.env.PERCY_ENABLE !== '0'; }
[ "checkDisableCards(){\r\n\t\tif(this.state.disabled){\r\n\t\t\treturn false;\t\t\r\n\t\t}\r\n\t\telse{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}", "_checkEnabled() {\n\t\tthis.isEnabled = !!this._getFirstEnabledCommand();\n\t}", "async isDisabled() {\n const button = await this._button();\n return coe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This funtion will let us check if this animation is going to modify a particular LED.
hasPixel(index, time) { //We get a time because animations shouldn't modify LEDs outside their timelines. It also allows for some expansions that we will talk about later. //This makes a couple of checks. The first is if we are looping, becuasde if we are there is no end to the animation's timeline. The next ch...
[ "function ledsSet(){\n for(let i = 0; i<NUM_LEDS; i++){\n if(!ledArray[i].isActive()){\n return false;\n }\n }\n return true;\n}", "function updateLeds() {\n for (var i = 0; i < 16; ++i) {\n if (currentInstrument.sequence[sequenceNumber][i] > 0) {\n //led sho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makeLink is called on each customer and a Material UI Chip is returned
makeLink(customer) { return ( <Chip key={customer._id} label={customer.name} onDelete={this.handleDelete(customer)} /> ); }
[ "generateClassCard(course_list) {\n\n\n let generateCard = ({id, name, description}, index) => {\n let activeIcon = <img className=\"p-10\" src=\"https://png.icons8.com/filled-circle/p1em/10/2ecc71\"/>;\n let activeText = \"Active\";\n let joinButton =\n <Link ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a Gist object from JSON parse object
function CreateGist(g) { var nextGist = {}; nextGist.id = g.id; nextGist.gisthtml = g.html_url; if (g.description) { nextGist.description = g.description; } else { nextGist.description = 'No Description Provided'; } if (g.hasOwnProperty('owner')) { nextGist.usernam...
[ "static from(json){\n let j=new Jugador();\n Object.assign(j,json);\n return j;\n }", "getGist(url) {\n // return gist object\n \n }", "static fromJSON(jsnmtl, mtags) {\nvar mm;\n//--------\nmm = new MorphsManager(mtags);\nmm.setFromJSON(jsnmtl);\nreturn mm;\n}", "static fromJSON(jsnmphtgt) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When selecting an item from the unordered list, we want to: 1. Highlight the list item as active b. open the corresponding marker's popup iii. pan the map to center the marker
handleListItemClick(position) { const markers = this.state.refs.markers; const marker = markers.filter(marker => { const location = marker.props.location; const _position = [location.latitude, location.longitude]; return ''+_position === ''+position }) .shift(); if (marker) { ...
[ "focusItem(item) {\n // console.log('selectedItem:', item)\n this.markerLayer.eachLayer(layer => {\n if (layer.id === item.id) {\n // console.log(selectedItem)\n // this.map.setView(layer.getLatLng())\n layer.bindPopup(layer.name).openPopup()\n }\n })\n }", "function doMap...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Combine items in collection based on callback starting with initial and return result
function reduce(collection, initial, callback) { var curr = initial; each(collection, function(item) { curr = callback(curr, item); }); return curr; }
[ "function reduce(collection, callback, startValue) {\n //your code here!\n}", "merge(existing, incoming, { args }) {\n const { skip, first } = args;\n // This runs when the Apollo client comes back from the network with our product\n // console.log(`MErging items from the network ${incoming.length...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns preload config from current router
createPreloadConfig() { return PreloadRequests_1.default.resolvePreloadConfig(this); }
[ "static async resolvePreloadConfig(router) {\n const preloadRequests = [];\n const tasks = new Tasks_1.default();\n const destinations = router.getDestinations();\n // Compile all the requests and options across all destinations\n if (!Object.keys(destinations).length) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RMXF viewer video size method Usage: viewer.SetSize(360, 288); or viewer.SetSize("360x288");
function RMXFViewer_SetSize() { var instText1 = "You must install "; var instText2 = "Vidicor View Component"; var instText3 = "Click this link and run the file then follow his instructions."; var instText4 = "Press F5 since installation complete."; var instText5 = "Attention! This page requires additional co...
[ "video_size(val) {\n this._video_size = val;\n return this;\n }", "function setVideoSize() {\n for (let i = 0; i < this.length; i++) {\n this[i].poster = this[i].poster.replace('large', screensize);\n var vidsource = this[i].querySelectorAll('source');\n for (let j = 0; j < vidsource.length; j++)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show all nodes in current Queue
_showAllNodes() { let currentNode = this.head; let nodeCounter = 0; if (currentNode === null) { console.log(`No nodes in current queue`); return null; } console.log(` There're currently ${this.length} nodes in queue `); let nodes = []; while (currentNode !== null) { ...
[ "print() {\n if (this.queue.tail == null) {\n process.stdout.write('[]\\n');\n }\n else {\n let iterator = this.queue.head;\n for (let i = 0; i < this.top; i++) {\n for (let j = 0+i; j < this.top - i; j++) {\n if (iterator.next ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generateRemainingTitles() Function that does what it says basically fills in any titles the player hasn't filled in yet.
function generateRemainingTitles() { for (let i = 0; i < (3 - acceptedTitleAmount); i++) { suggestion(); addCurrentTitle(); } }
[ "_createSongTitles() {\n for (var i = 0; i < this.playList.length; i++) {\n this.playList[i].element.innerHTML = this._getSongTitle(i);\n }\n }", "function initTitle() {\n var r = Math.round(Math.random() * (titles.length - 1));\n $(\"title\").html(titles[r]);\n}", "function cullTi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We use the argument name to create the AllignmentGroup name and push to the array. for our createAllignmentGroup method
createAllignmentGroup() { //prompt to assign names let allignment = prompt("Enter new allignment group:"); //array where we keep all our npcs this.allignmentGroups.push(new AllignmentGroup(allignment)); }
[ "function createGroup(name){\n\tfor (var i in groupList) {\n var group = groupList[i];\n if (group && group.groupName === name) \n return \"Group name has existed in the room\";\n } \n var group={\n\t\tgroupName:name,//The name is the id of group. It is unique in groupList\n\t\tbuffer:[],//This ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Plot a BioActivity Graph
plot(){ /* plot the X and Y axis of the graph */ super.plotXAxis(); super.plotYAxis(); /* (re)draw the points, grouped in a single graphics element */ let canvas = d3.select('svg#canvas_bioActivity > g#graph'); canvas.selectAll('#points').remove(); canvas.append('g') .attr('id', 'poi...
[ "function ChannelPlotChannelAnnotation(imyPlot) {\n var that = new ChannelPlotChannel(imyPlot);\n that.FixedSizeY = 120;\n that.theannotfetcher = new AnnotDataFetcher(imyPlot.ServerUrl);\n that.Title = \"Annotation\";\n this.ClickInfo = [];\n\n that.Draw = function (DrawInfo) {\n this.DrawT...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
8.2 Robots in a Grid Imagine a robot sitting on the upper left corner of a grid with r rows and c columns. The robot can only move in two directions, right and down, but certain cells are "off limits" such that the robot cannot step on them. Design an algorithm to find a path for the robot from the top left to the bott...
function robotGrid(matrix) { var path = []; var lastRow = matrix.length - 1; var lastCol = matrix[0].length - 1; var checkPath = function(row, col, currPath) { if (row === lastRow && col === lastCol) { path.push(currPath.concat([[row, col]])); } else if (row <= lastRow && col <= lastCol) { ...
[ "function robotPaths (grid) {\n var resultPath = [];\n var columnLength = grid.length - 1;\n var rowLength = grid[0].length - 1;\n\n function innerTraverseHelper(column, row, currentPath){\n \n if (column === columnLength && row === rowLength) {\n resultPath = currentPath;\n }\n\n if(column <= ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
moveSelectedOptionsLeft(select_object,select_object[,autosort(true/false)[,regex]]) This function moves options between select boxes. Works best with multiselect boxes to create the common Windows control effect. Passes all selected values from the first object to the second object and resorts each box. If a third argu...
function moveSelectedOptionsLeft(from,to) { // Unselect matching options, if required if (arguments.length>3) { var regex = arguments[3]; if (regex != "") { unSelectMatchingOptions(from,regex); } } // Move them over if (!hasOpti...
[ "function moveOptions( objSource, objDestination ){\r\n\tif( objSource.selectedIndex != -1){\r\n\t\tfor( mo_Ctr=(objSource.options.length-1); mo_Ctr>=0; mo_Ctr-- ){\r\n\t\t\tif( objSource.options[mo_Ctr].selected ){\r\n\t\t\t\tt_Opt = objSource.options[mo_Ctr];\r\n\t\t\t\toption = new Option( t_Opt.text, t_Opt.valu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
$> $<IResumableUpload.LastChunkSaved Gets date when last chunk was saved to this file.
get lastChunkSaved() { return this.fileInfo.ctime; }
[ "lastModifiedDate() {\n return this.file instanceof Blob ? this.file.lastModifiedDate : null;\n }", "get lastModifiedDate() {\n return new Date(this.lastModified);\n }", "get lastModifiedTime() {\n return this.getStringAttribute('last_modified_time');\n }", "get lastModified() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the Swell Direction property value and rotate's the Icon based on that number.
function rotateSwellArrow(degrees) { return ( <NavigationIcon style={{ transform: `rotate(${degrees + "deg"})`, color: "black" }} ></NavigationIcon> ); }
[ "get rotate_90_degrees_ccw () {\n return new IconData(0xe418,{fontFamily:'MaterialIcons'})\n }", "get threed_rotation () {\n return new IconData(0xe84d,{fontFamily:'MaterialIcons'})\n }", "get rotate_right () {\n return new IconData(0xe41a,{fontFamily:'MaterialIcons'})\n }", "get rotate_left () {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates a WebSocketQueue from a given topic. It connects to a consumer from the config list, depending on the hash of the topic.
function subscribeToAConsumer(topic) { const ws = new WebSocket("ws://" + config_1.default.consumers[utils_1.hashCode(topic) % config_1.default.consumers.length] + "/" + encodeURIComponent(topic)); return new Promise((res, rej) => { let opened = false; ws.on("open", () => { const res...
[ "function createQueueSocket(){\n hostname = window.location.hostname\n const socket = new WebSocket('wss://'+hostname+'/ws');\n return socket\n}", "function connectToAProducer(index) {\n return __awaiter(this, void 0, void 0, function* () {\n const ws = new WebSocket(\"ws://\" + config_1.default.prod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
track the number of users the inviting user has invited
async setNumInvited () { const numInvited = this.invitedUsers.reduce((total, userData) => { if (!userData.wasOnTeam) { total++; } return total; }, 0); if (numInvited === 0) { return; } const op = { $set: { numUsersInvited: (this.user.get('numUsersInvited') || 0) + numInvited, modifiedAt:...
[ "async setNumInvited () {\n\t\tconst numInvited = this.invitedUsers.length;\n\t\tif (numInvited === 0) { return; }\n\t\tconst op = {\n\t\t\t$set: {\n\t\t\t\tnumUsersInvited: (this.user.get('numUsersInvited') || 0) + numInvited,\n\t\t\t\tmodifiedAt: Date.now()\n\t\t\t}\n\t\t};\n\t\tthis.transforms.invitingUserUpdate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method is called when the object is dragged. Transfers the object data as a JSON string via the event
onDrag(event, obj){ event.dataTransfer.setData("draggedObject", JSON.stringify(obj)); }
[ "function getData(event) {\n return JSON.parse(event.originalEvent.dataTransfer.getData('text/plain'));\n }", "handleOndragstart(event) {\n const dataTransfer = JSON.stringify({id: event.target.dataset.id, column: event.target.dataset.column});\n event.dataTransfer.setData(\"text/plain\", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
enabling mouse click on grid
function setGridToClickable(grid){ grid.style.pointerEvents="visiblePainted"; }
[ "function enableMouseClick() {\n // Add event listener for mouse click events to the canvas\n canvas.addEventListener(\"mousedown\", function (evt) {\n triggerMouseEvent(evt, canvas, connectedGame.mouseClickEvent);\n }, false);\n }", "function setGridToNonCli...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Making buttons for holiday array
function renderButtons(){ //So we don't have repeating buttons $("#buttonDiv").empty(); for (holiday of topics){ //make button var b = $("<button>"); b.addClass("btn btn-light"); b.attr("data-name", holiday); b.text(holiday); ...
[ "function addEventOfButtonHoliday (button) {\n let holidays = document.querySelectorAll('.holiday');\n button.addEventListener('click', function (){\n holidays.forEach(holiday => {\n holiday.classList.toggle('selectionColorHolidays');\n });\n });\n}", "renderButtons (firstDate, visibleDate, selected...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide nav item contents and reset the cached the element.
hideContent () { if (this.$openNav) { this.$openNav.removeClass('is-active'); this.$openNav = null; } }
[ "function hideNav() {\n\t\t$(_element).find('.kks_nav').hide();\n\t}", "function removeAndHide() {\n removeActiveNavClass();\n hideCurrentSection()\n}", "function eraseNavHTML() {\n $(\"#nav .course-item\").remove();\n}", "static hide() {\n var nav = EditImage.getNavigation();\n nav.classLi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Store Topic to Local Storage function
function storeTopicLocally(topic) { let topics; if(localStorage.getItem('topics') === null) { topics = []; } else { topics = JSON.parse(localStorage.getItem('topics')); } topics.push(topic); localStorage.setItem('topics', JSON.stringify(topics)); }
[ "function setTopic() {\r\n\tsaveSetting(lastVisitedTopic, document.location.toString(), false);/* Save the URL of the topic. */\r\n}", "function saveTopic(event){\n var data = $('#inputDiv :input').serialize();\n var url = window.location.origin.replace(/[0-9]{4}/, '4000') + '/topics';\n var type = 'POST...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
XPATH FOR MEETING CARD ALL HEADER Xpath for Meeting Card All Header Date
get meetingHeader_Date() {return browser.element("//android.view.ViewGroup[2]/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup/android.view.ViewGroup[1]");}
[ "get horseCard_Race_Date() {return browser.element(\"//android.widget.ScrollView/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup/android.widget.TextView[2]\");}", "getSearchResultHeader(){\n return $('//h1[contains(@class,\"Title-sc\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Using the letter heights given, determine the area of the rectangle highlight in 'mm^2' assuming all letters are '1mm' wide. For example, the highlighted word = 'torn'. Assume the heights of the letters are t = 2, 0 = 1, r = 1 and n = 1. The tallest letter is 2 high and there are 4 letters. The hightlighted area will b...
function designerPdfViewer(h, word) { // our alphabet let alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] // an object that hold the key/value pairs for our alphabet let object = {} // loop to create our ke...
[ "function designerPdfViewer(h, word) {\n let _word = word.toLowerCase()\n let wordArray = [..._word]\n let letterIndex = { a: 0, b:1, c:2, d:3, e:4,f:5,g:6,h:7,i:8,j:9,k:10,l:11,m:12\n ,n:13,o:14,p:15,q:15,r:17,s:18,t:19,u:20,v:21,w:22,x:23,y:24,z:25}\n let heights = []\n wordArray.forEach((le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Class: Worm Objectives: handles the worm as an object / ==================================================================== Constructor Worm(params) [generates worm and it's behaviour] Params: string wormId [=cellType according to gameboard class], int startPosX, int startPosY, int length [just initial length], int sp...
function Worm(wormId, startPosX, startPosY, length, speed) { //that is local scope of the class Worm //that = this; // * Private properties * var position = []; // array of positions string x_y where worm is located var wormId = wormId; // string wormId according to cellType of gameboard class var length = len...
[ "function Worm(wormId, startPos, startTarget, wormLength) {\n\n\t// * Private properties *\n\t\n\t// storage for private variables\n\tvar priv = {};\n\n\tpriv.wormPositions = []; // array of positions string x_y where worm is located, in order: from tail to head\n\tpriv.wormId = wormId; // string wormId according t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the next exercise in the assignment which is not complete, returns the index for said exercise
function findNextExercise(assignmentNr, exerciseNr) { //Iterate through exercisesFinished[assignmentNr] and return the first index which is not complete, said index is then used //in exercisesArray to load the correct next unfinished exercise for(i = exerciseNr; i < exercisesFinished[assignmentNr].length; ...
[ "function findNextExercise(assignmentNr, exerciseNr)\n{\n for(var i = 0; i < 30; i++){\n for(var a = 0; a < 13; a++){\n exercisesGlow[a][i] = false\n }\n }\n //Iterate through exercisesFinished[assignmentNr] and return the first index which is not complete, said index is then used \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of main / DESC : runs a list of error checks on file that cause the SVG exporter to fail PARM : OBJECT_DOC(document to check errors) RTRN : ARRAY_STRING(array of all errors in document)
function findFileErrors ( activeDoc ) { var layerStatusLocked = []; var layerStatusVisible = []; var fileErrorString = ""; var fileTxtOutput; var array_errorList = []; var findNonNative = "[NonNativeItem ]"; var findRasterImage ="[RasterItem ]"; var isNonNative; var isRaster...
[ "function findErrorsInfFileArray(array_AIFilePaths, searchWriteTxtPath){\n var array_cleanAIFilePaths = [];\n var string_fileErrors;\n var array_fileErrorList = [];\n var int_numErrorFiles = 0;\n \n createTxtErrorFile(null, searchWriteTxtPath, null, \"create\"); // creates a error .txt file\n \n for(var y...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create Dealer Bust Modal
function dealerBust() { dealerBustModal.style.display = "block"; }
[ "render() {\n var _this = this\n var opts = {\n autoOpen: true,\n modal: true,\n title: `Bill ${this.id}`,\n width: '500',\n height: '600',\n buttons :[\n {'text': 'Order more..', \n 'click': function(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove train from database
function removeTrain(ID) { database.ref().child(ID).remove(); }
[ "function removeTrain(train_id){\n // console.warn(train_id);\n firebase_db.ref(\"trains/\" + train_id).remove();\n}", "function removeTrain() {\n $(document).on('click', '.remove-train', function(event) {\n event.preventDefault();\n var trainId = $(this).attr('data-trai...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
to edit invoice using invoicenumber
function editinvoice(inv) { var inv= inv; window.location = 'edit-job-invoice/' + inv; }
[ "function goToEditInvoice() {\n\t\t\t\t\t\t\tif (data.invoiceId > 0) {\n\t\t\t\t\t\t\t\tdiState.go('portal.invoices.editById', { id: data.invoiceId });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}", "function editInvoiceLine(e) {\n\tif($(e.currentTarget).children('input').length == 0){\n\t\tvar val = $(e.currentTarget).html()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the lifecycle configuration out of the uucket props
parseLifecycleConfiguration() { if (!this.lifecycleRules || this.lifecycleRules.length === 0) { return undefined; } return { rules: this.lifecycleRules.map(parseLifecycleRule) }; function parseLifecycleRule(rule) { const enabled = rule.enabled !== undefined ? rule...
[ "parseLifecycleConfiguration() {\n if (!this.lifecycleRules || this.lifecycleRules.length === 0) {\n return undefined;\n }\n const self = this;\n return { rules: this.lifecycleRules.map(parseLifecycleRule) };\n function parseLifecycleRule(rule) {\n var _d, _e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Click the "Update shopping cart" button
clickUpdateCart() { this.updateCart.click(); }
[ "function triggerCartSubmit() {\n jQuery('#uc-cart-view-form #edit-update').trigger('click');\n}", "function GoToCart() {\r\n\t$('#cartPreviewButton').click();\r\n}", "clickAddToCartButton() {\n this.addToCartButton.waitForDisplayed()\n this.addToCartButton.click()\n }", "function doUpdate...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the artboard containing the given layer, null if the layer isn't contained within an artboard, or the layer if it is itself an artboard.
function getContainingArtboard(layer) { while (layer && !isArtboard(layer)) { layer = layer.parentGroup(); } return layer; }
[ "function getLayerWithName(layerName, artboardName) {\n var all_layers = getArtboardWithName(artboardName).layers();\n for (x = 0; x < [all_layers count]; x++) {\n if (all_layers.objectAtIndex(x).name() == layerName) {\n return all_layers.objectAtIndex(x);\n }\n }\n}", "function isArtboard(lay...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
normalizeNGramNode normalizes probabilities of the node, and invokes normalizeNGramNode function in each direction for its descendants.
function normalizeNGramNode (node) { var nextTotal = 0.0 for (var k in node) nextTotal += node[k].prob for (var k in node) { node[k].prob /= nextTotal normalizeNGramNode(node[k].backw) normalizeNGramNode(node[k].forw) } }
[ "function portableNormalize( node )\n{\n\t// Internet Explorer often crashes when it tries to normalize\n\tif ( 'exploder' != detectBrowser( ) )\n\t\tnode.normalize( );\n\telse\n\t{\n\t\tif ( ELEMENT_NODE != node.nodeType )\n\t\t\treturn;\n\t\tvar child = node.firstChild;\n\t\tvar next;\n\t\twhile ( null != child )...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers a mutation observer to observe any mentions in the body.
function registerMentionObserver() { var target = document.querySelector(DIV_BODY); if (!MentionObserver) { MentionObserver = new MutationObserver(function(mutations) { var range = getRange(); var mentionToken; var chipAncestor; mutations.forEach(function(mutation) { chipAncestor...
[ "_addMutationObserver() {\n this._observer = new MutationObserver(this._onMutateBound);\n this._observer.observe(this.containerEl, {childList: true, attributes: true, characterData: true, subtree: true});\n }", "function attachObserver()\n{\n mutationObserver.observe(document.querySelector('.messages'), {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }