query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Generate a Iterator that can walk a Trie and yield the words.
function iteratorTrieWords(node) { return walk(node) .filter((r) => isWordTerminationNode(r.node)) .map((r) => r.text); }
[ "words() {\n return iteratorTrieWords(this.root);\n }", "words() {\n return util_1.iteratorTrieWords(this.root);\n }", "words() {\n return (0, trie_util_1.iteratorTrieWords)(this.root);\n }", "traverse (str, callbackfn, thisArg) {\n let cur = this.trie\n for (let i = 0; i < str.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Once and done at the load of this page: load array of zones containing an / aircraft carrier or an airbase and copy data for aircraft availability / array aircraftSources[] from the ships array.
function loadAircraftSources() { landingZones = []; aircraftSources = []; for (var i = 0; i < ships.length; i++) { var ship = ships[i]; if (canHasAircraft(ship)) { if ($.inArray(ship.Location, landingZones) == -1) { landingZones.push(ship.Location); ...
[ "function loadShipZones() {\n shipZones.length = 0;\n for (var i = 0; i < ships.length; i++) {\n if (ships[i].ShipType != \"BAS\" && isNumber(ships[i].Location.substr(1, 1))) {\n if ($.inArray(ships[i].Location, shipZones) == -1) {\n shipZones.push(ships[i].Location);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
We map to a button / box iff it is not rectangle kind of element (as defined in buttonTypes) and the style is not too complex
isButton (element) { if (this.buttonTypes.indexOf(element.type) >=0 ){ return !this.isTooComplexStyle(element) } return false }
[ "createButton(buttonSpec) {\n let newButton;\n switch (buttonSpec.type) {\n case 'simple':\n newButton = new Button(buttonSpec, false, this, this.box, this.box.widthPix, this.box.heightPix);\n break;\n case 'safety':\n newButton = new ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if we're on a touchenabled device. Requires Modernizr to run, otherwise simply returns false
function _isTouchDevice() { return window.Modernizr && Modernizr.touch; }
[ "function _isTouchDevice() {\n\t return window.Modernizr && Modernizr.touch;\n\t }", "function isTouchDevice() {\r\n\t\t\treturn !!('ontouchstart' in window) || ( !! ('onmsgesturechange' in window) && !! window.navigator.maxTouchPoints);\r\n\t\t}", "function is_touch_device() {\r\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return library by given id
getLibrary(id) { return knex("libraries").where("id", id).first(); }
[ "function getLibFromId(id) {\n\t\t// Resolve id from dependent libraries\n\t\tfor (var libName in options.libs) {\n\t\t\tvar lib = options.libs[libName];\n\n\t\t\tif (id.indexOf(libName + '/') === 0) {\n\t\t\t\treturn lib;\n\t\t\t}\n\t\t}\n\t}", "async library(id) {\n if (this.__library[id]) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
to change current page index then refresh the sms list
function sms_pageNav(to) { g_temp_pageIndex_status = g_sms_pageIndex; switch(to) { case "first": g_sms_pageIndex = 1; break; case "last": g_sms_pageIndex = g_sms_totalSmsPage; break; case "prePage": g_sms_pageIndex --;...
[ "function editPage (index) {\n ind = index;\n switchPage();\n refreshPage();\n}", "function changePageNum(newPage) {\n $(\"#page-number\").empty();\n $(\"#page-number\").text(\"Page \" + pageNum);\n $(\"tBody\").empty();\n params = getParams(urlVariables[0], urlVariables[1], radius,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
build html modal confirmation
function notification_modal_confirm() { header_style = 'style="background-color: #1DB198; color: #ffffff;"'; var modal = '<div class="modal fade" id="modal_div" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">'; modal += '<div class="modal-dialog">'; modal += '<div class=...
[ "function createConfirm(message_confirm, title, isConfirm) {\n // <!-- Modal -->\n if (title === null) {\n if (isConfirm === true)\n title = \"Confirmaci&oacute;n\";\n else\n title = \"Mensaje\";\n }\n var html = '<div class=\"modal fade\" id=\"modalConfirm\" tabindex=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide all tool panels.
hideTools() { let tools = this.querySelectorAll('.panel-nav > span.panel-nav-item'); if (tools.length) { Array.prototype.forEach.call(tools, (el) => el.classList.remove('is-selected')); } let tool = this.querySelector('.panel-tool'); let toolRect = tool.getBoundingClientRect(); if (!tool.style.display &&...
[ "function hideAllPanes() {\n hideInformation();\n hideIndicators();\n }", "function hideAllMainPanels() {\n $(\".mainPanels\").hide();\n }", "function hideActiveTools() {\n // Undisplay all the active tool groups\n $(\".active-tools-group\").css({ display: \"none\" });\n\n // Remov...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Functions for mapping base artefact (identifiable etc.)
function mapIdentifiableArtefact (node) { var result = { id: getAttrValue(node, 'id'), urn: getAttrValue(node, 'urn'), uri: getAttrValue(node, 'uri'), package: getAttrValue(node, 'package'), class: getAttrValue(node, 'class'), annotations: mapAnnotations(node) }; if (res...
[ "function _makePrimMaps() {\n if (_primToMaterial) return;\n _primToMaterial = {\n point: MATERIAL_TYPES.POINT\n };\n _primToFunc = {};\n var key;\n for (key in wirePrimitives) {\n _primToMaterial[key] = MATERIAL_TYPES.L...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function calling chat when you have the banner
function goToChat() { origin; jQuery(".chat_banner").hide(); jQuery(".banner-modal-box").slideDown(); jQuery("#history_div").mCustomScrollbar({ theme: "dark-thick", }); document.getElementById('input_area').focus(); chat(); }
[ "function showonlychat(){\n activetab();\n mostrarChats();\n ocultarLlamadas();\n ocultarEstados();\n}", "function banner(message){\n\tglobal.banner(message);\n}", "function acceptChat() {\n\n}", "function startMusaChat() {\n $(\"#musa\").on(\"click\", function () {\n $(\".contacts\").addClass...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Request certificate fields for the selected certificate in the hierarchy.
function showCertificateFields() { clearCertificateFields(); const item = $('hierarchy').selectedItem; if (item && item.detail.payload.index !== undefined) { chrome.send('requestCertificateFields', [item.detail.payload.index]); } }
[ "function selectCertLevel() {\n\n\t// ordered by cert_std and min_score ascending\n\tvar sortValues = [];\n\tsortValues.push( {\n\t\tfieldName : 'gb_cert_levels.cert_std',\n\t\tsortOrder : 1\n\t});\n\tsortValues.push( {\n\t\tfieldName : 'gb_cert_levels.min_score',\n\t\tsortOrder : 1\n\t});\n\tvar res = abGbCertProj...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if a category is rate limited
function isRateLimited(limits, category, now = Date.now()) { return disabledUntil(limits, category) > now; }
[ "function isRateLimited(limits, category, now = Date.now()) {\n return disabledUntil(limits, category) > now;\n }", "function isRateLimited(limits, category, now) {\n if (now === void 0) { now = Date.now(); }\n return disabledUntil(limits, category) > now;\n}", "function checkCategoriesLimits() {\n\tv...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! Listeners Reload if listens state props changed
onChangeListener() { const state = this.getState(); const listen = this.props.listen || Object.keys(state); const listens = Array.isArray(listen) ? listen : [listen]; if (state && listens.some(listen => !isEqual(state[listen], this.data[listen]))) { this.data = state; this.isEmpty = f...
[ "_dispatchChange() {\n if (!this.ready) { return; }\n for (let id in this.listeners) {\n this.listeners[id](R.clone(this.data));\n }\n }", "function checkPropsChange() {\n _onStateChange(getState())\n }", "update() {\n this.listeners.forEach(f => f(this.store))\n }", "storeChanged...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
real width of graph
function getGraphWidth() { return width - xOffset * 2; }
[ "function set_graph_width () {\n\tdataset.graph_width = get_output_nodes().length;\n}", "nodeWidth () {\n return this.scale.x.nodeSize\n }", "function getWidth() {\n return width;\n }", "get width() {\n return this.scale.x * this.getLocalBounds().width\n }", "width() {\n return this._n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calls the willTransitionFrom hook of all handlers in the given matches serially in reverse with the transition object and the current instance of the route's handler, so that the deepest nested handlers are called first. Returns a promise that resolves after the last handler.
function runTransitionFromHooks(matches, transition) { var promise = Promise.resolve(); reversedArray(matches).forEach(function (match) { promise = promise.then(function () { var handler = match.route.props.handler; if (!transition.isAborted && handler.willTransitionFrom) return handler.wi...
[ "function runTransitionToHooks(matches, transition) {\n var promise = Promise.resolve();\n\n matches.forEach(function (match) {\n promise = promise.then(function () {\n var handler = match.route.props.handler;\n\n if (!transition.isAborted && handler.willTransitionTo)\n return handler.willTran...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle 'views' combo change; load the selected page
function View_Change() { strURL = document.getElementById('cmbEntityViews').value; window.location.assign(strURL); }
[ "function loadSelectedView(oView, bFirst) { \n\n\tif (!oView) { \n\t\ttoastr.warning(\"Invalid selected view, no id found!\");\n\t\treturn;\n\t}\n\t\n\t//Get last selected view Id\n\tvar lastSelectedViewId = (_oSelectedView ? _oSelectedView._id : \"\");\n \n\t//Stop all launched \n\tif (isBusy()) { \n\t\tif (lastS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes a native node itself using a given renderer. To remove the node we are looking up its parent from the native tree as not all platforms / browsers support the equivalent of node.remove().
function nativeRemoveNode(renderer, rNode, isHostElement) { var nativeParent = nativeParentNode(renderer, rNode); if (nativeParent) { nativeRemoveChild(renderer, nativeParent, rNode, isHostElement); } }
[ "function nativeRemoveNode(renderer, rNode, isHostElement) {\n const nativeParent = nativeParentNode(renderer, rNode);\n if (nativeParent) {\n nativeRemoveChild(renderer, nativeParent, rNode, isHostElement);\n }\n}", "function nativeRemoveChild(renderer, parent, child, isHostElement) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Xpath for Race Result
get Homescreen_RaceResult() {return browser.element("//XCUIElementTypeOther[@name='z RACE RESULTS']");}
[ "get meetingRaceList_RaceStatus() {return browser.element(\"//android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup[2]\");}", "get raceMeetingOverview_RaceCondition() {return browser.element(\"//android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup[3]/android.view.ViewGroup[1]\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions to show & hide information window function to retrieve mouse xy pos
function fngetMouseXY(e) { // x-y pos.s if browser is IE if (IE) { var position=getScrollingPosition(); mintXPos = event.clientX + position[0]; mintYPos = event.clientY + position[1]; } else { // x-y pos if browser is NS mintXPos = e.pageX; mintYPos = e.pageY; } ...
[ "function showCoordinates(evt) {\n //the map is in web mercator but display coordinates in geographic (lat, long)\n var mp = webMercatorUtils.webMercatorToGeographic(evt.mapPoint);\n //display mouse coordinates\n dom.byId(\"info\").innerHTML = mp.x.toFixed(6) + \", \" + mp.y.toFi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the Splitter parent of a Layout item
getItemGroupElement(item) { const that = this; if (!that.isReady || !item || !(item instanceof JQX.TabsWindow) || !that.contains(item)) { return; } return item.closest('jqx-splitter'); }
[ "get parentItem() {\n const parentItem = getParentItem(this.rootItem, this.dataPath, true) || null\n return parentItem !== this.item ? parentItem : null\n }", "get parentItem() {\n const item = (\n getParentItem(this.rootItem, this.dataPath, this.nested) ||\n null\n )\n return item !== t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the site users
get siteUsers() { return new SiteUsers(this); }
[ "function getUsers() {\r\n var users = '';\r\n /* With new array make URLs to get offline user's data */\r\n users = urlUsers + offlineChannels.pop();\r\n getData(users, showUsers);\r\n}", "function findAllUsers() {\n return fetch(self.url).then(function(response) {\n return response.json();\n });\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Scan all files for property names, and return them as completions
getPropertyNameCompletions() { let results = []; this.enumerateBrsFiles((file) => { results.push(...file.propertyNameCompletions); }); return results; }
[ "getPropertyNameCompletions() {\n let results = [];\n this.enumerateFiles((file) => {\n results.push(...file.propertyNameCompletions);\n });\n return results;\n }", "function _CompletionCandidatesOfProperty() {\n}", "function completeProperties(startProp) {\n var compl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Print the header in ascii format.
function printHeaderAscii(headerStructure) { // headerStructure is something like: // [ // [ {fieldName: '', width: 30}, {fieldName: 'a', width: 30}, ...], // [ {fieldName: '', width: 30}, {fieldName: '', width: 8}, ...], // ... // ] var rowSep; head...
[ "function _printHeader(){\n sys.log(sys.product.meta.getHeaderText());\n }", "_printHeader() {\n console.log(chalk.blue(' =============================='));\n console.log(chalk.blue('-------============ 2048 ============-------'));\n console.log(chalk.blue(' ==============================...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Postprocessing view state fixing this appends basically the incoming view states to the forms. It is called from outside after all forms have been processed basically as last lifecycle step, before going into the next request.
fixViewStates() { ofAssoc(this.internalContext.getIf(Const_1.APPLIED_VST).orElse({}).value) .forEach(([, value]) => { const namingContainerId = this.internalContext.getIf(Const_1.NAMING_CONTAINER_ID); const namedViewRoot = !!this.internalContext.getIf(Const_1.NAMED_VIEWROOT)....
[ "function resolveViewState(parentItem) {\n const viewStateStr = (0, Const_1.$faces)().getViewState(parentItem.getAsElem(0).value);\n // we now need to decode it and then merge it into the target buf\n // which hosts already our overrides (aka do not override what is already there(\n // after that we nee...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds page navoutput, sprint progress output then places them on the page. And sets page title.
function buildPage() { var navOutput = '<select id="sprintSelector" style="width:100px;" onchange="changeCurrentSprint()">'; var contentOutput = '<table cellspacing="0" width="100%" class="ms-rteTable-0"><tbody><tr class="ms-rteTableEvenRow-0">'; var sProgress; //Build navigation output. for (var i = 0; i < spri...
[ "function createTitlePages() {\n let titleInfo = [\n { num:'1', title:'General Provisions' },\n { num:'2', title:'Elections'},\n { num:'3', title:'Legislature'},\n { num:'4', title:'State Organization and Administration, Generally'},\n { num:'5', title:'State Financial Administration'},\n { num:'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Control if schema station is valid.
static async isValidObject (object) { return Station.validator.validate('station.schema.json', object); }
[ "function dataValidationNotOk (data, schema) {\r\n return false\r\n}", "isValid(data, schema) {\n \n }", "isValid(){\n return (this.header !== undefined && this.header !== \"\" && this.datatype !== undefined);\n }", "function validateSchema(schema){\n\treturn true;\n}", "function isVa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Light scroll (which triggers less often and not in realtime)
function lightScroll(callback, delay){ var timer, delay = delay || 80, scrollCounter = 0; $(window).on('scroll', function(e) { // Count scroll ticks and force callback execution on a specific count scrollCounter++; if( scrollCounter > 8 ){ dlog_verbose('Scroll tick'); callb...
[ "function lightScroll(callback, delay){\n var timer,\n delay = delay || 80,\n scrollCounter = 0;\n\n $(window).on('scroll', function(e) {\n \n // Count scroll ticks and force callback execution on a specific count\n scrollCounter++;\n if( scrollCounter > 8 ){\n callback();\n scroll...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a new contactEmailAddress
static create(contactEmailAddress) { return __awaiter(this, void 0, void 0, function* () { try { const newContactEmailAddress = (yield db_1.db.write.table('ContactEmailAddresses').insert(contactEmailAddress).execute()).rowCount; return (newContactEmailAddress == 1) ? ...
[ "function postEmailAddress(req, res){\n //Get post parameters\n var newEmailName = req.body.email;\n var fullName = req.body.full_name;\n var domain = req.body.domain;\n var password = req.body.password;\n\n if(isString(fullName) && isString(password) && isDomain(domain) && isLocal(newEmailName)){...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert the parse tree output by the parser into an ordered list of atoms and bonds to render. Args: atoms: the output list of atoms that we're in the process of building. This should be the empty list if not being called recursively. bonds: the output list of bonds that we're in the process of building. This should be...
function convertTree(atoms, bonds, tree) { if (tree === null) { return [atoms, bonds]; } if (tree.type === "atom") { var treeIdx = idxString(tree.idx); atoms[treeIdx] = { idx: treeIdx, symbol: tree.symbol, connections: [] }; if (tree.bonds) { tree.bonds.fo...
[ "function convertTree(atoms, bonds, tree) {\n if (tree === null) {\n return [atoms, bonds];\n }\n\n if (tree.type === \"atom\") {\n var treeIdx = idxString(tree.idx);\n atoms[treeIdx] = {\n idx: treeIdx,\n symbol: tree.symbol,\n connections: []\n };\n\n if (tree.bonds) {\n tree...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempt to reconnect the web socket in 5 seconds.
function reconnectWebSocket() { window.setTimeout(() => { connectWebSocket(); }, 5000); }
[ "reconnectAfterTime() {\n\t\t//this.logger.info(\"Reconnecting after 5 sec...\");\n\t\tsetTimeout(() => {\n\t\t\tthis.connect();\n\t\t}, 5 * 1000);\n\t}", "reconnect() {\n this.debug('Attemping to reconnect in 5500ms...');\n /**\n * Emitted whenever the client tries to reconnect to the WebSocket.\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a Tech Props tag. pageID: required. Page ID to set on this Pageview tag
function cmCreateTechPropsTag(pageID, categoryID) { if (!pageID) { pageID = getDefaultPageID(); } var cm=new _cm("tid", "6", "vn2", "e3.1"); cm.pc="Y"; cm.pi = pageID; cm.cg = categoryID; // if available, override the referrer with the frameset referrer if (parent.cm_ref != null) { cm.rf = myNormalizeURL(pa...
[ "function cmCreateTechPropsTag(pageID, categoryID) {\r\n\tif(pageID == null) { pageID = cmGetDefaultPageID(); }\r\n\tcmMakeTag([\"tid\",\"6\",\"pi\",pageID,\"cg\",categoryID,\"pc\",\"Y\"]);\r\n}", "function cmCreateTechPropsTag(pageID, categoryID) {\r\n\r\n\tif(pageID == null) {\r\n\t\tpageID = cmGetDefaultPageID...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
= Description Creates and returns a new Rect that minimally but completely encloses the area defined by this Rect and the specified Rect. = Parameters +_rect+:: A HRect instance to compare to. = Returns A new HRect instance.
union(_rect) { return new HRect( Math.min(this.left, _rect.left), Math.min(this.top, _rect.top), Math.max(this.right, _rect.right), Math.max(this.bottom, _rect.bottom) ); }
[ "intersection(_rect) {\n return new HRect(\n Math.max(this.left, _rect.left), Math.max(this.top, _rect.top),\n Math.min(this.right, _rect.right), Math.min(this.bottom, _rect.bottom)\n );\n }", "getRectangle(rect) {\n return this.minX > this.maxX || this.minY > this.maxY ? Rectangle.EMPTY : (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Report Scraper Template scrapes a battle report for information
function twcheese_BattleReportScraper(gameDocument) { try { this.gameDocument = gameDocument; this.attackerTable = gameDocument.getElementById('attack_info_att'); this.attackerUnitsTable = gameDocument.getElementById('attack_info_att_units'); this.defenderTable = gameDocument.getElementById('attack_in...
[ "function twcheese_scrapeBattleReport(gameDoc)\n\t{\n\t\tvar reportScraper = new twcheese_BattleReportScraper(gameDoc);\n\n\t\tvar report = new twcheese_BattleReport;\n\t\treport.attacker = reportScraper.getAttacker();\n\t\treport.attackerLosses = reportScraper.getAttackerLosses();\n\t\treport.attackerQuantity = re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check whether the digit string exists in the digitArray
function isDigitExist(/*String:digit string for checking*/ digit, /*Array : current generated array of digits*/ digitArray) { return (digitArray.indexOf(digit)==-1) ? false : true; }
[ "function isRepdigit(n){\n let arr = n.toString().split('')\n const x = (val) => val === arr[0];\n return arr.every(x);\n}", "contains(num, arr) {\n\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === num) {\n return true;\n }\n }\n return false;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Layout selection incorporates previews and the old next window
function chooseLayout(layout) { // yay for half-baked data storage schemes layout = layout || document.cookieHash['layout'] || 'default'; // in case we're being called externally, make the UI match $('#layoutSelector').val(layout); $("#nextWindowConfirmation").hide(); console.log("Setting layout to " + lay...
[ "function setLayout(){\n\n}", "function postlayout() {\n scrollable.views[getPageFromIndex(currentVirtualIndex)].children[0].focus();\n scrollable.removeEventListener(\"postlayout\", postlayout);\n }", "async changePageLayout() {\n await this.content.$eval(this.sel.pageSettin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Coerces a value to a CSS pixel value.
function coerceCssPixelValue(value) { if (value == null) { return ''; } return cssUnitsPattern.test(value) ? value : `${value}px`; }
[ "function pixelValue(value) {\n return value + 'px';\n}", "function coerceCssPixelValue(value) {\n if (value == null) {\n return '';\n }\n return cssUnitsPattern.test(value) ? value : value + \"px\";\n}", "function getPixelValue(value) {\n return parseFloat(value.replace(\"px\", \"\"));\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles click on polygon. Updates id in body via method
handlePolyClick(polygon) { if (polygon.id != undefined) { this.props.updateId(polygon.id); } }
[ "function onClickPolygon(e) {\n if (document) {\n if (self.state.unClickable) {\n return;\n }\n //this.showInfoPolygon(e.target);\n $('#' + e.target.bmId).modal('toggle');\n }\n }", "function onPolygonClick...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles click on carousel's arrows.
_handleArrowClick(event) { const that = this, previousIndex = that._currentIndex; if (that.disabled) { return; } that.$.arrowLeft.contains(event.target) ? that.prev() : that.next(); that._changeEvent(previousIndex, that._currentIndex); }
[ "_handleArrowClick(event) {\n const that = this,\n previousIndex = that._currentIndex;\n\n if (that.disabled) {\n return;\n }\n\n if (that.rightToLeft) {\n that.$.arrowLeft.contains(event.target) ? that.next() : that.prev();\n }\n else {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw domain name in the center
function drawDomainTitle(domain, ICH_num) { var words = _translationsDomains__WEBPACK_IMPORTED_MODULE_6__["default"][language].domain; var offset = -30; ctx_nodes.textAlign = 'center'; ctx_nodes.fillStyle = 'black'; ctx_nodes.font = 'normal normal 400 22px ' + font_family; ctx_nodes.fillText(ICH...
[ "showReducedDomain(set) {\n if (set.size > 0) {\n let str = `Reduced Domain : (${[...set].toString()})`;\n this.domainWrapper.append('text')\n .attr('class', 'domain-text')\n .attr('x', this.w / 2)\n .attr('y', this.h / 1.5)\n .text(str);\n }\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check if the user's username will be unique for the teams they are on
async checkUsernameUnique () { if (this.notSaving && !this.teamIds) { // doesn't matter if we won't be saving anyway, meaning we're really ignoring the username return; } let teamIds = this.teamIds || []; if (this.existingModel) { const existingUserTeams = this.existingModel.get('teamIds') || []; if...
[ "async checkUniqueness () {\n\t\tthis.notUniqueTeamIds = [];\n\t\tObject.keys(this.usernamesByTeam).forEach(teamId => {\n\t\t\tif (this.usernamesByTeam[teamId].includes(this.username.toLowerCase())) {\n\t\t\t\tthis.notUniqueTeamIds.push(teamId);\n\t\t\t}\n\t\t});\n\t\tthis.isUnique = this.notUniqueTeamIds.length ==...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Opens a text box for editing.
function openForEditing(box) { codeReporter("openForEditing()"); // Save old text to variable. var old_text = $(box).text(); old_text = old_text.replace(/\s+/g, " ").trim(); // The saved text needs extra whitespace to be stripped. // Hide old text so that the box is the correct size. $(box).text(""); $(bo...
[ "function openTextBox(){\n\tdocument.getElementById('textbox').style.display = document.getElementById('textbox').style.display == 'block' ? 'none' : 'block';\n}", "edit(text) {\n this.text = text;\n }", "function edit()\n{\n\t//Unselect text from doubleclick. \n\twindow.getSelection().removeAllRanges();\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the specified filter if it contains a namespace.identifier & exists.
function removeFilter(filter, callback) { if ('string' === typeof filter) { _removeHook('filters', filter, callback); } return MethodsAvailable; }
[ "function deregisterFilter(filter/*:Function*/)/*:void*/ {\n if (filter) {\n var pos/*:int*/ = this.filters$A04Z.indexOf(filter);\n if (pos >= 0) {\n this.filters$A04Z.splice(pos, 1);\n }\n }\n }", "function removeFilter(filter, callback) {\n if (typeof filter === 'string') {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Refreshes the endpoint list by retrieving the writable and readable locations from the georeplicated database account and then updating the locations cache. We skip the refreshing if EnableEndpointDiscovery is set to False
refreshEndpointList() { return __awaiter(this, void 0, void 0, function* () { let writableLocations = []; let readableLocations = []; let databaseAccount; if (this.enableEndpointDiscovery) { databaseAccount = yield this._getDatabaseAccount(); ...
[ "refreshEndpointList() {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.isRefreshing && this.enableEndpointDiscovery) {\n this.isRefreshing = true;\n let shouldRefresh = false;\n const databaseAccount = yield this.getDatabaseAccount...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A helper function that converts the Date instance 'dateObj' into a string that represents this date in English.
function getLocaleDateString(dateObj){ console.log('entered into getLocaleDateString function'); return dateObj.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', timeZone: timeZone }); }
[ "function getLocaleDateString(dateObj) {\n return dateObj.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', timeZone: timeZone });\n}", "function getLocaleDateString(dateObj){\n return dateObj.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', timeZone: t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update mention tweets on frontend Poll twitter every few seconds;
function pollMentionTweets() { setTimeout(updateMentionTweets, TWITTER_POLL_INTERVAL); }
[ "function respondToTweet(event) {\n // sanitise tweet text by removing punctuation and converting to lowercase\n var text = event.text;\n text = text.toLowerCase().replace(/[.,\\/#!$%\\^&\\*;:{}=\\-_`~()?]/g, '');\n\n oscClient.send('/update', text, event.user.profile_link_color, function (err) {\n if (err) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets event listeners for close button on output images.
function setRemoveImageListeners() { document .querySelectorAll('.output-image-container > .close-button') .forEach((closeButton) => { closeButton.addEventListener('click', (e) => { outputImages.splice(Number(e.target.dataset.index), 1); // Displaying no. ...
[ "function setRemoveImageListeners() {\n document\n .querySelectorAll('.output-image-container > .close-button')\n .forEach((closeButton) => {\n closeButton.addEventListener('click', (e) => {\n outputImages.splice(Number(e.target.dataset.index), 1);\n // Displaying no. of images on deletion...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to clear tip calculator
function clearTip() { amount.value = ""; percentage.value = ""; numPeople.value = "" output.textContent = ""; }
[ "clearTip() {\n if (this.tip) {\n this.tip.remove();\n }\n }", "function clearTip() {\r\n\t\tthis.isFocused = false;\r\n\t\tthis.isValid = true;\r\n\t\tfor ( var x=0; x<this.tipArr.length; x++ ) {\r\n\t\t\tvar ele = document.getElementById(this.fldArr[x]+'warn');\r\n\t\t\tif (ele) ele.innerHTML = '';\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends the request to IMEXWEB API to retrieve freight load data, using access_token cookie. page=1 shows the first PAGE_LIMIT elements, page=2 shows the second PAGE_LIMIT elements, etc...
function getFreightLoads(page) { startLoadingAnimation(); if (getCookie("access_token") == null) return; $.ajax({ url: (API_PATH_FL + "?fromDate=2000-01-01&toDate=" + dateTodayStr()), dataType: 'json', type: 'get', contentType: 'application/x-www-form-urlencoded', beforeSend: functio...
[ "function requestList(api_key, user, page_count){\n var requests = [];\n for(var page = 1; page <= page_count; page++){\n requests.push(requestData(api_key, user, page))\n }\n return requests\n}", "function MS_requestAPI( link, loadFun, errFun )\r\n{\r\n\tGM_xmlhttpRequest(\r\n\t{\r\n\t\tmethod: \"GET\",\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
and "find_successors" functions Returns: null if no goal state found Returns: object with two members, "actions" and "states", where: actions: Sequence(Array) of action ids required to reach the goal state from the initial state states: Sequence(Array) of states that are moved through, ending with the reached goal stat...
function breadth_first_search(initial_state) { let open = []; //See push()/pop() and unshift()/shift() to operate like stack or queue //https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array let closed = new Set(); //https://developer.mozilla.org/en-US/docs/Web/JavaS...
[ "function find_successors(state) {\n ++helper_expand_state_count; //Keep track of how many states are expanded (DO NOT REMOVE!)\n \n let successors=[];\n const actions = {\n 1: [-1, 0],\n 2: [1, 0],\n 3: [0, -1],\n 4: [0, 1]\n }\n\n const blankPosition = find_blank(state);\n\n for (var i = 1; i <...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recalculate drag/swipe event and reposition the frame of a slider
updateAfterDrag() { const movement = (this.slider.rtl ? -1 : 1) * (this.drag.endX - this.drag.startX); const movementDistance = Math.abs(movement); const howManySliderToSlide = this.slider.perPage; const slideToNegativeClone = movement > 0 && this.slider.currentSlide - howManySliderToSl...
[ "_updateDragPosition() {\r\n // Current position + the amount of drag happened since the last rAF.\r\n const newPosition = this._wrapperTranslateX +\r\n this._pointerCurrentX - this._pointerLastX;\r\n \r\n // Get the slide that we're dragging onto.\r\n let slideIndex;\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Registers command in the editor
registerCommand(command){ this.get('commands').push(command); command.register && command.register(this); }
[ "function addCommand(name, command) {\n CodeMirror.commands[name] = command;\n }", "function addCommand(name, command) {\n codemirror_1.default.commands[name] = command;\n }", "_addCommands() {\n\n const editor = this.editor;\n\n // Add command to open the formula editor\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Complete a poll. No votes would be accepted since then. address: Poll address, returned fom startPoll options: Ethereum tx send options.
async function endPoll(web3, address, options) { const contract = new web3.eth.Contract(pollInfo.abi, address); const methods = contract.methods; var active = await methods.isActive().call(); if (active) { const result = await methods.closePoll().send(options); const receipt = await web...
[ "endPoll(event) {\n if (event) event.preventDefault();\n // end the poll\n this.props.objects.Voting.endPoll(parseInt(this.endPollID.value), {\n from: this.props.objects.accounts[this.props.curAccount],\n gas: GAS\n })\n .then(result => {\n // call the helper function to create an Enig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the set of enabledTasks of a given model
function getEnabled(modelName) { var res = new Set(); for (var instanceId in instanceMap) { if (modelName == instanceMap[instanceId].modelName) { for (var taskId of instanceMap[instanceId].enabledSet) res.add(taskId); } } return res; }
[ "function getModelTasks(modelName) { \n var res = [];\n for(var id in instanceMap){\n if(modelName == instanceMap[id].modelName){\n for(var task of getInstanceTasks(id)) res.push(task);\n }\n }\n return res;\n }", "function getActiveTasks() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check that the binary exists and works
check (cb) { if (this.checked) return cb() binWrapper.run(['version'], (err) => { // The binary is ok if no error poped up this.checked = !err return cb(err) }) }
[ "function hasBinary(binaryPath) {\n return fs.existsSync(binaryPath);\n}", "externalBinariesExist() {\n return this.requiredExternalBinaries.every(binary => _which.default.sync(binary, {\n nothrow: true\n }) !== null);\n }", "function CoreBinaryExists() {\n log.info('Checking if core binary exists...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change button status when use click on yes no of show testimonials
function displayTestimonials(value) { $.ajax({ url : HOST_PATH + "admin/accountsetting/save-testimonials", data : { content: value , type : "showTestimonial" }, method : "post", dataType : "json", type : "post", success : function(json) { if (value == 1) { $('button#btnSho...
[ "function handleButtonState() {\n if (testimonials[0].classList.contains(\"testimonial-active\")) {\n prev.disabled = true;\n } else {\n prev.disabled = false;\n }\n if (\n testimonials[testimonials.length - 1].classList.contains(\n \"testimonial-active\",\n )\n ) {\n next.disabled = true;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make sure the migration directory exists.
ensureMigrationDirectory() { try { fs.statSync(this.config.directory); } catch (error) { mkdirp.sync(this.config.directory); } }
[ "function migrationsCheck(cb) {\n\t\tfs.stat(path.join(process.cwd(), 'migrations'), function(err, stats) {\n\t\t\tif(err || !stats.isDirectory()) {\n\t\t\t\tcb();\n\t\t\t} else {\n\t\t\t\tcb(new Error('Migrations directory already exists.'));\n\t\t\t}\n\t\t});\n\t}", "function migrationsCheck(cb) {\n\t\tfs.stat(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adding an event to favourites
function addFavourite(event, day, id, cbSucces, cbError) { if (!Modernizr.geolocation) { cbError("No HTML5 geolocation available") return } if (localStorage['day_' + day + 'favourites'] == undefined) { favouriteEvents = []; favouriteEvents.push(event); localStorage['day_' + day + 'favourites'] = JSON ...
[ "function addToFavorites(event) {\r\n const elemTarget = event.currentTarget;\r\n const seriesName = elemTarget.querySelector('h3').innerHTML;\r\n const seriesFavIndex = favoritesList.findIndex(\r\n (serie) => serie.show.name === seriesName\r\n );\r\n if (seriesFavIndex === -1) {\r\n elemTarget.classList...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
5. Write a function that takes an array of numbers and prints the smallest and largest numbers from the array.
function minAndMax(array) { var smallest = array[0]; var largest = array[0]; for (var i=0; i < array.length; i++) { if (array[i+1] > largest) { largest = array[i+1]; } } console.log("The largest number is " + largest + "."); for (var i=0; i < array.length; i++) { if (array[i+1] < smallest) { smallest ...
[ "function printLowReturnHigh(arr) {\r\n var min = arr[0];\r\n var max = arr[0];\r\n for (var i = 1; i < arr.length; i++) {\r\n if (arr[i] > max) max = arr[i];\r\n if (arr[i] < min) min = arr[i];\r\n }\r\n console.log(min);\r\n return max;\r\n}", "function smallestToBiggest(arr){\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get top risky shares
async getTopRiskyShares(ts, te) { let token = localStorage.getItem("interset_token"); axios.defaults.headers.common['Authorization'] = token; // console.log(ts); let url = `${API_URL}/api/search/0/shares/topRisky?sort=maximum&markup=false&tz=UTC%2B8&count=10&keepAlive=300000` if((ts!==0) && (te!==0)...
[ "async getTopAccessedShares(ts, te) {\n let token = localStorage.getItem(\"interset_token\");\n axios.defaults.headers.common['Authorization'] = token;\n // console.log(ts);\n let url = `${API_URL}/api/search/0/shares/topAccessed?sort=maximum&markup=false&tz=UTC%2B8&count=10&keepAlive=300000`\n if((t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Autoset attribute colorField by colorByAccessor property If an object has already a color, don't set it Objects can be nodes or links
function autoColorObjects(objects, colorByAccessor, colorField) { if (!colorByAccessor || typeof colorField !== 'string') return; objects.filter(obj => !obj[colorField]).forEach(obj => { obj[colorField] = autoColorScale(colorByAccessor(obj)); }); }
[ "function autoColorObjects(objects, colorByAccessor, colorField) {\n if (!colorByAccessor || typeof colorField !== 'string')\n return;\n var colors = schemePaired;\n // Paired color set from color brewer\n\n var uncoloredObjects = objects.filter(function(obj) {\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If some entity already added at same depth and index then no need to replace entityVal 'NOT_FOUND'
function checkIfEntityAlreadyAddedAtSameDepthAndIndex(entity, entityVal, depth, index){ if (context.keys.length > 0 && entityVal === 'NOT_FOUND') { let keyCount = context.keys.length; for(let k=0; k<keyCount; k++){ let foundDepth = context.keys[keyCount].depth; let foundIndex = context.keys[keyCoun...
[ "function ifEntityValueAlreadyAddedOrUpdated(entity, entityVal, type) {\n\t\t\tlet keyCount = context.keys.length;\n\t\t\tconsole.log('findBOTResponse: ifEntityValueAlreadyAddedOrUpdated: Inside with type = ' + type + ' entity = ' + entity + ' entityVal = ' + entityVal);\n\t\t\tif(type.toLowerCase() === 'entity') {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
First groups the observations by code using `byCode`. Then returns a function that accepts codes as arguments and will return a flat array of observations having that codes. Example: ```js const filter = client.byCodes(observations, "category"); filter("laboratory") // => [ observation1, observation2 ] filter("vitalsig...
function byCodes(observations, property) { const bank = byCode(observations, property); return (...codes) => codes.filter(code => code + "" in bank).reduce((prev, code) => prev.concat(bank[code + ""]), []); }
[ "function byCodes(observations, property) {\n var bank = byCode(observations, property);\n return function () {\n for (var _len = arguments.length, codes = new Array(_len), _key = 0; _key < _len; _key++) {\n codes[_key] = arguments[_key];\n }\n\n return codes.filter(function (code) {\n return c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads the last row, this is useful when we're done looking at others' results and are ready to play the latest new game.
loadLastRow() { loadAllRows().then((response) => this.receiveData(-1, response)); }
[ "function last() {\r\n //If the current puzzle is the first or second, just get data from local array.\r\n if (CurrentPuzzle < 2) {\r\n load(PuzzleArray[CurrentPuzzle]);\r\n }\r\n //If it's not, reload the puzzle from the freshPuzzle array. The freshPuzzle just\r\n //stores data for an unaltered version of ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Llamar a la ventana Pop Up de Gestor del Acta
function addGestorActa(codigo) { open('addGestor.do?codEntidad='+codigo,'','top=100,left=300,width=600,height=300') ; }
[ "function PopupAcciones() {\n\n this.$id_boton_checklist = $('#id_boton_checklist')\n this.$id_boton_plan_auditoria = $('#id_boton_plan_auditoria')\n this.init_Events()\n}", "function ventanaModal()\n {\n \n }", "function onOpen(e) {\n SpreadsheetApp.getUi()\n .createMenu('Caccia al Tesor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
// for getting tracks of playlists //// ////////////////////////////////////////////////// / map the spotify URI in the playlist and return an array of URIs
function mapUris(playlist) { return _.chain(playlist.items) .map(function(item) { return item.track.uri; }) .filter(function(uri) { // do not include URIs start with 'spotify:local', they are not in Echonest return uri.indexOf('spotify:track:') === 0; }) .value(); }
[ "function getTracks(playlist){\n return playlist.tracks;\n}", "function getPlaylistTrackIDs(playlist_url) {\n\tlet playlist_id = playlist_url.substring(37, 59);\n\t\t// Get tracks in a playlist\n\t\tspotifyApi.getPlaylistTracks(playlist_id, { offset: data_offset, limit: 100 })\n\t\t.then( function(data) {\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return true if the node at the top of the stack (that means the innermost node in the current output) is lexically the first in a statement.
function first_in_statement(stack) { let node = stack.parent(-1); for (let i = 0, p; p = stack.parent(i); i++) { if (p instanceof AST_Statement && p.body === node) return true; if ((p instanceof AST_Sequence && p.expressions[0] === node) || (p.TYPE === "Call" && p.express...
[ "function first_in_statement(stack) {\n let node = stack.parent(-1);\n for (let i = 0, p; p = stack.parent(i); i++) {\n if (p instanceof AST_Statement && p.body === node)\n return true;\n if ((p instanceof AST_Sequence && p.expressions[0] === node) ||\n (p.TYPE ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
stop self from parent, elsewise try to stop child stop should remove listener and delete the referece at children map. this is a recursive operation, so give an accurate parent to stop is match better than system.stop()
stop(actorRef = this.self) { const context = actorRef.getInstance().context; if (this.self.getInstance().context.path === context.path) { const parent = this.parents[this.parents.length - 1]; const parentref = this.system.get(parent); parentref && parentref.getInstanc...
[ "stopChildBridge() {\n var _a;\n if (!this.shuttingDown) {\n this.log.warn(\"Stopping child bridge (will not restart)...\");\n this.shuttingDown = true;\n this.manuallyStopped = true;\n (_a = this.child) === null || _a === void 0 ? void 0 : _a.removeAllListe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
WebSocket event handler for close events
handleClose() { log.info(`[WS] WebSocket connection closed`) }
[ "function websocket_onclose() {\n console.log(\"Websocket connection closed.\");\n}", "_onSocketClose() {\n this.stopHeartbeat();\n this.emit('close', this);\n if (this.server) {\n this.server.emit('disconnect', this);\n }\n }", "function onClose() {\n\t\tconsole.log('Client socket: Connect...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stop streaming an image
function stopStreaming() { app.set('watchingFile', false); if (proc1) proc1.kill(); if (proc2) proc2.kill(); fs.unwatchFile('./stream/image_stream.jpg'); }
[ "function stopStream() {\n\tstream.close();\n}", "function stopStreaming () {\n if (_streamingFile) {\n if (reader) {\n reader.stop();\n }\n reader = null;\n _streamingFile = null;\n }\n }", "function stopStream() {\n\tif (!stream) {\n\t\treturn;\n\t}\n\n\tstream.destroy();\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the element as draggable, and while dragging creates a clone whose position and size is set to be what the element would have if dropped at that position
function makeDraggable() { const indicator = angular__default['default'].element('<' + element[0].nodeName.toLowerCase() + '>').addClass('fl-drag-indicator fl-item'); const clone = angular__default['default'].element('<div>').addClass('fl-drag-clone'); clone.append(indicator); c...
[ "function makeDraggable() {\n\n moveable.draggable({\n revert: 'invalid',\n helper:\"clone\",\n containment:\"document\",\n });\n}", "function makeDraggable() {\n\t\t$(\".selectorField\").draggable({ helper: \"clone\",stack: \"div\",cursor: \"move\", cancel: null });\n\t}", "function makeDra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a date from a string of the form 'dd.mm.yyyy hh:mm Uhr'
function makeDate(dateString) { let subStrings = dateString.split(' '); // ['dd.mm.yyyy', 'hh:mm', 'Uhr'] let dateStr = subStrings[0]; // 'dd.mm.yyyy' let timeStr = subStrings[1]; // 'hh:mm' let dateStrParts = dateStr.split('.'); // ['dd', 'mm', 'yyyy'] let timeStrParts = timeStr.split(':'); // ['hh...
[ "function parseDate(input) {\r\n var parts = input.split('.');\r\n // new Date(year, month [, day [, hours[, minutes[, seconds[, ms]]]]])\r\n return new Date(parts[2], parts[1] - 1, parts[0]); // Note: months are 0-based\r\n}", "function makeDate( d ){\n // Check for a Date object\n var dat;\n if( typ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for use with OO structures when association knowledge flows both directions. lets associated object know who it is associated with via the appropriate property. No point to using this function for unidirectional associations... just use a regular assignment statement.
function associate(objAssociated, objAssociate, strReverseProperty) { //if this association is known in both directions //put the objAssociate object into the reverse property. //then return objAssociated. if (strReverseProperty != undefined) {eval("objAssociated." + strReverseProperty + " = objAssociate;");} retu...
[ "_setupRelationship(attr, value) {\n const isFk = this.associationIdKeys.has(attr) || this.fks.includes(attr);\n const isAssociation = this.associationKeys.has(attr);\n\n if (isFk) {\n if (value !== undefined && value !== null) {\n this._validateForeignKeyExistsInDatabase(attr, value);\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Decrements the value of a numeric type text field by `step` or `n` `step` number of times.
stepDown(stepDecrement) { const input = this.getInput(); input.stepDown(stepDecrement); this.value = input.value; }
[ "decrement () {\n this.value = this._clampValue(this.value - this.step)\n }", "decrement() {\n if (this.step > 1) {\n this.step--;\n }\n }", "decrement() {\n const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical ? Number(this.value) - Number(this.step) :...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether a command is a getter and doesn't permit chaining.
function isNotChained(command, otherArgs) { if (command == 'option' && (otherArgs.length == 0 || (otherArgs.length == 1 && typeof otherArgs[0] == 'string'))) { return true; } return $.inArray(command, getters) > -1; }
[ "function isGetter(obj, prop) {\r\n // Object.getOwnPropertyDescriptor cannot find getter/setter of object instance.\r\n // So we must seek in the instance's prototype.\r\n const descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(obj), prop);\r\n return Boolean(descriptor) && (typeof des...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get empty cell position
function getEmptyCell() { for (let x = 1; x < 5; x += 1) { for (let y = 1; y < 5; y += 1) { if (!document.getElementsByClassName(`x${x}y${y}`).length) { return { x, y }; } } } return false; }
[ "findEmptyCellIndex() {\n let indexes = []\n this.cells.forEach((val, idx) => {\n if (val === 0) {\n indexes.push(idx)\n }\n })\n let len = indexes.length\n if (len === 0) {\n return -1\n }\n if (len === 1) {\n return indexes[0]\n }\n return indexes[Math.floor(M...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
View entity by wizard(Readonly mode)
view(options) { return this.wizardInvokeService.openWizard(Object.assign(options, { title: this._buildTitle(options.service.entityName, 'wizard_view_caption'), isNew: false, readonly: true, commitOnClose: false })); }
[ "editWorkAndEducation(){\n\t\tresources.workAndEducationTab().click();\n\t}", "function directUserFromViewInfo() {\n if (nextStep == \"Departments\") {\n viewDepartments();\n }\n if (nextStep == \"Roles\") {\n viewRoles();\n }\n if (nextStep == \"Employees\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: dwscripts.isSQLReservedWord DESCRIPTION: This function returns true if the given word has special meaining within the SQL syntax. ARGUMENTS: theStr string the word to check RETURNS: boolean
function dwscripts_isSQLReservedWord(theStr) { var retVal = false; // Use the Server Model version if it exists var serverObj = dwscripts.getServerImplObject(); if (serverObj != null && serverObj.isSQLReservedWord != null) { retVal = serverObj.isSQLReservedWord(theStr); } else { if (dwscripts...
[ "function dwscripts_isReservedWord(theStr)\n{\n var retVal = false;\n \n // Use the Server Model version if it exists\n var serverObj = dwscripts.getServerImplObject();\n if (serverObj != null && serverObj.isReservedWord != null)\n {\n retVal = serverObj.isReservedWord(theStr);\n }\n\n return retVal;\n}"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Object that holds a collection of ImageCompressionData objects.
function ImageCompressionDataContainer() { this.data_ = {}; }
[ "function ImageDataContainer() {\n this.data_ = {};\n}", "function Compressor(data) {\n\n this.files = data.files;\n this.flags = data.flags;\n this.cache = data.cache;\n this.assets = data.assets;\n\n this.compressedFiles = [];\n\n}", "function CompressedDataset(data){\n this.raw = data;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set a status on an error object, if ones does not exist
function setErrorStatus (error, status) { if (!error.status && !error.statusCode) { error.status = status error.statusCode = status } }
[ "function setErrorStatus (error, status) {\n\t if (!error.status && !error.statusCode) {\n\t error.status = status\n\t error.statusCode = status\n\t }\n\t}", "function setErrorStatus(error, status) {\n if (!error.status && !error.statusCode) {\n error.status = status\n error.statusCode = status\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fonction afficherNom, retourne la valeur si valide
function afficherNom() { return isValidNom(nom.value); }
[ "function nomControle() {\n //Contrôle de la validité du nom\n const leNom = formulaireValues.lastName;\n if (regExPrenomNomVille(leNom)) {\n return true;\n } else {\n return false;\n }\n }", "function estNom(mot) {\n\treturn mot.funct.indexOf(\"nom \")==0;\n}", "mapDis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add/remove like to a reply
'ADD_REPLY_LIKE'(state, id) { var vid = state.videos.filter(video => { return video.vidId == id.videoId })[0] var com = vid.comments.filter(comment => { return comment.idComment == id.commentId })[0] var reply = com.replies.filter(rep => { return rep.idReply == id.replyId })[0]...
[ "'ADD_REPLY_DISLIKE'(state, id) {\n var vid = state.videos.filter(video => {\n return video.vidId == id.videoId\n })[0]\n var com = vid.comments.filter(comment => {\n return comment.idComment == id.commentId\n })[0]\n var reply = com.replies.filter(rep => {\n return rep.idReply == id.r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
send a request to the server to add the summand and addend
function sendAddRequest() { // get the input HTML fields var summand_field = document.getElementById( "summand" ); var addend_field = document.getElementById( "addend" ); // parse the fields for the summand and addend var summand = parseFloat( summand_field.value ); var addend = parseFloat( addend_field.value );...
[ "function add(a, b, callback) {\n client.request('add', [a, b], function(err, response){\n if (err) throw err;\n console.log(response.result);\n callback(response.result);\n })\n}", "function addition (response, body) {\n console.log (\"addition body = \" + body);\n // display received cont...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loops through the chars of the extended settings part of the URL and parses the connection properties.
parseExtendedProperties(urlChars, extIndex) { let key = null; let value = null; const token = new Array(urlChars.length); let tokenIndx = 0; let indices = ''; for (let i = extIndex; i < urlChars.length; i++) { if (urlChars[i].trim() == '') { continue; //if whitespace char, then i...
[ "parseExtendedSettings(urlStr) {\n const urlBytes = Array.from(urlStr.trim());\n const extendedSettingsIndex = this.findExtendedSettingPosition(urlBytes);\n\n if (extendedSettingsIndex == -1) {\n return urlStr; // No extended settings configuration found\n }\n this.parseExtendedProperties(urlByt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the deleted record from the deletes table for this model
function getRecordsDeleted() { var result = null; var db = Ti.Database.open('ColicheGassoseDB'); var recordsRS = db.execute("SELECT id from deletes where record_table = 'symptoms' AND to_sync = 1"); if(recordsRS.getRowCount()>0) result = []; while (recordsRS.isValidRow()) { result.push(recordsRS.fieldByNam...
[ "get deleted() {\n return this.grid.gridAPI.row_deleted_transaction(this.key);\n }", "function getDeleted() {\n\treturn data.deleted;\n}", "get deleteURL() {\n return self.table.deleteURL(self)\n }", "del() {\n var deferred = q.defer();\n if(!this[this.primaryKey]) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The lineSplit function splits the file line by line. Then prefixOperation is called by each line
function lineSplit(text) { var lines = text.split(/[\r\n]+/g); for ( var line in lines) { prefixOperation(lines[line]); } downloadOutput(); }
[ "createAddPrefixToEachLinesHandler(prefix) {\n return () => {\n const cm = this.getCodeMirror();\n const startLineNum = cm.getCursor('from').line;\n const endLineNum = cm.getCursor('to').line;\n\n const lines = [];\n for (let i = startLineNum; i <= endLineNum; i++) {\n lines.push(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds shared wpf to secondary melee classes
function getSharedWpf(wpfPrimary, wpfSecondary, wpfTertiary) { return Math.floor((Math.max(wpfSecondary*0.7-30, 0) + Math.max(wpfTertiary*0.7-30, 0)) * 0.3 + wpfPrimary); }
[ "function SPECIAL_WELCOME_OUTER$static_(){PanelSkin.SPECIAL_WELCOME_OUTER=( new PanelSkin(\"special-welcome-outer\"));}", "function ClipLauncherScenesOrSlots() {}", "function SPECIAL_WELCOME_INNER$static_(){PanelSkin.SPECIAL_WELCOME_INNER=( new PanelSkin(\"special-welcome-inner\"));}", "function WIDGET$static...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: Select Form Action Simple processing of form dropdown options Parameters: formID ID of form to be processed dropdownID ID of tag to be processed
function selectFormAction (formID,dropdownID) { var selectedLink = document[formID][dropdownID].options[document[formID][dropdownID].selectedIndex].value; if (selectedLink != '#') { window.location=document[formID][dropdownID].options[document[formID][dropdownID].selectedIndex].value; } else if (selectedLink == '...
[ "function onDropdownChange(){ \n\t\tjQuery('.cf7-inbound-input').change(function(event) {\n\t\t\tvar form = jQuery(this).closest('form.tag-generator-panel');\n\t\t\t/* find the ghost-input in the form where the cf7-inbound-input dropdown changed\n\t\t\t * and set the value to that of the dropdown. */\n\t\t\tjQuery(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fill the map for the given item, indicating the top left corner That location contains the array index for the item
static updateItemMap(type, itemMap, itemIdx, r, c, height, width) { const gridWidth = StorageGrid.getData(type).width; for (let r1 = r; r1 < r + height; r1 += 1) { for (let c1 = c; c1 < c + width; c1 += 1) { const mapObj = {}; if (r1 === r && c1 === c) { mapObj.status = TOP; ...
[ "function ItemMap(array) {\n this.array = array;\n this.updateMap();\n}", "setItem(x,y,o) { this.getCell(x,y)._mapItem = o;}", "placeItems(){\n for (let item = 0; item < this.items.length; item++){\n this.items[item].y = Math.floor(random(this.mapSize));\n this.items[item].x = Math.floor(rand...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================================================================== id_doc id page of documentation linked up, if none, put false id_help : message to display texte : hard codede messgae global : if X means that id_help come from iknow space text Eg to use global iknow text over(false,86,'','X') ========================...
function over(id_doc,id_help,texte,global,chaine) { ikdoc(id_doc);// Add call of doc page set_text_help(id_help,texte,global,chaine,id_doc); }
[ "function displayHelp()\n{\n // Replace the following call if you are modifying this file for your own use.\n dwscripts.displayDWHelp(HELP_DOC);\n}", "function displayHelp() {\n dwscripts.displayDWHelp(HELP_DOC);\n}", "function displayHelp() {\n\tdwscripts.displayDWHelp(HELP_DOC);\n}", "function set_text...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
r: 0255 g: 0255 b: 0255 returns: [ 0360, 0100, 0100 ]
function RGB_HSV (r, g, b) { r /= 255; g /= 255; b /= 255; var n = Math.min(Math.min(r,g),b); var v = Math.max(Math.max(r,g),b); var m = v - n; if (m === 0) { return [ null, 0, 100 * v ]; } var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m); return [ 60 * (h==...
[ "function RGB_HSV (r, g, b) {\r\n\t\t\tr /= 255;\r\n\t\t\tg /= 255;\r\n\t\t\tb /= 255;\r\n\t\t\tvar n = Math.min(Math.min(r,g),b);\r\n\t\t\tvar v = Math.max(Math.max(r,g),b);\r\n\t\t\tvar m = v - n;\r\n\t\t\tif (m === 0) { return [ null, 0, 100 * v ]; }\r\n\t\t\tvar h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
bench02 (Floating Point, normally 64 bit) (arithmetic mean of 1..n)
function bench02(n) { var x = 0, sum = 0.0, i; for (i = 1; i <= n; i++) { sum += i; if (sum >= n) { sum -= n; x++; } } return x; }
[ "function benchmark_mean(interval){\n return (((+interval[0]) + (+interval[1])) / 2).toFixed();\n }", "function bench04(n) {\n\tvar m = 2147483647, // prime number 2^31-1; modulus, do not change!\n\t\ta = 16807, // 7^5, one primitive root; multiplier\n\t\tq = 127773, // m div a\n\t\tr = 2836, // m mod a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
An ad has actually started playing. Remove the loading spinner.
onAdStarted(player) { player.removeClass('vjs-ad-loading'); }
[ "onAdsCanceled(player) {\n player.ads.debug('adscanceled (Preroll)');\n\n this.afterLoadStart(() => {\n this.resumeAfterNoPreroll(player);\n });\n }", "function removeLoader () {\r\n $('#player-loader').fadeOut(600, function(){\r\n $(this).addClass('hidden');\r\n });\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns events with divisor count
getDivideCount(groupsMap) { let list = {}; this.eventList.forEach(event => { let maxCount = 0; Object.keys(groupsMap).forEach(key => { groupsMap[key].forEach(lineObject => { if (lineObject.id == event.id && maxCount <= groupsMap[key].length) {...
[ "numberOfEvents()\n\t\t{\n\t\t\tlet count = 0;\n\t\t\tlet events = [];\n\n\t\t\tfor (var index in this.rawStats) {\n\t\t\t\tlet id = this.rawStats[index].event_id;\n\n\t\t\t\t// for each unique event, increment the count\n\t\t\t\tif (events.indexOf(id) === -1) {\n\t\t\t\t\tcount++;\n\t\t\t\t\tevents.push(id);\n\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The next function called is: / / setPartnerSfoAdvance() / setPartnerSfoAdvance() / ... / the user's callback / / We do a loop and fire off a bunch of setTimeout()'s
performFinalCorrection(amount) { console.log("entering performFinalCorrection()"); let who = this.sjs.id; let bumpMs = 300; let limit = 128; let acc = 0; let curMs = 0; while(acc < amount) { let thisOne = Math.min(limit,amount-acc); // if( (amount-limit) > 0 ) { // ...
[ "function waitServos()\n {\n var changing = false;\n for (var id in self._servos)\n {\n changing |= self._servos[id].isChanging();\n }\n if (changing)\n {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
write data to the terminal
write(data) { return this.term.write(data) }
[ "write (data) {\n return this.term.write(data)\n }", "write(data) {\n stdin.write(data);\n }", "function onData (data) {\n process.stdout.write(data);\n }", "function send(data) {\n terminal.send(data).\n then(() => logToTerminal(data, 'out')).\n catch(error => logToTe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Move all the cells to the right of the grid. Returns true if cells were moved.
function moveAllToRight() { var moved = false; for (var r = 0; r < 4 ; r++ ) { var s = 3; for (var c = 3; c >= 0 ; c-- ) { if (!isCellEmpty(r, c)) { if (c != s) { moved = true; setGridNumRC(r, s, grid[r][c]); setEmptyCell(r, c); } s--; } } } return moved; }
[ "function moveCellToRight() {\n\tvar isChanged = false;\n\n\tfor (var rowIndex = 0; rowIndex < 4; rowIndex++) {\n\t\tfor (var columnIndex = 2; columnIndex >= 0; columnIndex--) {\n\t\t\tif (grid[rowIndex][columnIndex] === 0) continue;\n\n\t\t\tvar theEmptyCellIndex = findTheFirstRightCell(rowIndex, columnIndex);\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a parent 'brancher' is given, then the queue is shared with the parent, but the next_brancher is incremented.
function Brancher(S, brancher) { this.space = S; this.queue = brancher ? brancher.queue : []; this.next_brancher = brancher ? brancher.next_brancher : 0; }
[ "function visitor(node, index, parent) {\n if (parent && queue.indexOf(parent) === -1) {\n queue.push(parent);\n one(parent);\n }\n }", "flush({\n parent,\n child\n }) {\n if (!child) {\n return parent;\n }\n\n let start = this.queue.indexOf(parent);\n\n if (child.parent.i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves the text position to start of the previous paragraph.
moveToPreviousParagraph(selection) { let startOffset = selection.getStartOffset(this.currentWidget.paragraph); // tslint:disable-next-line:max-line-length if (this.offset === startOffset && !isNullOrUndefined(selection.getPreviousParagraphBlock(this.currentWidget.paragraph))) { let p...
[ "moveToBeginningOfPreviousParagraph() {\n const position = this.getBeginningOfPreviousParagraphBufferPosition();\n if (position) this.setBufferPosition(position);\n }", "moveToPreviousParagraph() {\n if (isNullOrUndefined(this.start)) {\n return;\n }\n this.end.moveToPreviou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
roleIs is meant to be called before the DB queries. It provides an extra layer of security and resources saving
function roleIs(req, role) { for (var userRole of req.user.roles){ if(userRole === role){ return (true) } } return (false); }
[ "static hasRole(role){\n let user = new User();\n user.getCurrent();\n let hasRole = false;\n user.data.roles.forEach(user_role => {\n if(user_role.name == role) {\n hasRole = true;\n }\n });\n return hasRole;\n }", "isUserRole(role...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a single message from an IRC server into an IrcCommand object.
function crackMessage(serverLine) { if(serverLine.length == 0) { return undefined; } var r = new IrcCommand(); var parts = serverLine.split(" "); var offset = 0; //If our message had a prefix, store it. if(parts[0][0] == ":" ) { r.prefix = parts[0]; offset = 1; } r.command = parts[0+o...
[ "function parseCommand(message) {\n if (message[0] === commandIdentifer) {\n var params = message.split(\" \"),\n command = params[0].slice(1),\n comObj = { command: command };\n params.shift();\n comObj.params = params;\n return comObj;\n }\n else {\n return false;\n }\n}", "func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }