query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Reverses a `tf.Tensor2D` along a specified axis.
function reverse2d_(x, axis) { var $x = tensor_util_env_1.convertToTensor(x, 'x', 'reverse'); util.assert($x.rank === 2, function () { return "Error in reverse2D: x must be rank 2 but got rank " + $x.rank + "."; }); return exports.reverse($x, axis); }
[ "function reverse2d_(x, axis) {\n const $x = convertToTensor(x, 'x', 'reverse');\n assert($x.rank === 2, () => `Error in reverse2D: x must be rank 2 but got rank ${$x.rank}.`);\n return reverse($x, axis);\n}", "function reverse2d_(x, axis) {\n const $x = convertToTensor(x, 'x', 'reverse');\n util.a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removes all vertices from the given face. necessary when deleting a face which is necessary when the hull is going to be expanded
_removeAllVerticesFromFace( face ) { if ( face.outside !== null ) { // reference to the first and last vertex of this face const firstVertex = face.outside; firstVertex.face = null; let lastVertex = face.outside; while ( lastVertex.next !== null && lastVertex.next.face === face ) { lastVertex...
[ "deleteFaceVertices(face, absorbingFace) {\n const faceVertices = this.removeAllVerticesFromFace(face);\n if (faceVertices !== void 0) {\n if (absorbingFace === void 0) {\n this.unassigned.appendChain(faceVertices);\n } else {\n let vertex = faceVertices;\n do {\n const...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
uncommonNumberSuffixes() Get a list of uncommon number suffixes. These must be ordered accordingly: 0=>st ("1st"), 1=>nd ("2nd"), 2=>rd("3rd"). For example: 'st', 'nd', 'rd'.
function uncommonNumberSuffixes() { return [ 'st', // 1st 'nd', // 2nd 'rd', // 3rd ]; }
[ "function getIgnoreKeywords_allNumberPlaces_suffixes_uncommon() {\n\t\tvar uncommonsuffixes = uncommonNumberSuffixes();\n\t\t\n\t\tvar uncommonsuffixnumbers = [];\n\t\t\n\t\tfor(var i = 0; i < uncommonsuffixes.length; i++) {\n\t\t\tvar uncommonsuffix = uncommonsuffixes[i];\n\t\t\t\n\t\t\tuncommonsuffixnumbers = unc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When rows are rerendered, better redraw dependencies (might have been collapsed etc).
onRowsRerender() { this.scheduleDraw(true); }
[ "invalidate() {\n\t\tthis.updateRowCount();\n\t\tthis.invalidateAllRows();\n\t\tthis.render();\n\t}", "redraw () {\n this.dataTable.draw();\n }", "redraw() {\n this.itemSet && this.itemSet.markDirty({refreshItems: true});\n this._redraw();\n }", "function redraw() {\n columns.forEach(fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a sibling widget to the document manager.
addSibling(widget, options = {}) { const opener = this._opener; if (opener) { opener(widget, options); } return new DisposableDelegate(() => { widget.close(); }); }
[ "addSibling(widget, options = {}) {\n let opener = this._opener;\n if (opener) {\n opener(widget, options);\n }\n return new disposable_1.DisposableDelegate(() => {\n widget.close();\n });\n }", "addInsertSibling(data){\r\n return(\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update Vehicle Dash Driver & Road Images with Vehicle data
function vdDemo_modifyImgs(){ GLB.vehicle.modifyRoadImg(); GLB.vehicle.modifyDriverImg(); }
[ "function setVehicleDet() {\n\n enableVehicleUpdateBtns()\n\n const data = vehicleArr[vehicleIndex];\n\n $(\"#lblVehicleNumber\").html(data.vehicleNumber)\n $(\"#lblBrandName\").html(data.brandName)\n $(\"#lblType\").html(data.type)\n\n $(\"#lblTransmission\").html(data.transmission)\n $(\"#lbl...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
copy rotation style from theme element to mover
function setRotation() { vm.moverStyle['-ms-transform'] = vm.moverStyle['-webkit-transform'] = vm.moverStyle.transform = vm.themeStyle.transform; }
[ "getOverlayStyle() {\n return {\n transform: this.state.image.isFlipped ? 'rotateY(180deg)' : ''\n };\n }", "function rotate(){\n imageLogo.setAttribute('style','transform:rotate(360deg)');\n}", "function applyTransformation($window, $element) {\n var degrees = getBackgroundDegrees($window);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove classes from squares to prevent doubling
function resetClasses() { squares.forEach((square) => { square.className = '' square.classList.add('piece') }) document.getElementById('container').classList.remove('container-disabled') }
[ "function clearHighlights() {\r\n\tfor(var i = 0; i < squares.length; i++) {\r\n\t\tsquares[i].classList.remove(\"highlighted\")\r\n\t}\t\r\n}", "function removeAllKingCheck(){\r\n for(let i = 0; i<=63; i++)\r\n {\r\n allSquares[i].classList.remove(\"checkedByWhite\");\r\n allS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
WIN WALL GET win wall
getMiniWinWall() { return fetch(`${config.API_ENDPOINT}/win-wall/mini`) .then(res => (!res.ok) ? res.json().then(e => Promise.reject(e)) : res.json() ) }
[ "function loadCurrentWall() {\n\n (async () => {\n let url = await wallpaper.get();//URL of current Wallpaper\n console.log('URL :', url);\n let wall = url.substring(url.lastIndexOf('\\\\') + 1); //Stripping filename of current Wallpapers\n console.log('File :', wall);\n\n if (...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle Change access type
function toggleAccess (id) { const index = rooms.findIndex(room => room.roomid === id) if (index !== -1) { rooms[index].access === 0 ? (rooms[index].access = 1) : (rooms[index].access = 0) } }
[ "setAccessType(accessType) {\n this._accessType = accessType;\n }", "function _toggleAnnotationAccess( event )\n{\n\tevent = getEvent( event );\n\tstopPropagation( event );\n\n\tvar annotation = getNestedFieldValue( this, AN_ANNOTATION_FIELD );\n\tvar accessButton = getEventTarget( event );\n\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show invite from user
function Display_showInvite(_name) { // Create messagebox var divMessageBox = document.createElementNS(this.xhtmlns, "div"); divMessageBox.setAttribute("id", "divMessageBox"); // Message divMessageBox.appendChild(document.createTextNode("Accept Invitation From: " + _name)); // Add some spacing divMessageBox.a...
[ "function Display_showInviteUser(_name) {\n\tif(!this.inviteVisible) {\n\t\tthis.inviteVisible = true;\n\t\tvar displayContent = document.getElementById(\"displayContent\");\n\t\t// Create information box\n\t\tvar divInviteBox = document.createElementNS(this.xhtmlns, \"div\");\n\t\tdivInviteBox.setAttribute(\"id\",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
split the robot instructions into an array
submitInstructionsForm() { let robot_input = this.instructionsForm.find('textarea').val(); return robot_input.split('\n'); }
[ "getCMDs() {\n let cmds = [];\n for (let instruction of this.instructions) {\n if (instruction instanceof cmd_1.Cmd) {\n cmds.push(instruction);\n }\n }\n return cmds;\n }", "function ParseToCommandArray(codeString) {\n codeString = codeString...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Funcao para montar as opcoes de sistemas
function montarMenuSistemas (){ $('#ulMenuSistema li').remove(); AtribuicaoPermissao.ferramenta.length = 0; FerramentaAjax.buscarTodos(function(result){ var concat = ""; for(var i in result){ AtribuicaoPermissao.ferramenta.push(result[i]); if(i == 0){ concat += '<li class="ativo" id="'+result[i].id...
[ "function pegaSistemas()\n{\n\tcore_pegaDados($trad(\"msgBuscaSistema\",i3GEOadmin.sistemas.dicionario),\"../php/sistemas.php?funcao=pegaSistemas\",\"montaArvore\");\n}", "function manipuladores_por_dos_opciones(manipuladores, manipuladores_a_ordenar, opciones, posicion){\n var auxiliar = [];\n for ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================= MARKUP ================= CART quantity
function cartQuantityMarkup() { cartIconHeadingQuantity.classList.add('qt'); cartIconHeadingQuantity.textContent = quantity; cartIconMainQuantity.classList.add('qt'); cartIconMainQuantity.textContent = quantity; cartIconSidebar.classList.add('qt'); cartIconSidebar.textContent = quantity; }
[ "function theme_commerce_cart_line_item_quantity(variables) {\n try {\n var id = 'commerce_cart_line_item_quantity_' + variables.line_item.line_item_id;\n var attributes = {\n type: 'number',\n id: id,\n value: Math.floor(variables.line_item.quantity),\n line_item_id: variables.line_item....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Converts a stringbased level into a `SeverityLevel`, normalizing it along the way.
function severityLevelFromString(level) { return (level === 'warn' ? 'warning' : validSeverityLevels.includes(level) ? level : 'log') ; }
[ "function severityLevelFromString(level) {\n return (level === 'warn' ? 'warning' : validSeverityLevels.includes(level) ? level : 'log') ;\n }", "function parseSeverityFromString(s) {\n const validSeverities = Object.values(exports.SeverityLevel);\n const lowerSeverity = s?.toLowerCase();\n if (lower...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Render the log This replaces the log wholesale with the content of model.getItem('lines') rather than keeping track of which lines have and haven't been rendered.
renderLog() { const lines = this.model.getItem('lines'); if (!lines || lines.length === 0) { this.ui.setContent(LOG_PANEL, 'No log entries to show.'); return; } const panel = this.getLogPanel(); panel.innerHTML = t('ol')( ...
[ "renderLog() {\n const lines = this.model.getItem('lines');\n if (!lines || lines.length === 0) {\n this.ui.setContent(LOG_PANEL, p(this.messages.NO_ENTRIES));\n this.renderButtons();\n return;\n }\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
play a win sound on victory
function winSound (){ if (win==true){ let what= Math.floor(Math.random() * 3); var victory = new Howl({src:winSounds[what]}); victory.play(); } }
[ "function winSound() {\n if (win == true) {\n let what = Math.floor(Math.random() * 3);\n var victory = new Howl({ src: winSounds[what] });\n victory.play();\n }\n}", "function userWin() {\n winSound.play();\n updateDisplay(\"Win!\", true);\n}", "function playWinSound() {\r\n let winSound = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the date of the first and last day of the current quarter.
getCurrentQuarter (format) { try { format = format || 'yyyy-MM-dd'; let date = new Date(), curYear = date.getFullYear(), startMonth = getQuarterStartMonth(), lastMonth = startMonth+2, lastDate = new Date(); l...
[ "function getQuarterStartDate() {\n var currentDate = new Date();\n var quater = Math.floor((currentDate.getMonth()) / 3) + 1;\n var startDate;\n var fullYear = currentDate.getFullYear();\n switch (quater) {\n case 1:\n startDate = new Date(fullYear, 00, 01);\n break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Selects and returns the controlled element previous to the given element in document position order. See [Node.compareDocumentPosition](
selectPrevious(element) { const order = this.getOrdered(element); const i = order.indexOf(element); const previous = order[i - 1] || order[order.length - 1]; this.select(previous); return previous; }
[ "function previousElement(element) {\r\n\r\n var prev_element = element.previousSibling;\r\n \r\n while ((prev_element != null) && (prev_element.nodeType != element.nodeType))\r\n \r\n prev_element = prev_element.previousSibling;\r\n \r\n return prev_element;\r\n}", "function previousElem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Toggle meeting rooms booking modals
function initMeetingRoomModals() { $(document).on('click', '.js-mr-modal-open', function(e) { e.preventDefault(); const telEl = $('.js-mr-modal-tel'); const emailEl = $('.js-mr-modal-email'); const telText = $(this).data('tel') const emailText = $(this).data('email'); ...
[ "function bookingModal() {\n $('#js-bookingModal').toggleClass('is-open-js-bookingModal');\n $('html').toggleClass('bookingModalOverFlowHidden');\n }", "function detailMeeting(id)\n{\n $('#below_meeting_detail_'+id).toggle();\n}", "function setIsInMeeting(meetingStatus) {\n isInMeeting = meetingStatus...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
render the vote btn
_renderVoteBtn(candidate) { if (this.props.data.session) { // if logged if (!this.state.votedFor) { // if not voted yet return (<div> <button className="vote-btn" onClick={(e) => this._MakeVote(candidate)}> <span className="fa fa-thumbs-up"></span> </button> </d...
[ "render () {\n\t\treturn (\n\t\t\t<div className=\"votes\">\n\t\t\t\t<img className=\"button\" src=\"./icon_up.png\" alt=\"\" onClick={() => this.props.updateVotes(this.props.topic.id,1)}/>\n\t\t\t\t<br/>{this.props.topic.votes}<br/>\n\t\t\t\t<img className=\"button\" src=\"./icon_down.png\" alt=\"\" onClick={() =>...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function moves the tank
function moveTank(curPlayer, dir){ if(curPlayer.getmoves() != 0){ curPlayer.setpx(curPlayer.getpx()+dir); delta = Math.abs(terrainY[curPlayer.getpx()]-terrainY[curPlayer.getpx()+curPlayer.geti()]); if(delta>25){ curPlayer.setpx(curPlayer.getpx()-dir); curPlayer.tooste...
[ "function moveAlienTank()\n\t{\n\t\talienTank.position.x = 0;\n\t\talienTank.position.z = 5;\n\t\t\n\t\tif(alienTank.position.y > 100)\n\t\t{\n\t\t\tshipCycleUpward = false;\n\t\t}\n\t\telse if(alienTank.position.y < -100)\n\t\t{\n\t\t\tshipCycleUpward = true;\n\t\t}\n\t\tif(shipCycleUpward == true)\n\t\t{\n\t\t\ta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Name setHeater Purpose sets the state of the heater Description of inputs state for the heater to be in Description of return values There are none
function setHeater(state){ // execute('heaterWrite.sh', [state]) execFile('./scripts/heaterWrite.sh', [state], (error, stdout, stderr) => { if (error) { console.error('stderr', stderr); throw error; } console.log(stdout); }) }
[ "toggleToHeater(){\n this.setState({heater: true, displayText: \"HEATER KIT\"});\n }", "function setHumanState(hstate, helptext, fun) {\n if(humanStateBusy()) {\n throw new Error('should not set callback if one is already active');\n }\n humanstate = hstate;\n if(helptext) {\n setHelp(helptext);...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Called by listIncompleteUploads to fetch a batch of incomplete uploads.
listIncompleteUploadsQuery(bucketName, prefix, keyMarker, uploadIdMarker, delimiter) { if (!isValidBucketName(bucketName)) { throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName) } if (!isString(prefix)) { throw new TypeError('prefix should be of type "string"') } ...
[ "uploadAll() {\n const that = this;\n\n if (that.disabled || that._items.length === 0) {\n return;\n }\n\n for (let i = that._items.length - 1; i >= 0; i--) {\n if (!that._items[i].uploading) {\n that.uploadFile(that._items[i].index);\n }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set up the canvases
setupCanvases() { this.mainCanvas = document.getElementById('main-canvas'); this.strokeCanvas = document.getElementById('stroke-canvas'); this.mainCanvas.width = this.windowWidth; this.mainCanvas.height = this.windowHeight; this.canvas = []; for (let i = 0; i < this.images.length; i++) { ...
[ "function initCanvases() {\n\t//create appropriately named references to all of our canvases\n\tcnv = document.getElementById(\"cnv\");\n\tctx = cnv.getContext(\"2d\");\n\t\n\tuicnv = document.getElementById(\"uicnv\");\n\tuictx = uicnv.getContext(\"2d\");\n}", "function setUpCanvases() {\n\n physicsCanvas = n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This problem was asked by Facebook. Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. For example, the message '111' would give 3, since it could be decoded as 'aaa', 'ka', and 'ak'. You can assume that the messages are decodable. For example, '001' is not a...
function waysToDecode(encodedMessage) { return recursiveCount(0, encodedMessage) }
[ "function messageCountUcs2(message) {\n var chars = punycode.ucs2.decode(message);\n console.log(chars);\n\n return {\n characters: chars.length,\n pages: chars.length / 70 > 1 ? Math.ceil(chars.length / 67) : 1\n };\n }", "function findWordFrequencies(encrypted_msg) {\n /* Below is an exa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Call `methodName` on each item of the array passing custom arguments if needed.
function invoke(arr, methodName, var_args){ if (arr == null) { return arr; } var args = slice(arguments, 2); var i = -1, len = arr.length, value; while (++i < len) { value = arr[i]; value[methodName].apply(value, args); } ...
[ "function invoke(arr, methodName, var_args){\n if (arr == null) {\n return arr;\n }\n\n var args = slice(arguments, 2);\n var i = -1, len = arr.length, value;\n while (++i < len) {\n value = arr[i];\n value[methodName].apply(value, args);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
createNestedSelectorNames :: Object > String
function createNestedSelectorNames(rule) { const parentSelectors = getRawRules(rule.parent.selector); const nestedSelectors = getRawRules(rule.selector); const commaAndNewLine = ',\n'; let selectorName = ''; for (let i = 0; i < parentSelectors.length; i += 1) { for (let j = 0; j < nestedSelectors.length;...
[ "function makeNestedSelectorNames(rule) {\n const parentSelectors = getRawRules(rule.parent.selector);\n const nestedSelectors = getRawRules(rule.selector);\n\n let selectorName = '';\n for (let i = 0; i < parentSelectors.length; i += 1) {\n for (let j = 0; j < nestedSelectors.length; j += 1) {\n select...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PRIVATE: display the given elements and append to the main container
function _displayElements(elementsArr) { const elementsContainer = document.createElement("div"); elementsContainer.classList.add("elements-container"); elementsArr.forEach((el) => { elementsContainer.appendChild(el); }); _mixGalContainer.appen...
[ "appendElements() {\n this.appendChild(this.container)\n }", "buildContainerElements(list, tags) {\n this.displayList = [...list];\n\n // create the containers for the filter buttons and the project list\n let containers = \"\";\n containers += '<div id=\"' + this.htmlIds.filters + '\"></div...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Main function Fetch HTML nodes in homepage scrap content from sublinks build an array and save it as JSON to a file
function run(){ fetchContent(root_url + home_suffix) .then((html) => parseHomeContent(html)) // Process sublinks .then( links => { // Build list of Promise to run sequentially var promises = links.reduce((promiseChain, link) => { return promiseChain ....
[ "async function grabAllLink(page, link) {\n // Storing the JSON format data in myObject\n var data = fs.readFileSync(\"data.json\");\n var myObject = JSON.parse(data);\n\n // fetch all Href on page\n const hrefs = await page.$$eval(\"a\", (list) => list.map((elm) => elm.href));\n console.log(hrefs);\n myObje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper to manage componentRef resolution. Internally appends logic to lifetime methods to resolve componentRef to the passed in object. Usage: call initializeComponentRef(this) in the constructor,
function initializeComponentRef(obj) { Object(_extendComponent__WEBPACK_IMPORTED_MODULE_0__["extendComponent"])(obj, { componentDidMount: _onMount, componentDidUpdate: _onUpdate, componentWillUnmount: _onUnmount }); }
[ "function initializeComponentRef(obj) {\n Object(__WEBPACK_IMPORTED_MODULE_0__extendComponent__[\"a\" /* extendComponent */])(obj, {\n componentDidMount: _onMount,\n componentDidUpdate: _onUpdate,\n componentWillUnmount: _onUnmount\n });\n}", "function initRefs() {\n this.$refs = {};...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
isIntegerInRange (STRING s, INTEGER a, INTEGER b [, BOOLEAN emptyOK]) isIntegerInRange returns true if string s is an integer within the range of integer arguments a and b, inclusive. For explanation of optional argument emptyOK, see comments of function isInteger.
function isIntegerInRange (s, a, b) { if (isEmpty(s)) if (isIntegerInRange.arguments.length == 1) return defaultEmptyOK; else return (isIntegerInRange.arguments[1] == true); // Catch non-integer strings to avoid creating a NaN below, // which isn't available on JavaScript 1.0 for Windows....
[ "function isIntegerInRange(s, a, b) {\r\n if (isEmpty(s))\r\n if (isIntegerInRange.arguments.length === 1) {\r\n return defaultEmptyOK;\r\n } else { \r\n return (isIntegerInRange.arguments[1] === true);\r\n }\r\n\r\n // Catch non-integer strings to avoid creating a NaN below,\r\n // which isn'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Get PreGame Odds by Week / / Year of the season, with optional season type. Examples: 2018, 2018POST, etc. / The week of the scores (games). Examples: 1, 2, etc.
getPreGameOddsByWeekPromise(season, week){ var parameters = {}; parameters['season']=season; parameters['week']=week; return this.GetPromise('/v3/nfl/odds/{format}/GameOddsByWeek/{season}/{week}', parameters); }
[ "function GamesPerWeek(season, week, type, games) {\n\tthis.season = season; // Season year\n\tthis.week = week; // Season week\n\tthis.type = type; // Season type\n\tthis.games = games; // number of games\n}", "getPeriodGameOddsByWeekPromise(season, week){\n var parameters = {};\n parameters['seaso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the last inserted record from the database.
lastInsert() { return this._lastInsert; }
[ "get lastInsertRowID() {\n this._ensureOpen();\n return this._connection.lastInsertRowID;\n }", "lastInsertId() {\n return this._lastInsertId;\n }", "function getLastId() {\n return db.lastId;\n}", "last() {\n const records = this.select();\n if (records.length === 0) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the state with items from its store
getItems(){ this.setState({ items: ItemsStore.getAll(), progess: this.getProgress(), }); }
[ "storeChangeHandler() {\n this.setState({\n items: ItemStore.get('items'),\n loading: ItemStore.get('loading'),\n });\n }", "updateDisplayItems() {\n this.setState({ displayItems: this.store.items, hasLoaded: true });\n }", "updateComponentStore() {\n let store = this.state.store;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
howManyHundreds(1000);10 howManyHundreds(894); 8 howManyHundreds(520); 5 howManyHundreds(99); 0 howManyHundreds(0); 0
function howManyHundreds(num) { return (num-(num%100))/100; }
[ "function howManyHundreds(input){\n\treturn input % 100\n}", "function oneHundred() {\n var integers = [];\n for (var i=0;i<=99;i++) {\n integers[i] = i+1;\n }\n return integers;\n }", "function howManyHundreds(number) {\n return Math.floor(number / 100);\n}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Body View Avail time tabs
renderAvailTimeTabs() { const doctorData = asyncdata.getDoctorItem(); const availTime = doctorData.availTime; return ( <View style={styles.tabsViewContainer}> <ScrollableTabView key="availTime" renderTabBar={() => <ScrollableTabBar />} ref={root => this._tabRefs.r...
[ "function showTime(){\n me.renderView(me.options.view);\n me.renderToc(me.options.toc);\n return me;\n }", "view() {\n window.app.intercom.view(false);\n window.app.nav.selected = 'Schedule';\n window.app.view(this.header, this.main, '/app/schedule');\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deletes all Divs. This method is used when clicking the All, Online, and Offline buttons.
function deleteDivs () { $('.streamer-wrapper').remove(); $('.link-to-twitch').remove(); $('.streamer-image').remove(); $('.channel-text').remove(); $('.streamer-text').remove(); $('.description-text').remove(); $('.is-streaming-logo').remove(); }
[ "function clearAllDivs(){\n\t\t$('#center').empty();\n\t\t$('#center').removeAttr(\"class\");\n\t\t$('#left').empty();\n\t\t$('#centernav').empty();\n\t\t$('#centernav').removeAttr(\"class\");\n\t}", "function clearAll() {\n\tfor (var i = 0; i < divs.length; ++i) {\n\t\tcontainer.removeChild(container.firstChild)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Busqueda del medidor [clave] dentro de los mediores [meters] almacenados de Forma Local
FindMeter(clave) { this.limpiar(); let conteo = 0; this.initMedidor(); this.initRegistro(); if (this.medidores) { for (let index = 0; index < this.medidores.length; index++) { const element = this.medidores[index]; console.log(clave, '=...
[ "function tipoCambio(moneda) {\r\n \r\n if (moneda.currency == \"UYU\") {\r\n costo = moneda.unitCost / tc;\r\n } else {\r\n costo = moneda.unitCost;\r\n }\r\n \r\n return costo;\r\n}", "calCostoDistancia(dirEstablecimiento, distancia_km) {\n // console.l...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
================================= = Callbacks = ================================= commit a voteRecord to local chain when received via messaging TODO: add validation
function receive(frm, message) { message.from = frm; debug('message received: ' + JSON.stringify(message)); commit('voteRecord', message); return true; }
[ "voteReceived( vote ) {\n console.log( 'vote received ' + this.room );\n console.log( new Date().getTime() + ' ' + new Date() );\n \n //Avoid cycles in vote object\n const voteThrough = {...vote};\n delete voteThrough.votation; \n //Pass the vote and votation to the ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the official list of genres for all tv shows
function getTVGenres() { let queryURL = "https://api.themoviedb.org/3/genre/tv/list?api_key=" + API_KEY + "&language=en-US"; $.ajax({ url: queryURL, method: "GET", }).then(function(response) { console.log(response); let tvGenres = []; for (let i = 0; i < response.genres.length; i+...
[ "function getGenres() {\n // TODO: get categories from wp headless\n // https://movie-api.cederdorff.com/wp-json/wp/v2/categories\n}", "static getGenres() {\n return axios\n .request({\n baseURL: `${TMDB.API_URL}`,\n url: `/genre/tv/list?api_key=${TMDB.API_KEY}`,\n responseType: \"j...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ScalarTypeExtension : extend scalar Name Directives[Const]
function parseScalarTypeExtension(lexer) { var start = lexer.token; expectKeyword(lexer, 'extend'); expectKeyword(lexer, 'scalar'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); if (directives.length === 0) { throw unexpected(lexer); } return { kind: Kind.SCALAR_T...
[ "parseScalarTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('scalar');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n\n if (directives.length === 0) {\n throw this.unexpected();\n }\n\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================== from functions/errors/Protect.java =================================================================== Needed early: Builtin Visitor Needed late: Pair FinallyInvoke PopArg ArcObject
function Protect() { }
[ "function sc_unwindProtectLambda(proc1, proc2) {\n try {\n return proc1();\n } finally {\n proc2();\n }\n}", "unsafelyUnwrap() {\n throw new Error('Tried to `unsafelyUnwrap an Err`');\n }", "exitObject_privilege(ctx) {\n\t}", "$restoreProtection () {\n this._lockLevel > 1 && sodiu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets a collection designed to aid in paging through data
getPaged(parser = new ODataDefaultParser()) { return this.get(new PagedItemCollectionParser(this, parser)); }
[ "function createPages() {\n\n pages = util.Array.chunk(collection.getItems(), pageSize)\n .map(makeCollection);\n\n }", "constructor(collection, itemsPerPage) {\n this.collection = collection;\n this.itemsPerPage = itemsPerPage;\n }", "_paginate (entities, page, pageSize) {\n\t\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Display Image Preview The purpose of this method is to display the preview for an image file. It shows the image window and hides any other display windows. It accepts paramaters for which windows (current or next) to hide/show as well as for the location of the image to show.
function displayImagePreview(previewWindowName, filePath, filename) { $("#" + previewWindowName + "SlideImage").attr('src', filePath + filename); $("#" + previewWindowName + "SlideImage").show(); $("#" + previewWindowName + "SlideWebpage").hide(); $("#" + previewWindowName + "SlideVideo").hide(); $("#nextEr...
[ "function showPreviewImage() {\n previewImage.show();\n }", "function showPreview(input) {\n if (input.files && input.files[0]) {\n let reader = new FileReader();\n\n reader.onload = function(e) {\n $('#preview-img').attr('src', e.target.result);\n $('#preview-img').show();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
try to ways for pick all the checkmarks 1 creating all the selectors tags in a class. 2 creating an array of selectors
constructor(){ this.checkBoxOne = Selector(""); const selectors =[ "", ] }
[ "function getTipClasses() {\n //Here it gets the elements that has classname prefixed with 'Tip- (and) ui-'.\n var elemArray = $(\"*[class*='Tip-'],*[class*='ui-']\");\n $.each(elemArray, function () {\n if (!($(this).css(\"visibility\") == \"hidden\")) {\n var pageClasses = $(this).a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Balikan setiap kata dari string dengan function reverseInPlace() Contoh reverseInPlace('Mobil itu berwarna merah') === 'liboM uti anrawreb harem' reverseInPlace('Hello World!') === 'olleH !dlroW' reverseInPlace('katak melompat') === 'katak tapmolem'
function reverseInPlace(str) {}
[ "function revInPlace(str) {\n if (str.lenth === 0) {\n return str;\n }\n let arrStr = str.split('');\n let ptrA = 0;\n let ptrB = str.length - 1;\n while (ptrA <= ptrB) {\n let swap = arrStr[ptrA];\n arrStr[ptrA] = arrStr[ptrB];\n arrStr[ptrB] = swap;\n ptrA++;\n ptrB--;\n }\n return arrSt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if we can save, we need fields
get canSave() { return (this.canEdit || this.alwaysEditing) && this.isEditing && this.hasChanged && !!this.recordFields.length; }
[ "get canSave() {\n return this._canSave;\n }", "get canSave() {\n // in case of a new connector validations are skipped\n if(this.connector != null)\n {\n return this.connector.token && this.connector.challenge && this.connectorType && !this.api.isRequesting;\n }\n return false;\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
updates the search list if a customer has been added, aswell as handles the modal toggle
toggleModal() { if (this.modal == true) { customerService.getCustomerSearch(result => { this.temporaryOptions = []; result.map(e => { this.temporaryOptions.push({ value: e.c_id, label: e.fullname }); }); this.searchbarOptions = this.temporaryOptions; }); } ...
[ "function bil002_paymentPanel_searchCustomer() {\n\tif (global_billingObj == null)\n\t\treturn false;\n\t\n\tmw_customerSearch_show(\n\t\tbil002_paymentPanel_searchCustomer_callbackFn, \n\t\tnull, \n\t\tglobal_billingBucketObj.customerNo);\t\n} // .end of bil002_paymentPanel_searchCustomer", "_onCustomerSearch() ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
participate Month Select Element Delete
function participateMonthDelete(){ var element = document.getElementById("participate_month"); var length = element.length; participate.month = 0; for(var i = 0; i < length - 1; i++){ element.removeChild(element.lastChild); } participateDayDelete(); }
[ "function acceptMonthDelete(){\n\tvar element = document.getElementById(\"accept_month\");\n\tvar length = element.length;\n\taccept.month = 0;\n\t\n\tfor(var i = 0; i < length - 1; i++){\n\t\telement.removeChild(element.lastChild);\n\t}\n\t\n\tacceptDayDelete();\n}", "function deselect() {\n\n\t\tvar filter = do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUBLIC Sets the connection's color. The default value for each connection is "003366".
function setConnectionColor(color) { this.color = color; if (document.getElementById(this.id) != null) { document.getElementById(this.id).strokeColor = color; } }
[ "function reset_connection_color()\n {\n firstInstance.select().setPaintStyle({\n \n stroke:\"#e35c85\", \n strokeWidth:5 \n \n });\n }", "static set color(value) {}", "set mainColor(value) {}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find all instances of a URLreferenced `stroke` in the svg. In 2.0, all gradient strokes have a round `strokelinejoin` and `strokelinecap`... for some reason.
_setGradientStrokeRoundedness () { const elements = this._collectElements(); for (const elt of elements) { if (!elt.style) continue; const stroke = elt.style.stroke || elt.getAttribute('stroke'); if (stroke && stroke.match(/^url\(#.*\)$/)) { elt.style...
[ "removeFillStrokeStyles (inlinedSVG) {\n let elements = inlinedSVG.getElementsByTagName('*')\n for (let i = 0; i < elements.length; i++) {\n if(elements[i].style === undefined) {\n continue\n }\n let fill = elements[i].style.fill\n if (fill && fill !== 'none') {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
VARIATIONS check if two arrays of attributes match
function variations_match( attrs1, attrs2 ) { var match = true; for ( var name in attrs1 ) { var val1 = attrs1[name].toLowerCase(); if ( typeof( attrs2[name] ) == 'undefined' ) { var val2 = 'undefined'; } else { var val2 = attrs2[name].toLowerCase(); } ...
[ "function find_matching_variations( attributes ) {\n var matching = [];\n\n for ( var i = 0; i < product_variations.length; i++ ) {\n var variation = product_variations[i];\n if ( variations_match( variation.attributes, attributes ) ) {\n matching.push(variation);\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
candies sold by store 1 on jan 8
function candiesSold(date) { for (var i=0; i < store1[date].length ; i++) { console.log(store1.date[i][0]) } //SAME CODE AS FOR LOOP, JUST WRITTEN DIFFER // function printDateAndSum() { // return dateArray.forEach(function(el) { // return numCandies(el); // }) }
[ "function buy(candyStore, id){\n for (let i = 0; i < candyStore.candies.length ; i++){\n if (candyStore.candies[i].id === id) {\n //add candy price to the cashRegister\n candyStore.cashRegister += candyStore.candies[i].price;\n //decrease the amount of the relevant candy\n candyStore.candies...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get a descending sorting function for a specific field
genSortDescendingByField(field) { return (a, b) => { const valA = a[field].toUpperCase() const valB = b[field].toUpperCase() let order = 0 if (valA < valB) order = 1 if (valA > valB) order = -1 return order } }
[ "function sort_by(field, fn, descending) {\n var func = fn ? function (x) {\n return fn(x);\n } : function (x) {\n return x[field];\n };\n descending = !descending ? 1 : -1;\n return function (a, b) {\n a = func(a);\n b = func(b);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
find a question mark on your map and the shortest path to it
breadthFirstSearch(big_map) { let paths = []; let visited = []; let current_path = null; let cur_room = null; paths.push([this.state.current_room.room_id]); while (paths.length > 0) { current_path = paths.splice(0, 1); cur_room = current_path[-1]; visited.push(cur_room); ...
[ "function solve(map, miner, exit) {\r var result = [];\r if(miner.x === exit.x && miner.y === exit.y) return [];\r\r //converting the map to we can edit. We want to know if we visited a point in the graph\r var newMap = [];\r for(var i = 0; i < map.length; i++) {\r newMap[i] = [];\r for(var j = 0; j < ma...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns 0 or 1 following the proportions given by this.zeroToOneRatio
random() { return (Math.random() >= this.zeroToOneRatio ? 1 : 0); }
[ "ratio() {\n if (this.dualKnobs) {\n return Math.min(this.ratioA, this.ratioB);\n }\n return this.ratioA;\n }", "function changeZeroToOneScaleFeedback( what, down ) {\r\n\tif( down ) {\r\n\t\tif( what > 0.01 ) {\r\n\t\t\tif( what < 0.15 && what > 0.01 ) {\r\n\t\t\t\twhat = 0.01;...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns an object containing two latLng coordinates representing the southwest and northeast corners of a box encompassing the given center latLng. The box's height is latOffset 2 and the box's length is lngOffset 2.
function calculateLatLngBounds(center, latOffset, lngOffset) { const southwest = new Map(); southwest.lat = center.lat - latOffset; southwest.lng = center.lng - lngOffset; const northeast = new Map(); northeast.lat = center.lat + latOffset; northeast.lng = center.lng + lngOffset; const...
[ "function make_center_box(){\n let bounds = map.getBounds();\n let topRight = bounds.getNorthEast(); \n let bottomLeft = bounds.getSouthWest();\n let c = bounds.getCenter();\n let cx = c.lng()\n let cy = c.lat()\n let nex = topRight.lng()\n let ney = topRight.lat()\n let swx = bottomLeft...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads the example MIDI file.
function loadExample() { document.getElementById('fileInput').value = ''; let request = new XMLHttpRequest(); request.open('GET', './example.mid', true); request.responseType = 'arraybuffer'; request.onerror = (e) => console.error('Unable to load example MIDI.'); request.onload = () => { let arraybuffer = reque...
[ "loadMidi(filepath) {\n this.reader.readAsDataURL(filepath);\n }", "function loadMidi(files){\n let reader = new FileReader();\n reader.onload=function(e){\n synth.loadMIDI(reader.result);\n }\n reader.readAsArrayBuffer(files[0]);\n}", "loadMidiFile(midiFile) {\n this.stop();\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Activate/deactivate the developer mode (advanced configuration)
function devmode() { dev = !dev; if (dev) { track('Options', 'Advanced configuration', 'Show the advanced configuration'); // show advanced configuration $('.advanced').show('blind', 'fast'); $('#devmode').addClass('activated'); } else { // hide advanced configuration...
[ "function devMode() {}", "toggleDebugMode() {\n debug = !debug;\n }", "toggleDebugMode() {\n this.setDebugMode(!this.getDebugMode());\n }", "function devMode(){\n\tdocument.getElementById('devButtons').style.display = 'block';\n}", "function developmentModeOn() {\n if (options.development) ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a stripped version of the Http Response which only contains body, headers and the status.
function stripResponse(response) { const strippedResponse = {}; strippedResponse.body = response.bodyAsText; strippedResponse.headers = response.headers; strippedResponse.status = response.status; return strippedResponse; }
[ "function stripResponse(response) {\n var strippedResponse = {};\n strippedResponse.body = response.bodyAsText;\n strippedResponse.headers = response.headers;\n strippedResponse.status = response.status;\n return strippedResponse;\n}", "clone() {\n const { headers, status, statusText } = thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to clear the grid and reinitialize count
function clear() { if (generate) return const freshGrid = buildGrid() setGrid(freshGrid) genCount.current = 0 }
[ "_resetGrid(){\n\t\tthis._grid = {\n\t\t\t0: {\n\t\t\t\t0: 1\n\t\t\t}\n\t\t};\n\t\tthis._spirals = 0;\n\t}", "function gridClear(){\n produceGridArray(gridSize);\n}", "function clearGrid() {\n populateGrid(0);\n}", "function resetGrid() {\n removeGrid();\n buildGrid(getDIMForGrid());\n}", "reset() {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to save only if a day has been flagged as changed
function calendarSaveDayIfChanged(index) { if (g_calendarDayModified[index] == true) { calendarAutoSave(index); } }
[ "_isNewDay() {\n return storage.data[STOR_CURRENT_DATE] !== this._getDate();\n }", "function setModified(){\n if(JSON.stringify(getUpdatedFields()) != \"{}\") {\n $(\"#save\").prop('disabled', false);\n }else{\n $(\"#save\").prop('disabled', true);\n }\n}", "function setCheckAtS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetches and loads an image from a url and gets the latitude/longitude GPS data from the EXIF data of the image. Returns a promise that resolves to a Graphic with a point geometry representing the location where the photo was taken.
function exifToGraphic(url, id) { return promiseUtils.create(function (resolve, reject) { const image = document.createElement("img"); image.src = url; image.onload = function () { image.load = image.onerror = null; EXIF.getData(image, function () { const latitude = EXIF.getTag(this, "...
[ "async function getImage() {\n const dim = dimensions.value && dimensions.validity.valid ? dimensions.value : 1;\n const response = await fetch(`https://api.nasa.gov/planetary/earth/imagery?lon=${longitude}&lat=${latitude}&dim=${dim}&date=${date.value}&api_key=DEMO_KEY`);\n const blob = await response.blob...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function for check delete folder name isnt default or trash.
function deleteFolder(form) { for (var i = 0; i < form.id.length; i++) { if (form.id.options[i].selected) { if (form.id.options[i].text == "[Default]" || form.id.options[i].text == "[Trash]") { bmErrorString += "[Default] and [Trash] folders ar...
[ "function deleteFolder(form)\n {\n for(var i=0; i<form.id.length; i++)\n {\n if(form.id.options[i].selected){\n if(form.id.options[i].text == \"[Default]\" || form.id.options[i].text == \"[Trash]\"){\n bmErrorString += \"[Default]...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determines whether the given object is a CreatedRheConnectionOptions object.
function isCreatedRheaConnectionOptions(obj) { return (obj && typeof obj.container === "object" && typeof obj.rheaConnection === "object"); }
[ "function hasOptions(obj) {\n if (obj!=null && obj.options!=null) { return true; }\n return false;\n }", "function hasOptions(obj) {\n if (obj!=null && obj.options!=null) { return true; }\n return false;\n }", "function hasOptions(obj) {\n\tif (obj!=null && obj.options!=null) { ret...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
production boolval ::== false | true
function parse_boolval() { tree.addNode('boolval', 'branch'); if (foundTokensCopy[parseCounter][1] == 'false') { match('false', parseCounter); parseCounter++; } else if (foundTokensCopy[parseCounter][1] == 'true') { match('true', parseCounter); parseCounter++; } tree....
[ "function evalBoolVal(val) {\n Log.GenMsg(`Evaluating single boolVal '${val}'...`);\n let addr = memManager.getFalseVal();\n if (val === \"true\") {\n //Store \"00\" in X and compare with defualt \"00\" in memory\n byteCode.push(\"A2\", \"00\", \"EC\", addr[0], addr[1]);\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Provided required arguments A field or directive is only valid if all required (nonnull without a default value) field arguments have been provided.
function ProvidedRequiredArgumentsRule(context) { return _objectSpread(_objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context)), {}, { Field: { // Validate on leave to allow for deeper errors to appear first. leave: function leave(fieldNode) { var _fieldNode$arguments; va...
[ "function ProvidedRequiredArgumentsRule(context) {\n return {\n // eslint-disable-next-line new-cap\n ...ProvidedRequiredArgumentsOnDirectivesRule(context),\n Field: {\n // Validate on leave to allow for deeper errors to appear first.\n leave(fieldNode) {\n var _fieldNode$arguments;\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate a publishIndex associated to a file and store publishAttributes
function createPublishIndex(fileDesc, publishAttributes) { var publishIndex; do { publishIndex = "publish." + utils.randomString(); } while(_.has(storage, publishIndex)); publishAttributes.publishIndex = publishIndex; fileDesc.addPublishLocation(publishAttributes); eventMgr.onNewPublishSuccess(fil...
[ "async function addToIndex(topic, filepath, filename) {\n try {\n const filedata = await fs.readFileSync(filepath, 'utf8');\n // add file to ipfs\n const r = await Publisher.pin(filedata);\n // put object into index\n const obj = new Obj(r[0].hash, filename, filedata);\n // add to hashes-table \n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a square from the game Square can be any object in the game such as player, enemy, obstacle, box, bullet ...
removeSquare(square){ if (square.type == "player"){ if (square.killer in this.players){ this.players[square.killer].score += 1; // add 1 to the score of the killer } delete this.players[square.id]; } else if (square.type == "enemy"){ if (square.killer in this.players){ this.players[square.killer...
[ "function remove(square){\n let p = get(square);\n this.board[square.row][square.col] = null;\n return {...p};\n }", "removeSquareFromBoard(x, y) {\n\t\tvar square = new Empty(\"empty\")\n\t\tthis.board[x][y] = square;\n\t\tupdateSquareHTML(square, x, y);\t\n\t}", "function removeSquareFromShi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this function feeds the handlePlayerInput function with keyboard actions from the recording
function checkPlayerInputFromRecording() { for (let i = 0; i < preloadedGameString.length; i++) { if (preloadedGameString[i].frameNumber === playerLevelEnvironment.frameNumber) { handlePlayerInput(preloadedGameString[i].eventValue); } } }
[ "setInputHandler() {\n document.addEventListener('keyup', function(e) {\n var allowedKeys = {\n 37: 'left',\n 38: 'up',\n 39: 'right',\n 40: 'down'\n };\n player.handleInput(allowedKeys[e.keyCode]);\n });\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
VV, Get the MaritalStatus out of the maritalStatusCode
function getMaritalStatus(patientObj) { var mStatus; if (patientObj.maritalStatusCode) { if (searchString("@displayName", patientObj.maritalStatusCode)) { mStatus = patientObj.maritalStatusCode["@displayName"]; } else if (patientObj.maritalStatusCode["@code"]) { mStatus = patientObj.maritalS...
[ "function getMaritalId(status){\n\tvar statusValue = \"\";\n\tif(status == \"Single\"){\n\t\tstatusValue = 1;\n\t}else if(status == \"Married\"){\n\t\tstatusValue = 2;\n\t}else{\n\t\tstatusValue = 2;\n\t}\n\treturn statusValue;\n}", "getStatusFromCode( statusCode ){\n\tlet statusObj = null;\n\tfor ( let status in...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Validation function for creating a new movie
static async validateMovie(data) { try { // Validation rules for data to create a movie const movieSchema = Joi.object({ title: Joi.string().min(2).max(50).required(), description: Joi.string().min(2).max(300).required(), rating: Joi.number().integer().positive().max(10).required...
[ "function validateMovie(movie) {\n const schema = {\n title: Joi.string()\n .min(3)\n .required(),\n year: Joi.string(),\n poster: Joi.string().required(),\n src: Joi.string().required(),\n synopsis: Joi.string().required(),\n similarMovies: Joi.array().items(Joi.string()),\n creator...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to view pallet details
function viewPalletDetails(pallet_no, transaction_id) { if (null != transaction_id && "" != transaction_id && "-- Select a transaction --" != transaction_id) { if (null != pallet_no && "" != pallet_no) { window.location = "view-entries?TrxTransactionDetailsSearch[pallet_no]=" + pallet_no + "&id=" + transaction_id...
[ "function viewPalletDetails(transaction_id, pallet_no) {\n\tif (null != transaction_id && \"\" != transaction_id && \"-- Select a transaction --\" != transaction_id) {\n\t\tif (null != pallet_no && \"\" != pallet_no) {\n\t\t\twindow.location = \"view-entries?TrxTransactionDetailsSearch[pallet_no]=\" + pallet_no + \...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If true, turns on synchronous error rethrowing, which is a deprecated behavior in v6 and higher. This behavior enables bad patterns like wrapping a subscribe call in a try/catch block. It also enables producer interference, a nasty bug where a multicast can be broken for all observers by a downstream consumer with an u...
set useDeprecatedSynchronousErrorHandling(value) { if (value) { var error = /*@__PURE__*/ new Error(); /*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack); } else if (_enable_super_gross...
[ "set useDeprecatedSynchronousErrorHandling(value) {\n if (value) {\n var error = new Error();\n console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \\n' + error.stack);\n }\n else if (_enable_super_gross_mode_that_will_c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
======================================================== Determines if this date completely includes another date NOTE: This is a deep test (patterns tested)
includesDate(other) { var _this2 = this; const date = other.isDateInfo ? other : new dateInfo_DateInfo(other, this.opts); if (!this.shallowIncludesDate(date)) { return false; } if (!this.on) { return true; } const range = this.findShallowIntersectingRange(this, date); let...
[ "includesDate(other) {\n var _this2 = this;\n\n const date = this.toDateInfo(other);\n\n if (!this.shallowIncludesDate(date)) {\n return false;\n }\n\n if (!this.on) {\n return true;\n }\n\n const range = this.rangeShallowIntersectingRange(this, date);\n let result = true;\n thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the AWS resource ARN. If the ARN is not defined it automatically generates it from other properties.
getArn() { let arn = super.getAsNullableString("arn"); if (arn) return arn; arn = "arn"; let partition = this.getPartition() || "aws"; arn += ":" + partition; let service = this.getService() || ""; arn += ":" + service; let region = this.getReg...
[ "get resourceArn() {\n return this.getStringAttribute('resource_arn');\n }", "get qualifiedArn() {\n return this.getStringAttribute('qualified_arn');\n }", "get arnForPolicies() {\n return this.secretFullArn ? this.secretFullArn : `${this.secretArn}-??????`;\n }", "getRoleArn(par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a smart constructor based on the given predicate
function fromPredicate_(a, predicate) { return predicate(a) ? some(a) : none; }
[ "function fromPredicate(predicate) {\n return a => predicate(a) ? some(a) : none;\n}", "function makeFactory(ctor) {\n function ci(outer, iid) {\n if (outer != null)\n throw Components.results.NS_ERROR_NO_AGGREGATION;\n return (new ctor()).QueryInterface(iid);\n }\n return { createInstance: ci };\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Apply a JSON Patch on a JSON document. Returns an array of results of operations. Each element can either be a boolean (if op == 'test') or the removed object (operations that remove things) or just be undefined.
function apply(document, patch, validateOperation) { console.warn('jsonpatch.apply is deprecated, please use `applyPatch` for applying patch sequences, or `applyOperation` to apply individual operations.'); var results = new Array(patch.length); /* this code might be overkill, but will be remove...
[ "function apply(tree, patches, validate) {\n let results = []\n , p = 0\n , plen = patches.length\n , patch\n , key;\n while (p < plen) {\n patch = patches[p];\n p++;\n // Find the object\n let path = patch.path ||...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Show winning panel and stop timer
function showWinPanel() { clearInterval(timercycle); $("#winPanel").css("display", "block"); }
[ "function winGame() {\n stopTimer();\n toggleModal();\n}", "function ifWin() {\n if (score === 8) {\n bringUpModal();\n stopTimer();\n\n }\n }", "function handlerClickNextPlay() {\n targetWin = false;\n winScene.visible = false;\n timeWinView = INITIAL_TIME_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generateFormDivs: helper func for making form elements
function generateFormDivs(id, title, type, options, selval) { // Make a parent div that holds the title and input field var mf = document.createElement('div') mf.setAttribute('id', "main_form_" + id) mf.style.margin = "10px" mf.style.padding = "10px" // title div to the left var td...
[ "function createFormDiv ()\n {\n if ($ (data.divID).length === 0)\n $ ('body').append ('<div id=\" ' + data.divID.substring (1) + '\"></div>');\n\n $ (data.divID).html ('<form class=\"formContent\" id=\"' + id + '\"></form>');\n }", "function generateFormSection(arr, targetElId, edi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine if current character is a number/digit
function is_digit(char) { return /[0-9]/i.test(char); }
[ "function isDigit(char) {\n return digits.test(char);\n }", "function isDigit(char) {\n var re = /^\\d$/;\n return re.test(char);\n}", "function isNumber(char) {\n\t\treturn !isNaN(Number(char));\n\t}", "function isDigit(inputCharacter) {\n\treturn ((inputCharacter >=\"0\")&&(inputCharacter <=\"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Upon timeout or transitionEnd, reject or resolve (respectively) this promise. NOTE: Make sure this transitionEnd didn't bubble up from a child
function finished(ev) { if ( ev && ev.target !== element[0]) return; if ( ev ) $timeout.cancel(timer); element.off($mdConstant.CSS.TRANSITIONEND, finished); // Never reject since ngAnimate may cause timeouts due missed transitionEnd events resolve(); }
[ "function finished(ev){if(ev&&ev.target!==element[0])return;if(ev)$timeout.cancel(timer);element.off($mdConstant.CSS.TRANSITIONEND,finished);// Never reject since ngAnimate may cause timeouts due missed transitionEnd events\nresolve();}", "function finished(ev){if(ev&&ev.target!==element[0])return;if(ev)$timeout....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Disallow `[...] = a` for some reason. (Could be equivalent to `[] = a`?)
disallowLoneExpansion() { var loneObject, objects; if (!(this.variable.base instanceof Arr)) { return; } ({objects} = this.variable.base); if ((objects != null ? objects.length : void 0) !== 1) { return; } [loneObject] = objects; if (loneObject instanceof Ex...
[ "function $a(a) {\n\t\tif (!arguments.length) {\n\t\t\tfor (var i = $j - 1; i >= 0 && $k[i] !== Infinity; i--);\n\t\t\tif (i < 0) {\n\t\t\t\tthrow new Error('array-marker-not-found');\n\t\t\t}\n\t\t\ta = $k.splice(i + 1, $j - 1 - i);\n\t\t\t$j = i;\n\t\t} else if (!(a instanceof Array)) {\n\t\t\ta = new Array(+argu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the default character format for document editor
setDefaultCharacterFormat(characterFormat) { this.characterFormat = characterFormat; }
[ "setDefaultParagraphFormat(paragraphFormat) {\n this.paragraphFormat = paragraphFormat;\n }", "set WindowsEditor(value) {}", "function autoFormat(){\n modifyContent(supportedAction.FORMAT);\n }", "function clearFormat(editor) {\n editor.focus();\n editor.addUndoSnapshot(function () {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get the list of predecessors O(n + m) (with n the number of nodes and m the number of edges) this operation is quite costly, but we could solve this problem by maintaining a list of predecessors per nodes in addition to the list of successors
getPredecessors(node) { const edges = new DynamicArray(); for (let i = 0; i < this.nbNodes; i++) { if (this.hasEdge(i, node)) { edges.add(edges.getSize(), i); } } return edges; }
[ "function findAllPredecessors(node, predecessorsList) {\n predecessorsList = predecessorsList || [];\n dag.predecessors(node).forEach(function (n) {\n //some nodes can be visited more than once so this removes them\n if (predecessorsList.indexOf(n) == -1) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns users by the current sorting
function getUsersToShow(sorting){ sortUsers(sorting); return gUsers; }
[ "sortUsers() {\n let data = angular.copy(this.users.raw);\n data = this.$filter('orderBy')(\n data,\n this.users.orderBy,\n this.users.orderDesc,\n );\n this.users.sorted = data;\n }", "sortUsers() {\n let data = angular.copy(this.users.raw);\n data = this.$filter...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a detailed TransactionResult for a given XRPL transaction hash.
async getTransactionResult(transactionHash) { const rawStatus = await this.getRawTransactionStatus(transactionHash); const isValidated = rawStatus.isValidated; const transactionStatus = await this.getTransactionStatus(transactionHash); // TODO: add logic to this method to investigate the...
[ "async getTransactionResult(transactionHash) {\n const rawStatus = await this.getRawTransactionStatus(transactionHash);\n const isValidated = rawStatus.isValidated;\n const transactionStatus = await this.getTransactionStatus(transactionHash);\n return new transaction_result_1.default(tra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function gets the brands selected in the selector and add them in the project.
function add_brand_in_project(){ //get selected items in selector let brands_selected = brands_selector.val(); //add brand to list for(let i in brands_selected){ let option_selected = brands_selector.find("option[value='" + brands_selected[i] + "']"); brands_added.append(template({ ...
[ "pushBrandsPropstoState(propsBrands)\n {\n var brands = [];\n for (var i = 0; i < this.props.config.brands.length; i++) {\n var brandName = this.props.config.brands[i];\n var brandObject = {};\n brandObject.brandName = brandName;\n brandObject.selected = ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loads provinces that has similar code
function loadProvince(event){ selectProvince.html('<option value="">Select Provinces...</option>'); for (i in provinces) { if ( provinces[i].provCode.indexOf(event.target.value) == 0 ) { selectProvince.append($('<option>', { value: provinces[i].provCode, text: provinces[i].provDesc ...
[ "function getProvinceList() {\n return {\n NCR: ['NCR'],\n CAR: ['Abra', 'Apayao', 'Benguet', 'Ifugao', 'Kalinga', 'Mtn Province'],\n R1: ['Ilocos Norte', 'Ilocos Sur', 'La Union', 'Pangasinan'],\n R2: ['Batanes', 'Cagayan', 'City of Isabela', 'Nueva Vizcaya', 'Quirino'],\n R3:...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[MSPPT] 2.6 Slide Show Types / [MSPPT] 2.6.1 SlideShowDocInfoAtom
function parse_SlideShowDocInfoAtom(blob, length, opts) { blob.l += length; }
[ "function extractShowInfo(data) {\n\treturn {\n\t\ttitle: data.title,\n\t\tairday: data.airs.day,\n\t\tairtime: data.airs.time,\n\t\ttimezone: data.airs.timezone,\n\t\truntime: data.runtime,\n overview: data.overview\n\t};\n}", "function setExtraInfo(hwpCtrl, docinfo) {\r\n\ttry {\r\n\t\tif (hwpCtrl != null) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a location object, used to identify the place in the source that created a given parsed object.
function loc(parser, start) { if (parser.options.noLocation) { return null; } if (parser.options.noSource) { return { start: start, end: parser.prevEnd }; } return { start: start, end: parser.prevEnd, source: parser.source }; }
[ "function loc(parser, start) {\n\t if (parser.options.noLocation) {\n\t return null;\n\t }\n\t if (parser.options.noSource) {\n\t return {\n\t start: start,\n\t end: parser.prevEnd\n\t };\n\t }\n\t return {\n\t start: start,\n\t end: parser.prevEnd,\n\t source: parser.source\n\t };...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make a cylinder of given length and width starting at turtle pos Moves turtle pos ahead to end of the new cylinder
makeCylinder(len) { var width = 0.3 / (0.5*(this.iter + 1)); var c = (0.6 - this.iter * 0.1) + 0.2; var color = new THREE.Color(c, c - 0.1, c * 0.1); var geometry = new THREE.CylinderGeometry(width, width, len); var material = new THREE.MeshLambertMaterial( {color: color} ); ...
[ "makeCylinder(len, width, colorcode) {\n var geometry = new THREE.CylinderGeometry(width, width, len);\n var material = new THREE.MeshBasicMaterial( {color: colorcode} );\n var cylinder = new THREE.Mesh( geometry, material );\n this.scene.add( cylinder );\n\n //Orient the cylinder...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
void ServerCallback(System.IAsyncResult ar), void IServerChannelSinkStack.ServerCall...
ServerCallback() { }
[ "function SimpleCallbackHandler() {}", "function serverCallBack(){\n\tconsole.log(`the server is running on port ${port}`);\n}", "_final(cb) {\n logger.debug('ZitiSocket._final entered');\n cb();\n }", "_remoteCallbackWrapper(packetId, error, ...result) {\n this.callback(packetId, error, result);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
request currentUser's list of saved urls from backend apiData param carries data from getJSON() source param corresponds to api source (eg. wikipedia)
function getSavedUrls (apiData, source) { $.ajax({ url: '/getstars', type: 'GET', success: function (data) { // data = savedUrlsArr // server returns error if user is not logged in if (data.status !== 'error') { // logged in loadResults(apiData, source, data); } e...
[ "function getJSON (source) {\n var url = '';\n\n // WIKIPEDIA API CALL\n if (source === 'wikipedia') {\n url = 'https://en.wikipedia.org/w/api.php?action=opensearch&search=';\n\n $.ajax({\n url: url + SEARCH_STR,\n dataType: 'jsonp',\n method: 'GET',\n success: functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Deserialize a dynamo respond to a seneca entity.
function deserializeEntity(entity) { return attributes.unwrap(entity); }
[ "unmarshal() {\n return JSON.parse(this.Body);\n }", "deserializeCompletion(json) {\n let objCompletion = json;\n\n if (typeof objCompletion !== \"object\") {\n objCompletion = JSON.parse(objCompletion);\n }\n\n objCompletion.forEach(obj => {\n if (obj[\"type\"] !== \"r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Send pm to selected user
function sfjsendPMTo(recipient, name, title, reply) { var toField = document.getElementById('pmmembers'); var titleField = document.getElementById('pmtitle'); var isreply = document.getElementById('pmreply'); toField.value = recipient; titleField.value = title; isreply.value = reply; sfjaddpmUser('pmmembers'); ...
[ "function pmUser(user) {\n\tmainRoom.openPrivateChat([stripHTML($(user).find(\".username\").html())]);\n}", "function pm(user, message) {\n if(!user) return send(\"Sorry! You must use the user's ID that you want me to PM!\");\n if(!message) return send(\"I can't DM someone and empty message! Pease check the mes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
renders the drawing and the paths
render() { this.ctx.clearRect(0, 0, this.pad.width, this.pad.height); this.paths.forEach((path) => path.render()); }
[ "draw() {\n if (!this.traceMode) {\n this.drawBackground();\n }\n\n for (let path of this.paths) {\n path.draw();\n }\n }", "drawPath() {\n\t\tif (this.drawing) {\n\t\t\trenderingContext.beginPath();\n\t\t\trenderingContext.moveTo(this.previousPos.x, this.previousPos.y);\n\t\t\trenderingCon...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
shows the buffs in each of the card. response is the data that contains pokemon info like hp and current hp and buffs whichCard refers to either one of the two player 1 and opponent pokemon cards
function getBuffs(response, whichCard) { qs(whichCard + " .buffs").innerHTML = ""; for (let i=0; i<response.buffs.length; i++) { let buff = document.createElement("div"); buff.classList.add("buff") ; buff.classList.add(response.buffs[i]); qs(whichCard + " ...
[ "function fillCard(response, whichCard) {\n qs(whichCard +' .name').innerHTML = response.name;\n qs(whichCard +' .hp').innerHTML = response.hp + \"HP\";\n qs(whichCard +' .type').src = response.images.typeIcon;\n qs(whichCard +' .pokepic').src = response.images.photo;\n qs(whichCa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION TO CHECK USER ROLES COUNT
function getUserRolesCount(username) { const $ASYNC = false; const $URL = `${$HEROKU_URL}/api/v1/users/${username}/rolesCount`; const $VERB = 'GET'; const $DATATYPE = 'json'; let rolesCount = 0; $.ajax({ async: $ASYNC, type: $VERB, url: $URL, dataType: $DATATYPE,...
[ "getRoleCount(role) {\n let count = 0;\n for (let player of this.players) {\n if (player.role & (1 << role)) {\n count++;\n }\n }\n\n return count;\n }", "static hasRole(role){\n let user = new User();\n user.getCurrent();\n let hasRole = false;\n user.dat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }