query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
initially to load the pending orders from zerodha
function loadPendingOrders(orders, trader){ for(var order of orders){ if(order['tag'] == null) continue; var stock = order['tradingsymbol']; var order_id = order['order_id']; var orders_in_stock = this.orders[stock]; if(orders_in_stock == null){ orders_in_stock = ...
[ "loadOrderBook() {\n this.state.exchange.LogOrderSubmitted({}, {fromBlock: 0, toBlock: 'latest'})\n .get((err, orders) => {\n for (let i = 0; i < orders.length; i++) {\n // confirm the order still exists then append to table\n this.state.exchange.orderBook_(orders[i].args.id, (err, order) =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the new Speaker from text input to list
function addSpeaker() { $.ajax(API_URL + "/list/" + LIST_ID + "/addSpeaker?name=" + encodeURIComponent($("#new-speaker-input")[0].value)).done(function(updatedList) { updateList(updatedList); }).fail(printError); $("#new-speaker-input")[0].value = ""; return false; }
[ "addASpeaker(speaker) {\n const {name, favConf, noOfConf, favProgrammingQuote } = speaker;\n\n const newSpeaker = { name, favConf, noOfConf, favProgrammingQuote };\n\n speakers.push(tempSpeaker);\n }", "add(text) {\n this.textList.push(text);\n this.update();\n }", "function e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Manually set CSS to animate the Determinate indicator based on the specified percentage value (0100).
function animateIndicator(target, value) { if ( !mode() ) return; var to = $mdUtil.supplant("translateX({0}%) scale({1},1)", [ (value-100)/2, value/100 ]); var styles = toVendorCSS({ transform : to }); angular.element(target).css( styles ); }
[ "function animateIndicator(target, value) {\n if (!mode()) return;\n\n var to = $mdUtil.supplant(\"translateX({0}%) scale({1},1)\", [(value - 100) / 2, value / 100]);\n var styles = toVendorCSS({\n transform: to\n });...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new LaunchTemplateSpotMarketOptionsRequest. The options for Spot Instances.
function LaunchTemplateSpotMarketOptionsRequest() { _classCallCheck(this, LaunchTemplateSpotMarketOptionsRequest); LaunchTemplateSpotMarketOptionsRequest.initialize(this); }
[ "function SpotMarketOptions() {\n _classCallCheck(this, SpotMarketOptions);\n\n SpotMarketOptions.initialize(this);\n }", "function SpotOptionsRequest() {\n _classCallCheck(this, SpotOptionsRequest);\n\n SpotOptionsRequest.initialize(this);\n }", "function RequestSpotLaunchSpecification() {\n _...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
customValid Directive for custom validation example
function customValid(){ return { require: 'ngModel', link: function(scope, ele, attrs, c) { scope.$watch(attrs.ngModel, function() { // You can call a $http method here // Or create custom validation var validText = "Inspinia"; ...
[ "function customValid () {\n return {\n require: 'ngModel',\n link: function (scope, ele, attrs, c) {\n scope.$watch(attrs.ngModel, function () {\n\n // You can call a $http method here\n // Or create custom validation\n\n var validText = \"Inspinia\";\n\n if (scope.extras ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Core Functionality Methods. ////////////////////////////////////////////////////////////// Filter RESULTS array, and determine the most commonlymatched PATH. Return all the results matching this PATH.
function filterResults(results) { var pathCounts = {}, i, path, maxCount = 0, bestPathMethod = 1/0, bestPath; for (i = 0; i < results.length; i += 1) { if (pathCounts[results[i].path] == null) pathCounts[results[i].path] = []; pathCounts[results[i].path].push(results[i]); } for (pa...
[ "listMatchedResults() {\n\t return new Promise(res => {\n\t // Final highlighted results list of array\n\t this.resList = []; // Final clean results list of array\n\n\t this.cleanResList = []; // Holds the input search value\n\n\t let inputValue = renderResults.getSearchInput().value;\n\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Even though this has no args, reference ScrollLockProps so the prop explorer in the styleguide works without warnings about unfound props
function ScrollLock(_) { const scrollLockManager = Object(_utilities_scroll_lock_manager_hooks_js__WEBPACK_IMPORTED_MODULE_1__["useScrollLockManager"])(); Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => { scrollLockManager.registerScrollLock(); return () => { scrollLockManager.unregister...
[ "function ScrollLock(_) {\n const scrollLockManager = (0,_utilities_scroll_lock_manager_hooks_js__WEBPACK_IMPORTED_MODULE_1__.useScrollLockManager)();\n (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {\n scrollLockManager.registerScrollLock();\n return () => {\n scrollLockManager.unregisterScro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Executes a MySQL query to fetch detailed information about a single specified post based on its ID, including comment and like data for the post. Returns a Promise that resolves to an object containing information about the requested post. If no post with the specified ID exists, the returned Promise will resolve to nu...
async function getPostDetailsById(id) { /* * Execute three sequential queries to get all of the info about the * specified post, including its comments and likes. */ const post = await getPostById(id); if (post) { post.comments= await getCommentsByPostId(id); post.likes = awa...
[ "async function getPostInfoById(id) {\n let placeholders = [id, id, id];\n let sql = \"SELECT * FROM posts WHERE pid = ?;\";\n\n sql += \"SELECT links FROM links WHERE pid = ?;\";\n sql += \"SELECT tags FROM tags WHERE pid = ?;\";\n\n return new Promise(async function (resolve, reject) {\n con...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the list of filters of the specified type
function get_checkbox_filters(type) { var filters = {}; var boxes = Y.all('#filter-form .'+type+' input[type=checkbox]'); Y.log('Getting starting '+type+' filters'); boxes.each(function(box) { var name = box.getData('filter-refine'); ...
[ "function getFilterValues(filters, type) {\n return filters.filter(function (data) {\n return data.type === type;\n }).map(function (data) {\n return data.value;\n });\n }", "filterByType(type) {\n this.sendAction('filterByType', type);\n }", "get filter_types() {\n return this.co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the module with the specified `uid` is cached, return it; otherwise, execute and cache it first.
function __require(uid, parentUid) { if(!__moduleIsCached[uid]) { // Populate the cache initially with an empty `exports` Object __modulesCache[uid] = {"exports": {}, "loaded": false}; __moduleIsCached[uid] = true; if(uid === 0 && typeof require === "function") { require.main = __modulesCache[0]; } else {...
[ "function __require(uid, parentUid) {\n\tif(!__moduleIsCached[uid]) {\n\t\t// Populate the cache initially with an empty `exports` Object\n\t\t__modulesCache[uid] = {\"exports\": {}, \"loaded\": false};\n\t\t__moduleIsCached[uid] = true;\n\t\tif(uid === 0 && typeof require === \"function\") {\n\t\t\trequire.main = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes an entity from queries if the removed component disqualifies it
removeComponent(entity, component) { for (const queryType in this._queries) { if (this._queries[queryType].matches(entity.types.concat([component.type]))) { this._queries[queryType].removeEntity(entity); } } }
[ "removeEntity(entity) {\n for (const queryType in this._queries) {\n this._queries[queryType].removeEntity(entity);\n }\n }", "remove(entity) {\n if (this.contains(entity)) {\n const id = this.id(entity);\n internal(this).entityToID.delete(entity);\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adjust timer frequency as needed to stay on cadence. We aim our everysecond timer to land exactly on mm:ss.000. If too far off, cancel & restart the timer with an adjusted frequency. Empirically, an interval of 990 ms appears to remain relatively stable. Notably, the timer granularity appears capped at 60 Hz; it is lik...
function calibrateTimer(context) { var newTimerInterval; var now = new Date().getTime(); var msecClkErr = (now + 500) % 1000 - 500; // get our delta from ideal: [-500, 499] msec newTimerInterval = TimerEnum.NORMAL_TIMER_INTERVAL; if (msecClkErr > MSECS_MAX_CLK_ERR) ...
[ "function changeFrequency() {\n if (speed != 0) {\n if (speed < 0 && currentFreq > firstFreq)\n currentFreq = currentFreq / Math.pow(2, 1 / (semitonesPerOctave * semitoneSubdivisions));\n else if (speed > 0 && currentFreq < lastFreq)\n currentFreq = currentFreq * Math.pow(2, 1 / (semitonesPerOctave...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array with the first letter of the users' name
function getFirstLettersArray(pUsersArray){ var auxLettersArray = []; pUsersArray.filter(function(user) { auxLettersArray.push(user.Name.charAt(0)); }); return auxLettersArray; }
[ "function usernames(names) {\n var usn = [];\n for (var i = 0; i < names.length; i++) {\n var name = names[i].split(\" \");\n usn.push(name[0][0].toLowerCase() + name[1].toLowerCase());\n }\n \n return usn;\n }", "getUserNames() {\n return this.users.map(user => user.name);\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Append remittance element with unstructured message.
appendRemittanceElement(node, message) { var remittanceInformation = node.addElement('RmtInf'); var ustrd = remittanceInformation.addElement('Ustrd'); ustrd.addTextNode(message); return remittanceInformation; }
[ "appendStructuredRemittanceElement(node, transactionInformation) {\n var creditorReference = transactionInformation.getCreditorReference();\n var remittanceInformation = node.addElement('RmtInf');\n\n var structured = remittanceInformation.addElement('Strd');\n var creditorReferenceInfor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Select the template to use given the specified "for" loop details
function selectForListTemplate(template, forTemplate, index, total, item) { // Generate the template details (if needed) if (forTemplate.details == undefined) forTemplate.details = makeForTemplateDetails(forTemplate); var res = undefined; // Check to see if there is any it...
[ "iterateTemplate() {\n let iteratebleElements = findIn(this.template, '[data-bi-for]');\n if (iteratebleElements === null) {\n return;\n }\n if (iteratebleElements.length == undefined) {\n iteratebleElements = [iteratebleElements];\n }\n iteratebleElem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the original array and updates the "is_updating_now" field for the objects that are in entitiesStatesToChange. Then calling for update to the doc in the db.
async function changeIsUpdatingStatus(expId, groupId, entitiesStates, entitiesStatesToChange, newStatus){ entitiesStatesToChange.forEach(entToChange => { let originalEntity = entitiesStates.find(ent => ent.type == entToChange.type && ent.entity_value == entToChange.entity_value) origina...
[ "function updateFieldValues(arrUpdates) {\n \n // make a copy of our array of objects held by the state\n let arrCopy = [...state.arrFields];\n\n // Update each field id listed in our updates array (the value property)\n arrUpdates.forEach(item => {\n\n // Obtain our field obj...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If saveSession = true, then the session cookie will be updated if it is verified successfully.
function verifySession(session, saveSession, callback_func){ if (session == null || typeof(session) == 'undefined' || session == bbs_type.cookie.error_session) { callback_func(false); return; } var url = bbs_query.server + bbs_query.auth.session_verify; var request_settings = { ...
[ "function saveSession (err) {\n if (String(session.id) !== token) {\n // Set cookie on new sessions.\n res.cookie(ID, session.id, { path: '/', httpOnly: true, secure: req.secure })\n } else if (session.lastModified === initialModified) {\n // Skip saving if we have not chang...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Allow the user to edit activity based on time and date
function editActivity(clicked_id) { var baseUrl = "../../php/objects/activityUpdate.php"; var ddlDate = document.getElementById("ddlDate" + clicked_id); var startTime = document.getElementById("tbStartTime" + clicked_id).value; var endTime = document.getElementById("tbEndTime" + clicked_id).value; var checkValid ...
[ "function editActivity() {\n\n // get the name of the activity\n // and check that it's not empty\n var name = view.activityName.val();\n if (name == '') {\n event.preventDefault();\n event.stopPropagation();\n view.activityNameErrorLabel.addClass('error'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the Menu and its PointerFocusTracker.
initialize(menu, pointerTracker) { this._menu = menu; this._pointerTracker = pointerTracker; this._subscribeToMouseMoves(); }
[ "focus() {\n if (this.elements.parentMenu.currentEvent !== \"mouse\") {\n this.dom.link.focus();\n }\n\n if (this.isMenubar && this.elements.parentMenu.isTopLevel) {\n this.dom.link.tabIndex = 0;\n }\n }", "function setCurrentMenu(menu) {\n menuCurrent = menu;\n }", "ini...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shift the widgets for RTL table.
shiftWidgetForRtlTable(clientArea, tableWidget, rowWidget) { let clientAreaX = tableWidget.x; let cellSpace = 0; let tableWidth = 0; if (tableWidget.tableFormat != null && tableWidget.tableFormat.cellSpacing > 0) { cellSpace = tableWidget.tableFormat.cellSpacing; } ...
[ "shiftWidgetsForRtlTable(clientArea, tableWidget) {\n let clientAreaX = tableWidget.x;\n let clientAreaRight = clientArea.right;\n let cellSpace = 0;\n if (tableWidget.tableFormat && tableWidget.tableFormat.cellSpacing > 0) {\n cellSpace = tableWidget.tableFormat.cellSpacing;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extend base with properties.
function extend(base, props) { for (let i in props) if (props.hasOwnProperty(i)) base[i] = props[i]; return base; }
[ "function inheritAndAdd(base, newProperties) {\n return Object.assign(Object.create(base), newProperties);\n }", "function extend(inBasePrototype, inProperties) {\n return Object.create(inBasePrototype, \n getPropertyDescriptors(inProperties));\n }", "function extend (base)\r\n{\r\n $sup...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Base construction of a variable. Does not implement methods key is of type string
function BaseVariable(key) { return { type: "variable", key: () => key } }
[ "constructor(key,value) {\n this.key = key;\n this.value = value;\n }", "constructor(key, value) {\n\t\tthis.key = key;\n\t\tthis.value = value;\n\t}", "static of(key : any) : Parent {\r\n return new Parent(key);\r\n }", "static of(key : any) : Parent {\n return new Parent(key);\n }", "_$kind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if a given value is a latitude.
function isLatitude(value) { return (typeof value === 'number' || typeof value === 'string') && Object(_IsLatLong__WEBPACK_IMPORTED_MODULE_1__["isLatLong"])(`${value},0`); }
[ "function isLatitude(value) {\n return (typeof value === \"number\" || typeof value === \"string\") && isLatLong(value + \",0\");\n }", "function isLatitude(value) {\n return (typeof value === \"number\" || typeof value === \"string\") && isLatLong$1(value + \",0\");\n}", "function isLatitude(value...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HandleControl receives dom event and control type then executes a helper fn of given type
handleControl(e, type) { switch (type) { case "play": return clickPlay(e, this.videoEle); case "pause": return clickPlay(e, this.videoEle); case "skip": return clickSkip(e, this.videoEle, 1); case "mute": return clickMute(e, this.videoEle); case "fullscr...
[ "addControlInteractively(ctrlType) {\n $(this.svgDisplay.htmlElement).css('cursor', 'crosshair');\n\n // Register for mouse events of both the display and the dialog\n // DOM elements to allow controls to be on top of those elements.\n let self = this;\n $(this.svgDisplay.htmlElement).on('m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DESCR: 3 selects a player's DIV & makes it fade out
playerFadeOut(activePlayerIndex) { $('#player' + activePlayerIndex).fadeTo(400, 0.2) }
[ "playerFadeIn(activePlayerIndex) {\r\n $('#player' + activePlayerIndex).fadeTo(400, 1)\r\n }", "function playerFade()\n{\n\t/* If fading out then make more transparent and if to many change state to not fading */\n\tif(playerFadingStage == global_consts.PLAYER_STATE_FADE_OUT)\n\t{\t\n\t\tthis.renderer.materia...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert image to greyscale, 32bits FP result (16.16)
function greyscale(src, srcW, srcH) { var size = srcW * srcH; var result = new Uint32Array(size); // We don't use sign, but that helps to JIT var i, srcPtr; for (i = 0, srcPtr = 0; i < size; i++) { result[i] = (src[srcPtr + 2] * 7471 // blue + src[srcPtr + 1] * 38470 // green ...
[ "function greyscale(src, srcW, srcH) {\n var size = srcW * srcH;\n var result = new Uint16Array(size); // We don't use sign, but that helps to JIT\n var i, srcPtr;\n\n for (i = 0, srcPtr = 0; i < size; i++) {\n result[i] = (src[srcPtr + 2] * 7471 // b...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a button for each popular theme that will update the UI using props.uiStyleChange.
renderPopularThemes() { return ( popularThemes.map((theme) => { const name = theme.name; const props = this.props; return <Button key={name} callback={() => props.uiStyleChange( theme.b...
[ "function showThemesWin(themes) {\n let tile = '';\n let styles = '';\n\n for (let c = 0; c < themes.length; c++) {\n let name = themes[c].name;\n let palette = themes[c].palette;\n\n styles += `.thm-${name}-bg {\n background: ${palette.bodyBg};\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Code Example 5.11 In production code, this function would be refactored into smaller functions. Read the data range into a JavaScript array. Remove and store the header line using the array shift() method. Use the array filter() method with an anonymous function as a callback to implement the filtering logic. Determine...
function writeFilteredArrayToRange () { var ss = SpreadsheetApp.getActiveSpreadsheet(), sheetName = 'english_premier_league', sh = ss.getSheetByName(sheetName), dataRange = sh.getDataRange(), dataRangeValues = dataRange.getValues(), filteredArray, header = dataRangeValues.shi...
[ "function writeFilteredArrayToRange() {\n var ss = SpreadsheetApp.getActiveSpreadsheet(),\n sheetName = 'english_premier_league',\n sh = ss.getSheetByName(sheetName),\n dataRange = sh.getDataRange(),\n dataRangeValues = dataRange.getValues(),\n filteredArray,\n header = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sorts creep creation requests, sends newly created name and role for creep to the crew that requested them.
HandleRequests() { for(let name in Game.spawns) { for(let i in this.requests) { let spawn = Game.spawns[name]; let request = this.requests[i]; let role = Role.Creep[request.role]; if (spawn.canCreateCreep(role.Level[0]) == OK) { let name = spawn.createCreep(role.Level[0], null, { role: reque...
[ "requestCreep(proc, role, creepClass, pos, priority, index = 0) {\n //return creep if it exists, else request it from spawn\n let procCreeps = this.creepsByProc[proc.name];\n \n //make sure pos is a roomPosition\n pos = new RoomPosition(pos.x, pos.y, pos.roomName);\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function: Get length of ancestors array while validating it.
function getValidatedAncestorsLength(ancestorArray) { let len = ancestorArray.length; if (len < 2) { console.log(`ERROR: orderedItemsToDelete contains item <${ancestorArray[0]}> which is not of the form <ancestors.../child>`); return null; } return len; }
[ "function getLength(nestArr) {\n return nestArr.flat(Infinity).length;\n}", "function countAncestors(obj) {\n\t\t\tvar count = 0;\n\t\t\t\n\t\t\tif((obj !== null) && (typeof obj == \"object\")) {\n\t\t\t\tObject.entries(obj).forEach(([key, value]) => {\n\t\t\t\t\tif ((key == \"id\") && (value != \"\")) {\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add a line data to Chat Content DIV
function addLines(data) { logger.debug("addLines", data); var linesAdded = false; if(typeof data.lines != "undefined"){ for (var i = 0; i < data.lines.length; i++) { var line = data.lines[i]; if(line.source == 'visitor' && !lpInteractiveChat){ lpInteractiveChat = true; ...
[ "function newChatLine(message){\n\n\t $(\".chat\").append($('#chatRow').html()); \n\t $(\".chat .username\").last().append(message.user.name);\n\t $(\".chat .messageDate\").last().append(message.created_at);\n\t $(\".chat .messageDate .msg-id\").last().val(message.id); \n\t $(\".chat .messageDate\")....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the target's release manifest. Try to use a cached copy first, but if there is none, or if the cache is outdated, download a new one by using the URL specified in the product info. The release manifest is cached after download.
function getElectronManifestAsync() { if (getManifestPromise) { return getManifestPromise; } getManifestPromise = Promise.resolve() .then(() => { Util.mkdirP(cacheRoot); return Util.readJsonFileAsync(cachedTargetConfigPath); }) .then((targetConfig) => { if...
[ "async function getLatestRelease() {\n const stream = await getData(\n \"https://api.github.com/repos/decentology/dappstarter-cli/releases\"\n );\n const content = await streamToString(stream);\n let json = null;\n try {\n json = JSON.parse(content);\n } catch (error) {\n console.error(\n \"Unab...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
onClick usage! deletes specifc time slot based on input when button is clicked
deleteFromSchedule() { let first = Number(document.querySelector('#del-startTime').value.slice(0,2)); let second = Number(document.querySelector('#del-endTime').value.slice(0,2)); let index = 0; let removed_schedule = [...this.state.schedule]; try{ if(document.queryS...
[ "function deleteTimeElement(button)\n{\n $(button).parent().remove();\n}", "onUnChoosingATimeSlot(timeSlot){\n\t\ttimeSlot = new Date(timeSlot).getTime();\n\t\tif (!this.state.chosenTimeSlots.has(timeSlot)) {\n\t\t\treturn true;\n\t\t}\n\t\tvar chosenTimeSlotsTemp = this.state.chosenTimeSlots;\n\t\tchosenTimeS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register Grid, DataView, Selection Model, and Plugin events.
registerEvents() { const gridEvents = [ // Register Grid Events. { handler: this.slickGrid, events: this.events.slickGrid }, // Register DataView Events. { handler: this.dataView, events: this.events.dataView }, // Register Se...
[ "registerEvents() {\n this.registerTimerBlock();\n this.registerElementsUI();\n }", "registerEvents() {\n this.registerButtonEvent();\n this.registerFrontLayerEvent();\n }", "function registerListeners() {\n miro.addListener('CANVAS_CLICKED', async function (event) {\n await wr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns base config with bidder overrides (if there is currently a bidder)
function _getConfig() { if (currBidder && bidderConfig && utils.isPlainObject(bidderConfig[currBidder])) { var currBidderConfig = bidderConfig[currBidder]; var configTopicSet = new __WEBPACK_IMPORTED_MODULE_3_core_js_pure_features_set___default.a(Object.keys(config).concat(Object.keys(currBidderConfig))...
[ "function getBidderConfig() {\n return bidderConfig;\n }", "function _getConfig() {\n if (currBidder && bidderConfig && isPlainObject(bidderConfig[currBidder])) {\n let currBidderConfig = bidderConfig[currBidder];\n const configTopicSet = new Set(Object.keys(config).concat(Object.keys(currBidderC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When URI input changes, prepare to create task
function handleUriChange(e) { var uri = $("#uri").val().trim(); if (uri == '') { msg(""); } else { progress(0); msg("Click <button class=\"btn btn-xs btn-primary\" id=\"btnCreatetaskwithuri\">Create Task</button> to create a task from URI: \"" + uri + "\"", "info"); $("#btnCr...
[ "function createTaskFromURI(uri, RK = null) {\n if (uri != '') {\n msg(\"Creating task from URI \" + uri, \"info\");\n $.ajax({\n type: \"post\",\n async: true,\n url: \"/createTask\",\n dataType: \"jsonp\",\n jsonp: \"callback\",\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads and transforms the Games from the json format
function loadGames(){ var request = loadViaAjax("AllGames.json"); request.done(function(data) { Games = data; createGameCategories(); createGameCategoryAll(); }); return request; }
[ "static async getGamesData() {\r\n\t\t// Doi du lieu tra ve tu game.json moi tiep tuc\r\n\t\tconst result = await fetch('game.json');\r\n\t\t// Doi loc du lieu tra ve xong roi moi tiep tuc\r\n\t\tconst data = await result.json();\r\n\t\t// Lay thong tin can thiet trong du lieu da loc\r\n\t\t// Du lieu tra ve la mot...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used for add forgery token to comments
function AddAntiForgeryToken(data) { data.__RequestVerificationToken = $('#__AjaxAntiForgeryForm input[name=__RequestVerificationToken]').val(); return data; }
[ "function AddAntiForgeryToken(data) {\r\n data.__RequestVerificationToken = $(\"form input[name=__RequestVerificationToken]\").val();\r\n return data;\r\n}", "async get_new_csrf_token() {\n\t\tconst response = await this.agent.get('https://app.memrise.com/home');\n\t\tlet csrftoken = response.header['set-co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::Kendra::DataSource.SharePointConfiguration` resource
function cfnDataSourceSharePointConfigurationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnDataSource_SharePointConfigurationPropertyValidator(properties).assertSuccess(); return { CrawlAttachments: cdk.booleanToCloudFormation(propertie...
[ "function renderProperties(setup) {\n // print available exams\n var html = '';\n if (!('localStorage' in window)) {\n html += warning(getMessage('msg_options_change_disabled', 'Changing options is disabled, because your browser does not support localStorage.'));\n }\n for (var section in setu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the data with the undergrad search toggle.
function searchUndergrad() { search.undergrad = $("#undergradsearch").is(":checked"); updateData(); }
[ "toggleSearch() {\n\t\t// toggle state of advanced search\n\t\tconst search = !app.getState().caseSearch;\n\t\tapp.setState({ caseSearch: search });\n\t\tthis.forceUpdate();\n\t}", "function searchGraduate() {\r\n search.graduate = $(\"#graduatesearch\").is(\":checked\");\r\n updateData();\r\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
develop option to set a developer flag on the db (used to show developer content to developers)
async setDeveloperFlag(collection, mode) { await this.getApiLock(); let result = null; if (!this.isAuthenticated()) { console.error("reference_to_mongo_db.setDeveloper", "user is not authenticated."); } else { console.info("Setting developer flag to: " + mode);...
[ "function devMode() {}", "function setDebug(value){\n flags.DEBUG_MODE = (value === true) ? value : false;\n }", "function setDebugFlag(flag) {\n\tdebugFlag = flag;\n}", "function developmentModeOn() {\n if (options.development) {\n console.log(\"Development mode is already turned on.\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deposit tokens into the pool
async depositAllTokenTypes(userAccountA, userAccountB, poolAccount, userTransferAuthority, poolTokenAmount, maximumTokenA, maximumTokenB) { return await (0, send_and_confirm_transaction_1.sendAndConfirmTransaction)('depositAllTokenTypes', this.connection, new web3_js_1.Transaction().add(TokenSwap.depositAllToke...
[ "spend_tokens(count) {\n this.tokens_held-=count;\n }", "function sendTokens(address target, uint amount) onlyOwner external {\r\n require(amount>0);//Number of tokens must be greater than 0\r\n balances[target] = safeAdd(balances[target], amount);\r\n StatsTotalSupply = safeAdd(StatsTota...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render the mfs parse tree as HTML under the element el.
function renderMFSParsed(parsed, el, fontTable, baseStyles) { var ret; try { ret = GSP.mfs.makeHTMLFromMFSParseTree(parsed, el, fontTable, baseStyles); return ret; } catch (ex) { GSP.signalCaughtError(ex); } }
[ "function render(self) {\n var container = document.getElementById(self.node),\n leaves = [],\n click = function(e) {\n e = e || window.event;\n //var parent = (e.target || e.currentTarget || e.srcElement).p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Execute the last HTTP request in a traversal that ends in post/put/patch/delete, but do not call t.callback immediately (because we still need to do response body to object conversion afterwards, for example) TODO Why is this different from when do a GET? Probably only because the HTTP method is configurable here (with...
function executeLastHttpRequest(t, callback) { // always check for aborted before doing an HTTP request if (t.aborted) { return abortTraversal.callCallbackOnAbort(t); } // only diff to execute_last_http_request: pass a new callback function // instead of t.callback. httpRequests.executeHttpRequest( ...
[ "function executeLastHttpRequest(t, callback) {\n // always check for aborted before doing an HTTP request\n if (t.aborted) {\n return abortTraversal.callCallbackOnAbort(t);\n }\n httpRequests.executeHttpRequest(\n t, t.requestModuleInstance, t.lastMethod, t.callback);\n}", "function executeLastHttpRe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return an array of buffers containing text samples with at least one byte outside the 7bit ascii range.
function getNonAsciiSamples() { var samples = []; var stringFields = header.fields.filter(function(f) { return f.type == 'C'; }); var cols = stringFields.length; // don't scan all the rows in large files (slow) var rows = Math.min(header.recordCount, 10000); var maxSamp...
[ "get supportedCharacters() {\n\t\tlet chars = [];\n\t\tconst cmap = this.getBestCmap();\n\t\tif (cmap) {\n\t\t\tfor (const chunk of cmap) {\n\t\t\t\tfor (let i = chunk.start; i < chunk.end + 1; i++) {\n\t\t\t\t\t// Skip 0xFFFF, Font.js currently reports this\n\t\t\t\t\t// as a supported character\n\t\t\t\t\t// http...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse parameters from url hash
function parseHashParams() { var hash = window.location.hash, keyValPairs = null, params = {}; if (hash) { hash = hash.replace('#', ''); keyValPairs = hash.split('&'); $.each(keyValPairs, function(i, pair) { var keyAndVal = pair.split('='); params[keyAndVal[0]...
[ "function parseUrlHash_(hash) {\n const parameters = hash.split('&');\n\n let tabHash = parameters[0];\n if (tabHash === '' || tabHash === '#') {\n tabHash = undefined;\n }\n\n // Split each string except the first around the '='.\n let paramDict = null;\n for (let i = 1; i < parameters.le...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This adds the getschool() function to the Intern class.
getSchool() { return this.school; }
[ "function getSchool() {\n return \"Novi Hogeschool\";\n}", "function getSchool () {\n return \"Novi\";\n}", "getSchool() {\n\t\treturn this.school;\n\t}", "getSchool() { return this.school }", "function getSchool()\n{\n\treturn this.school;\n}", "get school() {\n\t\treturn this.__school;\n\t}", "get...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Restores inline "fill"/"stroke" previously set to _track, _fill or _line.
_restoreInlineColors(trackColor, fillColor, lineColor) { const that = this; if (that._track && trackColor !== '') { that._track.style.fill = trackColor; } if (that._fill && fillColor !== '') { that._fill.style.fill = fillColor; } if (that._line ...
[ "restoreDefaultStroke(){\r\n strokeWeight(1);\r\n stroke(0);\r\n fill(255);\r\n }", "resetColor() {\n this.stroke.r = this.stroke.normal.r;\n this.stroke.g = this.stroke.normal.g;\n this.stroke.b = this.stroke.normal.b;\n }", "function clear_line_highlight() {\n\n if (hilighted_line !== n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function lists all files including pages in the pages_model folder (/views/pages_model) This is needed to automatically load all pages in the app To add mode pages to render model, just add a page in the /views/pages_model that renders using ejs whatever your model delivers.
function find_pages_model () { var files = fs.readdirSync(`${__dirname}/views/pages_model`); console.log(`ff ${JSON.stringify(files)} `) var names = []; files.forEach(function (file) { names.push(file.substring(0,file.indexOf('.ejs'))) }); return names }
[ "function getAllPages() {\n var filepath = getCurrentPath();\n console.log('file path: ', filepath);\n htmlFiles = fs.readdirSync(filepath)\n .filter(function (file) {\n return file.includes('.html');\n }).map(function (file) {\n var correctPath = pathLib.resolve(filepat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Iterate over each [x,y] point in a layer shapes: one layer's "shapes" array
function forEachPoint(shapes, cb) { var i, n, j, m, shp; for (i=0, n=shapes.length; i<n; i++) { shp = shapes[i]; for (j=0, m=shp ? shp.length : 0; j<m; j++) { cb(shp[j], i); } } }
[ "function ShapeIter(arcs) {\nthis._arcs = arcs;\nthis._i = 0;\nthis._n = 0;\nthis.x = 0;\nthis.y = 0;\n}", "function ShapeIter(arcs) {\n this._arcs = arcs;\n this._i = 0;\n this._n = 0;\n this.x = 0;\n this.y = 0;\n}", "function ShapeIter(arcs) {\n this._arcs = arcs;\n this._i = 0;\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a list contains date in all formats
function getDateInAllFormats(dateStrFormat) { var ddmmyyyy = dateStrFormat.day + dateStrFormat.month + dateStrFormat.year; var mmddyyyy = dateStrFormat.month + dateStrFormat.day + dateStrFormat.year; var yyyymmdd = dateStrFormat.year + dateStrFormat.month + dateStrFormat.day; var ddmmyy = dateStrFormat....
[ "function allFormatDates(dates) {\n let givenDate = dateStr(dates);\n let ddmmyyyy = givenDate.day + givenDate.month + givenDate.year;\n let mmddyyyy = givenDate.month + givenDate.day + givenDate.year;\n let yyyymmdd = givenDate.year + givenDate.month + givenDate.day;\n let ddmmyy = givenDate.day + g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is used for setting the color of the answer.
changeAnswerColor (answer, td) { answer == "Not answered" ? td.css({"color": "red"}) : td.css({"color": "#00cccc"}); }
[ "newAnswerColor() {\r\n this.answerElementColor.setCmColor(this.getRandomElementColor());\r\n }", "function setFAQAnwserColor() {\n // Repeated Question Label\n $('#faqCPAnwserLabel').colorpicker('setValue', faqAnwserColor);\n}", "function setFAQQuestionColor() {\n // Repeated Question Label\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function setEvent : input: none output: none Emit a SQLEvent, which triggers a MySQL Query Allows you to use the CreateMySQLEvent method of the Smart Contract, and emit an Event. It modifies the blockchain, by adding a log to the blockchain, so you can call it with the send function, as it needs to send a transaction. ...
function setEvent(){ Gestion.methods.getString().call(function(error, result){ if (!error){ Gestion.methods.CreateMySQLEvent( toString(result) ).send({ from : web3.eth.defaultAccount }); setTimeout(function(){ecrire()},120); } else console.log(error); }); }
[ "addEvent(event) {\n // call write repo to save to event store\n writeRepo.enqueueEvent(event, function(offset) {\n CommonCommandHandler.sendEvent(event, offset);\n });\n }", "addEvent(event) {\n // call write repo to save to event store\n writeRepo.enqueueEvent(event, function(offset) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load column latest data
function loadColumnLatest(column) { app.Column = column; // load from cache if (Storage.isEnabled) { var cache = Storage.getItem(app.getArticlesCacheKey()); if (!isEmpty(cache)) { loadColumnLatestContent(JSON.parse(cache)); } } // get data $.getJSON(url.arti...
[ "function loadColumnLatestContent(data) {\n if (isEmpty(data.Data)) {\n console.log('empty data');\n return;\n }\n\n var columnContent = $('#rovat .content');\n var articles = '';\n $.each(data.Data, function (index, item) {\n articles = articles + page.renderArticle(item);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
writeBuildManifest Writes the build and the blueprint data to the destination directory
async writeBuildManifest ({ build }) { let output_directory = build.id || '' const dest = path.join(this.options.cwd, OUTPUT_DIRECTORY, output_directory, build.blueprint.identifier); await this.ensureDir(dest) return new Promise((resolve, reject) => { fs.writeFileSync(path.join(dest + '/codotype-...
[ "async writeManifest()\n {\n const bootstrapFile = resolve( 'bootstrap', 'cache') + '/svelte-direct-components.php';\n let phpCode = '<?php return [';\n\n let arrayContent = this.manifest.reduce(\n (previous, current) => previous + `'${current.tag}' => '${current.filename}', `\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called whenever the user wishes to remove a custom property setting
function removeCustomCheckoutPropertySetting(index) { viewModel.product().Product.CheckoutPropertySettingsList.splice(index, 1); }
[ "removeProperty(propertyName) {\n const configuration = this.props.configuration;\n delete configuration.properties[propertyName];\n this.props.onChange(configuration);\n }", "function ff4j_removePropertiesForFeature(uid, propName) {\n\t$.ajax({\n\t type: 'GET',\n\t\turl: $(location).at...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prints the text on screen, optionally notifying the client of the log events;
function print(e, event, text, isExtraLine) { let t = null, s = text; if (!isExtraLine) { t = new Date(); s = cct.time(formatTime(t)) + ' ' + text; } let display = true; const log = module.exports.log; if (typeof log === 'function') { // the client expects log notificatio...
[ "function log( text )\n{\n if ( typeof( printer ) !== \"undefined\" )\n {\n printer.println( text );\n printer.flush();\n }\n else\n {\n print( text );\n }\n}", "function log(text) {\n body.pushLine(text);\n body.setScrollPerc(100);\n screen.render();\n}", "function pri...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Will parse a baggage header, which is a simple keyvalue map, into a flat object.
function baggageHeaderToObject(baggageHeader) { return baggageHeader .split(',') .map(baggageEntry => baggageEntry.split('=').map(keyOrValue => decodeURIComponent(keyOrValue.trim()))) .reduce((acc, [key, value]) => { acc[key] = value; return acc; }, {}); }
[ "function baggageHeaderToObject(baggageHeader) {\n return baggageHeader\n .split(',')\n .map(baggageEntry => baggageEntry.split('=').map(keyOrValue => decodeURIComponent(keyOrValue.trim())))\n .reduce((acc, [key, value]) => {\n acc[key] = value;\n return acc;\n }, {});\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds to chain of operations
function chainOperation(input) { opChain.push(input); }
[ "function _Chain() {}", "chain(operator, expression) {\n\n this.operators.push(operator);\n this.operands.push(expression);\n return this;\n }", "add (operation, compose) {\n if (this.state === UNDOING_STATE) {\n this.redoStack.push(operation)\n this.dontCompose = true\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort layout items by column ascending then row ascending. Does not modify Layout.
function sortLayoutItemsByColRow(layout /*: Layout*/ ) /*: Layout*/ { return layout.slice(0).sort(function (a, b) { if (a.x > b.x || a.x === b.x && a.y > b.y) { return 1; } return -1; }); }
[ "function sortLayoutItemsByRowCol(layout\n/*: Layout*/\n)\n/*: Layout*/\n{\n // Slice to clone array as sort modifies\n return layout.slice(0).sort(function (a, b) {\n if (a.y > b.y || a.y === b.y && a.x > b.x) {\n return 1;\n } else if (a.y === b.y && a.x === b.x) {\n // Without this, we can get ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sort array of articles by date.
function sortByDate() { return articles.sort(function(a, b) { let x = new Date(a.published_at).getTime(); let y = new Date(b.published_at).getTime(); if (x < y){ return -1; } else if (y > x){ return 1; } else { return 0 } }); }
[ "function sortByDate(array) {\n return array.sort(function (article1, article2) {\n //compare the dates\n return new Date(article2.datetime) - new Date(article1.datetime);\n });\n}", "function arraySortBasedOnDate(array) {\n return array.sort(function(a, b) {\n var c = ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add analytics attributes on icon Pinterest
function gtmAttributes() { $('a[data-pin-log="button_pinit"]').attr('data-click-category', 'social'); $('a[data-pin-log="button_pinit"]').attr('data-click-action', 'share'); $('a[data-pin-log="button_pinit"]').attr('data-gtm', 'social'); $('a[data-pin-log="button_pinit"]').attr('data-cli...
[ "function attachIcon (){ \n var iconID= data.current.weather[0].icon;\n\n var iconURL= \"https://api.openweathermap.org/img/w/\" + iconID + \".png\"\n \n $('#weather-icon').attr('src', iconURL);\n $('#weather-icon').attr('alt', data.current.weather.description);\n}", "function attachIcon() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render subset widget produces markup for SelectData as well
function getSubset(fieldname, subsetNum) { var widgetid = 'form-widgets-' + fieldname + '-' + subsetNum var datasetwidgetid = widgetid + '-items' var datasetmodalid = fieldname + '-' + subsetNum + '-items-modal' return '<div id="' + widget...
[ "function renderSubsetsDiv(){\n var sh = '<div><div class=\"joe-menu-label\">Subsets</div>';\n var act;\n [{name:'All',filter:{}}].concat(_joe.current.subsets||[]).map(function(opt){\n //if(!opt.condition || (typeof opt.condition == 'function' && opt.condition(self.cu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the average score of the user taking in account the date of the score The period of time passed since the referral was stored affects the score comparing it with the current time.
getRankScore () { let avg = 0 for (let i=0; i<this.rankScore.length; i++) { avg += this.rankScore[i].value * (1 - ((Date.now() - this.scores[i].time))/Date.now()) } return avg }
[ "function calculateAvg(userArray) {\n var userSum = 0;\n for(var i = 0; i < userArray.length; i++) {\n userSum += userArray[i].score;\n }\n var userAvg = userSum / userArray.length;\n return userAvg;\n}", "function overallScore() {\n user.score = extrTotal - intrTotal;\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NEXT FUNCTION GOES THROUGH 'candidates_array' TO FIND THE STATUS CODE AKA SWIPE STATUS TOWARDS.. ..'user_email_str' RETURNS 1 IF 'candidates_array' IS EMPTY, OR IF 'user_email_str' IS NOT AN ENTRY IN.. ..'candidates_array'
function get_status_towards_this_user(user_email_str, candidates_array) { let status_int = -1; // GO THROUGH ALL CANDIDATES for(let i = 0; i < candidates_array.length; ++i) { if(candidates_array[i].email === user_email_str) { status_int = candidates_array[i].status; br...
[ "function is_this_user_in_this_candidates_array(email_str, candidates_array)\n {\n let array_index = -1;\n \n // GO THROUGH ALL CANDIDATES\n for(let i = 0; i < candidates_array.length; ++i)\n {\n // IF 'email_str' IS THE CANDIDATE\n if(candidates_array[i].email === email_str)\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for adding a query
addQuery(text) {}
[ "function Query () {}", "onAddQuery() {\n var queryInput = document.getElementById(\"addQueryInput\");\n if (queryInput.value !== \"\") {\n this.addQuery(queryInput.value);\n queryInput.value = \"\";\n }\n }", "addQuery(commandId, queryText) {\n this.db\n .get(\"commands\")\n .g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return true if node is `PropertyAccessExpression`
function isPropertyAccessExpression(node) { return node.kind === ts.SyntaxKind.PropertyAccessExpression; }
[ "static isPropertyAccessExpression(node) {\r\n return node.getKind() === typescript_1.SyntaxKind.PropertyAccessExpression;\r\n }", "function isPropertyAccessCallExpression(node) {\n return ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression);\n }", "function IsAccessor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clears ALL outstanding actions
function killAllActions() { outstandingPendingActions = []; return outstandingPendingActions; }
[ "clear() {\n this.actions_.length = 0;\n }", "function clearActions() {\n actionsList = [];\n}", "function clearActions() {\r\n // Remove actions in reverse order so the game state updates properly\r\n for (var actionIndex = turnActions.length - 1; actionIndex >= 0; --actionIndex) {\r\n actionRe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
installs system dependencies needed to successfully build the ruby executables
async function installBuildDependencies() { const dependencyList = 'libyaml-dev libgdbm-dev libreadline-dev libncurses5-dev zlib1g-dev libffi-dev' await installDependencies('ruby-build', dependencyList); }
[ "function initdependencies(){\n process.spawnSync('npm',['install', '--save', 'express'], { cwd: './' });\n process.spawnSync('npm',['install', '--save', 'helmet'], { cwd: './' });\n}", "installDependencies() {\n this.project.logger.info('Installing dependencies...');\n util_1.exec(this.instal...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate audio url from context object
function getAudioUrl(context) { let audioName; if (context.animalHead !== context.animalBody) { audioName = [context.animalHead, context.animalBody].sort().join('') + '.wav'; } else { audioName = context.animalHead + '.wav'; } let audioUrl = `https://storage.googleapis.com/${ firebaseConfig....
[ "generateUrl() {\n let md5 = this.md5origin.replace('.mp3', '');\n let md5mp3bit = this.md5origin.includes('.mp3') ? '1' : '0';\n let mv = this.mediaVersion.toString().padStart(2, '0');\n this.url = `/stream/${md5}${md5mp3bit}${mv}${this.trackId}?q=${this.quality}`;\n }", "createReq...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
From the P'Zone menu, selecting Meaty PZone
selectmeatPzone() { I.waitForElement(foodObjects.meatyPzone); I.tap(foodObjects.meatyPzone); I.waitForElementLeaveDom(settings.config.helpers.Appium.platform, commonObjects.progressBar); }
[ "selectpepPzone() {\n I.waitForElement(foodObjects.pepPzone);\n I.tap(foodObjects.pepPzone);\n I.waitForElementLeaveDom(settings.config.helpers.Appium.platform, commonObjects.progressBar);\n }", "function selectZone(coords) {\n var topLeft = searchGrid.coordsToTopLeftCoords(coords);\n topLeft.x -=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cancels the drag operation for the ctrl
cancelDrag(_ctrl) { const _dragIdx = this._listeners.dragged.indexOf(_ctrl.viewId); if (_dragIdx !== -1) { this._listeners.dragged.splice(_dragIdx, 1); } }
[ "static cancel() {\n return addon_1.default.QDrag.cancel();\n }", "function cancel() {\n focusedControl.fire('cancel');\n }", "function cancel() {\n\t\t\tfocusedControl.fire('cancel');\n\t\t}", "onDragCancel(event) {\n if (!this.isDragging) return;\n this.isDragging = false;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
searches the array of objects returned from scaping the webpack list of loaders for a keyword supplied by the user
function searchWebpackLoaders(keyword, scrapedList) { return scrapedList.filter(function (val) { return val.desc.toLowerCase().indexOf(keyword.toLowerCase()) !== -1; }); }
[ "function analyzeLoaders(loaders, namePrefix = '') {\n const loaderDescriptions = {};\n const extensionsLoaders = Object.entries(Object.entries(loaders)\n .map(([name, description]) => ({ ...description, name }))\n .filter(isLoaderDescription)\n .reduce((previous, loaderDescription) => {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disables flipping on matched cards
function disableMatchedCards() { firstCard.removeEventListener('click', flipCard); secondCard.removeEventListener('click', flipCard); resetBoard(); }
[ "function flipCard() {\n if(disableDeck) return;\n if(this===firstCard) return;\n this.classList.remove('flipped');\n \n if (!cardFlipped) {\n cardFlipped = true;\n firstCard = this;\n clickedOn.push(this);\n \n return;\n }\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[2sample ttest]( This is to compute two sample ttest. Tests whether "mean(X)mean(Y) = difference", ( in the most common case, we often have `difference == 0` to test if two samples are likely to be taken from populations with the same mean value) with no prior knowledge on standard deviations of both samples other than...
function t_test_two_sample(sample_x, sample_y, difference) { var n = sample_x.length, m = sample_y.length; // If either sample doesn't actually have any values, we can't // compute this at all, so we return `null`. if (!n || !m) return null ; // default difference (...
[ "function t_test_two_sample(sample_x, sample_y, difference) {\n\t var n = sample_x.length,\n\t m = sample_y.length;\n\n\t // If either sample doesn't actually have any values, we can't\n\t // compute this at all, so we return `null`.\n\t if (!n || !m) return null;\n\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Note: a subsequence is not a substring because a substring has to be consecutive and a subsequence may skip characters Time complexity: O(nm) > nested loops for each character of both strings Space complexity: O(nm) > size of the matrix is length of text1 length of text2
function longestCommonSubsequence(text1, text2) { /* - Think of the rows as the outer loop and the columns as the inner loop. - Use 2 pointers, one for each string (imagine it being a matrix). One is for rows and the other for columns. - Rows -> text1 - Columns -> text2 - Like in the Coin Chan...
[ "function subsequence(str1, str2) {\n // Create a variable for i and start it at 0\n let i = 0;\n // Create a empty variable for j and start it at 0\n let j = 0;\n\n // If no string is passed we return true\n if (!str1) {\n // I'm unsure if I feel this should return true. If there is no fir...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize the BinarySearchTree structure that we are going to use.
function initTree() { console.log('initTree'); gTree = new BinarySearchTree(); }
[ "function BinarySearchTree() {\n\tthis._root = null;\n}", "function MatchBinarySearchTree(){\n this._root = null;\n }", "function BinarySearchTree (value) {\n this.value = value;\n this.left = null;\n this.right = null;\n}", "function BinaryTree() {\n this._root = null;\n}", "function BinarySe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
uses jquery to find text on page and adds it to textNodes only looking at paragraph nodes
function findText() { $( "p" ).each(function( index ) { var paragraph = $( this ).text(); if (wordCount($( this ).text()) > 20) { textNodes.push($( this ).text()); } }); pickWords(); }
[ "static paragraphContains(text) {\n return By.xpath(`.//p[text() = '${text}']`);\n }", "function replaceTextNodes(node) {\n if (node.type === 'text') {\n let fragments = splitSentences(node.nodeValue);\n let html = '';\n fragments.forEach((frag) => {\n let datapll = basicRandomI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
press effect in header bar
function pressEffectHeader(filter, share, refresh, action) { var currentId = window.localStorage.getItem("divIdGlobal"); window.localStorage.setItem("pageNaveType", action); // restore icons if (action === "menu") { $("#headerTitle" + currentId).attr("src", "./images/icons/ic_launcher_full_menu.png"); } showNon...
[ "function pressEffectHeader() {\n\tvar currentId = window.localStorage.getItem(\"divIdGlobalPlugin\");\n\t// header press effect\n\tif ($.mobile.pageContainer.pagecontainer(\"getActivePage\")[0].id !== 'pluginPage') {\n\t\t$(\"#headerTitle\" + currentId).on('touchstart', function () {\n\t\t\t$(this).addClass(\"holo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update the keys on is an array of the new active keys whereas off is and array of the new disactivated keys
updateKeys(on, off) { for(var i of on) { this.active[i] = 1; } for(var i of off) { this.active[i] = 0; } }
[ "function updateActiveState() {\n const active = tableEditor.cursorIsInTable();\n if (active) {\n editor.setOption(\"extraKeys\", keyMap);\n }\n else {\n editor.setOption(\"extraKeys\", null);\n tableEditor.resetSmartCursor();\n }\n }", "function onChange(newKeys) {\n setActiveKe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether we should hide the cookie banner
function shouldHideCookieBanner() { //We don't want a cookie notification when embedded in editor controllers, we'll use the url to determine that var noCookieBanner = isIFrame() && /nocookiebanner=1/i.test(window.location.href); return noCookieBanner; }
[ "function hasBannerDismissCookie( cookieName ) {\n\t\tvar currentCookie = Cookies.get( cookieName );\n\n\t\tif ( ( typeof( currentCookie ) !== 'undefined' ) ) {\n\t\t\tif ( cookieName === 'ShowCoilPublicMsg' || cookieName === 'ShowCoilPartialMsg' ) {\n\t\t\t\treturn ( currentCookie === '1' ) ? true : false;\n\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Do fn.apply on a constructor.
function ctorApply(ctor, args) { F.prototype = ctor.prototype; var instance = new F(); ctor.apply(instance, args); return instance; }
[ "function ctorApply(ctor, args) {\n F.prototype = ctor.prototype;\n var instance = new F();\n ctor.apply(instance, args);\n return instance;\n }", "function applyNew(args){\n\t\t// create an object with ctor's prototype but without\n\t\t// calling ctor on it.\n\t\tvar ctor = args.ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Setting save events for all the SAVE buttons on the page If a save button is clicked, it will trigger camera.js and fetch to save the video to local file system as well as save the new video name to the JSON db
function setSaveEvent(data){ var theID = '#save_' + data.doc.index; scroll_id = '#save_' + data.doc.index; $(theID).click(function(){ $.each(jsonData.rows,function(i){ if(jsonData.rows[i].doc.index == data.doc.index){ console.log("we are SAVING " + data.doc.index); // Update the video name to JS...
[ "function saveVideo() {\n\t\tdocument.getElementById(\"preview_popup_container\").style.display = \"none\";\n\t\tdocument.getElementById(\"Studio\").onExternalPreviewPlayerPublish();\n\t}", "async handleSaveClick() {\n // this sets the button to a spinner\n this.setState({ isUploading: true });\n\n // up...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a method and it's inputs and labels
function addMethod(methodnumber) { let newMethod = document.querySelector(`.add-method-${methodnumber}`); newBreak = document.createElement("br"); oneMoreBreak = document.createElement("br"); newPar = document.createElement("p"); buttonRemoveMethod = document.createElement("button"); buttonRemo...
[ "addMethod(method) {\n this.methods.push(method);\n }", "function addMethod() {\n // Retrieve method name from form\n let methodName = document.getElementById(\"menu-name\").textContent;\n\n // Check that method selected is not the none one\n if (methodName != \"METHODS\") {\n // Find selec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get all the plants on db
async function getPlants() { refPlants.onSnapshot((querySnapshot) => { const items = []; querySnapshot.forEach((doc) => { items.push(doc.data()); }); setPlants(items); setFilteredPlants(items); }); }
[ "static async getAllPlants() {\n let res = await this.request(`plants`);\n return res;\n }", "function getPlants() {\n $.get(\"/api/plants\", function(data) {\n var rowsToAdd = [];\n for (var i = 0; i < data.length; i++) {\n rowsToAdd.push(createPlantRow(data[i]));\n }\n rende...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when the extension is deactivated
function deactivate() { example.deactivate(); console.log(`Extension(${example.name}) is deactivated.`); }
[ "function deactivate() {\r\n console.log(\"Preview Extension Shutdown\");\r\n}", "function deactivate() {\n\tconsole.log(\" Remainders extension was deactivted\")\n}", "OnDeactivated() {}", "function deactivateExtension() {\n Privly.options.setInjectionEnabled(false);\n updateActivateStatus(false);\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call this function passing a callback. The callback function will be called with the last SIP signaling message as specified by the current line and the dir/type parameters PARAMETERS dir: 0=incoming/received message, 1=out outgoing/sent message type: 0=any, 1=SIP request, 2=SIP answer, 3=INVITE (the last INVITE receiv...
function getsipmessage(dir, type, callback) { if ( !callback || typeof (callback) !== 'function' ) { return; } if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null) webphone_api.plhandler.GetSipMessage(dir, type,callback); else webphone_api.Log('ERROR, webph...
[ "_onReply(line) {\n // let isLast = this._isLastReply(line);\n // let code = this._parseReplyCode(line);\n // let isSuccess = this._isSuccessReplyCode\n\n console.log('AAAA')\n // this.emit('reply', line, {code, isLast, isSuccess});\n }", "function signalingMessage(muzzData, next){\n var _this = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
setting scale of widget
function applyScaleToWidget(widget, scaleObj) { if (scaleObj.sx === scaleObj.sy && scaleObj.sx === scaleObj.sz) { widget.SetScale(Number(scaleObj.sx)); } else { widget.SetScaleXYZ(Number(scaleObj.sx), Number(scaleObj.sy), Number(scaleObj.sz)); } }
[ "SetScale(double, double) {\n\n }", "_onScaleChanged(scale) {\n this._$canvas.css({\n width: this._maxWidth * scale + 'px',\n height: this._maxHeight * scale + 'px',\n });\n }", "updateScale() {\n this.scale = this.getDrawingScale();\n }", "function setScale() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns highscore of users sorted by their descending score. POST parameter 'limit' sets the number of users returned. Parameters location sets the geographical scope of the search.
function getHighscore(req, res, callback) { if (req.body.location) { userModel.User.find({ location: req.body.location }, (err, users) => { if (err) callback(cbs.cbMsg(true, err)); else callback(cbs.cbMsg(false, users)); }).sort({ 'game_score.total_score': DESCENDING_FLAG }).limit(parseInt(req.bod...
[ "function getMostPopularLocationInCategory(category){\r\n console.log(category);\r\n return DButilsAzure.execQuery(\"SELECT * FROM Locations WHERE category = '\" + category + \"'\")\r\n .then(function(result){\r\n var maxRate = result[0].rate;\r\n var popularLocation = result[0];\r\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdPatchGet
repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdPatchGet( incomingOptions, cb ) { const Bitbucket = require('./dist'); let defaultClient = Bitbucket.ApiClient.instance; // Configure API key authorization: api_key let api_key = defaultClient.authentications['api_key']; api_key.apiKey ...
[ "repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdGet(\n incomingOptions,\n cb\n ) {\n const Bitbucket = require('./dist');\n let defaultClient = Bitbucket.ApiClient.instance;\n // Configure API key authorization: api_key\n let api_key = defaultClient.authentications['api_key'];\n api_key...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find pairs in an integer array whose sum is equal to 10 (bonus: do it in linear time) O(n^2)
function pairInArray(array) { let result = []; for (let i = 0; i < array.length; i++) { for (let j = i + 1; j < array.length; j++) { if (array[i] + array[j] === 10) { let arr = [array[i], array[j]]; result.push(arr); } } } return re...
[ "function findPairsSumTen(arr) {\n var results = [];\n var hash = {};\n\n for (var i = 0; i < arr.length; i++) {\n hash[arr[i]] = i;\n }\n\n for (var j = 0; j < arr.length; j++) {\n var num = arr[j];\n var match = 10 - num;\n\n if (hash[match]) {\n results.push([j, hash[match]]);\n delete...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recarga los generos con el mismo codigo
function recargarGenero(select, codigo, genero) { // Busco todas las categorias con el codigo actual /*$('#nueva-mercaderia').find('tr td.fila-genero').each(function() { // Encuentro codigos iguales => escribo la descripcion if ($(this).parent().find('td.fila-codigo input').val()...
[ "function cargarCgg_res_persona_juridicaCtrls(){\n if(inRecordCgg_res_persona_juridica){\n txtCrpjr_codigo.setValue(inRecordCgg_res_persona_juridica.get('CRPJR_CODIGO'));\n tmpSectorProductivo = inRecordCgg_res_persona_juridica.get('CSCTP_CODIGO');\n\n if(inRecordCgg_res_pers...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a native element if a node can be inserted into the given parent. There are two reasons why we may not be able to insert a element immediately. Projection: When creating a child content element of a component, we have to skip the insertion because the content of a component will be projected. `delayed due to pr...
function getRenderParent(tNode, currentView) { // Nodes of the top-most view can be inserted eagerly. if (isRootView(currentView)) { return nativeParentNode(currentView[RENDERER], getNativeByTNode(tNode, currentView)); } // Skip over element and ICU containers as those are represented by a comme...
[ "function canInsertNativeNode(parent, currentView) {\n // We can only insert into a Component or View. Any other type should be an Error.\n ngDevMode && assertNodeOfPossibleTypes(parent, 3 /* Element */, 2 /* View */);\n if (parent.tNode.type === 3 /* Element */) {\n // Parent is an element.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
API host name used for Kinvey API requests.
get apiHostname() { return url.format({ protocol: this.apiProtocol, host: this.apiHost }); }
[ "get name() {\r\n return rapi_helpers.normalizeString(OS.hostname());\r\n }", "function setHost (host) {\n apiHost = host\n }", "function get_api_url() {\n if (location.hostname === \"localhost\" || location.hostname === \"127.0.0.1\" || location.hostname === \"\") {\n return \"http://lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Simple body of a alien
function alienBody(id) { var single = ` <div id="head`+ id + `" class="alien__head"> <div id="imgHeadDiv`+ id + `"> <img id="imgLogo`+ id + `" class="logoSize" alt="cryptoLogos"> </div> <div id="...
[ "function appleBody(x,y,arms=0,feet=0,feetCol=color(0,255,0)) {\n\tstroke(0);\t//black outline\n\tstrokeWeight(1);\n\t//outline of body (parallelogram)\n\tline((x-45),y,(x+45),y);\n\tline((x-75),(y+110),(x+15),(y+110));\n\tline((x-45),y,(x-75),(y+110));\n\tline((x+45),y,(x+15),(y+110));\n\tfill(feetCol);\t//colors ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Note this is not a generic hash code but rather a hash code used to check whether or not consent has changed across invocations
hashCode() { /* * We hash every properties except: * - localStoragePurposeConsent object since the consentString is enough to know. * - ccpaString as it doesn't contribute to the local storage decision. */ const {localStoragePurposeConsent, ccpaString, ...others} = this; return cyrb53Has...
[ "prelimHash() {\n return utils.hash(`${this.prevBlockHash}||${this.proof}`);\n }", "ComputeHash() {\n this.hash = 2166136261;\n this.hash *= 16777619;\n this.hash ^= this.minFilter;\n this.hash *= 16777619;\n this.hash ^= this.maxFilter;\n this.hash *= 16777619;\n this.hash ^= this.addres...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO. Handles the keyup event
handleKeyUp(){ }
[ "function keyupListener() {\n\n}", "function keyUp(event) {}", "function on_key_up(vkey) {}", "function keyUp(event) {\n inputManager.keyUp(event);\n }", "keyUp() {}", "function valueKeyupListener(e) {\n switch (e.which) {\n case 13:\n $(e.target).text($(e.target).text());\n $(\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An Iterable for the node IDs in this graph.
* iterNodeIds() { yield* this.nodes.keys(); }
[ "getNodeIds() {\n\t\treturn this.getNodes().map((n) => n.id);\n\t}", "getNodeIDs(){\n return Array.from(this.nodes.keys());\n }", "getGroupedNodeIds() {\n const ids = [];\n Object.values(this.nodes).forEach(node => (node.group ? ids.push(node.index) : null));\n return ids;\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send contentevent to the background handler.
function _processContentEvent(event) { //console.log("_handleContentEvent"); // get current content (lazily load) let theContent = _getContent(event); if (theContent.length > 0 && _containsPrintableContent(theContent)) { event.value = JSON.stringify(theContent); event.last = (new Date(...
[ "function backgroundMessageReceived(msg) {}", "handleBackgroundClick(event) {\n this.$emit('backgroundClick', event);\n }", "function messageBackground(flow) {\n\t\tchrome.runtime.sendMessage(flow);\n\t}", "function sendEvents() {\n console.log(\"sending events to content script\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Operation: getQueryParamObject summary: Test query parameters req.query: type: object properties: int1: type: integer int2: type: integer valid responses: '200': description: ok
async getQueryParamObject(req) { if ( typeof req.query.int1 !== "number" || typeof req.query.int2 !== "number" ) { throw new Error("req.params.int1 or req.params.int2 is not a number"); } return ""; }
[ "async getQueryParam(req) {\n\t\tif (\n\t\t\ttypeof req.query.int1 !== \"number\" ||\n\t\t\ttypeof req.query.int2 !== \"number\"\n\t\t) {\n\t\t\tthrow new Error(\"req.params.int1 or req.params.int2 is not a number\");\n\t\t}\n\t\treturn \"\";\n\t}", "get _queryObject() {\n return queryParamsGetQueryObject(this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }