query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Once the colour has converted to the new colour Generate a new colour
function generateNewColour() { var finished = true; for (var key in Colour) { if(delta[key] != 0) { finished = false; } } if (finished) { colour = nextColour; nextColour = randomColour();...
[ "shiftColor() {\n\t\t// parse color into numbers\n\t\tvar colArr = [\n parseInt(this.color.substr(1,2),16),\n parseInt(this.color.substr(3,2),16),\n parseInt(this.color.substr(5,2),16)\n ];\n var colStr = '#';\n var val;\n const shift = Math.floor((Math.r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get a flat Array of all function names in the alltests object
function jum_get_all_function_names(alltests) { var fnames = []; for(var i=0;i<alltests.groups_array_.length;++i) { var groupdef = alltests.groups_array_[i]; var groupname = groupdef.groupname; jum_debug('concat of names for ' + groupname); //bu_alert("adding " + groupdef.function_names_.length + " ...
[ "function _getAllTestFunctions() {\n var testFunctions = Array();\n\n for (var i in window) {\n if (i.indexOf('test_') == 0) {\n testFunctions.push(i);\n }\n }\n\n return testFunctions;\n}", "function getTestMethodNames()/* : Array*/\n {\n return(null);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function that goes to a viewsequence either by scrolling or immediately without any scrolling animation.
function _goToSequence(viewSequence, next, noAnimation) { if (noAnimation) { this._viewSequence = viewSequence; this._scroll.springPosition = undefined; _updateSpring.call(this); this.halt(); this._scroll.scrollDelta = 0; _setParticl...
[ "function _scrollToSequence(viewSequence, next) {\n\t this._scroll.scrollToSequence = viewSequence;\n\t this._scroll.scrollToDirection = next;\n\t this._scroll.scrollDirty = true;\n\t }", "function _scrollToSequence(viewSequence, next) {\n\t this._scroll.scrollToSequence = viewSeque...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility function to increment a variable and clamp
function IncrementClamp(x, dx, upper){ var newX = x+dx; if (newX > upper){ return newX-upper; } return newX; }
[ "increment () {\n this.value = this._clampValue(this.value + this.step)\n }", "function increment() {\n number.update((n) => (n + 1 <= max ? n + 1 : n));\n }", "function Clamp01(value) { return Mathf.Clamp(value, 0.0, 1.0); }", "function clamp(clmp, curr)\n{\n return Math.min(Math.max(curr, -1 * cl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function will create map with listing skuID as key and image url as value
function createImageMapForSkus(currentProduct) { var skuIDImageMap = {}; for (var index = 0; index < currentProduct.childSKUs.length; index++) { if(currentProduct.childSKUs[index].primaryThumbImageURL){ skuIDImageMap[currentProduct.childSKUs[index].repositoryId]= currentProduct.childSKUs[i...
[ "function createImageMapForSkus(currentProduct) {\n var skuIDImageMap = {};\n for (var index = 0; index < currentProduct.childSKUs.length; index++) {\n if(currentProduct.childSKUs[index].primaryThumbImageURL){\n skuIDImageMap[currentProduct.childSKUs[index].re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find and list beta app review details for all apps.
function listBetaAppReviewDetails(api, query) { return api_1.GET(api, '/betaAppReviewDetails', { query }) }
[ "function readBetaAppReviewDetailsResourceForApp(api, id, query) {\n return api_1.GET(api, `/apps/${id}/betaAppReviewDetail`, { query })\n}", "function readAppInformationForBetaAppReviewDetail(api, id, query) {\n return api_1.GET(api, `/betaAppReviewDetails/${id}/app`, { query })\n}", "getBetaReviewDetail...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Never said given String has only a single number so, decided to use reduce method
function getResult(str) { return extractOddNumbers(str).reduce(function(accm, curr){ return accm + Math.pow(curr, 2) // Math.pow will convert String value to Number (which is curr) }, 0) // Set initial accumulator value to 0 (typeof Number), if not specify, initial value is set to the first element of ar...
[ "function NumberAddition(str) { \n\n // use the JavaScript match function which\n // tries to find all matching patterns in the string\n // and it returns an array of all matches found\n // e.g. \"75Number9\" returns [75, 9] \n // or set to 0 if no numbers are found\n var nums = str.match(/[0-9]+/gi) || [0];\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[END apps_script_calendar_conditional_update] [START apps_script_calendar_conditional_fetch] Creates an event in the user's default calendar, then refetches the event every second, on the condition that the event has changed since the last fetch. The conditional fetch is accomplished by setting the 'IfNoneMatch' header...
function conditionalFetch() { var calendarId = 'primary'; var start = getRelativeDate(1, 12); var end = getRelativeDate(1, 13); var event = { summary: 'Lunch Meeting', location: 'The Deli', description: 'To discuss our plans for the presentation next week.', start: { dateTime: start.toISOS...
[ "function conditionalUpdate() {\n var calendarId = 'primary';\n var start = getRelativeDate(1, 12);\n var end = getRelativeDate(1, 13);\n var event = {\n summary: 'Lunch Meeting',\n location: 'The Deli',\n description: 'To discuss our plans for the presentation next week.',\n start: {\n dateTim...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
track total clicks increment the counter variable
function clickCounter(event) { clicks++; outputClicks(); }
[ "function updateClicks () {\r\n total_clicks += 1 ;\r\n $(\"#total_clicks\").text(total_clicks);\r\n }", "function updateClickCount() {\r\n\tvar counter = 0\r\n\tcounter += 1;\r\n\t// do something with the counter\r\n}", "function clickCounter() {\n taps += 1;\n}", "function clickCount() {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the options menu inputs with the current values of global properties
function setOptionsMenuValues() { $("#bloodCellStartCount").val(options.bloodCellStartCount); $("#virusStartCount").val(options.virusStartCount); $("#defenderRatio").val(options.defenderRatio); $("#defenseDistance").val(options.defenseDistance); $("#infectionDistance").val(option...
[ "function getOptions() {\r\n gvar.mnu_Value[0] = getValue('KEY_FIXED_MNU');\r\n gvar.mnu_Value[1] = getValue('KEY_TCKILL_MNU');\r\n gvar.paused = getValue('KEY_PAUSED');\t\r\n }", "function writeGlobalOption() {\n $(\"#units\").val(globalOptions.units);\n $(\"#labelled\").val(globalOptions.labelle...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Detaches the RightPanel from the DOM.
detach() { if (this.panel) { this.panel.destroy(); } }
[ "detach() {\n if (this._parentNode) {\n render(null, this._parentNode);\n\n this._eventBus.fire('propertiesPanel.detach');\n }\n }", "function dptRemoveFromRightPane() {\n\n\t// delete one row at a time until all rows to delete have been deleted.\n\tvar idx = dptRowNumStillToDelete(jsDataRightTre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
inject toRomaji to avoid circular dependency between toRomaji katakanaToHiragana
function katakanaToHiragana(input = '', toRomaji, isDestinationRomaji) { let previousKana = ''; return input.split('').reduce((hira, char, index) => { // Short circuit to avoid incorrect codeshift for 'ー' and '・' if (isCharSlashDot(char) || isCharInitialLongDash(char, index) || isKanaAsSymbol(char)) { ...
[ "function koreanToRoman(korean) {\n \n}", "function toRoman(arabic) {\n // YOUR CODE HERE\n}", "function ConvertHiraganaToKatakana(hira) {\n var result = '';\n for(var i = 0; i < hira.length; i++) {\n result += String.fromCharCode(hira.charCodeAt(i) - hiraKataDiff)\n }\n return result;\n}...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Start the game in Idle mode
function startIdleGame() { score = idleClicks; updateScore(); // Enable the click button clickButton.disabled = false; // Remove the timer display timerElement.textContent = ""; timer = null; // Start the idle timer idleTimer(); }
[ "startGame() {\n\t\tthis.enterState(this.startState);\n\t}", "function switchToIdleMode() {\n // Update the high score if the current score is higher\n if (score > highScoreIdle) {\n highScoreIdle = score;\n }\n\n // Reset the score and update the display\n score = 0;\n updateScore();\n\n // Update the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
$j.simulation("generateGoodPaths", howMany, modelPath) $j.simulation("generateGoodPaths", 5000, $j.what("network").paths.digitalComm1[0]) TODO: Refactor generateGoodPaths & BadPaths so they reuse the same path walking loops
generateGoodPaths(howMany, modelPath) { var nodes = {}; var pathLength = modelPath.length; for(var i=0; i<pathLength; i++) { var path = modelPath[i]; if(i==0) { nodes[path.from]=newNode(path.from); } nodes[path.to]=newNode(path.to); } function newNode(id) { var o = { in: 0...
[ "generateBadPaths(howMany, modelPath) {\n\t\t\tvar nodes = {};\n\t\t\tvar pathLength = modelPath.length;\n\t\t\tvar dudTypes = [\"biz\", \"it\", \"planned\"];\n\n\t\t\tvar i;\n\t\t\tfor(i=0; i<pathLength; i++) {\n\t\t\t\tvar path = modelPath[i];\n\t\t\t\tif(i==0) {\n\t\t\t\t\tnodes[path.from]=newNode(path.from);\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
params: results: array of results (either from search or from upload) context: distant hearing or individual fileSource: upload or search adjusts the result tds depending on context and fileSource returns typeOfSelection depending on context
function adjustToContextAndFileSource(results, context, fileSource) { let noResultsFlag; let typeOfSelection; if (fileSource === "search") { $("#t_searchResults tbody tr.search td input").not(':checked').parent().parent().remove(); if (results.length <= 0) { noResultsFlag = true;...
[ "function sourceSelected( err, result ) {\n if ( err ) {\n console.log( err );\n process.exit();\n }\n \n // get the usage data\n console.log( '[Collector]Fetching usage data from [' + result.source + '].\\n');\n \n var file = result.source;\n \n getData( result.source, func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Wrap tables in a div so that they scroll responsively.
function wrapTable() { const tables = document.querySelectorAll('table'); tables.forEach((table) => { const tableWrapper = document.createElement('div'); tableWrapper.className = 'table-wrapper'; table.parentElement.replaceChild(tableWrapper, table); tableWrapper.appendChild(table); ...
[ "function wrapPepContentTables () {\n const pepContent = document.getElementById(pepContentId);\n const bodyTables = pepContent.getElementsByTagName(\"table\");\n Array.from(bodyTables).forEach(wrapTable);\n}", "wrap () {\n const wrapperHtml = document.createElement('div');\n wrapperHtml.className ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide the note next to the clipboard select button.
function resetClipboardNote() { if ($clip_note) { $clip_note.text(''); toggleHidden($clip_note, true); } }
[ "function hideShowRibbonPasteItem() {\n var activeSheet = designer.wrapper.spread.getActiveSheet()\n var sheet = activeSheet\n // TODO : isPasteFloatingObject\n if (sheet.isPasteFloatingObject()) {\n $('#clipboardgroup li:gt(0)').hide()\n } else {\n $('#clipboardgroup li:gt(0)').show()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Replace the current selection with the given slice.
replaceSelection(slice2) { this.selection.replace(this, slice2); return this; }
[ "function replaceOneSelection(doc, i, range, options) { // 1218\n var ranges = doc.sel.ranges.slice(0); // 1219\n ranges[i] = range; ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a Proj.4 projection name (e.g. lcc, tmerc) to a Proj.4 string by picking parameters that are appropriate to the extent of the dataset being projected (e.g. standard parallels, longitude of origin) Works for lcc, aea, tmerc, etc. TODO: add more projections
function expandProjDefn(str, dataset) { var mproj = require$1('mproj'); var proj4, params, bbox, isConic2SP, isCentered, decimals; if (str in mproj.internal.pj_list === false) { // not a bare projection code -- assume valid projection string in other format return str; } isConic2SP = ['l...
[ "function generate_proj4() {\n var source_proj = parse_projection(m_this.source()),\n target_proj = parse_projection(m_this.target()),\n source = source_proj.proj,\n target = target_proj.proj;\n m_source_matrix = source_proj.matrix;\n m_source_matrix_inv = source_proj.inverse;\n m_target_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Running filters runFiltersOnTextNode Return: node at which to continue traversal, or |null| to mean no changes were made.
function runFiltersOnTextNode(node) { // Too many variables. Good hint that I need to split this function up :P var source, j, regexp, match, lastLastIndex, k, filter, href, anyChanges; // things var used, unused, firstUnused, lastUnused, a, parent, nextSibling; // nodes source = node.data; any...
[ "function runFiltersOnTextNode(node)\r\n{\r\n function genLink(filter, match)\r\n {\r\n\ttry {\r\n\t return filter.href(match); \r\n\t}\r\n\tcatch(er) {\r\n\t return \"data:text/plain,Error running AutoLink function for filter: \" + encodeURIComponent(filter.name) + \"%0A%0A\" + encodeURIComponent(er);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chandge speed by n
function adjustSpeed(n) { setSpeed(speed+n); }
[ "testSpeed(n) {\n console.log(`Speed test. Processing ${n} positions.`);\n console.time('took');\n for (let i = 1; i < n; i++) {\n this.getDigit(i);\n }\n console.timeEnd('took');\n }", "function _speedCycle(f) {\n\tvar t = Date.now();\n\tvar n = 0;\n\twhile (Date.now() < t + 1000) {\n\t\tf()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the dom id of the journal page message td
function getJournalMessageId(id) { return "journalMessage" + id; }
[ "function domIdForMessage(m) {\n return '#msg__' + m.domId();\n }", "function getMessageID(e) {\n let message = e.target.parentElement.parentElement.parentElement;\n let id = message.id.split('-');\n return id = id[1];\n}", "function msgsDomIdForConversation(c) {\n return '#msgs__' + c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create an SVG line element.
function line(x1, y1, x2, y2) { let line = document.createElementNS(Svg.svgNS, "line"); line.setAttribute("x1", x1.toString()); line.setAttribute("y1", y1.toString()); line.setAttribute("x2", x2.toString()); line.setAttribute("y2", y2.toString()); ...
[ "function line(svg, x1,y1,x2,y2,stroke,strokewidth) {\r\n var obj = svg.createElementNS(svgNS,\"line\");\r\n obj.setAttributeNS(null,\"x1\",x1);\t\r\n obj.setAttributeNS(null,\"y1\",y1);\t\t\r\n obj.setAttributeNS(null,\"x2\",x2);\t\t\r\n obj.setAttributeNS(null,\"y2\",y2);\t\t\t \r\n obj.setAttributeNS(null...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Main function to scan serial numbers in inventory status change process
function RFInvStatusChangeSerialScan(request, response){ var context = nlapiGetContext(); var sessionobj = context.getSessionObject('session'); var user=context.getUser(); if (request.getMethod() == 'GET') { var getNumber = request.getParameter('custparam_number'); var getSerialArr = request.getParameter('c...
[ "function scan () {\n\t\n\t\n\tif (portOffset == 0) console.log(\"Scanning for serial ports...\".grey);\n\t\n\tserialport.list(function (err, ports) {\n\t\t\n\t\t// List all available serial ports\n\t\tvar portCount = ports.length;\n\t\t/*console.log(\"Available serial ports: \");\n\t\tvar portCount = 0;\n\t\tports...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Removes an event listener which has been subscribed for event listening.
function unsubscribe(listener) { var index = subscribers.indexOf(listener); if (index > -1) { subscribers.splice(index, 1); } }
[ "function removeListener() {\r\n\t\telement.removeEventListener(eventName, handler);\r\n\t}", "unlisten() {\n goog.asserts.assert(this.target, 'Missing target');\n this.target.removeEventListener(this.type, this.listener, this.options);\n\n this.target = null;\n this.listener = null;\n this.options...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Assign a class to each video based on title, and then another class based on the doctor(s) speaking.
function classifyVideo(title, description, DRs){ var classify = ''; var content = title+' '+description; //Add subject filter categories = { //TAG PHRASES //FILTER CLASS //body part 'knee': 'knee ', 'hip': 'hip ', 'back pain': 'back-pain ', 'shoulder': 'shoulder ', 'spinal': 'sp...
[ "function getVideoClasses() {\n const searchedClasses = searchResult && (videos ? 'searched ' : '')\n const showClasses = (props.show && props.allToggled) ? 'column-center ' : 'column-center hidden '\n return showClasses + searchedClasses\n }", "prepareVideoElement(){\n\t\tthis.applyDefaultClasses();\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the data of the series comes as a string it must be a int or float or it will not display the data
function highchartsSeriesDataToInt(series){ var _return = []; if('data' in series){ // if data exists it is one serie _return = highchartsSeriesDataToIntData(series); }else { // multiple series $.each(series, function(index, element) { _return[index] = highchartsSeriesDataToIntDa...
[ "function di_covertToProperInput(data)\n{\n\tvar seriesArray = data.seriesCollection;\n\tfor(var i=0;i<seriesArray.length;i++)\n\t{\n\t\tvar series = seriesArray[i];\n\t\tvar yData = series.data;\n\t\tfor(var j=0;j<yData.length;j++)\n\t\t{\n\t\t\tyData[j] = parseFloat(yData[j]);\n\t\t}\n\t}\t\n\treturn data;\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Title: Places API (standard Jive REST API v3) Description : All API functions around the places Author: Thomas Lambert Date : 01/26/2015 Version : 1.0
function getPlaces(){ // Get places : this function is useful to get the ID of a PLACE // Ajust filters, launch search and view results in the log // https://developers.jivesoftware.com/api/v3/cloud/rest/PlaceService.html#getPlaces(List<String>, String, int, int, String) // Filters // ?filter=search(test,r...
[ "function Places() {}", "function getPlaces(){\n googleApiURL = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=\" + lat + \",\" + long + \"&radius=5000&type=\" + searchType + \"&key=\" + googleAPIKEY;\n \n return $.ajax({\n url: \"https://limitless-tor-79246.herokuapp.com/...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
passin the redisclient object
constructor(redisClient) { this.promisifiedRedisFunctions = require('./helper/promisify')(redisClient); this.redis = redisClient; }
[ "constructor() {\n this.client = redis.createClient(config.redis) // Assumption: using default local config\n }", "_createRealRedis() {\n this.redis = redis.createClient(config.get('redis.option'));\n this.redis.getAsync = promisify(this.redis.get);\n this.redis.setAsync = promisify(this.redis.set);\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the code for my Abort button disabling after being clicked and enabling the Arm button
function abort() { document.getElementById("launchButton").disabled = false; document.getElementById("abortButton").disabled = true; }
[ "function arm() {\r\n document.getElementById(\"launchButton\").disabled = true;\r\n document.getElementById(\"abortButton\").disabled = false;\r\n}", "function EndOfHandUpdateButtons()\n{\n DRAW_BUTTON.disabled = true\n STAY_BUTTON.disabled = true\n PLAY_AGAIN_BUTTON.disabled = false\n}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
private function to clone a node coords and size
function cloneNode ( node ) { return { x: node.x, y: node.y, w: node.w, h: node.h }; }
[ "function cloneNode ( node ) {\r\n\t\t\treturn {\r\n\t\t\t\tx: node.x,\r\n\t\t\t\ty: node.y,\r\n\t\t\t\tw: node.w,\r\n\t\t\t\th: node.h\t\r\n\t\t\t};\r\n\t\t}", "function cloneNode (node) {\n\t\t\treturn {\n\t\t\t\tx: node.x,\n\t\t\t\ty: node.y,\n\t\t\t\tw: node.w,\n\t\t\t\th: node.h\n\t\t\t};\n\t\t}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if x>=i and x<=f
function rangecheck(x, i, f) { var tmpobj = {}; tmpobj.isempty = true; tmpobj.out = false; if (x != null) { tmpobj.isempty = false; if (x < i || x > f) { tmpobj.out = true; } else { tmpobj.out = false; } } else { tmpobj.isempty = true; } return tmpobj; }
[ "function checkInterger(x) {\n return (Math.abs(100 - x) <= 20) || (Math.abs(400 - x) <= 20);\n}", "function rangeX(a,x,b)\n {\n if(x>a && x<=b)\n {return 1;}\n else\n {return 0;}\n }", "function inBetween(x, a, b) {\n // x is the checked number\n // a and b are bo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This funnction is called whenever an interest in the "otherIntList" is clicked Basically toggles the colouring and "selected" value of the interest also toggles the colouring of the "ADD" button based if there are still "selected" interests $this is the interest we are toggling
function select($this) { var idPos = $this.id; var currInt = allInterests[idPos]; if(currInt.selected) { allInterests[idPos].selected = false; document.getElementById(idPos).style.backgroundColor = "#41658A"; //check if that was the last selected element, if so, discolour the ADD button if(Boolean(!anySel...
[ "function currentObstacleSelection() {\n Object.values(buttonObstacleChoose.getElementsByTagName('li')).forEach(function (value, index) {\n value.style.background = 'lightseagreen';\n if (index === (that.obstacleType - 1))\n value.style.background = 'black';\n });\n }", "function initColor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
waterfall chart known as "wf"
function drawWaterfall(){ }
[ "function waterfallChart() {\n \n // get the sheet\n var sheet = SpreadsheetApp.getActiveSheet();\n \n // get the range highlighted by user\n var range = sheet.getDataRange();\n \n var data = range.getValues();\n \n \n \n}", "function drawWaterfall(svg, data, height, width, traits) {\n const songs = d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
>> Toggles pixelsnap and sends it to both state and the reducer
function togglePixelsnap() { setPixelsnap(!pixelsnap) dispatch({type: 'SET_FRAME_PIXELSNAP', payload: !pixelsnap }); }
[ "toggleMySnap() {\n if (this.get('activeSnapComponent') !== 'status-comp') {\n this.set('activeSnapComponent', 'status-comp');\n } else {\n this.set('activeSnapComponent', '');\n }\n }", "switchSnapToSammi(o) {\n\t\tthis.setState({snapToSammi: !this.state.snapToSammi});\n\t}", "s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Here's a simple function to see if our page exists.
function PageExists(url) { var http = new XMLHttpRequest(); http.open('HEAD', url, false); http.send(); return http.status != 404; }
[ "function pageExists(title) {\n if (file_exists(pagePath(title)) || isSpecial(title)) {\n return true;\n } else {\n return false;\n }\n}", "function checkPage(pagename) \r\n{\r\n var href = window.location.href;\r\n var pos = -1;\r\n pos = href.indexOf(pagename);\r\n\r\n if (pos...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle a course (enable/disable) from the builder
handleToggleCourse(course) { course.enabled ? this.props.builder.disableCourse(course) : this.props.builder.enableCourse(course); }
[ "toggleMyCourses() {\n //get the current userCoursesOnly status and flip it\n let newStatus = (! this.get('userCoursesOnly'));\n //then set it to the new status\n this.set('userCoursesOnly', newStatus);\n }", "function toggleCourse() {\n courseMT = (courseMT == \"T\" ? \"M\" : \"T\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a string is a runtime expression in the context of link parameters
function isRuntimeExpression(str) { const references = ['header.', 'query.', 'path.', 'body']; if (str === '$url' || str === '$method' || str === '$statusCode') { return true; } else if (str.startsWith('$request.')) { for (let i = 0; i < references.length; i++) { if (str.star...
[ "function hasEval(s) {\n return evalReg.test(s);\n}", "static src_looks_like_valid_instruction(src){\n if(starts_with_one_of(src, [\"new Dexter(\", \"new Serial(\", \"new Job(\"])){\n return false\n }\n else if(src.startsWith(\"function\")){\n if(src.startsWith(\"function(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Current Location Map Quest API: Street Address obtained form AJAX call on lat and lon positions
function getStreet() { var apikey = '8iMbHQoKISbmKAynwHsO7ZlMhuPhWgtu'; $.ajax({ url: 'https://www.mapquestapi.com/geocoding/v1/reverse', dataType: 'json', method: 'GET', data: { location: lat + "," + lon, key: apikey, } }).then(function (response) { //On ...
[ "function getAddressFromCoords() {\n $.ajax({\n method: 'get',\n dataType: 'json',\n url: 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' + app.userLocation.lat + ',' + app.userLocation.lng + '&key=AIzaSyAqq4jH5c4jX1asTtuCjYye7CrPotGihto',\n success: function(response) {\n $('#input-lo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function should be used to encode a URL fragment. In the following URL, you need to call encodeUriFragment on "f":
function encodeUriFragment(s){return encodeURI(s);}
[ "function encodeUriFragment(s) {\n return encodeURI(s);\n }", "function encodeUriFragment(s) {\n return encodeURI(s);\n }", "function encodeUriFragment(s) {\n return encodeURI(s);\n}", "function encodeUriFragment(s) {\n return encodeURI(s);\n}", "function encodeUriSegment(val){return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renderer for "ManufacturerPart" model eslintdisablenextline nounusedvars
function renderManufacturerPart(name, data, parameters={}, options={}) { var manufacturer_image = null; var part_image = null; if (data.manufacturer_detail) { manufacturer_image = data.manufacturer_detail.image; } if (data.part_detail) { part_image = data.part_detail.thumbnail || ...
[ "function renderManufacturerPart(data, parameters={}) {\n\n return renderModel(\n {\n image: data.manufacturer_detail ? data.manufacturer_detail.thumbnail || data.manufacturer_detail.image || blankImage() : null,\n imageSecondary: data.part.detail ? data.part_detail.thumbnail || data...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find the key for this results id
function findResultKeyById(resultId){ var results = getSortedResults(); var key = ''; for(i in results){ if(results[i].id === resultId){ key = i; break; } } return key; }
[ "getKey(id) {\n for (let i = 0; i < this.keys.length; i++) {\n if (this.keys[i].id === id) {\n return this.keys[i];\n }\n }\n return null;\n }", "function keyIndexById (id) {\n return keys.findIndex(element => {return element.id === id});\n}", "key...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Log commit event's time(type:2)
async eventCommitTime() { // eventTAT's sysKey const sysKey = this.ctx.params.sysKey; const eventTAT = this.ctx.request.body; eventTAT.sysKey = sysKey; if (!await this.service.eventTAT.eventLog(eventTAT, 2)) { this.response(403, 'log event co...
[ "async eventCommitTime() {\n\n // eventTAT's sysKey\n const sysKey = this.ctx.params.sysKey;\n\n if (!await this.service.eventTAT.eventLog(sysKey, 2)) {\n this.ctx.body = this.service.util.generateResponse(403, 'log event commit time failed');\n return;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fix vertical when not overflow call fullscreenFix() if .fullscreen content changes
function fullscreenFix(){ var h = $('body').height(); // set .fullscreen height $(".content-b").each(function(i){ if($(this).innerHeight() > h){ $(this).closest(".fullscreen").addClass("overflow"); } }); }
[ "function fullscreenFix() {\n var h = $( 'body' ).height();\n // set .fullscreen height\n $( \".content-b\" ).each( function ( i ) {\n if ( $( this ).innerHeight() <= h ) {\n $( this ).closest( \".fullscreen\" ).addClass( \"not-overflow\" );\n }\n } )...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
prevent only first space in address
function spacePrevent(event) { var key = event.charCode; var address=$("#addressInput").val(); if(key==32 && !isEmpty(address)) { return false; } else { return true; } }
[ "function check_address(address) {\n var check = /[^0-9\\\\a-z\\\\\" \"]/gi;\n address.value = address.value.replace(check, \"\");\n}", "function checkAddressSplChar(str)\n{\n\tif(/^[a-zA-Z0-9- &()@',.\\://\\\\]*$/.test(str)){\n\t\treturn true;\n\t}\n\telse{\n\t\treturn false;\n\t}\n}", "function cleanAdd...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called when the application is loaded.
function applicationLoaded() { initiateController(); }
[ "function onFullyLoaded() {\n console.log(\"App is ready, in start screen..\");\n //..\n _app_scope.firstStart();\n }", "function initializeApp() {\r\n createLoader();\r\n getCategoryInfo(activeTab);\r\n}", "function notifyAppLoaded() {\n internalAPIs_1.ensureInitialized();...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Applies top bounce effect.
_bounceTop() { const that = this, mainContainer = that.$.mainContainer; that.$mainContainer.addClass('bounce-top'); function bounceBack() { mainContainer.scrollTop -= 5; if (mainContainer.scrollTop > 0) { window.requestAnimationFrame(bounceB...
[ "function bounceEffect(element) {\n\t\tif ( !$(element).is(':animated') ) {\n\t\t\t$(element).css('position','relative');\n\t\t\t$(element).animate({'top': '-=3px'}, 50, function(){\n\t\t\t\t$(element).animate({'top': '+=6px'}, 100, function(){\n\t\t\t\t\t$(element).animate({'top': '-=6px'}, 100, function(){\n\t\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validate that a value is a record with specific key and value entries.
function record(Key, Value) { return struct(`Record<${Key.type},${Value.type}>`, function* (value, ctx) { if (typeof value !== 'object' || value == null) { yield ctx.fail(); return; } for (const k in value) { const v = value[k]; yield* ctx.check(k, Key, value, k); yield* ctx...
[ "_assertRecordValid(record: Object) {\n // Iterating over all record properties and searching\n // for nan and undefined since this values probably indicate \n // data corruption\n for (let prop in record) {\n // Asserting current value is valid(valid is not undefined and not NaN)\n if (record...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the MXC URL of this Member's avatar. For users this should be their profile's avatar MXC URL or null if none set. For 3PIDs this should always be null.
getMxcAvatarUrl(): string { throw new Error("Member class not implemented"); }
[ "get avatarUrl() {\r\n const format = this.avatar.startsWith('a_') ? 'gif' : 'png';\r\n return this.avatar === null ? this.defaultAvatarUrl : `${Constants_1.CDNUrl}/avatars/${this.id}/${this.avatar}?size=512&format=${format}`;\r\n }", "get avatarURL() {\n if (this.avatar.startsWith('a_')) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
could be replaced by lua_call(lua_tableget(table, key), args) but this gives better error messages
function lua_tablegetcall(table, key, args) { var func = lua_tableget(table, key); if (typeof func == "function") { return lua_rawcall(func, args); } else { if (func == null) { throw new Error("attempt to call field '" + key + "' (a nil value)"); } var h = fun...
[ "function lua_tablegetcall(table, key, args) {\n var func = lua_tableget(table, key);\n if (typeof func == \"function\") {\n return lua_rawcall(func, args);\n } else {\n if (func == null) {\n throw new Error(\"attempt to call field '\" + key + \"' (a nil value)\");\n }\n var h = func.metatable &...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
uu.trim.url trim.inner + strip "url(" ... ")" + trim.quote
function uutrimurl(source) { // @param String: ' url("http://...") ' // @return String: "http://..." return (!source.indexOf("url(") && source.indexOf(")") === source.length - 1) ? source.slice(4, -1).replace(uutrim._QUOTE, "") : source; }
[ "function unquoteURL(m, leading, url) {\n let quote;\n\n url = url.replace(re.quotedString, \"$2\");\n quote = setQuote(RegExp.$1);\n url = url.replace(re.escapedBraces, \"$1\");\n\n if (re.urlNeedQuote.test(url)) {\n url = `${quote}${url}${quote}`;\n }\n\n return `${leading}url(${url})`;\n}", "function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes a list of Nodes and returns an XML string representing the graph
function GraphToXML(GraphNodes) { var XmlString = "<?xml version='1.0' encoding='us-ascii'?>\n<PREFERENCE-SPECIFICATION>\n"; // Output the preference variables (aka nodes) for(var i=0;i<GraphNodes.length;++i) { XmlString += " <PREFERENCE-VARIABLE>\n"; XmlString += " <VARIABLE-NAME>" + GraphNodes[i].Name + ...
[ "function graphToXml(pretty) {\n var encoder = new mxCodec();\n var node = encoder.encode(graph.getModel());\n if (pretty) return mxUtils.getPrettyXml(node, ' ', '');\n return mxUtils.getXml(node);\n }", "function renderNodes(nodeList) { // :: [Node..] -> String\n\t\t\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clear the Watch Fields option when Lookup field switches to "Text" option
function maybeClearWatchFields() { /*jshint validthis:true */ var link, lookupBlock, fieldID = this.name.replace( 'field_options[data_type_', '' ).replace( ']', '' ); if ( this.value === 'text' ) { lookupBlock = document.getElementById( 'frm_watch_lookup_block_' + fieldID ); if ( lookupBlock !== null ) ...
[ "function maybeClearWatchFields() {\n\t\t/*jshint validthis:true */\n\t\tvar link, lookupBlock,\n\t\t\tfieldID = this.name.replace( 'field_options[data_type_', '' ).replace( ']', '' );\n\n\t\tlink = document.getElementById( 'frm_add_watch_lookup_link_' + fieldID ).parentNode;\n\n\t\tif ( this.value === 'text' ) {\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
initialization on document ready to make standalone work IMPORTANT: remove our macro browser class so we leave no footprint for other macros!
function removeMacroBrowserClass() { $('#macro-details-page').removeClass(MACROBROWSER_CLASS); } // IMPORTANT: we need to remove our class from the macro browser whenever it is closed! The macro browser
[ "function qodefOnDocumentReady() {\n qodefThemeRegistration.init();\n\t qodefInitDemosMasonry.init();\n\t qodefInitDemoImportPopup.init();\n }", "function initDocument(){\n}", "function initOnDomReady() {}", "init() {\n self = this;\n\n // A page can't be manipulated safely until the...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clicks the select year element.
clickSelectYear() { $(this.rootElement) .$('select') .click(); }
[ "async clickSelectYear() {\n await $(this.rootElement)\n .$('select')\n .click();\n }", "clickRightMonthSelectYear() {\n $(this.rootElement)\n .$$('select')[1]\n .click();\n }", "clickLeftMonthSelectYear() {\n $(this.rootElement)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Animation loop on plane 1
function loop1() { $('.plane1').animate({ 'left': 100+'%', 'top': 30+'%' // Animation time in seconds }, 30000, function() { $(this).animate({ 'left': '-'+ width1, 'top': 70+'%' }, 0, 'linear', function() { loop1(); }, 0); }); }
[ "function loop2() {\r\n\r\n\t $('.plane2').animate({\r\n \t\t'top': 65+'%'\r\n\t }, 15000, function() {\r\n \t\t\t$(this).animate({\r\n \t\t\t\t'left': 100+'%'\r\n\t \t\t\t}, 15000, function() {\r\n\t \t\t\t\t$(this).animate({\r\n\t \t\t\t\t\t'top': 100+'%',\r\n\t \t\t\t\t\t'left': 50+'%'\r\n\t \t\t\t}, 0, 'line...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
increments counter inside inner
function incrementCounter() { for (let i = innerLen - 1; i >= innerLen - 4; i--) { inner[i]++; if (inner[i] <= 0xff) return; inner[i] = 0; } }
[ "function inner() {\n // increment count\n count++\n // console.log count\n console.log(count);\n }", "function innerCounter(){\n counter++; //incrementing var on line 20 ->3\n console.log(counter);\n }", "function inner() {\n // increment count\n count+...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load citations from the remote server
function loadCitation(id) { let xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState === XMLHttpRequest.DONE) { if (xhr.status === 200) { showCitation(JSON.parse(xhr.responseText)); } else { window.alert(`Erreur : ${xhr.statusText}.`);...
[ "function loadCitations(fname) {\n var text = readFile(fname)\n var table = text.match(/<[t]body>[^\\v]*?<\\/tbody>/)\n var blob = table[0].substr(7,table[0].length-15)\n var tbody = $(\"citations\").getElementsByTagName(\"tbody\")[0]\n tbody.innerHTML += blob\n /* new HTML - no events are linked yet */...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RedSandUITextManager Reparses and redisplays UI text registry items
refresh() { for (let i in this.registry) { // Skip if the textTable is empty if (this.registry[i] === undefined || typeof(this.registry[i]) !== "object") { continue; } let elem = i; elem = elem.split(";"); elem[0] = simp...
[ "function updateTextUI() {\n select('#result').html(currentText);\n}", "function updateText() {\n txt = 'ITEMS: ' + currentItemCount + '/' + totalItemCount;\n itemsTxt.setText(txt);\n}", "function updateText()\n{\n\tclearText();\n\taddText();\n}", "reconfigurateTexts() {\n const tEvalSoldOut = new Tex...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a supplier into the database
addSupplier(params){ return Api().post('/savesupplier', params) }
[ "static addSuppliers(req, res) {\n\t\tSupplier.create({\n\t\t\tname: req.body.name,\n\t\t\tkota: req.body.kota\n\t\t})\n\t\t\t.then((newSupplier) => {\n\t\t\t\tres.redirect('/suppliers');\n\t\t\t})\n\t\t\t.catch((err) => {\n\t\t\t\tconsole.log(err);\n\t\t\t});\n\t}", "function updateSupplierInfo(id, cust){\n\tsup...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the current date in YYYYMMDD format
function getCurrentDate() { const d = new Date(); let month = (d.getMonth() + 1).toString(); if (month.length < 2) { month = `0${month}`; } let day = d.getDate().toString(); if (day.length < 2) { day = `0${day}`; } return `${d.getFullYear()}-${month}-${day}`; }
[ "function now_date() {\n var d = new Date();\n // getMonth starts from 0\n return parseInt([d.getFullYear(), d.getMonth() + 1, d.getDate()].map(function(n) {\n return n.toString().rjust(2, '0');\n }).join(''), 10);\n }", "function getCurrentDate() {\n let currentDate = new Date()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a Catberry Catcomponent file. More details can be found here Creates new instance of the "searchform" component.
function SearchForm() { }
[ "function SearchPanel() {\n Component.call(this, 'form');\n //Llamamos al componente ubicado en (web-components....)\n //Pasando el this(obligatorio para el call) y form que llegará \n //al componente como tag\n // var input = document.createElement('input');\n // input.type = 'search';\n // in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
plotDrag: move the plot in response to a drag
function plotDrag(dx, dy) { function dragAxList(axList, pix) { for(var i = 0; i < axList.length; i++) { var axi = axList[i]; if(!axi.fixedrange) { axi.range = [axi._r[0] - pix / axi._m, axi._r[1] - pix / axi._m]; } ...
[ "function plotDrag(dx, dy) {\n\t // If a transition is in progress, then disable any behavior:\n\t if(gd._transitioningWithDuration) {\n\t return;\n\t }\n\t\n\t recomputeAxisLists();\n\t\n\t function dragAxList(axList, pix) {\n\t for(var i = 0; i < axList.len...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
UTILITIES \ build records query handling multiple uids uidSet can be a commaseparated string or an array \
function buildQueryString(uidSet) { var uids = (typeof uidSet == "string") ? uidSet.split(',') : uidSet; var str = ""; $.each(uids, function(index, value) { str += solrFieldNameForUid(value) + ":" + value + " OR "; }); return str.substring(0, str.length - 4); }
[ "function buildQueryString(uidSet) {\n var uids = (typeof uidSet === 'string') ? uidSet.split(',') : uidSet;\n var str = '';\n $.each(uids, function(index, value) {\n str += solrFieldNameForUid(value) + ':' + value + ' OR ';\n });\n return str.substring(0, str.length - 4);\n}", "function bui...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles replica set delete dialog.
handleDeleteReplicaSetDialog() { this.kdDeleteReplicaSetService_.showDeleteDialog( this.stateParams_.namespace, this.stateParams_.replicaSet) .then(this.onReplicaSetDeleteSuccess_.bind(this), this.onReplicaSetDeleteError_.bind(this)); }
[ "handleDeleteReplicationControllerDialog() {\n this.kdReplicationControllerService_\n .showDeleteDialog(this.stateParams_.namespace, this.stateParams_.replicationController)\n .then(this.onReplicationControllerDeleteSuccess_.bind(this));\n }", "onReplicaSetDeleteSuccess_() {\n this.log_.info(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Close Client Spec helptext popup.
function helpTextClose(){ if ($('#client_spec_helptext_popup').css('display') == 'block') $('#client_spec_helptext_popup').css('display','none'); }
[ "function closeHelpDesk() {\n window.close();\n}", "function closeHelp() {\r\n var helpWindow = window.open(\"/help/help_toc.htm\",'DeviceWebUIHelpWindow','width=0,height=0,scrollbars=yes,resizable=yes,status=yes,menubar=no,toolbar=no');\r\n helpWindow.close();\r\n}", "close() {\n this.sendAction('c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Maintain an ariadescribedby attribute on a targetElement while active is true
function useDescribedBy(targetElement, active, id) { const tooltipIdRef = useRef(id); if (!tooltipIdRef.current) { tooltipIdRef.current = `tooltip-${nanoid(8)}`; } useEffect(() => { if (targetElement && active) { // only set/remove attribute if user has not already added at...
[ "function fixAriaHelp()/*:void*/ {\n this.ariaHelpEl && this.inputEl.dom.setAttribute(\"aria-describedby\", this.ariaHelpEl.id);\n }", "_setA11yAttributes() {\n this.trigger.setAttribute('aria-expanded', this.isOpen.toString());\n this.trigger.setAttribute('aria-controls', this.id);\n\n this.target.s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a modal that tells mobile users to orient the phone to landscape. Add a close button that if clicked, exits VR and closes the modal.
function createOrientationModal (exitVRHandler) { var modal = document.createElement('div'); modal.className = ORIENTATION_MODAL_CLASS; modal.classList.add(HIDDEN_CLASS); modal.setAttribute(constants.AFRAME_INJECTED, ''); var exit = document.createElement('button'); exit.setAttribute(constants.AFRAME...
[ "function createOrientationModal(exitVRHandler) {\n\t\t\t\tvar modal = document.createElement('div');\n\t\t\t\tmodal.className = ORIENTATION_MODAL_CLASS;\n\t\t\t\tmodal.classList.add(HIDDEN_CLASS);\n\n\t\t\t\tvar exit = document.createElement('button');\n\t\t\t\texit.innerHTML = 'Exit VR';\n\n\t\t\t\t// Hide modal ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all of our playlists in one foul swoop Recursively gets playlists until no more .next value. Fails when user has a lot of playlists, and we hit the API limits
function loadNextPlaylistsBatch(dispatch, getState, playlists, lastResponse){ if( lastResponse.next ){ sendRequest( dispatch, getState, lastResponse.next ) .then( response => { playlists = [...playlists, ...response.items] loadNextPlaylistsBatch( dispatch, ge...
[ "async getPlaylists() {\n\t\tconst url = 'https://api.spotify.com/v1/me/playlists' +\n\t\t\t\t '?client_id=' + clientId +\n\t\t\t\t '&limit=50' +\n\t\t\t\t '&offset='\n\t\tlet offset = 0;\n\t\tlet playlistIds = []\n\t\tlet playlistIdsCurr;\n\t\twhile (offset <= 100) {\n\t\t\tplaylistIdsCurr = await this.offsetHa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to insert into data into database and in their respective collection based on the type recieved from client
function insert(type, data) { db.collection(type).insertOne(data, function(err, res) { if (err) throw err; //if succesfully inserted log the details of data and client console.log("Document inserted of type " + type + ' from userId ' + data.userId); }); }
[ "function insertData(CollectionName, logger, callback) {\n mongoose.connection.db.listCollections({\n name: CollectionName\n }).next((err, result) => {\n if(err) {\n logger.error(err);\n callback(0)\n } else{\n if(result){\n console.log('Dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get detail of access permissions
detail(accessPermissionId) { return this.request.get(`detail?accessPermissionId=${accessPermissionId}`); }
[ "static get AccessPerm () {}", "async accessInfo(){\n return this.get(\"access-info\", null);\n }", "getPermissions () {\n return this.__request('GET', '/v1/me/getpermissions')\n }", "function list() {\n var deferred = $q.defer();\n $http.get(config.endpoints.admin.permission)\n .su...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert slider range value to millisecond value
function convertRangeToMillis (option) { var index = (parseInt(option) - 1) return rangeValuesinMillis[index] }
[ "timechanged () {\n this.audio.timeElement = (this.sliderElement.value / 100) * this.audio.duration;\n }", "function getTimefieldTimeBegin() {\n return parseFloat($('#clipBegin').timefield('option', 'value'));\n}", "function convert_to_milliseconds(value, type){\n\t\t// value = parseInt(val...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This Function adds data to the landing site table
function landSiteData() { /** * first i access the table "bodys" i.e the area the info will be displayed. * Then i create a table row and clone 6 times so each body has its own row. */ let landBody1 = document.getElementById("tab-one-body-land"); landBody2 = document.getElementById("tab-two-body-land"),...
[ "function makeTableData() {\n try {\n\n pageDetails.mainTableData = sortArrayByObj(pageDetails.mainTableData, 'overallDistScore', true);\n\n pageDetails.mainTableData = addIndToArr(pageDetails.mainTableData, 'ID');\n\n pageDetails.baseImagedata['mainFeatures']...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Changes a pixel on the tile.
function changePixel(ux, uy, palNum) { _tile[uy * CHR_WIDTH + ux] = palNum; nesTiles.writeTile(_appState.rom, _tile, _appState.selectedTileIndex); _appState.isDirty = true; drawPixel(ux, uy, palNum); document.dispatchEvent(new CustomEvent('tileDataChanged', { detail: {tile: _tile} })); }
[ "function setTile(x, y, value) {\n convert(x, y, function (index) {\n data[index] = value;\n \n redraw(x, y, true);\n\n if (tileset.isNSensitive(value)) {\n //Update adjacent\n redraw(x - 1, y, true);\n redraw(x + 1, y, true);\n redraw(x, y - 1, true);\n red...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
apply general functions like removing empty gray nodes, simplifying etc.
binaryOperationCleaning(extraNodes) { this.removeEmptyGrayNodes(this._octree); this.simplifyNode(this._octree); this.simplifyNode(extraNodes[0]); this.simplifyNode(extraNodes[1]); // updates center this.center = this._octree.boundingBox.center; }
[ "simplifyNode(node) {\n\t\tvar whiteBlackCounter = 0;\n\n\t\tfor (let i = 0; i < node.kids.length; i++) {\n\t\t\tif (node.kids[i].color == Octree.GRAY)\n\t\t\t\tthis.simplifyNode(node.kids[i]);\n\t\t\telse if (node.kids[i].color == Octree.WHITE)\n\t\t\t\twhiteBlackCounter--;\n\t\t\telse // Octree.BLACK\n\t\t\t\twhi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Feb23 by Jatin Insert Attachment in db
insertAttachment(params, division_db, token) { // const self = this; // const deferred = Q.defer(); // const sqlQuery = `use [${division_db}]; insert into dbo.caregiverAttachments(socialSecNum,descr,str_filename) values('${ // params.socialSecNum // }','${params.descr}','${params.str_filename}')`...
[ "function insertFileDataInDatabase (fileInfo) {\n\n // inser the file information\n collection.insert(fileInfo, function (err, doc) {\n\n // handle error\n if (err) { return callback({ status: 500, error: err }); }\n\n // inserted doc is the first o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch all authors from the database it assumes that the list has less that the 1MB limit of dynamodb
async list(event) { const data = event.queryStringParameters; const params = { TableName: authorsTable }; if (data && data.start){ params.ExclusiveStartKey = { id: data.start }; } try { // create a response of the results const result = await Util.DocumentC...
[ "async getEDUAuthors() {\n const authors = await this.queryEntries({\n content_type: 'person',\n limit: 1000,\n });\n return authors;\n }", "async function getAllAuthors()\n {\n let retrieved = [];\n\n await pool.query('SELECT * FROM author')\n .then((results) => retrieved ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The rotation of the wrist servo in degrees
set wristRotationDegree(value) { this._wristRotation = (value / 180.0 * Math.PI); }
[ "get wristRotationDegree() { return this._wristRotation * 180.0 / Math.PI; }", "get rotation() {}", "getRotationDeg(){\n return this.currentRot* (180/Math.PI);\n }", "get rotation() {\n // Get the radian angle\n let radianAngle = this.object3d.rotation.z;\n\n // Convert into degrees and ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes a picture and check if there's no more pictures hide the title
function removePicture(item){ $(item).remove(); if(!$('#pictures_shareTag').html()){ $('#title_pictures_shareTag').fadeOut('slow'); } checkboxPublicPrivateTag(); }
[ "function removeMinusOneImage() {\n minusOneImg.style.visibility = \"hidden\";\n document.body.removeChild(minusOneImg)\n }", "function removePics() {\r\n\t\tpicsContainer.innerHTML= '';\r\n\t\tsumButtonSwitch();\r\n}", "function deleteLittlepic() {\n var myContaner = document.qu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds traps to maze by changing random walls to traps, if difficulty is set to hard
function addTraps() { if(mazeDifficulty === "hard") { const possibleTrapPositions =[]; const numberOfTraps = 10; for (let i = 0; i < mazeWidth; i++) { for (let j = 0; j < mazeHeight; j++) { if (newPathArray[bottomRow - j][rightColumn - i] === 1) { possibleTrapPositions.push([rightColumn - i, ...
[ "function addRandomTraps(){\n // Create the random traps\n var randomTrap = [\n { trap : -1, message : 'You are bitten by a snake! <br> Go back ' },\n { trap : -3, message : 'Winter is Here! <br> Go back ' },\n { trap : -8, message : 'Shame! Shame! Shame! <br> You take the walk of shame!...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create rules from rule definitions which may include an id attribute for user customisation. It's assumed these are being created from build config.
function createExtraRules(extraRules = [], userConfig = {}) { let createRule = createRuleConfigFactory({}, userConfig); return extraRules.map(extraRule => { let { id } = extraRule, ruleConfig = _objectWithoutProperties(extraRule, ['id']); return createRule(id, ruleConfig); }); }
[ "function createExtraRules() {\n var extraRules = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var rule = ruleConfigFactory({}, userConfig);\n return extraRules.map(function (extraRule) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format number as money
function formatMoney(num) { return '£ ' + num.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); }
[ "function formatMoney(number){\r\n return (number).toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g, '$&,');\r\n}", "function formatMoney(num) {\n return '$' + num.toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g, '$&,');\n}", "function moneyFormat(n) {\n\treturn \"$ \" + n.toFixed(2).replace(/(\\d)(?=(\\d{3})+\\.)/g, \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generateDownloadLinks will generate a signed set of links for a given user to download an archive of their data.
async function generateDownloadLinks(ctx, userID) { const { connectors: { url: { BASE_URL }, secrets, }, } = ctx; // Generate a token for the download link. const token = await secrets.jwt.sign( { user: userID }, { jwtid: uuid.v4(), expiresIn: '1d', subject: DOWNLOAD_LINK_SUBJECT } ...
[ "async function generateLinks() {\n\tlet html = \"\";\n\tfor ( let i = 0 ; i < STORE.links.length && i < MAX_LINKS ; i++ ) {\n\t\thtml += `<div><a href=\"${STORE.links[i].link}\" data-idx=${i} target=\"_blank rel=\"noopener\"\n\t\t\t\t\tclass=\"link\">\n\t\t\t\t\t<div><h3>${STORE.links[i].title}</h3>${STORE.links[i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
9 flattenDepth Recursively flatten array up to depth times.
function flattenDepth(array,n) { console.log(array.flat(n)); }
[ "function flatten_flatten(array, depth) {\n return flatten(array, depth, false);\n}", "function flatten$1(array, depth) {\n return flatten(array, depth, false);\n}", "function flattenIter(data,depth,callback){doFlattenIter(data,depth,[],callback);}", "function flatten$1(array, depth) {\n return flatten(a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an array of all known artist names, with an optional max song amount and offset
getAllArtists(limit = 0, offset = 0) { var query = ` SELECT DISTINCT artist FROM songs LEFT JOIN json USING (json_id) ORDER BY date_added ASC `; return this.cmdp("dbQuery", [query]) .then((artistObjs) => { // Unpack "artist" string attribute into its own array of strings return new Promise((r...
[ "function getMainArtists(arrSongs) {\n\tarrSongs.map(function(song){\n\t\tartist = song.artist;\n\t\tfeaturingIndex = artist.search(\" featuring\");\n\t\tif (featuringIndex > 0) {\n\t\t\treturn artist.substring(0, featuringIndex);\n\t\t} else {\n\t\t\treturn artist;\n\t\t}\n\t});\n}", "function getArtists(artist)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method checks if Metamask selected network is Localhost:8545 / Kovan Testnet
_checkNetwork() { if ( [HARDHAT_NETWORK_ID, KOVAN_NETWORK_ID].includes( window.ethereum.networkVersion ) ) { return true; } this.setState({ networkError: "Please connect Metamask to Localhost:8545, or Kovan Testnet", }); return false; }
[ "function checkNetwork() {\n web3.version.getNetwork((err, netId) => {\n if(netId != \"3\") {\n alert(\"PLEASE CONNECT TO THE ROPSTEN NETWORK ON METAMASK\");\n }\n })\n}", "isTestNetwork(network) {\n return network === xrpl_network_1.default.Test || network === xrpl_network_1...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcion para cargar departamentos en dropdown
function getDepartamentosDropdown() { $http.post("Departamentos/getDepartamentosTotal").then(function (r) { if (r.data.cod == "OK") { vm.listaDepartamentos.data = r.data.d.data; } }) }
[ "function getEmpleadosDropdown() {\n $http.post(\"lateral/getNombresDropdown\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaEmpleados.data = r.data.d.data;\n \n }\n })\n }", "function chargeSelectCiudades(departamento){\n\tvar tx...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove an interview session from Firestore
removeInterviewById(interviewId) { return firebase.firestore().collection('users').doc(backendService.token).update({ interviews: firebase.firestore().FieldValue().arrayRemove(interviewId) }); }
[ "function delRec(recID){\n db.collection(\"invitations\").doc(recID).delete();\n}", "async deleteFromCollection(ctx, movie) {\n let collection = await db.collection(auth.currentUser.uid).get();\n let number = 0;\n await collection.forEach(doc => {\n Object.keys(doc.data()).forEach...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hides category "active, inactive, debris". You must pass through the category name as a string > ex. "active" otherwise will throw an error
function hideCategory(category) { NEAR_FIELD_OBJECTS.scene.children.forEach(child => { if (child.userData == category) child.visible = false }) }
[ "hideUniformCategory(list, category) {\n list.set('hideCategory', category && !category.get(\"has_children\"));\n }", "function hideCategory() {\n $('#category').hide();\n}", "function hideCategoryNav() {\n var $tooltipBackground = $('.tooltip-background');\n // Check if a disclaime...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
general purpose function to return true if a is congruent to b module m e.g. IsCongruent(7,2,5) = true because 5 divides (72) e.g. IsCongruent(15,20,10) = false because 10 does not divides (1520) (c) 20102016 Kardi Teknomo all rights reserved
function IsCongruent(a,b,m) { return IsDivisible(a-b,m) }
[ "function congruent(a, b, k) {\n return scn(a, k) === scn(b, k);\n}", "function isDivisibleBy(a, b) {\n if (a % b == 0) {\n //trace(n+\" est divisible par \"+i);\n return true;\n } else {\n return false;\n }\n}", "function checkCoprimeNum(a,b){\n\tif (b===1) {\n\t\treturn true;\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function from mysql to excel my sql to excel file .
function create_excel_produits(){ // Create a connection to the database const con = mysql.createConnection({ host: 'localhost', user: 'root', password: '', database: 'ordre' }); // Open the MySQL connection con.connect((err) => { if (err) throw err; /...
[ "function exportData(){\r\n\r\n var tab_text=\"<table border='2px'><tr bgcolor='#87AFC6'>\";\r\n var textRange; var j=0;\r\n tab = document.getElementById('mytable'); // id of table\r\n\r\n for(j = 0 ; j < tab.rows.length ; j++) \r\n { \r\n tab_text=tab_text+tab.rows[j].innerHTML+\"</tr>\";\r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method to extract the kda of a champion
function getChampionKDA( item, champion, which ){ if( which == 0 ){ if( pre[""][champion] == undefined ) return "Unplayed"; return pre[""][champion]["KDA"]; } else{ if( post[item][champion] == undefined || post[item][champion]["numGames"] < num ) return "Unplayed"; return post[item][ch...
[ "function getChampionKey(champ){\t\n\t\t//console.log(champ);\n\n\t\tvar xhrChampInfo = new XMLHttpRequest();\n\t\txhrChampInfo.onload = function(){\n\t\t\tvar myJSON = JSON.parse( xhrChampInfo.responseText );\n\t\t\tvar name = myJSON.key;\n\t\t\tplayerObject.championsPlayed.push(name);\n\t\t\t\n\t\t\t//console.log...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function that goes through each card, adds event listener, adds open/show classes when clicked, and adds match class when they match
function activateCards() { allCards.forEach(function(card) { card.addEventListener('click', function(e) { console.log("A card was clicked!"); if (!card.classList.contains('open') && !card.classList.contains('show') && !card.classList.contains('match')) { openCards.push...
[ "function showCard() {\n this.removeEventListener('click', showCard);\n this.classList.add('show', 'open');\n openCard.push(this);\n if (openCard.length === 2) {\n updateCounter();\n if (openCard[0].firstChild.classList.value === openCard[1].firstChild.classList.value) {\n openCard[0].classList.add('...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
addCodeToHtml() sets up all the algorithms code and algo info blocks and on document ready.
function addCodeToHtml(){ let bSortCodeBlock = document.getElementById("bubble-sort-code-block"); let mSortCodeBlock = document.getElementById("merge-sort-code-block"); let qSortCodeBlock = document.getElementById("quick-sort-code-block"); let bSortInfoBlock = document.getElementById("bubble-sort-info...
[ "function initializeCodePane() {\n for (var i = 0; i < code.length; i++) {\n if (code[i].type==\"string\") {\n for (var j = 0; j < code[i].text.length; j++) {\n var el = element(\"span\")\n el.text(code[i].text[j])\n el.newAddClass([code[i].color, \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
====================================== peer to peer methods ========================================================= addNode: ["ip", "command"], getAddedNodeinfo: ["verbose"], getNetworkInfo: [], getPeerInfo: [], ping: [],
function addNode(params) { return new Promise((resolve, reject) => { var response; var ipAddress = params.ip; var commands = params.command; multichain.addNode({ "ip": ipAddress, "command": commands }, (err, res) => { console.log(res) if (err == null) { ...
[ "addPeer(id, info={}) {\n let peer = this.getPeer(id);\n\n // check if this peer was already added\n if (peer) return peer;\n\n // create a new peer\n peer = new NetworkPeer(this.peer, id, info);\n this.peers.push(peer);\n\n return peer;\n }", "function addNode(params) {\n return new Promis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prompts the user to store this OExchangeenabled site.
function promptIfOexchange() { var s = ['', '<div id="oexchange-prompt-inner">', '<h1>OExchange</h1>', '<p>This site has enabled open sharing. Would you like to remember it so you can share here later?</p>', '<div id="oexchange-prompt-buttons">', ...
[ "function manageStore() {\n\n inquirer.prompt([{\n name: \"action\",\n type: \"list\",\n message: \"Choose an option below to manage your store:\",\n choices: [\"Restock Inventory\", \"Add New Product\", \"Remove An Existing Product\"]\n }]).then(function(answers) {\n\n swit...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
wait for the event eset in the given scope, when eset is triggered, break execution
function breakupon(eset) { return { in: function(waitForScope) { //save previous bp var _bp = bp; bp = { //new sync function sync : function(rwb){ //there are no other events we need to wait for if (rwb.waitFor == null){ rwb.w...
[ "function waitFor(o) {\n\tvar waitList = [];\n\t\n\t_.each(o.events, function(e, index) {\n\t\tvar defer = $.Deferred(),\n\t\t\temitter = e.emitter || o.emitter,\n\t\t\tevent = e.name || e,\n\t\t\tcheck = typeof e.check == 'function' ? e.check() : false,\n\t\t\tcheckFail = typeof e.checkFail == 'function'? e.checkF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Metodo responsiveVideos(), encierra en un div de clase videobox a cada iframe con source de youtube o vimeo, para poder mantener su aspecto en pantallas pequenas.
function responsiveVideos(){ $(".review iframe[src^='http://player.vimeo.com'], .review iframe[src^='http://www.youtube.com']").each(function(){ $(this).wrap('<div class="videobox"></div>'); }); $('.review .videobox').each(function(){ $(this).wrap('<div class="video_container"></div>'); }); }
[ "function responsiveVideos(){\n\tvar iframes = document.getElementsByTagName( 'iframe' );\n\t\tfor ( var i = 0; i < iframes.length; i++ ) {\n\t\tvar iframe = iframes[i],\n\t\tplayers = /www.youtube.com|player.vimeo.com/;\n\t\tif ( iframe.src.search( players ) > 0 ) {\n\t\t\tvar videoRatio = ( iframe.height / iframe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Watch search form for submit, call getParks function
function watchForm() { $('form').submit(event => { event.preventDefault(); const searchText = $('#search-text').val(); const maxResults = $('#max-results').val() - 1; getParks(searchText, maxResults); }); }
[ "function watchForm() {\n $('form').submit(event => {\n event.preventDefault();\n const searchTerm = $('#js-search-term').val();\n const maxResults = $('#js-max-results').val();\n getParksInfo(searchTerm, maxResults);\n });\n}", "function watchForm(){\r\n console.log('App Loaded!');\r\n $('for...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initial is the object that creates the initial module or a set of modules
function Initial () {}
[ "function init() {\n\treturn Object.create( MyModuleObject );\n}", "function init(){ \n modules = Object.freeze(loadModules());\n for(let moduleId in modules){\n let moduleDefinitions = getDefinifionsForModule(moduleId);\n var modulePath = getModulePath(moduleId);\n for(let level of m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }