query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Changes the root directory from being the root project folder (top most folder) to being the current project's folder (closest project parent folder). Call this function if you are going to build a path for items in the current project and NOT the root project. (Avoids being affected when nested inside another project)...
currentProjectAsRoot() { let currentDir = __dirname; let parentDir = Path.dirname(currentDir); let parentName = parentDir.split(Path.sep).pop(); if (parentName == 'node_modules') { let grandParentDir = Path.dirname(parentDir); this.rootDir = grandParentDir; } return this; }
[ "_moveToProjectRootFolder() {\n while (!fs.existsSync('package.json')) {\n const oldPath = process.cwd();\n process.chdir('..');\n if (oldPath === process.cwd()) {\n this._exitWithError(ERROR_NOT_EXECUTED_IN_NODE_PATH);\n }\n }\n }", "function updateProjectDirectoryRoot(state, ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function make the select options back to the first choice
function backtofirst(){ var x =document.getElementById("mySelect").selectedIndex = 0; }
[ "function resetSelectElement(el) {\n el.options.length = 1;\n el.selectedIndex = 1; // first option is selected, or// -1 for no option selected\n }", "function resetSelectBox() {\n document.getElementById(\"langSelectBox\").selectedIndex = 0;\n }", "function resetSelectedOptions() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make all args, instance variables
function setupInstanceVars(args) { for(let a in args) { this[a] = args[a]; } }
[ "constructor(args = {}){\n //this can be overriden for each derived class\n this.args = args;\n }", "processArgs() {\n this.args = [];\n this.argObject = {};\n let pair = [];\n\n process.argv.forEach((val, index) => {\n this.args[index] = val;\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
It is mandatory to reply to a descriptioninfo action with an unsupportedinfo error if the info isn't recognized.
onDescriptionInfo(changes, cb) { cb(unsupportedInfo); }
[ "onDescriptionInfo(changes, cb) {\n cb({\n condition: 'feature-not-implemented',\n jingleCondition: 'unsupported-info',\n type: 'modify'\n });\n }", "getDescription(...args) {\n MxI.$raiseNotImplementedError(IRequest, this);\n }", "onTransportInfo(changes, c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle mouse move on volume bar
handleMouseMove(event) { if (this.player_.muted()) { this.player_.muted(false); } this.player_.volume(this.calculateDistance(event)); }
[ "volumeSeekBarAction() {\n let mouseDown\n\n this.volumeSeekBar.addEventListener('mousedown', (_event) => { \n this.changeVolume(_event)\n })\n\n this.volumeSeekBar.addEventListener('mousedown', () => { \n mouseDown = true\n })\n\n document.addEventListener('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resets text assigned to Genome and IPD Study Stage fields
function reset_genome_ss () { $('#g_val').text(''); $("#genome_val").val($('#g_val').text()); $('#ss_val').text(''); $("#study_stage_val").val($('#ss_val').text() ); $('#ssDiv').hide({ complete: function() { $('#ss_create').prop('checked',false); // uncheck the create_study_stage box if sample is changed ...
[ "function resetQuestionText() {\n vm.question.text = angular.copy(backUpQuestion.text);\n vm.question.expalanation = angular.copy(backUpQuestion.expalanation);\n vm.question.hint = angular.copy(backUpQuestion.hint);\n setUpQuestionEditor();\n }", "function resetProjectField() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PREPARE THE SLIDE //
function prepareOneSlide(slotholder, opt, visible) { var sh = slotholder; var img = sh.find('img') setSize(img, opt) var src = img.attr('src'); var bgcolor = img.css('background-color'); var w = img.data('neww'); var h = img.data('newh'); var fulloff = ...
[ "function beginSlides() {\r\n // shiftSlides: 2\r\n clearScrollingInterval(); //clear already existing timer before restarting it\r\n $('.hslide, .thumbnail-slide').removeClass('selected');\r\n $('.hslide#hslide' + options.currentSlide + ', .thumbnail-slid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles a click on the subsribe button on the chairpage which triggers a subscribe or removesubscription request
async _handleSubscribeButtonClick() { if (this.state.userHasSubscribedToChair) { const unsubscribeRequest = await chairService.unsubscribeFromChair( this.props.chairId ); if (unsubscribeRequest.status === 200) { this.setState({ userHasSubscribedToChair: false, ...
[ "function clickSubscriptionButton(event) {\n displayingError = false;\n event.target.blur();\n elemSubscribeButton.disabled = true;\n\n if (isSubscribed) {\n unsubscribeUser();\n } else {\n requestPermissionIfNeeded()\n .then(function (permission) {\n // Settin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
place sell limit order
async placeSellLimitOrder(amount, price){ return await this.exchange.placeSellLimitOrder(amount, price); }
[ "async placeSellLimitOrder(amount, price){\n let order = this._prepareOrder(amount, price);\n let url = `${BASE_URL}/market/selllimit?${order}`;\n let response = await fetch(url);\n let data = await response.json()\n return data;\n }", "async placeBuyLimitOrder(amount, price)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a JS function that calculates the distance between the two points in 3D by given coordinates. The input comes as an array of numbers. The first three elements are the x, y and z coordinates for the first point and the second set of arguments are the coordinates of the other point. The output should be printed to ...
function calculateDistanceIn3D(arr){ let firstObject = { X: arr[0], Y: arr[1], Z: arr[2] }; let secondObject = { X: arr[3], Y: arr[4], Z: arr[5] }; return Math.pow( Math.pow(secondObject.X - firstObject.X, 2) + Math.pow(secondObject.Y - firstObject.Y, 2) + Math.pow(secondObject.Z - ...
[ "function distanceIn3d(arr) {\n let [x1, y1, z1, x2, y2, z2] = [arr[0], arr[1], arr[2], arr[3], arr[4], arr[5]];\n console.log(Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2) + Math.pow((z1 - z2), 2)));\n}", "function distanceIn3D ([firstX, firstY, firstZ, secondX, secondY, secondZ]) {\n let delt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Preload prev and next images being showed
function _preload_neighbor_images() { if ( (settings.imageArray.length -1) > settings.activeImage ) { objNext = new Image(); objNext.src = settings.imageArray[settings.activeImage + 1][0]; } if ( settings.activeImage > 0 ) { objPrev = new Image(); objPrev.src = settings.imageArray[settings.acti...
[ "function preloadImages() {\n if ((settings.imageArray.length - 1) > settings.activeImage) {\n objNext = new Image();\n objNext.src = settings.imageArray[settings.activeImage + 1].href;\n }\n if (settings.activeImage > 0) {\n objPrev = ne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Positions the rectangle rect to coordinates (x, y). If (x, y) is a point outside the canvas area the coordinates are corrected.
function positionRectangle(rect, x, y) { if (x >= 0 && x + rect.width <= canvas.width) { rect.left = x; rect.right = rect.left + rect.width; } else if (x < 0) { rect.left = 0; rect.right= rect.width; } else if (x + rect.width > canvas.width) { rect.left = canvas.width...
[ "setXY(canvasX, canvasY) {\n let centerX = canvas.width * this.percentX / 100;\n let centerY = canvas.height * this.percentY / 100;\n\n if (this.shape == 'rectangle') {\n this.x = 2 * (canvasX - centerX) / this.width;\n this.y = -2 * (canvasY - centerY) / this.height;\n }\n if (this.shape =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes sure that the path has a valid extension
normalizeExtension(path) { if (path_1.default.extname(path) == ".js") path = path.substring(0, path.length - path_1.default.extname(path).length); if (path_1.default.extname(path) == "") path += ".json"; return path; }
[ "function extensionFromPath(path){var ext=tryGetExtensionFromPath(path);return ext!==undefined?ext:ts.Debug.fail(\"File \"+path+\" has unknown extension.\");}", "function extensionFromPath(path) {\n var ext = tryGetExtensionFromPath(path);\n if (ext !== undefined) {\n return e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the enabled status
function updateEnabled(cb){ //Log log("Checking/Changing enable status"); //Get the pref value exec('plutil -key "enabled" /var/mobile/Library/Preferences/com.chronic-dev.CDevReporter.plist', function (err, enabledvalue, stderr) { //Log log("Read enabled value of: "+(enabledvalue.trim() == "1")); //If enabled...
[ "function updateEnableStatus() {\n var apiGateways = lodash.get(ctrl.version, 'status.apiGateways', []);\n var originallyDisabled = lodash.get(ctrl.version, 'ui.deployedVersion.spec.disable', false);\n\n if (!lodash.isEmpty(apiGateways) && !ctrl.enableFunction && !originallyDisabled...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns true if row is full
rowIsFull(row_index) { return this.rows[row_index].every( cell => cell.filled); }
[ "function isRowFull() {\n var rowLength = (fileCount - 1) % 4;\n if (rowLength == 0) {\n return true;\n } else {\n return false;\n }\n }", "function isTableFull()\r\n {\r\n for(var row=0; row<3; row++)\r\n {\r\n for(var c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save the given projects to firebase.
saveProjects(projects) { db.ref('projects').set(projects); }
[ "function saveProjects(projects) {\n\n //Write data to file\n try {\n\n fs.outputFileSync(projectsPath, angular.toJson(projects, true));\n\n } catch(e){\n\n notification.error('Error saving projects list.');\n }\n\n\t}", "function saveProjects (projects) {\n fs.w...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Constructs a new instance of the GenericLogDriver class.
constructor(props) { super(); try { jsiiDeprecationWarnings.aws_cdk_lib_aws_ecs_GenericLogDriverProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, GenericLogDriv...
[ "static fluentd(props) {\n return new fluentd_log_driver_1.FluentdLogDriver(props);\n }", "static syslog(props) {\n return new syslog_log_driver_1.SyslogLogDriver(props);\n }", "static awsLogs(props) {\n return new aws_log_driver_1.AwsLogDriver(props);\n }", "static journald(prop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds the provided space to the beginning of every line in the input string
function _indent(s,space) { return s.replace(/^/gm, space); }
[ "function removeLeadingSpace(str) {\n var lineArray = str.split('\\n');\n\n var minimum = Infinity;\n lineArray.forEach(function (line) {\n if (line.trim() !== '') {\n // This is a non-empty line\n var spaceArray = line.match(/^([ \\t]*)/);\n if (spaceArray) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
37. Write a function: generatePass(passLength) that generates a password of a specified length. Password is made out of random singledigit numbers.
function generatePass(passLength) { var passLength = 5; var password = ''; for (var i = 0; i < passLength; i++) { var a = (getRandomInt(0, 10)) password += a } return password }
[ "function generatePassword (length) {\n var tmp = buildWord(getRandom(table), 1, length);\n tmp += Math.floor(Math.random() * (10 - 0) + 0);\n return tmp;\n}", "function generatePassword(passwordLength) {\n let password = \"\";\n for (let i = 0; i < passwordLength; i++) {\n password = password += charSet....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
agrega clase active a iconbar y navmenu atraves de la funcion mobilmenu
function mobileMenu() { // toggle agregar ó elimina un nombre de clase de un elemento con JavaScript. iconbar.classList.toggle("active"); navMenu.classList.toggle("active"); // modal.classList.toggle("a ctive"); // console.log(iconbar.classList + navMenu.classList); }
[ "function mobileMenu() {\n\n // toggle agregar ó elimina un nombre de clase de un elemento con JavaScript.\n iconbar.classList.toggle(\"active\");\n navMenu.classList.toggle(\"active\");\n\n // console.log(iconbar.classList + navMenu.classList);\n}", "function mobileMenuActive(active){\n if (active){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For a block with _type 'block' (text), join spans where possible
function normalizeBlock(block) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var newIndex = 0; if (!block._key) { block._key = (0, _randomKey.default)(12); } if (block._type !== (options.blockTypeName || 'block')) { return block; } if (!block.children) ...
[ "function output(text){\n\tvar blockText = \"\";\n\tfor (var i = 0; i < text.length; i++){\n\t\tif (i % 5 == 0 && i != 0)\n\t\t\tblockText += \" \" + text.charAt(i);\n\t\telse\n\t\t\tblockText += text.charAt(i);\n\t}\n\treturn blockText;\n}", "function textSsmlBlock(txt, o) {\n var b = o.block;\n for(var end=b....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete any illegal characters that will not make it through AGS.
function DeleteIllegalCharacters(myAry) { var retval = ''; for(var k=0;k<myAry.length;k++) { if(myAry.charAt(k)=="%" && myAry.charAt(k+1)=="0" && (myAry.charAt(k+2)=="A" || myAry.charAt(k+2)=="D")) { k = k+2; // PT 127924 cariage return should be replaced by a space // also, ES01.1 should not remove...
[ "static uncorrupt(text) {\n\t\tfor (let letter of ALL) {\n\t\t\ttext = text.replace(letter, '');\n\t\t}\n\t\treturn text;\n\t}", "removeAllSpaceAndSpecialChars(text) {\n\t\ttry {\n\t\t\tconst newString = text.replace(/[^A-Z0-9_]+/ig, \"\");\n\t\t\treturn newString;\n\t\t} catch (e) {\n\t\t\treturn \"\";\n\t\t}\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get config via HTTP get request and call syncConfig()
function get_config() { $.get("/config") .done(function( data ) { syncConfig(data); }); }
[ "function fetchConfig() {\n $.get('/api/config', updateConfig);\n}", "function syncGetRequest(){\n\tvar req = null;\n\n\ttry{\n\t req = new XMLHttpRequest();\n\t req.open(\"GET\", \"/config.json\", false);\n\t req.send(null);\n\t}catch(e){}\n\n\treturn {'code': req.status, 'text': req.responseText};\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes the provided input info and shows the quick pick so the user can provide the value for the input
showUserInput(variable, inputInfos) { if (!inputInfos) { return Promise.reject(new Error(nls.localize('inputVariable.noInputSection', "Variable '{0}' must be defined in an '{1}' section of the debug or task configuration.", variable, 'input'))); } // find info for the...
[ "function showInputHelpPopup(paramName, value, assignFun, type, examples){\n\t\tvar $box = $('#sepiaFW-teachUI-input-helper');\n\t\tvar $input = $box.find(\".sepiaFW-input-popup-value-1\");\n\t\tvar $title = $box.find(\".sepiaFW-input-popup-title\");\n\t\tvar $examples = $box.find(\".sepiaFW-input-popup-examples\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Unpair this device from the server (and logout)
function unpair() { if (isLoggedIn()) { logout(); } chromep.storage.local.remove("connectionData"); chromep.storage.local.remove("keystores." + state.userID); state.paired = false; }
[ "unpair() {\n debug(`${this.name} (${this.id})`);\n\n // Send the unpair packet only if we're connected\n if (this.connected) {\n this.sendPacket({\n id: 0,\n type: 'kdeconnect.pair',\n body: {pair: false}\n });\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks whether the carousel is in a specific state or not.
is(state) { return this._states[state] && this._states[state] > 0; }
[ "_is(specificState) {\n return this.carouselService.is(specificState);\n }", "check() {\n const {\n showNext: stateShowNext,\n showPrev: stateShowPrev,\n } = this.state;\n if (!this.carousel) return;\n const st = this.carousel.state;\n const showNext = st.currentSlide < st.slide...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if there are unresolved mutations between HEAD and EDGE, meaning we have mutations that are still waiting to be either submitted, or to be confirmed by the server.
anyUnresolvedMutations() { return this.submitted.length > 0 || this.pending.length > 0; }
[ "hasUnresolvedMutations() {\n return this.submitted.length > 0 || this.pending.length > 0;\n }", "_hasLocalChanges() {\n return this._nextChange && this._nextChange.ops.length > 0\n }", "consumeUnresolved(txnId) {\n // If we have nothing queued up, we are in sync and can apply patch with no\n // r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Keep chromosomes in order of distance
sortByFitness() { this.chromosomes = _.sortBy(this.chromosomes, 'totalDistance'); }
[ "function Chromosome() {\n this.genes = [];\n}", "generateChromosome() {\n this.genes.fill(0);\n let selectionGene = this.genes.map((_, index) => index),\n i = 1,\n index,\n limit = floor(random(NUMBER_OF_CH - 3, NUMBER_OF_CH + 1));\n while (i <= limit) {\n index = floor(random(sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================== from functions/errors/OnErr.java =================================================================== Needed early: Builtin Needed late: Catch ArcObject
function OnErr() { }
[ "function error(err) {\n}", "function he_api_errorHandler(data, cb , returnErrorObject) {\n\n var errorId = \"EGeneralError\";\n var errorMsg = \"----- no error message ???? -----\";\n var errMap;\n var errorBodyObj;\n var source = data.source;\n var heCode=\"500\";\n var heText=\"No Text\";\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the volume of the specified Hypem player
function getVolume(playerId){ return mPlayers[playerId].volume; }
[ "getVolume() {\n return Math.floor(this.video.volume * 100);\n }", "function getVolume() {}", "get volume() {\n return Number(this.media.volume);\n }", "function get_volume(params) {\n var volume = $('#sfx_volume').text();\n if (volume) {\n return volume;\n } else {\n return '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function drawCenterStars(num) that prints 75 characters total. The stars should be centered in the 75. the middle num characters should be asterisks; the rest of the 75 characters should be spaces.
function drawCenterStars(num) { }
[ "function drawCenterStars(num) \n{\n var left = Math.floor((75 - num)/2);\n var arr = [];\n \n for(var i = 0; i < left; i++)\n {\n arr.push(' ');\n }\n\n for(var i = 0; i < num; i++)\n {\n arr.push('*');\n }\n\n for(var i = 0; i < 75-left-num; i++)\n {\n arr.push('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by LUFileParserfilterLine.
exitFilterLine(ctx) { }
[ "exitParse(ctx) {\n\t}", "exitReportGroupLineNumberClause(ctx) {\n\t}", "exitErrorFilterLine(ctx) {\n\t}", "exitLinageClause(ctx) {\n\t}", "exitCompilationUnit(ctx) {\n\t}", "exitSelectLinesInto(ctx) {\n\t}", "exitFilterSection(ctx) {\n\t}", "exitRecordDelimiterClause(ctx) {\n\t}", "exitRulePart(ctx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a function that tells whether a given key matches an upper bound
getUpperBoundMatcher (query) { // No lower bound if (!Object.prototype.hasOwnProperty.call(query, '$lt') && !Object.prototype.hasOwnProperty.call(query, '$lte')) return () => true if (Object.prototype.hasOwnProperty.call(query, '$lt') && Object.prototype.hasOwnProperty.call(query, '$lte')) { if (this...
[ "function after(key, range) {\n if (range && range.upper !== undefined) {\n var c = indexedDB.cmp(key, range.upper);\n if (range.upperOpen && c >= 0) return true;\n if (!range.upperOpen && c > 0) return true;\n }\n return false;\n}", "function _boundBy(bounds, value) {\n return (value > bou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add internal on change listener. Used for sub SDKs that need to store the scope.
addScopeListener(callback) { this._scopeListeners.push(callback); }
[ "_setupScopeListener() {\n const scope = core_1.getCurrentHub().getScope();\n if (scope) {\n scope.addScopeListener(updatedScope => {\n // We pass through JSON because in Electron >= 8, IPC uses v8's structured clone algorithm and throws errors if\n // objects ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fills the fields of the edit form with the information of the book being edited.
function fillEditForm() { let selectedBook = document.getElementById('selected-book') let titleInput = document.getElementById('title-edit-in') let authorInput = document.getElementById('author-edit-in') let genreInput = document.getElementById('genre-edit-in') let pagesInput = document.getElementBy...
[ "function editBook() {\n helper.fadeBetweenElements(\"#bookContent, #dataPreview\", \"#bookForm\");\n newPreviousBook = helper.clone(globalVars.book);\n showProperButton(\"editBook\");\n\n // Below the above setters so previous value doesn't change descLength\n limitDescriptionLength(true);\n imageUploadListe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Construct a new context which inherits values from an optional parent context.
function BaseContext(parentContext) { // for minification var self = this; self._currentContext = parentContext ? new Map(parentContext) : new Map(); self.getValue = function (key) { return self._currentContext.get(key); }; self.setValue = function (key, value) { var ...
[ "function createSubContext(parent, customValues) {\n var subContext = Object.create(parent);\n if (customValues) {\n Object.assign(subContext, customValues);\n }\n return subContext;\n}", "constructor (parent) {\n if (parent instanceof Context) this.parent = parent\n else if (parent) this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
functions find vehicle match and get url
function getURL(makeModel) { // find correct OEM array to search through var mArr = makeModel.split(' '); var make = "no match found", model = "", ar = oems, oLen = oems.length, x = 0; ...
[ "function apiMatchUrl(matchURL) {\n\t\tmodMatchURL = matchURL.replace('.html', '');\n\t\treturn yql(\"http://www.espncricinfo.com\" + modMatchURL + \".json\");\n\t}", "function getMatchDetail(matchLink){\n request(matchLink, function(err, res, data){\n processData(data);\n })\n}", "function URLPars...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
request for hostUnique_ByHits service, calls 'callback' function.
function requestGetUnique_CompletedByHits(query, callback) { // var url = hostUnique + format.queryToURLForm(slotValue_name, slotValue_country, slotValue_region, slotValue_content, slotValue_date, slotValue_solution); // var url = hostUnique_ByHits + format.queryToURLForm(slotValue_name, slotValue_country, slotValu...
[ "function requestGetUnique_ByHits(query, callback) {\n\n// var url = hostUnique + format.queryToURLForm(slotValue_name, slotValue_country, slotValue_region, slotValue_content, slotValue_date, slotValue_solution); \n\n// var url = hostUnique_ByHits + format.queryToURLForm(slotValue_name, slotValue_country, slotVa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add a specific carst to carsts queue
function addCarstToQueue(carst) { //Channelangabe überdenken gID++; carst.id = gID; var channel = carst.channel; carsts[channel].push(carst); if(carsts[channel][0] === carst) { defaultCarstStatus[channel].status = false; clearTimeout(defaultCarstStatus[channel].timeout); sendToReceivers(channel, 'c...
[ "enqueue(item) {\n this.queue.push(item);\n }", "addCar(car) {\n autosList.push(car);\n }", "add( data ) {\n this._queue.push( data );\n }", "function addtoqueue(videoid)\n{\n Queue.unshift(videoid)\n retrieveVideoInfo(videoid).then(function(res)\n {\n console.log(res.items);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A fixed size buffer storing sample counts over a set of time ranges. This is specifically being used for record approximately how many log/span records were discarded over a given period of time. This provides the server with some notion of what was not reported without consuming a lot of bandwidth. Arguments: maxBucke...
function TimestampSamples(maxBuckets, granularity) { this.maxBuckets = maxBuckets; this.minMagnitude = Math.pow(10, granularity); // Note: this will initialize the rest of the object fields this.clear(); }
[ "static analyse(buffer, resampleLength) {\n const resampledBuffer = new Float32Array(resampleLength);\n let min = 100;\n let max = -100;\n let resampledMin = 100;\n let resampledMax = -100;\n \n const bucketSize = 1 + Math.ceil(buffer.length / resampleLength);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wrapper functions for OpenJsCAD & OpenJSCAD.org color table from
function color() { var map = { "black" : [ 0/255,0/255,0/255 ], "silver": [ 192/255,192/255,192/255 ], "gray" : [ 128/255,128/255,128/255 ], "white" : [ 255/255,255/255,255/255 ], "maroon": [ 128/255,0/255,0/255 ], "red" : [ 255/255,0/255,0/255 ], "purple": [ 128/255,0/255,128/255 ], "fuch...
[ "function ColourTable() {}", "function initColorMaps() {\n let tableRed = []\n let tableGreen = []\n let tableBlue = []\n let red, green, blue;\n let a, b;\n for (let i = 0; i <= 255; i++) {\n a = i * 0.01236846501;\n b = Math.cos(a - 1.0)\n red = Math.round(Math.pow(2.0, Math.sin(a - 1.6)) * 200)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts `I18nCreateOpCodes` array into a human readable format. This function is attached to the `I18nCreateOpCodes.debug` if `ngDevMode` is enabled. This function provides a human readable view of the opcodes. This is useful when debugging the application as well as writing more readable tests.
function icuCreateOpCodesToString(opcodes) { var parser = new OpCodeParser(opcodes || (Array.isArray(this) ? this : [])); var lines = []; function consumeOpCode(opCode) { var parent = getParentFromIcuCreateOpCode(opCode); var ref = getRefFromIcuCreateOpCode(opCode); ...
[ "function i18nCreateOpCodesToString(opcodes) {\n const createOpCodes = opcodes || (Array.isArray(this) ? this : []);\n let lines = [];\n for (let i = 0; i < createOpCodes.length; i++) {\n const opCode = createOpCodes[i++];\n const text = createOpCodes[i];\n const isComment = (opCode & I18nCreateOpCode.C...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this method reacts only onmouseover on any of the nodes in the shared graphs
function onMouseoverChart(e) { if (e['target'] === 'node') { var nodeSplit = e['targetid'].split('-'); var nodeId = nodeSplit[nodeSplit.length - 1]; if (Number.isInteger(parseInt(nodeId)) && parseInt(nodeId) < globalEnergyData['values'].length) { renderPieChart(parseInt(nodeId)); } ...
[ "function HivePlot_nodeMouseover(event, d, svg) {\n svg.selectAll(\".link\").classed(\n \"active\",\n (p) => p.source === d || p.target === d\n );\n d3.select(event.srcElement).classed(\"active\", true);\n displayNodeInfo(d);\n}", "function nodeMouseover(d) {\n chart.selectAll(\".link\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
search post by title
function searchTitle(title) { const sql = `SELECT * FROM post WHERE title LIKE '%${title}%' ORDER BY timeposted DESC;`; return db.execute(sql); }
[ "function searchByTitle(posts) {\n const search_content = document.getElementById('post-search-content').value;\n if (search_content !== \"\") {\n posts.forEach(i => {\n const titleContent = document.getElementById(`post_title${i.id}`).innerHTML;\n const post = document.getElement...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When size is provided as a number in base currency terms or as a number relative to a size hook, individual orders will have identical sizes because the quote currency becomes irrelevant. Therefore, regardless of splits or duration, we don't need to recalculate the size on a perorder basis.
async function composeIndividualSizeCalculator( exchange, credentials, data, initialMarketData ) { // Relative size. if (data.size.type === 'relative') { const [totalSize, accountData] = await Promise.all([ calculateTotalRelativeSize( exchange, credentials, data, in...
[ "function calculatePriceSize(size = 38) {\n // size pricing\n switch (size) {\n case \"38\":\n objPrice.size = 0;\n break;\n case \"39\":\n objPrice.size = 0;\n break;\n case \"40\":\n objPrice.size = 2;\n break;\n case \"41\":\n objPrice.size = 2;\n break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns dom element for header text
function getHeaderDom(text){ var hd = document.createElement('div'); hd.setAttribute('class', 'terminus-module-head'); var h = document.createElement('h3'); h.innerHTML = text; hd.appendChild(h); return hd; } // getHeaderTextDom
[ "get headerNode() {\n return DOMUtils.findElement(this.node, HEADER_CLASS);\n }", "get headerNode() {\n return apputils_1.DOMUtils.findElement(this.node, HEADER_CLASS);\n }", "get header() {\n return Polymer.dom(this.$.headerContent).getDistributedNodes()[0];\n }", "function create...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.
get lastReviewDate () { return this._lastReviewDate; }
[ "get lastReviewDate() {\n\t\treturn this.__lastReviewDate;\n\t}", "get approvalDate() {\n\t\treturn this.__approvalDate;\n\t}", "get approvalDate () {\n\t\treturn this._approvalDate;\n\t}", "function getLatestRatingDate() {\n\t return latestRatingDate;\n\t}", "dateForNewComment() {\n if (this.actionLi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extracts the root type of the operation from the schema.
function getOperationRootType(schema, operation) { if (operation.operation === 'query') { var queryType = schema.getQueryType(); if (!queryType) { throw new _GraphQLError.GraphQLError('Schema does not define the required query root type.', operation); } return queryType; } if (operation.o...
[ "function getOperationRootType(schema, operation) {\n switch (operation.operation) {\n case 'query':\n var queryType = schema.getQueryType();\n if (!queryType) {\n throw new __WEBPACK_IMPORTED_MODULE_1__error__[\"a\" /* GraphQLError */]('Schema does not define the required query root type.', [o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes the visibility of a search form, using the table name.
function toggleSearchForm(table){ var obj = ge(table + "_searchDiv"); var display = obj.style.display; if( display == 'none'){ obj.style.display = 'block'; }else{ obj.style.display = 'none'; } }
[ "updateTable(search_query){\r\n\t\tthis.hide_row_list = this.searchTable( search_query );\r\n\t\tthis.showAllTableRows();\r\n\t\tthis.hideTableRows();\r\n\t}", "function showFieldSearch() {\n var $toolbar = $('.fixed-table-toolbar');\n var $searchBox = $toolbar.find('div.search');\n if($searchBox.css('visib...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes a game from a user Returns a Promise
async function removeGameFromUser(game_name, username) { // First, unrate the game await gamesdb.rate(game_name, username, 0); // Get the game to remove var game = await gamesdb.get(game_name); var game_id = game.id; // Remove the game var query = { username: username }; var update = {...
[ "function deleteGame(request, response) {\n\t/** Unique token key. */\n\tvar token = jwtTools.getJwtFromHeader(request.headers);\n \tvar decoded = jwt.decode(token);\n\n \tvar userId = JSON.stringify(decoded.user_id);\n\tuserId = jwtTools.cleanUserId(userId);\n\n\tUserModel.findByIdAndUpdate(userId ,{ $pull : { gam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes Elements when Geolocation radio button is selected
function geoRadioBtn(){ searchbarInput.readOnly = true; geolocation = true; searchbarInput.style.color = "black"; searchbarInput.style.backgroundColor = "#ddd"; getGeolocation(); }
[ "function geolocaterOnRadioSelect() {\n var value = gui.radiogroup.value;\n if (gui.prefs.uri != value) {\n gui.prefs.uri = value;\n gui.prefs.forceUpdate();\n }\n}", "function initGeoRadio(geo) {\n\n // Trigger update on user selection\n $('#neighborhood-radio').change(function () {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Read PNG data for a file, and resolve with an object containing the file name and the PNG object instance representing its data.
function readPngData(file,scale){ var deferred = Q.defer(); var readFile = Q.denodeify(fs.readFile); return readFile(file).then(function(data){ var stream = new PNG(); stream.on('parsed', function() { var png = scale > 1 ? scalePng(this,scale) : this; stream.end(); deferr...
[ "function readPNG (path) {\n debug('readPNG', path)\n const data = fs.readFileSync(path)\n const png = rawToPng(data)\n return png\n}", "function load_img_method(path)\n{\n// const {PNG} = require('pngjs'); //nested so it won't be needed unless load() is called\n var png = PNG.sync.read(fs.readFileSync(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
input: a window (assumes it is the focused window) output: none effect: places the focused window in the right half of the screen. Places the rest of the windows in the upper and lower left fourths of the screen depending on the counter passed to the tiler helper function
function tile3Windows(focus_window) { var counter = 0; // screen = Screen.main().flippedVisibleFrame(); var windows = focus_window.others(); var max = windows.length; notifier(max); var win = windows[0]; var i; verticalizeAndHalf(focus_window, 'right'); for(i = 0; i < max; i++) { win = windows[i]; ...
[ "function place2Windows()\n{\n // Get current window\n var currentWindow = slate.window();\n // Find another window in same screen.\n var secondWindow = getSecondWindow(currentWindow);\n if (secondWindow === null) {\n return;\n }\n\n // Perform appropriate action.\n if (isWindowAt(cur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
oscilloscope initiate the oscilloscope only run this once
function oscilloscope() { // create an audio stream container var audioContext = new window.AudioContext(); // create source from html5 audio element var source = audioContext.createMediaElementSource(audio); // attach oscilloscope var scope = new Oscilloscop...
[ "function aos_init() {\n AOS.init({\n duration: 1000,\n easing: \"ease-in-out-back\",\n once: true\n });\n }", "function initOscilloscope() {\n const bufferLength = analyser.frequencyBinCount;\n const dataArray = new Uint8Array(bufferLength);\n analyser.fftSize = 2048;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Process the specified "FOR" template
function processFOR(template, node) { var res = ''; // Select the collection var collection = selectCollection(template, template.view, node.getAttribute('each'), node.getAttribute('where')); // Parse the template var forTemplate = { dom: node }; // Loop over the obje...
[ "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" ] ] } }
CheckStatus Used to check a task output number status (waiting, running, done,...). Parameters: task_trid: task tracking ID output_number: task output number
function CheckStatus(task_trid, output_number) { var url = CGI_PATH + "/get_result.cgi?task_id=" + task_trid + "&results_in_list=" + output_number + "&status=1&random=" + Math.random(); var ajax_object = new Ajax.Request(url, { method:"get", onSuccess:function (transport) { UpdateStatus(transport, task_trid, o...
[ "function checkTaskStatus() {\r\n if ( task.status === 'QUEUED' || task.status === 'RUNNING' || task.status === 'NEW' ) {\r\n ProgressStatusService.getSubmittedTask( task.taskId, {\r\n callback : function onSuccess( submittedTask ) {\r\n if ( submittedTask === null ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appends arguments passed in to the base document url and returns the same.
function AppendArgumentsToBaseUrl() { var url = GetBaseUrlPath(); for (arg_index = 0; arg_index < arguments.length; arg_index++) { url += arguments[arg_index]; } return url; }
[ "function addUrlArgs (url, args){\r\n if (!args)\r\n return url;\r\n if (url.indexOf('?') < 0)\r\n url += '?';\r\n else if (url.substr(url.length-1) != '&')\r\n url += '&'; \r\n if (matTypeof(args == 'object'))\r\n return url + implodeUrlArgs (args); \r\n return url + args;\r\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get /employers/:id UNAUTHENTICATED ROUTE
function getEmployerById(req, res) { Employer.findById(req.params.id).exec(function (err, employer) { if (err) return res.send(err); res.status(200).json(employer); }); }
[ "function getEmployerByAuthUser(req, res) {\n if (req.user.user_type !== 'recruiter') {\n res.status(401).json({\n \"message\": response.onlyRecruiters\n });\n } else {\n User.findById(req.user._id).exec( function(err, user){\n if (err)\n return res.se...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts memory (all units to MegaBytes)
function memToMB (mem) { var regex = /([0-9]*)([a-zA-Z]{1,2})/g; var found = regex.exec(mem); if (mem == null || found == null) { return 0; } switch (found[2]) { case 'b': return Math.round((found[1] / 1024) / 1024) break; case 'kb': return Math.round(found[1] / 1024) bre...
[ "static toMb(bytes) {\n return +(bytes / Util.MB).toFixed(0)\n }", "function vboxMbytesConvert(mb) {return vboxBytesConvert(parseFloat(mb) * 1024 * 1024);}", "function formatMemory(bytes) {\n var thresh, u, units;\n thresh = 1000;\n if (bytes < thresh) {\n return bytes + \" B\";\n }\n units = [\"kB\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Contains RASH review Loads the content of the current paper in the appropriate div
function loadCurrentPaperContent() { if (document.location.pathname === "/") { $addedHeadTags && $addedHeadTags.remove(); $('.paper-container').empty(); } updateModeCheckbox(false); WebuiPopovers.hideAll(); sessionStorage.revForPaper = false; sessionStorage.alreadyReviewed = false; if (document.location....
[ "function loadReviewPage() {\n\t\t$.ajax({\n\t\t\turl: \"review.html\",\n\t\t\tsuccess: function(data) {\n\t\t\t\t$(\"#main-content\").html(data);\n\t\t\t\treddit();\n\t\t\t\tyouTube();\n\t\t\t\tmovieInfo();\n\t\t\t}\n\t\t});\n\t}", "function rdetailDisplayPreview() {\n previewPane = $('rdetail_excerpt_div');\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fills a select field with all the names of the teams (of a given group) Used to continue a contest if the students didn't write down the team password
function fillListTeams(teams) { $("#selectTeam").html("<option value='0'>" + t("tab_view_select_team")); for (var curTeamID in teams) { var team = teams[curTeamID]; var teamName = ""; for (var iContestant in team.contestants) { var contestant = team.contestants[iContestant]; ...
[ "function populateTeamsDropdown(option, teams) {\n var teams_select = $('.js-bio-profile__teams');\n var dataResult = bioProfileContent;\n $.each(dataResult.department, function (i, department) {\n if (option === department.departmentValue) {\n $.ea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes only the first node of the list
removeFirst() { if (!this.head) { return; } this.head = this.head.next; }
[ "removeFirstNode() {\n if(!this.head) {\n return;\n }\n this.head = this.head.next;\n }", "removeFirst() {\n\t\tthis.head = this.head.next;\n\t}", "removeFirstNode() {\n let currentNode = this.headNode;\n this.headNode = currentNode.nextNode;\n }", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The publicly exposed MathQuill API. Global function that takes an HTML element and, if it's the root HTML element of a static math or math or text field, returns its API object (if not, null). Identity of API object guaranteed if called multiple times, i.e.: var mathfield = MathQuill.MathField(mathFieldSpan); assert(Ma...
function MathQuill(el) { if (!el || !el.nodeType) return null; // check that `el` is a HTML element, using the // same technique as jQuery: https://github.com/jquery/jquery/blob/679536ee4b7a92ae64a5f58d90e9cc38c001e807/src/core/init.js#L92 var blockId = $(el).children('.mq-root-block').attr(mqBlockId); return...
[ "function setupMathQuill() {\n //on document ready, mathquill-ify all `<tag class=\"mathquill-*\">latex</tag>`\n //elements according to their CSS class.\n $(function () {\n $('.mathquill-editable:not(.mathquill-rendered-math)').mathquill('editable');\n $('.mathquill-textbox:not(.mathquill-re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch all of the kernel specs.
function getSpecs(settings) { return default_1.DefaultKernel.getSpecs(settings); }
[ "get specs() {\n return this.manager.services.kernelspecs.specs;\n }", "function getKernelSpecs(options) {\n if (options === void 0) { options = {}; }\n var baseUrl = options.baseUrl || utils.getBaseUrl();\n var url = utils.urlPathJoin(baseUrl, KERNELSPEC_SERVICE_URL);\n var ajaxSettings = u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! ignore /! Returns this documents _id cast to a string.
function o(){return null!=this._id?String(this._id):null}
[ "function r(){return null!=this._id?String(this._id):null}", "function n(){return null!=this._id?String(this._id):null}", "getId() {\n return this._docObject.getId();\n }", "getId() {\n const parent = this.getParent();\n return parent ? `${parent.getId()}/${this.getInternalId()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns 3element array of projected coordinates for a transaction, the outer elements are projected on land, the middle in the sky
function projectTransaction(transaction) { var source = eval(transaction.from_coord), target = eval(transaction.to_coord), mid = locationAlongArc(source, target, 0.5); return [ land(source), sky(mid), land(target) ]; }
[ "_projectCoordinates() {\n var point;\n return this._coordinates.map(_coordinates => {\n return _coordinates.map(ring => {\n return ring.map(latlon => {\n point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes the '_resolved' suffixes from link and image tags that were added to resolved references.
function removeResolvedSuffixes(text) { text = text.replace(/<a_resolved /g, '<a '); text = text.replace(/<img_resolved /g, '<img '); return text; }
[ "function resolveReferences(base, path, text) {\n text = text.replace(/<a\\shref=\"([^\"]+)/g, function(s, href) {\n return '<a_resolved href=\"' + resolveReference(base, path, href);\n });\n text = text.replace(/<img\\ssrc=\"([^\"]+)/g, function(s, src) {\n return '<img_r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Can a user change the default country or not.
can_change_country() { const { countries } = this.props // If `countries` is empty, // then only "International" option is available, // so can't switch it. // // If `countries` is a single allowed country, // then cant's switch it. // return countries.length > 1 }
[ "function onChangeCountry(value){\n setCountry(value);\n if(value.length === 0){\n state.f_country = false;\n }else{\n state.f_country = true;\n state.countryCode = value;\n state.default = false;\n }\n filterALL();\n }", "function countryselect(origin){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show popup toast at 'main'
function showMain(message) { tau.changePage('#main'); if (message != undefined) { toastAlert(message); } transferId = 0; }
[ "function toast() {\n\tM.toast({html: 'Eventual link to Github'})\n}", "function toastShow() {\n toastElemant.show();\n}", "function toastAlert(msg) {\n var toastMsg = document.getElementById(\"popupToastMsg\");\n toastMsg.innerHTML = msg;\n tau.openPopup('#popupToast');\n console.log(msg);\n}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PROBLEM: Kadane's Algorithm takes in nonempty array of integers returns the max sum that can be HIGH LEVEL STRATEGY: iterate through the array keep track of the current sum and beginning index keep track of the max sum and max beginning index and max ending index when the current iteration is a negative number compare ...
function kadanesAlgorithm(array) { let maxSum = array[0] // -2 let currentSum = array[0] // -2 for (let i = 1; i < array.length; i++ ) { currentSum += array[i] currentSum = Math.max(array[i], currentSum) maxSum = Math.max(currentSum, maxSum) } return maxSum }
[ "function maxmimumSubarraySum4_WithIndexes_KadaneAlgo(a){\n //Kadane's algo for maximum subarray sum\n let current_sum = 0;\n let max_sum = Number.MIN_SAFE_INTEGER;\n let start =0;\n let end = 0; \n let newStart=0; \n\n //Kadane's algo for maximum subarray sum\n for (let i = 0; i < a.length;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
set filter and fetch
setFilterAndFetch(query) { const { type, sort } = query this.filter.sort = sort this.filter.type = type this.fetchFilterPro() }
[ "function setFilters(){}", "function setFilters() {} // 2042", "function fetchCustomFilters() {\n\n store.dispatch(updateCustomFiltersFetchedBool(false));\n\n fetch('/filters').then(response=> response.json()).then...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function updates the position of the player's SVG object and set the appropriate translation of the game screen relative to the the position of the player
function updateScreen() { // Transform the player player.node.setAttribute("transform", "translate(" + player.position.x + "," + player.position.y + ")"); // Calculate the scaling and translation factors var scale = new Point(zoom, zoom); var translate = new Point(); translate.x = SCRE...
[ "function updateScreen() {\r\n\r\n // Transform the player\r\n if (player.motion == motionType.LEFT || motionKeep == motionType.LEFT)\r\n player.node.setAttribute(\"transform\", \"translate(\" + (player.position.x + PLAYER_SIZE.w) + \",\" + player.position.y + \") scale(-1, 1)\");\r\n else\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
msg.id = id of new bookmark msg.pageID = id of page Adds the bookmark id to the page list in memory, and sets the bookmark in memory, and tells content to display it
function addNewBookmark(msg,port){ //Confirm bookmark does not exist; var bookmark=jsonToBookmarkItem(msg.bookmark); var bookmarkID=bookmark.id; getData(bookmarkID,function(bookmarkData){ if(bookmarkData[bookmarkID]!==undefined){ alert("cannot create duplicate URL"); } else{ console.log(...
[ "function BookmarkPage()\n{\n\tPageArray[currentpage].AddBookmark();\n}", "function bookmark(itemID, pageLoad)\n{\n socket.emit('bookmark', itemID, pageLoad); \n socket.once('bookmarkResult', function(success)\n {\n if (success == 1)\n {\n if (!pageLoad) //user clicks bookmark; show confirmation \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
slide the nav bar on burger menu
navigationSlide() { const burger = document.querySelector('.burger'); const nav = document.querySelector('.nav'); const links = document.querySelectorAll('.nav ul a'); // On burger press move the menu left/right nav.classList.toggle('navigation-active'); // Animate the...
[ "function burgerMenu(){\n\t$(\".burger-menu\").click(() => {\n\t\t$(\".burger-menu\").toggleClass(\"show\")\n\t\t$(\"nav ul\").toggleClass(\"show\")\n\t})\n}", "function burgerClick() {\n\n setShowBurger(prevState => !prevState);\n\n navRef.current.classList.toggle('show');\n\n }", "function burger() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MixinOptions behaviors Takes care of getting the behavior class given options and a key. If a user passes in options.behaviorClass default to using that. If a user passes in a Behavior Class directly, use that Otherwise delegate the lookup to the users `behaviorsLookup` implementation.
function getBehaviorClass(options, key) { if (options.behaviorClass) { return options.behaviorClass; //treat functions as a Behavior constructor } else if (_.isFunction(options)) { return options; } // behaviorsLookup can be either a flat object or a method if (_.isFunction(Marionette.Behaviors.b...
[ "function getBehaviorClass(options, key) {\n\t\t if (options.behaviorClass) {\n\t\t return options.behaviorClass;\n\t\t //treat functions as a Behavior constructor\n\t\t } else if (_.isFunction(options)) {\n\t\t return options;\n\t\t }\n\n\t\t // behaviorsLookup can be either a flat object or a method\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
END generateVCard START generateSingleFeedHTML
function generateSingleFeedHTML(itemToUseContent) { var tAuthorFullName = itemToUseContent.targetAuthor.eventDestActorFullName(true), tAuthorProfileUrl = itemToUseContent.targetAuthor.eventDestActorProfileUrl(true), tAuthorProfilePic = itemToUseContent.targetAuthor.eventDestActorProfilePic(true), tAutho...
[ "function main() {\r\n clearElement('output');\r\n for (i = 0; i < 20; i ++){\r\n Scriptures.getRandomScripture(scripture => {\r\n let cardHtml = createCardHtml(scripture);\r\n insertHtml('output', cardHtml)\r\n });\r\n }\r\n }", "function main() {\n\n Memes.getMemesUrl(memes => {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculates and sets the appropriate 'top' and 'left' CSS values based on the specified array's level of recursion and number of blocks the array should be offset from the left arr the JSAV array to set the 'top' and 'left' values for level the level of recursion, the fullsize array is level 1 leftOffset the number of b...
function setPosition(arr, level, leftOffset) { console.log("In setPosition with level " + level + " and leftOffset " + leftOffset + ". Also, leftEdge is " + leftEdge); var blockWidth = 46; var rowHeight = 80; var left = leftEdge + leftOffset * blockWidth; var top = rowHeight * (level - 1); ...
[ "function setPosition(arr, level, column) {\n // Calculate the number of arrays in the current row\n var numArrInRow = Math.pow(2, level - 1);\n\n // Calculate the left value of the current array by dividing\n // the width of the canvas by twice the number of arrays that should\n // appear in that ro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
HandleInputChange +++++++++++++++++ MODAL CONFIRM +++++++++++++++++++++++++++++++++++++++++++ ========= ModConfirmOpen_AddFromPreviousExamyears ================ PR2023041
function ModConfirmOpen_AddFromPreviousExamyears() { //console.log(" ----- ModConfirmOpen_AddFromPreviousExamyears ----") mod_dict = {mode: "add_from_prev_examyears"}; mod_dict.user_pk_list = []; if(permit_dict.permit_crud_sameschool){ // --- loop through tblBody.rows and fill ...
[ "function ModConfirm_Cesuur_Nterm_Open(mode, el_input) {\n console.log(\" ----- ModConfirm_Cesuur_Nterm_Open ----\")\n if (permit_dict.permit_crud && permit_dict.requsr_role_admin) {\n let hide_save_btn = false, has_selected_item = false;\n\n // --- put text in modal form\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles the paused mode on and off.
function togglePause() { if (isPaused()) { resume(); } else { pause(); } }
[ "toggle() {\n this._paused = !this._paused;\n }", "togglePause() {\n\t\tthis.paused = this.paused ? false : true;\n\t}", "function togglePause() {\n\n\t\tif( isPaused() ) {\n\t\t\tresume();\n\t\t}\n\t\telse {\n\t\t\tpause();\n\t\t}\n\n\t}", "toggle() {\n this.pause.status ? this.start() : this.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a Part ( aka. Entry ) A Part is a fundamental Atomic Building Block of the Bubble System. A Part automatically has many static meta and psuedo meta capabilites, as well as pseudoautomatically and fullmanually has many dynamic capabilities // The Slots of a Part constitute its parametric description, and kitsift...
function Part(load_kit) { load ('Part') this.Slots = new Strainer(load_kit) this.AddSlot = (name, inspector, none) => this.Slots.Add (name, inspector, none) this.GetSlot = (name ) => this.Slots.Get (name ) this.Sift = (o, kit) => this.Slots.Sif...
[ "makePart(part) {\n if (part.type === 'board')\n return new Board(this, part);\n if (part.type === 'mcu')\n return new MCU(this, part);\n if (part.type === 'pushbutton')\n return new Button(this, part);\n if (part.type === 'led')\n return new LED(this, part);\n if (part.type === '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
status_message computed: true, optional: false, required: false
get statusMessage() { return this.getStringAttribute('status_message'); }
[ "getMessage(status) {\n /**\n * @param status STRING - order status\n */\n\n // * Validate\n if (status) {\n // * Switch case\n switch (status) {\n case 'evidence':\n return 'รอยืนยันหลักฐานการโอน'\n case 'confirm':\n return 'กำลังดำเนินการ'\n case '...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the game of life to the next iteration, and redraw the grid. If the game of life is null, start it.
function iterate() { if (gameOfLife == null) { gameOfLife = new Jason.GameOfLife(grid); gameOfLife = gameOfLife.nextIteration(); } else { gameOfLife = gameOfLife.nextIteration(); } grid = gameOfLife.gridCopy(); buildGrid(false); }
[ "iterateLife() {\n // Ensure the grid should be running\n if (!this.state.running) return;\n // Create a deep clone of the current cells, which will be replaced by the next grid\n const nextGrid = JSON.parse(JSON.stringify(this.state.cells));\n // Iterate through each row of cells\n this.state.cells.forEach((...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given the positive integer 15, there are three ways to take consecutive positive integers that sum to 15: 1+2+3+4+5, 4+5+6 and 7+8. Your task is to write a program that, given a positive integer, finds all the ways that consecutive positive integers can sum to the target integer. When you are finished, you are welcome ...
function consecutive_sums(n) { let out = [] for (let i = 1; i < n; i++) { let sum = i let seq = [i] for (let j = i+1; j < n; j++) { sum += j seq.push(j) if (sum == n) { out.push(seq) break } if (s...
[ "function sumOfConsecutivePositiveIntegers(input) {\n //Total number of sequences to return\n let sequences = [];\n //Iterate up to input integer\n for (let i = 1; i < input; i++) {\n //Track current sequence\n let currentSequence = [];\n //Set sum to 0 since we're starting from 1\n let sum = 0;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initGL Initialize WebGL, returning the GL context or null if WebGL isn't available or could not be initialized.
function initGL(canvas) { var gl = null; try { // Try to grab the standard context. If it fails, fallback to experimental. gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); gl.viewportWidth = canvas.width; gl.viewportHeight = canvas.height; } catch(e) {} // If we don't...
[ "function initWebGL() {\n var gl = null;\n try {\n gl = glcanvas.getContext(\"experimental-webgl\");//load the web GL onto the canvas\n gl.viewportWidth=glcanvas.width;//find out the size of the canvas\n gl.viewportHeight=glcanvas.height;\n }\n catch(e) {\n console.log(\"exception caught when gettin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Using url parameter and json context as reference renders the numFact object or just text. Props: None Context: json numFact updateCurrNumberString Router > (APIResponse)
function APIResponse() { const { parameter } = useParams(); const {numFact, updateCurrNumberString, json} = useContext(NumberContext); useEffect(() => { updateCurrNumberString(parameter, true) }, []) // eslint-disable-line react-hooks/exhaustive-deps return ( <div className="API">{json ? JSON.stri...
[ "function getFact(number) {\n fetch(\"http://numbersapi.com/\" + number)\n .then(response => {\n return response.text();\n })\n .then(fact => {\n displayFact(fact);\n })\n}", "function factResponse(fact, req, res, num) {\n const type = req.params.type || \"trivia\";\n var factObj = fact.g...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove the filter and close the list if it is notabove it.
leave(){ if ( this.isOpened && !this.getRef('list').isOver ){ this.isOpened = false; } this.inputIsVisible = false; this.filterString = ''; }
[ "function close_FiltrItem(e){\n let filtrListItem = document.querySelectorAll('.filter_item');\n let filtrToClose = e.path[2].dataset.filtr;\n filtrListItem.forEach( (l) => {\n if(l.dataset.filtr == filtrToClose){\n filter_list.removeChild(l)\n }\n })\n\n filtr_arr = filtr_ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggles the lecture panel
function toggle_lectnav() { // If the lecture panel is not displayed, display it. if (!lectnav_enabled) { lecture_fade_in("list"); document.getElementById("lecture").style.width = "100vw"; document.getElementById("lecture-list").style.opacity = "1"; lectnav_enabled = true; } // If the lecture p...
[ "tutorial_toggle() {\n if (this.isTutorialDialogOpen()) {\n this.tutorial_close();\n\n return;\n }\n\n this.tutorial_open();\n }", "function toggleView() {\n getId(\"intro\").hidden = !getId(\"intro\").hidden;\n getId(\"game\").hidden = !getId(\"game\").hidden;\n}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Turn a CodePipeline Artifact into a FileSet
static fromArtifact(artifact) { try { jsiiDeprecationWarnings.aws_cdk_lib_aws_codepipeline_Artifact(artifact); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, this.fromArtifact); ...
[ "static fromArtifact(artifact) {\n return new CodePipelineFileSet(artifact);\n }", "toCodePipeline(x) {\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_pipelines_FileSet(x);\n }\n catch (error) {\n if (process.env.JSII_DEBUG !== \"1\" && error.name === \"Deprecat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subscribe to click events on the page and see if they are triggering new resources fetched from the network in which case they are interesting to us!
function instrumentClick() { // Capture clicks and wait 50ms to see if they result in DOM mutations BOOMR.subscribe("click", function() { if (impl.singlePageApp) { // In a SPA scenario, only route changes (or events from the SPA // framework) trigger an interesting event. return; } var resourc...
[ "function instrumentClick() {\n // Capture clicks and wait 50ms to see if they result in DOM mutations\n BOOMR.subscribe(\"click\", function() {\n if (impl.singlePageApp && !impl.spaStartFromClick) {\n // In a SPA scenario, only route changes (or events from the SPA\n // framework) trigger ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validate the description of workspace
function checkDescription(){ var description = document.getElementById("description").value; if (isUrl(description)) { alert('Do not enter a URL here. Instead, just enter how you would like to describe your collaborative workspace.'); document.getElementById("description").value = window.descriptiondefault; } ...
[ "function checkProjectName(){\r\n var projectName = $('#projectName').val();\r\n projectName = jQuery.trim(projectName);\r\n\r\n var errors = [];\r\n\r\n if (!checkRequired(projectName)) {\r\n errors.push('project name is empty.');\r\n }\r\n\r\n if (projectName.length > 60){\r\n erro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`STANDARD` Creates an intersection schema. Note this function requires draft `201909` to constrain with `unevaluatedProperties`.
Intersect(items, options = {}) { return { ...options, kind: exports.IntersectKind, type: 'object', allOf: items }; }
[ "withOnly(...propertyList) {\n\t\tthis._assertProperties(propertyList);\n\n\t\tconst result = new Schema(this);\n\t\tresult.$id = this.$id + '/with/' + propertyList.join(',');\n\t\tresult.properties = lodash.pickBy(\n\t\t\tresult.properties,\n\t\t\t(_, key) => propertyList.indexOf(key) >= 0\n\t\t);\n\t\treturn resu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get property descriptor for inName on inObject, even if inName exists on some link in inObject's prototype chain
function getPropertyDescriptor(inObject, inName) { if (inObject) { var pd = Object.getOwnPropertyDescriptor(inObject, inName); return pd || getPropertyDescriptor(Object.getPrototypeOf(inObject), inName); } }
[ "function getPropertyDescriptor(inObject, inName) {\n if (inObject) {\n var pd = Object.getOwnPropertyDescriptor(inObject, inName);\n return pd || getPropertyDescriptor(Object.getPrototypeOf(inObject), inName);\n }\n}", "function hasPrototypeProperty(object,name){\n return !object.hasOwnProperty(name)&...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a function for deletePullRequestHostedPropertyValue / Delete an application property value stored against a pull request.
deletePullRequestHostedPropertyValue(incomingOptions, cb) { const Bitbucket = require('./dist'); let apiInstance = new Bitbucket.PropertiesApi(); // String | The account // String | The repository // String | The pull request ID // String | The key of the Connect app // String | The name of the property. /...
[ "deleteUserHostedPropertyValue(incomingOptions, cb) {\n const Bitbucket = require('./dist');\n\n let apiInstance = new Bitbucket.PropertiesApi(); // String | The user // String | The key of the Connect app // String | The name of the property.\n /*let username = \"username_example\";*/ /*let appKey = \"app...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merge aixs definition from parallel option (if exists) to axis option.
function mergeAxisOptionFromParallel(option){var axes=modelUtil.normalizeToArray(option.parallelAxis);zrUtil.each(axes,function(axisOption){if(!zrUtil.isObject(axisOption)){return;}var parallelIndex=axisOption.parallelIndex || 0;var parallelOption=modelUtil.normalizeToArray(option.parallel)[parallelIndex];if(parallelOp...
[ "function mergeAxisOptionFromParallel(option){\nvar axes=normalizeToArray(option.parallelAxis);\n\neach$1(axes,function(axisOption){\nif(!isObject$1(axisOption)){\nreturn;\n}\n\nvar parallelIndex=axisOption.parallelIndex||0;\nvar parallelOption=normalizeToArray(option.parallel)[parallelIndex];\n\nif(parallelOption&...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a page that has been logged into Board Game Arena Manually logging into BGA (page render and redirects) takes ~2400ms Directly calling login takes (this fn) ~600ms
async function loginBGA(browser, username, password) { const page = await browser.newPage(); await page.setRequestInterception(true); page.on('request', async (interceptedRequest) => { console.log("Intercepting", interceptedRequest.url()); let postData = { "email": username...
[ "function timed_login(user) {}", "function goLogin(obj){\r\n\t//mark inactive on server\r\n\tcheckLogout();\r\n\r\n\t//display home controllers\r\n\tmain();\r\n}", "function checkLogin() {\n if (loggedIn) {\n showAccount();\n } else {\n loginPageTransition();\n }\n}", "async openLoginpa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Shows a scene given sceneId
function showScene(sceneId) { var scene = document.querySelector(sceneId); scene.setAttribute("visible", true); scene.setAttribute("scale", "1 1 1"); }
[ "function goToScene(sceneId) {\n \n var scenes = document.getElementsByClassName(\"scene\");\n console.log('The current space has '+scenes.length+' scenes.');\n \n for (var i = 0; i < scenes.length; i++){\n scenes[i].setAttribute('visible', 'false');\n }\n \n console.log('Show scene '+s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This transform takes the raw MatchField nodes parsed by the compiler and validates the types as well as generating the supported arguments field.
function relayMatchTransform(context: CompilerContext): CompilerContext { return IRTransformer.transform(context, { // $FlowFixMe this transform intentionally changes the AST node type LinkedField: visitLinkedField, // $FlowFixMe this transform intentionally changes the AST node type FragmentSpread: v...
[ "function relayMatchTransform(context: CompilerContext): CompilerContext {\n return IRTransformer.transform(context, {\n MatchField: visitMatchField,\n MatchFragmentSpread: visitMatchFragmentSpread,\n });\n}", "function transformMatchCall (context: ConversionContext, path: NodePath) {\n // the first argu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies default mock handlers to the service worker and any additional handlers specified in `Story.parameters.msw`. Lifted from
function ConfigureMockServiceWorker(Story, { parameters: { msw = [] } }) { // Resets to default handlers worker.resetHandlers() if (!Array.isArray(msw)) { throw new Error(`[MSW] expected to receive an array of handlers but received "${typeof msw}" instead. Please refer to the documentation: https://msw...
[ "function HWorkerServerMock() {}", "function setupHandlers () {\n\n \"use strict\";\n var self = this;\n var worker = self.worker;\n\n // History (group / channel / history)\n worker.on('history', handleHistory.bind(self));\n\n // Error from worker\n worker.on('error', handleError.bind(self))...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a getClassNames function which calls getStyles given the props, and injects them into mergeStyleSets.
function classNamesFunction() { // TODO: memoize. return function (getStyles, styleProps) { return index_1.mergeStyleSets(getStyles && getStyles(styleProps)); }; }
[ "function classNamesFunction() {\n // TODO: memoize.\n return function (getStyles, styleProps) {\n return Object(__WEBPACK_IMPORTED_MODULE_0__uifabric_merge_styles__[\"f\" /* mergeStyleSets */])(getStyles && (typeof getStyles === 'function' ? getStyles(styleProps) : getStyles));\n };\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update post by a selector and then execute callback
function findPostAndUpdateBySelector (selector, update, callback) { models.Post.findOneAndUpdate(selector, update, { new: true }) .exec( function(err, post) { callback(err, post); }); }
[ "async function updatePost(id) {}", "function okToSetPost(owner, postId, finished){\n \n}", "function setPost(owner, postId, content, finished){\n \n}", "editPost(new_post){\n // console.log(\"Editing Post\");\n // console.log(new_post);\n fetch(\"/posts/\" + new_post.id, {\n body: JSON.st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }