query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
flagSet handles flags and it assumes the current cursor points to a first dash.
function flagSet() { if (cursor < input.length - 1 && input[cursor + 1] == "-") { return longFlag(); } cursor++; // skip leading dash while (cursor < input.length && !whitespace(input[cursor])) { var flagName = input[cursor]; ...
[ "function flagSet() {\n\t\t// long flag form?\n\t\tif (cursor < input.length-1 && input[cursor+1] == \"-\") {\n\t\t\treturn longFlag();\n\t\t}\n\n\t\t// if not, parse short flag form\n\t\tcursor++; // skip leading dash\n\t\twhile (cursor < input.length && !whitespace(input[cursor]))\n\t\t{\n\t\t\tvar flagName = inp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a boolean for whether the view is attached to a container.
function viewAttachedToContainer(view) { return isLContainer(view[PARENT]); }
[ "function viewAttachedToContainer(view) {\n return isLContainer(view[PARENT]);\n }", "function viewAttachedToContainer(view) {\n return isLContainer(view[PARENT]);\n}", "function viewAttachedToContainer(view) {\n return isLContainer(view[PARENT]);\n}", "function elementInView() {\n\t\treturn (($co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function that takes a frequency and maps it to a distance from the center of the circle based on the distance between the inner and outer radii
function freqToDist(frequency){ const percentFreq = (frequency - minFreq) / (maxFreq - minFreq); const distFromInner = ((outerRadius * 2 - innerRadius * 2) * percentFreq); return distFromInner + innerRadius; }
[ "function nodeFreqToRadius(freq) {\n return 1.5 * Math.pow(freq, 0.4);\n}", "function circleSize(magnitude) {\r\n return magnitude ** 2;\r\n}", "function drawFreqCircle() {\n if (userData.device === 'pc') {\n circleSpectrum = frequencyCircle.analyze();\n } else if (userData.device === 'smartpho...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
All blobs that aren't mine
function getOtherBlobs(){ return _.omit(zeach.allNodes, zeach.myIDs); }
[ "function getOtherBlobs(){\r\n return _.omit(zeach.allNodes, zeach.myIDs);\r\n }", "function getOtherBlobs(){\n return _.omit(nodes, myIDs);\n }", "function noBlobs() {\r\n\tif (buffer == 0) {\r\n\t\tclear();\r\n\t}\r\n\telse if (buffer == -1){\r\n\t\t// do nothing, infinite memory\r\n\t}\r\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear all role checkboxes in a row
function clear_role_checkboxes(e) { var user_id = $(this).attr('id').substr(7); for (var i in roles) { $('#checkbox-'+roles[i]+'-'+user_id).attr('checked', false); } }
[ "function clear_role_checkboxes(e) {\n var user_id = $(this).attr('id').substr(7);\n for (var i in roles) {\n $('#checkbox-'+roles[i]+'-'+user_id).attr('checked', false);\n }\n}", "function resetRoleListbox() {\n // Reset the role settings\n $('#orgRoleList input').each(function (ind...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
grabs the score element and adds plus 1 to it everytime there is a successful click.
function score(){ if(gameStart){ var s = document.getElementById("score"); s.innerText++; removeClick(); resetAll(); } }
[ "function incrementScore() {\n score = score + 1;\n $(\"#correctMatches\").html(score);\n }", "function updateScore() {\n score++;\n $('.score').text(score);\n }", "_incScore() {\n this.score++;\n this.scoreElem.innerText = \"Score: \" + this.score;\n }", "function _incrScore() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updateUserMod: adds user info onto modal by calling getInfo and extracting its details button calls this function to update modal and show it needs to be called after userModal has been called
function updateUserMod (self, userID, authorisation) { //select the modal and clear it const userMod = document.querySelector('#userMod-content'); helper.deleteChildren(userMod); //add title const modalTitle = helper.createEle('h1', 'My Details', 'centre-align'); userMod.appendChild(modalTitle)...
[ "function userModal () {\n const modal = helper.buildModal('user-modal','userMod-content');\n return modal;\n}", "function fillAndShowUpdateProfileModal(data, userType) {\n var profileDetails;\n if (userType === 'supervisor') {\n profileDetails = data[0];\n } else if (userTyp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
11 Create a function called arrayExceptLast that accept an array and return the entire array except the last elemnt hint: search abou the function that will cut the array on MDN var nums= [1,2,3,8,9] Ex: arrayExceptLast(nums) => [1,2,3,8] try more cases by your self
function arrayExceptLast(arr){ return arr.slice(); }
[ "function arrayExceptLast(array){\n\n // return array.splice(0,array.length-1)\n array.pop();\n return array;\n\n}", "function arrayExceptLast(array){\n array.pop()\n return array ;\n}", "function arrayExceptLast (x)\n{var l = x.length;\nreturn x.slice(0, l-1 ) \n}", "function arrayExceptLast...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rotate matrix by 180 degrees
function rotateMatrix180(matrix) { var x, y, resultX, resultY, result = []; for (y = matrix[0].length - 1, resultY = 0; y >= 0; y--, resultY++) { result[resultY] = []; for (x = matrix.length - 1, resultX = 0; x >= 0; x--, resultX++) { result[resultY][resultX] = matrix...
[ "function rotateMatrix(matrix) {\n\n}", "function matrixRotation(matrix, r) {}", "rotate(outMatrix, inMatrix, radians, axis) {\r\n // @todo\r\n }", "function rotate(matrix,direction) {\n\tif (direction === 1) {\n\t\t//rotate clockwise\n\t\tangle--;\n\t} else {\n\t\tangle++;\n\t}\n\tmatrix[0] = Math....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserts `element` into `array` at `index`. Caps `index` to be between `0` and `array.length`
function insert(array, element, index) { //if (array) { index = _Math__WEBPACK_IMPORTED_MODULE_0__["fitToRange"](index, 0, array.length); array.splice(index, 0, element); //} }
[ "function insert(arr, element, index) {\n insertAll(arr, [element], index);\n}", "function insert(array, element, index) {\n //if (array) {\n index = fitToRange(index, 0, array.length);\n array.splice(index, 0, element);\n //}\n}", "function insert(array, element, index) {\n //if (array) {\n inde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disposes of the proxy object, removes event listeners, and drops all references to the underlying message manager. Must be called before the last reference to the proxy is dropped, unless the underlying message manager or is also being destroyed.
dispose() { if (this.eventTarget) { this.removeListeners(this.eventTarget); this.eventTarget = null; } this.messageManager = null; Services.obs.removeObserver(this, "message-manager-close"); }
[ "destroy() {\n if (this.proxy) {\n this.proxy.detach(this.subscription);\n }\n this.proxy = null;\n this.lastTarget = null;\n this.subscription = null;\n }", "_cleanProxy () {\n this._rpcListeners.clear();\n if (this._sdlSession !== null && this._sdlS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
MainCategory Category addnew Validation
function validateCategoryNew() { //Error Language var err_lang_arr = error_language(); var maincatename = $.trim($("#maincatename").val()); //alert(maincatename); return false; if(document.getElementById("maincat_option_normal").checked == true){ var cateoption = $.trim($("#maincat_option_no...
[ "validateCategory() {\n this.validateXpath(\n 'itemMeta > links > link[type=\"x-im/category\"]',\n 'At least one category must be chosen.'\n )\n }", "function checkAddCategory()\n{\n\t\n\tvar isFormValid = false;\n\tif(goThroughRequiredInputs(\"newcategory\"))\n\t{\n\t\t//va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
gets the product line items
function getProductLineItems() { return ensureArray( _.filter(this.items, function (item) { return item.lineItemTypeField.alias === 'Product'; })); }
[ "getLineItems() {\n let items = [];\n this.lineItems.forEach(item =>\n items.push({\n type: 'sku',\n parent: item.sku,\n quantity: item.quantity,\n })\n );\n return items;\n }", "assembleLineItems(){\n return this.props.bom.items.reduce((sum,item,n)=>{\n sum.pus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
These next functions are for our Tension Accents
function SetTensionAccent () { if( showTension == true ) { // Check our images and make sure they are active if( tensionAccentUp != null && tensionAccentUp.gameObject.activeInHierarchy == false ) tensionAccentUp.gameObject.SetActive( true ); if( tensionAccentDown != null && tensionAccentDown.gameObjec...
[ "calculateTensionFunction() {\n let tFuMap = [10, 30, 60].map((v) => v ** ((this.tension-5) / 2) )\n let ret = normalizeAndGetRandomFromMap(tFuMap)\n return ret\n }", "calculateTensionFlavor() {\n let tFlMap = [50, 30, 20].map((v) => v ** ((this.tension-5) / 2) )\n let ret = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rounds up all blocks defined by hook_block_info and places them in the drupalgap.blocks array.
function drupalgap_load_blocks() { try { /*drupalgap.blocks[0] = {}; var modules = module_implements('block_info'); if (modules) { $.each(modules, function(index, module){ var blocks = module_invoke(module, 'block_info'); if (blocks) { $.each(blocks, function(delta, b...
[ "function loadBlocks(){\n\t\t\t\n\t\t}", "function Populate_blocks () {\n block_order = []; // Reset Blocks\n\n for(var i = 0; i < BLOCK_QUEUE.length; i++){\n if(BLOCK_QUEUE[i] == labels[0]) {continue;} // Deleted By User\n if(BLOCK_QUEUE[i] == labels[1]) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test whether a message handler has posted messages pending delivery.
function hasPendingMessages(handler) { return getDispatcher(handler).hasPendingMessages(); }
[ "function hasPendingMessages(handler) {\r\n return getDispatcher(handler).hasPendingMessages();\r\n}", "function hasPendingMessages(handler) {\n return getDispatcher(handler).hasPendingMessages();\n }", "function hasPendingMessages(handler) {\n\t return getDispatcher(handler).hasPendingM...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check for FDC3 support
function fdc3OnReady(cb) { if (window.fdc3) { cb() } else { window.addEventListener('fdc3Ready', cb) } }
[ "function isTHREEAvailable() {\n return typeof THREE !== 'undefined';\n }", "function isD3Available(){\n\n\treturn window[\"d3\"] != undefined;\n}", "function requireCf(){\n return (execSync('cf --version').toString().indexOf('not found') === -1);\n}", "function is3PCSupported() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create folders for deploy
async function generateFolders() { fs.stat('deploy', function(err) { if (!err) { return; } else if (err.code === 'ENOENT') { fs.mkdir('deploy', function(err) { if (err) { console.log(colors.bgRed('failed to create doployment folder!')); } else { ...
[ "_createAppFolders() {\n\n /* Base folder */\n mkdirp('app/fonts');\n mkdirp('app/images');\n mkdirp('app/scripts');\n mkdirp('app/styles');\n\n /* Folder for enginge */\n mkdirp('app/_documentation');\n mkdirp('app/_config');\n mkdirp('app/_patterns');...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
METHODS / Getter for _head. Returns the head node.
get head() { return this._head; }
[ "function _getHead() {\n return _head;\n }", "function _getHead() {\n return head;\n }", "function getHead(){\n\t\treturn head;\n\t}", "getHead() {\n return this.head;\n }", "head() {\n return this._head === null ? null : this._head.data;\n }", "getHeadNode() {\n return this...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a cell based on some simple data
function createCell(rowNum, columnIdx, cellData) { var col = CellRefUtil.columnIndexToName(columnIdx); var cell; // allow null cells if (cellData == null) { var cell = { f: null, is: null, v: null, r: col + rowNu...
[ "function createCell() {\n var cell = {\n minesAroundCount: 0,\n isShown: false,\n isMine: false,\n isMarked: false,\n value: ''\n }\n return cell\n}", "function createCell() {\r\n //Setting each cell to default values (the moment its inserted into the 2D array)\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change the url based on glyphs equipped
function changeUrlGlyphs(glyphs) { $location.search('glyphs', generateUrlGlyphs(glyphs)); }
[ "function getUrlGlyphs() {\n return $location.search().glyphs;\n }", "createURL() {\n\t\tthis.finalURL = [];\n\t\tthis.apiURL.map((name, index, arr) => {\n\t\t\tindex === 0 || index === 1\n\t\t\t\t? this.finalURL.push(name)\n\t\t\t\t: index === arr.length - 1\n\t\t\t\t? this.finalURL.push(`|${name}&display=sw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::CloudFront::Distribution.StatusCodes` resource
function cfnDistributionStatusCodesPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnDistribution_StatusCodesPropertyValidator(properties).assertSuccess(); return { Items: cdk.listMapper(cdk.numberToCloudFormation)(properties.items), ...
[ "function cfnWebACLResponseInspectionStatusCodePropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_ResponseInspectionStatusCodePropertyValidator(properties).assertSuccess();\n return {\n FailureCodes: cdk.listMapper(cdk.numberToC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset the slider and all graph
function resetGraph(){ d3.select("#handle-one").style("left","0%"); d3.select("#handle-two").style("left","100%"); d3.select(".d3-slider-range").style("left","0%").style("right","0%"); }
[ "function resetSlider() {\r\n slider.value = 0;\r\n}", "function reset_slider(){\r\n \tslider.value = 0;\r\n }", "function reset_slider() {\n slider.value = 0;\n}", "resetSliders(){\n\t\tlet sliders = this.Sliders\n\t\tsliders[0].value(0.8);\n\t\tsliders[1].value(0.8);\n\t\tsliders[2].value(1);\n\t\tslide...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when clicking on a flight notification, dismiss it
dismiss(flight) { this.flightNotification.initFlight(flight); // if not flight notification are left close the toast if (!this.flightNotification.stillNotifications()) this.closeToast(); }
[ "function closeNotification(e) {\n var notification = document.getElementById(\"notification\");\n notification.style.display = \"none\";\n}", "function dismiss() {\n chrome.storage.sync.get({ VFM_NOTIF: \"\" }, (get) => {\n const check = get.VFM_NOTIF;\n check.notifOld = notifNew;\n check.notifSt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loop through received messages.
async loop () { while (true) { const events = await this.getMessages() this.processQueue() events.forEach(element => { try { const parsedElement = JSON.parse(element.payload.body) this.emit(`message:${parsedElement.recipe}`, parsedElement) this.emit('message'...
[ "function _receivedAll(messages){\n console.log(messages);\n return true ;\n }", "function process(callback) {\n if(messages.length < 1) {\n callback(false);\n return;\n }\n\n for(messageIndex in messages) {\n callback(consume());\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add a project through the professor
function addProject(project, professor_id) { project.professor_id = professor_id; return db('projects') .insert(project, 'id') .then(ids => { const [ id ] = ids; return db('projects') .where({ id }) .first(); ...
[ "function addProject() {\n const inputname = document.querySelector('.project_name_input').value; //get input data from dom\n if (inputname == '')\n return;\n data.projects.push(new project(inputname, data.projects.length)) //add new project with name and id to list\n\n }", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a source at the specified url.
function getSource(threadClient, url) { let deferred = promise.defer(); threadClient.getSources((res) => { let source = res.sources.filter(function(s) { return s.url === url; }); if (source.length) { deferred.resolve(threadClient.source(source[0])); } else { deferred.reject(new...
[ "function getSource(url) {\n // TODO reuse source from script tags?\n if (!(url in sourceCache)) {\n sourceCache[url] = ajax(url).split('\\n');\n }\n return sourceCache[url];\n }", "function readURL(url) {\n return getResource(url);\n }", "function getSource(s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy libs file from nodemodules to dist
function copyLibs(callback) { return src(npmDist(),{base: paths.base.node}) .pipe(dest(paths.dist.libs)); callback(); }
[ "function copy() {\n gulp.src(npmDist(), {\n base: './node_modules'\n })\n .pipe(gulp.dest('./assets/libs'));\n}", "async function copy() {\r\n gulp.src(npmDist(), {\r\n base: './node_modules'\r\n })\r\n .pipe(gulp.dest('./src/assets/libs'));\r\n}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PRIVATE: Creates a card slider element, with all functional parts nested
_createCardSliderElement() { // create the top level parent const cardSlider = document.createElement("div"); cardSlider.classList.add("card-slider"); // create the cards container const cards = document.createElement("div"); cards.classList.add("cards"); ...
[ "_createCardSliderElement() {\n // create the top level parent\n const cardSlider = document.createElement(\"div\");\n cardSlider.classList.add(\"card-slider\");\n\n // create the cards container\n const cards = document.createElement(\"div\");\n cards.classList.add(\"cards\");\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set mock data of a particular storageUtilized and numberOfObjects
function setMockData(data, timestamp, cb) { const prefixValuesArr = getPrefixValues(timestamp); const { storageUtilized, numberOfObjects } = data; prefixValuesArr.forEach(type => { const { key } = type; if (storageUtilized) { memoryBackend.data[`${key}:storageUtilized:counter`] =...
[ "function setMockData(data, timestamp, cb) {\n const prefixValuesArr = getPrefixValues(timestamp);\n const { storageUtilized, numberOfObjects } = data;\n prefixValuesArr.forEach(type => {\n const { key } = type;\n if (storageUtilized) {\n memoryBackend.data[`${key}:storageUtilized:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns our labeled legend, with a color bar and three labels representing the minimum, middle, and maximum values.
function makeLegend() { var labelPanel = ui.Panel( [ ui.Label(Math.round(undoColorStretch(0)), {margin: '4px 8px'}), ui.Label( Math.round(undoColorStretch(0.5)), {margin: '4px 8px', textAlign: 'center', stretch: 'horizontal'}), ui.Label(Math.round(undoColorStretch...
[ "function makeLegend() {\n var labelPanel = ui.Panel(\n [\n ui.Label('schlecht', {fontSize: '10x', margin: '4px 8px'}),\n ui.Label('',\n {margin: '4px 8px', textAlign: 'center', stretch: 'horizontal'}),\n ui.Label('gut', {fontSize: '12px', margin: '4px 8px'})\n ],\n u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds month picker functionality
function addMonthPickerFunctionality() { const d = new Date(); $(".month-text").text(MONTH_NAMES[d.getMonth()]); document.getElementById("list").addEventListener("click", function (e) { $(".month-text").text(e.target.innerHTML); applyDateFilter(e.target.innerHTML); }); }
[ "function month_picker() {\n var month_menu = new Date(actual_month.value);\n actual_calendar.innerHTML = month_menu.calendar();\n eventMonth = month_menu.getMonth()+1;\n controllerFunction()\n}", "function onChange_selectMonth(){\n date.setMonth(month.value);\n render_calenda();\n update_actDay();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the elevator direction indicator based on elevator.dir
function setIndicators(elevator) { if (elevator.dir == "up") { elevator.goingUpIndicator(true); elevator.goingDownIndicator(false); } else if (elevator.dir == "down") { elevator.goingUpIndicator(false); elevator.goingDownIndicator(t...
[ "function elevDir(elev) {\r\n var up = elev.id + \"Up\";\r\n var dn = elev.id + \"Dn\";\r\n\r\n if (elev.dir == \"up\") {\r\n //if the elevator is going up, make the down arrow grey\r\n $(\"#\" + up).removeClass(\"inactive\");\r\n $(\"#\" + dn).addClass(\"inactive\");\r\n } else if (elev.dir == \"dn\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the musical note's standard frequency
function getStandardFrequency(note) { // eslint-disable-next-line no-restricted-properties return middleA * Math.pow(2, (note - semitone) / 12); }
[ "frequency() {\n\t\t// Using http://www.glassarmonica.com/science/frequency_midi.php\n\t\t// f = 27.5 * 2 ^ ((midi - 21)/12)\n\t\t// Midi notes are from 21 (A0, 27.5Hz) to 108 (C8, 4186Hz)\n\t\treturn 27.5 * Math.pow(2, (this.midi() - 21.0) / 12.0)\n\t}", "function frequencyFromNoteNumber( note )\n{\n\treturn 440...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fills list of possible months in data
function fill_Month_List(data) { for (var key in data) { monthList.push(key) } }
[ "function fill42(year, month) {\n const day1 = firstDay(year, month);\n const monthlyCalendar = [];\n let date = 1;\n\n for (let i = 0; i < 42; i++) {\n if (i < day1 || date > daysInMonth(year, month)) {\n monthlyCalendar.push(null);\n } else {\n monthlyCalendar.push(date);\n date++;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines whether the active section or slide is scrollable through and scrolling bar
function isScrollable(activeSection){ return activeSection.filter('.pp-scrollable'); }
[ "function isScrollable(activeSection){\n //if there are landscape slides, we check if the scrolling bar is in the current one or not\n if(activeSection.find(SLIDES_WRAPPER_SEL).length){\n return activeSection.find(SLIDE_ACTIVE_SEL).find(SCROLLABLE_SEL);\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function fetches the statuses from the video
function getStatus(video) { //create the object let status = {} //use the same "commands" as the video commands for clarity plz if (video.paused == false) { status.paused = 0; } else if (video.paused == true) { status.paused = 1; } status.currentTime = video.currentTime ...
[ "async getStatus(videoId) {\n return rev.get(`/api/v2/videos/${videoId}/status`);\n }", "getGameStatus() {\n this.setMethod('GET');\n this.setPlayerId();\n return this.getApiResult(`${Config.PLAY_API}/${this.playerId}/status`);\n }", "function fetchStatusList() {\n // Reques...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets a slot number
set_slot(slotNumber) { this.memory.push(this.last()); return parseInt(this.memory[slotNumber - 1]); }
[ "setSlot(slot) {\n this.slots = slot;\n this.isSlotSelected = true;\n }", "set_value(n, value) {\n this.slots[n * 2 + 1] = value;\n }", "function addSlot() {\n addSlotNumbered(1);\n}", "setSlot(slotName) {\n\t\tthis.test.armSlot = slotName\n\t}", "set_name(n, name) {\n this.slots[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves all DOM elements matching a given XPath expression.
getElementsByXPath(expression, scope) { scope = scope || document; let nodes = []; let a = document.evaluate(expression, scope, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (let i = 0; i < a.snapshotLength; i++) { nodes.push...
[ "function getElementsByXpath(xPath) {\r\n\tvar elm = document.evaluate(xPath, document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);\r\n\treturn elm;\r\n}", "function $x(xpath,root){var got=document.evaluate(xpath,root||document,null,null,null),result=[];while(next=got.iterateNext())result.push(next);re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes in the timeline object and updates the positions of its markers to display an evenly spaced, nonlinear representation
function nonlinearTransform(timeline) { var events = timeline.events; var spacing = timeline.absLen / events.length; timeline.sd = spacing; for (var i = 0; i < events.length; i++) { var offsetFromStart = spacing * i; var properties = { y: (timeline.yOffset + offsetFromStart) ...
[ "function linearTransform(timeline) {\n var events = timeline.events;\n\n // for each event in the timeline.events array, this block linearly interpolates \n // from the time the event occured relative to the start of the narrative to its\n // according pixel position on the timeline object and updates ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate an inbetween shadow.
function calculateShadow(begin, end, pos) { var parts = []; if (begin.inset) { parts.push('inset'); } if (typeof end.color != 'undefined') { parts.push('#' + get2hex(begin.color[0] + pos * (end.color[0] - begin.color[0])) + get2hex(begin.color[1] + pos * (end.color[1] - begin.color[1])...
[ "get shadows() {}", "function drawShadow(){\n shadowsize = (y/11);\n //x size is roughly double y size, hence shadowsize is halved for y\n ctx.drawImage(landershadow, x+2, canvas.height-25, shadowsize, (shadowsize/2.25));\n}", "get shadowNormalBias() {}", "calcShadow() {\n let yTemp = Global.h...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attaches listeners to draggable
attach() { this.draggable.on('draggable:initialize', this[onInitialize]).on('draggable:destroy', this[onDestroy]); }
[ "attachDragListeners () {\n\t\tthis.container.addEventListener(\"drag\", function (event) {\n\t\t\t\n\t\t}, false)\n\n\t\tthis.container.addEventListener(\"dragstart\", this.dragStart.bind(this), false);\n\t\tthis.container.addEventListener(\"dragend\", this.dragEnd.bind(this), false);\n\t\tthis.container.addEventL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Builds tree brach or root tree from json data parameter data contains two collections data.nodes and data.elements. Nodes are implemented as folders and elements are implemented as tree leafs.
function _buildFromJson(data, container, options, isBase) { if (data.nodes.length == 0 && data.elements.length == 0) { container.append('<ul><li class="ui-nd">no data</li></ul>'); return; } var ul = $('<ul class="ui-tree"/>'); $.each(data.nodes, function(i,val) { var v = val.node; ...
[ "generateTree(data) {\n\n\t // build hierarchical source.\n\t var map = {}\n\t var dataSize = data.length;\n\t for(var i = 0; i < dataSize; i++){\n\t var obj = data[i]\n\t if(!(obj.Id in map)){\n\t map[obj.Id] = obj\n\t map[obj.Id].children = []\n\t }\n\n\t ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
for check track1 data is present in swipe string :AJ Accepted Payment
function hasTrack1(trackData) { var i = trackData.indexOf("%"); var j = (i >= 0) ? trackData.indexOf("^") : -1; var k = (j > 0) ? trackData.indexOf("^", j + 1) : -1; var l = (k > 0) ? trackData.indexOf("?") : -1; return (i >= 0 && l > k && k > j && j > i); }
[ "function hasTrack2(trackData) {\n\n\n var i = trackData.indexOf(\";\");\n return (i >= 0 && trackData.indexOf(\"?\", i + 1) >= 0);\n\n}", "function ParseStripeData() {\n var TrackData = $('#swiper').val();\n var p = new SwipeParserObj(TrackData);\n\n if(p.hasTrack1)\n {\n // Populate for...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a message using a message key and use the tokens as values for tokenization.
getMessage(key, tokens = []) { return this.getMessageWithMap(key, tokens, this.messages); }
[ "function getMessage(key) {\n var messageSearchKeys = generateMessageSearchKeysImpl(key);\n if(messageSearchKeys && messageSearchKeys.length > 0) {\n for(var i = 0; i < messageSearchKeys.length; i++) {\n if(messages.hasOwnProperty(messageSearch...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
save file to jpg
function saveJPEG(path, name, quality){ var exp = new ExportOptionsSaveForWeb(); exp.format = SaveDocumentType.JPEG; exp.interlaced = false; exp.optimized= false; exp.quality = quality; fileObj = new File( getFileName(path, name, "jpg")); activeDocument.exportDocument(fileObj, ExportType.SAVEFORWEB, exp);...
[ "function saveImageAsFile() {\n \n }", "function save(image) { image.write(path.join(root, file.filename)); }", "function saveJPEG(doc, saveFile, qty) {\n var saveOptions = new JPEGSaveOptions();\n saveOptions.embedColorProfile = true;\n saveOptions.formatOptions = FormatOp...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Timed events (NOT autoclicking) /////////////////// Times out after tax rate is 60%
function taxHike() { if (taxRate < 0.60) { taxRate += 0.01; setTimeout(taxHike, 2*1000); } }
[ "function setTimers()\r\n{\r\n \r\n\r\n function tmUpdateResource(ri, quantum)\r\n {\r\n var i;\r\n var resNodesList = document.getElementsByClassName(\"timeout\" + ri);\r\n\r\n for ( i = 0; i < resNodesList.length; ++i )\r\n {\r\n var aResNode = resNodesList.item(i);\r\n v...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Writes a hidden for property 'methodToCall' set to the given value. This is useful for submitting forms with JavaScript where the methodToCall needs to be set before the form is submitted.
function setMethodToCall(methodToCall) { jq("<input type='hidden' name='methodToCall' value='" + methodToCall + "'/>").appendTo(jq("#formComplete")); }
[ "function setMethodToCall(methodToCall) {\r\n jQuery(\"<input type='hidden' name='methodToCall' value='\" + methodToCall + \"'/>\").appendTo(jQuery(\"#\" + kradVariables.FORM_COMPLETE_ID));\r\n}", "_method(method) {\n return `<input type=\"hidden\" name=\"_method\" value=\"${method.toUpperCase()}\">`;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
calculate node's bbox from bboxes of its children
function calcBBox(node, toBBox) { node.bbox = distBBox(node, 0, node.children.length, toBBox); }
[ "function calcBBox(node, toBBox) {\nnode.bbox = distBBox(node, 0, node.children.length, toBBox);\n}", "function calcBBox(node, toBBox) {\n node.bbox = distBBox(node, 0, node.children.length, toBBox);\n }", "function calcBBox(node, toBBox) {\n node.bbox = distBBox(node, 0, no...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds the next month's dates to the end of dateArray up to a maximum equalling the total remaining cells; extra numbers will not render on the page
function fillNext() { const nextMonth = moment(currentDate).add(1, 'month'); const nextStartDay = nextMonth.startOf('month').day(); for (let i = nextStartDay; i < 14; i++) { dateArray.push(i - nextStartDay + 1) } }
[ "function addDaysFromNextMonth(){\n if(new Date(dateInfo.currentYear, dateInfo.currentMonth, monthInfo[dateInfo.currentMonth][1],0,0,0,0).getDay()!=6){\n var day = new Date(dateInfo.currentYear, dateInfo.currentMonth+1, 1,0,0,0,0).getDay();\n var j=1;\n for(i=day;i<=6;i++){\n crea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
update square position and keep it in bounds
updatePosition(sqr) { if(sqr.x > window.innerWidth - sqr.width) sqr.x = window.innerWidth - sqr.width; if(sqr.x < sqr.width) sqr.x = sqr.width; if(sqr.y > window.innerHeight - sqr.height) sqr.y = window.innerHeight - sqr.height; if(sqr.y < sqr.height) sqr.y = sqr.height; sqr.div.style.left = sqr.x + "px"; ...
[ "function repositionSquare(square) {\n var buffer = 20;\n \n // position the square on the screen according to the row and column\n square.element.css('left', square.column * SQUARE_SIZE + buffer);\n square.element.css('top', square.row * SQUARE_SIZE + buffer);\n}", "update() {\n // Checks if mouse is ove...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle cases where the Leader has 'stepped_down'
onStepDown(handler) { this.me.on('stepped_down', (election) => { handler(election); }); }
[ "tickDownBonus () {\n // only count down if the bonus > 0 AND the level is still being played.\n if (this.state.timeBonus - this.props.misclicks*100 <= 0) {\n this.setState({\n isTimeOut: true\n })\n return\n }\n if (this.props.isLevelCompl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
9 Write a function called canIGetADrivingLicense that: accept 1 parameter represent the age and if the age greater than or equal to 20 return "yes you can" otherwise return "please come back after X years to get one" Ex: canIGetADrivingLicense(21) => "yes you can" Ex: canIGetADrivingLicense(17) => "please come back aft...
function canIGetADrivingLicense(age){ if(age>=20){ return "yes you can"; }else{ return `please come back after ${20-age} years to get one`; } }
[ "function canIGetADrivingLicense(age) {\r\n if (age >= 20) {\r\n return 'yes you can';\r\n } else\r\n {\r\n return `please come back after ${20 - age} years to get one`;\r\n }\r\n}", "function canIGetADrivingLicense(age) {\r\n if (age >= 20) {\r\n return \"yes you can\";\r\n } else {\r\n let nu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns either the location of the property's first thumbnail url OR an "image not available" image, if there is none.
function getThumbnail(images) { if (images) { return images[0].thumb; }else{ return "../img/map/noimageavailable.png"; } }
[ "get thumbnail() {\n var _a, _b;\n return (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.asset) === null || _b === void 0 ? void 0 : _b.thumbnail;\n }", "function getThumbnailUrl(item) {\n return item.$thumbnail ? item.$thumbnail.image + '?width=320&height=180&mode=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Combine text from multiple HTML elements, specifically used for concatenating cast names
function combineCastNames(elements){ let cast = ''; for (let i=0;i<elements.length;i++){ cast += cheerio(elements[i]).text(); if (i != elements.length-1){ cast += '&'; } } cast = cast.replace(/\s/g,''); return cast; }
[ "function combineText(texts) {\n return texts.items.map(x => x.str).join(' ');\n}", "function JoinPhoneElements(elems) {\n try {\n var a = [];\n for (var i = 0; i < elems.length; i++) {\n a.push(elems[i].innerText);\n }\n return a.join(\", \");\n } catch (err) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DataProvider containing Records, FieldProperties and record display expectations FileAttachment fields
function fileAttachmentDataProvider() { var localFile = 'file://c:/local/package/file/batFile.bat'; var urlFile = 'http://www.intuit.com/some/file/zipFile.zip'; var httpsURLFile = 'https://www.intuit.com/some/file/zipFile.zip'; var linkText = 'some link text'; /** * Fi...
[ "function noFlagsFileAttachmentDataProvider(fid) {\n // Local file attachment\n var localFileAttachmentInput = [{id: fid, value: localFile}];\n var expectedLocalFileAttachmentRecord = {id: fid, value: localFile, display: localFile};\n\n // HTTP file attachment\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If token type is whitespace, lineterminator or comment then skip forward and return true Otherwise return false
processWhiteSpace(type, length) { if(type === this.Token.WhiteSpace) { this.skipToken(length); return true; } else if(type === this.Token.LineTerminatorSequence) { this.newLine(length); this.skipToken(length); return true; } else if(typ...
[ "static isWhiteSpaceToken(token) {\n const str = token.data;\n for (let i = 0; i < str.length; i++) {\n const c = str[i];\n if (c !== ' ' && c !== '\\n' && c !== '\\r' && c !== '\\t' && c !== '\\f')\n return false;\n }\n return true;\n }", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert a channel name of the form ;;; to an object.
function convertChannelNameToObject(channel) { channel = channel.split(';'); // Remove private- from the beginning of the network name. var network = channel[0].split('-'); network.shift(); // Rejoin the network field in case the network name had '-'s in it. network = network.join('-'); ...
[ "function splitChannel(channelString) {\n // input in the form of \"ID|name\"\n var channelSpl = channelString.split(\"|\");\n var channl = {\n id: channelSpl[0],\n name: channelSpl[1]\n };\n return channl;\n}", "function normalizeChannel(name) {\n return \"#\" + ltrim(name.toLower...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for when the Unarchive action is clicked. Args: ev (Event): The event that triggered the callback.
_onUnarchiveClicked(ev) { ev.stopPropagation(); ev.preventDefault(); this.model.updateVisibility('unarchive'); }
[ "_onArchiveClicked(ev) {\n ev.stopPropagation();\n ev.preventDefault();\n\n this.model.updateVisibility('archive');\n }", "function archiveClosedHandler(event){\n\tloadArchive();\n}", "function onUnarchive(){\n const sendData = {\n user_email: this.tab.state.user_email, user_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sends Jingle 'transportreject' message which is a response to 'transportreplace'.
sendTransportReject(success, failure) { // Send 'transport-reject', so that the focus will // know that we've failed const transportReject = $iq({ to: this.remoteJid, type: 'set' }) .c('jingle', { xmlns: 'urn:xmpp:jingle:1', action: 'transp...
[ "sendTransportReject(success, failure) {\n // Send 'transport-reject', so that the focus will\n // know that we've failed\n let transportReject = Object(strophe_js__WEBPACK_IMPORTED_MODULE_2__[\"$iq\"])({\n to: this.remoteJid,\n type: 'set'\n }).c('jingle', {\n xmlns: 'urn:xmpp:jingle:1',...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initialize properties to make this waypoint a flyover waypoint
_initFlyOverWaypoint() { this._isFlyOverWaypoint = true; }
[ "function waypointsInit() {\n\n var headerWaypoint = new Waypoint({\n element: document.getElementById('masthead'),\n offset: -5,\n handler: function (direction) {\n if (direction === 'down')\n this.element.classList.remove('animation-on');\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
obtiene la direccion de fotos aleatoriamente
function obtainExternalPhotos() { const random = Math.floor(Math.random() * (paths.length)); const pathImage = path.join(__dirname, "../images/" + paths[random]) return pathImage; }
[ "imagenesDeTempHaciaPost(userId) {\n const pathTemp = path_1.default.resolve(__dirname, '../uploads', userId, 'temp');\n const pathPost = path_1.default.resolve(__dirname, '../uploads', userId, 'posts');\n console.log('temp', pathTemp);\n console.log('post', pathPost);\n if (!fs_1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if client supports pointer events.
function supportsPointerEventsFn() { // check cache if (_supportsPointerEvents !== undefined) return _supportsPointerEvents; var element = document.createElement('x'); element.style.cssText = 'pointer-events:auto'; _supportsPointerEvents = (element.style.pointerEvents === 'auto'); return _supportsPointer...
[ "function isPointerSupported() {\n return (\"onpointerdown\" in document.documentElement);\n }", "function isPointerSupported() {\n return (\"onpointerdown\" in document.documentElement);\n }", "function usePointerEvent() {\n\t // TODO\n\t // pointermove event dont trig...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Aligns the responsive element with the viewport edges.
alignToViewport() { if (this.isAlignedToViewport_) { return; } this.isAlignedToViewport_ = true; const vsync = Services.vsyncFor(this.win_); const layoutBox = this.element_.getLayoutBox(); const viewportSize = Services.viewportForDoc( this.element_.getAmpDoc() ).getSize(); co...
[ "function adjustToScreenAspectRatio(){\n\n\tvar iDistance = height / 483.5814286;\n\tvar rDistance = width / 533.33333;\n\n\tminI = -iDistance;\n\tmaxI = iDistance;\n\tminR = -0.4 - rDistance;\n\tmaxR = -0.4 + rDistance;\n}", "function calculateViewportBoundaries() {\n var pctInView = settings.pctInView / ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
negate makes s sentence mean s opposite thing.
function negate(s) { //these are cheap ways to negate s meaning // ('none' is ambiguous because it could mean (all or some) ) var logic_negate = { //some logical ones work "everyone": "no one", "everybody": "nobody", "someone": "no one", "somebody": "nobody", ...
[ "function negated() {\n return (options.negate) ? '' : 'not ';\n }", "function negate() {\n emitLn('NEG D0');\n}", "function negate(a) { return !a; }", "negate() {\n this._truth = !this._truth;\n }", "function negate() {\n if (is_operator(equation_array[0])) {\n return;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function returns the constant of a geometric sequence if there is one or null in all other cases
function findGeoSeqConstant(sequence) { if (sequence.length < 2) return null; let r = sequence[1] / sequence[0]; for (let i = 0; i < sequence.length - 1; i++) { if ((sequence[i + 1] / sequence[i]) !== r) { return null; } } return r; }
[ "function getGeoSeqSeries(sequence, n) {\n\n if (isGeoSeq(sequence)) {\n \n let a = sequence[0];\n let r = findGeoSeqConstant(sequence);\n\n return (Math.pow(r, n) - 1) * a / (r - 1);\n\n }\n\n return null;\n}", "function isGeoSeq(sequence) {\n if (sequence.length < 2) return false;\n\n //find th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return a number for date's month length
getMonthLength(date) { return new Date(date.year, date.month, 0).getDate(); }
[ "function monthLength(m,y){return((m==1)?((isLeapYear(y)?29:28)):((m==3||m==5||m==8||m==10)?30:31));}", "getMonthLength(date) {\n return new Date(date.year, date.month, 0).getDate();\n }", "getMonthLength(date) {\n return new Date(date.year, date.month, 0).getDate();\n }", "getMont...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads the current URL (hash) and navigates accordingly.
function readURL() { var hash = window.location.hash; // Attempt to parse the hash as either an index or name var bits = hash.slice(2).split('/'), name = hash.replace(/#|\//gi, ''); // If the first bit is invalid and there is a name we can // assume that this is a ...
[ "function readURL() {\n\t\t// Break the hash down to separate components\n\t\tvar bits = window.location.hash.slice(2).split('/');\n\t\t\n\t\t// Read the index components of the hash\n\t\tindexh = bits[0] ? parseInt( bits[0] ) : 0;\n\t\tindexv = bits[1] ? parseInt( bits[1] ) : 0;\n\t\t\n\t\tnavigateTo( indexh, inde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validazione Telefono tramite regex
function validaTelefono(telefono) { let re = /^[0-9]{10,10}$/; return re.test(telefono); }
[ "function comprobarTelf(campo){\n\tvar formatoTelefono; //expresion regular de un numero de telefono\n\t\n\tformatoTelefono=/[0-9]{9}/;\n\t\n\tif(formatoTelefono.test (campo.value) == false){ //comprueba que cumpla el formato del atributo\n\t\talert('Formato de telefono incorrecto');\n\t\tcampo.focus();\n\t\treturn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createEnemy.flyingOn(544, 160).thatMovesVerticalOn(32, 288), createEnemy.heavyOn(384, 352).thatMovesOn(192, 512).withShield(), createEnemy.heavyOn(64, 236).thatMovesOn(0, 160).withFullArmor(), createEnemy.heavyOn(32, 86).thatMovesOn(32, 192).withHelmet()
function initEnemy() { var enemyCoordinate =[]; switch (levelNow) { case 0 : enemies = [ createEnemy.shotingOn(520, 160), createEnemy.shotingOn(1400, 80), createEnemy.shotingOn(1966, 416), createEnemy.shotingOn(2170, 148), createEnemy.s...
[ "function spawnEnemies(){\r\n //\"Ai\" objekterne vil give værdier af x1, x2, y, w, h og fallOff.\r\n Enemies.push(new ai(755, 50, 150, 35,45, 2));\r\n Enemies.push(new ai(500, 700, 150, 35,45, 1));\r\n Enemies.push(new ai(140, 365,150,35,45, 1));\r\n}", "generateEntities(player,bulk,x,y,path,speed) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rename the references to the triggers in conditionals, when a trigger changed its name
function _renameTriggers(masterRenameTable, referenceConditionalClones, involvedConditionals){ involvedConditionals = involvedConditionals || []; var renamedTriggers = reduce(masterRenameTable, function(renamed, original, sum){ if( !(new Trigger(renamed)).isValid() ){ ret...
[ "function normalizeTriggers(triggers) {\n for (let i = 0; i < triggers.length; i++) {\n if (triggers[i] === \"STOCK\") {\n triggers[i] = \"POOL\";\n }\n else if (triggers[i] === \"BOUNCE\") {\n triggers[i] = \"RETURN\";\n }\n }\n}", "function Triggers() {}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if textures are done loading (leads to Tunnel(cell);)
function checkTextures() { texturesLoaded++; if (texturesLoaded === Object.keys(textures).length) { document.body.classList.remove("loading"); // When all textures are loaded, init the scene window.tunnel = new Tunnel(); } }
[ "function loadedTextures() {\n\t\tif(!loadingTextures) return true;\n\t\tfor(var i = 0; i < textureImages.length; i++) {\n\t\t\tif(!textureImages[i].complete) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tloadingTextures = false;\n\t\treturn true;\n\t}", "function checkLoadedTextures()\r\n{\r\n\tif (!textures.loa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Collisions/Bouncing helper functions Returns true if two objects overlap, false otherwise. Assume each object is rectangular.
function doCollide(obj1, obj2) { var left1 = { "x": obj1.x, "y": obj1.y }; var right1 = { "x": obj1.x + obj1.width, "y": obj1.y + obj1.height}; var left2 = { "x": obj2.x, "y": obj2.y }; var right2 = { "x": obj2.x + obj2.width, "y": obj2.y + obj2.height}; // If one rectangle is on left side of o...
[ "function overlap(object1, object2)\n{\n var hb1 = object1.getHitBox();\n var hb2 = object2.getHitBox();\n \n /* Checks the rectangle sides for overlap */\n if(hb1.x - hb1.width/2 < hb2.x + hb2.width/2 && \n hb1.x + hb1.width/2 > hb2.x - hb2.width/2 &&\n hb1.y - hb1.height/2 < hb2.y + hb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Init battle when user clicks on a character
function initBattle(char) { me.input.registerPointerEvent('click', char.collisionBox, function() { game.data.battle.init(char); }); }
[ "function setupMyCharacter(){\n player = characters[$(this).data('data-index')];\n //console.log (player);\n\n $(this).appendTo(\"#player-character\")\n .addClass('player');\n\n\n $(\"#character-box\").children()\n .appendTo(\"#enemies-box\")\n .addClass(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a new [[iRGB]] object based on `rgb` parameter with specific saturation applied. `saturation` can be in the range of 0 (fully desaturated) to 1 (fully saturated).
function saturate(rgb, saturation) { if (rgb == null || saturation == 1) { return rgb; } var hsl = rgbToHsl(rgb); hsl.s = saturation; return hslToRgb(hsl); }
[ "function saturate(rgb, saturation) {\n if (rgb == null || saturation == 1) {\n return rgb;\n }\n\n var hsl = rgbToHsl(rgb);\n hsl.s = saturation;\n return hslToRgb(hsl);\n }", "function saturate(rgb, saturation) {\n if (rgb == null || saturation == 1) {\n return rgb;\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The 'closeReason' parameter must be one of: 'Duplicate' 'NeedsDetailsOrClarity' 'NeedMoreFocus' 'OpinionBased' 'SiteSpecific' If the 'closeReason' parameter is 'SiteSpecific', then the 'siteSpecificReason' parameter must be a numeric ID corresponding to one of the sitespecific reasons.
async function closeQuestion(questionID, closeReason, siteSpecificReason = null, siteSpecificOtherText = null, duplicateID = null) { if (!questionID) { thr...
[ "get closingReason() { return this._closingReason || (this._closingReason = {}); }", "function getCloseReasonID() {\n switch (window.location.host) {\n case \"softwarerecs.stackexchange.com\":\n case \"hardwarerecs.stackexchange.com\":\n case \"stackapps.com\":\n return 1;\n case \"mathoverflow....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
JoinTable decorator is used in manytomany relationship to specify owner side of relationship. Its also used to set a custom junction table's name, column names and referenced columns.
function JoinTable(options) { return function (object, propertyName) { options = options || {}; __1.getMetadataArgsStorage().joinTables.push({ target: object.constructor, propertyName: propertyName, name: options.name, joinColumns: (options && options....
[ "function JoinTable(options) {\n return function (object, propertyName) {\n options = options || {};\n var args = {\n target: object.constructor,\n propertyName: propertyName,\n name: options.name,\n joinColumns: (options && op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a Catberry Catcomponent file. More details can be found here Creates new instance of the "pagesnavigation" component.
function PagesNavigation() { }
[ "function PagesNavigation() {\n}", "createPages() {\n // Example:\n // this.pages = {\n // [this.pageNames.mainMenu]: new TestPage(ObjectFinder.find(\"plane0\"),this),\n // [this.pageNames.textMenu]: new TestPage(ObjectFinder.find(\"3dText0\"),this)\n // };\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all the columns referenced in the parse tree and return them as an array. The columns will be distinct (that is, if the same column appears multiple times in the same condition, it will exist in the returned array only once).
getColumns(parseTree) { const columns = []; // Recursively traverse tree. (function traverse(tree, columns) { // If the current node is a column and not yet in the list of columns, add it. if (tree.token.type === 'column' && columns.indexOf(tree.token.value) === -1) columns....
[ "function templateGetColumnList(templateElement) {\n var arrColumn = [];\n var arrElement = tblQry(templateElement.content, '[column]');\n var i = 0;\n var len = arrElement.length;\n var strColumn;\n\n while (i < len) {\n strColumn = arrElement[i].getAttribute('c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fill the hidden form fields and submit the form on user type/category selection
function selectCategory(ids){ var idsArray = ids.split("-"); if(idsArray.length == 2){ $('#type_choice').val(idsArray[0]); $('#category_choice').val(idsArray[1]); $('#wineSelectionForm').submit(); } }
[ "function populate_form_fields() {\n\t\t\n\t\tvar category_id = config_modal.get_active_category_id();\n\t\tvar category = config_modal.categories[category_id];\n\t\t\n\t\tif(category === undefined) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t//Set the data\n\t\tvar cat_data = temp_config[category_id];\n\t\t\n\t\tif (cat_da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The controller to manage the fieldslist
function contentTypeFieldListController(appId, contentTypeFieldSvc, contentType, $modalInstance, $modal, eavAdminDialogs, $filter, $translate, eavConfig) { var vm = this; var svc = contentTypeFieldSvc(appId, contentType); // to close this dialog vm.close = function () { $mod...
[ "function FormController() {\n\t}", "function FieldList ( app ) {\n\t\tvar me = this;\n\t\tapp.getList( \"FieldList\", function ( reply ) {\n\t\t\tme.fields = reply.qFieldList.qItems;\n\t\t\tme.render();\n\t\t} );\n\t\tapp.getList( 'CurrentSelections', function ( reply ) {\n\t\t\tvar yearSel = reply.qSelectionObj...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the word in the database fires the 'load word' event to update the current word for all sockets
async function loadWord(code, letter, position) { try { response = await db.addLetter(code, letter, position); io.to(code).emit("load word", response); } catch (error) { console.error("Could not update word" + error); } }
[ "updateCurrentWord(value) {\r\n appData.words.currentWord.update(value);\r\n }", "function updateCurrentWord(){\r\n\tvar currentWordData = globalVariables.child('currentWord');\r\n\tcurrentWordData.update({\r\n\t currentWord: currentWord,\r\n\t timeStamp: Firebase.ServerValue.TIMESTAMP\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clean up the html files in the root
function runCleanHtml(cb) { del(global.getDest('html'), cb); }
[ "function cleanHTML() {\n return src(appPath.dist.root + '/**/*.html', { read: false, force: true }).pipe(clean());\n}", "function cleanHTML() {\n return gulp.src('./pub/*.html') \n .pipe(delFile());\n}", "function clean() {\n\n debug('cleaning site files')\n\n cd('./_site')\n exec('rm -rf -- $(ls...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
compile eisenscript code and return intermediate object
function compile(source) { const ast = parser.parse(source); const interpreter = new Interpreter(); const object = interpreter.generate(ast); // console.log(JSON.stringify(object)); return object; }
[ "getTransformedCode() {\n if (this.fastStorage.code) return this.fastStorage.code;\n\n if (this.shouldBeCompiled) {\n this.fastStorage.code = this.packer.generateCode(this.getAST(), this.projectPath, this.getContents());\n } else if (this.isJSON) {\n this.fastStorage.code = \"module.exports = \" ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the maximum horizontal speed of moving enemies. Conventionally, they are usually slower than the player.
function getEnemyMaxSpeedX() { return 1; }
[ "function getEnemyMaxSpeedY() {\n return 1;\n}", "function getMovingPlatformMaxSpeedX() {\n return 2;\n}", "getMaxSpeed() {\n return (\n MIN_SPEED + (\n\t(MAX_SPEED - MIN_SPEED) *\n\t(MAX_RADIUS - this.r) /\n\t(MAX_RADIUS - MIN_RADIUS)\n )\n );\n }", "get horizontalSpeed() {\n if (th...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete all records from a store:
deleteAll(storename) { this.cache.then((db) => { db.transaction(storename, "readwrite").objectStore(storename).clear(); }); }
[ "static deleteAll(store) {\n const database = store.$db();\n const models = database.models();\n for (const entity in models) {\n const state = database.getState()[entity];\n state && new this(store, entity).deleteAll();\n }\n }", "function dbDeleteAllFromIndex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove trailing null nodes as they are implied.
function trimTrailingNulls(parameters){while(isNull(parameters[parameters.length-1])){parameters.pop();}return parameters;}
[ "function getRemoveUnneededNulls() {\n return {\n visitor: {\n // Remove `null;` statements (e.g. at the end of constructors)\n // and orphan empty object literals (on top of constructors with no base)\n ExpressionStatement(path) {\n const expr = path.node.expression;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chapter 101 RopeGroup Run
function C101_KinbakuClub_RopeGroup_Run() { BuildInteraction(C101_KinbakuClub_RopeGroup_CurrentStage); // changing images // Group view if (C101_KinbakuClub_RopeGroup_CurrentStage == 100) { DrawImage(CurrentChapter + "/" + CurrentScreen + "/RopeGroupAmelia.png", 600, 20); DrawImage(CurrentChapter + "/" + Cur...
[ "function C999_Common_Rope_Run() {\n\tBuildInteraction(C999_Common_Rope_CurrentStage);\n\tif (PlayerHasLockedInventory(\"Rope\")) DrawPlayerImage(150, 240);\n}", "function C101_KinbakuClub_RopeGroup_Introduced() {\n\tC101_KinbakuClub_RopeGroup_IntroDone = true;\n}", "function C101_KinbakuClub_RopeGroup_Click() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns whether a user is a teacher
function isTeacher(id) { return clients[id].permissions == "teacher"; }
[ "async function isUserTeacher (req, res, next ) {\n var sessionRequest = req.sessionID;\n try {\n var x = await getUserType(sessionRequest);\n if(x.localeCompare('student') == 0){\n res.redirect('/user/studentdashboard'); //Students can't go to teacher urls, so redirect them back to t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add processing parameters given as request options to an URL as GET query parameters
function addProcessingParameters(url, opts) { var sep = url.indexOf("?") > 0 ? "&" : "?"; $.each(PROCESSING_PARAMS, function (i, key) { if (opts[key] != null) { url += sep + key + "=" + opts[key]; sep = "&"; } })...
[ "function addProcessingParameters(url, opts) {\n var sep = url.indexOf(\"?\") > 0 ? \"&\" : \"?\";\n each(PROCESSING_PARAMS, function (i, key) {\n if (opts[key] != null) {\n url += sep + key + \"=\" + opts[key];\n sep = \"&\";\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! Function : WebSocketIFHandleResponseInit
function WebSocketIFHandleResponseInit (InPacket) { }
[ "function\nWebSocketIFHandleResponse\n(InPacket)\n{\n if ( InPacket.status == \"Error\" ) {\n SetMessageError(InPacket.message);\n return;\n }\n\n console.log(InPacket);\n if ( InPacket.status == \"OK\" ) {\n WebSocketIFID = InPacket.packetid + 1;\n if ( InPacket.type == \"init\" ) {\n WebSocke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove underline of current selection
function removeUnderlineSelection() { var sel = window.getSelection(); var range = sel.getRangeAt(0); var nodes = getRangeTextNodes(range); for (var i = 0; i < nodes.length; i++) { var node = nodes[i]; // unhighlight(node); var parent = node.parentNode; // window.TextSel...
[ "function underlineSelection() {\n this.execCommand('underline', false, null);\n }", "set removeUnderline(value) {\n this.removeUnderlineInternal = value;\n }", "function underlineSel() {\n\trichTextBox.document.execCommand('underline',false,null);\n}", "function styleUnderline() {\n\t\tif (acti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
SNAPPING TO LINES / snapCylinder() Adapted from: Prussian Blue's answer. parameters: point1: point2: radius: parent: Creates an invisible snap cylinder between 2 points whose radius is the snap radius.
function snapCylinder( point1, point2, radius = snapRadius, parent = scene ) { this.cylinder = cylinderBetweenPoints( point1, point2, snapRadius, false ); this.cylinder.isSnapObj = true; this.cylinder.isSnapCylinder = true; this.cylinder.snapOn = true; this.cylinder.snapIntensity = globalAppSettings.snapInte...
[ "function IntersectRayCylinder(point_sa, direct, point_p, point_q, cylinder_rad, inter_pnt){\n\n //var R = subPoints(point_sb, point_sa);\n //R = normalizeVec3D(R);\n var R = direct;\n var A = subPoints(point_q, point_p);\n A = normalizeVec3D(A);\n\n var D = crossProduct(R, A);\n var ren = getLength(D);\n D...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a new account based on a mnemonic (this.state.value). If the first account in the derivation path is used it will continue to try the next number until an address that is unused is found. This function can be slow. TODO: this logic should be in OriginWallet.js rather than here but to catch errors for invalid mnemon...
addAccountFromMnemonic() { const existingAddresses = this.props.wallet.accounts.map(a => a.address) // Use a loop to try the next account in the derivation path for (let i = 0; i < 10; i++) { // This is the default path but explicitly stated here for clarity const derivePath = `m/44'/60'/0'/0/${...
[ "function generateAccountWithMnemonic(mnemonic) {\n if (typeof mnemonic !== 'string') {\n mnemonic = bip39.generateMnemonic(256);\n } // Generate 24 word list\n\n return bip39.mnemonicToSeed(mnemonic).then((s) =>{\n return bip32.fromSeedBuffer(s);\n }).then((m) => {\n const keypair = m.derivePath('m/44...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Step 5: Total Tips Received
function singleClickTipsReceived(){ runReportAnimation(25); //of Step 4 which takes 5 units $.ajax({ type: 'GET', url: COMMON_LOCAL_SERVER_IP+'/'+SELECTED_INVOICE_SOURCE_DB+'/_design/invoice-summary/_view/grandtotal_tips?startkey=["'+fromDate+'"]&endkey=["'+toDate+'"]', timeout: 10000, success: fun...
[ "function excelReportTipsReceived(){\n\n\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t type: 'GET',\n\t\t\t\t\t\t\turl: COMMON_LOCAL_SERVER_IP+'/'+SELECTED_INVOICE_SOURCE_DB+'/_design/invoice-summary/_view/grandtotal_tips?startkey=[\"'+request_date+'\"]&endkey=[\"'+request_date+'\"]',\n\t\t\t\t\t\t\ttimeout: 10000,\n\t\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets an STL from a full scene
function getSTLFromScene(params) { var root = params.root; var matrix = params.matrix || new THREE.Matrix4(); var strbuf = []; strbuf.push("solid object"); function addFace(v0, v1, v2) { strbuf.push("facet normal 0 0 0"); strbuf.push(" outer loop"); strbuf.push(" ver...
[ "get scenes() {}", "function Scene() {}", "function loadScene() {\n var obj = pullGet();\n if (obj) {\n loadFromObject(obj);\n }\n}", "function getScene() {\n\n\treturn scene;\n}", "function SceneLoader() {}", "function getScene()\n {\n return SCENE;\n }", "createScene() {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an API token from cache or through registering a new device
RegisterDevice() { // fetch new device token if we haven't already got one in our cache return this.Cache.Wrap('device_token', () => { // first, get (or generate) a new user ID return this.GenerateUserID().then((userID) => { // request token for further API requests return this.HTTP(...
[ "registerDevice() {\n // fetch new device token if we haven't already got one in our cache\n return this.cache.wrap(\n 'device_token', () =>\n // first, get (or generate) a new user ID\n this.generateUserID().then(userId =>\n // request token for further API requests\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the inversed value of hex value
function inverseHex(h){ var hex = h.substr(1).toUpperCase(); var inv_val = "#"; var h_vals = {"A": 5, "B": 4, "C": 3, "D": 2, "E": 1, "F": 0}; var inv_h_vals = ["F", "E", "D", "C", "B", "A", "9", "8", "7", "6", "5", "4", "3", "2", "1", "0"]; for(var i = 0; i < hex.length; i++){ var h_i = h...
[ "function inverseHex(hex) {\n // expand shorthand colour\n hex = hex.replace(/^#(.)(.)(.)$/, '#$1$1$2$2$3$3');\n \n // convert hex to decimal value\n var inverse = parseInt(hex.substring(1), 16);\n \n // invert colour\n inverse = 0xFFFFFF ^ inverse;\n \n // convert back to hex notation\n return '#' + ('0...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the highest power coefficient of the given polynomial is 0 then removeLeadingZeros can be called to remove all such highest terms so that the returned array is a valid presentation of a polynomial.
function eRemoveLeadingZeros(p) { let lzCount = 0; for (let i = 0; i <= p.length - 1; i++) { if (eSign(p[i]) !== 0) { break; } lzCount++; } if (lzCount !== 0) { p = p.slice(lzCount); } return p; }
[ "function arrayGenerator(polynomial) {\n let localPolyArray = [];\n polynomial.forEach((monomial) => {\n let polynomialProps = monomial.split('^');\n localPolyArray.push({\n coefficient: parseFloat(polynomialProps[0]),\n power: polynomialProps[1] != null ? parseInt(polynomialProps[1]) : 0\n });...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add bitrix link only if there is no comments
function add_bitrix_link(id, link){ var query = 'https://app.trackingtime.co/api/v4/tasks/'+id+'/comments'; $.ajax({ url: query+"?callback=?", dataType: 'json', async: false, type: 'GET', success: function (resp) { console.log('\nsearching comments in tt task:'); console.log(resp); ...
[ "function addCommentLinksToSpecialSearch() {\n const [, commentAnchor] = location.search.match(/[?&]cdcomment=([^&]+)(?:&|$)/) || [];\n if (commentAnchor) {\n mw.loader.using('mediawiki.api').then(\n async () => {\n await loadSiteData();\n $('.mw-search-result-heading').each((i, el) => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }