query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
This method adds the column filter parameter to a list of links.
function lc_update_filter_in_links (_links, _param, _filter) { for (var a = 0; (a < _links.length); a++) { if (_links[a].href && _links[a].href.match ('^http')) _links[a].href = appendToUrl (_links[a].href, _param, _filter); } }
[ "function createFilterUrls()\n\t{\n\t\t$('.fltr-wrapper .fltr-check').each(function(){\n\t\t\tvar elem = $(this);\n\t\t\tvar getQuery = window.location.search.substring(1);\n\t\t\tvar category = elem.parent().data('property');\n\t\t\tif (!elem.hasClass('active')) {\n\t\t\t\tvar filterGetParameter = $.query.set('fil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load Images Async switch src attribute with datalazysrc
function ReLoadImages() { $('img[data-lazysrc]').each(function() { $(this).attr('src', $(this).attr('data-lazysrc')); }); }
[ "async loadImages() {\n const resources = Array.from(this._resources.entries());\n\n console.info(`[ImageManager] Loading ${resources.length} image assets.`);\n\n await Promise.all(resources.map(([iKey, iValue]) => {\n console.info(`[ImageManager] Loading image ${iValue}.`);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
keep on local storage player name
function playerName() { var player = document.getElementById("player").value; localStorage.setItem("playerName", player); }
[ "function getName(){\n if(localStorage.getItem('player-name') === null){\n playerName.textContent = 'Player1';\n }\n else{\n playerName.textContent = localStorage.getItem('player-name');\n }\n}", "function addUserName () {\n let tag = document.querySelector('#player')\n let myHeadline ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add 'shape' that will make up the amoeba.
function addShape(type) { var time; var border_radius; var opacity = "0.2"; var animation; var deg = rand(-360, 360); if (type == 'neutral'){ time = rand(20,30); animation = "pulserotate"; } else if (type == 'calm') { time = rand(30,40); animation = "shr...
[ "add(shape) {\n // store shape offset\n var offset = shape.__position;\n\n // reset shapes list cache\n this.__shapes_list_c = void 0;\n\n // add shape to list of shapes and fix position\n this.__shapes.push({\n shape: shape,\n offset: offset.clone()\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes a native node itself using a given renderer. To remove the node we are looking up its parent from the native tree as not all platforms / browsers support the equivalent of node.remove().
function nativeRemoveNode(renderer, rNode, isHostElement) { var nativeParent = nativeParentNode(renderer, rNode); if (nativeParent) { nativeRemoveChild(renderer, nativeParent, rNode, isHostElement); } }
[ "remove() {\n const ownerElement = this.node.ownerElement\n if(ownerElement) {\n ownerElement.removeAttribute(this.name)\n }\n }", "function removeElement(node) {\n\t\tjQuery(node).remove();\n\t}", "_removeNode(tree, path) {\n if(tree){\n if (path.length === 1) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets or gets a property of the preset. prop(propertyName) returns the current value of the property (if defined). prop(propertyName, propertyValue) sets the property to a new value and simply returns this (the PresetCopy instance) in order to allow chained method calls.
prop(propertyName, propertyValue) { if (typeof propertyValue === "undefined") { return this.preset[propertyName]; } else { this.preset[propertyName] = propertyValue; return this; } }
[ "setDefault(prop, value) {\n this.properties[prop].value = value;\n return this;\n }", "set(propObj, value) {\n propObj[this.id] = value;\n return propObj;\n }", "function SetPreset (v : VDPRESET) {\n\t\n\t\tswitch (v) {\n\t\t\n\t\t\tcase VDPRESET.AMBIENTOCCLUSION :\n\t\t\t\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When annotation is selected, the page is scrolled but sometimes the annotation is not visible. We move the scroll bar position adding the y value based on the annotation position.
function scrollToAnnotationInCanvas(annotation) { console.log('scrollToAnnotationInCanvas() annotation: ' + annotation); if (!annotation) return; PDFViewerApplication.pdfViewer.scrollPageIntoView(annotation.pageIndex + 1); var y = annotation.y; // If annotation has highlightTextRects, get ...
[ "function updateScroll() {\n\t\tlet elements = container.getElementsByClassName('selected');\n\t\tif (elements.length > 0) {\n\t\t\tlet element = elements[0];\n\t\t\t// make group visible\n\t\t\tlet previous = element.previousElementSibling;\n\t\t\tif (previous && previous.className.indexOf('group') !== -1 && !prev...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prepare modal if there is a duplicate name
function duplicateFriend(aname){ // empty modal display, load with message alerting user that their name is already used $('#modal-display').empty(); $('#modal-display').append($('<p>').html('Sorry, '+aname+' is already taken.')); $('.modal-title').empty(); $('.modal-title').html('Duplicate Name'); // display mod...
[ "function modalTitleFiller(){\n\t\t\n\t\tvar productname = $('.product-name>h2').text();\n\t\t$('#myModalLabel').text(productname);\n\t\t\n\t}", "function deleteModal(key, name) {\n $(\"#train_delete\").text(name);\n $(\"#delete_name\").attr(\"value\", name);\n $(\"#delete_key\").attr(\"value\", key);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display hand and points to console.
display_hand() { console.log("\n\n"); console.log("My hand:"); console.log(this.mycards); console.log("\n\n"); console.log("My points:"); console.log(this.mypoints); console.log("\n\n"); }
[ "display() {\n this.draw(this.points.length);\n }", "display() {\n //set the color\n stroke(this.element*255) ;\n //draw the point\n point(this.identity.x,this.identity.y)\n }", "display() {\n console.log(`Title: ${this.title}\\nAuthor: ${this.author}\\nPrice: ${t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes the object returned from createAsterias and converts it to an objec with geneName indexes and geneExpression Level values
function createOrganism() { var ret = {}; var organism = createAsterias(); //get all properties of form xxxxLevel, //where xxxx is the gene name and xxxxLevel is a function //returning the level for that gene ret = _.filter(_.map(organism, fun...
[ "function create_main_obj(){\n chart_container.show();\n var newValues={};\n newValues.pop=population_slider.slider(\"value\");\n newValues.genome=genome_slider.slider(\"value\");\n newValues.mutate=mutation_prob_slider.slider(\"value\");\n newValues.fight=tournament_size_slider.slider(\"value\");...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if a given transclusion slot is present by its name
function hasTranscludeSlod(slotName){ if(slotName && angular.isString(slotName)){ // on controller info, there is an info about // the $transclude.isSlotFilled(slotName) // https://docs.angularjs.org/api/ng/service/$compile return $transclude.isSlotFilled(slotName); } r...
[ "Exists() {\n return this.transaction != null;\n }", "isAssis(name){\n for(u in this.assisList){\n if(u.name == name){\n return true;\n }\n }\n return false;\n }", "function doesMenuItemExist(truckID, name) {\n\t//aey - does truck exist\n\tif(doesTruckExist(truckID)) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create interpolation bindings with a variable number of expressions. If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead. Those are faster because there is no need to create an array of expressions and iterate over it. `values`: has static text at even indexes, has evaluated ...
function interpolationV(values) { ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values'); ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values'); var different = false; for (var i = 1; i < values.length; i += 2) { // Check if bindings (odd i...
[ "function interpolateValues(values, getter, i, iteration) {\n if (i > 0) {\n var ta = iterations[i], tb = iterations[i - 1],\n t = (iteration - ta) / (tb - ta);\n return getter(values[i]) * (1 - t) + getter(values[i - 1]) * t;\n }\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
readonly attribute AUTF8String endTimeZoneName;
get endTimeZoneName() { return this._endTimeZoneName; }
[ "get endTimeZoneId()\n\t{\n\t\treturn this._endTimeZoneId;\n\t}", "get timezoneName() {\n let parent = this.parent;\n let n = `${this.name}`;\n while (parent) {\n n = `${parent.name}, ${n}`;\n parent = parent.parent;\n }\n return n;\n }", "get timeZone...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return an object containing beziers for the segments object. segments: A segments object, e.g. escher.Map.segments. reaction_id: The reaction id for the segments.
function newBeziersForSegments(segments, reactionId) { var beziers = {}; var _loop3 = function _loop3(segmentId) { var segment = segments[segmentId];['b1', 'b2'].forEach(function (bez) { var segBez = segment[bez]; if (segBez !== null) { var bezierId = bezierIdForSegmentId(segmentId, bez); ...
[ "function newReservePart(part, segments){\n \n reservationsJSONarr[part] = { \n removed: false, \n reserved: false,\n segments: {} };\n \n for(var segm in segments){\n \n var jCell = { isReserved: false };\n \n reservationsJSONarr[part].segments[segm] = jCell...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Triggers dispose handlers recursively.
triggerDispose() { this.getChildren().forEach(function(child) { child.triggerDispose() }) this.dispose() this.__isMounted__ = false }
[ "function recursiveDispose ( object ) {\n\n\t\t\tfor ( var i = object.children.length - 1; i >= 0; i-- ) {\n\n\t\t\t\trecursiveDispose( object.children[i] );\n\t\t\t\tobject.remove( object.children[i] );\n\n\t\t\t}\n\n\t\t\tif ( object instanceof PANOLENS.Infospot ) {\n\n\t\t\t\tobject.dispose();\n\n\t\t\t}\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the third method used for retrieving the next meetup. It uses Node 8's async and await syntax.
async function getNextMeetupV4() { return nextmeeting[0]; }
[ "async function getNextMeetupV3() {\n const meetingCache = cache.get('nextMeeting');\n if (meetingCache) {\n return meetingCache[0];\n } else {\n const response = await fetch('https://api.meetup.com/2/events?&sign=true&group_id=10250862&page=20&key=' + process.env.meetupapi_key);\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a function that holds within her closure the context path. the returned function is one that accepts a resource to fetch, and returns a new resource with the context path at its prefix
function wrapBuildingURLWithContextPath() { var contextPath = calculateContextPath(); return function(resource) { return "/" + contextPath + "/" + resource; }; }
[ "default(resource, context){\n return this.defaultFn ? this.defaultFn(resource, context) : resource;\n }", "function recursiveGetFactory ({path: resPath, domain, setupTree, token, headers, funcMode}) {\n function recursiveGet({state, resolve, path, oada}) {\n return Promise.resolve().then(() => {\n /...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluates whether the current reading <= 0
static evalReadingLessThanEqualToZero(context, dict) { return (libLocal.toNumber(context, dict.ReadingSim) <= 0); }
[ "static evalReadingGreaterThanOrEqualToZero(context, dict) {\n return (libLocal.toNumber(context, dict.ReadingSim) >= 0);\n }", "static evalIsOverflowNotEmptyAndOverflowGreaterThanReading(context, dict) {\n if (!libThis.evalIsCounterOverflowEmpty(dict)) {\n return (libLocal.toNumber(co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load previously selected theam on restart
function setTheam(){ if (localStorage.getItem("theam") !== null) { if (localStorage.getItem('theam')==1) { dark(); } else if (localStorage.getItem('theam')==0) { light(); } } }
[ "function loadProgram() {\n if (modified && !window.confirm(\"Discard unsaved changes to the current program?\")) {\n\treturn;\n }\n var programName=loadSelector.value;\n if (programName==\"\") {\n\thtmlSrc.value=htmlExample;\n\tjsSrc.value=jsExample;\t\n } else {\n\thtmlSrc.value=window.localStorage...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return the centroid of the polygon with the given vertices (an array) assumes no polygon stretches more than half a great circle around horizontally this uses a planar method to find the centroid, which is a good approximation except at the poles
function findCentroid(vertices) { //make a copy so that we don't mess anything up var copy = [] for (var i = 0; i < vertices.length; i++) { var p = vertices[i]; copy.push(new Point(p.RA, p.Dec)); } var min = Math.min.apply(null, copy.map(function(a){return a.RA;})); var max = Math.max.apply(null, copy.map(fu...
[ "function compute_centroid(facet, vertices) { \n var va = vertices[facet.a];\n var vb = vertices[facet.b];\n var vc = vertices[facet.c];\n\n return new THREE.Vector3(\n (va.x + vb.x + vc.x)/3,\n (va.y + vb.y + vc.y)/3,\n (va.z + vb.z + vc.z)/3\n );\n }", "getCenter() {\n const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the message content gong The Gong applet id The message id type The content type Return the message content
function gongGetMessageContent(gong, id, type) { if (gong == null || !gong.isActive()) return "Gong Applet is not ready."; if (useXML) { var request = "<GetMessageContentRequest xmlns=\"" + GASI_NAMESPACE_URI + "\">"; request += "<MessageId>" + id + "</MessageId>"; request += "<ContentT...
[ "function gongGetMessage(gong, id) {\n if (gong == null || !gong.isActive()) return \"Gong Applet is not ready.\";\n\n if (useXML) {\n var request = \"<GetMessageRequest xmlns=\\\"\" + GASI_NAMESPACE_URI + \"\\\">\";\n request += \"<MessageId>\" + id + \"</MessageId>\";\n request += \"</G...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
===========================|| delete Interest ||========================
async deleteInterest(req, res, next) { try { let findUser = await profile.findOne({ _id: req.profile.id }); let indexOfInterest = findUser.interest.indexOf(req.query.id_interest); if (indexOfInterest < 0) { const error = new Error("Interest name has not been added at Interest"); error.statusCode = 40...
[ "function deleteExpense(id) {\n console.log(\"DELETE BUTTON WORKS\");\n }", "function deleteTrain() {\n if (CurrentUser === undefined || CurrentUser === null) {\n $('#authModal').modal(); // Restrict access to logged in users only. \n return;\n }\n\n var uniqueKey = $(this).closest('tr').data('key');...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Select all the issues on the issue list page.
function TKR_selectAllIssues() { TKR_selectIssues(true); }
[ "function initIssues() {\n\t//ids start at 5 so fill in 0-4 to make retrieval bawed on array index trivial\n\tissues = [0, 0, 0, 0, 0,\n {id:5,\tname:\"Alumni\"},\n\t\t\t{id:6,\tname:\"Animals\"},\n\t\t\t{id:7,\tname:\"Children\"},\n\t\t\t{id:8,\tname:\"Disabilities\"},\n\t\t\t{id:9,\tname:\"Disasters\"}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert lbs to kg
lbsToKg (d) { return d / 2.205 }
[ "function GToKG(weight) {\n if (weight === null) return null;\n else if (weight.includes('кг')) return weight.substring(0, weight.length - 3).match(/\\d+/gm)[0];\n else return weight.substring(0, weight.length - 2).match(/\\d+/gm)[0]/1000;\n}", "function btuToKcalMs(btu) {\n return btu*.0000000700457\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
encrypt and send out a peice of a file
function file_encrypt_and_send(username, message, additional_key, chunk_num) { /* MUST have completed OTR first */ if (rtc.crypto_verified[username]) { message = _arrayBufferToBase64(message); message = JSON.stringify(RabbitCryptoJS.Rabbit.encrypt(message, rtc.crypto_send_symmetr...
[ "function file_decrypt(username, message) {\n if (rtc.crypto_verified[username]) {\n hash = CryptoJS.SHA256(message).toString(CryptoJS.enc.Base64); \n \n message = RabbitCryptoJS.Rabbit.decrypt(JSON.parse(message),\n rtc.crypto_receive_symmetric_keys[username] ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given ANY palette button (custom user palette or static), update the color shown inside and assigned to the button
function updatePaletteSwatch(button, color) { if(color) button.setAttribute("data-color", color); button.firstElementChild.style.background = button.getAttribute("data-color"); }
[ "function refreshPaletteDialog()\n{\n palettedialogpalette.innerHTML = \"\";\n var palettename = getPaletteName();\n var palette = palettes[palettename] || palettes[0];\n palettedialogname.textContent = palettename;\n palette.forEach(p =>\n {\n var b = makePaletteButton();\n updatePaletteSwatc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show lastFm, calling lastFm API API key 19b8a524d7b3e2f4e8a48a323aaa7938
function showlastFm () { $('.audition').click(function () { $('.choicePage').hide() $('.lastFm, .up').show(100) audioLastFm() }) function audioLastFm () { var url = 'https://ws.audioscrobbler.com/2.0/?method=album.search&album=' + loc + '&api_key=19b8a524d7b3e2f4e8a48a323aaa7938&format=json&callb...
[ "function DisplayInfo() {\n showAccessToken();\n whenTheTokenWillExpire();\n}", "function showLastTweets() {\n\tvar params = {screen_name: 'trgmedina'};\n\n\tclient.get('statuses/user_timeline', { count: 20 }, function(error, tweets, response) {\n\t if (error) {\n\t console.log('Error occurred: ' + erro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========================================================================================= ============================================================================= Media Index =========================================================================================
function htmlMediaIndex(data) { return PrintIndex('M', _('Media Index'), true, htmlMediaIndexTable, null, data); }
[ "static index(id, shouldUpdate){\n\t\tlet kparams = {};\n\t\tkparams.id = id;\n\t\tkparams.shouldUpdate = shouldUpdate;\n\t\treturn new kaltura.RequestBuilder('metadata_metadata', 'index', kparams);\n\t}", "function getMediaList( err ) {\n if( err ) {\n Y.log( 'error in deleting ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all the related error logs.
async errorLogs() { const options = this.buildOptions({ path: `${this.path}/logs/error`, method: "get", body: {}, }); return this.apiCall(options); }
[ "function getLogsFromServer() {\n if (!$scope.logs) return;\n\n var logs = $scope.logs;\n var len = logs.length;\n for (var i = 0; i < len; i++) {\n getLog(logs[i]);\n }\n }", "function getAllEntries(){\n for(const [sourceId, logSource] of logSources.entries()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
_compile / _expandPaths The expandPaths function is used to take the input paths that have been supplied to interleaver and convert them to the discrete list of javascript files that was implied. For instance, if a directory was supplied then this should be expanded to the .js files that exist within the directory (wit...
function _expandPaths(paths, callback) { var expandedPaths = [], basedir = this.basedir; function notHidden(file) { return !reHidden.test(file); } async.forEach( paths, function(inputPath, itemCallback) { debug('expanding path: ' + inputPath); ...
[ "function expand(filePath, requiredFiles) {\n requiredFiles = requiredFiles || {};\n\n if(requiredFiles[filePath]) {\n this.lineConcat.add(filePath, '', null, 0);\n return;\n } // just return if already required\n\n requiredFiles[filePath] = true;\n\n var lines = String(fs.readFileSync(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets whether an element has a valid tabindex.
function hasValidTabIndex(element) { if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) { return false; } var tabIndex = element.getAttribute('tabindex'); // IE11 parses tabindex="" as the value "-32768" if (tabIndex == '-32768') { return false; } return...
[ "function shouldFocusMenuItem(element) {\n var allowDisabledItemNavigation = element.parentElement.classList.contains(\"allowDisabledItemNavigation\");\n var isDisabled = element.classList.contains(\"disabled\");\n var isHidden = element.classList.contains(\"hidden\");\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Notify other Users that an Object on the canvas was changed
notifyCanvasChange(id, type){ let json = this.canvas.toObject(["id"]), update = new CanvasUpdate(type, id, json), payload = {json, update}, event = new Event("CanvasContentChanged", payload); this.notifyAll(event); }
[ "updateCanvas(payload){\n let changes = payload.update,\n update = new CanvasUpdate(changes.type, changes.objectID, changes.canvasObject);\n update.executeChange(this.canvas);\n }", "function objectChanged(_o) {\n replace(ka.objs, o, _o);\n recalc(ka);\n }", "changeContact(new...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Busca en el vector de turno ordenado la posicion de un personaje dado su nombre
function buscarDefensor(nombre, idPartida){ for (i in turnoOrdenado[idPartida]){ if (turnoOrdenado[idPartida][i].personaje.nombre == nombre){ return i; } } return 'no encontrado'; }
[ "function buscarPorNombre(nombre, idPartida, tipo){\n\tif (tipo == 'aliado'){\n\t\tfor (i in personajes[idPartida]){\n\t\t\tif (personajes[idPartida][i].nombre == nombre){\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\t\t\n\t} else {\n\t\tfor (i in enemigos[idPartida]){\n\t\t\tif (enemigos[idPartida][i].nombre == nombre){...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the upper most point. In case of a tie, get the left most point.
function upperLeft(points) { var top = points[0]; for(var i = 1; i < points.length; i++) { var temp = points[i]; if(lngToY(temp.lng()) > lngToY(top.lng()) || (lngToY(temp.lng()) == lngToY(top.lng()) && latToX(temp.lat()) < latToX(top.lat()))) { top = temp; } } return top; }
[ "function findBestCorner() {\n\t\t\n\t}", "function findMostBottom (units) {\n if (units.length === 0) {\n return null;\n }\n var mostBottom = units[0];\n for (var i = 0; i < units.length; i++) {\n var unit = units[i];\n if (unit.pos.y < mostBottom.pos.y) {\n mostBottom...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
matchSearchFunc for definition to searchTerm (EngRegex)
function matchSearchFuncEngRegex (searchTerm) { return function(element) { var re = ".*" + searchTerm + ".*"; if (element.definition.match(re)) { return true; } else { return false; } } }
[ "function matchSearchFuncEngPlain (searchTerm) {\n return function(element) {\n if (element.definition == searchTerm) {\n return true;\n } else {\n return false;\n }\n }\n }", "function matchSearchFuncMoroRegex (searchTerm) {\n return func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the change of PWM percentage values by user
function percentChangeHandler(e) { var value = parseInt(this.value); if(isNaN(value)) value = 0; if(value < 0) value = 0; if(value > 100) value = 100; this.value = value; // If percent changed we need send updated configuration var $pin = this.parentNode.parentNode; var data = getPinData($pin); //console...
[ "function update() {\n\tvar out;\n\n\tconfig.motors.forEach(function (motor) {\n\t\t// update motor.gpio with value from rawMotorValues[motor.key]\n\t\t// todo: constrain motor output values to range in configuration\n\t\t//out = ((rawMotorValues[motor.position.key] || 1000) - 1000) / 1000;\n\t\t//out = (out < 0 ? ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
send the message container over a websocket when updated.
function sendWebsocketUpdate() { io.emit('updateMessages', messageContainer); }
[ "function hostMessage() {\n if (websocket != null && websocket.readyState == 1) {\n var input = document.getElementById(\"gameID\").innerHTML.toString();\n var message = { messageType: 'HOST', message: input };\n websocket.send(JSON.stringify(message));\n }\n}", "function chat_stream() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a ModelShape object. This is an internal simplified reference to a mesh used as for a model to replicate particles from by the SPS. SPS internal tool, don't use it manually.
function ModelShape(id, shape, shapeUV, posFunction, vtxFunction) { this.shapeID = id; this._shape = shape; this._shapeUV = shapeUV; this._positionFunction = posFunction; this._vertexFunction = vtxFunction; }
[ "function Shape() {\n Vector.apply( this, arguments ); // call Vector's constructor\n this.age = 0\n this.maxAge = 450\n this.size = 0\n this.color = \"#00FFFF\";\n}", "static _create2DShape (typeofShape, width, depth, height, scene) {\n switch (typeofShape) {\n case 0:\n var faceUV = new Arr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set Nova Damage returns String
SetNovaDamage(num) { return ["3d6", "3d6+2", "3d8", "3d8+2", "3d10"][num-1]; }
[ "takeDamage() {\n return `${this.name} took damage.`;\n }", "SetSpecialDamageResistance(num) { return [\"Negates one level\", \"Negates two levels\", \"Negates three levels\", \"Complete immunity\"][num-1]; }", "set softwareDamage (softwareDamage) {\n this._softwareDamage = softwareDamage\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Formats the given money's fraction part.
formatMoneyFractionPart (money) { if (this.currency.ratioToMinimumCurrency <= 1) { // If the minimum currency ratio is less than or equal to 1 // Then the fraction part does not exist. e.g. JPY, KRW return '' } const digits = Math.log10(this.currency.ratioToMinimumCurrency) let fract...
[ "format (money) {\n return `${this.formatSign(money)}${\n this.currency.symbol\n }${this.commaPeriodSetting.format(\n Math.floor(Math.abs(money.amount))\n )}${this.formatMoneyFractionPart(money)}`\n }", "function formatMoney(number){\n return '₹ '+number.toFixed(2).replace(/\\d(?=(\\d{3})+\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete an schedule from the schedule's array
function deleteSchedule (index,collection) { collection.splice(index,1); }
[ "deleteAppointment(date,time)\n {\n if (this.map.has(date)) {\n\n for (let i=0; i<this.map.get(date).length; i++)\n {\n if (this.map.get(date)[i].date == date && this.map.get(date)[i].time == time) {\n this.map.get(date).splice(i,1);\n break;\n }\n }\n }\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function resets the color of all the groups to unassigned color
function resetColorOfGroups() { var grptds= document.getElementsByClassName("group"); for (t in grptds) { if (grptds[t].className != null) { cn = grptds[t].className; grptds[t].className= cn.replace("btn-success","btn-secondary"); } } }
[ "function resetBoard() {\n $tileArray.each(function (i, value) {\n var removeGreen = $($tileArray[i]).removeClass(\"green\");\n turnCounter = 0;\n greenTileCount = 0;\n });\n }", "function resetChairColors() {\n // change the \"chosenColor\" variable\n model.changeChosenColorVa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Define the container's height
function setContainerHeight() { if (zwiperSettings.autoHeight === false) { if (zwiperSettings.height === undefined) { zwiperContainerHeight = parseInt(zwiperContainer.offsetHeight, 10); zwiperContainer.style.height = zwiperContainerHeight + 'px'; } else if (zwiperSettings.height.indexOf(...
[ "function containerHeight() {\n var cnt = scope.data && scope.data.length || 0;\n return cnt * theight;\n }", "set requestedHeight(value) {}", "setHeight() {\n this.$().outerHeight(this.$(window).height() - this.get('fixedHeight'));\n }", "function getHeight() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility function to find average amplitude value for a snapshot
function snapshotAverageAmplitude(snapshot_arr) { var amp_sum = 0; var bin_count = snapshot_arr.length; for(var i=0; i<bin_count; i++) amp_sum += snapshot_arr[i]; return amp_sum / bin_count; }
[ "getAverageQuality(save) {\n let total = 0;\n let count = 0;\n for (let x in save.modifiers) {\n let mod = save.modifiers[x]\n total += mod.quality\n count++;\n }\n return total/count;\n }", "averageCubeTime(arg) {\n // let arr = [this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Indicates whether Change in dropdown selected option was due to a Manual Click or due to System properties of dropdown. vSelectChange_A = 'MANUAL_CLICK' indicates that the jump to a noneditable option in the dropdown was due to a Manual click (i.e.,changed on purpose by user). vSelectChange_A = 'AUTO_SYSTEM' indicates ...
function fnChangeHandler_A(getdropdown) { fnSanityCheck(getdropdown); vPreviousSelectIndex_A = vSelectIndex_A; // Contains the Previously Selected Index vSelectIndex_A = getdropdown.options.selectedIndex; // Contains the Currently Selected Index if ((vPreviousSelectIndex_A == (vEditableOpti...
[ "function ChangeHandler() {\n PreviousSelectIndex = SelectIndex; \n /* Contains the Previously Selected Index */\n\n SelectIndex = document.forms[0].lstDropDown.options.selectedIndex;\n /* Contains the Currently Selected Index */\n\n if ((PreviousSelectIndex == (document.forms[0].lst...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
onCertFileChange when the input certFile changed, read the file and setting cert name into text of selectedCert to display on the view
async onCertFileChange () { const page = this.page const files = page.certFile.files if (!files.length) return page.selectedCert.textContent = files[0].name Doc.show(page.removeCert) Doc.hide(page.addCert) }
[ "function displayFile() {\n if (changed) {\n let fileName = $(this).val().split(\"\\\\\").pop();\n $(this).siblings(\".custom-file-label\").addClass(\"selected\").html(fileName);\n }\n}", "function fileSelected(file) {\n\tif (file.type == \"text\" && file.subtype == \"plain\") {\n\t\tgetData(f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is triggered when a user clicks on a movie poster to reveal the movie's details. setDetailView() adds the "showdetails" class name to the "moviedetailsbox" DIV to switch the "display" CSS property from "none" to "block". setBlurry() adds the "blurredout" class name to the "appcontainer" DIV to blur out th...
function makeDetailsVisible() { setDetailView("show-details"); setBlurry("blurred-out"); }
[ "function ShowMovieDetails (resultat)\n{\n\t\n\tfillElement(\"#movieTitle\",resultat.original_title);\n\tfillElement(\"#movieSynopsis\",resultat.overview);\n\tfillElement(\"#movieReleased\",resultat.release_date);\n\tfillElement(\"#movieRate\",resultat.vote_average + \"/10\");\n\tdisplayImage(\"#moviePoster\", resu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ShareViewModel: a knockout view model for the share customization dialog. Tracks basic dialog state (e.g. are we choosing a size or not) and contains a PlayerEmbed model for binding to most of the controls. This model currently relies on EmbedData from the page (second arg to ctor), but that dependency is as of yet res...
function ShareViewModel(rootelem, embeddata) { var self = this; var $root = $(rootelem); self.$root = $root; // until Share2 is active, check for extra EmbedData for the album if(embeddata.album_embed_data) { embeddata = embeddata.album_embed_data; } var embedopts = { t...
[ "function ShareDialog(parentSelector, interactiveContainerSelector, i18n, interactive) {\n var hash = share_dialog_location.hash,\n originMatch = share_dialog_location.href.match(/(.*?\\/\\/.*?)\\//),\n // Origin might not be available when Lab is running in iframe using srcdoc attr.\n origin = originMa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
description: All of the animals are having a feast! Each animal is bringing one dish. There is just one rule: the dish must start and end with the same letters as the animal's name.
function feast(beast, dish) { let beastLetters = [beast.slice(0, 1), beast.slice(-1)].join('') let dishLetters = [dish.slice(0, 1), dish.slice(-1)].join('') return beastLetters === dishLetters }
[ "function dishNameRe(name){\n //for parenthesis\n name = name.replace(/([()[{*+.$^\\|?])/g, '\\\\$1');\n //select exact\n name = '^' + name + '$';\n return name;\n }", "function tooManyWords(){\n\t\n\tanswer = prompt(\"Please enter a phrase...\");\n\t\n\tif (answer == null ||...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets socket, user and activeChat objects and set in to Redux store on component mount
componentDidMount() { const {activeChat, user, socket, userlist} = this.props; if (!activeChat) { const newChat = factories.createChat({name}); this.props.setActiveChat(newChat); this.createChat(newChat, socket); } if (user && activeChat) { ...
[ "function send_current_users (socket) {\n var info = client_info[socket.id];\n var users = [];\n var now_timestamp = moment().local().format('h:mm:ss a');\n\n if (typeof info === 'undefined') {\n return;\n }\n\n Object.keys(client_info).forEach(function (socket_id) {\n var user_info = client_info[socket...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getOverwriteFile() Input Name of file passed by user Output Gets name of new file to write JSON object to. If file exists, ensures user wants it to be overwritten.
function getOverwriteFile(filename, flag) { var overwriteChoice = ""; while (fs.existsSync(filename + ".json")) { overwriteChoice = readline.question("File exists, would you like to overwrite it? Y/N\n").trim(); overwriteChoice = overwriteChoice.toLowerCase(); while (!(ove...
[ "function getExistingFile(filename, flag)\r\n{\r\n if (filename.length == 0 && flag)\r\n {\r\n var tempName = \"newRaffle\";\r\n var realName = tempName;\r\n var count = 0;\r\n\r\n while (fs.existsSync(tempName + \".json\"))\r\n {\r\n count++;\r\n tempN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes date as String in common 'MMM DD, YYYY' format (i.e. 'Jan 10, 2018') and returns object with month, day, year as integer values
parseDate(formattedDate) { const [monthDayStr, yearStr] = formattedDate.split(', '); const [monthStr, dayStr] = monthDayStr.split(' '); return { month: this.getMonthInt(monthStr), day: parseInt(dayStr), year: parseInt(yearStr) }; }
[ "function parse(date, cMonth, cDay) {\n\n // Empty/undefined date is invalid\n if (typeof date === \"undefined\" || !date.length > 1) {\n return false;\n }\n\n var year = null, month = null, day = null;\n date = date.toString();\n\n var parts = normalize(date).sp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
after user inactive, this method is hot swapped as the dynamicActivity method inwhich the next user activity reactivates monitors
function reactivate() { enableIntervals(); dynamicActivity = regularActivityMonitor; }
[ "function startActivityMonitor() {\n\tclearInterval(activityLoop);\n\tlastActive = Math.ceil((new Date()).getTime() / 1000); //unix time in seconds\n\tactivityLoop = setInterval(timerIncrement, 31000); // Check user active every 31 seconds \n\n}", "function stop_monitoring()\n {\n browser.idle.onStateCh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Computes a relative position in the trimmed content from that in the raw content.
computeContentOffset(rawOffset) { if (this.content === '') { return 0; } if (rawOffset < this.paddingLeft) { return 0; } if (rawOffset < this.paddingLeft + this.content.length) { return rawOffset - this.paddingLeft; } return thi...
[ "matchBefore(expr) {\n let line = this.state.doc.lineAt(this.pos);\n let start = Math.max(line.from, this.pos - 250);\n let str = line.slice(start - line.from, this.pos - line.from);\n let found = str.search(ensureAnchor(expr, false));\n return found < 0 ? null : { from: start + f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds input value to textarea for BORDERBOTTOMRIGHT
function borderBRValue(borderValue) { textarea.textContent += `border-bottom-right-radius: ${borderValue}%; -webkit-border-bottom-right-radius: ${borderValue}%; -moz-border-radius-bottomright: ${borderValue}%;`; }
[ "function borderBLValue(borderValue) {\n textarea.textContent += `border-bottom-left-radius: ${borderValue}%;\n-webkit-border-bottom-left-radius: ${borderValue}%;\n-moz-border-radius-bottomleft: ${borderValue}%;`;\n}", "_updateHeight() {\n this._mirroredTextareaRef.el.value = this.composer.textInputConten...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a new ``bytes26`` type for %%v%%.
static bytes26(v) { return b(v, 26); }
[ "static bytes27(v) { return b(v, 27); }", "static bytes25(v) { return b(v, 25); }", "static bytes23(v) { return b(v, 23); }", "static bytes22(v) { return b(v, 22); }", "static bytes9(v) { return b(v, 9); }", "static bytes28(v) { return b(v, 28); }", "static bytes24(v) { return b(v, 24); }", "static by...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate an alert with the provided array of options.
async function generateAlert(message,options) { let alert = new Alert() alert.message = message for (const option of options) { alert.addAction(option) } let response = await alert.presentAlert() return response }
[ "function createLaunchPopOver (options){\n \n if (typeof options === 'undefined' ||\n options === null){\n return;\n }\n \n var message = options['message'],\n trace = options['trace'],\n isConfirm = options['confirm-mode'] || false,\n okLabel = options['ok-labe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================== calculate k and b for given (x1,x2,...xn) (y1,y2,...yn) ===================================================================
function cal_kb(xy_points){ /* // formula for k and b k =( n(x1y1+x2y2+...+xnyn)-(x1+...+x2)(y1+...+yn) ) / ( n(x1^2+x2^2+...+xn^2) - (x1+...+x2)^2 ) b = (y1+...+yn)/n - k*(x1+...+x2)/n */ var n = xy_points.length; var xy_sum = 0,x2_sum = 0,y2_sum = 0; var x_sum = 0,y_sum = 0; for(var i=0;i<n;i++){ xy_sum ...
[ "function xmm( x , y )\n {\n\n let i = undefined ;\n let j = undefined ;\n let k = undefined ;\n let a = undefined ;\n let b = undefined ;\n let c = undefined ;\n let d = undefined ;\n\n let e = [ 1 , 2 , 2 , 1 , 2 , 0 , 0 , 2 , 0 , 1 , 1 , 0 ] ;\n\n for( j = 0; j < this.nc; ++j )\n\n for( i = k = 0 , a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enter a parse tree produced by Java9ParserprimitiveType.
enterPrimitiveType(ctx) { }
[ "enterTypeReference(ctx) {\n\t}", "static parseNode(ASTNode) {\n\n // To see all available types:\n // http://esprima.readthedocs.io/en/latest/syntax-tree-format.html\n const typeSwitcher = {\n\n /* A base-level token like 'x' */\n 'Identifier': (node) => {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Normals code added by Daniel Koenig and Scotti Anderson Orr Lab 5 /// DISK DEFINTION /// /// Disk is defined to be centered at the origin of the coordinate reference system. /// Disk size is assumed to be r=1, center (0,0,0). /// Disk is lying in the XY plane /// slice variable indicates the number of "pizza slices" fo...
function Disk(x) { var slice = x; this.name = "disk"; this.numTriangles = slice; this.numVertices = 3*this.numTriangles; this.radius = 1; this.vertices = []; this.colors = []; this.normals = []; this.texCoords = []; //Declare angle per slice in radians var angle =...
[ "function calculateNormalLines() {\n const len = segments.length;\n for(var i = 0; i < len; i++) {\n var points = segments[i];\n var normalVector = surfaceNormals[i];\n // Scales each line by 1/10 of the longest dimension of the shape\n var scaleFactor = 0.1 * Math.max(Math.abs(ext...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chapter 101 RopeGroup Load
function C101_KinbakuClub_RopeGroup_Load() { // Load correct stage // After intro player has a choice each time she goes to the group, until a twin is released if (C101_KinbakuClub_RopeGroup_CurrentStage > 100 && C101_KinbakuClub_RopeGroup_CurrentStage < 700) { C101_KinbakuClub_RopeGroup_CurrentStage = 100; } ...
[ "static async load({\n groups = [],\n onProgress = null,\n onComplete = null\n } = {}) {\n const promises = [];\n\n let progress = 0;\n\n for (let audioName in SuperAudioManager.audios) {\n const audio = SuperAudioManager.audios[audioName];\n const ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
checkMetadataComplete: start the download of existing metadata chunks
function checkMetadataComplete() { var metadata = g_files[g_metadataName]; var i, writer; g_complete++; if (g_complete == metadata.chunks.length) { // Remove chunks that do not exist for (i = metadata.chunks.length - 1; i > -1; i--) { if (!metadata.chunks[i].info[0].exists) {...
[ "function checkComplete() {\r\n if (sectionLoaderState.filesLoaded >= sectionLoaderState.filesToLoad.length) complete();\r\n}", "function checkFinished () {\n console.log(fileLoadCount+\" files loaded\")\n if (fileLoadCount == fileLoadThreshold) {\n console.log(\"basicFileLoader - callback: \"+cFunc.n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if the secret object should be refreshed.
isRefreshNeeded() { if (this.refreshNeeded) { return true; } if (null != this.exception) { // If we encountered an exception on the last attempt // we do not want to keep retrying without a pause between // the refresh attempts. // ...
[ "shouldReset() {\n const { resourceShouldRefresh } = this.optionsTemplate;\n\n return (_.isBoolean(resourceShouldRefresh) && resourceShouldRefresh)\n || (_.isFunction(resourceShouldRefresh) && resourceShouldRefresh());\n }", "get reconfigured() {\n return this.startState.config != this.state.co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
start : Use for change image color in info page
function change_color(f) { var imagename = f.id; var modelnamess = $('#' + f.id + '').data('model') //alert(modelnamess); $("#infoimage").attr("src", "images/" + modelnamess + "/" + f.id + ".jpg"); }
[ "changeColorRed() {\n this.planet.loadTexture('planetred');\n this.mini.loadTexture('planetred');\n }", "function setBackgroundImage(i){\n document.body.style.backgroundImage = `url(${prettyStuff[i].image})`;\n document.getElementById(\"summary\").textContent =\n prettyStuff[i].s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resize iframe height based on window/device width
function resizeIframe() { const windowWidth = window.innerWidth; if (windowWidth > 1024) return; if (windowWidth > 812) { iframe.height = "220"; } else if (windowWidth > 550) { iframe.height = "233.33"; } else { iframe.height = "200"; } }
[ "function resizeWindow () {\n\t\tparent.postMessage($('body').height(), '*');\n\t}", "resizeEmbed() {\n Object.keys(this.videoEmbeds).forEach((key) => {\n const embed = this.videoEmbeds[key];\n\n fastdom.measure(() => {\n const newWidth = embed.floated ?\n embed.parent.offsetWidth :\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generate csv table from selected plot data
function convert_to_csv (curr_sel, plot_id, header_index, defaultFilename, use_data_order) { // if selection is empty, use all plots if (curr_sel.length == 0) { // construct current selection as all points for (var i = 0; i < tot_num_plots; i++) { ...
[ "function download_plot(event)\r\n{\r\n\r\n // identify plot to be downloaded\r\n var plot_id = event.data.id;\r\n\r\n // get user selection\r\n var curr_sel = selections.filtered_sel();\r\n\r\n\t// make sure something is selected\r\n\tif (curr_sel.length == 0) {\r\n\r\n\t dialog.ajax_error(\"There a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function used to save Sale or Update Book Issue Details
function saveOrUpdateDetails() { // Collect Form Input Data into variable let bookname1 = $('#bookname').val(); let studentid1 = parseInt($('#studentid').val()); let issuedate1 = $('#issuedate').val(); let issuestatus1 = $("#issuestatus").val(); // Collect Issue ID let issueid = $("#issuei...
[ "function editSave() {\n if (!inputValid()) return;\n vm.editObj.id = -3;\n server.addBuoy(vm.editObj).then(function(res) {\n queryBuoys();\n queryBuoyInstances();\n gui.alertSuccess('Buoy added.');\n }, function(res) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end of function setChart function to create a dropdown menu for attribute selection
function createDropdown(csvData){ //add selection element var dropdown = d3.select(".vizMap") .append("select") .attr("class", "dropdown") .on("change", function(){ //add a listener for attribute changes from dropdown menu changeAttribute(this.value, c...
[ "function createAttributeSelect() {\n var attrSelect = $(\"#attr-select\");\n var prevDatasetId = queryParameters.dataset;\n if(attrSelect.length > 0 && attrSelect.data(\"datasetid\") !== prevDatasetId){\n attrSelect.parent().remove();\n attrSelect = $(\"#attr-select\");\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParseralter_user.
visitAlter_user(ctx) { return this.visitChildren(ctx); }
[ "visitAudit_user(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAlter_user_editions_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitCreate_user(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitData_manipulation_language_statements(ctx) {\n\t return this.visitChildren(ctx);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create the relabel selector.
function createRelabelSelector(data, index, annotator, popupContainer) { var select = document.createElement("select"), firstOption = document.createElement("option"); firstOption.appendChild(document.createTextNode("Change to")); select.appendChild(firstOption); for (var i = 0; i < data.labels....
[ "function createSelector() {\n for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n args[_key7] = arguments[_key7];\n }\n\n var selector = _reselect.createSelector.apply(undefined, args);\n selector.$$factory = function () {\n return _reselect.crea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function `multiplyLog` that accepts a callback and a number as it's arguments. `multiplyLog` should multiply the number argument by 2 and store the sum `multiplyLog` should then invoke the callback function, and pass the previously calculated sum to the callback function. Next, write a function `logger` that ac...
function multiplyLog(num, callback) { const result = num * 2; setTimeout(function() { callback(result); }, 4000) }
[ "function multiplyNums(x, y, cb) {\n return cb(x * y);\n}", "function calculateMultiply(num1, num2){\n \n return num1 * num2 \n}", "function squareCPS(num, callback) {\n setTimeout(function() {\n callback(num * num);\n console.log(\"Waited 1000 ms\");\n }, 1000);\n}", "function multiplyBy2(item...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loading info about cards by class 'cardloadinfo'
function contentCardLoad(){ $('.card-load-info').each(function(){ var background = $(this).data('mainimg'); var value = $(this).data('value'); var subTypeMas = $(this).data('subtypemas').split(','); var titleText = $(this).data('title'); var icon = $(this).data('icon'); var contentText = $(this).data('co...
[ "async loadCards() {\n await JsonPlaceholder.get(\"/posts\", {\n params: {\n _start: this.props.cardList.length + 1,\n },\n })\n .then((res) => {\n this.props.fetchCardsSuccess({\n loadMore: !(res.data.length < 10),\n cardList: res.data,\n });\n })\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SoundCloudControls wraps the SoundCloud widget and custom controls element
function SoundCloudControls(player, controlsElement) { this.player = player; this.controls = controlsElement; this.controls.addClass("playControls__wrapper"); }
[ "function placeControlsElements(){\n\t\t\n\t\tif(g_objButtonPlay)\t\t\t\n\t\t\tg_functions.placeElement(g_objButtonPlay, g_options.slider_play_button_align_hor, g_options.slider_play_button_align_vert, g_options.slider_play_button_offset_hor, g_options.slider_play_button_offset_vert);\t\t\t\n\t\t\n\t\t//position fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
end function j32() Function j33
function j33( x ) { let r = undefined ; let i1 = i31( x ) let i2 = i32( x ) let i3 = i33( x ) r = ( ((2 * i1 * i1 * i1) / 27) - ((i1 * i2) / 3) + i3 ) ; return( r ) ; }
[ "function run_MIPS32(asmInput, singleStep) {\n ks_endian = ENDIANESS? ks.MODE_BIG_ENDIAN:ks.MODE_LITTLE_ENDIAN\n uc_endian = ENDIANESS? uc.MODE_BIG_ENDIAN:uc.MODE_LITTLE_ENDIAN\n return run_generic(asmInput, 0x10000, ks.ARCH_MIPS,ks.MODE_MIPS32+ks_endian,uc.ARCH_MIPS,uc.MODE_MIPS32+uc_endian,\"MIPS32\",\"n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implementacion utilizada para el cierre de aplicaciones NAcar desde el escritorio pesado. Unicamente controlado para peticiones multiflujo (contenedores)
function accionCierreAplicacionNacar(parametros){ if (parametros) { var datos = parametros.split("||"); if (datos) { var op = datos[0]; switch(op) { case "0": // Si es pagina contenedora if (typeof (CTE_CONTENEDORES_PAGINA_CONTENEDORA)!="undefined") { prevenirCierrePaginaContenedora(); }...
[ "function subirObjetosNegocio(claves, valores, actualizacionFlag) {\n if (utils_isComuServidorWeb()){\n\t\t\t//Si utilizamos el servidor Web\n\t\t\tvar mensaje=\"\";\n\t\t\t// EL formato serà clave1=*=valor1*+*clave2=*=valor2 ...\n\t\t\tvar j=0;\n\t\t\tfor(var i=0;i<claves.length;i++)\n\t\t\t{\n\t\t\t\tif (j>0)\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the instrument name from the instrumentForm UI element
function getInstrumentNameFromForm() { return document.getElementById("instrumentForm").value; }
[ "parseName() {\n return ionMarkDown_1.Imd.MarkDownToHTML(this.details.artist) + \" - \" + ionMarkDown_1.Imd.MarkDownToHTML(this.details.title);\n }", "function getParentFormName(elt) {\n\t\twhile (elt && elt.nodeName && elt.nodeName.toUpperCase() !== 'HTML' && elt.nodeName.toUpperCase() !== 'FORM') {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolve a config option for a cell renderer.
function resolveOption(option, config) { return typeof option === 'function' ? option(config) : option; }
[ "_updateEditorConfig() {\n for (let i = 0; i < this.widgets.length; i++) {\n const cell = this.widgets[i];\n let config;\n switch (cell.model.type) {\n case 'code':\n config = this._editorConfig.code;\n break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
displays the appropriate description message and image based on the selected blueprint and wizard dialog step.
function getBlueprintDescriptionAndUpdateImage(dialogPage, selectedBlueprint) { var description; switch (selectedBlueprint) { case "Multi-Page Journey": description = "Create several pages that a user can follow from start to finish."; updateBlueprintImage(dia...
[ "function getStepContent(step) {\r\n switch (step) {\r\n case 0:\r\n return `Acknowledgement of guidelines for the compliance of food safety and security.`\r\n case 1:\r\n return 'Details of the donations including the item details and pickup details'\r\n case 2:\r\n return ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Join a room as a user
function joinRoom(user, name) { var room; if(user.getRoom()) { leaveRoom(user); } room = Room.getRoomByName(name); if(room) { room.addMember(user); listRoomMembers(user); } else { user.notify('Room \'' + room + '\' does not exist.'); } }
[ "joinRoom(room) {\n this.ajax.post(`/rooms/${room.id}/join`).then(() => {\n this.transitionToRoute('play.room', room);\n });\n }", "joinRoom(room) {\n this.room = room;\n\n this.room.addClient(this);\n }", "function joinChatRoom() {\n socketRef.current.emit(\"join chat\", { name, r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
flush sequentially with an interval in between
function flushNext() { delete exports.intervalId if (exports.exiting) return Promise.resolve() const promise = exports.flushSequentialPromise = flushSequential().catch(config.onError) return promise.then(timeout).then(flushNext) }
[ "flush(callback) {\n\n var callQueue = this._callQueue;\n var uploadQueue = this._uploadQueue;\n\n var waitUpload = () => {\n if (uploadQueue.idle()) {\n return callback();\n }\n\n uploadQueue.drain = () => {\n uploadQueue.drain = null;\n\n callback();\n }\n }\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the ToDateTimeOptions abstract operation is called with arguments options, required, and defaults, the following steps are taken:
function ToDateTimeOptions(options, required, defaults) { // 1. If options is undefined, then let options be null, else let options be // ToObject(options). if (options === undefined) options = null;else { // (#12) options needs to be a Record, but it also needs to inherit properties ...
[ "toISOString() {\n return this.dateTime.toISOString();\n }", "static GetOptions(options, defaultOptions) {\n let _options = {};\n if (!options) {\n options = {};\n }\n if (!defaultOptions) {\n defaultOptions = LowPolyPathBuilder.GetDefaultOptions(options ? opt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method replaces the target HTML with the component's HTML. The radio button is included to have Bootstrap use the correct styles.
render() { const html = `<label id="${this.target.replace('#', '')}" class="btn btn-primary text-light " title="${this.hoverText}"> <input type="radio" name="options" autocomplete="off"> ${this.iconStr()} </label>`; $(this.target).replaceWith(html); }
[ "function aRadioSelect(target, options)\n{\n $(target).each(\n function(i) {\n // Don't do it twice to the same element\n if ($(this).data('a-radio-select-applied'))\n {\n return;\n }\n $(this).hide();\n $(this).data('a-radio-select-applied', 1);\n var html = \"\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolves a localized module config to a path.
function resolveLocalizedModuleConfiguration(moduleConfiguration) { // Workaround for temporary issue in SPOREL. VSO#279843 var currentLocale = _stores_LocaleStore__WEBPACK_IMPORTED_MODULE_2__["default"].getLocale(); if (moduleConfiguration.paths) { // This only applies when testing production manif...
[ "function resolvePath(module, cwd) {\n\n\t\n\treturn resolve.sync(module, {\n\t\tbasedir: cwd\n\t});\n\n\tif(cwd && module.substr(0, 1) == \".\") {\n\t\treturn require.resolve(cwd + \"/\" + module);\n\t}\n\n\t//not local?\n\ttry {\n\t\treturn require.resolve(module);\n\t} catch(e) {\n\t\treturn null;\n\t}\n\t\n\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find the max and min frequency keys
function getMaxMap() { let max = 0; let maxKey = ""; let min = Infinity; let minKey = ""; for (let [key, value] of tempMap.entries()) { if (value > max) { max = value; maxKey = key; } if (value <= min) { min = value; minKey = ke...
[ "static frequencies(arr) {\n let result = {};\n arr.forEach(e => {\n if (e in result) {\n result[e] += 1;\n } else {\n result[e] = 1;\n }\n });\n return result;\n }", "function kMostElements(arr, k) {\n // counter hash\n let count = {};\n // frequency histogram\n let ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refreshes the personal views list
function refreshPersonalViews() { received_personal_views = false; $.ajax({ url : bb_api_personalviews, data : { user__username: user_name, room : room.id, limit : 0, format : 'json', username : user_name, api_key : api_key }, accepts : 'application/json', ...
[ "function refresh() {\n $scope.award = {};\n $scope.awardLocation = {};\n\n getAwardList(personReferenceKey);\n\n\n\n\n }", "function refreshFurnitureList(){\n\tvar listPanel = View.panels.get('treePanel');\n\tlistPanel.refresh(listPanel.restriction);\n}", "function notifyObservers() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds fields which contain geometry data to geomAttrs. This list is used when adding properties to the features so that no geometry fields are added the properties key
function setGeomAttrList(params) { for(var param in params) { if(params.hasOwnProperty(param)) { if(typeof params[param] === 'string') { geomAttrs.push(params[param]); } else if (typeof params[param] === 'object') { // Array of coordinates for Point geomAttrs.push(params[pa...
[ "_initGeometryData() {\r\n if (!this._geometryData) {\r\n this._geometryData = new GeometryData();\r\n\r\n // if vertex buffer exists aleady, store the sizes\r\n if (this.vertexBuffer) {\r\n this._geometryData.vertexCount = this.vertexBuffer.numVertices;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END OF CHECKED PROPERTY FUNCTIONS / HIDE CHECKED ITEM FUNCTIONS toggleHiddenCheckItems() Toggles the hide property in STORE obj handleHiddenCheckedItems() Responsbile for handling when a user clicks hide checked items Toggles the hide property in STORE obj
function toggleHiddenCheckItems() { STORE.hide = !STORE.hide; }
[ "function handleHiddenCheckedItems(){\n $('#toggle-completed-items').click(function() {\n toggleHiddenCheckItems();\n renderShoppingList();\n });\n}", "isItemHidden(item) {\n return this.composer.getItemPropertyValue(item, 'hidden') === true;\n }", "function toggleCheckedForListIte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Bind all files checkboxes
bindFileCheckbox() { const chk = this.cnt.querySelectorAll(".files-tree-file-checkbox"); for (const el of chk) { el.addEventListener("click", e => { const ul = this.getParentsUL(e.target); ul.forEach(ul => this.markFolderCheckbox(ul)); if (thi...
[ "bindFolderCheckbox() {\n const folderChk = this.cnt.querySelectorAll(`.files-tree-folder-checkbox`);\n for (const el of folderChk) {\n el.addEventListener(\"click\", e => {\n //po klinięciu na checkbox\n //zaznaczam w danej liście i podlistach wszystkie checkb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Aligns popup with sender Horizontally. Tries should initially be set to 0
function alignHorizontally(systemPopup, position, tries) { var extra = systemPopup.data("popup-extra"); // Sender's offset in parent var senderOffset = extra['senderOffset']; // Onscreen alignment distance var aliDist = extra['alignOffset']; // Point of reference ...
[ "function orientatePopupHorizontally(systemPopup, position, tries) {\n var extra = systemPopup.data(\"popup-extra\");\n var posArr = position.split(\"|\");\n // Popup's onscreen distance from sender in px\n var offDist = extra['distanceOffset'] + 10;\n // Reference point\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluates if a VATCode follows the countryspecific format. Returns: 0: success 1: wrong countrycode 2: not enough characters 3: too many characters
function evalVATCode(countrycode, VATcode) { vatspec = getVATSpec(countrycode); if (VATcode.slice(0,vatspec.prefix.length) != vatspec.prefix) return 1; if(VATcode.length < vatspec.minlength) return 2; if(VATcode.length > vatspec.maxlength) return 3; return 0; }
[ "function validCountryProvided(c) {\n return typeof c === 'string' && c.length < 501;\n}", "function _validUPS(number) {\n number = number.trim();\n if (number.length != 18) { return false; }\n var check = number.substr(17, 1);\n\n // First Two Digits Must Be 1Z\n if (number....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
insert a word into the trie
insert(word) { let node = this.root; let char = word.slice(0,1); word = word.slice(1); let child; while(char.length > 0) { if(node.children[char] === undefined) { child = new Trie(char); node.children[node] = child; } else { child = node.children...
[ "addNewWord(word) {\n\t\tlet currentNode = this;\n\t\tfor (let i = 0; i < word.length; i++) {\n\t\t\tconst char = word[i];\n\n\t\t\t// Increment the seen counter\n\t\t\tcurrentNode.seen += 1;\n\n\t\t\tif (!currentNode.children[char]) {\n\t\t\t\t// There isn't a word built here yet, so just use the constructor\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes UI for editor and toolbar based on whether dark mode param is set
function darkMode(preference) { if (preference) { //turn dark mode on $("#current-note-body").css({ 'color': 'white', 'background-color': '#2a2a2a' }); $("#toolbar").css({ 'background-color': '#1b1b1b' }); $(".ql-snow .ql-fill, .ql-snow .ql...
[ "function determineDarkMode() {\n (userPreferences.darkMode) ? darkMode(true) : {};\n}", "switchToWYSIWYG() {\n this.$containerEl.removeClass('te-md-mode');\n this.$containerEl.addClass('te-ww-mode');\n }", "function updateStyle() {\r\n\tif (settings.darkThemeSettings) {\r\n\t\t//dark theme ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Asserts that sidebar has a reasonable width.
function assertSidebarWidth() { cy.get('#sidebar').should('have.css', 'width').and((width) => { expect(width).to.have.string('px'); const val = parseInt(width.substring(0, width.length - 2)); expect(val).to.be.within(271, 275); }); }
[ "function getSidebarWidth() {\r\n return sidebarWidth;\r\n}", "checkForcedWidth() {\n var maximum_string_width = 0;\n\n for(var i=0;i<this.dispatcher.split_words.length;i++) {\n var block = this.dispatcher.split_words[i];\n if(block.match(/^\\s+$/)) { // только строка из пробелов совершает word-b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Alternates Header background images & text when clicked
onClick() { if (this.state.backgroundSelection === "Header-background-1") { this.setState({ backgroundSelection: "Header-background-2", backgroundText: this.imageTextTwo() }) } else if (this.state.backgroundSelection === "Header-background-2") { this.setState({ backgrou...
[ "function colorHeader(i) {\n $(\"#heading\" + i).addClass(\"hasEvent\");\n }", "function setupHeaderClickHandling()/*:void*/ {var this$=this;\n this.subPanels$v95j.forEach(function (panel/*:Panel*/)/*:void*/ {\n var header/*:Element*/ = panel.header.getEl();\n\n if (header) {\n header.setS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Figure out the text for the dialog button.
getButtonText() { return defaultValue(this.buttonText, this.pointEntities.entities.values.length >= 2 ? i18next.t("models.userDrawing.btnDone") : i18next.t("models.userDrawing.btnCancel")); }
[ "showButtonPageDescription(text){\n\t\tthis.buttonPageDescription.setInfoText(text);\n\t\tthis.buttonPageDescription.updatesHimself();\n\t\tthis.buttonPageDescription.showInfoText();\n\t}", "function setOkButtonTitle(name) {\n\t\t$okButton.html(name);\n\t}", "function isDefault(text) {\n var _t;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find attached sheet with an index higher than the passed one.
function findHigherSheet(registry, options) { for (var i = 0; i < registry.length; i++) { var sheet = registry[i]; if (sheet.attached && sheet.options.index > options.index && sheet.options.insertionPoint === options.insertionPoint) { return sheet; } } return null; }
[ "function findHigherSheet(registry, options) {\n for (var i = 0; i < registry.length; i++) {\n var sheet = registry[i];\n if (\n sheet.attached &&\n sheet.options.index > options.index &&\n sheet.options.insertionPoint === options.insertionPoint\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
BluetoothLoop................................................................................... Check every 10 seconds if not connected and subscribed and every 15 seconds if already connected...
function BluetoothLoop() { if( bPhoneInBackground ) { // Phone in background, run without BT... // Note that this loop is stopped if a BT device has already connected but // if trying to connect then the disconnect logic does not stop this loop. BluetoothCnxTimer = setTime...
[ "scanForAllDevices() {\n if (this.btDevicesToPing.length <= 0) {\n // console.log(`[${new Date()}] no BT devices to ping`);\n } else {\n // console.log(`[${new Date()}] scanning for presence of any of ${this.btDevicesToPing.length} BT devices`);\n\n // scan for each de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Execute the current batch and resolve the associated promises
execute() { // we need to check the dependencies twice due to how different engines handle things. // We can get a second set of promises added during the first set resolving return Promise.all(this._deps) .then(() => Promise.all(this._deps)) .then(() => this.executeImpl(...
[ "async execute() {\n try {\n await this.persistStatus(TASK_ONGOING_STATUS);\n this.files = await getUnconsumedFiles(this.since);\n console.log(`Found ${this.totalFiles} new files to be consumed`);\n if (this.totalFiles) {\n await this.consumeNext();\n } else {\n console.log...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract packageName, version and fileName from given literal if type = "installed".
function extractLiteralFromInstalled(stats, element) { if (element.length === 0) return stats; let value = ''; if (validLiteral(element[0])) { value = element[0].value; stats.setPackageName(value); } if (validLiteral(element[1])) { value = element[1].value; stats.setF...
[ "function pkgFromType(type) {\n const parts = type.split(\":\");\n if (parts.length === 3) {\n return parts[0];\n }\n return undefined;\n}", "function getPackageInfo(installPackage) {\n if (installPackage.match(/^.+\\.(tgz|tar\\.gz)$/)) {\n return getTemporaryDirectory()\n .then(obj =>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement a GET Endpoint to Search by Blockchain Wallet Address
async searchBlockchainWalletAddress() { this.app.get("/stars/address::address", async (req, res) => { try { console.log("Address Block Hit"); let blockchain = new Blockchain(); let val = req.params.address; if(val =...
[ "getBlocksByAddress() {\n this.app.get('/stars/address::address', async (req, res) => {\n const { address } = req.params;\n // ensure address is valid\n if (checkAddress(address)) {\n try {\n // search through blockchain, add any blocks with matching address to total.\n co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }