query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Probably actually not uniform, but probably good enough for games. Returns an integer uniform between min and max, both inclusive.
function uniformInt(min, max) { return min + Math.floor(Math.random() * (max - min + 1)); }
[ "function randomInclusiveNumGen(min, max){\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1) + min);\n}", "function getRandomValueInRange(min, max){\n if(max === min){\n return max;\n }\n var randomValue = (max - min) * Math.random() + min;\n return Ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
:: VOID > yngwieListener Creates clone of this yngwieListener:
clone() { let evtName = `${this._evtName}`; let fns = this._fns.map(fn=>{ return new Function("evt", "elem", fn.toString()); }); return new YngwieListener(evtName, fns); }
[ "function listeners_(){this.listeners$bq6g=( {});}", "function YalcilListener() {\n\tantlr4.tree.ParseTreeListener.call(this);\n\treturn this;\n}", "function captureListeners_(){this.captureListeners$bq6g=( {});}", "function tiproxy_remove_fire_listener(e) {\r\n throw new Error(\"should not be called\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Appointment that this response is replying to.
get appointment() { return this.__appointment; }
[ "static get __resourceType() {\n\t\treturn 'AppointmentResponse';\n\t}", "createAppointment(event) {\n event.preventDefault()\n const selectedDate = this.refs.selectedDate.value;\n const selectedTime = this.refs.selectedTime.value;\n var patientDescription = this.refs.selectedPatient.value;\n var p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Processes a message and try to upload any images found in it
async function processMessageUpload(msg) { //See if it is a gallery post. // If so, then we will just react and then continue on. No need to process it twice. // (this is if they directly post a https://gall.lu.je/gallery/ post) let gallery = await findGalleryFromMessageContent(msg.content); if (ga...
[ "function replyByImage(image) {\n\n // Check for the Uploaded Image \n if(image && fileUploadingType) {\n var reply = `<div class=\"text-center\">\n <img src=\"${image}\" class=\"img-fluid chatbox__image--uploaded\" alt=\"image\">\n </div>`;\n\n // Call addQuestio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Switch to the smart folder mode, get the smart inbox.
function test_switch_to_smart_folder_mode() { mc.folderTreeView.mode = "smart"; assert_folder_mode("smart"); smartFolderA = get_smart_folder_named(smartParentNameA); mc.folderTreeView.selectFolder(smartFolderA); }
[ "async getFolder(href) {\n const [result] = await this.client('folders').select('folder').where('href', href);\n if (typeof result !== 'undefined') {\n return new Folder(result.href, result.folder);\n }\n }", "editFolder(aTabID, aFolder) {\n let folder = aFolder || GetSelecte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If the given date is not within the given range, move it inside. (If it's past the end, make it one millisecond before the end).
function constrainMarkerToRange(date, range) { if (range.start != null && date < range.start) { return range.start; } if (range.end != null && date >= range.end) { return new Date(range.end.valueOf() - 1); } return date; }
[ "function clampTimeRange(range, within) {\n if (within) {\n if (range.overlaps(within)) {\n var start = range.start < within.start ?\n range.start > within.end ?\n within.end :\n within.start : range.start;\n var end = range.end > within.end ?\n range.end < within.start...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Rotate a Vector3 around the yaxis
function rotate_vector3_y(vector, angle_in_degrees) { var r = deg2rad(angle_in_degrees); var s = Math.sin(r); var c = Math.cos(r); var multMatrix = new Matrix4(); multMatrix.elements = [ c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1]; return multMatrix.multiplyV...
[ "rotate270() {\n const { x } = this;\n this.x = this.y;\n this.y = -x;\n }", "rotateAroundWorldAxis(obj, axis, radians) {\n let rotWorldMatrix = new THREE.Matrix4();\n rotWorldMatrix.makeRotationAxis(axis.normalize(), radians);\n rotWorldMatrix.multiply(obj.matrix); // pre-multiply\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempts to schedule all the possible combinations of a course's particular activity type.
function scheduleCourseSections(iCourseID, iSectionID) { var scSectionContainer = UBCCalendarAPI.getSectionContainer(aCourseIDs[iCourseID]); if (iSectionID >= scSectionContainer.aSections.length) { // We're out of section types for this course, so we'll go to the next one schedu...
[ "function scheduleCourse(iCourseID) {\n if (iCourseID >= aCourseIDs.length) {\n // We are out of courses to schedule - great!\n // Make a 1-dimensional array out of the 2-dimensional current schedule array\n var aPossibleSchedule = [];\n var sPossibleSchedule = \"\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
____________________________________________________________________________ Validate the options for the command to create a z/OS file system
static zfsValidateOptions(options) { imperative_1.ImperativeExpect.toNotBeNullOrUndefined(options, ZosFiles_messages_1.ZosFilesMessages.missingFilesCreateOptions.message); /* If our caller does not supply these options, we supply default values for them, * so they should exist at this point. ...
[ "static vsamValidateOptions(options) {\n imperative_1.ImperativeExpect.toNotBeNullOrUndefined(options, ZosFiles_messages_1.ZosFilesMessages.missingFilesCreateOptions.message);\n /* If our caller does not supply these options, we supply default values for them,\n * so they should exist at this ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
resetRegisters() Sets all registers in array to 0
function resetRegisters () { for (var register in registers) registers[register] = 0; }
[ "function resetAll () {\n resetOutput();\n resetRegisters();\n updateRegisterOutput();\n error = false;\n}", "clearAll() {\n this._stack.length = 0;\n\n // stuff the stack to mimic always needed registers\n for (let i = 0; i < MINIMUM_STACK; i++) {\n this._stack.push(0);\n }\n\n this._last...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an array of values, returns the min/max range to be set on size domain
function getBubbleSizeRange(values) { var sizeMinMax = []; sizeMinMax = d3.extent(values, function (obj) { return obj['size'] }); if (sizeMinMax[0] == sizeMinMax[1]) { sizeMinMax = [sizeMinMax[0] * .9, sizeMinMax[0] * 1.1]; } else { sizeMinMax = [sizeMinMax[0], sizeMinMax[1]...
[ "function minMaxSet() {\n min = parseInt(minRange.value);\n max = parseInt(maxRange.value);\n}", "function findMinMax(array, minmax) {\n if ( minmax == \"max\" ) {\n return Math.max.apply(Math, array);\n }\n else if ( minmax == \"min\" ) {\n return Math.min.apply(Math,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enables or disables the echoing of commands into stdout for the rest of the step. Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
function setCommandEcho(enabled) { command_1.issue('echo', enabled ? 'on' : 'off'); }
[ "function debugAction(action) {\n debugger\n action.debug = true\n return action\n}", "function setupConsoleLogging() {\n (new goog.debug.Console).setCapturing(true);\n}", "function disableStdout() {\n isStdoutDisabled = true;\n}", "function debugEnabled(){\n let debug = false\n for (const arg of...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adapt the style to an element: returns the new style of the element
adapt_style(elem){ var elem_type = 'node'; if(elem.isEdge()){ elem_type = 'edge'; } var elem_style = this.STYLE[elem_type][elem._private.data.type]; elem.style(elem_style); return elem_style; }
[ "function newStyle(element) {\n element.style['color'] = randObj().color;\n element.style['font-size'] = randObj().size;\n element.style.fontFamily = randObj().font;\n element.style.backgroundColor = randObj().backgroundColor;\n element.style.border = randObj().border;\n }", "function _stylise($...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
count entry and exit pairs for each layer, alert with status
function check_missing(){ i=global_events.length; var layer_counts = {}; while (i--) { if (global_events[i].fields.Layer){ layer = global_events[i].fields.Layer label = global_events[i].fields.Label if(!layer_counts[layer]){ layer_counts[layer] = {}; } if(label){...
[ "function getSelectedLayersCount(){\n\t\tvar res = new Number();\n\t\tvar ref = new ActionReference();\n\t\tref.putEnumerated( charIDToTypeID(\"Dcmn\"), charIDToTypeID(\"Ordn\"), charIDToTypeID(\"Trgt\") );\n\t\tvar desc = executeActionGet(ref);\n\t\tif( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){\n\t\t\td...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Upon being called by the gameplay controller, it checks if the mouse is inside the triangle, if so, it begins the color drag and drop
function MouseDown() { // If the point is inside the triangle if(PointInsideTriangle()) { Debug.Log("Down: "+gameObject.name); // Tells the gameplay controller to start the logic for changing triangle collors, this phase represents selecting the triangle from which we will add / subtract color gameplayControll...
[ "function mouseDragged() {\n\tif(mouseX > frameThickness && mouseX < canvasWidth-frameThickness && mouseY > frameThickness && mouseY < canvasWidth-frameThickness){\n\t\t//\"Turn on\" drawing\n\t\tisDrawing = true;\n\t\treleasedMouse = false;\n\t\tbrush.drag(mouseX, mouseY);\n\t\t//hide mouse if dragging\n\t\tdispl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets the currently selected client
setSelectedClient(state, selectedClient) { state.selectedClient = selectedClient; }
[ "_onApplicationSelect() {\n this._selected = 'appsco-application-add-settings';\n }", "function setClientNameUI(clientName) {\n var div = document.getElementById('client-name');\n div.innerHTML = 'Your client name: <strong>' + clientName +\n '</strong>';\n }", "function ServerBehavior_setSel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Not currently being used Helper function to create tooltips for the animated nodes animatedNode: the node in the BST that is going to be animated value: the value of the animated node current: the node in the BST that the animated node is being compared to
function createTooltipForAnimatedNode(animatedNode, value, current) { var tooltipContent = "Value: " + value + "<br>" + "x_coord: " + animatedNode.cx + "<br>" + "y_coord: " + animatedNode.cy; $('circle.animated').tipsy({ gravity: 'w', html: true, delayO...
[ "function drawAnimatedNode(tree, svgContainer, animatedNode, xpos, ypos) {\n\n //Special case: when there is only one item, there is nothing to animate\n if(tree.size() === 1) {\n //clear the screen\n svgContainer.selectAll(\"circle\").remove();\n svgContainer.selectAll(\"line\").remove()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A ProcessInstantEvent is a zeroduration event that's tied to a particular process. An example is a trace event that's issued when a kill signal is received.
function ProcessInstantEvent(category, title, colorId, start, args) { InstantEvent.apply(this, arguments); this.type = InstantEventType.PROCESS; }
[ "function addGlobalInstantEvent(model, name, timestamp) {\n console.log(\"Adding instant event for \", timestamp);\n var e = new tr.model.InstantEvent(\"tti-experiment\", name,\n tr.b.ColorScheme.getColorIdForReservedName(\"black\"), timestamp);\n model.instantEvents.push(e);\n }", "createSchedul...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal: Set timer to trigger JWT refresh.
setupTokenReconnectTimer(){ log.debug('[PageSharedDB] setting up timer for token refresh') let reconnectInMilliseconds = (this.expires_at * 1000) - Date.now() - 5000 clearTimeout(this.tokenReconnectTimer) this.tokenReconnectTimer = setTimeout(() => { this.tokenReconnect() }, rec...
[ "function setAutoRefreshTimeout() {\n clearTimeout(autoRefreshTimeoutId);\n if (auth.autoRefresh && typeof auth.expires !== 'undefined') {\n autoRefreshTimeoutId = setTimeout(auth.refresh, auth.expires + 1000);\n }\n }", "async setRefreshToken (token) {\n this.client.auth.ref...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to pass all input field .val()s to createEmployee() and addToTable ()
function passToConstructorAndTable () { let inputFirstName = $('#firstNameInput').val(); let inputLastName = $('#lastNameInput').val(); let inputIdNumber = $('#idNumberInput').val(); let inputJobTitle = $('#jobTitleInput').val(); let inputAnnualSalary= $('#annualSalaryInput').val(); if (inputFir...
[ "function submitClick() {\n let firstName = $('#firstNameInput').val();\n let lastName = $('#lastNameInput').val();\n let id = $('#idNumberInput').val();\n let jobTitle = $('#jobTitleInput').val();\n let salary = $('#annualSalaryInput').val();\n\n // if any inputs are blank, call the errorMessage function\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parse folders looking for README.md files (to indicate the folder should be read by the documentation app);
function getReadmeData (folderToParse) { // data object to return; // this will be the collection of components/templates with documentation README files; const folderData = []; // go through each folder looking for a README.md file, and if one is found, record the folder for the documentation; file.walkSync...
[ "readDir(p) {\n let files = fs_1.readdirSync(p);\n for (let name of files) {\n let fileName = path.join(p, name);\n if (fs_1.statSync(fileName).isDirectory()) {\n this.readDir(fileName);\n continue;\n }\n let text = fs_1.readFil...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
IMGUI_API bool IsItemClicked(int mouse_button = 0); // is the last item clicked? (e.g. button/node just clicked on)
function IsItemClicked(mouse_button = 0) { return bind.IsItemClicked(mouse_button); }
[ "function IsItemActivated() { return bind.IsItemActivated(); }", "function jsIsClicked() {\n return clicked;\n }", "function IsItemHovered(flags = 0) {\r\n return bind.IsItemHovered(flags);\r\n }", "function IsMouseReleased(button) {\r\n return bind.IsMouseReleased(button);\r\n }",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function accepts tags array from a single quote object, returning the tags in a Html format
function createTags(tags) { let tagsHtml = ''; if (tags !== undefined) { for (let i = 0; i < tags.length; i++) { tagsHtml += `<span class="tag">${tags[i]}</span>`; } } return tagsHtml; }
[ "function formatTags(tags) {\n var formatted = [];\n angular.forEach(tags, function(tag) {\n formatted.push({ text: tag });\n });\n return formatted;\n }", "function format_selected_tags (htag)\n { var rx = /<p class=\"stag\" id=\"(.*?)\">{1}/\n tags = '';\n while (match = rx.exec(htag))\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to list of all indicators on the county pages with indicator name, indicator value, and rank, with a horizontal bar that shows the rank (long green bar = 1, short red bar = last)
function displayAllIndicators() { var html = "<table> <tr> <th></th> <th>Indicator</th> <th>Value</th> <th colspan=\"2\">Rank among local authorities</th> </tr>"; var color; var size; var bar = ""; var completeBar; var divId =""; var mean = numRegions / 2; var positions_level2=0,positions_level1=0; va...
[ "function loadIndicatorsObservations(forASingleCounty) {\n\t\tvar bindings = queryIndicatorResults.results.bindings;\n\t\tvar localIndicators = [];\n\t\tvar localProps = [];\n\t\tvar localRegions = [];\n\t\tvar len = 0;\n\t\t\n\t\n\t\tfor (var i=0; i<bindings.length; i++) {\n\t\t\t// in each row we have ?prop ?prop...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
URLS MANAGEMENT SECTION / Event handler for when the user wants to add a url. If the last url field is still empty, we simply put the focus on it. Otherwise we create a new blank url input.
function onAddUrl(ev) { ev.preventDefault(); var lastField = this.select('urlListSelector').find('[name="websites[]"]').last(); if (lastField.val() === '') { lastField.focus(); } else { this.select('urlListSelector').append(metadataEditUrlListTemplate.render({ metadataPrefi...
[ "function onUrlInputKeydown(ev, data) {\n\n switch (ev.which) {\n case 9:\n // tab\n if (ev.shiftKey) {\n // ignore shift + tab\n break;\n }\n /* falls through */\n case 13:\n // return\n var urlsCount = thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new HistoricalQR
async function Create() { const HistoricalQR = await getDB(); let result = null; const date = new Date(); const expireTime = 15; try { result = await new HistoricalQR({ secret: btoa( btoa(date.valueOf()) + Math.random() * 555 + date.valueOf().toString().substr(0, 5).spl...
[ "historicalOrderbook(symbol_id, time_start, time_end, limit, limit_levels) {\n const params = this._getParamString({\n time_start: time_start,\n time_end: time_end,\n limit: limit,\n limit_levels: limit_levels\n });\n return this._request(`/v1/orderbo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resizes and styles dummy nodes
resizeDummyNodes(){ var self = this var clusterBBox = d3.select('.interactive_diagram.' + self.view).select('.cluster').node().getBBox() d3.select('.interactive_diagram.' + self.view) .selectAll('.node') .each(function(){ var id = d3.select(this).attr('id') ...
[ "function naturalSize(node) {\n var style = node.style;\n var boxSizing = style.boxSizing;\n var position = style.position;\n var top = style.top;\n var left = style.left;\n var right = style.right;\n var bottom...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this draws a shop
shop() { // this sets the current scene to "shop" this.current = "shop"; // this draws the floor background(148, 82, 52); //this draws the shelves for (let i = 0; i < 4; i++) { this.vShelf(50 + this.pxl * 3 * i, 400); } for (let i = 0; i < 2; i++) { this.hShelf...
[ "function shopMenu() {\n fill(0, 200, 144);\n rect(0, 0, width, height);\n fill(255, 0, 0);\n rect(windowWidth - 3 * blockWidth, 0, 3 * blockWidth, 3 * blockHeight);\n fill(255);\n rect(blockWidth * 5, blockHeight * 5, windowWidth - (10* blockWidth), windowHeight - (10* blockHeight));\n rectMode(CORNERS);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The clinical status of the allergy or intolerance.
get clinicalStatus () { return this._clinicalStatus; }
[ "get status() {\n if (!this._cancerProgression.value) return null;\n return this._cancerProgression.value.coding[0].displayText.value;\n }", "get status() {\n this._status = getValue(`cmi.objectives.${this.index}.status`);\n return this._status;\n }", "_getAVREcoStatus() {\n this....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function getfloodfill runs floodfill function, initializes new color and mouse coords, sets base color and stack array
function getfloodfill(e){ let coords = getMousePosition(canvas, e); col_num = parseInt(coords[1]); row_num = parseInt(coords[0]); var new_color = {r: 0x0, g: 0x0, b: 0x0, a: 0xff}; var baseColor = getColorAtPixel(imageData,row_num,col_num); Stack.push([row_num, col_num]); while(Stac...
[ "function floodFill(i, j) {\n var $recurCell = document.querySelectorAll(`[data-row='${j}'][data-col='${i}']`);\n \n // Give the current tile a mark showing it has already been checked\n $($recurCell).attr('recurred', 1);\n \n // For each adjacent tile\n for (var offJ=-1; offJ<=1; offJ++){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Obtains Velocity sampletest files
function _getSampleTestFiles () { return [{ path: path.join(testSuitesRelativePath, 'test-txt.txt'), contents: Assets.getText(path.join('sample-tests', 'suites', 'test-txt.txt')) }, { path: path.join(testSuitesRelativePath, 'test-tsv.tsv'), contents: Assets.getText(path.join('sample-test...
[ "get fixture() { return 'example/test/fixture/test.txt' }", "async function getTestCases() {\n const directories = await fs.readdir(TEST_CASES_DIRECTORY);\n const testCases = [];\n \n for (let i = 0; i < directories.length; i++) {\n const filename = directories[i];\n\n if (filename.indexOf...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Whether the two dates represent the same view in the current view mode (month or year).
_isSameView(date1, date2) { if (this.calendar.currentView == 'month') { return this._dateAdapter.getYear(date1) == this._dateAdapter.getYear(date2) && this._dateAdapter.getMonth(date1) == this._dateAdapter.getMonth(date2); } if (this.calendar.currentView == 'year') { ...
[ "function sameDate(dateA, dateB) {\n return dateA.getUTCFullYear() === dateB.getUTCFullYear() &&\n dateA.getUTCMonth() === dateB.getUTCMonth() &&\n dateA.getUTCDate() === dateB.getUTCDate();\n }", "function sameDate(date1, date2) {\n return (date1.getDate() === date2.getDate()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Coefficient of determination of sample
function coeff_of_determination_s(X, Y) { return correlation_coeff_s(X, Y) ** 2; }
[ "function getFitness(sample){\n\treturn getNumConflictionsOnBoard(sample)/(sample.length*sample.length);\n}", "function calculate(){\n var productMatrix = matrixMultiply();\n var reflectance = [];\n var no = 1.0;\n var ns = parseFloat($('input#substrate').val());\n \n //for each wavelength find matrix...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Put all IoT devices on local network into configuration mode (acess portal)
function config() { outlet(0, 'host', addr_broadcast); outlet(0, 'port', iotport); outlet(0, '/config'); }
[ "function discoverTTSDevices() {\n console.log('[TTS] Discovering resources on TTS...');\n var json = JSON.stringify({\n path: '/api/v1/device/list',\n requestID: '1',\n options: {depth: 'all'}\n });\n manageWS.send(json);\n}", "function setDeviceInformation(devPath,model,src,manu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the map projection, autosetting parallels or centers based on data
function updateProjection(data,width,height) { //Projection at unit scale mapOptions.projection = d3.geo[mapOptions.projectionType]() .scale(1) .translate([0, 0]); //Path generator mapOptions.path = d3.geo.path() .projection(mapOptions.projection); //Use min/max lat of data as parallels f...
[ "function centerCleveland(){\n map.setView([41.502405, -81.673895],13);\n}", "resetMapAndVars(){\n controller.infoWindow.close();\n model.map.setZoom(13);\n model.map.setCenter(model.athensCenter);\n }", "updateMap(worldcupData) {\n\n //Clear any previous selections;\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
renders the minesweeper game grid on the 2D canvas
function renderGrid(ctx) { drawGridLines(ctx); drawGridCells(ctx, minesweeper.cells ); }
[ "function drawGrid() {\n for(let i = 0; i < HEIGHT; i++) {\n // create a new raw\n let raw = $('<div class=\"raw\"></div>');\n // fill the raw with squares\n for(let j = 0; j < WIDTH; j++) {\n raw.append('<div class=\"block\"></div>');\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
from (define call/cc (lambda (f cc) (f (lambda (x k) (cc x)) cc)))
function callcc (f,cc) { return f(function(x,k) { return cc(x); },cc); }
[ "visitFunction_call(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "enterCallableReference(ctx) {\n\t}", "function acc(func, initial) {\n \n}", "function yinyang_cps_00_02() {\n call_cc_cps(k => k, (cc) => {\n const yin = ((cc) => {\n process.stdout.write(\"@\");\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for create the new car window
function createNewCarWindow() { if (newCarWin) { return; } newCarWin = new BrowserWindow({width: 450, height: 400, webPreferences :{nodeIntegration : true}}); newCarWin.loadFile(path.join('src', 'addCar.html')); // Listen when the window will be closed for destroy it newCarWin.on('clos...
[ "function newRobotWindow() {\n\tvar robotWindow = window.open(\"Images/robot.png\", \"robotWindow\", \"resizable=no,width=400,height=300\");\n\treturn false;\n}", "function createWindow() {\n\n windowPanel = $(\"<div></div>\"); //Sliding Window\n windowPanel.addClass(\"swindow\");\n var sfSlot = sfSlots[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove socketID of userID
removeSocketFormUser(userID, socketID) { // If have connections if (isUserOnline(userID)) { socketIDs[userID].sockets.map(function (socket, index) { // If the socket is correct socket want to remove if (socket === socketID) { socketIDs[userID].sockets.splice(index, 1); ...
[ "async function getUserID(socketId){\n const userId = await redis.getValue(`${socketId}`);\n \n // Remove this socket id from redis\n await redis.removeValue(`${socketId}`);\n\n return userId;\n}", "function handleClientDisconnection(socket) {\n\tsocket.on('disconnect', function() {\n\t\tvar nameIn...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
display a message with number
function displayMessage(numb) { console.log("I am diplaying 1st message, becuase I ate " + numb + " apples"); }
[ "function changeText() {\r\n $alertHolder.html(number);\r\n }", "function displayQuestionNumber () {\n $('.question-key').html('Question Number: ' + (questionNumber + 1) + '/10')\n}", "getDisplayNumber(number) {\n\n let displayNumber = '';\n\n if (number % 3 === 0) { // multiple of 3\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
collects the appropriate casting functions for a given color space
function getCastingFtns(space) { let fromColor; let toColor; switch (space) { case ColorSpace.RGB: fromColor = (c) => c.toRGB(); toColor = (r, g, b) => new Color(r, g, b); break; case ColorSpace.HSV: fromColor = (c) => c.toHSV(); to...
[ "function ColorType()\n{\t\t\t\t\n}", "_makeColorScheme(category_info) {\n // If at least one element has an explicit itemRgb, assume the entire dataset has colors. BED intervals require rgb triplets,so assume that colors will always be \"r,g,b\" format.\n const has_explicit_colors = categor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This renderer creates a link that calls the biobank results function with the id from the datastore corresponding to the row we clicked on.
function renderSampleLink(value,id,row) { var returnString = ""; if(true) { returnString += value + '&nbsp;&nbsp;&nbsp;<a href="#" onClick="showBioBankResults(\'' + row.id + '\')"><img src="' + pageInfo.basePath + '/images/test_tube.png"></a>&nbsp;&nbsp;&nbsp;'; } else { return...
[ "function onClickOid(e)\n{\n\tvar row = this.data[0];\n\tvar item = convertOid(row[0],row[1]);\n\t//if (item)\n\t{\n\t\titemlist.appendData(item);\n\t\tEvent.element(e).setStyle('background-color: #ACCEDE');\n\t}\n}", "function clickToDisplay(id) {\n $(\"#itemDisplayBox\").text(id);\n}", "function guest_airbnb...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a value that specifies the collection of fields for the content type.
get fields() { return tag.configure(SharePointQueryableCollection(this, "fields"), "ct.fields"); }
[ "get fields() {\n return SPCollection(this, \"fields\");\n }", "getFieldType() {\n return this._fieldTypeId\n }", "get fieldValuesAsText() {\n return SPInstance(this, \"FieldValuesAsText\");\n }", "get listItemAllFields() {\n return SPInstance(this, \"listItemAllFields\");\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a widget that shows the information about a collection.
function CollectionInfoWidget(params) { if(params) { this.init(params); } }
[ "function Collection(collection, entryPoint) {\n this.collection = collection;\n\n this.detail = {\n type: 'collection',\n name: collection.name,\n id: collection.id,\n categoryId: collection.categoryId,\n query: collection.query,\n icon: collection.icon,\n pinned: collectio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
translate size to radius
function size_to_radius(size){ switch (size) { case "small": return 2; break; case "normal": return 5; break; case "large": return 10; break; case "huge": return 20; break; default: break; } }
[ "function radius(e)\n{\n return 4*Math.sqrt(e.size);\n}", "function squareAreaToCircle(size){\n return +(Math.PI * size / 4).toFixed(8);\n}", "updateRadius(newRadius) {\r\n this.r = newRadius;\r\n }", "function updateRadius(rad){\n circle.setRadius(rad);\n}", "function resizeCircles(rainL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Segment addr according to cache config
segment(addr) { return { offset: addr & (this.blockSize - 1), idx: (addr >> this.offsetLen) & (this.setNum - 1), tag: addr >> (this.offsetLen + this.idxLen) } }
[ "inCache(addr) {\n console.assert(0 <= addr.idx && addr.idx < this.setNum, \"Illegal index: \" + addr.idx);\n\n var entries = this.sets[addr.idx];\n for(var i = 0; i < entries.length; i++) {\n if(addr.tag == entries[i].tag && entries[i].valid) {\n return i;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
renders the view results button to the page
function renderResultsButton() { btn.innerHTML = 'View Results'; document.body.appendChild(btn); }
[ "function renderResults() {\n resultsSection.innerHTML = '<button id=\"view-results\">View Results</button>';\n let viewResults = document.getElementById('view-results');\n viewResults.addEventListener('click', function() {\n makeChart();\n resultsSection.innerHTML = '';\n let h2 = document.createElemen...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ADD SP, n 0xE8
ADDSPn() { let i = MMU.rb(regPC[0]); if (i > 0x7F) { i = -((~i + 1) & 0xFF); } regPC[0]++; regSP[0] += i; return 16; }
[ "stackPush(byte) {\n this.writeRam({ address: 0x0100 + this.cpu.sp, value: byte });\n this.decrementRegister('sp');\n }", "function generateConstantPUSH(memoryAddress) {\n return `\n@${memoryAddress}\nD=A\n@SP\nA=M\nM=D\n@SP\nM=M+1\n`;\n}", "function ld_SP_XX(xxIndex, tCycles) {\n CPU.tCycles +=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
funcion eliminar datos administradores
function siEliminarAdmin(datos) { var parametros = { "datos": datos, "tabla": "ADMINISTRADORES", "campo": "IdAdmin" }; eliminar(parametros); }
[ "function accionEliminar()\t{\n\t\tvar arr = new Array();\n\t\tarr = listado1.codSeleccionados();\n\t\teliminarFilas(arr,\"DTOEliminarMatricesDescuento\", mipgndo, 'resultadoOperacionMsgPersonalizado(datos)');\n\t}", "function siEliminarM(datos) {\n\tvar parametros = {\n\t\t\"datos\": datos,\n\t\t\"tabla\": \"MEN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generates the keys to check errors against
function generateErrKeys() { for (let i = 1; i < 5; i++) { fs.writeFile(`automated_testing/err_keys/err${i}.txt`, `error ${i}\n`, (err) => { if (err) throw err; }); } }
[ "function listErrors() {\n\treturn Object.keys(errorCodeMap);\n}", "nextControlErrorKey(name) {\r\n const control = this.get(name);\r\n if (control && control.errors) {\r\n // try client side keys first for correct order\r\n let error = this.registeredValidatorsMap[name] &&\r\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
takes in a user object and displays the modal for the user
showModal(user) { this.modalContainer.style.display = "inherit"; this.updateModalInfo(user); }
[ "function showUser(){\n\t\t\tdocument.getElementById('user-div').style.display = 'block';\n\t\t\tdocument.getElementById('user-btn').style.backgroundColor = 'white';\n\t\t\tdocument.getElementById('user-btn').style.color = 'black';\n\t\t\tdocument.getElementById('owner-div').style.display = 'none';\n\t\t\tdocument....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Raise a snackbar with the "error" colour.
function _error( message ) { _showSnackbar.bind( this, "error" )( message ); }
[ "function viewError(inputt,spann,error) {\r\n //setting variables\r\n var error_color=\"red\";\r\n var correct_color=\"green\";\r\n\r\n if (error != \"\") {\r\n $(spann).show();\r\n $(spann).text(error);\r\n $(spann).css(\"color\", error_color);\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Custom type guard for ObjectTypeDeclaration. Returns true if node is instance of ObjectTypeDeclaration. Returns false otherwise. Also returns false for super interfaces of ObjectTypeDeclaration.
function isObjectTypeDeclaration(node) { return node.kind() == "ObjectTypeDeclaration" && node.RAMLVersion() == "RAML10"; }
[ "function isObjectPattern(node) {\n return node.type === \"ObjectPattern\";\n}", "static isInstance(obj) {\n if (obj === undefined || obj === null) {\n return false;\n }\n return obj['__pulumiType'] === RelationshipLink.__pulumiType;\n }", "static isInstance(obj) {\n i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle a click on a checkbox container and relay the click to the checkbox it contains.
_handleCheckboxContainerClick(e) { const checkbox = dom(e.target).querySelector('input'); if (!checkbox) { return; } checkbox.click(); }
[ "function itemClick(event) {\n\n\n $(this).find(\"input[type=checkbox]\").click();\n\n updateCompletedBtn();\n updateCheckCount();\n\n // Don't bubble up the event to the enclosing <li> element ?? Ask Willis\n event.stopPropagation();\n}", "function handleItemCheckClicked() {\n $('.js-shopping-lis...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove one single hint element from the page Useful when you want to destroy the element and add them again (e.g. a modal or popup) Use removeHints if you want to remove all elements.
function removeHint(stepId) { var hint = hintQuerySelectorAll(".introjs-hint[data-step=\"".concat(stepId, "\"]"))[0]; if (hint) { hint.parentNode.removeChild(hint); } }
[ "function removeKnCellHint(){\n\t$(\"[kn-cell-hint]\").remove();\n}", "function destroyHintbox(graph) {\n\t\tvar data = graph.data('options'),\n\t\t\thbox = graph.data('hintbox') || null;\n\n\t\tif (hbox !== null && data.isHintBoxFrozen === false) {\n\t\t\tgraph.off('mouseup', makeHintboxStatic);\n\t\t\tgraph.rem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Recursive function that assign levels to each node
assignLevel(node, level) { node.level = level; if (level+1 > this.depth) { this.depth++; } for (let i = 0; i < node.children.length; i++) { this.assignLevel(node.children[i], level+1); } }
[ "assignLevel(node, level) {\n node.level = level;\n for (let n of node.children) {\n this.assignLevel(n, level+1);\n }\n }", "function showLevels() {\n nodes.forEach(node => {\n node.color = Colorlvl[node.lvl - 1];\n });\n recharge();\n}", "function createTre...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a menu item using its ID
static getMenuItem(id) { return menuItemById[id]; }
[ "function DDLightbarMenu_GetItem(pItemIndex)\n{\n\tif ((pItemIndex < 0) || (pItemIndex >= this.items.length))\n\t\treturn null;\n\treturn this.items[pItemIndex];\n}", "getById(id) {\n return NavigationNode(this).concat(`(${id})`);\n }", "function getItemInfo(id) {\n if (id in item)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
deep clone with each reference duplicated exactly once excepting global reference.
function deepClone(o, visited){ if(!visited){ visited = []; } var newitem = clone(o); for(var key in newitem){ var child = newitem[key]; if($.inArray(child, visited) || child === getGlobal()){ //try to prevent circular or runaway continue; //skip this value } visited.push(child); newitem[k...
[ "cloneObjects() {\n\t return map(this.objects, object => object.clone());\n\t }", "function deepClone(el) {\r\n var clone = el.cloneNode(true);\r\n copyStyle(el, clone);\r\n var vSrcElements = el.getElementsByTagName(\"*\");\r\n var vDstElements = clone.getElementsByTagName(\"*\");\r\n for (var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function is used for all the foreignkey columns presented in the annotation form, but the only purpose of this is to actually return a function for just the annotated term (anatomy). This will disable the rows that already exist in the database. The displayed table (in the popup) is the annotated table, and we wan...
function getAnnotatedTermDisabledTuples (columnModel) { if (columnModel.column.name !== annotConfig.annotated_term_visible_column_name) { return null; } return function (tableModel, page, requestCauses, reloadStartTime) { var defer = $q.defer(); ...
[ "checkFormulaImageFields() {\n if (this.formulaImageFields) {\n this.columns.forEach((col) => {\n if (this.formulaImageFields.indexOf(col.fieldName) !== -1) {\n col.type = 'image';\n }\n });\n }\n }", "function filter_attribut...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function takes a session token buffer and unpacks its values to extract the most significant and least significant bits
function getSessionFromTokenBuffer(sessionTokenBuffer) { const unpackedValues = msgpack.unpackMultiple(sessionTokenBuffer); const [mostSignificantBits, leastSignificantBits] = unpackedValues; return uuidFrom(mostSignificantBits, leastSignificantBits); }
[ "function encodeIntoByteBuffer(buffer) {\n var self = this;\n var initialPosition = buffer.position;\n buffer.putInt32(encodingCookie);\n buffer.putInt32(0); // Placeholder for payload length in bytes.\n buffer.putInt32(1);\n buffer.putInt32(self.numberOfSignificantValueDigits);\n buffer.putInt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PRIVATE dispatch an event with arguments
_dispatch(event, ...args) { const handlers = this._handlers && this._handlers[event]; if (!handlers) return; handlers.forEach(func => { func.call(null, ...args); }); }
[ "emit(event, args){\n\n if(this.listeners.has(event)){\n\n Logger.info(`Broadcasting: #${event}, Data:`, args);\n\n this.listeners.get(event).forEach((listener) => {\n listener.callback.call(listener.component, args);\n });\n\n }\n\n if(event !== ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is the third method used for retrieving the next meetup. It uses Node 8's async and await syntax.
async function getNextMeetupV3() { const meetingCache = cache.get('nextMeeting'); if (meetingCache) { return meetingCache[0]; } else { const response = await fetch('https://api.meetup.com/2/events?&sign=true&group_id=10250862&page=20&key=' + process.env.meetupapi_key); const json = a...
[ "async function getNextMeetupV4() {\n return nextmeeting[0];\n}", "function getNextMeetupV2() {\n return new Promise((resolve, reject) => {\n const meetingCache = cache.get('nextMeeting');\n if (meetingCache) {\n resolve(meetingCache[0]);\n } else {\n fetch('https:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
does this server think it's in a voice channel
inChannel() { return this.current_voice_channel_id != null; }
[ "setVoiceChannel(channel_id) {\n var server = this;\n server.current_voice_channel_id = channel_id;\n server.save();\n server.world.setPresence();\n }", "function getVoiceChannel() {\n // @todo: get the actual voice channel, CurryBot may have been moved?\n return voiceChannel;\n}", "isAudioTr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test for a predefined set of fonts
function getFontsList() { var fontList = []; var testFont = function(font) { if (fontDetector.test(font)) { fontList.push(font); } } testFont('a charming font'); testFont('abadi mt condensed'); testFont('abadi mt condensed extra bold'); testFont('abadi mt condensed light'); testFont('academy...
[ "function detectFontChange(_options) {\n var options = {}; // option processing\n\n Object.keys(_options).concat(Object.keys(DEFAULTS)).forEach(function (key) {\n options[key] = _options[key] != null ? _options[key] : DEFAULTS[key];\n });\n var multipleFonts = options.font.split(',');\n\n if (multipleFonts....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates Technical Task object based on corresponding input values.
function createTechnicalTask() { var tasks, technicalTask, operations, requestsForDevelopers, operation, devRequest, tableRow; tasks = $("#tasks"); operations = []; technicalTask = { name: $("#technicalTaskName").val(), description: $("#technicalTaskDescription").val(), status: ...
[ "createTasks() {\n let jobProfile = null; // \"arwen_express\" or \"arwen_cpu\" for example\n let management = {\n 'jobManager': this.jobManager,\n 'jobProfile': jobProfile\n };\n return this.nodes.map((n) => {\n return new taskModules[n.tagtask](manageme...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loop thru earned income array to see if item already exists, if so add work hours and income amount.
function updateEarnedIncome(targetArray, sourceItem) { for (var i in targetArray) { //If same income type if (String(targetArray[i].IncomeTypeCode) == String(sourceItem.IncomeTypeCode)) { updateAddWorkHours(targetArray[i], sourceItem.IncomeFrequencyCode, targetArray[i].IncomeWorkHoursNumber, sourceItem....
[ "function updateUnEarnedIncome(targetArray, sourceItem) {\n for (var i in targetArray) {\n if (String(targetArray[i].IncomeTypeCode) == String(sourceItem.IncomeTypeCode)) {\n updateAddIncome(targetArray[i], sourceItem.IncomeFrequencyCode, targetArray[i].IncomeAmount, sourceItem.IncomeAmount);\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
p function Description: Checks that line is valid premise declaration, meaning the premise listed is the same as the line number and the citation box is empty. Parameters: integer 115 (line number) Returns: boolean (if line is valid premise declaration or not)
function p(lineNumber){ var premises = document.getElementById('prem'+lineNumber).value; var citation = document.getElementById('cite'+lineNumber).value; if (premises.trim() != lineNumber.toString() || citation.trim() != ""){ return false; } else { return true; } }
[ "function ruleOne(lineNumber){\n var currentLine = document.getElementById('line'+lineNumber).value.trim();\n if (currentLine != \"(UQx)(x=x)\"){\n return false;\n }\n var citation = document.getElementById('cite'+lineNumber).value.trim();\n if (citation != \"\"){\n return false;\n }\n var premises = d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a random password of length "len". Password requirements: Contains "len" characters Contains only alphanumeric characters
function randomPassword(len){ }
[ "function randomPassword(passwordLength){\noutputPassword=''\nfor (i=0;i<passwordLength;i++)\noutputPassword+=randomCharacters.charAt(Math.floor(Math.random()*randomCharacters.length))\n\nif (i < 8 || i > 128){\n alert(\"*ERROR* Your password must be between 8 to 128 characters long\");\n}\nelse {\nreturn output...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hidding and showing the DIV element, hidding and showing canvas
function showingHiddingCanvas(mode){ let x = document.getElementById("display-mode"); x.style.display = mode; }
[ "showContent () {\n this.loadingWrapper.style.display = 'none'\n this.canvas.style.display = 'block'\n }", "show() {\n\t\tthis.element.style.visibility = '';\n\t}", "function showHideTLeditPanel(){\n if(trafficLightControl.isActive){ // close panel\n trafficLightControl.isActive=false; //don't redraw...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete an organization's routing settings
deleteRoutingSettings() { return this.apiClient.callApi( '/api/v2/routing/settings', 'DELETE', { }, { }, { }, { }, null, ['PureCloud OAuth'], ['application/json'], ['application/json'] ); }
[ "function clearRoute(){\n\t\t\troutingGroup.removeAll();\n\t}", "async function getGroupSettings() {\n const groupId = \"root\";\n const credential = new DefaultAzureCredential();\n const client = new ManagementGroupsAPI(credential);\n const result = await client.hierarchySettingsOperations.delete(groupId);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selection changed event Callback in the 3D viewer
function selectionChangedEventCB(event) { var dbIdArray = event.dbIdArray; if (dbIdArray.length == 0) { UpdateCommandLine("Selection changed event : No selection "); return; } for (i = 0; i < dbIdArray.length; i++) { var dbId = dbIdArray[i]; var node = viewer...
[ "onSelectionEdited(func){ return this.eventSelectionEdited.register(func); }", "selectionSetDidChange() {}", "function initSelection() {\n canvas.on({\n \"selection:created\": function __listenersSelectionCreated() {\n global.console.log(\"**** selection:created\");\n setActiveObject();\n too...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
============================= ENDS HERE ============================= / =================== COMPONENTS VISIBILITY =================== Function to set components visibility in application. The order you set the parameters metters args : receive several componentScreen objects and their properties!
function setComponentsVisibility(){ var argLength_nrb = arguments.length; var component_obj; for (var i = 0; i < argLength_nrb; i++){ component_obj = arguments[i]; /*arguments is a BottomComponentScreen object*/ componentsVisibility(component_obj); } }
[ "function setPanelVisibility() {\n var isMobileScreen = app.sceneView.widthBreakpoint === \"xsmall\" || app.sceneView.widthBreakpoint === \"small\",\n isDockedVisible = app.sceneView.popup.visible && app.sceneView.popup.currentDockPosition,\n isDockedBottom = app.sceneView.popup.currentDock...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Consturct the default value for versionCode as PATCH + MINOR 100 + MAJOR 10000 see
function default_versionCode(version) { var nums = version.split('-')[0].split('.'); var versionCode = 0; if (+nums[0]) { versionCode += +nums[0] * 10000; } if (+nums[1]) { versionCode += +nums[1] * 100; } if (+nums[2]) { versionCode += +nums[2]; } events.emi...
[ "get serverVersion() {\n\t\tif (!this._devMode) console.log(\"Implement to override the default server version of 10.1\");\n\t\treturn 10.1;\n\t}", "function getVersion() {\n var contents = grunt.file.read(\"formulate.meta/Constants.cs\");\n var versionRegex = new RegExp(\"Version = \\\"([0-9.]+)\\\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Food Facts Container Stuff
function createFoodFactsContainer() { $("#food-facts").remove(); $("body").append('<div class="container-fluid background-1" id="food-facts"></div>'); }
[ "function foodFactory(localFood, apiFood) {\n return `\n <div class=\"Item\">\n <h2>${localFood.name}</h2>\n <h3>${localFood.ethnicity}</h3>\n <p>${localFood.category}</p>\n <p>Country: ${apiFood.product.countries}</p>\n <p>Calories: ${apiFood.product.nutriments.energy_servi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Evaluates whether the lower range is empty
static evalLowerRangeIsEmpty(dict) { return libVal.evalIsEmpty(dict.LowerRange); }
[ "static evalUpperRangeIsEmpty(dict) {\n return libVal.evalIsEmpty(dict.UpperRange);\n }", "isFull() {\r\n\t\treturn (this.emptyCells.size() == 0);\r\n\t}", "static evalIsLowerRange(dict) {\n return dict.IsLowerRange === 'X';\n }", "isEmpty() {\n // the heap has a mark in the top of ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loop over provided script tags and get the content, via innerHTML if an inline script, or by using XHR. Transforms are applied if needed. The scripts are executed in the order they are found on the page.
function loadScripts(transformFn, scripts) { var result = []; var count = scripts.length; function check() { var script, i; for (i = 0; i < count; i++) { script = result[i]; if (script.loaded && !script.executed) { script.executed = true; run(transformFn, script); ...
[ "function getScripts() {\n\t\tvar result = [];\n\t\tvar scripts = targetWindow.document.scripts;\n\t\tforEach(scripts, function(script) {\n\t\t\tif (script.src) {\n\t\t\t\tresult.push({\n\t\t\t\t\ttype: script.type,\n\t\t\t\t\tsrc: script.src,\n\t\t\t\t\tasync: script.async,\n\t\t\t\t\tdefer: script.defer\n\t\t\t\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
form for uploading a parent expression file and any children
function ExpressionUploadForm({ formState, serverState, addNewFile, updateFile, saveFile, deleteFile, isAnnDataExperience }) { const fragmentType = isAnnDataExperience ? 'expression' : null const processedParentFiles = matchingFormFiles( formState.files, processedFileFilter, isAnnDataExperience, f...
[ "function setupUploadChain (selector) {\n if ($.type(selector) === \"string\") {\n\n // CHECK IF UPLOADS ALREADY EXIST:\n // It is possible to arrive at this point in execution after the user has submitted a\n // form containing errors that also already contains transcripts...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show Orks CLAN stratagems
function showOrksClanStratagems() { // Orks CLAN name/value var orks_clan = orksClanName(); // Select all Orks CLANs stratagems var all_orks_clan_spc_strt = orksAllSpecificClansStratagems(); // Select all Orks stratagems var all_orks_stratagems = orksAllStratagems(); // Select specific CLAN s...
[ "function orksSpecificClansStratagems() {\r\n var orks_clan_name = orksClanName();\r\n return document.getElementById('orks').getElementsByClassName('orks-' + orks_clan_name + '-stratagem');\r\n}", "function show_grocery_store_chains() {\n\tmarkers_site[S_GROCERY_STORE_CHAINS] = show_place_markers_1(14 , 8 , da...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses and returns info about the call stack at the given index.
function getStackInfo(stackIndex) { // get call stack, and analyze it // get all file, method, and line numbers var stacklist = new Error().stack.split('\n').slice(3) // stack trace format: // http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi // do not remove the regex expresses to outside of this m...
[ "function traceCaller(n) {\n\t\tif (isNaN(n) || n < 0) n = 1;\n\t\tn += 1;\n\t\tlet s = (new Error()).stack\n\t\t\t\t, a = s.indexOf('\\n', 5);\n\t\twhile (n--) {\n\t\t\ta = s.indexOf('\\n', a + 1);\n\t\t\tif (a < 0) {\n\t\t\t\ta = s.lastIndexOf('\\n', s.length);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tlet b = s.index...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
There is no event to tell us a specific subframe has been removed from the main document. The code below will remove subframes which are no longer present in the root document. Removing obsolete subframes is not a critical task, so this is executed just once on a while, to avoid bloated dictionary of subframes. A TTL i...
async pruneFrames() { let entries; try { entries = await webext.webNavigation.getAllFrames({ tabId: this.tabId }); } catch(ex) { } if ( Array.isArray(entries) === false ) { return; } const toKeep = new Set(); for ( const { f...
[ "unbindEvents() {\n const document = this.frame.contentWindow.document;\n if (this.arrayOfEvents !== undefined && Array.isArray(this.arrayOfEvents)) {\n this.arrayOfEvents.forEach((event) => {\n document.removeEventListener(event[0], event[1]);\n });\n }\n }", "_cleanupFrame() {\n //...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Finds an object by example
findByExample(example){ var message = { cn: 'com.percero.agents.sync.vo.FindByExampleRequest', theObject: example }; return this._sendMessage('findByExample', message, this._getShortClassName(example.cn)); }
[ "find(type, group, instance) {\n\t\tif (Array.isArray(type)) {\n\t\t\t[type, group, instance] = type;\n\t\t} else if (typeof type === 'object') {\n\t\t\t({type, group, instance} = type);\n\t\t}\n\t\tlet query = {\n\t\t\ttype,\n\t\t\tgroup,\n\t\t\tinstance,\n\t\t};\n\n\t\tlet index = bsearch.eq(this.records, query, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
requestsPerService() runs a query to get requests from a consumer (authenticated_entity) on table requests grouping it by service then it calls a helper function to generate a csv with the query data
async function requestsPerService() { const queryString = `SELECT fk_service_id AS service, COUNT (fk_service_id) FROM requests GROUP BY fk_service_id`; await db.query(queryString, (err, res) => { if (err) { throw err; } else { ...
[ "function requestsPerConsumer() {\n const queryString = `SELECT fk_consumer_authenticated_entity AS consumer,\n COUNT (fk_consumer_authenticated_entity)\n FROM requests\n GROUP BY fk_consumer_authenticated_entity`;\n db.query(queryString, (err, res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
hrHR validation function (Osobni identifikacijski broj (OIB), persons/entities) Verify TIN validity by calling iso7064Check(digits)
function hrHrCheck(tin) { return algorithms.iso7064Check(tin); }
[ "function validar_RUC_2(ruc) {\n //Valida dimension\n if (ruc.length != 13) {\n return 0;\n } else {\n let dos_primeros_digitos = parseInt(ruc.slice(0, 2));\n //Valida dos primeros digitos\n if (dos_primeros_digitos < 1 && dos_primeros_digitos > 22) {\n return 0;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get client node from socket
function getClientSocketNode(socket){ var remoteAddr = socket.remoteAddress; var remotePort = socket.remotePort; var node = sockets[remoteAddr+':'+remotePort]; return node; }
[ "getClient_sock_at(socket_id){\n \tif (this.nodes.has(socket_id))\n \t\treturn this.nodes.get(socket_id).socket;\n \tconsole.warn(\"Error:getClient_sock_at\");\n }", "function getSocketById(id){\n var count = openSockets.length;\n var socket = null;\n for(var i=0;i<count;i++){\n \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
exported ValidationContext / global ValidationResult The validation context carries information about the current validation, as well as the validation result. It is meant to be used for a single validation.
function ValidationContext() { /** * The name of the constraint being validated, it may be useful for debugging and for the validator. * @member {string} */ this.constraintName = null; /** * A map from the model path to the results of validation for that path. * It contains all paths that have been validat...
[ "validate({ target: object, validationResult: validationResult }) {\n if( validationResult === undefined ) {\n validationResult = ValidationResult.new()\n }\n\n this.assertionExpression.validate({\n target: object,\n validationResult: validationResult,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reducer that takes a Game and an Action and returns a new Game. Action must be one of: FRAME_READY | CONTROLS_CHANGED | COIN_INSERTED
function updateGame(game, action) { if (typeof game === 'undefined') return makeGame(); if (action.type === 'FRAME_READY') { if (game.get("mode") === 'GAME_ON') { var player = updatePlayer(game.get("player"), { 'type': 'STEP' }); var boulders = game.get("boulders").map(function...
[ "function updateInputContext(inputContext, action) {\n if (typeof inputContext === 'undefined') return makeInputContext();\n\n var game = inputContext.get(\"game\");\n\n if (action.type === 'FRAME_READY') {\n var leftPressed = inputContext.get(\"leftPressed\");\n var rightPressed = inputConte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Hide Progress Status and empty status texts
function HideProgressStatus(should_hide) { var progress_bar = GetProgressBar(); var div_progress = GetDivProgress(); if (div_progress && progress_bar) { if (should_hide == true) { div_progress.style.visibility = "hidden"; div_progress.style.zIndex = "-999"; ...
[ "clearStatusMessages() {\n const status_div = document.querySelector('.form-options-widget .status');\n status_div.innerHTML = '';\n }", "function hideProcessing(){\n vm.processing = false;\n }", "function hideStatusBarDevelopmentOnly () {\n _el.style.display = 'none'\n }"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Will return the 64 bit value as returned in an array from rsint64 / ruint64 to a value as close as it can. Note that Javascript stores all numbers as a double and the mantissa only has 52 bits. Thus this version may approximate the value. valAn array of two 32bit integers
function toApprox64(val) { if (val === undefined) throw (new Error('missing required arg: value')); if (!Array.isArray(val)) throw (new Error('value must be an array')); if (val.length != 2) throw (new Error('value must be an array of length 2')); return (Math.pow(2, 32) * val[0] + val[1]); }
[ "static uint64(v) { return n(v, 64); }", "static int64(v) { return n(v, -64); }", "function read64() {\n var bytes = readBytes(_leb.MAX_NUMBER_OF_BYTE_U64);\n var buffer = Buffer.from(bytes);\n return (0, _leb.decodeInt64)(buffer);\n }", "function divmodInt64(src) {\n var hi32 = Math.floor(src / ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
check whether thumb is exists and count is equals to photo's count if not, reproduce all thumbs in album
function checkThumb() { console.log('--checking for thumb...'); let albumList; try { albumList = db.getData('/albumList'); } catch (err) { return; } let promises = []; albumList.forEach((albumInfo) => { let albumPath = path.resolve(paths.albumsFolder, albumInfo.id); let thumbFolderPath = path.resolve(al...
[ "function checkPhotos() {\n\tconsole.log('--checking for photos...');\n\tlet albumList;\n\ttry {\n\t\talbumList = db.getData('/albumList'); // todo, get albumList from real folder\n\t} catch (err) {\n\t\treturn;\n\t}\n\n\talbumList.forEach((albumInfo, albumIndex) => {\n\t\tlet albumPath = path.resolve(paths.albumsF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Resolve the type for the variable in `templateElement` by finding the structural directive which has the context member. Returns any when not found.
function getVariableTypeFromDirectiveContext(value, query, templateElement) { for (const { directive } of templateElement.directives) { const context = query.getTemplateContext(directive.type.reference); if (context) { const member = context.get(value); if (member && member.t...
[ "function refinedVariableType(value, mergedTable, query, templateElement) {\n if (value === '$implicit') {\n // Special case the ngFor directive\n const ngForDirective = templateElement.directives.find(d => {\n const name = compiler_1.identifierName(d.directive.type);\n return...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a WAV audio file from a Flipnote's master audio track
static fromFlipnote(note) { const sampleRate = note.sampleRate; const wav = new WavAudio(sampleRate, 1, 16); const pcm = note.getAudioMasterPcm(sampleRate); wav.writeSamples(pcm); return wav; }
[ "static fromFlipnoteTrack(flipnote, trackId) {\r\n const sampleRate = flipnote.sampleRate;\r\n const wav = new WavAudio(sampleRate, 1, 16);\r\n const pcm = flipnote.getAudioTrackPcm(trackId, sampleRate);\r\n wav.writeSamples(pcm);\r\n return wav;\r\n }", "getAudio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if socket connection should be opened or closed
function checkSocketStatus() { if (ports.list().length) { globalSettings.get(function(options) { socket.setup(options).connect(handshakeInfo); }); } else { socket.disconnect(); } }
[ "function isActive() {\n return socket && socket.readyState == WebSocket.OPEN;\n }", "expectConnection() {\n if (!this._isClosed && !this._udpConnected) {\n // connection timed out\n this.killConnection(new Error(\"The connection timed out\"));\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: dwscripts.canApplySB DESCRIPTION: Does some basic checks to see if the selected range is correct for the current server behavior. Displays alert messages if problems are found. ARGUMENTS: sbObject ServerBehavior object (optional) the SB instance, if we are checking an existing SB. preventNesting boolean (opti...
function dwscripts_canApplySB(sbObject, preventNesting, selectionNotRequired) { var retVal = true; var sbFileName = dwscripts.getSBFileName(); var groupName = dwscripts.getUniqueSBGroupName(null, sbFileName); var selectionIsRequired = !selectionNotRequired; // declared for easier readability below // if we ...
[ "function canApplyServerBehavior(sbObj)\r\n{\r\n var success = true;\r\n if (success)\r\n {\r\n success = _input_type_text__tag.canApplyServerBehavior(sbObj);\r\n }\r\n if (success)\r\n {\r\n success = _expression1.canApplyServerBehavior(sbObj);\r\n }\r\n if (success)\r\n {\r\n success = dwscripts...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Internal `_.pick` helper function to determine whether `key` is an enumerable property name of `obj`.
function keyInObj(value, key, obj) { return key in obj; }
[ "function isObjectAssignable(key) {\n return typeof key === 'string' || typeof key === 'number' || typeof key === 'symbol';\n}", "function hasProps(keys, x) {\n if(!isFoldable(keys)) {\n throw new TypeError(err)\n }\n\n if(isNil(x)) {\n return false\n }\n\n var result = keys.reduce(\n every(hasKe...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When we get a signal, spawn the objectToSpawn and store the spawned object. Also enable this behaviour so the Update function will be run.
function OnSignal () { /* if (audio && explosionSound) { audio.clip = explosionSound; audio.Play (); } */ screenPosition = Camera.main.WorldToScreenPoint(transform.parent.position); screenPosition.y = Screen.height - screenPosition.y; AudioSource.PlayClipAtPoint(explosionSound, transform.position); spaw...
[ "function SetSpawn()\n{\nDebug.Log(\"LEAVE SETSPAWN FUNCTION ALONE WE SLEEPING KAY!\");\n\ttempX = boardPosition.X;\n\ttempZ = boardPosition.Y;\n\t\n\ttarget = new Point(tempX, tempZ);\n \tif(ProgramGUI.setNewSpawnPoint)\n \t{\n \tDebug.Log(\"X:\" + newSpawnPointX + \"\\nY:\" + newSpawnPointY + \"\\nRotation:\" ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
endregion region processInvitation Handles an incoming 1:1 messaging invitation: reads the embedded message and adds it to the collection, enables the accept/reject commands and so on. This method can be invoked multiple times in the conversation merging scenario.
function processInvitation() { // if another tab starts a conversation, all other tabs get the // outgoing invitation event (with no message link); and they // do not need to process the toast message (toast message will ...
[ "function processInvitation(r) {\n rInvitation = r;\n isIncoming = rInvitation.get('direction') == 'Incoming';\n setResource(ucwa.get(rInvitation.link('conversation').href));\n threadId.set(rInvitation.get('t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a CSS percentage value to a decimal. Ex: toDecimal("30%"); // > 0.3
function toDecimal(pctString) { var match = pctString.match(/^(\d+)%?$/i); if (!match) return null; return (Number(match[1]) / 100); }
[ "function convertToDecimal(perc) {\n\treturn perc.map(x => parseFloat(x) / 100);\n}", "function getPercentage(str) {\n return parseFloat((str / max_cgMLST_count) * 100).toFixed(2);\n }", "getPercentage(bookmark) {\n var cco = bookmark.currentChapterOrder;\n var tc = this.props.book.totalChapter;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clamps `range` to `within`, so that if the result range is within `within`. Returns `null` if range is entirely outside.
function clampTimeRange(range, within) { if (within) { if (range.overlaps(within)) { var start = range.start < within.start ? range.start > within.end ? within.end : within.start : range.start; var end = range.end > within.end ? range.end < within.start ? ...
[ "function keepWithin(value, min, max) {\n if (value < min) value = min;\n if (value > max) value = max;\n return value;\n }", "function keepInRange(lower, upper, value) {\r\n if(value < lower){\r\n return lower;\r\n }\r\n else if (value > upper){\r\n return upper;\r\n }\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
jQuery load Setup screen size and init Raphael
function load() { var $b = $('.background-edit'); pW = $b.width(); pH = $b.height(); var offset = $b.offset(); pX = offset.left; pY = offset.top; Raphael('design', pW, pH, preDraw); }
[ "function init() {\n paper = Raphael(\"klotski\", config.get(\"WIDTH\"), config.get(\"HEIGHT\") + 10);\n paper.rect(0, 0, config.get(\"WIDTH\"), config.get(\"HEIGHT\"), 5).attr({fill: \"#330e04\"});\n paper.rect(config.get(\"CELL_SIZE\"), config.get(\"HEIGHT\"), config.get(\"CELL_SIZE\") * 2, 10, 5).attr({...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Feed in an argument that shows where the position of the barrier is going to be
function createBarrier(event) { var x = event.x; var y = event.y; var canvas = document.getElementById("canvas"); x -= canvas.offsetLeft; x += window.scrollX; y -= canvas.offsetTop; y += window.scrollY; console.log("x:" + x + " y:" + y); game.createNewBarrier(ctx, x, y) }
[ "function cannonInBarrier(cannonBall){\n for(let i = 0; i < barriers.length; i++){\n let barrier = barriers[i];\n\n //Work out barrier edges\n let leftEdge = stageX + (barrier.x * stageDivPathWidth);\n let width = (stageDivPathWidth ) * barrier.length;\n let topEdge = stageY + ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }