query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Extract the `float` parts of all vector members, Making this a `Vector3` of `float`. precision.
function doubleToFloatVec(v) { return new three_1.Vector3(Math.fround(v.x), Math.fround(v.y), Math.fround(v.z)); }
[ "function makeFloatVec(v) {\n const majorX = Math.fround(v.x);\n const majorY = Math.fround(v.y);\n const majorZ = Math.fround(v.z);\n const minorVec = new three_1.Vector3(v.x - majorX, v.y - majorY, v.z - majorZ);\n v.x = Math.fround(majorX);\n v.y = Math.fround(majorY);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HEADER ABSOLUTE / FIXED when focus inputs
function headerfixed(){ // $(document).on('focusin','input, textarea', function(){ // $('.header').addClass('header-absolute'); // }) // .on('focusout','input, textarea', function(){ // $('.header').removeClass('header-absolute'); // }); $(':input').focus(function(){ $('.header').addClass('hea...
[ "function header() {\r\n\t\tvar headerHeight = jQuery(\"#header\").outerHeight();\r\n\t\tvar windowHeight = jQuery(window).height() - headerHeight;\r\n\t\tvar half = jQuery(window).height()/2 - 120;\r\n\t\t\r\n\t\t\r\n\t\tvar header = jQuery(\".slider-wrap\");\r\n\t\tvar text = jQuery(\".slider-wrap .stunningtext\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate percentage increase between two goals
function percentage(a, b){ var increase = b - a; var step2 = increase / a; return step2 * 100; }
[ "calcPercent(goal, saved) {\n return(Math.round((saved/goal)*100))\n }", "function finalPoints(team1,team2) {\n\n\t// goal scored by team 1 is 2 times \n\t// goal scored by team 2 is 3 times\n\tlet c = (team1*2) + (team2*3) //c is the total goal scored in the match\n\treturn c\n}", "function updateGoalAtt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the decoded viewState from parentItem
function resolveViewState(parentItem) { const viewStateStr = (0, Const_1.$faces)().getViewState(parentItem.getAsElem(0).value); // we now need to decode it and then merge it into the target buf // which hosts already our overrides (aka do not override what is already there( // after that we need to deal...
[ "function getParentData() {\n return this.getState('parentData') || {};\n }", "function getParentState(state, rootView) {\n var node;\n if ((node = state.node) && node.type === 2 /* View */) {\n // if it's an embedded view, the state needs to go up to the container, in case the\n // co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new shallow copy of an object while excluding certain keys
function copy(obj, exclude) { var newObj = {}; $.each(obj, function(key, value) { if ($.inArray(key, exclude) === -1) { // exclude array doesnt contain key so // we need to add it to our newObj newObj[key] = value; } }); return newObj; }
[ "function cloneExceptObj(obj, keys) { \n\t\tvar target = {}; \n\t\tfor (var i in obj) { \n\t\t\tif (keys.indexOf(i) >= 0) continue; \n\t\t\tif (!Object.prototype.hasOwnProperty.call(obj, i)) continue; \n\t\t\ttarget[i] = obj[i]; \n\t\t} \n\t\treturn target; \n\t}", "function copyWithoutKey(key, object) {\n\t// ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the closest date that doesn't meet the condition for unavailable date Returns undefined if no available date is found addFn: function to calculate the next date args: time value, amount increase: amount to pass to addFn testFn: function to test the unavailablity of the date args: time value; retun: true if unavail...
function findNextAvailableOne(date, addFn, increase, testFn, min, max) { if (!isInRange(date, min, max)) { return; } if (testFn(date)) { var newDate = addFn(date, increase); return findNextAvailableOne(newDate, addFn, increase, testFn, min, max); } return date; } // direction: ...
[ "function findNextAvailableOne(date, addFn, increase, testFn, min, max) {\n if (!(0,_lib_utils_js__WEBPACK_IMPORTED_MODULE_0__.isInRange)(date, min, max)) {\n return;\n }\n if (testFn(date)) {\n const newDate = addFn(date, increase);\n return findNextAvailableOne(newDate, addFn, increase, testFn, min, m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check for any errors exist
any() { return Object.keys(this.errors).length > 0 }
[ "function checkErrors() {\n\t\t\tvar i, errorFree = true;\n\n\t\t\tfor (i = 0; i < scope.config.input.length; i++) {\n\t\t\t\t// if we haven't found any errors, such to make sure we are still error free\n\t\t\t\tif (errorFree) {\n\t\t\t\t\terrorFree =\tcheckInputRequirements(scope.config.input[i]);\n\t\t\t\t}\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates an instance of payload command service.
function PayloadCommandService(basePayloadCommand) { this.basePayloadCommand = basePayloadCommand; }
[ "static async createNewService (config = {\n iriNode: \"https://node-iota.org:14267\",\n title: \"unkown\",\n description: \"unknown\",\n price: 0,\n author: \"unknown\",\n }) {\n //TODO:\n const privateKey = \"\";\n\n //Create new Service object\n c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the Logstash versions available
function getLogstashVersionsAvailable() { var logstash_versions = [] var res = execSync('docker image list --filter "reference=titan-project-logstash" --format "{{.Tag}}"') logstash_versions = res.toString('utf8').split('\n') logstash_versions = logstash_versions.filter(function( element )...
[ "function getVersions() {\n return versions;\n }", "collectVersions() {\n const versions = {\n schema: 1,\n container: {\n commit: null,\n tools: {\n java: null,\n },\n },\n client: {\n version: null,\n },\n jenkins: {\n core: nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if given application row should be displayed. The row is displayed when any of its checkboxes is selected or any of the lists is being overridden.
shouldShowAppRow(appRowRawValue) { const { subscribedOnCreation, subscribedOnUpgrade } = appRowRawValue; const { overrideOnCreationSubscriptions, overrideOnUpgradeSubscriptions } = this.form.value; return (subscribedOnCreation || subscribedOnUpgrade || overrideOnCreationS...
[ "isEmptyView() {\n return !this.form\n .getRawValue()\n .appRows.some(appRowRawValue => this.shouldShowAppRow(appRowRawValue));\n }", "function hasItems(map, row) {\n\tif (map[row] == null) {\n\t\treturn false;\n\t}\n\n\tif ($(map[row].children[0]).css(\"display\") != \"none\" \n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find a node containing `data`
find(data) { let current = this.head; while (current !== null) { if (current.data === data) { return current; } current = current.next; } }
[ "findNode(data) {\n let found = false;\n this.#crawl((node) => {\n if (node.data === data) {\n found = node;\n return;\n }\n });\n return found;\n }", "function find(data){\n\t\tvar current = head;\n\t\twhile(current != null){\n\t\t\tif(current.data === data){\n\t\t\t\treturn ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Defining a function that updates a NonAddable field in phonebook, use this function with: 1. Nick Name > fieldName = nickname 2. Job Title> fieldName = jobTitle> iOS only 3. Company> fieldName = organization 4. Birthday> fieldName = birthday> Date format (fieldValue) is "yyyyMMddTHH:mm:ss.SSS+0000" 5. Note> fieldName =...
function UpdateNonAddableField(fieldName, fieldValue) { Ti.API.info("UpdateNonAddableField: " + fieldName + ", " + fieldValue); // TODO: Replace this with return statement if(contact == null) alert("Contact must be initialized ya beheema !"); // Job title is supported only by iOS if(fieldName == "jobTitle" && ...
[ "function setBirthday(records, index, newBirthday){\n // Your code goes here:\n}", "_updateCommonFields(updateData, {\n firstName, lastName, picture, website, interests, careerGoals, retired,\n }) {\n if (firstName) {\n updateData.firstName = firstName;\n }\n if (lastName) {\n updateData.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply new server data for the specified tagged query.
function syncTreeApplyTaggedQueryOverwrite(syncTree, path, snap, tag) { var queryKey = syncTreeQueryKeyForTag_(syncTree, tag); if (queryKey != null) { var r = syncTreeParseQueryKey_(queryKey); var queryPath = r.path, queryId = r.queryId; var relativePath = newRelativePath(queryPath, path...
[ "function syncTreeApplyTaggedQueryOverwrite(syncTree, path, snap, tag) {\n var queryKey = syncTreeQueryKeyForTag_(syncTree, tag);\n if (queryKey != null) {\n var r = syncTreeParseQueryKey_(queryKey);\n var queryPath = r.path, queryId = r.queryId;\n var relativePath = newRelativePath(queryPath, path);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the expression possibly has binding identifiers.
function isBinding(expr) { var type = expr.type; return 'Identifier' === type || 'SpreadElement' === type || 'ArrayExpression' === type || 'ObjectExpression' === type; }
[ "function hasBindingInScope(identifierPath, limitScope) {\n const name = identifierPath.node.name;\n let scope = identifierPath.scope;\n while (scope) {\n if (scope.hasOwnBinding(name)) {\n return true;\n }\n // This check must come after the hasOwnBinding check because it is ok if\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Preserves the original function invocation when another function replaces it
function preserveInvocation(originalFn, currentFn, args) { if (originalFn && originalFn !== currentFn) { originalFn.apply(void 0, args); } }
[ "function preserveInvocation(originalFn, currentFn, args) {\n if (originalFn && originalFn !== currentFn) {\n originalFn.apply(void 0, args);\n }\n }", "function preserveInvocation(originalFn, currentFn, args) {\n if (originalFn && originalFn !== currentFn) {\n originalFn.apply(void 0, arg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop scan BLE Device
async stopScan() { if (!this.scanning) { logW('stop scanning, while no instance scanning for Crimson devices.'); return; } try { logI('stop scanning...'); await cmsnSDK.adapter.stopScan(); this.scanning = false; logI(`stopp...
[ "stopScan() {\n if (this.scanning) {\n // stop the scan\n this.bluetooth.scanOff();\n logger.info('BLE scanning stopped.');\n this.emit(\"stopped\")\n this.scanning = false;\n }\n }", "function stopScan() {\n new Promise(function (resolve,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
finds the remainder of big / small, found when big is no longer bigger than small
function intDivisionRemainder(small, big) { return small <= big ? intDivisionRemainder(small, big - small) : big; }
[ "function intDivisionRemainder(small, big) {\n function iter(small, big, multiplier) {\n return small * multiplier <= big\n ? iter(small, big, multiplier + 1)\n : big - small * (multiplier - 1);\n }\n return iter(small, big, 1);\n}", "function intDivisionQuotient(small, big) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize RPC to enable discovery and rpcHandler
function initializeRPC() { try { registry = new Registry (); rpcHandler = new RPCHandler (undefined, registry); // Handler for remote method calls. rpcHandler.setSessionId (PzhObject.getSessionId()); PzhObject.discovery = new Discovery (rpcHandler, [registry]); ...
[ "async initRpcServer() {\n var _a;\n this.config.useHttps = this.config.useHttps || false;\n // adapterPort was introduced in v1.0.1. If not set yet then try 2000\n const desiredAapterPort = parseInt(this.config.port) || parseInt(this.config.homematicPort) || 2000;\n const callbac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save self evaluation to the database.
function saveSelfEvaluation(){ wasSelfEvaluationEmpty=checkEmptyID("self-evaluation-input",true); lastSavedSelfEvaluationInput=$selfEvaluationText.text(); var id = ADLoginID; var data = $selfEvaluationInput.val(); var success = function(response){ closeSelfEvaluation(true); } var error = function(error){} addS...
[ "function saveManagerEvaluation(){\t\n\twasManagerEvaluationEmpty=checkEmptyID(\"manager-evaluation-input\",true);\n\tlastSavedManagerEvaluationInput=$managerEvaluationText.text();\n\taddManagerEvaluationAction(ADLoginID, selectedReporteeID, $managerEvaluationInput.val(), $evaluationScoreInput.val(), function(respo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
User Interface Functions Create the preferences window
function createPreferencesWindow() { //Define the preferences window prefWindow = new BrowserWindow({ width: 850, height: 600, minWidth: 735, minHeight: 500, title: 'Preferences', icon: path.join(__dirname, 'assets/icons/app_icon.png'), frame: false, trasparent: true, darkTheme: ...
[ "function handlePreferencesWindow() {\n mainWindow.show();\n}", "function openProperties() {\n var wid, win, wwidth = 175, wheight = 100;\n wid = \"preferences\";\n win = getApp().windows[wid];\n if (!win) {\n win = merger.ui.window(wid, {\n title: \"Preferen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get property descriptor in object and all its ancestors.
function getPropertyDescriptor(object, propertyName) { while (object) { const pd = Object.getOwnPropertyDescriptor(object, propertyName); if (pd) { return pd; } object = Object.getPrototypeOf(object); } return null; }
[ "function getPropertyDescriptor(object, propertyName) {\n while (object) {\n var pd = Object.getOwnPropertyDescriptor(object, propertyName);\n\n if (pd) {\n return pd;\n }\n\n object = Object.getPrototypeOf(object);\n }\n\n return null;\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert `showSearch` to unique config
function useSearchConfig(showSearch) { var mergedShowSearch = (0,vue__WEBPACK_IMPORTED_MODULE_2__.ref)(false); var mergedSearchConfig = (0,vue__WEBPACK_IMPORTED_MODULE_2__.ref)({}); (0,vue__WEBPACK_IMPORTED_MODULE_2__.watchEffect)(function () { if (!showSearch.value) { mergedShowSearch.value = false; ...
[ "function convertSearchToString() {\n return searchOpt[STATE.searchOption];\n}", "static generateSearchConfig(dataDefs, data, searchConfig = {}) {\n // We generate filter options based on data defs.\n const searchProps = dataDefs.filter(d => d.searchBy);\n\n const desc = searchConfig.description || 'Sea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions to move the background
function backgroundMove(){ imageMode(CORNER); bgImg.resize(7250,720); image(bgImg, bgLeft, 0); }
[ "moveBackground() {\r\n this.background.tilePositionX -= 0.1;\r\n this.clouds1.tilePositionX += 0.1;\r\n this.clouds2.tilePositionX += 0.3;\r\n this.clouds3.tilePositionX += 0.8;\r\n }", "function moveBackground() {\n\t for (var i = 0; i < backgrounds.length; i++) {\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
tag a component `Snap` with a semantic version. we follow SemVer specs as defined [here](
tag(version) {// const snap = this.snap(); // const tag = new Tag(version, snap); // this.tags.set(tag); }
[ "isHeadSnap() {\n const tagsHashes = this.versionArray.map(ref => ref.toString());\n return this.head && !tagsHashes.includes(this.head.toString());\n }", "function addSnapshotToVersion(version) {\n return version.concat('-SNAPSHOT');\n}", "function forceSemanticVersion(range) {\n\tvar re = /([0-9]+)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function: to delete a node of given index
function node_delete(_nodeindex){ var currentnode = nodes[_nodeindex]; var temp = delete_relatededges(currentnode, edges, edges_tangents); edges = temp.edges; edges_tangents = temp.edges_tangents; if(matchnodeindex(nodes,currentnode.id)>= 0 & matchnodeindex(nodes,currentnode.id)< nodes.length){ switch (cur...
[ "function deleteNode(dom, index) {\n var node = findNode(dom, index);\n node.siblings.splice(node.indexToParent, 1);\n}", "function deleteAt(index) {\n}", "deleteAt(index) {}", "deleteFromIndex(index){\n if(index > this.size || index < 0){\n console.log(\"Deletion Failed! index is out ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test regex array on given string
function testRegexAry(ary, string) { for(var key in ary) { var pattern = ary[key]; if(pattern.test(string)) { return true; } } return false; }
[ "function test_regex_array (regex_array, test_string) {\n // console.log('test_regex_array function');\n // console.log('testing string:', test_string, '\\nagainst regex array', regex_array);\n\n for (var ni = 0; ni < regex_array.length; ni++) {\n if (regex_array[ni].test(test_string)) {\n // c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
replace brackets with hidden span tags and store lang tags in state
function replaceLanguageLabels() { const languageLabels = $('ul[class="objects"]').find('label:contains(" [")'); if (languageLabels.length) { // if state is undefined, set the language labels in state if (typeof state.languageLabels === 'undefined') { state.languageLabels = languag...
[ "function langTag(x) {\n if (typeof x !== 'undefined') {\n x = '<span class=\"lang\">' + x + '</span>';\n } else {\n x = '';\n }\n return x;\n}", "function xl_SwitchLang(target_lang)\n{\n\tvar i=0; \n\tvar tokens = document.getElementsByTagName(\"SPAN\"); \n\t// Cycle through all spans\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Before the component mounts, an async request is sent to retrieve the evidence item (image) details. When it returns set state on the imgData property
componentDidMount() { axios.get(`${API_URL}collection-evidence/${this.id}`).then(res => { this.setState({ imgData: res.data.Item }); }); }
[ "async _loadImageInfo() {\n const img = this._getImg();\n await loadImageInfo(img, this._rpc.bind(this));\n if (!img.dataset.originalId) {\n this.originalId = null;\n this.originalSrc = null;\n return;\n }\n this.originalId = img.dataset.originalId...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Free to be used and/or modified for any legal purposeplease give credit to the author (Caleb Larsen) / Works for any two dates in the format yyyy[./,]mm Example: 20080919 16:48:26
function date_diff(x,y) { var x_year = x.substr(0,4); var x_month = x.substr(5,2); var y_year = y.substr(0,4); var y_month = y.substr(5,2); var year_diff = (+x_year - +y_year) * 12; var month_diff = +x_month - +y_month; return (year_diff + month_diff); }
[ "function ts_sort_str_date(a,b) {\n // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX\n aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);\n bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);\n\t\n\tdd = aa.substr(5,2);\n\tmm = aa.substr(8,3);\n\tyyyy = aa.su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a random animation duration between set min and max durations.
getAnimationDuration() { let min = Streak.durations.min, max = Streak.durations.max; return Number.parseFloat((min + (max - min) * Math.random()).toFixed(2)); }
[ "getRandomDuration () {\n return (Math.floor(Math.random() * (4000)) + 2000) * this.scale.screenWidth;\n }", "function getRandomInt(min, max) {\r var rand = Math.floor(Math.random() * (max - min + 1)) + min;\r return currentFormatToTime(rand, app.project.activeItem.frameRate, true);\r}", "function an...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open the Microsoft account login dialog, let the user login, grab the token and then store it for later use.
function Login(silent) { // Build required random numbers let state = Math.floor(Math.random() * 1000000); let nonce = Math.floor(Math.random()*1000000); // Build the request url let authURL = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'; authURL += `?client_id=${clientI...
[ "async function getAccessTokenMSAL() {\n // Attempt to acquire token silently if user is already signed in.\n if (homeAccountId !== null) {\n const result = await myMSALObj.acquireTokenSilent(loginRequest);\n if (result !== null && result.accessToken !== null) {\n return result.access...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
either encode or decode message depending on direction parameter passed
function shiftCode(msg, direction){ var abcLen = abc.length; var shiftedCode = ''; //str to be returned msg.split('').forEach(function(char, i){ var moveBy = abc.indexOf(key.substr(i, 1)); //a moves 0, z moves 25 var shiftedCharInd; //char ind after it's encoded OR decode...
[ "function encodeMessage(message) {\n \n}", "encodeMsg(msg, privKey){\n return msg + privKey;\n }", "observe_send_binary_message(message, decode = false, remove_kp = false, str_result_grouping = '') {\n let a = arguments,\n sig = get_a_sig(arguments);\n //console.log('observe_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets the plan cache
resetPlanCache() { this.store.years.forEach((year) => { year.plans = []; }); this._commit(); }
[ "resetCache() {\n this.cache = null;\n }", "resetCache() {\n if (this.cacheEnabled) {\n this.cached();\n }\n }", "function clear(){\n vm.plan.clear();\n\n }", "reset() {\n _.each(caches, function(cache, key) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function takes a create date and returns a message (string) displaying how old the tweet is.
function dateDiff(dateInput){ // Get the date difference as a nice looking message from moment.js. let strDateDiff = moment(dateInput).fromNow(); // The fromNow() function only displays in seconds or longer so this while() loop was added // for when a new tweet is entered and displayed in less than one second...
[ "function getTimeSincePostCreation(createdDate) {\n var time = new Date().getTime();\n var timeAgoInSeconds = ((time - createdDate) / 1000);\n var timeAgoInMinutes = (timeAgoInSeconds / 60);\n var timeAgoInHours = (timeAgoInMinutes / 60);\n var timeAgoInDays = (timeAgoInHours / 24);\n var timeDiff...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
looks through all acf fields and matches them to embedded acf fields this allows us to use the relationship field and get all the fields of the linked item
function linkAllAcfEmbed(acf = {}, embed = {}, embedPost = {}, nested = false) { const linked = {}; Object.keys(acf).forEach((key) => { try { if (nested) { linked[key] = acf[key]; } else { linked[key] = linkAcfEmbed(acf[key], key, embed, embedPost); } } catch (err) { ...
[ "function linkFields() {\n var fields = jQuery(\".tx_mask_tabcell3 .tx_mask_field\");\n jQuery.each(fields, function (i, item) {\n evalValues = new Array();\n jQuery(item).find('.tx_mask_fieldcontent_link').each(function (index, value) {\n\n if (jQuery(value).attr(\"type\") == \"checkbox\") {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IMPLEMENTATION Return the entire data repository for the entire site. Because the data structure is so small (and future growth is not expected to ever change that to a big enough degree), the entire block of data can be returned to the client in one data structure. It is then "caches" in a siteReposity variable for fa...
function getSiteRepository() { var deferred = $q.defer(); // Get the site and school data if (siteRepository !== null) { // If the site repo has already been generated, then return the stored value. //console.log('Resolving site repo from cache'); ...
[ "function getRepoData() {\n var repo = getRepoName();\n\n var repoUrl = scheme + \"//\" + hostname + \"/repos/\" + repo;\n $.getJSON(repoUrl, repoResults);\n}", "getSiteData() {\n return siteData\n }", "function getAllRepos(org) {\n\n // This array is used to store all the repositories f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns apt backup sheetname
function getBackupSheetName(name){ return name + "." + (new Date()).toString(); }
[ "function getSheetName_() {\n return SpreadsheetApp.getActiveSpreadsheet().getName();\n}", "function getTabName(){\n var sheetName = SpreadsheetApp.getActiveSheet().getSheetName();\n //Browser.msgBox(sheetName);\n return sheetName;\n}", "function getSheetName() {\n try {\n var name = SpreadsheetApp.getA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function returns all the projects where: user is owner are shared with this user
function getProjectsByUserId(req, res, next){ Project.find({ $or:[ {owner: req.user._id }, {users: req.user._id } ]}).populate('owner') .populate('users') .populate('tasks') .populate('tasktypes') .populate('taskgroups') .exec( function(err, relatedProjects) { console.log(relatedProjects...
[ "function getUserProjects() {\n $scope.projects = [];\n $scope.totalProject = 0;\n _.each($scope.currentUser.projects, function(project) {\n if (project.owner == $scope.currentUser._id && project.status !== \"archive\") {\n $scope.totalProject += 1;\n $s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When the trashcan icon is clicked in user's ownStories list, grabs evt.target's storyId. Updates the API to delete the story. Remove story from user's ownStories list
async function deleteStory(evt) { console.debug("deleteStory"); let $storyId = $(evt.target).closest('li').attr('id'); await currentUser.removeStory($storyId); currentUser.ownStories = currentUser.ownStories.filter(story => story.storyId !== $storyId); // put this in models storyList = await StoryList.getStor...
[ "async removeStory(user, storyId) {\n const userStoryInd = user.ownStories.findIndex((item) => item.storyId == storyId);\n if (userStoryInd === -1) return; // exit early if user does not own the story\n\n try {\n const response = await axios.delete(\n `${BASE_URL}/stories/${storyId}`,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add pair to game collection
addPair() { this.foundPairs.push(this.firstCard); --this.pairs; this.statistics.addFoundPair(); // check if there still are pairs to uncover if (this.pairs === 0) { this.gameOn(false); this.pauseButtonNode.setAttribute('disabled', ''); this.f...
[ "addGame (opponent, teamPoints, opponentPoints) {\n let game = {\n opponent: opponent,\n teamPoints: teamPoints,\n opponentPoints: opponentPoints\n };\n this._games.push(game);\n }", "addGame (opponentName, teamPoints, opponentPoints) {\n let game = {\n opponent: opponentN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build container 6 type
function container6type() { let title = document.querySelector('#type6title').value; let goal = document.querySelector('#type6goal').value; let link = document.querySelector('#type6link').value; let notes = document.querySelector('#type6notes').value; let li = document.querySelectorAll('#type6checkl...
[ "buildContainer() {\n this.container = document.createElement('div');\n this.container.classList.add('input-container');\n this.container.classList.add('checkbox-container');\n\n if (this.hidden) { this.container.style.display = 'none'; }\n if (this.disabled) { this.container.clas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
++ | COUNTRY | ++
function COUNTRY(incColor) { this.countryTiles = []; this.startX; this.startY; this.currentX; this.currentY; this.stepCount; this.tileCount; this.yoffset; this.xoffset; this.color = incColor; this.invalidTimeout = 0; }
[ "function favoriteCountry (greatCountry){\n greatCountry.unshift('Norway')\n return `My favorite country is ${greatCountry[0]}`\n}", "addCountryFlagAndName(rankCountries, countriesData) {\r\n return rankCountries.map(obj => {\r\n const { name, flag } = countriesData[obj[\"country\"]];\r\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch lyrics for a song. If lyricsAutoNext is enabled, all enabled providers will be searched until one returns a result. The callback receives a list of other providers to try and the search result.
function fetchLyrics(aSong, cb) { var index = 0; function tryNext() { var providers = localSettings.lyricsProviders; fetchLyricsFrom(aSong, providers[index], function(provider, result) { if ((result.error || result.noresults) && settings.lyricsAutoNext && providers[++index]) tryNext(); ...
[ "function fetchLyricsFrom(song, provider, cb) {\n lyricsProviders[provider].fetchLyrics(song, function(result) {\n cb(provider, result);\n });\n }", "function fetchLyrics(song, cb) {\n function cleanAndParse(data) {\n //remove images to avoid them to be loaded\n var parsed = $(data.replace(/<im...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the vampire object with that name, or null if no vampire exists with that name
vampireWithName(name) { if (this.name === name) { return this; } let vampire; for (let offspring of this.offspring) { vampire = offspring.vampireWithName(name); if (vampire != null) { return vampire; } } return null; }
[ "vampireWithName(name) {\n // Check name of current vampire\n if (this.name === name) {\n return this;\n }\n\n for (const offspring of this.offspring) {\n const result = offspring.vampireWithName(name);\n // Only return if name has been found;\n if (result) {\n return result;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the classname has changed
function checkClassName() { var url = window.location.href; experior.editor.checkClassName( url ); }
[ "function codeUiUpdatedClassName(){\n\t//console.log('Class name updated');\n}", "function checkIfSameClasses(vnode, oldVnode) {\n\tif (!oldVnode || !vnode.data.class || !oldVnode.data.class) {\n\t\treturn false;\n\t}\n\n\tconst classes = vnode.data.class;\n\tconst oldClasses = oldVnode.data.class;\n\n\tif (![...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Export serialized visual data.
exportSerializedVisualData() { let iv = this.i.ou(); return (iv); }
[ "exportSerializedVisualData() {\n let iv = this.i.dc();\n return (iv);\n }", "function exportData() {\n viz.showExportDataDialog();\n}", "exportSerializedVisualData() {\n let iv = this.i.d1();\n return (iv);\n }", "exportSerializedVisualData() {\n let iv = this.i.by()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start playback of any embedded content inside of the targeted slide.
function startEmbeddedContent(slide) { if (slide) { // HTML5 media elements toArray(slide.querySelectorAll('video, audio')).forEach(function (el) { if (el.hasAttribute('data-autoplay')) { el.play(); } }); // Yo...
[ "function startEmbeddedContent( slide ) {\n\n\t\t\tif( slide && !isSpeakerNotes() ) {\n\t\t\t\t// HTML5 media elements\n\t\t\t\ttoArray( slide.querySelectorAll( 'video, audio' ) ).forEach( function( el ) {\n\t\t\t\t\tif( el.hasAttribute( 'data-autoplay' ) ) {\n\t\t\t\t\t\tel.play();\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shows the captions div
function showCaption(){ var childInFocus = $('div#carousel').data('roundabout').childInFocus; var setCaption = $('.carousel_data .carousel_item .caption:eq('+childInFocus+')').html(); $('#captions').html(setCaption); var newHeight = $('#captions').height()+'px'; $('.caption_container').animate({'height':new...
[ "function showCaptions() {\n // If there's no caption toggle, bail\n if (!player.elements.buttons.captions) {\n return;\n }\n\n toggleClass(player.elements.container, config.classes.captions.enabled, true);\n\n // Try to load the value from stora...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Filtering transactions from the history that were in the same week as the selected transaction.
getTransactionsByCurrentWeek(transaction) { return this.transactionsHistory.filter( (oldTransaction) => transaction.week === oldTransaction.week, ); }
[ "_selectWeek(event) {\n this._weeks.forEach(week => {\n const dayInThisWeek = week.findIndex(item => {\n const date = _CalendarDate.default.fromTimestamp(parseInt(item.timestamp) * 1000);\n return date.getMonth() === this._calendarDate.getMonth() && date.getDate() === this._calendarDat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
retrieves user's info from the server for the modal page
function modal(name){ request = mkObj(); if (request) { request.onreadystatechange = function() { if (request.readyState == 4 && request.status == 200) { var info = JSON.parse(request.responseText); console.log(info); document.getElementById('profile_picture').setAttribute("s...
[ "function showUserDetails(userId){\n\tvar myInit = { \n\t\t\tmethod:'GET',\n\t\t\tcredentials: 'same-origin'\n\t};\n\t\n\tfetch('UserManagement?action=getUser&userId=' + userId, myInit) // fetch request to server\n\t\t.then(function(response){\n\t\t\tresponse.json().then(function(user){\n//\t\t\t\tconsole.log(data)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
In function "sqrt" there are something specific: It can with one parameter when we need square root for example"sqrt(4)" It can use with two parameters when we need fourth root
function sqrt(number,root){ root = root || 2; return pow(number,1/root); }
[ "function sqrt(x){\r\n return Math.sqrt(x);\r\n}", "function sqrt(value)\n{\n return Math.sqrt(value);\n}", "function fsqrt(x) {\n return Math.sqrt(x)\n }", "function doubleSquareRootOf(num) {\n var sqrrt = Math.sqrt(num);// your code here\n var double = sqrrt * 2;\n return double;\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
print all data in your file;
function printAll() { var phoneBookArreyFromFile = fs.readFileSync('myFile.txt', 'utf8'); if (phoneBookArreyFromFile) { readFile(); } else { console.log('you don\'t have data in you\'r file'); } }
[ "function printArticles() {\n\t\t\tfs.readFile('articles.json', 'utf8', function (err,contents) {\n\t\t\t\t\tconsole.log(\"starting print\");\n\t\t\t\t\tconsole.log(contents);\t\n\t\t\t});\n\t\t}", "function printFile() {\n\tcsvFileToJSON(function(data) {\n\t\tconsole.log(data);\n\t});\n}", "printFile(filePath)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns a specific contactEmailAddress using its emailAddressId
static get(emailAddressId) { return __awaiter(this, void 0, void 0, function* () { try { const contactEmailAddress = (yield db_1.db.read.columns('*').tables('ContactEmailAddresses').where('emailAddressId', '=', emailAddressId).get()).rows; return contactEmailAddress; ...
[ "static getByContactId(contactId) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const contactEmailAddress = (yield db_1.db.read.columns('*').tables('ContactEmailAddresses').where('contactId', '=', contactId).get()).rows;\n return contactEmailAddr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get place by name
function getPlaceByName (req, res) { const placeName = req.params.placeName let url = `https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=${placeName}&fields=name,place_id&inputtype=textquery&key=${apiKey}` request(url, (error, response, body) => { if (error) res.status('400').send(error)...
[ "getPlaceByName(placeName) {\n for (const place of this.story.places) {\n if (place.name == placeName) {\n return place\n }\n }\n console.log(`no place named ${placeName}`)\n // no place with that name, return null\n return null\n }", "function get_place_called(name) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when panel is clicked, handlePanelClick is called.
function handlePanelClick(event){ showPanel(event.currentTarget); }
[ "function handlePanelClick(event){\n showPanel(event.currentTarget);\n }", "function handlePanelClick(event) {\n showPanel(event.currentTarget);\n }", "function handlePanelClick(event){\n showPanel(event.currentTarget);\n }", "onClickPanel(event) {\n\t\tevent.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
deepglob(parts :string[]) string[] | null
function deepglob(dir, parts, partIndex, matches, filesVisited) { if (partIndex >= parts.length) { partIndex = parts.length - 1 } let part = parts[partIndex] let pattern = part if (partIndex === 0) { // first part if (part.charCodeAt(part.length - 1) != DIRSEP_BYTE) { // e.g. input="part**...
[ "function simple_glob(glob) {\n if (Array.isArray(glob)) {\n return [].concat.apply([], glob.map(simple_glob));\n }\n if (glob && glob.match(/[*?]/)) {\n var dir = path.dirname(glob);\n try {\n var entries = fs.readdirSync(dir);\n } catch (ex) {}\n if (entr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
appends li elements to ul, saves count of items displayed
_appendLis () { let i = this.currentCount; while ((i < this.maxCount + this.currentCount) && (i < this.data.length)) { let li = document.createElement('li'); li.dataset.index = i; let divWrap = this._addDiv(['wrap']); let divThumb = this._addDiv(['thumb']); let thumbnail = this._...
[ "function updateNumberOfElements() {\n $(\"#counter\").html($('#list li').length);\n}", "function addItems(x) {\n for (var i = 0; i < x; i++) {\n itemCount++;\n $list.prepend('<li class=\"topcoat-list__item\">Item ' + itemCount + '</li>');\n }\n }", "function update_item_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns all [[CpNode]]s on the MAT that this [[CpNode]] is part of starting from the current one and going anticlockwise around the shape.
function getAllOnLoop(cpNode) { const cpStart = cpNode; const cpNodes = [cpStart]; let cpNode_ = cpNode.next; while (cpNode_ !== cpStart) { cpNodes.push(cpNode_); cpNode_ = cpNode_.next; } return cpNodes; }
[ "function getCpNodesOnCircle(cpNode, exclThis = false) {\n // const startCp = this as CpNode;\n const startCpNode = cpNode;\n let cpNode_ = startCpNode;\n const cpNodes = [];\n do {\n if (exclThis) {\n exclThis = false;\n }\n else {\n cpNodes.push(cpNode_);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disables the request button if user makes a request
function makeRequest() { setCanUserMakeRequest(false) }
[ "function cancelRequest() {\n //TODO need to enable method to be able to cancel a request\n}", "async onDeny(request, id) {\n let requests = this.state.requests;\n let index = requests.indexOf(request);\n requests.splice(index, 1);\n this.setState({ requests });\n\n await membership.denyRequest(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function gets user_id from Spotify by using this.getUserID, then gets user's playlists owned by the user from Spotify by using GET to "
async getPlaylists() { const accessToken = this.accessToken || this.getAccessToken(); const headers = { Authorization: `Bearer ${accessToken}` }; const userID = await this.getUserID(); //GET method try { const response = await fetch( 'https://api.spotify.com/v1/me/playlists?limit=50', ...
[ "getListOfCurrentUserPlaylists() {\r\n this.getCredentials();\r\n\r\n return new Promise((resolve, reject) => {\r\n this.$http.get('https://api.spotify.com/v1/me/playlists' , {headers: {'Authorization': this.hashParams.token_type + \" \" + this.hashParams.access_token}}).then(f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
callable from user defined rules. alias: r.ajax
function ajaxHelper(userOpts, r) { var defaults = { method: "GET", timeout: 15 * 1000 }, exec = r._exec, promptContainer = exec.type === "GroupRuleExecution" ? exec.element.domElem : r.field, userSuccess = userOpts.success, userError = userOpts.erro...
[ "function ajaxHelper(userOpts, r) {\n\n var defaults = {\n method: \"GET\",\n timeout: 15 * 1000\n },\n exec = r._exec,\n promptContainer = exec.type === \"GroupRuleExecution\" ?\n exec.element.domElem :\n r.field,\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a function wrapping the body of a jest `describe` block to execute in a synchronousonly zone.
function wrapDescribeInZone(describeBody) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return syncZone.run(describeBody, this, args); }; }
[ "function wrapBenchmark(desc) {\n const fn = desc.fn;\n return async function outerWrapped() {\n let token = null;\n const originalConsole = globalThis.console;\n currentBenchId = desc.id;\n\n try {\n globalThis.console = new Console((s) => {\n ops.op_dispatch_bench_event({ output: s });\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the list of IP addresses for this server
getIpAddresses() { const nets = networkInterfaces(); const results = {}; for (const name of Object.keys(nets)) { for (const net of nets[name]) { // Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses if (net.family === 'IPv4' && !net.internal) ...
[ "get ipAddresses() {\n return this.getListAttribute('ip_addresses');\n }", "get ips() {\n return this.#proxy\n ? (this.#serverRequest.headers.get(\"x-forwarded-for\") ??\n this.#serverRequest.conn.remoteAddr.hostname).split(/\\s*,\\s*/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Goes through every position of the board array and send each result up to view. drawDisc does this with the x, y and player values. x and y tells the position, and the player value which is either 0, 1, or 2.
function copyBoardArrayToDrawBoard() { var player; for (x = 0; x < size; x++) { for (y = 0; y < size; y++) { player = getboardArrayValue(x, y); drawDisc(x, y, player); } } //get scores from model and send it to display for the players displayScore(getScore(p...
[ "placeDiscAt(row, col) {\n let opponentDisc = this.prepareNextTurn()\n\n // Place the current player's disc at row,col.\n this.board[row][col] = this.disc;\n\n // If move is valid, run through board game process.\n if (this.isValidMove(row, col, this.disc)) {\n // Check...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Number of weeks request for initialisation
function numberOfWeeks(req, res) { // Retrieve unit name const unit = req.query.unit; // Retrieves the numberOfWeeks value to initialise a new unit db.query('SELECT * FROM ' + unit + 'Initialise', (err,result) => { let numberOfWeeks = result[0].numberOfWeeks; // Sends back numberOfWeeks res.send(nu...
[ "function numOfSecInAWeek() {\n return 7 * 24 * 60 * 60;\n}", "function getwk1() {\n\tvar curr = new Date;\n\ttoday = moment(curr).format('MM-DD-YYYY');\n\tvar wkno = moment(today).week();\n\tif (wkno % 2 == 0){\n\t\tweekno = wkno;\n\t}\n\telse{\n\t\tweekno = wkno + 1;\n\t}\n\treturn weekno;\n}", "allocate_wee...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs the function expandChar on all characters stored in the tree
function expandTree(tree) { traverseTree(tree, function(tree, char, i) { tree[i] = expandChar(char); }); return tree; }
[ "expand(node) {}", "function ECMS_expand(name, tree) {\n\tECMS_control_node(ECMS_find_node_name(tree, name), 1);\n}", "setExpandedCharacters(expanded) {\n this.expanded = expanded;\n }", "function expand(node){\n\t\t\t// Check for branch nodes.\n\t\t\tfor(var j in node.entries){\n\n\t\t\t\t// Add en...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rewrite the nested structure cache.
rewriteCache() { this.cache = { levels: [], levelCount: 0, rows: [], nodeInfo: new WeakMap() }; rangeEach(0, this.data.length - 1, (i) => { this.cacheNode(this.data[i], 0, null); }); }
[ "function recache($node, pa) {\n const path = pa.concat($node.data(\"key\"));\n\n if (Tree.debug) {\n Serror.assert(pa);\n\t\t\t\tconst p = path.join(PATHSEP);\n Serror.assert(!Tree.path2$node[p], `Cannot remap '${p}'`);\n\t\t\t\tSerror.assert(!$node.data(\"path\"),\n\t\t\t\t\t\t\t\t `N...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Instantiates a GraphQL Client Uses Auth Header if token present in state
async gqlClient({ commit, state }, useAuth) { return new GraphQLClient( GQL_ENDPOINT, useAuth && state.token ? { headers: { authorization: `Bearer ${state.token}` } } : {} ); }
[ "async buildClient() {\n if (this.#gqlClient) {\n return;\n }\n\n if (!this.#gqlAccessToken) {\n await this.authenticate();\n }\n\n const gqlClient = new GraphQLClient(this.#gqlEndpoint);\n gqlClient.setHeader(\"Authorization\", \"Bearer \" + this.#gqlAccessToken);\n this.#gqlClient =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if namespace is traced.
function istraced (namespace) { if (process.traceDeprecation) { // --trace-deprecation support return true } var str = process.env.TRACE_DEPRECATION || '' // namespace traced return containsNamespace(str, namespace) }
[ "function istraced(namespace) {\n /* istanbul ignore next: tested in a child processs */\n if (process.traceDeprecation) {\n // --trace-deprecation support\n return true;\n }\n\n var str = process.env.TRACE_DEPRECATION || \"\";\n\n // namespace traced\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Jekyll prod Useful for testing prod version before deploys
function jekyllProd() { return gulp.src('.').pipe(run('bundle exec jekyll build')); }
[ "function jekyll_production() {\n return child_process.spawn(\"bundle\", [\"exec\", \"jekyll\", \"build\", \"--config\", \"_config-production.yml\"], { stdio: \"inherit\" });\n}", "function jekyllDev(){\n return cp.spawn(\"bundle\", [\"exec\", jekyll, \"build\", \"--config\", \"_config.yml,_config_dev.yml\"],...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if a panel with a given id is expanded.
isExpanded(panelId) { return this.activeIds.indexOf(panelId) > -1; }
[ "isExpanded(panelId) {\n return this.activeIds.indexOf(panelId) > -1;\n }", "expand(panelId) { this._changeOpenState(this._findPanelById(panelId), true); }", "expand(panelId) {\n this._changeOpenState(this._findPanelById(panelId), true);\n }", "_isExpanded() {\n return this.panel.expanded;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sorts events by cycle by assigning a "cycles" attribute uses the print markers in cycleEvents as "end points" compares startTime of event to startTime of a cycleEvent to determine what cycle it belongs to event.cycle is an integer.
function addCycleAttribute() { var currEventIndex = 0; //events index var currCycle = 0; // Loop through all cycles, comparing the start time of the cycle // to the start time of events to cateogorize events for (currCycle; currCycle<cycleEvents.length;currCycle++) { var currEvent = events[currEventInde...
[ "function sortCycles() {\n var count = 0;\n var ret = [];\n var i = 3;\n while (count < cycles.length) {\n for (var h = 0; h < cycles.length; h++) {\n if (cycles[h].length == i) {\n ret.push(cycles[h]);\n count++;\n }\n }\n i++;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to determine if a there is an active text selection on the document page. Used to filter out click events caused by the mouse up at end of selection Accepts an element as only argument to test to see if selection overlaps or is contained within the element
function textSelectionActive() { var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; var win = window; /* istanbul ignore if: JSDOM doesn't support getSelection */ if (win && win.getSelection && win.getSelection().toString() !== '' && Object(_utils_dom__WEBPACK_IMPORTED_MODUL...
[ "function textSelectionActive() {\n var el =\n arguments.length > 0 && arguments[0] !== undefined\n ? arguments[0]\n : document\n var win = window\n /* istanbul ignore if: JSDOM does...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
callback(results, status) makes sure the search returned results for a location. If so, it creates a new map marker for that location.
function callback(results, status) { if (status == google.maps.places.PlacesServiceStatus.OK) { createMapMarker(results[0]); } }
[ "function callback(results, status) {\n // if (status == google.maps.places.PlacesServiceStatus.OK) {\n // createMapMarker(results[0]);\n // }\n createMapMarker();\n }", "function callback(results, status) {\n if (status == google.maps.places.PlacesServiceStatus.OK) {\n createMapMarker(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process tooltip ajax content.
function onBeforeRender(args) { var _this = this; this.content = 'Loading...'; this.dataBind(); var ajax = new ej.base.Ajax('./src/tooltip/tooltipdata.json', 'GET', true); ajax.send().then(function (result) { result = JSON.parse(result); for (var i = 0; i < result.length; i++) { ...
[ "function tooltipContentCreator(activeUUID) {\n $.getJSON('http://api.universalbusinessmodel.com/ubms_modelcreationsuite_model_get_OjectDetail.php?callback=?', { //JSONP Request\n key: \"YDoS20lf7Vrnr22h8Ma6NGUV5DblnVhueTPXS7gPynRvQ6U8optzfnMDs3UD\",\n activeUUID: activeUUID\n }, function(res, s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will read the license file only if file found or if it is not a README. If it is readme, then will return the path to the README file, or N/A for other cases.
function readLicenseFile (file) { if (file && fs.existsSync(file)) { if (file.includes('README')) { return file; } if (!file.includes('README')) { return fs.readFileSync(file, 'utf8'); } } return 'N/A'; }
[ "function readLicenseFile (file) {\n if (file && fs.existsSync(file)) {\n if (file.includes('README')) {\n return file;\n }\n if (!file.includes('README')) {\n return fs.readFileSync(file, 'utf8');\n }\n }\n return 'No local license could be found for the dependency';\n}", "readLicenseTex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Serializes an object in a way that will provide a token unique to the type, class, and value of an object. Host objects, class instances etc, are not serializable, and are held in an array of references that will return the index as a unique identifier for the object. This array is passed from outside so that the calli...
function serializeInternal(obj, refs, stack) { var type = typeof obj, sign = '', className, value, ref; // Return up front on if (1 / obj === -Infinity) { sign = '-'; } // Return quickly for primitives to save cycles if (isPrimitive(obj, type) && !isRealNaN(obj)) { return type + si...
[ "function serializeInternal(obj, refs, stack) {\n var type = typeof obj, className, value, ref;\n\n // Return quickly for primitives to save cycles\n if (isPrimitive(obj, type) && !isRealNaN(obj)) {\n return type + obj;\n }\n\n className = classToString(obj);\n\n if (!isSerializable(obj, clas...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
reset the camera center. Can be useful when switching back and forth between trackball and fly controls
function recenterCamera() { var old_up = [ viewerParams.camera.up.x, viewerParams.camera.up.y, viewerParams.camera.up.z, ]; if (viewerParams.useTrackball) initControls(); // handle fly controls-- just want to look at the center else viewerParams.camera.lookAt(viewerParams.center); // maintain orientation as...
[ "function resetCamera() {\n xPos.value = camXDefaultPos;\n yPos.value = camYDefaultPos;\n}", "ResetCamera() {\n this.camera.setPosition(new BABYLON.Vector3(0, 0, 15));\n this.camera.target = new BABYLON.Vector3(0,0,0);\n this.camera.attachControl(this.canvas, true);\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return if found some combo involucres a repeated card(pair, two pairs, three of a kind, full house, poker)
function getRepeatedCardCombos(handCount) { let nPair = 0; let pair = []; let nThree = 0; let three; console.log(handCount); //check handcount for cards repeateds for (var key in handCount) { if (handCount.hasOwnProperty(key)) { var val = handCount[key]; if (v...
[ "function ratscrew_checkPair(cards) {\n // cannot have a pair in less than two cards\n if (cards.length < 2) {\n return false;\n }\n\n // get the top two cards and compare their value\n var topCard = cards_getNum(cards[cards.length - 1].value);\n var bottomCard = cards_getNum(cards[cards.le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new `ResultRating` component.
function ResultRating(element, options, bindings, result) { var _this = _super.call(this, element, ResultRating.ID, bindings) || this; _this.element = element; _this.options = options; _this.bindings = bindings; _this.result = result; _this.options = ComponentOptions_1.Co...
[ "function createRatingElement() {\n const ratingElement = document.createElement('p');\n\n ratingElement.innerHTML = `Rated ${rating} out of 5`;\n\n return ratingElement;\n}", "function Rating() {\n this.id = 0;\n \n // a rating, generally 0-5\n this.rating = 0;\n \n // the user creatin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throws if the provided value is not validated by the port `validate` property.
function validateValueForPort(port, value) { if (angular.isDefined(value) && ( (angular.isFunction(port.validate) && !port.validate(value)) || (value && angular.isString(port.validate) && port.validate != TYPE_ANY && typeof value != port.validate) )) { throw "$component: Invalid value for port '" + port...
[ "function isValidPort(port) {\n return !((typeof port !== ALLOWED_TYPE) || ((port % 1) !== 0) || (port < MIN_PORT));\n}", "function getAndValidatePortNumber() {\n const portNumberArgument = Number(getArgument('portNumber', defaultPort));\n if (!Number.isInteger(portNumberArgument)) {\n throw new E...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds movie to wishlist
function addMovieToWishlist(movie_id) { // Reset timer in case it's ticking timerInf = ""; showInfo('Adding...', false); $.post('/library/add_movie_wishlist/' + movie_id + '/', function(msg) { if(msg == 'err_login') { showInfo('You need to <a href="/login">log in</a> or <a href="/register">register</a> to add ...
[ "function addMovie(newMovie) {\n movies.push(newMovie);\n}", "function addMovie(){\n newMovie = $(\"#new-movie\").val();\n topics.push(newMovie);\n showButtons()\n }", "function addMovie(watchlist,name, imageurl,id){\n\n\tif(!findMovie(watchlist,name)){\n\t\tvar newmovie = {\"name\":nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set set a cached key and change the stats Parameters: `key` ( String | Number ): cache key `value` ( Any ): A element to cache. If the option `option.forceString` is `true` the module trys to translate it to a serialized JSON `[ ttl ]` ( Number | String ): ( optional ) The time to live in seconds. `[cb]` ( Function ): ...
set( key, value, ttl, cb ){ // force the data to string let err; if (this.options.forceString && !isString( value )) { value = JSON.stringify( value ); } // remap the arguments if `ttl` is not passed if (arguments.length === 3 && isFunction( ttl )) { cb = ttl; ttl = this.options.stdTTL; } // ...
[ "set( key, result, time ) {\n return cache.set(key, result, time);\n }", "function setSync(key, value, ttlValue) {\n\tvar args = Array.prototype.slice.call(arguments);\n\tif (args.length < 2) {\n\t\tthrow new Error('InputArgumentsError');\n\t}\n\tvar ttl = (args.length > 2 && typeof ttlValue === 'number...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UI function to insert an edge between vertices
function addEdgeUI() { var vertices = document.getElementById("edgeV").value.split(","); addEdge(vertices[0], vertices[1]); document.getElementById("edgeV").value = ""; showGraph(); }
[ "function insertEdge(label, weight, vertex1, vertex2, style)\r\n{\r\n var e1 = new Edge(label, weight, vertex2, style);\r\n var e2 = new Edge(null, weight, vertex1, null);\r\n \r\n vertex1.edges.push(e1);\r\n vertex2.reverseEdges.push(e2)\r\n \r\n return e1;\r\n}", "function createLine() {\r\n graphEdit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Factory method to create a test
static make(incomingOptions) { const test = new Test(); const options = coolKids_1.ensureObject(incomingOptions); test.breadCrumbs = options.suite.breadCrumbs.slice(); test.breadCrumbs.push(options.command); coolKids_1.whenNotString(options.command, `Test command must be of type ...
[ "function create(tests) {\n var instance = new TestRun();\n instance.init(tests);\n return instance;\n}", "function FrameworkUnitTest() {}", "function createTestRunner (sourceFile) {\n sourceFile = testFileName(sourceFile)\n\n return function testRunner (testFunction) {\n const testName = `${sourceFile}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
| | Filter out rules that either: | 1. Break storybook | 2. Are already controlled by storybook
function dropRulesHandledByStorybook (conf) { conf.module.rules = conf.module.rules // Our babel config is still used, but via dumping a .babelrc file .filter(({ loader = '' }) => !loader.includes('babel-loader')) // We don't want to include our extract css rules .map(rule => { if (rule.use) { ...
[ "function auditWithExcludedRule() {\n var extended_options = _.cloneDeep(options_default)\n extended_options.ignore = ['WCAG2AA.Principle1.Guideline1_1.1_1_1.H37'];\n try {\n pa11y(test_url, extended_options).then((results) => {\n console.log(\"Issues detected when excluding rule 1_1_1.H3...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct AMD version of the library
function constructAMD() { //create a library instance return init(); //spawns a library instance function init() { var library; library = factory('amd'); library.fork = init; return library; } }
[ "function constructAMD() {\n\n\t\t//create a library instance\n\t\treturn init(context);\n\n\t\t//spawns a library instance\n\t\tfunction init(context) {\n\t\t\tvar library;\n\t\t\tlibrary = factory(context, 'amd');\n\t\t\tlibrary.fork = init;\n\t\t\treturn library;\n\t\t}\n\t}", "function libraryVersion() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Run the calculations for a building
function run(bldg) { IO.buildings[bldg].out.innerHTML = prettyNumber(calculatePrice(bldg)); }
[ "function updateBuildings()\n{\n\tfor (var i = 0; i < buildings.length; i++)\n\t{\n\t\tbuildings[i].costTest();\n\t}\n}", "function computeBuildings() {\r\n var rowLen = player.numBuildingTypes;\r\n for (var i = 0; i < rowLen; i++) {\r\n // Generate lower tier buildings from higher tiers\r\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute a range from a list of samples samples: The samples to compute the range for returns: an array [[startDim0, endDim0], [startDim1, endDim1], ...] containing the range for each dimension of the samples
function computeRange(samples) { // slice() is a hack for cloning var lowerBound = samples[0].slice(); var upperBound = samples[0].slice(); $.each(samples, function (index, value) { lowerBound = binaryMap(Math.min, lowerBound, value); upperBound = binaryMap(Math.max, upperBound, value); }); ...
[ "function range() {\n var lngArgs = arguments.length,\n lngMore = lngArgs - 1;\n\n iMin = lngMore ? arguments[0] : 1;\n iMax = arguments[lngMore ? 1 : 0];\n dI = lngMore > 1 ? arguments[2] : 1;\n\n return lngArgs ? Array.apply(null, Array(\n Math.floor((iMax - iMin) / dI) + 1\n )).map(function (_, i) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Build the orbital period ISS status response. source: Peat, Chris (25 January 2015). "ISS Orbit". HeavensAbove. Retrieved 25 January 2015. source link:
function buildISSPeriodStatusResponse(satData) { var cardTitle = "ISS Status: Orbital Period"; var repromptText = " "; var shouldEndSession = true; var speechOutput = "ISS orbits the Earth every 92.69 minutes. That's approximately 15.55 orbits around the Earth per day."; return buildSpeechletResponse(cardTitle, s...
[ "function buildISSFullStatusResponse(satData) {\n\t//var imageRequestID = generateImageRequestID();\n\tvar cardTitle = \"ISS Status\";\n\tvar speechOutput = \"\";\n\tvar repromptText = \" \";\n\tvar shouldEndSession = true;\n\n\tspeechOutput += \"At a latitude of \" + Math.round(satData.latitudeDeg) + \" and longit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fadeOut and hide abilities div
function emptyAbilities() { $('#abilities').fadeOut(); $('#abilities').hide(); }
[ "function achieveHide() {\n $(\"#achivementContainer\").fadeOut();\n getId(\"achievementContainer\").style.display = \"none\";\n}", "function hidePlayerOverview (){\n\t$('#overviewStats').fadeOut();\n}", "function hideArea() {\n area().fadeOut(100);\n}", "function newLaw_fadeOut()\n\t\t\t{\n\t\t\t\t$...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Track multiple entities before updating them in the collection. Does NOT update the collection (the reducer's job).
trackUpdateMany(updates, collection, mergeStrategy) { if (mergeStrategy === MergeStrategy.IgnoreChanges || updates == null || updates.length === 0) { return collection; // nothing to track } let didMutate = false; const entityMap = collection.entities;...
[ "trackUpsertMany(entities, collection, mergeStrategy) {\n if (mergeStrategy === MergeStrategy.IgnoreChanges ||\n entities == null ||\n entities.length === 0) {\n return collection; // nothing to track\n }\n let didMutate = false;\n const entityMap = colle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the champion is a known Top champion Helps us in determining who should be TOP when it messes up
function checkChampIsTop(champion) { var tops = ['Malphite', 'Renekton', 'Fiora', 'Irelia', 'Darius', 'Gnar', 'Shen', 'Jax', 'Nasus', 'Illaoi', 'Garen', 'Vladimir', 'Dr. Mundo', 'Trundle', 'Tryndamere', 'Rengar', 'Olaf', 'Wukong', 'Tahm Kench', 'Teemo', 'Pantheon', 'Hecarim...
[ "isTopHit() {\n let retVal = false;\n this.arrSlabs.forEach((ele) => {\n if (ele.xPosition === 0) {\n retVal = true;\n }\n });\n return retVal;\n }", "function isAtTheTop(){\r\n return getScrollTop()<=0 && revealed && !isMoving;\r\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find all elements from collection by criteria
findAllBy(collectionName, criteria, sort = [], stopOnFirst = false) { this.validateCollection(collectionName); if (typeof criteria === 'undefined') { return this.tempStorage[collectionName]; } if (typeof criteria === 'object') { const result = []; co...
[ "find(criteria) {\n if (Object.keys(criteria).length === 0) {\n return this.collection.data;\n }\n const ret = []; // eslint-disable-line\n this.collection.data.forEach((element) => {\n const criteriaKeys = Object.keys(criteria);\n const elementKeys = Obj...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove all engines from the scheduler.
clear() { if (this.__timeout) { clearTimeout(this.__timeout); this.__timeout = null; } this.__schedEngines.length = 0; this.__schedTimes.length = 0; }
[ "remove(engine) {\n if (engine.master !== this) {\n throw new Error(\"object has not been added to this scheduler\");\n }\n\n engine.master = null;\n\n // remove from array and queue\n this.__engines.delete(engine);\n const nextTime = this.__queue.remove(engine);\n\n // reschedule queue\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Verify the cryptographic integrity of all transaction inputs
async function verifyCryptoIntegrity(inputs, wallets) { for (let input of inputs) { let {hashee, encodings} = deriveHashingParams(input) let hash = createHash(hashee, input.hash.alg, encodings) if (input.hash.val !== hash) { let error = new Error('transaction-input-hash-mismatch') error.detail...
[ "async function verifyCryptoIntegrity(inputs, wallets) {\n for (let input of inputs) {\n let hash = createHash(deriveHashingParams(input))\n if (input.hash.value !== hash) {\n let error = new Error('transaction-input-hash-mismatch')\n error.details = {hash: {provided: input.hash.value, expected: ha...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
routes ====================================================================== connecting to MYSQL database
function connectMysql() { var self = this; var pool = mysql.createPool({ connectionLimit : 100, host : '127.0.0.1', user : 'root', password : '', database : 'load_pincode_data', debug : false }); pool.getConnection(function(err,connect...
[ "function onDatabaseConnection() {\n //set the connection object to be used in api files\n app.set('db', db);\n\n //mount the api router\n app.use( '/api', Api(app) );\n\n //TODO: mount an auth router\n // app.use( '/auth', Auth() );\n\n //start the server\n app.listen( process.env.PORT || 8...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the NgFacebook class to be retrieved on Facebook Service request.
function NgFacebook() { this.appId = settings.appId; }
[ "function NgFacebook() {\n this.appId = settings.appId;\n }", "function FacebookGraph() {}", "initFacebook(){\n this.fb.init(this.config.getLangCode());\n }", "urlFacebook() {\n return facebookLoginUrl;\n }", "function Facebook(accessToken) {\n\tthis.fb = Meteor.require...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[respawn Inits randomly a new position]
respawn() { this.initRandomPosition() }
[ "respawn(){\n this.x = this.orgX;\n this.y = this.orgY;\n let ang = random(-PI / 4, PI / 4) + (random(1) > 0.5 ? 0 : PI);\n this.xspeed = cos(ang) * this.speed;\n this.yspeed = sin(ang) * this.speed;\n }", "function respawn(){\n\t\tplayerHealth = 100;\t//Redonne 100PV\n\t\tpl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load data samples for topics in given model
function loadData(dataset, numTopics, dataSource) { clearCanvas(); if (dataset) { setSelectedDataset(dataset + "/" + numTopics); } if (dataSource) { setDataSource(dataSource); } message("loading data ..."); try { var socket = getWebsocket(); socket.onopen = function() { sendRequest(socket, ...
[ "function loadTopics(dataset, numTopics, dataSource) {\n\tclearCanvas();\n\tmessage(\"<h5>loading topics ...</h5>\");\n\n\tif (dataset) {\n\t setSelectedDataset(dataset + \"/\" + numTopics);\n\t}\n\n\tif (dataSource) {\n\t setDataSource(dataSource);\n\t}\n\n\ttry {\n\t\tvar socket = getWebsocket();\n\t\tsocke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }