query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Helper function to remove the dialog and call the callback with false.
function _remove() { dialog.remove(); }
[ "@action closeDialog() {\r\n\t\tif (this.dialog) this.dialog.opened = false;\r\n\t}", "function clearDialog() {\n $(\".dialog\").empty();\n }", "function closeDeviceTypePopUp(){\n\t$('#devicetypePopUp').dialog('destroy');\n}", "function dialogAddEventHandler() {\n $(\"#dialog-cancel-load\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the the x position for an element, relative to the parent
getElementX(el) { var parent = this.myRef.current; var center = parent.clientWidth / 2; var left = el.offsetLeft - parent.offsetLeft; return left - center; }
[ "pos_x() {\n return(this.pos.x);\n }", "function tooltipXposition(d){\n\t\t\treturn x(d)+leftOffset(\"stage_wrapper\")+\"px\";\n\t\t}", "function findAbsolutePosX(obj)\n{\n var curleft = 0;\n if (document.getElementById || document.all)\n {\n while (obj.offsetParent)\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
todo: need to make sure these are dispatched in correct order
_dispatchEvents() { //todo: this doesnt let us specify order that events are disptached //so we will probably have to check each one //info here: https://stackoverflow.com/a/37694450/10232 for (let handler of this._eventHandlers.values()) { handler.dispatch(); } }
[ "_dispatch(event, ...args) {\n const handlers = this._handlers && this._handlers[event];\n if (!handlers) return;\n handlers.forEach(func => {\n func.call(null, ...args);\n });\n }", "componentDidMount() {\n\n if (!this.props.courses) {\n this.props.dispatch(getCourseList());\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get species count per common name function
function getSpeciesCount() { var arrayCount = []; for (var i = 0; i < data.features.length; i++) { for (var j = 0; j < comNameArr.length; j++) { if (data.features[i].properties.Common_Name == comNameArr[j]) { arrayCount.push(comNameArr[j]); } } } var dict = {}; for (var i = 0; i < comNameAr...
[ "function speciesCount(node, parentNodes) {\n let childrenAmount = node.c.length;\n\n if (childrenAmount > 0 && node.r == 'Genus') {\n //say the node has N species\n node.cumulativeChildren += node.c.length;\n //add species count ot its parents\n parentNodes.forEach(function(family...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to start the quizz
function startQuizz() { setPreviousTime(currentDate.getTime()) addTimers(); setQuestionNumber(0); }
[ "function initialise (quizz){\n if (quizz === \"kaamelott\") {\n kaamelott.forEach(item => {\n questionArray.push(new Question(item[0], item[1], item[2], item[3], item[4], item[item[5]]));\n });\n } else if (quizz === \"manga\") {\n manga.forEach(item => {\n question...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by Java9ParserenumConstantList.
exitEnumConstantList(ctx) { }
[ "exitEnumConstantModifier(ctx) {\n\t}", "exitEnumConstantName(ctx) {\n\t}", "exitEnumEntry(ctx) {\n\t}", "enterEnumConstantList(ctx) {\n\t}", "exitLiteralConstant(ctx) {\n\t}", "exitPreprocessorConstant(ctx) {\n\t}", "exitConstantModifier(ctx) {\n\t}", "exitMultiVariableDeclaration(ctx) {\n\t}", "ex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prepare() takes a string, whacks off any front and trailing whitespace, and puts everything in lowercase.
prepare(str) { return str.trim().toLowerCase(); }
[ "function lower(text) {\n return text.toLowerCase();\n }", "function normalize(ruleStr)\r\n{\r\n\tvar retVal = ruleStr.toLowerCase() ;\r\n\tvar re = /,(\\w)/;\r\n\tretVal = retVal.replace(re,\", $1\");\r\n\treturn retVal;\r\n}", "function normalizeHeader_(header) {\n var key = \"\";\n var upperCase ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simplified assertion. Throws an error is `val` is falsey.
function assert(val, message) { if (!val) throw new Error(message); }
[ "function check(oval, nval) {\n if (oval !== undefined) {\n if (oval != nval) {\n throw Error(\"Values don't match\");\n }\n }\n return nval;\n}", "function assertNever(theValue) {\n throw new Error(\"Unhandled case for value: '\".concat(theValue, \"'\"));\n }", "function assertIsFalse(a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches the collaborators from the API and return a list of the collaborators.
async function getCollaborators(id) { const requestOptions = { headers: {'Content-Type': 'application/json', 'Authorization': ('Bearer ' + token.token)} }; return await fetch(`https://lagalt-service.herokuapp.com/api/v1/project/${id}/collaborators/`, requestOptions) .then...
[ "function loadCollaborators(doc, cb) {\n $.ajax({\n type: 'GET',\n headers: {\n \"Authorization\": \"token \" + token()\n },\n url: Substance.settings.hub_api + '/documents/' + doc.id + '/collaborators',\n success: function(publications) {\n cb(null, publications);\n },\n error: func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the courses from the CSV specified in the cli prompt
function getCourses(filePath) { return new Promise((resolve, reject) => { fs.readFile(filePath, 'utf8', (err, fileContents) => { if (err) { console.error(err); return reject(err); } /* Use d3.dsv to turn the CSV file into an array of object...
[ "function listCourses() {\n gapi.client.classroom.courses.list({\n pageSize: 10\n }).then(function(response) {\n var courses = response.result.courses;\n appendPre('Courses:');\n\n if (courses.length > 0) {\n for (i = 0; i < courses.length; i++) {\n var course = courses[i];\n append...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
displays the save zones button (called when things have changed)
function showSaveZones () { $('#save-zones').css('display',''); }
[ "function displayZonesData() {\n\tvar $table = getTable ('zones-info', ['nom','paramètres']);\n\tvar $tbody = getTBody($table);\n\tvar zones = screenData['zones'];\n\tfor (zoneid in zones) {\n\t\tzoneid = parseInt(zoneid, 10);\n\t\tconsole.log('displayZonesData '+(typeof zoneid));\n\t\tcreateZone(zoneid).append(zon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: getParameters DESCRIPTION: get participant parameters object ARGUMENTS: none RETURNS: parameter object
function SBParticipant_getParameters() { return this.parameters; }
[ "function getParameters(stream_id, stream_version, username, start_date, end_date)\n{\n return {\n\t auth_token : auth_token,\n\t observer_id : observerId,\n\t stream_id : stream_id,\n\t stream_version : stream_version,\n\t username : username,\n\t start_date : start_date,\n\t end_date : end...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion que busca el indice en donde se encuantra lat y lon requerida
function indice(lat, lon, array){ var n = array.length; index = -1; for (var i = 0 ; i < n; i++) { if (Number(array[i][0]) == lat && Number(array[i][1]) == lon){ index = i; return index; } } return index; }
[ "function getMiddle() {\n\n // setup vars\n var lat1 = loc1.lat;\n var lon1 = loc1.long;\n var lat2 = loc2.lat;\n var lon2 = loc2.long;\n\n // helper functions\n function toRadians(degrees) {\n return degrees * (Math.PI / 180);\n }\n\n functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the user changes selected country or month, this is called to update the lines accordingly.
function updateLine() { if (globalAvgLine && selectedCountryLine) { const monthSelector = document.getElementById("lineChartMonthSelect"); const month = monthSelector.options[monthSelector.selectedIndex].value; const monthAsNumber = moment().month(month).format("MM"); const monthAsNu...
[ "function updateRegion(selectedRegion) {\n // restrict the full dataset data to the restricted region\n dataRegion = data.map(function (d) {\n return {date: d.date, value: d[selectedRegion]}\n })\n\n // assign the restricted data to the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close an Accordion item
close( item ) { item.classList.remove( 'is-expanded' ) const [ tab, panel ] = item.children // ARIA tab.setAttribute( 'aria-selected', false ) panel.setAttribute( 'hidden', '' ) // Styling & transition panel.style.transitionProperty = 'height, padding' ...
[ "close() {\n this.removeAttribute('expanded');\n this.firstElementChild.setAttribute('aria-expanded', false);\n // Remove the event listener\n this.dispatchCustomEvent('tk.dropdown.hide');\n }", "closeTab () {\n if (this.currentTab) {\n this.currentTab.contentElement.setAt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert a class into class list in ascending order of starting time
insertToClassList(classList_, class_) { var startTime = class_.classData.startTime; var endTime = class_.classData.endTime; var len = classList_.length; var done = false; for (var i = 0; i < len; i++) { var currentStartTime = classList_[i].classData.startTime; ...
[ "arrangeClassListView(classList_) {\n var classListLen = classList_.length;\n var subColumnList = new Array();\n subColumnList[0] = new Array();\n var subColumnCount = 1;\n var maxEndTimeClass = classList_[0];\n for (var i = 0; i < classListLen; i++) {\n var curr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserstartup_clauses.
visitStartup_clauses(ctx) { return this.visitChildren(ctx); }
[ "function parse_StatementList(){\n\t\n\n\t\n\n\tvar tempDesc = tokenstreamCOPY[parseCounter][0]; //check desc of token\n\tvar tempType = tokenstreamCOPY[parseCounter][1]; //check type of token\n\n\tif (tempDesc == ' print' || tempType == 'identifier' || tempType == 'type' || tempDesc == ' while' || tempDesc == ' if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION NAME : error AUTHOR : Apple Kem DATE : February 27, 2014 MODIFIED BY : REVISION DATE : REVISION : DESCRIPTION : popUp for warning message with Ok Button PARAMETERS : msg,header
function error(msg,header,execFunc) { $(".ui-popup").popup("close"); if(globalDeviceType == "Mobile"){ $('#errorPromptHeader').empty().append(header); $('#errorPromptBody').empty().append(msg); }else{ $('#errordialogheader').empty().append(header); $('#errordialogbody').empty().append(msg); } if(globalDevi...
[ "function displayErrorDialog(title, message, description) {\n var html = '<div class=\"message-error-dialog\"><p>'+message+'</p>';\n if (description != undefined && description != \"\")\n html += '<p>'+description+'</p>';\n\n html += '<button type=\"button\" class=\"pure-button pure-button-primary r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Arranges UIElement by specified coordinates (x, y) and size taking it's margin into consideration.
function arrange(element, x, y, size) { if (typeof size == "undefined") { size = element.size; } element.arrange(x + element.margin.left, y + element.margin.top, size); }
[ "function SetElementPos(el, x, y){\n el.style.top = y + 'px';\n el.style.left = x + 'px';\n}", "function sizeShouldReturnDimensionsForElementWithMargin() {\n const data = element.size(fixture.el.querySelector(\".size\"))\n expect(data)\n .toEqual({\n width: 100,\n height: 100\n })\n}", "posi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new instance DepthOfFieldEffect
function DepthOfFieldEffect(scene,depthTexture,blurLevel,pipelineTextureType,blockCompilation){if(blurLevel===void 0){blurLevel=DepthOfFieldEffectBlurLevel.Low;}if(pipelineTextureType===void 0){pipelineTextureType=0;}if(blockCompilation===void 0){blockCompilation=false;}var _this=_super.call(this,scene.getEngine(),"dep...
[ "function createDepthMaterial() {\n\n\t\t\t// create main/default override material first\n\t\t\tvar depthShader = zvs.NormalsShader;\n\t\t\t_depthMaterial = zvs.createShaderMaterial(depthShader);\n\t\t\t_depthMaterial.blending = THREE.NoBlending;\n\t\t\t_depthMaterial.packedNormals = true;\n\t\t\t// normally the c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
solve using 2 gameobject with a physics component
solveCollision2(transformA, physicsA, colliderA, transformB, physicsB, colliderB){ // let nameA = "unknown"; // let nameB = "unknown"; // if(colliderA.gameObject.name != null) nameA = colliderA.gameObject.name; // if(colliderB.gameObject.name != null) nameB = colliderB.gameObject.name; // console.lo...
[ "solve() {\n let edgeLength, edge;\n let dx, dy, fx, fy, springForce, distance;\n const edges = this.body.edges;\n const factor = 0.5;\n\n const edgeIndices = this.physicsBody.physicsEdgeIndices;\n const nodeIndices = this.physicsBody.physicsNodeIndices;\n const forces = this.physicsBody.forces...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates hashtags from passed text field or 'tweet.text' property, using twittertext lib.
getHashtags(text) { return twitter.extractHashtagsWithIndices(text ? text : this['tweet.text']); }
[ "function hashtags(tweet) {\n var string = tweet.split(\" \");\n var hash = [];\n for (var i = 0; i < string.length; i++) {\n if (string[i].startsWith(\"#\")) {\n hash.push(string[i]);\n }\n }\n return hash;\n}", "function highlight(str){\n\t\t \treturn '<a rel=\"nofollo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParseralter_tablespace.
visitAlter_tablespace(ctx) { return this.visitChildren(ctx); }
[ "visitTablespace(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitPermanent_tablespace_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitAlter_table(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitCreate_tablespace(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitUser_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Swaps this expression for its reduction (if one exists) in the expression hierarchy.
performReduction() { //console.log("called performReduction"); var reduced_expr = this.reduce(); if (reduced_expr !== undefined && reduced_expr != this) { // Only swap if reduction returns something > null. console.warn('performReduction with ', this, reduced_expr); if ...
[ "swap() {\n const { top, stack } = this;\n const tmp = stack[top - 2];\n\n stack[top] = stack[this.top];\n stack[this.top] = tmp;\n }", "merge(expr) {\n expr = RelationExpression.create(expr);\n\n if (this.isEmpty) {\n // Nothing to merge.\n return expr;\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParserset_constraint_command.
visitSet_constraint_command(ctx) { return this.visitChildren(ctx); }
[ "visitAdd_constraint_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitDrop_constraint_clause(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitConstraint_clauses(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "visitCheck_constraint(ctx) {\n\t return this.visitChildren(ctx);\n\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assign all items to single drop down
function setSingleDropdown(selector, items){ //Remove all options except first option clearSingleDropdown(selector, "not(:first)"); //Create new options $.map(items, function(item, index){ selector.append($("<option></option>").text(item)); }); }
[ "function createDropdowns(){\r\n\tdenominations.forEach(mainDropdown);\r\n\tupdateAddableCurrencies();\r\n}", "prepareSelectItems() {\n let that = this;\n let items_buffer = getReferencesOfType('AGItem');\n let select_item_buffer = '';\n if (items_buffer.length > 0) {\n item...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return an array of objects with start and end index values calculated from the values in dims and sliceInfo.
function processSlices(dims, sliceInfo) { assert(dims.length === sliceInfo.length, "ArrayView: dims and sliceInfo parameters must be of the same length."); var ds = _us.zip(dims, sliceInfo); var processedSlices = _us.map(ds, function(val) { var dim = val[0]; var si = val[1].replace(/\s/g, ""); var si...
[ "function slice () {\n if (settings.vshrink || settings.hshrink) {\n var slices = {};\n if (settings.vshrink) {\n slices['rows'] = getRows();\n }\n if (settings.hshrink) {\n slices['cols'] = getCols();\n }\n return slices;\n }\n else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
opt_in_status computed: true, optional: false, required: false
get optInStatus() { return this.getStringAttribute('opt_in_status'); }
[ "_approveLoan(val){\n return true;\n }", "@action\n statusChangeAction(field, value) {\n if (value == 'approved') {\n this.editEntry.set('create_entry', 1);\n }\n }", "get pending() {\n return this.status === PENDING;\n }", "_getDefaultBooleanSelectBox(value) {\n const { valueReq...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change instrument of the current track
changeCurrentTrackInstrument(instrumentID) { this.changeTrackInstrument(this.index, instrumentID); }
[ "changeTrackInstrument(trackID, instrumentID) {\n let track = this.tracks[trackID];\n let new_instr = instrumentArray[instrumentID];\n track.instrument = new_instr;\n track.instrumentID = instrumentID;\n let trackName = this.generateTrackName(trackID, new_instr);\n this.tra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves grid panels container so that the current panel is visible in the Nav_Grid viewport.
function show_current_panel() { var new_left = this.config.panel_config.w * this.curr_position_coor.x, new_top = this.config.panel_config.h * this.curr_position_coor.y; if(new_left > 0) { new_left = new_left * -1; } if(new_top > 0) { new_top = new_top...
[ "function setPanelVisibility() {\n var isMobileScreen = app.sceneView.widthBreakpoint === \"xsmall\" || app.sceneView.widthBreakpoint === \"small\",\n isDockedVisible = app.sceneView.popup.visible && app.sceneView.popup.currentDockPosition,\n isDockedBottom = app.sceneView.popup.currentDock...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a custom parameter group for an RDS database family. For more information about RDS parameter groups, see Working with DB Parameter Groups in the Amazon Relational Database Service User Guide. Documentation:
function DBParameterGroup(props) { return __assign({ Type: 'AWS::RDS::DBParameterGroup' }, props); }
[ "function DBParameterGroup(props) {\n return __assign({ Type: 'AWS::Neptune::DBParameterGroup' }, props);\n }", "function DBClusterParameterGroup(props) {\n return __assign({ Type: 'AWS::RDS::DBClusterParameterGroup' }, props);\n }", "function DBClusterParameterGroup(props) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) { if ( manipulation_rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } }
[ "get defaultChecked() {\n return this.hasAttribute('checked');\n }", "function actuallyCheckCheckbox(p_e)\n{\n\tvar target = (p_e.target) ? p_e.target : p_e.srcElement;\n\t\n\tif (typeof target.defaultChecked != 'undefined')\n\t{\n\t\ttarget.defaultChecked = target.checked;\n\t}\n}", "function defaultRa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
append comment to the correct place and add eventListener: pop when the progress is same as timepoint
function appendCommentToSong(song, comment, duration) { var domEl = document.createElement("div"); domEl.classList.add("comment-avatar"); domEl.setAttribute("data-id", comment.comment_id); domEl.setAttribute( "style", `left: ${Math.floor((comment.timepoint / duration) * parentWidth)}px` ...
[ "function updateSeekTooltip(event) {\n var skipTo = Math.round((event.offsetX / event.target.clientWidth) * parseInt(event.target.getAttribute('max'), 10));\n seek.setAttribute('data-seek', skipTo)\n var t = formatTime(skipTo);\n seekTooltip.textContent = formatTimeHumanize(t);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init of all things needed in popup
function init() { console.group('popup init') console.info('document ready') initTabs() initExternalLinks() console.info('getting background page') chrome.runtime.getBackgroundPage((backgroundPage) => { gotBgPage(backgroundPage) }) console.groupEnd('popup init'); sec_cont...
[ "function init () {\n $(\"#popup-container\").on(\"click\", \".popup-overlay\", function() {\n $.hidePopup();\n return false;\n });\n\n // close popup on pressing esc key\n $(document).bind('keydown', function(e) {\n if (e.which == 27) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Based on the probabilities array sent from the server, calculator the total crash probability according to formula: d1p1 + d2p2 ... / sum of distances
function calculateCrashProbability(probabilities) { var numerator = 0; var denominator = 0; for(var i = 0; i < probabilities.length; i++) { var roadName = probabilities[i].roadName; var distance = roads[roadName].distance; var probability = probabilities[i].result; numerator = numerator + distance * probabi...
[ "function onCalcPressed() {\n\tconsole.log(\"Calculate button pressed\");\n\n\tvar roadNames = Object.keys(roads);\n\tvar roadArr = [];\n\n\n\t//map.clear();\n\tfor(var i = 0; i < previousPolylines.length; i++) {\n\t\tconsole.log(\"Calling setMap(null) on polyline\");\n\t\tconsole.log(previousPolylines[i]);\n\t\tpr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The following will loop through the `keys` of MYLIBRARY. It will assign a random value between 0 & 2 and return a entree, dessert, & drink object containing 2 keyvalue pairs `name` & `price`.
randomOrder() { let keys = Object.keys(MYLIBRARY); //keys[] = all 3 keys of MYLIBRARY. for (let i = 0; i < keys.length; i++) { //iterate through keys[]. let key =keys[i]; //key = current index of keys[]. let value...
[ "function InitHashKeys() {\n var index = 0;\n for (index = 0; index < 14 * 120; ++index) {\n PieceKeys[index] = RAND_32();\n }\n\n SideKey = RAND_32();\n\n for(index = 0; index < 16; ++index) {\n CastleKeys[index] = RAND_32();\n }\n}", "function get_item_prices(rarity_counts, price...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sends a challenge for a given user
function sendChallenge(userToChallenge) { //get data var username = window.user; var challengeuser = userToChallenge; var dataToSend = {service:'game',method:'sendChallenge',data:{user:username,challengeuser:challengeuser}}; $.ajax({ type: "POST", url: SERVERADR, data: JSON.stringify(dataToSend)...
[ "function acceptChallenge()\n{\n //get data\n var username = window.user;\n\n var dataToSend = {service:'game',method:'acceptChallenge',data:{user:username}};\n $.ajax({\n type: \"POST\",\n url: SERVERADR,\n data: JSON.stringify(dataToSend),\n dataType: 'json',\n contentType: 'application/json',\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Storing initials in local storage
function storeInitials() { localStorage.setItem("initials", JSON.stringify(initials)); }
[ "function initLocalStorage(){\n if (!localStorage.hasOwnProperty('closeLoginWarning')){\n localStorage['closeLoginWarning'] = false;\n }\n \n if (!localStorage.hasOwnProperty('list')){\n localStorage['list'] = JSON.stringify([DEFAULT_ITEM]);\n }\n \n if (!localStorage.hasOwnProper...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds Click Handler to Add a task
add_addtask_handler() { var btn = document.getElementById("add-btn"); btn.addEventListener("click", function (e) { var name = window.prompt("Task Name:"); if (name != null && name.length > 0) { TController.create_task(name, this.add_task); } }...
[ "function addTask(e) {\n // fetch the current value input in task box\n lkj('In addTask() Event');\n\n let task = {\n description: submitTaskBox.value,\n status: 0\n }\n lkj(task);\n\n currentTaskList.push(task);\n displaycurrentTaskList();\n\n updateLocalStorage();\n displayLocalStorage(); \n\n // ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
End getProviderId Begin getTier1Link
function getTier1Link(selectedClient, selectedProvider, isAdd, selectedTier1) { $.ajax({ url: '/get-Tier1Link', method: 'post', timeout: 20000, data: { _token: $('#token').val(), client_id: selectedClient, provider_i...
[ "getTechnologyProviderId(technologyProviderId) {\n return technologyProviderId !== null ? technologyProviderId : this.technologyProviderId;\n }", "getIdentityprovidersOnelogin() { \n\n\t\treturn this.apiClient.callApi(\n\t\t\t'/api/v2/identityproviders/onelogin', \n\t\t\t'GET', \n\t\t\t{ },\n\t\t\t{ }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Pull the items from a specific feed
function getFeedItems(feed) { $.ajax({ url: urlBase + 'articles/' + encodeURIComponent(feed.feed), dataType: "json", success: function (data) { ko.utils.arrayForEach(data, function(item) { vm.displayedItems.push( new Item(feed, item) ); var bool = containsId(vm.bookmarkedArray(), vm.di...
[ "function fetchFeedItems(url, from, count, callback) {\n\t\tfrom = from || 0;\n\t\tcount = count || 20;\n\t\t\n\t\tvar feed = new google.feeds.Feed(FEED_URL);\n\t\tfeed.setResultFormat(google.feeds.Feed.JSON_FORMAT);\n\t\tfeed.setNumEntries(from + count);\n\t\tfeed.includeHistoricalEntries();\n\t\tlog('From ' + fro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes the products global hashmap which is a map of to It requires an array of image paths as input. Each element of the array should be an image path with the image name of the following format: _$. Returns a hashmap, which can be assigned to the global variable 'products'
function initProductsVar(productsPrices) { var products = {}; for (var i = 0; i < productsPrices.length; i++) { var imagePath = productsPrices[i]; var productName = productNameFromImagePath(imagePath); // All quatities are initialized to 5: products[productName] = 5; } return products; }
[ "galleryItems() {\n return this.items.map((i) => <img key={i} src={i} alt=\"productimage+i\" id=\"responsive-gallery-image\"></img>)\n }", "function mapImageResources(rootDir, subDir, type, resourceName) {\n var pathMap = {};\n shell.ls(path.join(rootDir, subDir, type + '-*'))\n .forEach(function (dr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Visit a parse tree produced by PlSqlParsercreate_table.
visitCreate_table(ctx) { return this.visitChildren(ctx); }
[ "function parseTable() {\n var name = t.identifier(getUniqueName(\"table\"));\n var limit = t.limit(0);\n var elemIndices = [];\n var elemType = \"anyfunc\";\n\n if (token.type === _tokenizer.tokens.string || token.type === _tokenizer.tokens.identifier) {\n name = identifierFromToken...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exposes the internal express request object
exposeReq() { this.exposeRequest = true; return this; }
[ "function GenericRequest() {}", "internalRequest(request) {\n const transformer = this.getTransformer(request);\n return transformer.transform(currentSuite.get(this), new runtime_1.Runtime());\n }", "getRequestSerializer() {\n return ((req) => {\n let returnVal = null;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Searches for a gene with a given ID
function searchGene(e) { var exact_match = ""; // track if node found exactly var close_match = ""; // track if node found with partial match in name var matches = []; // track all possible matches s.graph.nodes().forEach(function(n) { // loop over all nodes if (n.id === _.$('...
[ "function searchForIdInArray(id,array){\n var returnValue;\n var position;\n\n (DEBUG || ALL ) && console.debug(\"Searching for id\",id,\"in\",array);\n for (position = 0; position < array.length; position++) {\n if (array[position].keyID === id) {\n returnValue...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates documents list for the given perfomance test case.
function generateDocuments(perfCase) { const documents = []; for (let i = 0; i < perfCase.numberOfDocuments; ++i) { documents.push(perfCase.documentGenerator(i)); } return documents; }
[ "function GetDocuments()\n{\n\t// specify criteria for document search\n\tvar Criteria =\n\t{\n\t\t// extensions should be fixed to image\n\t\tDocIds: [1001],\n\t\t//Extensions: new Array(\".jpg\", \".png\", \".gif\", \".bmp\"),\n\t\t//DocTypeIds: new Array(1, 2), // specify document type ids which you canget from ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function adds the installation product to cart
addToCart() { const requestConfig = {}; requestConfig.data = { quantity: this.installDetails.parentProductQuantity, product: { code: this.installDetails.code, }, additionalAttributes: { entry: [{ key: 'installedEntry', value: this.i...
[ "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n var product = document.getElementsById('items').value;\n // TODO: get the quantity\n var quantity = document.getElementById('quantity').value;\n // TODO: using those, add one item to the Cart\n cart.product = produc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return stacktrace as a string, e.g. debugAlert(stacktrace())
function stacktrace() { var stackstring = "stacktrace: "; var history = []; var func = arguments.callee.caller; while (func !== null) { var funcName = getFuncName(func); var funcArgs = getFuncArgs(func); var caller = func.caller; var infiniteLoopDetected = history.indexOf(funcName) !== -1; var historyTo...
[ "function show(exn) /* (exn : exception) -> string */ {\n return stack_trace(exn);\n}", "get stack() {\n \t\treturn extractStacktrace(this.errorForStack, 2);\n \t}", "toString() {\n return `${this.constructor.name}( ${this._stack\n .map((rc) => rc.toString())\n .join(', ')} )`;\n }", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
on message from background
onBackgroundMessage(e) { if(e && e.params && e.params.name) { window.dispatchEvent(new CustomEvent(e.params.name, {detail: e.params.params})); } }
[ "function onGCSMessage(msg) {\n d(\"onGCSMessage(): msg=\" + msg);\n}", "function onMessageReceived(e) {\n var data = JSON.parse(e.data);\n\n switch (data.event) {\n case 'ready':\n onReady();\n break;\n\n case 'playProgress':\n onPlayProgress(data.data);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to delete a role
function deleteRole() { db.query(`SELECT * FROM role`, (err, data) => { if (err) throw err; const roles = data.map(({ id, title }) => ({ name: title, value: id })); //inquirer prompt that presents a list of roles to choose from inquirer.prompt([{ type: 'list', ...
[ "deleteRole (roleId) {\n assert.equal(typeof roleId, 'string', 'roleId must be string')\n return this._apiRequest(`/role/${roleId}`, 'DELETE')\n }", "deleteOne(req, res) {\n if (process.env.NODE_ENV === 'production') {\n res.status(403).send({ message: 'That action is not allowed!' });\n } else ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by KotlinParsertypeConstraints.
exitTypeConstraints(ctx) { }
[ "exitTypeParameterModifier(ctx) {\n\t}", "exitParenthesizedType(ctx) {\n\t}", "exitAnnotationTypeMemberDeclaration(ctx) {\n\t}", "exitTypeParameters(ctx) {\n\t}", "exitNullableType(ctx) {\n\t}", "exitUnannTypeVariable(ctx) {\n\t}", "exitTypeProjection(ctx) {\n\t}", "exitSingleTypeImportDeclaration(ctx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
6 Switcher function for the channels name in the right app bar
function switchChannel(channelName) { //Log the channel switch console.log("Tuning in to channel", channelName); //Write the new channel to the right app bar document.getElementById('channel-name').innerHTML = channelName.name; //#6 change the #channel #location document.getEleme...
[ "function name_updater(){\n console.log(\"I entered her hihihi\");\n if(oldview_number != view_number){ //Condition used to prevente Discord API rate limit\n var final_name = channel_name[0].concat('-',channel_name[1],'-', view_number.toString());\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set "done" property of active timer and go to next.
function toggle_done() { if (active_timer_idx >= 0 && active_timer_idx != selected_timer_idx) { return; // Special case of discussion toggled on. Don't set to done in this case. } var next_timer_idx = -1; if (active_timer_idx < 0) { timer_object = timers[selected_timer_idx]; } else { timer_object...
[ "function next () {\n var a = actions.shift()\n if ( a ) {\n a( function ( err ) {\n if ( err ) throw err\n // setTimeout( next, ACTION_INTERVAL )\n } )\n } else {\n setTimeout( finish, ACTION_INTERVAL )\n }\n }", "continue(){\n\t\tthis.timeout = setTi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ThemeProvider component Provides a theme object to all it's child components via `styledcomponents`' ThemeProvider
function ThemeProvider(props) { const { children, theme: newTheme, themeContextOptions } = props; const validChildren = React.Children.toArray(children).filter(React.isValidElement); if (!validChildren.length) { return null; } // Hint: Do not remove the fragment (<>...</>) below. It is absol...
[ "function DarkThemeProvider(props) {\n return (\n <ThemeProvider theme={props.theme || dark}>\n <div>{props.children}</div>\n </ThemeProvider>\n );\n}", "injectTheme(themeId){\n //helper function to clone a style\n function cloneStyle(style) {\n var s = document.createElement('style');\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Does all the preliminary work before moving mm's orders up a notch
function moveUp() { // Buying other traders' limit asks if (trade.orderBook[1][0].price <= asks[0] - mmConf.SPREAD) { let indexToOrderSpread = round(index - trade.orderBook[1][0].price); if (indexToOrderSpread > mmConf.TAKERFEE * index) { let amountToBuy = round(Math.pow(indexToOr...
[ "function beforeMove(){\n sumInFront = 0;\n numInFront = 0;\n }", "function move1(addition){\n //below condition so that it doesnt move when it reaches the end\n if((multiplier[2]==0&&addition==1)||(multiplier[divs.length-1]==0&&addition==-1))\n return;\n if(currentD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the URL anchors (section and slide)
function getAnchorsURL(){ var section; var slide; var hash = window.location.hash; if(hash.length){ //getting the anchor link in the URL and deleting the `#` var anchorsParts = hash.replace('#', '').split('/'); /...
[ "get anchors() {\n\t\tconst slot = this.shadowRoot.querySelector('slot[name=\"anchor\"]');\n\t\treturn slot.assignedElements();\n\t}", "function getSceneLinks() {\n var returnData = [];\n\n $('h3.card-info__title a').each(function () {\n var theLink = window.location.origin + $(this).attr('href');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the Mythic Keystone profile index for a character.
getCharacterMythicKeystoneProfile(realmSlug, characterName) { return __awaiter(this, void 0, void 0, function* () { return yield this._handleApiCall(`${this.gameBaseUrlPath}/${realmSlug}/${characterName}/mythic-keystone-profile`, 'Error fetching character mythic keystone profile.'); }); ...
[ "function get_current_character(){\n\tvar char = getCookie('dawn_inv_char');\n\tvar hasPerm = $('.top-line #'+char+'.character').length>0;\n\tif(!hasPerm){\n\t\tchar = $('.top-line .character').first().attr('id');\n\t\tset_current_character(char);\n\t}\n\treturn char;\n}", "function firstOcc(string, character) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to clear timeout in displayHint
function clearTimeOutHint() { clearTimeout(tHint); }
[ "function clearMonitorTimeout() {\n serlog('Clear disp. off');\n consolelog('Clear display off');\n if (monitorTimeoutId != null) {\n clearTimeout(monitorTimeoutId);\n\tmonitorTimeoutId = null;\n }\n}", "function displayHint() {\n tHint = setTimeout(function () {\n $(\"#hint-c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UIRouterConfig.$inject = [ '$provide' ];
function UIRouterConfig ($provide) { // http://stackoverflow.com/a/23198743 $provide.decorator('$state', function($delegate, $stateParams) { $delegate.forceReload = function() { return $delegate.go($delegate.current, $stateParams, { reload: true, inherit: false, notif...
[ "function UIRouterHelperProvider($locationProvider, $stateProvider, $urlRouterProvider) {\n var docTitlePrefix,\n resolveAlways = {};\n\n $locationProvider.html5Mode(true);\n\n /**\n * Sets the document title prefix for all routes.\n * @param {string=} prefix\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function makes an asynchronous call to the getStudents function in the database and pulls all the students information. Then it builds a an array of students and grades objects, and an array of students and submission statuses objects which are then set in state to feed the data property of the table. OnClick meth...
componentDidMount(){ const rootRef = firebase.database().ref().child('react') const studentRef = rootRef.child('students') console.log(studentRef) //holds key value pairs of student and grades const studentArray = [] // initializing arrays to hold grades and statuses obje...
[ "function displayGrades(grades) {\n //console.log(grades);\n const items = grades.map(grade => {\n return `<a href=\"#\" class=\"list-group-item list-group-item-action\" onclick=\"updateStudentsGradesView(${grade.grade_id})\">${grade.grade}</a>`;\n });\n\n // Add an All grades link at the start\n items.unsh...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The input textarea state/contents. This is used to implement undo/redo by the undo manager.
function TextareaState(input) { // Aliases var stateObj = this; var inputArea = input; this.init = function() { this.setInputAreaSelectionStartEnd(); this.text = inputArea.getContent(); }; // Sets the selected text in the input box after we've performed an // operation. this.setInputAreaSelectio...
[ "function AtD_restore_text_area()\n{\n\t/* clear the error HTML out of the preview div */\n\tAtD.remove('content');\n\n\t/* swap the preview div for the textarea, notice how I have to restore the appropriate class/id/style attributes */\n var content = jQuery('#content').html();\n\n\tif ( navigator.appName == 'M...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate the increment series
function checkIncrements() { var i, prev = Number.MAX_VALUE, msg = interpret("av_incrmsg"); // Convert user's increments to an array, // assuming values are space separated var incrs = $("#increments").val().match(/[0-9]+/g) || []; for (i = 0; i < incrs.length; i++) { incrs[i] ...
[ "function validateCarYear () {\n let carYear = parseInt(carYearNum.value);\n let currentYear = new Date().getFullYear() + 1;\n \n if (currentYear < carYear) {\n formIsValid = false;\n carYearNum.setCustomValidity('Car year may not exceed ${currentYear}.')\n }\n else {\n car...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END Purpose: This function handles the ajax get request for unique vehicle types. The returned data is used to build the search form's select dropdown for vehicle types. Inputs: None. Output: Builds the search form's dropdown for vehicle types.
function getDistinctType() { $.ajax({ url: 'api/', method: 'GET', data: {distinctType: '1'}, success: function(data) { // Fill the 'type' dropdown with results. $.each(data, function(index, value) { $('#selectType').append("<option value=\""+va...
[ "function GetDropDownList() {\n var typeCodeList = [\"WMSYESNO\", \"WMSRelationShip\", \"INW_LINE_UQ\", \"PickMode\"];\n var dynamicFindAllInput = [];\n\n typeCodeList.map(function (value, key) {\n dynamicFindAllInput[key] = {\n \"FieldName\": \"Typ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns % of p1 in p2 regardless of sign
function getpercentage(p1, p2) { return Math.abs(100 * Number(p1) / Number(p2)) }
[ "function percentOf(num, num2){\n return (num/num2)*100\n}", "function getPercentOf(p, n) {\n\treturn p/100 * n\n}", "function comparePokemon(p1, p2) {\n\t/*console.log(pokeData[p1]);\n\tconsole.log(p2);\n\tp1 = pokeData[p1].colors;\n\tp2 = pokeData[p2].colors;*/\n\t\n\t//get the total pixels in the pokemon ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API to get a specific survey and its questions given its IDs
async function getSurvey(id){ const url = `/api/survey=${id}`; try{ const res = await axios.get(url, {id: id}); const survey = await res.data; return survey; }catch(error){ alert("ERROR ON getSurvey() API"); } }
[ "async function getAdminSurveys(id){\n const url = `/api/admin=${id}`;\n try{\n const res = await axios.get(url, {id: id});\n const surveys = await res.data;\n return surveys;\n }catch(error){\n alert(\"ERROR ON getAdminSurveys() API\");\n }\n}", "function getQuestionByQues...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert a new user and give him 1500 coins for his signUp.
function signUp(username, password){ users.insert({username,password,Balance:1500}); }
[ "function signup(userData){\n console.log(\"creating new user \"+userData.id);\n return User.create(userData)\n }", "function insertData(e) {\n e.preventDefault();\n const fullName = document.getElementById('signup-name').value + \" \" + document.getElementById('signup-surname').value;\n const ema...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates navigation setting in jive based on the conditions choosen(activity +overview , activity or overview ) INPUT: salesforce account data, spae id OUTPUT : Updation of jive space
function updateNavigationSettingsOfSpace(res, accountData, spaceId, callback) { var activityTab = ''; var overviewTab = ''; var defaultTab = ''; if (accountData.navigation == 0) { activityTab = true; overviewTab = false; defaultTab = 'activityTab'; } else if (accountData...
[ "NavigateToProperPage() {\n console.log('this.accRecord.Application_Current_Stage__c '+ this.accRecord.Application_Current_Stage__c )\n if(this.accRecord.Application_Current_Stage__c == 'Not Started'){\n this.currentStep=\"1\"\n this.navigateToGeneralInfo()\n }\n // If Current Stage == Person...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ / Helper function for Undergraduate Adult Learners by Classification and Gender Chart
function undergradAdultDataChart() { var undergradData = getUndergradAdultData(galbyClassAndGen); var maleUGData = undergradData[0]; var femaleUGData = undergradData[1]; var undergradAdultChart = google.visualization.arrayToDataTable([ ['Year', 'Male', 'Female', { role: 'annotation' }], ['Fr...
[ "function gradEnrollmentChart() {\r\n\t\t\tvar gradData = getGradData(gabyClassAndGen);\r\n\t\t\tvar maleGradData = gradData[0];\r\n\t\t\tvar femaleGradData = gradData[1];\r\n\r\n\t\t\tvar chartData = google.visualization.arrayToDataTable([\r\n\t\t\t\t['Type', 'Male', 'Female', { role: 'annotation' }],\r\n\t\t\t\t[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a value implements the `Text` interface.
isText(value) { return isPlainObject(value) && typeof value.text === 'string'; }
[ "function ISTEXT(value) {\n return 'string' === typeof value;\n}", "isTextList(value) {\n return Array.isArray(value) && value.every(val => Text.isText(val));\n }", "isTextOperation(value) {\n return Operation.isOperation(value) && value.type.endsWith('_text');\n }", "isTextProps(props) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
log.addSrcFile("NowPlaying4Tmplt.js", "NowPlaying4Tmplt"); log.setLogLevel("NowPlaying4Tmplt", "debug"); NowPlaying4Tmplt constructor
function NowPlaying4Tmplt(uiaId, parentDiv, templateId, controlProperties) { this.divElt = null; this.NowPlaying4Ctrl = null; this.templateName = "NowPlaying4Tmplt"; this.onScreenClass = "TemplateWithStatus"; this.offScreenLeftClass = "TemplateWithStatus-OffscreenLeft "; this.offScreenR...
[ "function SoundTARLoader() {}", "constructor() { \n \n FlowLog.initialize(this);\n }", "function T1_init () {\n\n var codeBuffer = \"\";\n\n codeBuffer += '<!DOCTYPE html>';\n codeBuffer += '<html lang=\"en\">';\n codeBuffer += '<head>';\n codeBuffer += '<title>Generated Site...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set table head fixed
function fixHead() { var thead = $(settings.table).find("thead"); var tr = thead.find("tr"); var cells = thead.find("tr > *"); setBackground(cells); cells.css({ 'position': 'relative' }); }
[ "function fixFoot() {\n var tfoot = $(settings.table).find(\"tfoot\");\n var tr = tfoot.find(\"tr\");\n var cells = tfoot.find(\"tr > *\");\n\n setBackground(cells);\n cells.css({\n 'position': 'relative'\n });\n }", "function fourDTableFi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CONCATENATED MODULE: ./node_modules/reduxpersist/es/persistCombineReducers.js combineReducers + persistReducer with stateReconciler defaulted to autoMergeLevel2
function persistCombineReducers(config, reducers) { config.stateReconciler = config.stateReconciler === undefined ? autoMergeLevel2 : config.stateReconciler; return persistReducer(config, Object(redux["c" /* combineReducers */])(reducers)); }
[ "extraReducers(builder) {\n builder.addCase(fetchNotifications.fulfilled, (state, action) => {\n // push the return array of action.payload into the current state array first\n // state.push(...action.payload);\n // state.forEach(notification => {\n // // all r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Submit contact form submit button functionality
function contactSubmit() { $(this).submit(); }
[ "async function handleContactUsSubmit(e) {\n e.preventDefault();\n const res = await Axios.post(requests.contactUs, contactUsDataToPost);\n if (res.status === 200) {\n notifyDistSubmitionSuccess();\n\n setContactEmail(\"\");\n setName(\"\");\n setOrderNumber(\"\");\n setSubject(\"\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the current page number in the book. The pageDiv argument is optional typically defaults to whatever the flipper thinks is the "active" page.
function pageNumber(pageDiv) { var place = getPlace(pageDiv); return place ? (place.pageNumber() || 1) : 1; }
[ "function pageNumber(parentID, index, object) {\n //TODO Change checking for chapter to checking for isHeading\n if (specif.isChapter(object)) {\n let num = \"\";\n indexNumbers[object.id] = {index: index + 1, parent: parentID};\n while (indexNumber...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CONCATENATED MODULE: ./src/lab/models/energy2d/views/photons.js Energy2D photons view. It uses HTML5 Canvas for rendering. getHTMLElement() returns jQuery object with canvas used for rendering. Before use, this view should be bound with the parts array using bindPhotonsArray(photons). To render parts use renderPhotons(...
function PhotonsView(html_id) { var DEFAULT_ID = 'energy2d-photons-view', DEFAULT_CLASS = 'energy2d-photons-view', PHOTON_LENGTH = 10, $photons_canvas, canvas_ctx, canvas_width, canvas_height, photons, scale_x, scale_y, scene_width, scene_height, ...
[ "function render_editor()\n{\n\t// first get the piece to make show up\n\tvar piece = get_selected_piece();\n\n\t// get the pixel width and height to set the canvas\n\t// add space for the extra grid pixels\n\tvar canvas_width = tile_size * piece.width + grid_thickness;\n\tvar canvas_height = tile_size * piece.heig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The local method that executes routine, and inserts frames when needed. It dispatches a "frameinserted" event after having inserted any frame, and an "insertframe" event before.
function frameInserter() { self.dispatch('frameinserted'); while (isRunning && tasks.length && routine()) {} if (!isRunning || !tasks.length) { stopTasks(); } else { startTime = (new Date()).getTime(); framesCount++; delay = effectiveTime - frameTime; correctedFrameTime = ...
[ "frame () {\n\t\t// This is to call the parent class's delete method\n\t\tsuper.frame();\n\n\t\tif (this.state === 'swinging') this.swing();\n\t\telse if (this.state === 'pulling' && this.shouldStopPulling()) this.stopPulling();\n\t\telse if (this.state === 'pulling' && this.shouldRemoveLastChain()) this.removeLast...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Composes the tooltip for a specific message
function composeTooltip(message) { var html = ''; // Get the message description if (message.shortId) { html += '<div>' + message.shortId + '</div>' } var desc = LangServi...
[ "generateToolTip() {\n //Order the data array\n let data = formatArray.collectionToBottom(this.data, ['Database IDs', 'Comment']);\n\n if (!(data) || data.length === 0) {\n return generate.noDataWarning(this.name);\n }\n\n //Ensure name is not blank\n this.validateName();\n\n if (!(this.da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempts to connect with the Wallet
async connectWallet() { // Requesting connection to wallet var accounts = await window.ethereum.enable().catch(this.displayError); if (!accounts) return; console.log(`User's address is ${accounts[0]}`); this.web3.eth.defaultAccount = accounts[0]; this.setState({ connecte...
[ "async function connect() {\n state.setStartEthereum(false);\n if (typeof window.ethereum !== \"undefined\") {\n const accounts = await ethereum.request({ method: \"eth_requestAccounts\" });\n const provider = await detectEthereumProvider();\n\n console.log(accounts);\n\n const web3 = new ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the value of a specific plugin, if present. Note that / plugins that crash can be dropped from a view, so even when you / know you registered a given plugin, it is recommended to check / the return value of this method.
plugin(plugin) { for (let inst of this.plugins) if (inst.spec == plugin) return inst.value; return null; }
[ "plugin(plugin) {\n for (let inst of this.plugins)\n if (inst.spec == plugin)\n return inst.value;\n return null;\n }", "getPlugin(pluginId) {\n if (typeof pluginId === \"string\") {\n return this.plugins[pluginId];\n } else {\n const pluginCtor =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Populates global players array with player objects and generates player sections of html on the plage, number of player is taken from input on the page, plus and extra player for the dealer.
function createPlayers(){ var playerContainer = document.getElementById("player_container"); var numOfPlayer = document.getElementById("numberOfPlayers").value; for (var i = 1; i <= numOfPlayer; i++){ thePlayers.push({player_id: i, playerName : 'Player ' + i, handArr : [], isDealer : false, isBust : false, fi...
[ "function drawPlayers(searchedPlayers) {\n if (searchedPlayers != null) {\n\n var template = '';\n\n for (let i = 0; i < searchedPlayers.length; i++) {\n let player = searchedPlayers[i];\n\n template += `\n <div class=\"player-card\" id=\"${i}\">...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the runtime alignment of a collection's keys.
function getKeyAlign(info) { return 31 - Math.clz32((info >>> KEY_ALIGN_OFFSET) & 31); // -1 if none }
[ "getPropertyKeys() {\n let properties = this.getProperties();\n let propertyKeys = [];\n if (properties) {\n for (var key in properties) {\n if (Object.prototype.hasOwnProperty.call(properties, key)) {\n propertyKeys.push(key);\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this removes all children from an element
function remove_all_children(element,args) { // while (element.firstChild) { element.removeChild(element.firstChild); } }
[ "function removeChildren(node) {\n\t\tjQuery(node).empty();\n\t}", "removeAllChildren() {\n this.__childNodes = [];\n this.repeats = [];\n this.dispatchNodeEvent(new NodeEvent('repeated-fields-all-removed', this.repeats, false));\n }", "function clearChildren() {\n while(board.firstChild) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the income dynamically from the storage class
static dynamicIncomeUpdate() { let storedIncome = Storage.getIncome() let storedExpenses = Storage.getExpenses() const incomes = storedIncome const expenses = storedExpenses; updateUI.updateTransaction(incomes, expenses) }
[ "function updateIngredients(base) {\n ingredients.forEach(ingredient => ingredient.updateAmount(base));\n}", "deductBudget() {\n let price = parseInt(costClothing.value, 10);\n runningBudget -= price;\n updateBudget();\n }", "async price_update() {}", "function setAmount()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets new local testcases
getNewLocalTests() { return __awaiter(this, void 0, void 0, function* () { const re = /@tcid:(\d+)$/; const reScenario = /^\s*Scenario(?: Outline)?\s*:(.*?)$/; const testcases = []; walk.sync(this.config.featuresDir, (filePath) => { if (/\.feature$...
[ "async function getTestCases() {\n const directories = await fs.readdir(TEST_CASES_DIRECTORY);\n const testCases = [];\n \n for (let i = 0; i < directories.length; i++) {\n const filename = directories[i];\n\n if (filename.indexOf('.json') !== -1) continue;\n \n if (filename.in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle bill create by switching back to bill list
function onBillCreate() { alert("You try to create a bill"); window.location.href = "#billing-list"; }
[ "addItemOnPress() {\n var receipt = this.state.receipt;\n receipt.addNewItem(\n this.state.quantityFieldValue,\n this.state.nameFieldValue,\n this.state.pricePerUnitFieldValue\n )\n\n this.setState({\n receipt: receipt\n })\n\n receipt.save()\n }", "function handleNewTransac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes it simple to add another alphabet button to the control bar using the inbuilt drawing routines
function alpha_button(textin,xpos_in,ypos_in,widthin,actif,varif,active) { if (draw_button(xpos_in,ypos_in,widthin,alpha_button_height,Hcontext,control_button_style,alpha_button_corner,"src",active,HmouseX,HmouseY,Hmouse_clicking)) { if (actif) { button_next_action_2 = actif; ...
[ "function drawMapButton() \n{\n fill(0);\n rect(buttonX, buttonY, buttonWidth, buttonHeight);\n fill(255);\n text('Click here to change mappings', buttonX + 7, buttonY + 20);\n}", "function drawControl_more(header_ypos)\r\n{\r\n // now draw the feedback panel with an appropriate sized gap\r\n header_ypo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save reminders to BTT Trigger
async function BTTsaveDBLRemindersToTrigger() { // tell BTT where to put the stringified object let updateDefinition = { "BTTInlineAppleScript": JSON.stringify(reminders) } // update the trigger details with my JSON object embeded in the applescript element! callBTT('update_trigger', { ...
[ "async function BTTsaveDBLReminders() {\n let text = JSON.stringify(reminders);\n callBTT('set_persistent_string_variable', {\n variable_name: 'DBLReminders',\n to: text\n });\n\n}", "function postReminder() {\n cron.schedule('13***', () => {\n communityCallReminder();\n }, {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fillSpreadsheetId This is run after creating the toolbar. The spreasdsheet information from localStorage is inserted into the Spreadsheet script ID box.
function fillSpreadsheetId() { var value = ""; if (SPREADSHEETSCRIPTID) { value = SPREADSHEETSCRIPTID; } if (SPREADSHEETID) { value += "|" + SPREADSHEETID; } var selement = document.querySelector("#scriptid"); if (!selement) { return; } selement.value = value; showSpreadsheetIconState(); }
[ "function getSpreadsheetId(value) {\n\tvar matches = value.match(/([^\\/]+)\\/exec/);\n\tif (matches) {\n\t\tvalue = matches[1];\n\t}\n\tif (value.match(/^\\s*$/)) {\n\t\tvalue = \"\";\n\t}\n\tmatches = value.match(/^\\s*(.*)[|\\s]+(.*)\\s*$/);\n\tif (matches) {\n\t\tvalue = matches[2];\n\t}\n\tSPREADSHEETID = valu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provided two composite types, determine if they "overlap". Two composite types overlap when the Sets of possible concrete types for each intersect. This is often used to determine if a fragment of a given type could possibly be visited in a context of another type. This function is commutative.
function doTypesOverlap(typeA, typeB) { // So flow is aware this is constant var _typeB = typeB; // Equivalent types overlap if (typeA === _typeB) { return true; } if (typeA instanceof _typeDefinition.GraphQLInterfaceType || typeA instanceof _typeDefinition.GraphQLUnionType) { if (_typeB instanceo...
[ "typesAreEquivalent(t1, t2) {\n if (t1 === null || t2 === null) {\n return true;\n }\n if (t1.constructor === ListType && t2.constructor === ListType) {\n return this.typesAreEquivalent(t1.memberType, t2.memberType);\n } else if (t1.constructor === DictType && t2.constructor === DictType) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Implement the function isAccessibleByTransportMode that Accepts two parameters: 1) First parameter is an array of transport modes e.g: ["tube", "river boat"] 2) Second parameter is a string containing a transport mode e.g: "river boat" Returns True if the location in the first parameter is accessible by the transport m...
function isAccessibleByTransportMode() {}
[ "function isValidTransportationMode(options) {\n let status = true;\n try {\n let co2Factor = constants[options.transportation]\n if (co2Factor === undefined)\n status = false;\n } catch (error) {\n status = false;\n }\n return status;\n}", "function hasAccessibleAcl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of input booleans for the gate given the current simulation state.
function getInputs (gate, state) { return gate.inputs .map((pin) => (state.outputs[pin.connections[0]] ^ pin.isInverted) === 1) }
[ "getInputs (gate) {\n if (!inputSubjects.has(gate.id)) {\n const gatePinSubjects = (\n gate.inputs\n .map(pin => (\n pin.connections[0] ? getPin(pin.connections[0]) : of(false)\n )).map(observable => (\n observable.pipe(map(x => (x ^ pin.isInverte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to create glsl vector representation of a javascript array.
function _arrayToVec(array) { var len = array.length; return 'vec' + len + '(' + array.join(',') + ')'; }
[ "static FromArray(array, offset = 0) {\n return new Vector4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\n }", "getVector() {\n if (this.parent) {\n let dx = this.parent.loc.x - this.loc.x;\n let dy = this.parent.loc.y - this.loc.y;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the last option is filled, add another option.
function lastOption() { $('.last-option').on('input', function() { $('#options').append('<div class="form-group"><input name="option" type="text" class="form-control floating-label last-option" placeholder="Enter poll option"></div>') $(this).removeClass('last-option'); $(this).unbind(); lastOption(); }); }
[ "function pollsAddOption()\n{\n var newOption = $jq( '<input />').attr('type', 'text').attr('name', 'options[]');\n $jq('#tikiPollsOptions').append($jq('<div></div>').append(newOption));\n}", "function addToSelect(values) {\nvalues.sort();\nvalues.unshift('None'); // Add 'None' to the array and place it to the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calls recursively 'folderFunction( folder )' for parentFolder and all its subfolders; parentFolder must be supplied as nsIMsgFolder;
function iterateFoldersFunction( parentFolder, folderFunction ){ // log.thisLevel( log.level.debug ); // log.debug( 'parentFolder.prettyName ' + parentFolder.prettyName ) if( ! parentFolder.isServer ) { // apply fuction to folder and see if need to stop iteration if( folderFunction( parentFolder ) )...
[ "LoadFolder(folder) {\n return __awaiter(this, void 0, void 0, function* () {\n this.ClearMain(); //Clear all current folders and files\n this.ClearSideBar(); //Clear the sidebar\n const childFolders = yield this.Api.GetChildFolders(folder);\n const childFiles = yi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method: step triggers calculate and print if the stopwatch is running
step() { if (!this.running) return; this.calculate(); this.print(); }
[ "function runStopwatch() {\n console.log(\"runStopwatch start\");\n\n if( $(\"#dogwalk_start_as_millis\").val() ) {\n var now = new Date();\n var ms = now.getTime() - parseInt($(\"#dogwalk_start_as_millis\").val());\n //$(\"#elapsed-stopwatch\").text(time(ms));\n //$(\"#dogwalk_tim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Guarda el estado de NotificationService en filename
function saveNotificationService(notificationService, filename) { console.log(); notificationService.save(filename); }
[ "function getNotificationService(filename) {\n let notificationService = new notmod.NotificationService();\n if (fs.existsSync('./' + filename)) {\n console.log();\n notificationService = notmod.NotificationService.load(filename);\n }\n return notificationService;\n}", "storeNotifications() {\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to calculate a random speed between two values to provide a minimum speed, credits go to (
calcSpeed(min, max) { return Math.random() * (max - min) + min; }
[ "changeSpeed() {\r\n this.speed = Math.random() * 3 + 1.5;\r\n }", "generateDistTrav()\r\n {\r\n var distance = Math.floor((Math.random() * 2) + 1)\r\n console.log(distance + \"m\")\r\n }", "randomVelocity() {\n return random(50, 200, 10);\n }", "function calcul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add the node as a child of the block when: we are in a block, we are not inside a ICU message (those are handled separately), the node is a "direct child" of the block
_mayBeAddBlockChildren(node) { if (this._inI18nBlock && !this._inIcu && this._depth == this._blockStartDepth) { this._blockChildren.push(node); } }
[ "function addBlock(label) {\n // make sure label is unique identifier\n var newlabel = label;\n var counter = 1;\n var found;\n do {\n found = topBlock.forEachChild(function(child){\n if (child.getLabel() == newlabel) {\n newlabel = lab...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
History grades stacked bar chart
function show_history_grade_distribution(ndx) { var dim = ndx.dimension(dc.pluck("gender")); function gradeByGender(dimension, histgrade) { return dimension.group().reduce( function (p, v) { p.total++; if(v.histgrade == histgrade) { ...
[ "function drawGrade2Stacked() {\n var data = google.visualization.arrayToDataTable([\n [\"Grade\", \"Bike, walk, others\", \"School bus, family vehicle, carpool, or city bus\"],\n [\"Pre-school\", 15, 151],\n [\"Primary school\", 8, 80],\n [\"Middle school\", 20, 19],\n [\"Hi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
example responseText: passID, seller_name, price, class, game 2,"Nick Johnson", 45,U1,Alabama 3, "HsinMei Lin", 9999,U3,Michigan 4, "Morris Lin", 99.9,U4,Alabama "" if no result
function filterPassSuccess(responseText){ //console.log("responseText = ",responseText); /* EDIT HERE! */ var each_pass = responseText.split("\n"); var passes = []; for(var i = 0 ; i < each_pass.length ; ++i){ let pass = each_pass[i].split(","); var obj = {}; obj.i...
[ "function getSellerPassSuccess(responseText){\n /*\n EDIT HERE!\n */\n}", "function helperFreeText(results) {\n var $responses = $('#helperResponses');\n var content = '';\n for (var i = 0, l = results.length; i<l; i++) {\n var helperResponses = results[i].responses[3];\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }