query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Return variable values of declaration or assignment contained in node. Same as getVariableNames but evaluate variables to discover their values.
static getVariableValues(state, node) { let valuesMap = new Map(); let varNodes = this.reduceNodeToVarDeclaration(node); if (!varNodes) { return valuesMap; } this.getVariableNames(varNodes).map(varName => valuesMap.set(varName, state.eval(varName))); return va...
[ "static getVariableNames(node) {\n if (node.type === 'VariableDeclaration') {\n let decl = node;\n return decl.declarations.map(d => {\n let varName = EsprimaHelper.patternToString(d.id);\n return varName;\n });\n }\n else if (node....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
yx titles and scale
function addXYTitles(svg,xTitle,yTitle,xAxis,yAxis,width,height){ var ticks = svg .append("g") .attr("class", "x axis") .attr("transform", "translate(0," + height + ")") .call(xAxis) .selectAll('.tick'); for (var j = 0; j < ticks[0].length; j++) { var c = ticks[0][j], n = ticks[0][j+1]; if (!c || !n || !...
[ "_positionTitles () {\n\n\t\t// Position to horizontal centre in the middle of the plot area.\n\t\tlet centred = this.plotLeftOffset + (this.plotAreaWidth / 2);\n\n\t\tlet titleBox = getBox(this.titleElement);\n\t\tsetTransform(this.titleElement, centred, this.chartOptions.titlePadding + (titleBox.height / 2));\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start a new search with a new domain
function newSearch(domain) { window.domain = domain; $("#currentDomain").text(window.domain); $("#completeSearch").attr("href", "https://emailhunter.co/search/" + window.domain + "?utm_source=chrome_extension&utm_medium=extension&utm_campaign=extension&utm_content=browser_popup"); $(".loader").show(); $("#re...
[ "function changeSearchDomain (domain)\n\t{\n\t\taddDebug(0, \"changeSearchDomain setting current DB value for domain to \"+domain+\".<br>\");\n\t\tcurrentDomain=domain;\n\t\tappAPI.db.set(\"searchDomain\", domain);\n\t\tsetDomainToggleTitle(currentDomain); // update title \n\t}", "_startNewSearchWithNewWord() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mostrar jogos da desenvolvedora informada
function jogosDaDesenvolvedora(desenvolvedora){ let jogos = []; for (let categoria of jogosPorCategoria) { for ( let jogo of categoria.jogos ) { if (jogo.desenvolvedora === desenvolvedora){ jogos.push(jogo.titulo) } } } console.log("Os jogos da " + desenvolvedora + " são: " + jogos...
[ "decrirePerso() {\r\n const description = this.nom + \"possède\" + this.sante + \"et fait \" + this.degat + \" points de dégâts avec son arme\";\r\n return description;\r\n }", "function mostrarDevoluciones() {\n elementos.mensajePanel.addClass('hide');\n elementos.devolucionesTabla.removeCla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to find order payment by username
function findOrderPaymentByUsername(username, callback) { var queryStr = "SELECT `order`.`order_id`, `order`.`order_date`, buyer_username, SUM(unit_price * product_quantity) AS order_total, `order`.`payment_method_id`, payment_method_type, payment_method.is_locked AS payment_is_locked " + " FROM `order`, `order_d...
[ "function getOrdersByUsername(username, callback) {\n\n\tvar query = {\n\t\tusername: username\n\t};\n\n\tOrder.find(query, function (err, orders) {\n\t\tif (err) callback(err, null);\n\t\telse callback(null, orders);\n\n\t});\n}", "function getCustomerByOrder (order) {\r\n\r\n}", "deriveTotalPaymentCost(paymen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
common perobject storage area made visible by patching getOwnPropertyNames'
function getOwnPropertyNames(obj){ var props = getProperties(obj); if (hasOwn(obj, globalID)) splice(props, indexOf(props, globalID), 1); return props; }
[ "function safeGetOwnPropertyNames(from) {\n\tvar names = getOwnPropertyNames(from),\n\t\ttmp, i, name;\n\tif (from === ObjectPrototype) {\n\t\ttmp = createSack();\n\t\tfor (i = 0; i < names.length; i++) {\n\t\t\tname = names[i];\n\t\t\tif (!/^__/.test(name))\n\t\t\t\tpush(tmp, name);\n\t\t}\n\t\tnames = slice(tmp);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Before render get the default keymap and load it TODO: Allow user to request personalized keymap, move this to external function to be called when keymap changes
componentWillMount() { var updateKeymap = function(keymap, name) { this.setState({ "keymap": keymap, "cmd": new InfoCmd("Loaded " + name) }); if (this.bindings != undefined) { this.bindings.unbindAll(); } this.bindings = new Bindings(keymap, this.handleKeyStri...
[ "async loadDefaultKeymap({ state }) {\n const keyboardPath = state.keyboard.slice(0, 1);\n // eslint-disable-next-line\n const keyboardName = state.keyboard.replace(/\\//g, '_');\n const resp = await axios.get(\n `keymaps/${keyboardPath}/${keyboardName}_default.json`\n );\n if (resp.status ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Download all documents in "download" section An interval must be used because browsers limit the number of documents can be downloaded within a timeframe TODO: Change to zip served from backend on BE zip implementation
function handleDocumentDownloads() { const downloadPaths = [...documents] interval = setInterval(() => downloadDocument(downloadPaths), 500) }
[ "function multiDownload(filenames) {\n const getFilesIterator = function* () {\n while (filenames.length) {\n yield filenames.shift();\n }\n };\n const getFile = getFilesIterator();\n\n const timer = setInterval(function() {\n let filename = getFile.next().value;\n if (filename) {\n window...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
on mouseReleased send the mousePressedData as a single snapshot to the data array
function mouseReleased() { if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) { data.push(mousePressedData); //empty the mousePressedData array mousePressedData = []; //send snapshot to everyone socket.emit('snapshot', { data: data, }); ...
[ "function mousePressed() {\n let x = map(mouseX, 0, width, 0, 1);\n let y = map(mouseY, 0, height, 1, 0);\n x_vals.push(x);\n y_vals.push(y);\n}", "function mousePressed() {\n data.training_data.push({\n class: currentClass,\n x: mouseX,\n y: mouseY\n });\n}", "function mousePress...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
psuedo code... remove all special characters then start... 1. loop through the string and store each letter that is lowercase... 1a. the storing should in the same objects one for every letter.. 2. after looping and the objects are filled respectively. check if the length of each prop:value is length > 1; if it isn't l...
function mix(s1, s2) { console.log(s1, "string2: " + s2) var finalStr = ""; // remove all unnecessary characters in the string.. s1 = s1.replace(/[^a-z]/gi, ''); s2 = s2.replace(/[^a-z]/gi, ''); var letterOccurrenceInSentences = {}; // moves all the occurrence of every letter into a obje...
[ "function mostWanted(string) {\n let str = string.toLowerCase();\n let evalObj = {};\n let finalLetter = \"\";\n let counter = -Infinity\n 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'];\n\n for (let value of str) {\n alphabet.indexO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions to insert new record into shipping_info table shippingtables's fields: shipping_info_id (auto), shipping_to_name, shipping_address_id, shipping_contact_phone insert fields (3): all except shipping_info_id, which is auto incremented
function insertShipping(shippingInfo, callback) { var queryStr = "INSERT INTO `shipping_info` ( shipping_to_name, shipping_address_id, shipping_contact_phone ) " + " VALUES ( ? , ? , ? );"; var queryVar = []; if (shippingInfo.shippingToName === undefined) { queryVar.push(""); } else { quer...
[ "function insertShippingRecord (data) {\n var reference =\n data.ref_number == '' || !data.ref_number ? 'None' : data.ref_number\n var saveRec = record.create({\n type: 'customrecord_blank_shipments'\n })\n saveRec.setValue({\n fieldId: 'name',\n value: data.shippingnumber\n })\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PLUGIN FUNCTIONS loads the gmap plugin, then call 'callback' e.q. this.loadPlugin('year_view');
loadPlugin(plugin,callback){ var _plugin = this.getPlugin(plugin); //must deffer the callback to inject the initialization of the xcal plugin var _callback = function(){ if (_plugin && !_plugin.is_loaded) _plugin.is_loaded = true; _.isFunction(callback) && callback(); //only now call the real callback...
[ "function load() {\r\n\tif (GBrowserIsCompatible()) \r\n\t{\r\n\t\t// create map mapContainer\r\n\t\tvar mapTag = document.getElementById(\"map\");\r\n\t\t\r\n\t\tmap = new GMap2(mapTag);\r\n\t\t\r\n\t\t// add controls\r\n\t\tmap.addControl(new GSmallMapControl());\r\n\t\tmap.addControl(new GMapTypeControl());\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add equation to array, add removal button
function pushEquation() { //if equation isnt a misclick and drawing is enabled if (canvas.style.display === "block" && equation.length > 5) { points.push(equation); equation = []; var editor = document.getElementById("editor"); editor.innerHTML += "<img id=\"remove" ...
[ "function removeEquation(index) {\n var equation = points[index];\n points[index] = null;\n\n // Remove points from canvas\n for (var i = 0; i < equation.length; i++) {\n ctx.clearRect(equation[i][0] - 8, equation[i][1] - 8, 16, 16);\n }\n\n document.querySelector(\"#remove\" + index).remov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
expands path of specified configuration file, if necessary, and verifies existence of the file
function checkConfig(f) { f = fo.GetAbsolutePathName(trimit(f)); if ( !fo.FileExists ( f ) ) { if ( !fo.FileExists ( scriptPath + f ) ) { WSHShell.Popup ( 'Configuration file not found:\n' + f, 0, mbTitle, 16 ); WScript.Echo ( 'Configuration file not found.' ); WSHShell ...
[ "function configExistsCheck() {\n let exists = fs.existsSync(configPath);\n if (!exists) {\n setConfigFile(DEFAULT_CONFIG);\n }\n}", "hasConfigurationFile() {\n return this.fs.exists(this.destinationPath('compose.json'));\n }", "function findConfigFile(filePath) {\n\t\tlet prev = null\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse an if statement
parseIf() { // assumed that substring begins with 'if' //skip keyword if this.skipKw("if"); // grab if conditition, comma delimited const cond = this.parseExpression(); // check the content of the expression var then = this.parseProg(); var tok = { type: "if", cond: cond, then: then }; ...
[ "function parse_if() {\n\n skip_kw(\"if\");\n const cond = parse_key_args();\n input.next();\n if (!is_punc(\"{\")) input.croak(\"The statements must be in a {} block. Please add a {.\");\n\n const then = parse_expression();\n const ret = {\n type: \"if\",\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The highlight configuration is dependent on how we use the content in the UI. For example, we feel we need about 3 lines (max) of highlights of content under each title. If we feel it shows too many highlights in the search result UI, we can come back here and change it to something more appropriate.
function getHighlightConfiguration(query) { return { pre_tags: ['<mark>'], post_tags: ['</mark>'], fields: { title: { fragment_size: 200, number_of_fragments: 1, }, headings: { fragment_size: 150, number_of_fragments: 2 }, // The 'no_match_size' is so we can display...
[ "function blogModeHighlightHelper(){ \n const editor = playbackData.editors[playbackData.activeEditorFileId] ? playbackData.editors[playbackData.activeEditorFileId] : playbackData.editors[''];\n \n const selection = editor.getSelectedText();\n\n if (selection !== \"\"){\n const numbersAbove = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill the grid table when a layer is selected in gridControl
function fillGrid(layerId){ //console.log("layer Id="+layerId); var columnNames=[]; var th='<thead><tr>'; var tdA,td='<tbody>'; var table='<table id="attributes">'; for(var k=0;k<capas.length;k++){ var capaId=capas[k].layerId; if(layerI...
[ "function populateLayersTable() {\n loadingElementFinished('table-container');\n\n const layers = getCurrentLayers();\n const tableBody = $('#tbody');\n $('#color-fxn-editor').hide();\n tableBody.empty();\n for (let i = layers.length - 1; i >= 0; i--) {\n const layer = layers[i];\n tableBody.append(crea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the user clicks on the edit button, all object markers shown on the marking area are made editable. If there is no object marker on the marking area, a message is shown to the user.
function editMarkingRectangle() { if(EDITING === status) { // If the user is already editing the marking area, stop. alert('You are already editing the marking area. Click on the "Update" button to save the changes.'); return; } // Check whether there are objects marks to edit. const howManyToEdit = document.ge...
[ "function EditMarkerClickHandle() {\n document.getElementById(\"Title\").contentEditable = true;\n document.getElementById(\"Description\").contentEditable = true;\n document.getElementById(\"DateVisited\").readOnly = false;\n document.getElementById(\"CategoryEditor\").disabled = false;\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add some road crosswalks to the scene
function addRoadCrosswalks() { const tex = new THREE.TextureLoader().load("src/textures/street_crosswalks.png"); tex.anisotropy = renderer.capabilities.getMaxAnisotropy(); tex.repeat.set(3, 1); tex.wrapT = THREE.RepeatWrapping; tex.wrapS = THREE.RepeatWra...
[ "function road() {\n\t\tpiece = \"road\";\n\t}", "function add_elements_to_scene() {\n\n add_nucleus_proton_to_scene();\n add_electron_ground_state_to_scene();\n add_electron_excited_state_to_scene();\n\n}", "function highlightRoads() {\n\tfor (var i = 0; i < board.paths.length; i++) {\n\t\tif (board.p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ReduxDenormalizer has two modes: 1st FindStorage mode Provide getStore and storagePath dynamically get latest storage 2nd ProvideStorage mode There is no getStore and storagePath, denormalization functions require storage to resolve relationships
constructor(getStore, storagePath) { // storage reference will be updated every time denormalizing // Object denormalizer requires normalizedData object when initialising super({}); if (!getStore && !storagePath) { this.provideStorageMode = true; } else { this.provideStorageMode = false...
[ "_storage() {\n return getStorage(get(this, '_storageType'));\n }", "updateStorageMap(storage) {\n const denormalizationStorage = this.createStorageMap(storage);\n super.setNormalizedData(denormalizationStorage);\n }", "fetchDeferredUserStorageByKind(context) {\n if (context.rootGetters.storageU...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate new court object
function generateCourtObj(oldCourtData, resultData) { let courtDetail = resultData.venueCourts; if (isArrayNotEmpty(courtDetail)) { for (let j in courtDetail) { let object = { lat: courtDetail[j].lat, lng: courtDetail[j].lng, courtNumber: courtDetail[j].courtNumber, venueId...
[ "async function newCourt() {\n code = await generateAccessCode();\n return await insertCourt(code);\n}", "function generateClub() {\n return {\n id: generateId(),\n name: clubName(),\n proTeam: initTeam(12),\n youthTeam: initTeam(10)\n };\n}", "addCourse(courseData) {\n let courseObje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the current image data
function getImageData() { //get the minimum bounding box around the drawing const mbb = getMinBox() //get image data according to dpi const dpi = window.devicePixelRatio const imgData = canvas.contextContainer.getImageData(mbb.min.x * dpi, mbb.min.y * dpi, ...
[ "getCurrentImg() {\n return this.ctx.getImageData(0, 0, this.width, this.height);\n }", "function getImageData(){\n\n }", "function getImageData() {\n return ctx.getImageData(0, 0, elem.width, elem.height);\n }", "function getData(img){\r\n can...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns main classes for the component combined with dialog main classes.
get mainClasses() { return classNames(super.mainClasses); }
[ "_getDialogClasses(size = 'small') {\n return {\n box: '',\n form: '',\n prompt: `dialog aui-layer aui-dialog2 aui-dialog2-${size}`,\n close: 'aui-hide',\n fade: 'aui-blanket',\n button: 'button-control',\n message: 'aui-dialog2-con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this will draw an additional piece of the hangman
function drawHangman () { // hangmanParts correlates to the number of lives a user has // how can we be sure to always draw the right body part in accordance with how many lives we have? // each item in this array is a function that will draw the hangman part // make sure when you access the hangman item that y...
[ "function drawHangMan(triesUp) {\n switch (triesUp) {\n case 1:\n // Bottom line\n ctx.moveTo(20, 190);\n ctx.lineTo(150, 190);\n ctx.strokeStyle = '#ff0000';\n ctx.stroke();\n break;\n case 2:\n // Left pole line\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get document by documentId
getDocument(documentId, cb) { let doc = this._getDocument(documentId) if (!doc) { return cb(new Err('DocumentStore.ReadError', { message: 'Document could not be found.' })) } cb(null, doc) }
[ "function getDoc(id) {\n if(docs.hasOwnProperty(id)) {\n return docs[id];\n }\n return undefined;\n}", "function getExistingDocument(id) {\n return wsk.actions.invoke({\n actionName: packageName + \"/read-document\",\n params: { \"docid\": id },\n blocking: true,\n })\n .then(a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Emits a notification that the user indicates a desire to view the details of a product.
notifyShowDetail(evt) { evt.preventDefault(); this.dispatchEvent( new CustomEvent('showdetail', { bubbles: true, composed: true, detail: { productId: this.displayData.id } }) ); }
[ "OnClick(products){\n console.log(\"product selected\")\n BuySdkManager.presentProductwithId(String(products.product_id));\n console.log(\"product view displayed succesfully\");\n }", "function showProductModal(productId) {\n\n var titleMarkup = '<div style=\"display:inline-block;marg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles moving all rebel projectiles to their next position
function moveRebelProjectiles(modifier, list) { //move projectiles incrementProjectilePosition(list, modifier); }
[ "function ProjectileHandling()\n{\n arr_activeProjectiles.forEach(function(element, index)\n {\n //Before drawing the object, we move it\n element.HorizontalMovement();\n //Delete the projectile if it reached the end of the level\n if(element.x > element.objSprite.width + intLevelW...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset Droppable Box Everything in droppable box is reset and speed increases
function resetDroppableBox() { for (let i = 0; i < idArray.length; i++) { wordObjects[idArray[i]].reset(); // the project resets idArray = []; outputArray = []; $droppableBox.empty(); } }
[ "function ResetSlots() {\n $('.slot:empty').droppable('option', 'accept', '.socket-item');\n}", "function reset(event, ui) {\n // move the draggables outside the droppable area with easeoutelastic animation\n ui.draggable.position({\n my: \"top+50px\",\n //at the bottom of the window\n at: \"center-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
heh. shuffle! Shuffle works by getting all the coordinates of the adjacent points to the void Then it randomly chooses one, based on the number of adjacent points returned Then it goes through the puzzlepieces to find the div to move and once it finds it, it moves it to the void.
function shufflemiseh() { var adj = getadjacentpoints(); var rand = Math.floor(Math.random() * adj.length); var piecetomove = adj[rand]; var l = piecetomove.split(","); l[0] = l[0] + "px"; l[1] = l[1] + "px"; var davoid = whereisthespace(); var y = davoid[0]; var x = y.split(","); var m = document...
[ "function shuffle(){\n\t\tsquare = $(\"#puzzlearea div\");\n\t\tvar zavi = Math.floor(Math.random() * 87);\n\t\tfor (var madandbad = 0; madandbad < zavi; madandbad++){\n\t\t\t\t\tfor(var i=0;i < 15;i++){\n\t\t\t\t\tvar tTop=parseInt(square[i].style.top);\n\t\t\t\t\tvar lLeft=parseInt(square[i].style.left);\n\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Confirms the order so the waiter can confirm and send it to the kitchen.
function confirmOrder() { const orderId = sessionStorage.getItem("orderId"); const dataToSend = JSON.stringify({ orderId: orderId, newOrderStatus: "READY_TO_CONFIRM" }); post("/api/authTable/changeOrderStatus", dataToSend, function (data) { if (data === "success") { window.location.replace("/c...
[ "function confirmOrder() {\n \n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"orderPlace\",\n message: \"Please confirm the order above.\",\n default: false\n }\n \n ]).then(function(order) {\n if (order.orderPlace == false)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates page instance whose _id is pageId
function updatePage(pageId, page) { return Page.update( { _id: pageId }, { $set: { name: page.name, title: page.title, dateUpdated: Date.now() } } ); }
[ "function updatePage(pageId, page) {\n return pageModel.update({_id: pageId}, {$set: page});\n}", "function updatePage(pageId, page) {\n for (var p in pages) {\n if (pages[p]._id == pageId)\n pages[p] = page;\n }\n }", "function updatePage(pageId...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves the face across the defined plan that intersects the closet, without overlapping the closet's slots
moveFace() { let closetSlotsFaces = this.closet.getClosetSlotFaces(); if (this.raycaster.ray.intersectPlane(this.plane, this.intersection)) { let closetLeftFace = this.closet.getClosetFaces().get(FaceOrientationEnum.LEFT).mesh(); let closetRightFace = this.closet.getClosetFaces().get(FaceOrientation...
[ "moveSlot() {\n if (this.raycaster.ray.intersectPlane(this.plane, this.intersection)) {\n let newPosition = this.intersection.x - this.offset; //Subtracts the offset to the x coordinate of the intersection point\n let leftFace = this.closet.getClosetFaces().get(FaceOrientationEnum.LEFT).mesh();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hides and removes the current dialog being shown.
hideCurrentDialog_() { if (this.currentDialog_) { this.currentDialog_.removeAttribute('active'); removeAfterTimeout(this, this.currentDialog_, 200); this.currentDialog_ = null; } }
[ "function _hide( dialog ) {\n\tdialog.wrapper.style.display = 'none';\n }", "function hideDialog () {\r\n\t$('.dialogContainer').hide();\r\n\t$('.dialogTextContainerFit').hide();\r\n\t$( '.dialogPartner').hide();\r\n\t$( '.dialogButton').hide();\r\n}", "hide() {\n this.hidden = true;\n // imple...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply Jasmine settings and set up anything else needed by the testing environment.
function configureJasmineEnvironment() { const timeout = getClientArg('testTimeout'); if (timeout) { jasmine.DEFAULT_TIMEOUT_INTERVAL = Number(timeout); } const logLevel = getClientArg('logLevel'); if (logLevel) { shaka.log.setLevel(Number(logLevel)); } else { shaka.log.setLevel(shaka.log.Level...
[ "function configure(){\n /**\n * Default configuration options - override these in your config file\n * (e.g. var preambleConfig = {timeoutInterval: 10}) or in-line in your tests.\n *\n * windowGlobals: (default true) - set to false to not use window globals\n * (i.e. ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Autoupdating Markdown list numbers when a new item is added to the middle of a list
function incrementRemainingMarkdownListNumbers(cm, pos) { var startLine = pos.line, lookAhead = 0, skipCount = 0; var startItem = listRE.exec(cm.getLine(startLine)), startIndent = startItem[1]; do { lookAhead += 1; var nextLineNumber = startLine + lookAhead; var nextLine = cm.getLine(next...
[ "function setupListItemNumbering() {\n\n var start = 1;\n\n $(\".section-title\").each(function() {\n var ol = $(this).next();\n ol.attr('start', start);\n start += ol.children().length;\n });\n}", "function setupListItemNumbering() {\n \n var start = 1;\n \n $(\".section-title\").each(function() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::RuleGroup.NotStatement` resource
function cfnRuleGroupNotStatementPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnRuleGroup_NotStatementPropertyValidator(properties).assertSuccess(); return { Statement: cfnRuleGroupStatementPropertyToCloudFormation(properties.statement),...
[ "function CfnRuleGroup_NotStatementPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
inject ShoppingListCheckOffService for toBuyController toBuyController.$inject = ['ShoppingListCheckOffServiceFactory'];
function toBuyController(ShoppingListCheckOffServiceFactory){ var toBuyList = this; //get toBuyList from service toBuyList.items = ShoppingListCheckOffServiceFactory.getToBuyList(); //function that calls the service function that moves the selected item to boughtList toBuyList.buyItem = function(i...
[ "function ToBuyController(ShoppingListCheckOffService){\n //variables declaration\n this.products = ShoppingListCheckOffService.getProductListToBuy();\n\n this.buyProduct = function(index){\n ShoppingListCheckOffService.buyProduct(index);\n };\n\n }", "function ToBuyController(ShoppingListCheckO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implemente que calcula a potencia eira positiva de um numero
function potencia(base, expoente) { return 0 }
[ "function negativo(numero){\n if (numero===0){\n return 0;\n }\n return numero *-1;\n}", "function toPosInt(number) {\n return Math.floor(Math.abs(number));\n }", "function testNumber(n, amtPRow)\n{\n var newN = n / amtPRow;\n var result = (newN - Math.floor(newN)) !== 0;\n\n\n return r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find all journals for a given user.
static async findUserJournals(username){ const journalRes = await db.query (`SELECT id, username, title, description, plant_id AS "plantId" FROM journals WHERE username = $1 ...
[ "async myJournals(parent, args, ctx, info) {\n if (!ctx.request.userId) {\n throw new Error(\"You must be logged in\");\n }\n\n return ctx.db.query.journals(\n {\n where: {\n creator: {\n id: ctx.request.userId,\n },\n },\n },\n info\n );\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Strip away Couchdb/pouchdb metadata.
function cleanMeta(obj) { delete obj._id; delete obj._rev; delete obj.docType; }
[ "function removeInfoData() {\n\tconst query = {\n\t\t'name': 'nginx__test',\n\t\t'sha': '0000000000000000000000000000000000000000000000000000000000000000',\n\t};\n\treturn databaseSingleton.collection(TEST).deleteOne(query);\n}", "_cleanUserMetadata (metadata) {\n USER_PROPS.forEach(prop => {\n if (!(prop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert 'Z' segments to 'L' segments
function zToL(path){ var ret = []; var startPoint = ['L',0,0]; for(var i=0, len=path.length; i<len; i++){ var pt = path[i]; switch(pt[0]){ case 'M': startPoint = ['L', pt[1], pt[2]]; ret.push(pt); break; case 'Z': ...
[ "function zToL(path) {\n var ret = [];\n var startPoint = ['L', 0, 0];\n\n for (var i = 0, len = path.length; i < len; i++) {\n var pt = path[i];\n switch (pt[0]) {\n case 'M':\n startPoint = ['L', pt[1], pt[2]];\n ret.push(pt);\n break;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Try to reminify original input with standard options to see if it matches expect_stdout.
async function reminify(test, input_code, input_formatted) { if (process.env.TEST_NO_REMINIFY) return true; const { options: orig_options, expect_stdout } = test; for (var i = 0; i < minify_options.length; i++) { var options = JSON.parse(minify_options[i]); options.keep_fnames = orig_options...
[ "function checkRawOutput(args, lineFinder, testString, stream, cb) {\n let av = ['-c', configCfg].concat(args);\n if (isScality) {\n av = av.concat(isScality);\n }\n process.stdout.write(`${program} ${av}\\n`);\n const allData = [];\n const allErrData = [];\n const child = proc.spawn(pro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flush the buffer of new commands into the main list.
@action flush() { if (this.buffer.length > 0) { const newList = [...this.buffer.reverse(), ...this.all.slice()] this.buffer = [] this.all.replace(newList.slice(0, MAX_COMMANDS)) } setTimeout(() => this.flush(), FLUSH_TIME) }
[ "flush() {\n api.sendCommands(this.commands);\n this.commands = [];\n }", "function flushBuffer() {\n refresh(buffer);\n buffer = [];\n }", "function flushCmd() {\n var cmds = cmd.slice(0);\n cmd = [];\n for (var i=0; i<cmds.length; i++) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is used to traverse the right contour of a subtree. It returns the rightmost child of node or the thread of node. The function returns null if and only if node is on the highest depth of its subtree.
function nextRight(node) { var children = node.children; return children.length && node.isExpand ? children[children.length - 1] : node.hierNode.thread; }
[ "rightmostDescendant(node) {\n const outgoing = this.getOutgoing(node)\n if (outgoing.length == 0) return node\n return this.rightmostDescendant(outgoing[outgoing.length - 1])\n }", "function nextRight(node) {\n var children = node.children;\n return children.length && no...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
$utility: indentOneSpace $keywords: indent $eg: __NONE__ $desc: Adds one space to the beginning of each line
function indentOneSpace() { utilitymanager_1.um.utilityManager({ utilType: utilitymanager_1.um.TIXUtilityType.utLineUtility, sp: utilitymanager_1.um.TIXSelPolicy.All, }, function (up) { return ' ' + up.intext; }); }
[ "function indentOneSpace() {\n utilitymanager_1.um.utilityManager({\n utilType: utilitymanager_1.um.TIXUtilityType.utLineUtility,\n sp: utilitymanager_1.um.TIXSelPolicy.All,\n }, function (up) { return ' ' + up.intext; });\n }", "function tryIndentAfterSo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines the number of pages needed based on number of students in list Creates elements that will hold page page links Appends page links to the DOM and assigns active class to the page link that is being viewed.
function appendPageLinks(studentList) { numberOfPages = Math.ceil(totalStudents / 10); pagLinks = document.createElement('div'); pagLinks.className = 'pagination'; pagUL = document.createElement('ul'); pagUL.setAttribute("id", "links"); pageDiv.appendChild(pagLinks); pagLinks.appendChild(pagUL); for (le...
[ "function appendPageLinks(list) {\r\n const studentsPerPage = Math.ceil(list.length/10);\r\n console.log({list, studentsPerPage})\r\n const pageDomElement = document.querySelector('.page');\r\n const pageContent = document.createElement('div');\r\n pageContent.classList.add('pagination');\r\n const page...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This functions changes the colour of a square when you move the mouse over it
function changeSquareColor(){ $('.square').hover(function () { $(this).css("background-color", "#0F0F0F") }); }
[ "function mouseupSquareYellow() {\n box.style.backgroundColor = \"yellow\";\n}", "function hover() {\n //Get current position\n let thisX = this.style.left;\n let thisY = this.style.top;\n\n //if the pieces can move, hover red, and cursor with \"pointer\"\n if(letsMove(thisX,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Destroys "game over" text.
function destroyTextGameOver() { if (textGameOver) { textGameOver.destroy(); } }
[ "function drawGameOverText()\n{\n\tconst displayText = \"Game over\";\n\tconst textPos = {\n\t\tx : 750 - ctx.measureText(displayText).width / 2,\n\t\ty : 400 - resetTextTimer\n\t};\n\n\tctx.globalAlpha = 1 - (1 / 100 * resetTextTimer);\n\tctx.fillText(displayText, textPos.x, textPos.y);\n\tctx.globalAlpha = 1;\n\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the Output according to the Message Properties
function createOutput(message) { var name; var type; if (message.property("streams_scheduler_destination").exists()) { name = message.property("streams_scheduler_destination").value().toString(); type = message.property("streams_scheduler_destination_type").value().toString(); } else { ...
[ "write(props) {\n let logTraces = this.logTraces;\n\n const logLevel = this.tryGetLevel('error') || this.tryGetLevel('warn') || 'info';\n\n let strings = logTraces.map((logTrace, idx) => {\n return `[${idx + 1}] ${logTrace.logLevel.toUpperCase()} ${logTrace.logTitle} : ${logTrace.message}`;\n });\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
is node1 child of node2 ?
function isChildOf(node1, node2) { // Node.prototype.isChildOf while (node1.parentNode) { if (node1.parentNode == node2) return true; node1 = node1.parentNode; } return false; }
[ "function contains_child(parent_node, child_node_type) {\r\n\t// not yet implemented\t\r\n}", "function isNodeAChildOf(otherNode) {\n\t\t\t\t\t\tvar children = otherNode[nodesProperty];\n\t\t\t\t\t\tif (angular.isArray(children)) {\n\t\t\t\t\t\t\tfor (var i = 0; i < children.length; i++) {\n\t\t\t\t\t\t\t\tvar ch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a text to plural form ('you' is changed to 'them', etc).
function pluralize(text){ var replacements = { 'Yourself': 'Themselves', 'yourself': 'themselves', 'Your': 'Their', 'your': 'their', 'You': 'They', 'you': 'they' }; $.each(replacements, function (singular, plural){ text = text.replace(new RegExp(singular,'g'),plural); }); return t...
[ "function pluralize(str) {\n return inflected.pluralize(str);\n}", "function pluralizeText(text, count) {\n var ntext = count ? count : \"No\";\n ntext += ' ' + text;\n if (count != 1) {\n ntext += 's';\n }\n return ntext;\n }", "pluralize (noun, count) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Private: startsWith / / Args / str string to test against / pattern string pattern to check at beginning of str / / Returns / return boolean value of pattern match result
function startsWith(str, pattern) { return str.slice(0, pattern.length) == pattern }
[ "startWith(string, start) {\n if ( !string ) return false;\n return string.substr(0, start.length) == start;\n }", "function startsWith(stringaa, pattern){\n return stringaa.slice(0, pattern.length) == pattern;\n}", "function startsWith(haystack, start) {\n if ((typeof (haystack) == 'string...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retorna los elementos de una lita que hacen match con el str
elementosMachingWithString(str, array){ let st = str; if(st === undefined){st = ''} return array.filter((ele) => ele.getName().toLowerCase().match(st.toLowerCase())); }
[ "function grabscrab(str, arr) {\n let matches = [];\n\n for (let idx = 0; idx < arr.length; idx += 1) {\n if (str.split('').sort().join('') === arr[idx].split('').sort().join('')) {\n matches.push(arr[idx]);\n }\n }\n\n return matches;\n}", "function containChar1 (arr, l)\n{\n// debugger\n var out...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Activate pop over for all annotations
function showAllAnnotations(){ for(var annot_id in annotations){ var annot = annotations[annot_id]; annot.elem.popover('show'); } annotFlag = true; }
[ "toggleAnnotations() {\n if (!this.annotationsActive) {\n this.openAnnotations();\n }\n else {\n this.closeAnnotations();\n }\n }", "function hideAllAnnotations(){\n for (var annot_id in annotations){\n var annot = annotations[annot_id];\n annot.elem.popover('hide');\n }\n\n annotF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unloads the object's buffers
Unload() { // TODO: Unload buffers }
[ "Unload()\n {\n if (this._vb)\n {\n device.gl.deleteBuffer(this._vb);\n this._vb = null;\n }\n }", "unload() {\n this._unpopulate();\n this._rawSrc = undefined;\n this._text = undefined;\n this._parseTree = undefined;\n }", "Unload() {\n if (this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wraps an event listener with preventDefault behavior.
function wrapListenerWithPreventDefault(listenerFn){return function wrapListenerIn_preventDefault(e){if(listenerFn(e)===false){e.preventDefault();// Necessary for legacy browsers that don't support preventDefault (e.g. IE) e.returnValue=false;}};}
[ "function wrapListenerWithPreventDefault(listenerFn) {\n return function wrapListenerIn_preventDefault(e) {\n if (listenerFn(e) === false) {\n e.preventDefault();\n // Necessary for legacy browsers that don't support preventDefault (e.g. IE)\n e.returnValue = false;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method simplex_out(index_in) search index for out from basis
simplex_out(index_in) { var ind = -1; var min_a = 0; for (let i=0; i<this.n; i++) { if (this.numerator[i][index_in] <= 0) continue; var a = (this.b_numerator[i] / this.b_denominator[i]) * (this.denominator[i][index_in] / this.numerator[i][index_in]); if (a < 0) continue; if (ind == -1 || a < min_a) { ...
[ "simplex2_in(ind_out) {\n\t\tvar ind = -1;\n\t\tvar min_a = 0;\n\t\tfor (let i=0; i<this.m; i++) {\n\t\t\tif (this.f_numerator[i] > 0) continue;\n\t\t\tif (this.numerator[ind_out][i] >= 0) continue;\nvar a = (this.f_numerator[i] * this.denominator[ind_out][i]) / (this.numerator[ind_out][i] * this.f_denominator[i])...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When you click on a zone it locks its color to green.
function greenClick(){ $(this).unbind("mouseleave"); $(this).css('background-color','green'); if($(".container div .zone ").stylee.background-color==='green'){ console.log("congratulations!!!"); } }
[ "function markerColor(e) {\n if (whoseTurn === 0) {\n e.target.style.color = \"blue\";\n } else {\n e.target.style.color = \"red\";\n }\n}", "function mouseClicked() {\n background(250, 250, 100)\n}", "function clickEvent(evt) {\n console.log(evt.target);\n const target = evt.targe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the state of the chain.
function getChainState() { getEosTable("global", 1).then((result) => { console.log('ChainState: ' + JSON.stringify(result.rows[0])) chainState = result.rows[0] }, handleError) }
[ "function getState() {\n return state;\n }", "function getState() {\n return state;\n }", "function getState () {\n return state\n }", "getState() {\n return this._state;\n }", "get state() {\n if (!this._state)\n this.startState.applyTransaction(this);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new JSA CAS TRSet from the given components.
static createFromStr(name4ccstr, rot, trans) { var trset; //------------- trset = new CASTRSet(); trset.setFromStr(name4ccstr, rot, trans); return trset; }
[ "static create(name4cc, rot, trans) {\nvar trset;\n//------\ntrset = new CASTRSet();\ntrset.setFrom(name4cc, rot, trans);\nreturn trset;\n}", "setFromTRSet(trs) {\n//-----------\nthis.fourCCName = trs.getFourCC();\n// Overwrite rotation, translation.\nRQ.setQV(this.rotation, trs.getRotation());\nreturn V3.setV3(t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the products in local storage or make it an empty array
function loadProducts() { let productsList = JSON.parse(localStorage.getItem("productsList")); if (productsList == null) { return []; } else { return productsList; } }
[ "static getProducts() {\n const products = JSON.parse(localStorage.getItem('products'))\n return products;\n }", "loadFromStorage() {\n\n let products = this.all();\n products.forEach(product => this.products.set(product.id, product))\n }", "function getProductFromS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a single recipe by slug for the specified artisan.
getRecipe(artisanSlug, recipeSlug) { return __awaiter(this, void 0, void 0, function* () { return yield this._handleApiCall(`${this.gameBaseUrlPath}/artisan/${artisanSlug}/recipe/${recipeSlug}`, 'Error fetching specified recipe.'); }); }
[ "getArtisan(artisanSlug) {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this._handleApiCall(`${this.gameBaseUrlPath}/artisan/${artisanSlug}`, 'Error fetching the specified artisan.');\n });\n }", "getItem(recipeSlug) {\n return this.items.find(({ slug }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
attract everything in the inputted array
attract(objArray){ for (let i = 0;i<this.planets.length;i++){ for (let k = 0; k< objArray.length;k++){ this.planets[i].attract(objArray[k]); } } }
[ "function replaceArray(arr) {\r\n this.array = arr ? arr : this.array;\r\n return this.array;\r\n}", "function update_array()\n{\n array_size=inp_as.value;\n generate_array();\n}", "function indexArrayByAttr(inArray, attr) {\r\n inArray.forEach( function(elem,ignore,arr){\r\n // Add a nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the node id for the type ("source" or "target") or throw if we haven't seen the node.
function safeGetNodeId(type, edge) { var nodeId = edge[type].dagre.id; if (!g.hasNode(nodeId)) { throw new Error(type + " node for '" + e + "' not in node list"); } return nodeId; }
[ "function safeGetNodeId(type, edge) {\n var nodeId;\n if (type in edge) {\n nodeId = edge[type].dagre.id;\n } else {\n if (!(type + \"Id\" in edge)) {\n throw new Error(\"Edge must have either a \" + type + \" or \" + type + \"Id attribute\");\n }\n nodeId = edge[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create an invisible form which posts to 'path' with 'parameters'
function post(path, parameters) { var form = $("<form></form>"); form.attr("method", "post"); form.attr("action", path); $.each(parameters, function(key, value) { var field = $("<input></input>"); field.attr("type", "hidden"); field.attr("name", key); field.attr("value", value); form.app...
[ "function _postHiddenForm(path, params) {\n var form = xdom.createElement(\"form\");\n xdom.setAtt(form, \"method\", \"POST\");\n xdom.setAtt(form, \"action\", path);\n\n for(var key in params) {\n if(params.hasOwnProperty(key)) {\n var hiddenField = xdom.createElement(\"input\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sumAll:list>number Sumar todos los elementos de una lista function sumAll(list) sumAll([1,2,3])>6 sumAll([0,1])>1 sumAll([1,1])>0
function sumAll(list) { if(length(list) == 1) { return first(list); } else { return first(list) + sumAll(rest(list)); } }
[ "function sumAll(list) {\n if(length(list) == 1) {\n return first(list);\n } else {\n return first(list) + sumAll(rest(list));\n }\n}", "function sum(list) {\n\n}", "function sum(list)\r\n{\r\n\tvar sum = 0;\r\n\tfor (var i = 0; i<list.length; i++)\r\n\t{\r\n\t\tsum += list[i];\r\n\t}\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to add a hint button
function addHintButton (caption, datai18n) { datai18n = datai18n || 'button.hint' return addHelperButton( 'fa-lightbulb-o', caption, 'btn-tutorial-hint', datai18n ) }
[ "addHintToDisplay () {\n this.createSection([\"div\", \"p\", \"button\"], [\"id\", undefined, \"id\"],\n [\"hint\", \"hint\", \"get-hint\"], 'scoreboard');\n document.querySelector('#hint p')\n .textContent = \"click the button below to trade a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attaches a context menu to any selected graph nodess
function attachContextMenus() { DAGContextMenu.call(graphSVG.node(), graphSVG.selectAll(".node")); DAGContextMenu.on("open", function() { DAGTooltip.hide(); }).on("close", function() { graphSVG.selectAll(".node").classed("preview", false); graphSVG.selectAll("...
[ "function addContextMenus() {\n var graph = graphFromSvg();\n $(\"#graph svg g.node\").each(function() {\n var nodeId = $(this).attr(\"id\");\n var menu = $(\"#job-context-menu-template\").clone();\n var menuId = \"job-context-menu-\" + nodeId;\n menu.attr(\"id\", menuId);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the message ID of the message associated with the exception. May be null if there is no message associated or the exception was thrown before extracting the message ID.
function getMessageId() { if (messageId) return messageId; if (this.cause && this.cause instanceof MslException) return this.cause.messageId; return undefined; }
[ "function getMessageId() {\n if (messageId)\n return messageId;\n if (self.cause && self.cause instanceof MslException)\n return self.cause.messageId;\n return undefined;\n }", "function getMessageID(e) {\n let messag...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exposure fx object. Looks for the conf value exposure which should be between 100 and 100 for it to take affect. An exposure value of 0 will stop the fx.
function ExposureFx () { if (!(this instanceof ExposureFx)) return new ExposureFx(); }
[ "computeExposure(sliderValue) {\n return Math.pow(1.05698, sliderValue) + 0.0000392163 * sliderValue;\n }", "function SaturationFx () { \n\tif (!(this instanceof SaturationFx)) return new SaturationFx();\t\n}", "public function evade()\n\t{\n\t\tif(Random.Range(0.0, 100.0) <= getEvasionRate())...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls the specified Reveal.js method with the provided argument and then pushes the result to the notes frame.
function callRevealApi( methodName, methodArguments, callId ) { let result = deck[methodName].apply( deck, methodArguments ); speakerWindow.postMessage( JSON.stringify( { namespace: 'reveal-notes', type: 'return', result, callId } ), '*' ); }
[ "function callRevealApi(methodName, methodArguments, callback) {\n\n var callId = ++lastRevealApiCallId;\n pendingCalls[callId] = callback;\n window.opener.postMessage(JSON.stringify({\n namespace: 'reveal-notes',\n type: 'call',\n callId: callId,\n m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
cancel remove / Invoked at app/views/phases/_archive_note.html.erb L.18
function cancel_archive_note(c_id) { var c_id = $(this).prev(".comment_id").val(); $('.archive_comment_class').hide(); $('#view_comment_div_'+ c_id).show(); }
[ "function cancelAddNote(){\n\t\t\t$rootScope.showDetailsHeaderButton=true;\n\t\t\t$rootScope.$broadcast(\"toggle-addNoteModalView\");\t\n\t\t\tquoteDetailFactory.addNoteSendNotificationClicked=false;\n\t\t\t$scope.newNote.noteValue=\"\";\n\t\t\t$scope.request.notificationEmails=[];\n\t\t\tnewRequestFactory.temporar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create featureElement to be appended to selected ul could have used a instead
function createFeatureElement(feature) { const li = document.createElement("li"); li.dataset.feature = feature; const img = document.createElement("img"); img.src = `images/feature_${feature}.png`; img.alt = capitalize(feature); li.append(img); return li; }
[ "createFeatureListElement() {\n let element = this._el('ul', '_feature-list');\n\n return element;\n }", "function createFeatureElement(feature) {\n const li = document.createElement(\"li\");\n li.dataset.feature = feature;\n console.log(feature);\n const img = document.createElement(\"img\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attachment Formatting Helpers Display a humanreadable file size. Currently we always display things in kilobytes because we are targeting a mobile device and we want bigger sizes (like megabytes) to be obviously large numbers.
function prettyFileSize(sizeInBytes) { var kilos = Math.ceil(sizeInBytes / 1024); return mozL10n.get('attachment-size-kib', { kilobytes: kilos }); }
[ "get _fileSizeText()\n {\n // Display the file size, but show \"Unknown\" for negative sizes.\n let fileSize = this.dataItem.maxBytes;\n if (fileSize < 0) {\n return DownloadsCommon.strings.sizeUnknown;\n }\n let [size, unit] = DownloadUtils.convertByteUnits(fileSize);\n return DownloadsComm...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: arenaController.addimage functionality: this function adds an image to an arena
function addimage(req, res, nxt) { var newimage = { data: req.files[0].buffer }; var arenaid = req.params.arenaid; Arena.findOne({ _id: arenaid }, function (err, arena) { if (err) { return res.status(500).json({ error: err.message }); } if (!arena) { return res.status(400).json({ error: 't...
[ "addImage() {\n }", "addImage(url) {\n this.editor.execute('image', url);\n this.editor.updateHeight();\n }", "addImage(idx, path, left, top, name, canMove = true, scalex = 1, scaley = 1) {\n\t\tfabric.Image.fromURL(path, function (oImg) {\n\t\t\toImg.left = left;\n\t\t\toImg.top = top;\n\t\t\toImg.name...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
data.source_id data.target_id data.define data.present data.equate
function Relation(data) { this.source_id = data.source_id; this.target_id = data.target_id; this.define = new mode_1.Mode({ source_id: data.source_id, target_id: data.target_id, type: 'DEFINE', relationships: data.define }); this.pr...
[ "function linkData(data) {\n this.source = parseInt(data['sourceIdx']);\n this.target = parseInt(data['targetIdx']);\n if ('value' in data) {\n this.value = parseFloat(data['value']);\n } else {\n this.value = 3;\n }\n if ('relation' in data) {\n this.relation = data['relation...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::WebACL.BlockAction` resource
function cfnWebACLBlockActionPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnWebACL_BlockActionPropertyValidator(properties).assertSuccess(); return { CustomResponse: cfnWebACLCustomResponsePropertyToCloudFormation(properties.customRespon...
[ "function cfnWebACLAllowActionPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_AllowActionPropertyValidator(properties).assertSuccess();\n return {\n CustomRequestHandling: cfnWebACLCustomRequestHandlingPropertyToCloudFormatio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
connect server and check username,password if connect one server is failure and then try next host until all hosts are tried.
function _check_username_and_password(){ try{ if(_selected_host_index >= _new_host_list.length){//if check finish all host, but still can't pass verified, then return false;' _selected_host_index = 0; ...
[ "function doConnect() {\n attemptCount++;\n attemptTimestamp = new Date();\n attemptSingleConnect().then(\n registerHandlersAndDomains, // succeded\n function () { // failed this attempt, possibly try again\n if (attemptCount < CONNEC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Upsert a slopePercentage based on provided column name which will be used as the basis for calculation
upsert_slopePercentage(baseColumn){ var availableKeys = Object.keys(this.data.intervalls[0]); if (this.contains(availableKeys,baseColumn) != true){ throw new Error("Column name is not available. Available columns are: " + availableKeys.toString()); }else{ var baseColumn_slopePercentage = baseCo...
[ "function slope(p) {\n return (p[2] - p[0]) !== 0 ? (p[3] - p[1]) / (p[2] - p[0]) + '' : 'undefined';\n}", "function slope(serie,startBarsAgo,endBarsAgo){\n\t\tvar dx = startBarsAgo - endBarsAgo;\n\t\tvar dy = diffSeries(barsAgo(serie,endBarsAgo), barsAgo(serie,startBarsAgo));\n\t\t\t\t\n\t\treturn div(dy,dx);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a string from an U32 and an U16 view on a memory.
function getStringImpl(U32, U16, ptr) { var dataLength = U32[ptr >>> 2]; var dataOffset = (ptr + 4) >>> 1; var dataRemain = dataLength; var parts = []; const chunkSize = 1024; while (dataRemain > chunkSize) { let last = U16[dataOffset + chunkSize - 1]; let size = last >= 0xD800 && last < 0xDC00 ? ch...
[ "function getStringImpl(U32, U16, ptr) {\n var dataLength = U32[ptr >>> 2];\n var dataOffset = (ptr + 4) >>> 1;\n var dataRemain = dataLength;\n var parts = [];\n const chunkSize = 1024;\n while (dataRemain > chunkSize) {\n let last = U16[dataOffset + chunkSize -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse and create sprite sheet for data/currency.json entries.
async function parseCurrencyIcons() { console.time('CurrencyIcons'); const currencies = require('../../data/currencies.json'); const paths = []; currencies.forEach(currency => { const { iconPath } = currency; if (paths.indexOf(iconPath) !== -1) { return; } paths.push(iconPath...
[ "LoadJSONData(data){\n\n\t\tthis.fontName = data.fontName;\n\n\t\t// if the spritesheet graphic was already loaded by the content pipeline, use the graphic\n\t\tvar spritesheet = null;\n\t\tif(!!Game.instance){\n\n\t\t\tvar pgfx = Object.assign({}, Game.content.graphics, Game.content.unfinishedAssets)\n\t\t\tfor(le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an HTML document, parse out links and images. Only return gif, jpg, or png images. Only considers img.src, ignoring img.srcset. Also ignores inline data images (data:).
function parse(body, url) { var $ = cheerio.load(body); // Ensure we return absolute urls. var abs = urlmod.resolve.bind(null, url); // http & https only var proto = function(url) { return url.startsWith('http'); } // only gif, png, and jpg files var exts = ['.gif','.png','.jpg'...
[ "function parse_images(html_elements){\n var images = [], index = 0;\n for (var element in html_elements)\n if(element == index){\n images.push(html_elements[element].attribs.src)\n index++\n }\n return images;\n}", "function extractImageTags(doc, html) {\n var imgArr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
It toggles a lesson watched or unwatched.
toggleLessonWatched(key) { this.lessons[key].watched = this.lessons[key].watched == false; this.storeLessonsInStorage(); this.updateBadge(); }
[ "toggle() {\n this.on = !this.on;\n }", "function toggleOnOff(instrument) {\n if(instrument.isPlaying){\n instrument.isPlaying = false;\n button_playall.style('filter', `none`);\n }\n else{\n instrument.isPlaying = true;\n }\n playAll();\n}", "function toggleWatchlist () {\n\t\tsetModal(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Child Pages Autocomplete code
function GlobalSiteAutoCompleteChildPage() { if ($("#txtGlobalSiteSearch").hasClass("ui-autocomplete-input")) { //already initialised return false; } $("#txtGlobalSiteSearch").autocomplete({ source: function (request, response) { $.ajax({ url: "/VCAWebsite/Helpers/PopulateAutocomplete.ashx", dataT...
[ "function GlobalSiteAutoCompleteRootPage() {\n\n\tGlobalSiteAutoCompleteChildPage();\n\n}", "function searchAutoComplete() {\n if(self.selectedChoice() == 'name') {\n autoCompleteSource(nameArr);\n } else {\n autoCompleteSource(addrArr);\n }\n}", "function navbar_serach_box_autocomplate() {\n $('#as...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle the submission of adding a comment
async handleAddComment(ev) { ev.preventDefault(); const { content } = ev.target; const comment_content = content.value; const thoughtId = this.state.thoughtId; // Make POST request to server to add a post await ActionsService.postComment(thoughtId, comment_content); // Clear the comment in...
[ "function submitComment(event) {\n event.preventDefault();\n CommentModel.create({\n content: content,\n authorId: props.user[0].id,\n tweetId: props.id,\n }).then((json) => {\n if (json.status === 201) {\n console.log(json, \"user commented\");\n }\n });\n }", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the player's turn value to false, as this acts oddly without a method. Returns nothing.
endTurn(){ this.turn = false; }
[ "function switchPlayerTurn() {\n isPlayerTurn ? (isPlayerTurn = false) : (isPlayerTurn = true);\n }", "function resetTurn() {\r\n turn = true;\r\n}", "function _changeTurns() {\r\n if (_isPlayerTurn(playerOne)) {\r\n playerOne.isMyTurn = false;\r\n playerTwo.isMyTurn = true;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Only Sp Size Processing Please describe processing of sp below
function spSizeOnly(){ changeImgSp(); }
[ "function spSizeOnly(){\n//////////////////////////////////////////////\nchangeImgSp();\n\n/*\n■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■\nSPの時のみ実行するものの追加スペース\n■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■\n*/\n\n\n//////////////////////////////////////////////\n}", "function getFontSize(sp) {\n return sp * P...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tests if getRandomPiece returns a piece object since function functions with rng, may need to run multiple times
function test1() { return getRandomPiece() instanceof Piece }
[ "function generateRandomPiece() {\n\tlet randomNumber = Math.floor(Math.random()*pieces.length);\n\treturn new Piece(pieces[randomNumber][0], pieces[randomNumber][1]);\n}", "generateRandomPiece(){\n return new Piece(\n this,\n Utils.selectRandom(\n Object.keys(this.cons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add actions to page buttons
function addButtonActions() { var startButton = document.getElementById('button-start'); var questionsButton = document.getElementById('button-questions'); startButton.addEventListener("click", function () { showStartPage(); }); questionsButton.addEventListener("click", function () {...
[ "function registerPageActionButtonEvents() {\n var actions = self.settings().actions;\n for( var action in actions ) {\n var button = actions[action];\n if(button.perRecord) {\n continue;\n }\n registerActionButtonEvent(button, action);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get URL query key value pairs from an URL string.
function getURLQueries(url) { let queryString = coreHttp.URLBuilder.parse(url).getQuery(); if (!queryString) { return {}; } queryString = queryString.trim(); queryString = queryString.startsWith("?") ? queryString.substr(1) : queryString; let querySubStrings = queryString.split("&"); ...
[ "function getURLQueries(url) {\n let queryString = new URL(url).search;\n if (!queryString) {\n return {};\n }\n queryString = queryString.trim();\n queryString = queryString.startsWith(\"?\") ? queryString.substring(1) : queryString;\n let querySubStrings = queryString.split(\"&\");\n q...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The xaxis represents the angles from 0 to 180, and each point is tha angle [n, n+4] where n is divisible by 5. The yaxis represents how many times the patient reached such angle.
function drawHistogram() { // thumbIndexAngleCount --> y-axis. // the first cell in array contains the name that represents the y-axis. // length of array is 37: (180/5)'the number of points' + 1 'the name of array' var thumbIndexAngleCount = Array(37).fill(0); var distalMedialCount = Array(37).fill(0); var...
[ "function angle(i) {return 36*i*Math.PI/180}", "function angle(n) {\n\treturn (n - 2) * 180\n}", "function circleAngle(n) {\n return n * 2 * Math.PI / kConfig.domainSize;\n}", "function startAngle(d) {\n //console.log(d); \n return d.startAngle + offset; }", "function drawIntervalsOnXAxis()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the default item template
_defaultItemTemplate(value) { return `<div class ="jqx-toast-item-header"> <span class ="jqx-toast-item-close-button"></span> </div> <div class ="jqx-toast-item-container"> <span class ="jqx-toast-item-icon"></span><span class ="jqx-toast-i...
[ "get itemTemplate() {\n return this._getOption('itemTemplate');\n }", "get template() {\n switch (this.type) {\n case IgxAvatarType.IMAGE:\n return this.imageTemplate;\n case IgxAvatarType.INITIALS:\n return this.initialsTemplate;\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
es capaz de seleccionar categorias si palabra es xx, selecciona xx categoria y lo pasa a variable array de abajo para pruebas var palabrasClave = ["aba", "abe", "abi", "baba", "bebe", "bibi", "caca", "cece", "cici", "dada", "dede", "didi"];
function entregaCategoriaSeleccionada() { //divide lista palabras en 4 para elegir entre 4 categorias var palabrasClaveCuartosLength = palabrasClave.length/4; //cuartos para bloques de palabras var primerCuarto = palabrasClaveCuartosLength * 1; var segundoCuarto = palabrasClaveCuartosLength * 2; var tercerCuarto...
[ "function selecionarCategoria(){\n\tlet itensAtuais = []\n\tlet i = 0\n\tlivro.map((livro) =>{ \n\t\tif(itensAtuais.indexOf(livro.categoria) === -1){\n\t\t\titensAtuais[i] = livro.categoria\n\t\t\ti++\n\t\t}\n\t})\n\n\tresp = prompt(`Essas sao as categorias disponiveis\n\n\t\t${itensAtuais}\n\n\t\tQual categoria de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checks time blocks vs current time and color codes accordingly
function colorCode() { var currentTime = moment().hours(); $(".time-block").each(function () { var timeBlock = parseInt($(this).attr("id").split("-")[0]); if (timeBlock === currentTime) { $(this).addClass("present"); } else if (timeBlock ...
[ "function colorCodeTimeBlocks(){\n //Every second, check if the timeblock color coding should change\n var timeInterval = setInterval(function (){\n let currentTime = moment().format(\"H\");\n compareTimeBlocks(currentTime); \n }, 1000)\n \n}", "function colorTimeBlocks() {\n\n va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to check for the existance of a deliveryman by its email
async function existsDeliveryman(email) { return pool.query('SELECT COUNT(*) FROM deliverymans WHERE email = $1', [email]) .then((res) => { if(res.rows[0].count > 0) return {exists: true} else ...
[ "function checkExistingEmail(email) {\n var flag = false;\n for (let item in databases.users) {\n if(databases.users[item].email === email){\n flag = true;\n userId = databases.users[item].id;\n }\n }\n return flag;\n}", "function miabEmailExists(email, callback) {\n\n var domain = email.sp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replacement to IRD Function Name: "UTCToString" Return value type: STRING. This function takes UTC in seconds and converts it into string in format 'YYYYMMDDTHH:MM:SSZ'.
function irdUTCToString(seconds) { var milliseconds = seconds * 1000; var d = new Date(milliseconds); function prefiller(num) { return num < 10 ? '0' + num : num; } return d.getUTCFullYear() + '-' + prefiller(d.getUTCMonth() + 1) + '-' + prefiller(d.getUTCDate()) + 'T' + prefiller(d.getUTCHours()) + ':...
[ "function utcString() {\n var today = new Date();\n var utcstring = today.toUTCString();\n alert(\"Today's date converted to UTC string is: \" + utcstring);\n}", "toUTCString() {\n return this.timestamp().toUTCString();\n }", "function toISOString() {\r\n return this.getUTCFullYear() + '-'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the geometry layer from the map
removeGeometryLayer() { this.map.removeLayer(this.geometryLayer); this.geometryLayer = null; }
[ "remove () {\n if (this.map) {\n this.map.removeLayer(this.id);\n }\n }", "function clearGeometry() {\n var layers = drawingTools.layers();\n layers.get(0).geometries().remove(layers.get(0).geometries().get(0));\n}", "function remove() { \n DCI.interPolate.map.re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the count of withdrawal of saving account
function getWithdrawCount(accNo,callback){ conn.query(`SELECT transaction_count FROM saving_account WHERE account_num = ` + accNo, function(err,result){ if(err){ callback(err,null); }else{ callback(null, result[0].transaction_count); } }); }
[ "function numberWithdraw(){\n const withdraw = user.transactionsMonthToDate.filter((element) => element.type == \"withdrawal\")\n return `total number of withdraw is ${withdraw.length}`\n}", "function countWithDrawals() {\n let result = 0;\n user.transactionsMonthToDate.forEach((item) => {\n consol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create random page session
function getPageSession() { return `${customerName}${new Date().getTime()} " " ${Math.floor((Math.random() * 998) + 1)}`; }
[ "function makePageRandom() {\n page = Math.floor(Math.random() * 1000);\n}", "function createNewSessionNumber(){\n\treturn Math.floor(Math.random()*1000000);//create a random number between 0-999999\n}", "function generateSessionId () {\n\tvar id = Math.random().toString(36);\n\twhile (typeof active_sessions[i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
receiving data on the COM port and sending to the open connections
function onrecieveData(data) { for (myConnection in connections) { // iterate over the array of connections connections[myConnection].send(data); // send the data to each connection } console.log("Received data: " + data); }
[ "function sendSerialData(data) {\r\n\r\n console.log(data);\r\n if (connections.length > 0) {\r\n broadcast(data);//broadcast or flood all web server connections. In this case, if port 8081 is the only one that is open, then this port receives the information\r\n }\r\n}", "emitData(data) {\n if(!this.isO...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }