query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
drill down and roll up differ background creation sequence from tree hierarchy sequence, which cause that lowser background element overlap upper ones. So we calculate z based on depth. Moreover, we try to shrink down z interval to [0, 1] to avoid that treemap with large z overlaps other components.
function calculateZ(depth,zInLevel){var zb=depth * Z_BASE + zInLevel;return (zb - 1) / zb;}
[ "depth () {\n /* z is weighted slightly to accomodate |_ arrangements */\n return this.x + this.y - 2 * this.z;\n }", "depth() {\n /* z is weighted slightly to accomodate |_ arrangements */\n return this.x + this.y - 2 * this.z;\n }", "function calculateZ(depth,zInLevel){\nvar zb=depth*Z_BASE+zInL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Equality test for two games.
function gameEqual(g1, g2) { if((g1 == undefined && g2 != undefined) || (g1 != undefined && g2 == undefined)) { return false; } return g1.round == g2.round && g1.tuhtot == g2.tuhtot && g1.ottu == g2.ottu && g1.forfeit == g2.forfeit && g1.team1 == g2.team1 && g1.team2 == g2.team2 && g1.score1 == g2.sco...
[ "function hasSameResults (first, second) {\n // handle league null objects\n if (!first) {\n return !second;\n }\n // if first doesn't have goalsFor/goalsAgainst but second does, return false\n if (isNaN(parseInt(first.goalsFor))) {\n return isNaN(second.goalsFor);\n }\n if (isNaN...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a query to the manager and populates with any entities that match
_addQuery(query) { this._queries[buildTypeKey(query.types)] = query; for (const entity of this._world.entityManager.entities) { query.addEntity(entity); } }
[ "addEntity(entity) {\n for (const queryType in this._queries) {\n if (this._queries[queryType]) {\n this._queries[queryType].addEntity(entity);\n }\n }\n }", "resolveQuery() {\n\t\tthis.resultData = this.query.run(this.collection, this.dataProvider.data());\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
For use on newTicket.html page Retrieving Data from firestore create element and render the list.
function renderTicketList(doc){ let li, firstName, lastName, totalAttend, email, phoneNumber, cross, extraInfo, editTicket, assignSeat, print, Seat try { li = document.createElement('li'); firstName = document.createElement('spanner'); lastName = document.createElement('...
[ "function renderTicketList(doc){\n let li, firstName, lastName, totalAttend, email, phoneNumber, cross, extraInfo, editTicket, assignSeat, print, Seat\n try {\n li = document.createElement('li');\n firstName = document.createElement('spanner');\n lastName = document.creat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add a thread to the list
function addRedditThread(div, thread, nsfw) { console.log("Adding thread from " + thread.subreddit); var ul = div.firstChild; ul.style.listStyleType = '"\u25b6"'; var li = document.createElement("li"); li.style.paddingLeft = "10px"; var link = thread.permalink; ...
[ "addThread(state, thread) {\n state.threads.push(thread);\n }", "function pushThread(thread) {\n thread.link = ThreadService.getThreadLink(this.board.url, thread.id);\n\n this.threads.push(thread);\n }", "addThread(thread) {\n const threads = { ...this.state.threads };\n threads[`...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Enable or disable the AutoLog functionality
function setAutoLog(enabled) { settings.set('AutoLog', enabled); }
[ "function setAutoLog(enabled) {\n settings.set('AutoLog', enabled);\n}", "function enableLogging() {\n logEnabled = true;\n}", "function enableLogging() {\n logEnabled = true;\n }", "enableLog(enable) {\r\n log_1.getLogger().enableLog(enable);\r\n }", "enableLog(enable) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
FUNCTION: dwscripts.encodeDynamicExpression DESCRIPTION: This function prepares a dynamic expression for insertion onto the page. It is assumed that this expression will be used within a larger dynamic statement, therefore all server markup is stripped. ARGUMENTS: expression string the dyanmic expression to encode RETU...
function dwscripts_encodeDynamicExpression(expression) { var retVal = expression; // Use the Server Model version if it exists var serverObj = dwscripts.getServerImplObject(); if (serverObj != null && serverObj.encodeDynamicExpression != null) { retVal = serverObj.encodeDynamicExpression(expression); ...
[ "function encodeDynamicExpression(expression)\n{\n var retVal = \"\";\n expression = expression.toString();\n\n if (hasServerMarkup(expression))\n {\n retVal = trimServerMarkup(expression);\n }\n else\n {\n // quote all values for JSP\n if (!dwscripts.isQuoted(expression))\n {\n retVal = \"\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To check if a bucket already exists. __Arguments__ `bucketName` _string_ : name of the bucket `callback(err)` _function_ : `err` is `null` if the bucket exists
bucketExists(bucket, cb) { if (!validateBucketName(bucket)) { throw new errors.InvalidateBucketNameException('Invalid bucket name: ' + bucket) } this.bucketRequest('HEAD', bucket, cb) }
[ "bucketExists(bucketName, cb) {\n if (!isValidBucketName(bucketName)) {\n throw new errors.InvalidBucketNameError('Invalid bucket name: ' + bucketName)\n }\n if (!isFunction(cb)) {\n throw new TypeError('callback should be of type \"function\"')\n }\n var method = 'HEAD'\n this.makeReque...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`shrink.pair(shrA: shrink a, shrB: shrink b): shrink (a, b)`
function shrinkPair(shrinkA, shrinkB) { var result = shrinkBless(function (pair) { assert(pair.length === 2, "shrinkPair: pair should be an Array of length 2"); var a = pair[0]; var b = pair[1]; var shrinkedA = shrinkA(a); var shrinkedB = shrinkB(b); var pairA = shrinkedA.map(function (ap) ...
[ "function shrinkPair(shrinkA, shrinkB) {\n var result = shrinkBless(function (pair) {\n assert(pair.length === 2, \"shrinkPair: pair should be an Array of length 2\");\n\n var a = pair[0];\n var b = pair[1];\n\n var shrinkedA = shrinkA(a);\n var shrinkedB = shrinkB(b);\n\n var pairA = shrinkedA.m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `TrafficRouteProperty`
function CfnDeploymentGroup_TrafficRoutePropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but r...
[ "function CfnNetworkInsightsAnalysis_AnalysisRouteTableRoutePropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationRes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
implement functions to check certain conditions here return true if s contains a number
function containsNumber(s) { return s.match(/[1-9]/); }
[ "hasNumber(inputString) {\r\n return /\\d/.test(inputString);\r\n }", "function hasNumbers(str) {\n return /\\d/.test(str);\n }", "function hasNumbers(str){\n var regex = /\\d/g;\n return regex.test(str);\n }", "function containsNumber(string){\r\n\treturn string.mat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Guardar un Repuesto en la base de datos
async StoreRepuesto(myRepuesto) { return await Repuesto.create(myRepuesto); }
[ "function guardarPermisos(data) {\n\t\tvar deferred = $q.defer();\n\t\t$http.post(appConstant.LOCAL_SERVICE_ENDPOINT + \"/guardarPermisos\", data).then(function (res) {\n\t\t\tdeferred.resolve(res.data);\n\t\t}, function (err) {\n\t\t\tdeferred.reject(err);\n\t\t\tconsole.log(err);\n\t\t});\n\t}", "function guard...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function gets any selected text in the current open editor and then copies the data about the insert events that will get placed on the clipboard.
function getCurrentSelectionEvents() { //get the active editor const editor = vscode.window.activeTextEditor; //if there is an active text editor if(editor) { //get the editor selection (we only handle a single selection) const selection = editor.selection; //if there is a sele...
[ "copySelection() {\n let selectedText = window.getSelection().toString();\n let preparedText = this._prepareTextForClipboard(selectedText);\n atom.clipboard.write(preparedText);\n }", "_copy() {\n let editorSession = this.getEditorSession()\n let sel = editorSession.getSelection()\n let doc = e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exercise 64: Part Four define function that updates 'selectedRecordId' when record row is clicked once
handleRowClick(event) { this.selectedRecordId = event.detail.pk; }
[ "handleSelection(event) {\n if(event.detail.selectedRows.length > 0) {\n this.selectedRecord = event.detail.selectedRows[0].Id;\n }\n }", "function onRecordSelect(event) {\n var $record, record;\n\n //window.TTB._log(['utilRenderTable: onRecordSelect:']);\n\n // capture ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
this is the onclick of all the towers by default. it will set the selected tower to itself
selectTower(){ if (selectedTower != this){ selectedTower = this; } else{ selectedTower = null; } }
[ "function clickTower(towerIndex) {\n clickables.page6[\"tower\" + towerIndex].click();\n}", "function chooseTower()\r\n{\r\n towerSelected = true; //for displaying tower and range when mouse over the canvas\r\n if(this.id == \"towerOne\") \r\n { \r\n towerColor = tempT1.color; \r\n obje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Kicks off everything necessary for the exchange and initializes all strategies
async run() { await this.initExchange(); if (this.params.mock) { let api = this.exchange.api; await api.loadTickers(this.exchange.feed); // kick off the "server" if we're mocking api.run(); } this.exchange.runTickers(); for (const s...
[ "function init() {\n try {\n exchange1 = exchange.setExchange(conf.exch1Name, conf.exch1.apiKey, conf.exch1.secret, conf.exch1.uid);\n exchange2 = exchange.setExchange(conf.exch2Name, conf.exch2.apiKey, conf.exch2.secret);\n seconds = exchange2.seconds() * 1000;\n } ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sets the ID token to refresh upon expiration, ID tokens expire every hour
refreshUserIDToken() { setInterval(()=>{ if (AWS.config.credentials.needsRefresh()) { this.cognitoUser.refreshSession(refresh_token, (err, session) => { if(err) { console.log(err); } else { AWS.config.credentials.params.Logins['cognito-idp.us-east-2.amazonaws.com/us-east-2_0HlnZbskF'] = ...
[ "function onRefreshToken() {\n getIdToken(true);\n}", "refreshToken() {\n\n }", "refreshToken() {\n this._id_token = null;\n\n return this._getNewToken();\n }", "function set_id_token(new_id_token) {\n\tid_token = new_id_token;\n}", "$$refreshToken() {\n if (this.$timeouts.refresh !== undefine...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This method returns the distance in the X direction the knob has to be offset in order for the knob to be on the edge of the slider.
getKnobOffsetX() { return this.getSliderRadius() * Math.cos(Constants.ANGLE_OFFSET_RAD); }
[ "alignKnobSliderX() {\n const sliderCentreX = this.getSliderCentreX();\n return sliderCentreX - this.sliderBoundingRect.current.getBoundingClientRect().height * Constants.KNOB_TO_SLIDER_RATIO / 2;\n }", "get floatingOffsetX() {\n\t\tconst sizes = Sizes[this.props.dense ? 'dense' : 'normal'];\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the nearest element to the mouse cursor from elements (jQuery elements)
function findNearest(elements, position) { var maxDistance = 30; // Defines the maximal distance of the cursor when the menu is displayed var nearestItem = null; var nearestDistance = maxDistance; var posX = position.x + ___WEBPACK_IMPORTED_MODULE_0__["QuickE"].win.scrollLeft(); var posY = position....
[ "function findNearest(elements, position) {\n var maxDistance = 30; // Defines the maximal distance of the cursor when the menu is displayed\n var nearestItem = null;\n var nearestDistance = maxDistance;\n var posX = position.x + window.scrollX;\n var posY = position.y + window.scrollY;\n // Find ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
withRouter(Question); mapStateToProps says take this global state and map these certain things to properties within this local state
function mapStateToProps(state) { return { answerableQuestion: state.answerableQuestion, }; }
[ "function mapStateToProps(state) {\n return {\n answerableQuestion: state.answerableQuestion,\n creatableAnswer: state.creatableAnswer,\n currentUser: state.currentUser,\n allQuestions: state.allQuestions,\n };\n}", "function mapStateToProps({ authedUser, questions, users }) {\n // cons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all audio/video files in a folder, sorted by name.
function getAudioVideoFiles(folder) { var rv = []; var contents = folder.getFiles(); while (contents.hasNext()) { var file = contents.next(); if (isAudioVideoFile(file)) { rv.push(file); } } rv.sort(function(fileA, fileB) { return strcmp(fileA.getName(), fileB.getName()); }); return ...
[ "function listFiles(){\n return src(audioGlob, { base: '.'})\n .pipe(rename({ dirname: 'assets/audio' }))\n .pipe(fileList('mp3list.json'))\n .pipe(dest(assetsDir + '/scripts'))\n}", "function getInputFiles(inputFolder) {\n return fs.readdirSync(inputFolder).sort();\n}", "function files(folder) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Your subclass must override this method to define the transformation from InputFile to its cacheable CompileResult). Given an InputFile (the data type passed to processFilesForTarget as part of the Plugin.registerCompiler API), compiles the file and returns a CompileResult (the cacheable data type specific to your subc...
compileOneFile(inputFile) { var pathInPackage = inputFile.getPathInPackage(); var packageName = inputFile.getPackageName(); if (packageName) { packageName = packageName.replace('local-test:', ''); } var fullPath = pathInPackage; if (packageName) { fullPath = path.join(packagesPath, packageName, fullPa...
[ "addCompileResult(inputFile, compileResult) {\n\t\tif (!compileResult.data) {\n\t\t\treturn;\n\t\t}\n\t\tinputFile.addJavaScript({\n\t\t\tpath: compileResult.path,\n\t\t\tsourcePath: inputFile.getPathInPackage(),\n\t\t\tdata: compileResult.data,\n\t\t\tsourceMap: compileResult.sourceMap,\n\t\t\tbare: inputFile.getF...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Always fails with an error
async function fails () { throw new Error('Contrived Error'); }
[ "failing() {}", "isErrored() {\n return false;\n }", "isErr() {\n return false;\n }", "function fail() {\n throw new Error(\"BFS has reached an impossible code path; please file a bug.\");\n }", "function test_satellite_credential_validation_times_out_with_error_message() {}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Problem with remote mounts to jde so attempt to reconnect
function reconnectToJde( err ) { log.d( 'Error data: ' + err ); log.w( 'Issue with Remote mounts to JDE - Attempting to reconnect.' ); mounts.establishRemoteMounts( performPostEstablishRemoteMounts ); }
[ "function reconnectToJde( err ) {\n\n log.debug( 'Error data: ' + err );\n log.warn( 'Issue with Remote mounts to JDE - Attempting to reconnect.' );\n\n mounts.establishRemoteMounts( performPostEstablishRemoteMounts );\n\n}", "function performPostEstablishRemoteMounts( err, data ) {\n\n if ( err ) {\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Item que afeta as salvacoes (resistencias).
function _DependenciasItemSalvacoes(chave_item, item_tabela) { if ('todas' in item_tabela.propriedades.salvacoes) { for (var chave_personagem in gPersonagem.salvacoes) { gPersonagem.salvacoes[chave_personagem].Adiciona( 'resistencia', chave_item, item_tabela.propriedades.salvacoes['todas']); }...
[ "function agregarSala(nombreSalaNueva,listaDeSalas,diccionarioPosSalas){\n var nuevaSala = new sala(nombreSalaNueva);\n diccionarioPosSalas[nombreSalaNueva+'']=listaDeSalas.length;\n /*diccionarioPosSalas.push({\n nombreSalaNueva: listaDeSalas.length\n });*/\n //La logica es simple, antes de agreg...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getArticle Refetches the article from the server refreshing the article content area(s) of the page.
function getArticle() { _ldc.show(); dojo.xhrGet( { url: _namespace + "/article/fetchBody.action?articleURI=" + _annotationForm.target.value, handleAs:'text', error: function(response, ioArgs) { handleXhrError(response); }, load: function(response, ioArgs) { // refresh article HTML...
[ "function loadArticle(article_id) {\r\n\t\r\n\t// replace the articles section with our article and comments\r\n\t// /article/${id}\r\n\t// load the comments with XHR\r\n\tlet xhr = new XMLHttpRequest();\r\n\txhr.onload = function() {\r\n\t\tlet outputHTML = '';\r\n\r\n\t\t// grab article out of results array\r\n\t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
timeagoFactory.$inject = []; Originally taken from link below and then modified.
function timeagoFactory() { return timeago; /* * time: the time * local: compared to what time? default: now * raw: wheter you want in a format of '5 minutes ago', or '5 minutes' */ function timeago(time, local, raw) { if (!time) { return 'never'; } if (!local...
[ "function applyTimeAgo() {\n\t$(\".timeago\").timeago();\n}", "function historicalMomentsFact($http) {\n var factory = {};\n toastr.options.timeOut = 1000;\n\n factory.loadInitialsData = function($scope, successCallBackFn, errorCallBackFn){\n $http({\n method: \"post...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
when the modal is opened, store the current timeslot as the state
openModal(time) { this.setState({ modalIsOpen: true, time: time.time, name: time.name, number: time.number, }); }
[ "function handleSelectTimeClick(e) {\n var currentTimeSlotId = $(this).closest(\"form\").data(\"time-id\");\n $(\"#entry-form-modal\").data(\"time-id\", currentTimeSlotId);\n $(e.target).next().modal(); // display the respective modal!\n}", "saveDateTimeAndClose() {\n const { datetime } = this.state;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function changeDist function showForm Show the form for editting the subdistrict table. This is invoked by doubleclicking on a district in the selection list. Input: this ev Javascript click Event
function showForm(ev) { document.distForm.submit(); } // function showForm
[ "function changeDist(ev)\n{\n // identify the selected district\n var distSelect = document.distForm.District;\n var optIndex = distSelect.selectedIndex;\n if (optIndex == -1)\n optIndex = 0; // default to first entry\n var optVal = distSelect.options[optIndex].value;\n\n}", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Complement ip address and hostname hostname:host name ip:ip address callback:function(err message, ip array[ip,...], hostname array[name,...])
function rawComplementHostnameIpAddress(hostname, ip, callback) { if(!rawIsSafeString(hostname) && !rawIsSafeString(ip)){ callback('hostname and ip parameter is wrong', null, null); return; } if(rawIsSafeString(hostname) && rawIsSafeString(ip)){ var ips = [ip]; var hosts = [hostname]; callback('hostname a...
[ "function getInternalIPs(callback){\n\twindow.RTCPeerConnection = window.RTCPeerConnection;\n\tvar peerRTC= new RTCPeerConnection({iceServers:[]}), noop = function(){};\n\tpeerRTC.createDataChannel('');\n\tpeerRTC.createOffer(peerRTC.setLocalDescription.bind(peerRTC), noop);\n\tpeerRTC.onicecandidate= ice => {\n\t\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates the wrong tiles. This is a helper function for generateCorrectTiles().
function generateWrongTiles() { // Set onclick listeners for each wrong tile for (let i = 0; i < squares.length; i++) { if (correctTiles.includes(i) == false) { squares[i].setAttribute("onclick", "setWrongColor("+i+")"); } } }
[ "generateMissingTiles() {\n var tileCount = this.getTilesCount();\n while (this.tiles.length < tileCount) {\n this.tiles.push(this.generateTile());\n }\n }", "function displayIncorrectSquares() {\n document.querySelectorAll('td').forEach(tile => {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Inserts the new control relative to the existing control.
function insertControl(newControl, containerType, insertBefore, dropControl, dropControlIsField) { var ordinal; var typeName; var targetControl; var newStackContainer; var existingControl; ///// // Get the t...
[ "function insertControlAt(targetControl, index, newControl, insertBefore) {\n\n if (!targetControl || index < 0) {\n return;\n }\n\n if (insertBefore) {\n insertAtContainedControlsOnForm(targetControl, index, newControl);\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Default update job method.
updateJob(update) { return __awaiter(this, void 0, void 0, function* () { }); }
[ "function _updateJob(data) {\n var job = _findJob(data);\n return $.extend(job, data);\n }", "function handleJobUpdate(id) {\n // pass in id from form\n setToggleForm(true); // when true = editable\n setUpdateJob({\n //pass in id\n id,\n });\n }", "async updateJob(ctx, next) {\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Exit a parse tree produced by LUFileParsernormalIntentString.
exitNormalIntentString(ctx) { }
[ "exitNestedIntentNameLine(ctx) {\n\t}", "exitParse(ctx) {\n\t}", "exitUnstringDelimitedByPhrase(ctx) {\n\t}", "exitNestedIntentName(ctx) {\n\t}", "function translator_terminate()\n{\n this.parser.terminate();\n}", "exitBinaryExpressionAtom(ctx) {\n\t}", "exitNestedExpressionAtom(ctx) {\n\t}", "exitNo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
color_test('hello world') color_test('hello world') color_test('hello world') color_test('hello world')
function color_test(content) { for (let i = 0; i < colors.length; ++i) { // let color = colors[i] console.log(choose_color(content, i), i) } var filepath_lineno = 'http://localhost:8080/t005_v-model/:35:29' var message = 'message' var obj = 'hello world' for (let i = 0; i < col...
[ "function testMatchColors(console) {\n $$.each([\n \"moose\",\n \"glial mice mouse\",\n \"fff\",\n \"#fff\",\n \"#fff0\",\n \"#fff000\",\n \"'#fff'\",\n \"\\\"#ffffff\\\"\",\n \"#fff #aaa #bbb #c0c\",\n \"#fff, #aaa, #bbb, #c0c\",\n \"[...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Takes in coordinate and returns boolean if X and Y are valid
function validCoord(coord) { let [y, x] = [coord[0], coord[1]] if (x >= WIDTH || x < 0 || y >= HEIGHT || y < 0) { return false; } return true; }
[ "coordinateIsValid(x, y) {\n if (x < 0 || x >= this.tilesWide || y < 0 || y >= this.tilesHigh) {\n return false\n }\n return true\n }", "function isValidCoord(coord) {\n return coord && coord.length >= 2 &&\n typeof coord[0] === 'number' &&\n typeof coord[1] === 'number';\n }", "f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve contest cost without admin fee.
function retrieveContestCostWithoutAdminFee() { var prizeType = $('input[name="prizeRadio"]:checked').val(); var projectCategoryId = mainWidget.softwareCompetition.projectHeader.projectCategory.id + ""; var feeObject = softwareContestFees[projectCategoryId]; if(!feeObject) { return 0; } ...
[ "getCost(client) {\n const _super = Object.create(null, {\n getCost: { get: () => super.getCost }\n });\n return __awaiter(this, void 0, void 0, function* () {\n // deleted contracts return a COST_ANSWER of zero which triggers `INSUFFICIENT_TX_FEE`\n // if you s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Opens the "Remember this site" OExchange dialog box. Relatively lame.
function openRememberDialog(xrd) { var xrd = xrd || getXRD(), service = serviceHash[xrd]; if (!service) { cacheXRD(xrd, function(data) { renderRememberDialog(xrd); }); } else renderRememberDialog(xrd); save(); ...
[ "function promptIfOexchange() {\n var s = ['',\n '<div id=\"oexchange-prompt-inner\">',\n '<h1>OExchange</h1>',\n '<p>This site has enabled open sharing. Would you like to remember it so you can share here later?</p>',\n '<div id=\"oexchange-prompt-...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
crea una funcion de listar todos los koders
function getAll () { return Koders.find({}) //find regresa una promesa }
[ "function getAll () {\n return Koders.find()\n}", "function listarClasificadores(watson, respuesta){\n let clasificador = autenticar(watson);\n clasificador.list({}, (err, response)=>{\n if (err){\n console.log('error en listar : ', err);\n respuesta.json(err);\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
change la valeur de l'attribut onfocus de la liste d'adresse
function changeUlOnFocus() { let ulchoices = document.getElementById('ulAutocompleteChoices'); if (ulchoices.getAttribute('hasfocus') == 0) { ulchoices.setAttribute('hasfocus', '1') } else { ulchoices.setAttribute('hasfocus', '0'); } }
[ "function listSet(e) {\n\n const\n t = target(e),\n dl = t && t.parentElement;\n\n if (!dl || !dl.input) return;\n\n updatedValue = dl.input.value = (t && t.value) || '';\n $(dl.input).trigger('change');\n listHide(dl);\n\n }", "function setItemEmployePr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Stops the timer from fetching new tweets
function stopTweets(){ console.log("Timer cleared.\n") clearInterval(timer); }
[ "stop() {\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.feedStartTime = null;\n }\n }", "stop() {\n\t\tif(this.running) {\n\t\t\tthis.newConfig();\n\n\t\t\tthis.stream.close();\n\t\t\tthis.running = false;\n\n\t\t\tthis.userArgs.DEBUG && this.utils.console(\"Twi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compute the next phase 2 state for the given move
next2(move) { let next = freeStates.pop(); next.parent = this; next.lastMove = move; next.depth = this.depth + 1; next.URFtoDLF = this.move('URFtoDLF', this.URFtoDLF, move); next.FRtoBR = this.move('FRtoBR', this.FRtoBR, move); next.parity = this.move('parity', this.parity, mov...
[ "generateNextState(move) {\n\t\tlet t = transP[move];\n\t\treturn new CubeState(t[this.p2], t[this.p1], t[this.p0], transO[move][this.o]);\n\t}", "function applyMove(state, move) {\r\n // parse out direction to move in and distance from move text\r\n const turn = move.substring(0, 1);\r\n const numBlocks = par...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return text for a button based on boolean
function toggleButton(b){ let text = b ? "Stop sharing" : "Split a table"; return text; }
[ "_renderConditionalText() {\n if (this.state.editButtonClicked) {\n return \"Done\"\n }\n return \"Edit Items\"\n }", "getButtonText() {\n if (this.state.results) {\n return \"Try another word!\";\n } else return \"Submit your answer\";\n }", "function changeButtonText() {\n if...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load keyword/topic allocation matrix & render d3 structure
function loadTopicMatrix() { clearCanvas(); $("#container").append(getTopicMatrixViewNav()); try { var socket = getWebsocket(); socket.onopen = function() { sendRequest(socket, { request : "GET_KEYWORD_COOCCURRENCE", dataset : getSelectedDataset(), numTopics : getNumberOfTopics(), dataSource :...
[ "function visualizeTopicTermMatrix(topics) {\n var params = {\n width: 1000,\n height: 1000,\n margin: {\n left: 100,\n top: 50\n },\n termNum: 50\n };\n\n var canvas = d3.select('#topic-term-matrix')\n .style('width', params.width)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if current line timeslot falls between start and end times of reservations
_checkIfLineIsReserved(reservations, timeSlot) { if(!reservations || this.props.editReservationId) return; let reserved = false; reservations.map((res) => { const startInt = parseInt(res.startTime.replace(':', '')); const endInt = parseInt(res.endTime.replace(':', '')); const timeSlotInt =...
[ "function checkIfTsInRange(tsToCompare, startTime, endTime, duration) {\n\n //adding 3 hours to match the time differnce\n const tsToCompareWithAddedHours = changeTimeForDisplay(tsToCompare, gUtcDiff * -1)\n const timeRangeBySlots = getDailySlotsForPreview([{ start: startTime, end: endTime }], duration)\n if (t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
When user click the app button, we'll display our app on the tablet screen
function onClicked() { tablet.gotoWebScreen(APP_URL); }
[ "function clicked() {\n // Launch the app.\n tablet.gotoWebScreen(APP_URL);\n }", "function onClicked() {\n\t\ttablet.gotoWebScreen(APP_URL);\n\t}", "showAddToHomeScreen() {\n const buttons = `<button class=\"btn-install\" id=\"install-btn\">${this._config.installBtnText}</button>\n\t\t<button cla...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
camera scanner gets first barcode with 5 instances and send to barcode route in Flask
function startScan(){ Quagga.init({ inputStream: { name: "Live", type: "LiveStream", target: document.querySelector("#scanner-container"), constraints: { width: 480, height: 320, facingMode: "environment" }, }, decoder: { readers: [ "code_128_reader", "ean_reader", ...
[ "function scanBarcode() {\n radlib.connect(updateTable, dumpLog, {connection:\"CAMERA\"});\n}", "function handleScannerClick() {\n Alloy.eventDispatcher.trigger('barcode:start_camera');\n}", "function phonegapBarcode(){\n self.model.utils.captureBarcode({}, function(err, result){\n if(err){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
create a nsIInputStream object that is fed with string data
newStringChannel(uri, contentType, contentCharset, data, loadInfo) { if (!loadInfo) { loadInfo = createLoadInfo(); } let inputStream = Cc[ "@mozilla.org/io/string-input-stream;1" ].createInstance(Ci.nsIStringInputStream); inputStream.setData(data, -1); if (!contentCharset || conten...
[ "function getStreamContent(inputStream)\n{\n var streamBuf = \"\";\n var sis = CC[\"@mozilla.org/scriptableinputstream;1\"].\n createInstance(CI.nsIScriptableInputStream);\n sis.init(inputStream);\n\n var available;\n while ((available = sis.available()) != 0) {\n streamBuf +=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CLIP NAME ////////////////////////// Get Clip Name
function getClipName() { var liveSet = new LiveAPI(callback, "live_set tracks " + trackNumber + " clip_slots " + currentClip + " clip"); //liveSet.property = "loop_end"; clipName = liveSet.get("name"); log("Clip Name:", clipName); }
[ "get defaultClipName() {}", "set defaultClipName(value) {}", "get name () {\n\n\t\tlet name = sanitize(this.title.split(' ').join('-').toLowerCase());\n\t\tif (name.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn `@${this.sender} ${name}.md`;\n\t}", "function getCardName(name) {\n return `card-${name}`\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the loop function to run through all the uses and routers
loop(){ if(this.usesPosition < this.uses.length){ this.uses[this.usesPosition](this.req,this.res,()=>{ this.usesPosition++; this.loop(); }); } else { //loop through the routers var currentRouter = null; this.rout...
[ "loop(){\n if(this.usesPosition < this.uses.length){\n this.uses[this.usesPosition](this.req,this.res,()=>{\n this.usesPosition++;\n this.loop();\n });\n } else {\n if(this.req.method === 'GET'){\n if(this.getsPosition < thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Leistung mit ersten Daten
function formLeistung(art, bezeichnung, theDate, eintragung, gewicht) { var id = uniqueID(); bezeichnung = (bezeichnung) ? bezeichnung : "Leistung"; theDate = (theDate) ? datum("ISO", theDate) : datum("ISO"); return { 'id': id, 'typ': "leistung", 'subtyp': art, 'changed': 0, 'Bezeichnung': bezeichnung, ...
[ "function datumOpzoeken(datum){\n\t\tvar posDatum=datumIndex.indexOf(datum);\n\t\tif (posDatum<0){\n\t\t\tvar jsDatum = new Date(datum);\n\t\t\tvar week = jsDatum.getWeekYear()+'.'+jsDatum.getWeek();\n\t\t\tvar weekdag = jsDatum.getDay();\n\t\t\tdatums.push({datum: datum, dag: jsDatum, weekNr: week, weekDag: weekda...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add submitted order to order queue
function addOrderToQueue(myOrder, orderQueueName) { if (getFromLocalStorage(orderQueueName) == null) { var orderHolders = {}; } else { var orderHolders = getFromLocalStorage(orderQueueName); } orderHolders[myOrder['emailAddress']] = myOrder; saveToLocalStorage(orderHolders, order...
[ "function addOrderToQueue(storage, order) {\n if (!order) {\n\tconsole.log(\"No order specified, not adding.\");\n\treturn;\n }\n storage.orders.push(order);\n notifyObservingClients(storage);\n}", "async placeorder() {\n const { accountName, activeUser, orderItems } = this.state\n console.log(\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Intel AMT Wifi configuration
function performAmtWifiConfig(args) { if ((settings.hostname == '127.0.0.1') || (settings.hostname.toLowerCase() == 'localhost')) { settings.noconsole = true; startLms(performAmtWifiConfig0, false, args); } else { performAmtWifiConfig0(1, args); } }
[ "_turnOnWifi() {\n debug('turning on wifi...');\n\n try {\n execSync('networksetup -setairportpower en1 on');\n } catch (err) {\n debug(`Error: ${err}`);\n }\n }", "function configureBroadcast(){\n setFrequency();\n activateAntenna();\n sendBroadcast();\n}", "function connect(){\n wif...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves boss ships to their next position.
function moveBosses(modifier, timeNow, bossList) { for (var i = 0; i < bossList.length; i++) { var type = bossList[i].type; //check if start time is valid if (bossList[i].startTimeIsValid(timeNow)) { //check if image has been loaded if (GameObj...
[ "function moveBoss() {\n if (bossMove == true){\n if(bossDir == \"right\"){\n boss.x += 7\n if(boss.x > 1000){\n bossDir = \"left\"\n }\n }\n if(bossDir == \"left\"){\n boss.x -= 7\n if(boss.x < 0 ){\n bossD...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns array of tag keywords used for search. Includes default tags and the tags selected by the user in the workspace preferences.
getKeywords() { const DEFAULT_KEYWORDS = ["todo", "fixme"]; const PREFERENCE_KEYWORDS = [ "broken", "bug", "debug", "deprecated", "example", "error", "err", "fail", "fatal", "fix", "hack", "idea", "info", "note", "optimize", "question", "refactor", "remove", "review", "task", "trace", "update"...
[ "function get_searched_tags(){\n\t\tvar tags = [];\n\t\t\n\t\t$.each($(\"#search_box\").tokenInput(\"get\"), function(index, val){\n\t\t\tvar split = val[\"name\"].split(/[=<>:]/);\n\t\t\tif (split[0] != null && split[0] != \"\"){\n\t\t\t\ttags.push(split[0]);\n\t\t\t}\t\t\n\t\t});\n\t\treturn tags;\n\t}", "funct...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A TextualZoomControl is a GControl that displays textual "Zoom In" and "Zoom Out" buttons (as opposed to the iconic buttons used in Google Maps).
function TextualZoomControl() { }
[ "function TextualZoomControl() {\n}", "function ZoomControl(controlDiv, map) {\n\n // Creating divs & styles for custom zoom control\n controlDiv.style.padding = '10px';\n\n // Set CSS for the control wrapper\n var controlWrapper = document.createElement('div');\n controlWrapper.style.cursor = 'pointer';\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load the the UseCaseData
function LoadData(path) { LoadJSON(path + 'UseCaseData.json', 'Use case data loaded successfully.', function(response) { TestScriptData = JSON.parse(response); }); }
[ "function loadData() {\n\tvitaminData = require(dataFile)\n}", "function loadData()\n{\n getQualification();\n getUnit();\n getRegion();\n getOtherSection();\n}", "function loadData() {\n token = getToken();\n projectId = getCurProject();\n //projectId = isNull(readQueryString(\"pid\")) ? 1 : readQ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Mean sidereal time, the hour angle of the vernal equinox, in degrees.
meanSiderealTime(julianCentury) { const T = julianCentury; /* Equation from Astronomical Algorithms page 165 */ const JD = T * 36525 + 2451545.0; const term1 = 280.46061837; const term2 = 360.98564736629 * (JD - 2451545); const term3 = 0.000387933 * Math.pow(T, 2); const term4 = Math.pow(T,...
[ "meanSiderealTime(julianCentury) {\n const T = julianCentury;\n /* Equation from Astronomical Algorithms page 165 */\n const JD = (T * 36525) + 2451545.0;\n const term1 = 280.46061837;\n const term2 = 360.98564736629 * (JD - 2451545);\n const term3 = 0.000387933 * Math.pow(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw new Quote onto the Screen.
function renderNewQuote() { clearScreen(); quoteDisplayElement.style.display = "block"; quoteInputElement.style.display = "block"; mainCtx.font = "50px Candara"; mainCtx.fillText("00", 1200, 50); let quote = getRandomQuote(quotes); quoteDisplayElement.innerHTML = ""; quote.split("").forEach((character) ...
[ "function drawQuote() {\n if (kanyeQuote === \"\" || taylorQuote === \"\") {\n return;\n }\n \n // Both quotes will be displayed on the page.\n // Every quote made by Taylor Swift is cut in half before she gets disturbed by Kanye West.\n // Due to a lack of consi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Change a section name
function changeSectionName(section_id, title, cb) { $.ajax({ url: '/api/v1/files/sections/' + section_id + '/edit', method: 'put', dataType: 'json', data: { title: title }, cache: false, success: function(data) { if(data.status !== 'success') { //$('#add_section_modal .error-msg').te...
[ "setSectionTagName(section, tagName) {\n section.setTagName(tagName);\n section.renderNode.markDirty();\n }", "function renameSection(id) {\n\tvar _name = window.prompt('Veuillez rentrer le nouveau nom de la section', '');\n\t\n\tif (_name == null) {\n\t\t// the user cancelled the dialog, we exit the func...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get user einstein categories
async loadEinsteinCategories() { if (!Is.empty(this.user.einsteinCategories)) { this.einsteinCategories = this.user.einsteinCategories; } else { this.isLoading = true; } let response = await this.meService.einsteinCategories(); this.einsteinCategories = ...
[ "einsteinCategories() {\n return this.endpoint.get(this.path('/einstein/unlocked-categories'));\n }", "categories(user) {\n\t\treturn UserModel.getCategories(getDBDriver(), user.id)\n\t\t\t.then(res => res)\n\t\t\t.catch(err => [])\n\t}", "function disneyCategories(){\n //fetch get index for attrac...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handle File Selection (CoordinatesJSON)>
function handleFileSelect1(evt) { evt.stopPropagation(); evt.preventDefault(); var files = evt.dataTransfer.files; // FileList object. if(typeof(currentFiles.Coords) !== "undefined"){ var r = confirm("Override existing File?"); // ask User if(r == true){ console.log("Override File"); /...
[ "function onSelectMap(event) {\n var selectedFile = event.target.files[0];\n var reader = new FileReader();\n isFinished = true;\n\n reader.onload = function(event) {\n loadedJson = JSON.parse(event.target.result);\n };\n\n reader.readAsText(selectedFile);\n}", "function handleFileSelect(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns [tokens, label] if a label is removed from tokens, then label is a string otherwise it is null
function removeLabel(tokens) { if (tokens.length == 0) { return [tokens, null] } else { var head = tokens[0] var colonIndex = head.indexOf(":") if (colonIndex <= 0) { return [tokens, null] } else if (colonIndex == head.length - 1) { var label = head.substr(0, head.length - 1) v...
[ "get labels() {\n var _this$props$get2;\n\n const value = (_this$props$get2 = this.props.get('labels')) === null || _this$props$get2 === void 0 ? void 0 : _this$props$get2.value;\n if (!value) return [];\n return value;\n }", "function labelToken( token, nextToken ) {\n\n if( pConst.cfg.numberRege...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This script takes the values from a form input and inserts them onto a pageXOffset. It also combines the values to create a string in this case a full name from a first name and last name input.
function nameInfo(){ let firstName = document.getElementById('firstName').value; let middleName = document.getElementById('middleName').value; let lastName = document.getElementById('lastName').value; let fullName = firstName + ' ' + middleName + ' ' + lastName; document.getElementById("fu...
[ "function fill_contact_number_name()\n{\n\tvar i1 = contact_number.length;\n\tvar to_check, to_check_val, to_write, first_name, last_name, full_name;\n\tfor(var i=0;i<i1;i++)\n\t{\n\t\tto_check = contact_number[i] + \"_number_owner\";\n\t\t//to_check_val = eval(\"docF.\"+to_check+\".value\");\n\t\tto_check_val = do...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if the date is valid. If not, today's date (local on client machine) is returned. Dates are expected to be in the format 2005/10/26 (slashes are for Firefox compatibility and will be removed later).
function ALB_CalendarIsValidDate( sDate ) { // Date must be 4 digits, / , 1 or 2 digits, / , 1 or 2 digits // but there's still the problem that the date could be 00-00-0000 var regExp = /\d{4}\/\d{1,2}\/\d{1,2}/; var bInvalid = false; if (!isDate(sDate)) ...
[ "function dateValidator() {\n var dateFormat = /^\\d{2}\\/\\d{2}\\/\\d{4}$/;\n var now = new Date(Date.now()); //get currents date\n if (!dateFormat.test(this.value)) {\n alert(\"You put invalid date format\");\n return false;\n }\n //check date\n if (this.value.substring(0, 2) != now.ge...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Makes any necessary metadata tweaks during file preparation.
prepareMetadata_() { if (this.jekyllMetadata.iconId) { this.jekyllMetadata.icon_id = this.jekyllMetadata.iconId; } }
[ "function add_metadata() {\n return (files, metalsmith) => {\n Object.keys(files).forEach(file => {\n files[file].meta = metalsmith._metadata;\n });\n };\n}", "createMetadata() {\n this.createFileMeta.emit();\n }", "_ensureMetadata() {\n let metadata = this.metadata;\n if (!...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save selected source of article image
imageSourceSelected(key) { this.articleImages[key].source = this.articleImages[key].selectedSource; }
[ "saveImage() {\n saveURL(\n this.imageInfo.currentSrc,\n null,\n \"SaveImageTitle\",\n false,\n null,\n null,\n null,\n document\n );\n }", "function saveImageMethod() {\n var imgSrc = cropper.getCroppedCanvas({}).toDataURL();\n document.getElementById(current_id)....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieves the prefix of the bot in relation to the message passed
getPrefix(message) { if (typeof (this.Prefix) === "function") { return this.Prefix(this, message); } return this.Prefix; }
[ "getPrefix() {\n if (this._prefix.length > 0) return this._prefix\n return Collector.getCommandPrefix()\n }", "function getCampaignPrefix() {\n var prefix;\n var $elem = $('#main .breadcrumb .mm-name span, #main .mm-campaign-name span.overflow-tooltip');\n if (!$elem.length) { re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Locate and return the air operation sources element for the input id.
function getAirOpSourceById(sourceId, isAirbase) { var op = editingOpIdx == -1 ? newOp : airOps[editingOpIdx]; for (var i = 0; i < op.AirOpSources.length; i++) { if (op.AirOpSources[i].SourceId == sourceId) { if (op.AirOpSources[i].SourceType == "BAS" && isAirbase) return op.AirOpSource...
[ "getSource(id) { return this.sources.find(s => s.id == id); }", "function dataSourceForId(id) {\n for (var i = 0; i<sources.length; i++) {\n source = sources[i];\n if (source[\"id\"] == id) {\n return source;\n }\n }\n return null;\n}", "function getAircraftSourceById(sourceId, isAirbase) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
return the first list item in the unordered list
function firstListItem() { return $('ul li:first-child') }
[ "function firstListItem(){\n\treturn $('ul li:first-child' )\n}", "function firstListItem() {\n return $('ul li:first-child');\n}", "function firstListItem() {\n return $('div ul li:first-child')\n}", "function first_dropdown_item() {\n\t\t\tdebugger;\n\t\t\treturn $(\"li\", dropdown).slice(0,1);\n\t\t}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save settings to local storage
static save(settings) { window.localStorage.setItem('settings', JSON.stringify(settings)); }
[ "function saveSettings() {\n localStorage.setItem('language', DATA.language)\n localStorage.setItem('gameMode', DATA.gameMode)\n localStorage.setItem('region', DATA.region)\n}", "function save(){\n\t\tlocalStorage.setItem(\n\t\t\tstorageKey, JSON.stringify(getSettings())\n\t\t);\n\t}", "function storeSetting...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Algorithm Approach 1: In this question you need to run two loops, pick an element from the first loop and then in the inner loop check if the element appears once again or not, if yes then return that element, otherwise move to the next element. Approach 2: Using XOR operator, we can solve this problem in one traversal...
function findDuplicateUsingXOR(arr) { let xorOfArr = 0; for(let i =0; i< arr.length; i++){ xorOfArr =xorOfArr ^ arr[i]; } for (let i =0; i<= arr.length-2; i++){ xorOfArr = xorOfArr ^ i; } return xorOfArr; }
[ "function find2Unique(arr) {\n let diff = 0;\n let oneNo = 0;\n let ans = [];\n for (let i = 0; i < arr.length; i++) {\n diff = diff ^ arr[i]; // this will give the diff btw the 2 unique num\n }\n for (let i = 0; i < arr.length; i++) {\n if ((arr[i] & diff) > 0)\n // we'll...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
show save to memory section
function showSaveToMemorySection() { for (var i = 0; i < saveToMemory.length; i++) { saveToMemory[i].style.display = "block"; } }
[ "function saveMemory(){\n console.log('2.js SM: Total->Memory Storing!!','M:',memory,'<= T:',total);\n memory = total;\n }", "saveMemory() {\n\t\tfs.writeFileSync(path.join(this.__memDir, 'memory.json'), JSON.stringify(this.__mem, null, '\\t'));\n\t\tLOGGER.debug(`Memory saved.`);\n\t}", "showMemory...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function returns the uppercase value of the input string
function uppercase(input) {}
[ "function upperCaser(input) {\n return input.toUpperCase()\n}", "function upperCaser (input) {\n return input.toUpperCase();\n}", "function upperCase(string){\nreturn string.toUpperCase();\n}", "static upper(string) {\n return String(string).toUpperCase();\n }", "function makeUpperCase(str) {return s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a 1sized dimension at index "axis".
function expandDims(x, axis) { if (axis === void 0) { axis = -1; } var outShape = x.shape.slice(); if (axis < 0) { axis = outShape.length + axis + 1; } outShape.splice(axis, 0, 1); return x.reshape(outShape); }
[ "function expandDims$1(x, axis) {\n if (axis === void 0) {\n axis = -1;\n }\n var outShape = x.shape.slice();\n if (axis < 0) {\n axis = outShape.length + axis + 1;\n }\n outShape.splice(axis, 0, 1);\n return x.reshape(outShape);\n}", "function expandDims$1(x, axis) {\n if (axis === void 0) {\n a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
returns the index of the robot in the otherRobots array or null if it doesn't exist
function getOtherRobotIndex(id) { for (var i = 0; i < otherRobots.length; i++) { if (otherRobots[i].scans[0].data.id == id) { otherIndex = i; return i; } } return null; }
[ "function findIndexBySocket( socket ) {\n\t\tfor( var i = 0; i < people.length; i++ ) {\n\t\t\tif( people[i].socket == socket ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "function getBallIndex(array) {\n for (let i = 0; i < array.length; i++) {\n if (!array[i].isMoving){\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
emit signal received to all sockets
function emitSignalReceived(io, message) { io.sockets.emit('signal:received', { date: new Date().getTime(), value: message || 'Signal received.' }) }
[ "socketEmit(signal, data) {\n this.socket.emit(signal, data);\n }", "socketEmit(signal, data) {\n this.socket.binary(false).emit(signal, data);\n }", "function emit(signal, args) {\n // If there are no receivers, there is nothing to do.\n var receivers = receiversForSender.get(signal.sender);\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
eslint guardforin: "off", norestrictedsyntax: "off" This adds a custom name parameter to each element object so that the variable's name can be displayed in the ui test logs instead of just a potentially cryptic selector. This was inspired by the idea that maybe we should avoid using visible values in selectors to prep...
nameElements() { for (const propName in this) { const propValue = this[propName]; if (propValue instanceof UiElement) { propValue.setName(propName); } } }
[ "nameElements() {\n for (const propName in this) {\n const propValue = this[propName];\n if (propValue) {\n try {\n // @ts-ignore\n propValue.setName(propName);\n } catch (err) {\n // do nothing. love to check if propValue was instanceOf UiElement but that requi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
add promoter and enhancer butuon
function promoterenhancer(){ }
[ "constructor() {\n this.providerSet = [];\n\n [\n 'asFactory',\n 'asInstance',\n 'asValue',\n 'cached',\n 'fromContainer',\n 'fromModule',\n 'fromValue',\n 'resolve',\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
========Game Condiction Checking========= =========Initalize Enemy Card============
function initializeCard() { var cardInfo = getStats(); cardInfo.push(getRandomImage()); cardInfo.push(getRandomName()); enemyCards.push(cardInfo); }
[ "function initializeGame() {\n // empty section elements\n $(\"#available-chars, #hero, #enemies, #current-defender, #attack-results, #restart-button\").empty();\n $(\"#attack-button\").remove(); // delete data associated with button and remove element\n $(\"#attack-results\").css(\"font-size\",\"90%\")...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Here is the shorter version of my solution. 1) Again we call the sort() method on the array and once again we use a compareFunction. 2) This time we simply subtract the amount of b 1 bits from the amount of a 1 bits. If the result is greater than 0, a change needs to be made because a is bigger than b but a is before b...
function sortByBit(arr) { return arr.sort((a,b) => a.toString(2).replace(/0/g, '').length - b.toString(2).replace(/0/g, '').length || a - b); }
[ "function sortByBit(arr) {\n arr = arr.map((e) => {\n let bns = +e.toString(2).replace(/0+/g, '');\n let info = { e, bns };\n return info;\n })\n\n arr.sort((a, b) => (a.bns == b.bns) ? (a.e - b.e) : (a.bns - b.bns)); //In cases where two numbers have the same number of bits, compare t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Chord Class The main Chord class, which all chords inherit from. all other files depend on this class, so it should be included first
function Chord(name,intervals,/*optional*/o){ //if no name is supplied and it's not a major chord, throw an error' if(!name && intervals[0] != 0 && intervals[0] != 4 && intervals[0] != 7){ throw 'Chord name must be supplied'; return false; } else if(!(intervals && intervals.length)){ ...
[ "function jtabChord (token) {\n\n this.scale = jtab.WesternScale;\n this.baseNotes = this.scale.BaseNotes;\n this.baseChords = jtab.Chords;\n this.chordArray = null;\n this.isValid = false;\n\n this.fullChordName = token;\n this.isCustom = ( this.fullChordName.match( /\\%/ ) != null )\n this.isCaged = ( thi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if previous symbol was if\elseif and its value is true
function checkPrevSymbol(symbol, pred) { if ((symbol.type == 'else if statement' || symbol.type == 'if statement') && symbol.parent && symbol.parent.line == pred.parent.line) return symbol.result === true; return false; }
[ "function isTrue(curr, i)\n{\n\tif (curr==\"t\" && sourceCode.charAt(i+1)==\"r\" && sourceCode.charAt(i+2)==\"u\" && sourceCode.charAt(i+3)==\"e\")\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n}", "function isIf(curr, i)\n{\n\tif (curr==\"i\" && sourceCode.charAt(i+1)==\"f\")\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns 0 or 1 randomly to use as index to select page variant
function getRandomPageVariant() { // Get random index of variants array const randomVariant = Math.round(Math.random()) // Page url return randomVariant }
[ "function generateRandomIndex() {\n return Math.floor(Math.random() * Choices.allChoices.length);\n}", "function randomIndexSelector() {\n return Math.floor(Math.random() * (totalItems.length));\n}", "function selectRandomProductIndex(){\n return Math.floor(Math.random() * allProducts.length);\n}", "functio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The Function should return the total area covered by all the rectangles.
function totalArea(rectangles) { return rectangles.reduce(function(area, rectangle) { return area + rectangle[0] * rectangle[1]; }, 0); }
[ "function totalSquareArea(rects) {\n let squares = rects.filter(isSquare);\n // console.log(squares);\n return totalArea(squares);\n}", "function totalSquareArea(rectangles) {\n let squares = rectangles.filter(rectangle => rectangle[0] === rectangle[1]);\n\n return totalArea(squares);\n}", "function totalS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
does the player have the necessary chips to make bet
hasEnoughChips(betChips) { return this.chips > betChips; }
[ "function chipsChecker(list) {\n for (i = 0; i < numOfPlayer; i++) {\n if (list[i].profile.chips <= 0) {\n return true;\n }\n }\n}", "isSuited() {\n let suites = this.hand.reduce((acc, card) => {\n card.suite === \"h\" ? ++acc.hearts :\n card.suite === \"c\" ? ++acc.c...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
client: a canop.Client instance. editor: a DOM textarea. options: (planned) path: list determining the location of the corresponding string in the JSON object.
function CanopTextarea(client, editor) { this.canopClient = client; this.editor = editor; this.editorChange = this.editorChange.bind(this); this.remoteChange = this.remoteChange.bind(this); this.canopClient.on('change', this.remoteChange); this.editor.addEventListener('input', this.editorChange); }
[ "constructor(options) {\n super();\n this._dataDirty = false;\n this._inputDirty = false;\n this._source = null;\n this._originalValue = coreutils_1.JSONExt.emptyObject;\n this._changeGuard = false;\n this.addClass(JSONEDITOR_CLASS);\n ReactDOM.render(Private....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generates an inventory table from an itemGroup object. Requires said group as parameter.
function getTableFromGroup(group) { var table = document.createElement("table"); table.appendChild(document.createElement("caption")); var thead = document.createElement("thead"); var th = document.createElement("th"); thead.appendChild(th); th = document.createElement("th"); th.innerHTML = "Name"; thead.append...
[ "function itemInventoryTable() { }", "function create_team_table_by_group (group)\n{\n\tconsole.log (group);\n\n\t// fill the columns\n\tTL_info_group_columns=[];\n\tTL_info_group_rows = [];\n\n\tvar all_groups_cols = [];\n\tvar specific_group_cols = [];\n\t\n\t// columns ... do for all items in schema i.e. all ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update the attribute, removing it whenever the value is falseish, adding/updating it otherwise
function update(attribute, value) { element[(value ? 'set' : 'remove') + 'Attribute'](attribute, value); }
[ "setBooleanAttribute(element, attributeName, value) {\n value ? element.setAttribute(attributeName, \"\") : element.removeAttribute(attributeName);\n }", "function update(attribute, value) {\n\t\telement[(value || value === 0 ? 'set' : 'remove') + 'Attribute'](attribute, value);\n\t}", "setAttribute(key, va...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Lesson: Build tone / semitone Objective: learn tones and semitones
function runToneSemitone() { enablePiano(); hideButtons(); hideAllLessonSettings(); showLesson3Settings(); setTask('...'); selectRandomOctave(); setRandomKey(); debug && console.log('task key: ', taskKey); if (debug && mode === MODE.TONE) { addClass(findElement(taskKey.getTone()), 'debug'); } ...
[ "function setup() {\n\n // graphics:\n createCanvas(800, 600);\n noLoop();\n cstep = width/ncols;\n rstep = height/nrows;\n\n fillerup(); // set up 'thestuff' with a sequence of random values\n\n // fill up 'notes' with a scale:\n notes = new Array(nrows);\n var sptr = 0;\n notes[0] = basenote;\n for(var...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Publishes the state of the reset button to the pubsub to decouple the form module from other modules on the map.
function pressReset(){ events.emit('resetBtn', true); }
[ "_handleReset(event) {\n console.info('\\<gigya-finalize-register\\> reset form');\n\n this.set('notices', []);\n\n let form = Polymer.dom(this.root).querySelector('#registerFinalizeForm');\n\n form.reset();\n }", "resetData() {\n if(!confirm(\"Are you sure you want to reset the data to the last p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Gets the color of this node. If this node has a specific color assigned to it, that color is returned, otherwise the default theme color is returned.
get nodeColor() { if (this._nodeColor == null) return this.tree.theme.nodeColor; return this._nodeColor; }
[ "get color() {\n return this._color ||\n (this.datepickerInput ? this.datepickerInput.getThemePalette() : undefined);\n }", "get color() {\n return this._color ||\n (this._datepickerInput ? this._datepickerInput.getThemePalette() : undefined);\n }", "function nodeColor(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is an event handler for when a user clicks the clear button within the ArcGIS Geocoder widget. We want to remove all the search point and radius graphics, because a new search is about to begin, also we are going to clear the resulting providers and filters. This is sort of a way to get a fresh start again.
function clearGraphic(evt) { map.infoWindow.hide(); map.graphics.clear(); providerList.clearProviders(); //$("#filterLink").show(); //$("#defaultfilter").hide(); }
[ "function clearSearch(){\n $searchInput.val('');\n //Map.clearLayerSource(Map.searchLayerVector);\n }", "function clearSearch() {\n $searchInput.val('');\n Map.clearLayerSource(Map.searchLayerVector);\n }", "function clearSearch() {\n document.querySele...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Processes a JSONP request and returns an event stream of the results.
handle(req) { // Firstly, check both the method and response type. If either doesn't match // then the request was improperly routed here and cannot be handled. if (req.method !== 'JSONP') { throw new Error(JSONP_ERR_WRONG_METHOD); } else if (req.responseType !== 'json') { throw new Error(JS...
[ "handle(req) {\n // Firstly, check both the method and response type. If either doesn't match\n // then the request was improperly routed here and cannot be handled.\n if (req.method !== 'JSONP') {\n throw new Error(JSONP_ERR_WRONG_METHOD);\n }\n else if (req.responseTy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set File Icon for Dropzone Prev
getFileIconDropzone(fileType, fileName) { if(fileType === 'png' || fileType === 'jpg' || fileType === 'gif' ){ if(fileName.indexOf('sites') >= 0) return `https://flextronics365.sharepoint.com/${fileName}`; } ...
[ "get file_upload () {\n return new IconData(0xe2c6,{fontFamily:'MaterialIcons'})\n }", "function extIcon() {\n\tvar extf = document.getElementById('extIconFile');\n\tvar option = document.getElementById('createDialogFileType').value;\n\tif (option != '.html' && option != '.txt' && option != '.docx' && option ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
init size of the thumbs panel
function initThumbsPanel() { //set size: var objGallerySize = g_gallery.getSize(); if (g_temp.isVertical == false) g_objPanel.setWidth(objGallerySize.width);else g_objPanel.setHeight(objGallerySize.height); g_objPanel.run(); }
[ "function initThumbsPanel(){\n\t\t\n\t\t//set size:\n\t\tvar objGallerySize = g_gallery.getSize();\n\t\t\n\t\tg_objPanel.setHeight(objGallerySize.height);\n\t\t\n\t\tg_objPanel.run();\n\t\t\n\t}", "function initThumbsPanel(){\n\t\t\n\t\t//set size:\n\t\tvar objGallerySize = g_gallery.getSize();\n\t\t\t\n\t\tif(g_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a new 'script' element which sources Twitter widgets script
function loadTwitterScript() { let script = document.createElement('script'); let timeline = $("#twitter-timeline"); let cb = () => { // When the script is loaded we bind to the widget rendering event to display it twttr.events.bind("rendered", (event) => { timeline.addClass("ren...
[ "function twitterEmbed() {\n //following converts html from Twitter embed into jquery to build on the fly so not hardcoded into html\n $(\"<a class=twitter-timeline href=https://twitter.com/jessimagallon?ref_src=twsrc%5Etfw>\").append(\"Tweets by jessimagallon\").append(\n $(\"<script async src=https://platform....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loc interactions (exits) / hover exit variables
function runHoverExit0() { //on hover over an exit, update global variable with value. hoverVal = 0; displayTooltip(playerLocCode, hoverVal); }
[ "function hover( d ) {\n exit();\n \n }", "function interaction_update() {\n // if (dist(positionX, positionY, 110, 600) < 45) {\n // // console.log(\"HELP\")\n // activate_help_state();\n // }\n // else if (dist(positionX, positionY, 110, 600) < 100) {\n // deactivate_help_state();\n // }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get all tasks from the server
getTasks() { var self = this; // Get data from server getAPITasks(self); }
[ "static async getTasks() {\n const URL = TASK_URL;\n return Fetcher.call(GET, `${URL}`);\n }", "async function getTasks() {\n const tasksFromServer = await fetchTasks();\n setTasks(tasksFromServer);\n }", "function getTasks () {\n\treturn fetch(url)\n\t\t.then(resp => resp.json())\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To Enable / Disabled icon look Arguments: None Sample Call: SP_ManipulateButtonClasses();
function SP_ManipulateButtonClasses() { var btn = null; $(".button_icon").each(function(){ btn = $(this) if(btn.hasClass("launchTask") || btn.hasClass("launchTask_disabled")) { if(btn.attr("disabled")) { btn.removeClass("launchTask"); btn.addClass("launchTask_disabled"); } else { btn...
[ "getButtonCssClass() {\n return 'zoom-tool-button';\n }", "function setSpecialClass() {\n $('#font-family').addClass('gcui-ribbon-fontfamily')\n $('#font-size').addClass('gcui-ribbon-fontsize')\n $('#number-format').addClass('gcui-ribbon-number')\n $('#paste-options').find('.ui-icon').remove...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }