Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
locale: string; // Custom specified locale ID
function CandyDate(date) { // if (!(this instanceof CandyDate)) { // return new CandyDate(date); // } if (date) { if (date instanceof Date) { this.nativeDate = date; } else if (typeof date === 'string') { this.nativeDate = new Date(date); } else { throw new Error('The input date type is not supported ("Date" and "string" is now recommended)'); } } else { this.nativeDate = new Date(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLocaleId() {\n return LOCALE_ID;\n}", "function getLocaleId() {\n return LOCALE_ID;\n}", "function getLocaleId() {\n return LOCALE_ID;\n}", "function getLocaleId() {\n return LOCALE_ID;\n}", "function getLocaleId() {\n return LOCALE_ID;\n}", "function getLocaleId() {\n retur...
[ "0.7984865", "0.7984865", "0.7984865", "0.7984865", "0.7984865", "0.7984865", "0.7927544", "0.7893955", "0.7623716", "0.7549621", "0.7513653", "0.70934784", "0.6998832", "0.69582325", "0.69056827", "0.69056827", "0.69056827", "0.69056827", "0.69056827", "0.69056827", "0.68905...
0.0
-1
| | Lifecycle hooks |
function NzSliderComponent(utils) { this.utils = utils; // Debugging this.nzDebugId = null; // Static configurations (properties that can only specify once) this.nzStep = 1; this.nzMarks = null; this.nzMin = 0; this.nzMax = 100; this.nzDefaultValue = null; this.nzOnAfterChange = new EventEmitter(); this._disabled = false; this._dots = false; this._included = true; this._range = false; this._vertical = false; this.value = null; // CORE value state this.cacheSliderStart = null; this.cacheSliderLength = null; this.prefixCls = 'ant-slider'; this.activeValueIndex = null; // Current activated handle's index ONLY for range=true this.track = { offset: null, length: null }; // Track's offset and length this.bounds = { lower: null, upper: null }; // now for nz-slider-step this.onTouched = function () { } // onTouch function registered via registerOnTouch (ControlValueAccessor). ; // onTouch function registered via registerOnTouch (ControlValueAccessor). this.isDragging = false; // Current dragging state }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onInitialize() {}", "onInit() {}", "postConstruct() {}", "beforeDestroy(){\n //Antes de destruir la instancia\n console.log('beforeDestroy')\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "constructor () {\n ...
[ "0.7029297", "0.6864453", "0.6698177", "0.66521275", "0.6603429", "0.6603429", "0.6603429", "0.65905166", "0.65792835", "0.657214", "0.6566553", "0.6566553", "0.6560154", "0.65218765", "0.65218765", "0.65218765", "0.65218765", "0.65218765", "0.65218765", "0.65218765", "0.6521...
0.0
-1
Problem 5: Background: India is a nation of many languages. Hindi is spoken, or at least understood, in many regions. English is spoken in many cities as well. In Bangalore, Kannada is the local language. Urdu is another language spoken in some parts of India. What is interesting about Urdu is that, unlike most languages, it is written right to left. Problem statement: A company released a newspaper advertisement containing text in Hindi, Urdu, and English. However it made a mistake in writing the Urdu words left to right instead of right to left. Write a program to correct the mistake and restructure the input into one line, and also to count the total words in the advertisement. Note that the words are provided in the form of a nested array. The Urdu words are in the second array. Example: [ ["zara", "dhyaan", "dein"], ["mazarat", "chahenge"], // reverse this line ["attention", "please"] ] Given an advertising text: zara dhyaan dein mazarat chahenge attention please When I correct the text Then the result should be: zara dhyaan dein chahenge mazarat attention please count: 7
function changeElementText(element, fixedAdvert) { $(element).text(sum); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAnadiplosisCount() {\r\n text = workarea.textContent;\r\n search_string = \"[a-zA-Zа-яА-ЯёЁ]+[.?!;]{1,3}\\\\s[a-zA-Zа-яА-ЯёЁ]+\";\r\n middle_words = text.match(/[a-zA-Zа-яА-ЯёЁ]+[.?!;]{1,3}\\s[a-zA-Zа-яА-ЯёЁ]+/g);\r\n new_phrases = [];\r\n result = [];\r\n if(middle_words != null) {\r\n for (i...
[ "0.6602132", "0.6245358", "0.6244223", "0.61439437", "0.6087164", "0.6068919", "0.59454286", "0.59322137", "0.58747065", "0.5854746", "0.58455867", "0.5835294", "0.5824434", "0.58232313", "0.5819031", "0.5778173", "0.57751125", "0.5756509", "0.5748078", "0.569771", "0.5697555...
0.0
-1
Check if the column of the last move is completed
function checkCol(board, x, player){ if(board[x][0] == player && board[x][1] == player && board[x][2] == player) return true; else return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isColumnComplete(player)\r\n {\r\n for(var col=0; col<3; col++)\r\n {\r\n numCells = 0;\r\n for(var row=0; row<3; row++)\r\n {\r\n if(cellValue(row, col) == player)\r\n {\r\n numCells++;\r\n }\r\n }\r\n if(numCells == 3)\r\n {\r\n r...
[ "0.7052778", "0.6924038", "0.68343455", "0.6623863", "0.65517557", "0.6526866", "0.6390213", "0.6385907", "0.63431305", "0.6333813", "0.63073057", "0.6302315", "0.6293104", "0.62687755", "0.6192866", "0.6150302", "0.61242425", "0.6115739", "0.6113385", "0.6087621", "0.6070456...
0.0
-1
Check if the line of the last move is completed
function checkLine(board, y, player){ if(board[0][y] == player && board[1][y] == player && board[2][y] == player) return true; else return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lookForCompletedLines()\n\t{\n\t\tvar g = grid, nr = self.numRows, nc = self.numColumns, line;\n\t\tvar completedLines = [];\n\t\tfor(var r = nr; r-->0;)\n\t\t{\n\t\t\tline = true;\n\t\t\tfor(var c = nc; c-->0;)\n\t\t\t{\n\t\t\t\tif(!g[r][c])\n\t\t\t\t{\n\t\t\t\t\tline = false;\n\t\t\t\t\tbreak;\n\t\t\t\t...
[ "0.69208527", "0.6578727", "0.6574955", "0.65201783", "0.64349455", "0.6395678", "0.6321027", "0.63072926", "0.6241137", "0.6221219", "0.6204334", "0.6193741", "0.6146206", "0.61393154", "0.6130795", "0.6115773", "0.6081474", "0.6079193", "0.60728246", "0.6048432", "0.60403",...
0.0
-1
Check if the diagonal of the last move is completed
function checkDiag(board, player){ if(board[0][0] == player && board[1][1] == player && board[1][1] == player){ return true; } if(board[0][2] == player && board[1][1] == player && board[2][0] == player){ return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isWinningMove() {\n var hori = count(0, -1) + count(0, 1) - 1;\n var vert = count(-1, 0) + count(1, 0) - 1;\n var diag = count(1, -1) + count(-1, 1) - 1;\n var antd = count(1, 1) + count(-1, -1) - 1;\n // console.log(\"horizontal: \" + hori);\n // console.log(\"vertical: \" + vert);\n ...
[ "0.7269041", "0.71088964", "0.68663085", "0.6846417", "0.67951465", "0.6676342", "0.662169", "0.6601882", "0.65872025", "0.65832007", "0.65507823", "0.6508399", "0.6487655", "0.6445982", "0.64306515", "0.64227057", "0.63982576", "0.63799065", "0.6376625", "0.6375214", "0.6369...
0.6347996
23
Check if the position selected is valid
function checkPosition(id, x, y){ let gameJson = reader.read(id).game; let gameMoves = gameJson.movements; if(x < 0 || x > 2 || y < 0 || y > 2) return WRONG_POS; for(let i = 0; i < gameMoves.length; i++){ if(gameMoves[i].movement.x == x && gameMoves[i].movement.y == y) return WRONG_POS; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isValid(position) {\n\t\treturn position.x >= 0 && position.x < this.width\n\t\t && position.y >= 0 && position.y < this.height;\n\t}", "isValidPos(pos) {\n try {\n let x = pos[0];\n let y = pos[1];\n return ( (x > -1 && x < 8) && (y > -1 && y < 8) );\n } catch (error) {\n \n }\n ...
[ "0.7123742", "0.6987946", "0.6901161", "0.68082887", "0.66447794", "0.6625849", "0.6562076", "0.65539867", "0.65338767", "0.652088", "0.6461782", "0.6403057", "0.63475835", "0.63315517", "0.63075584", "0.6232632", "0.61963415", "0.615987", "0.61591196", "0.6151791", "0.613426...
0.0
-1
Check if the game already finished
function checkEnd(id){ let gameJson = reader.read(id).game; if(gameJson.gameState == "Finished") return END; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isFinished() {\n if(this.noMoreTurns()||this.getWinner()!==null)\n return true;\n else\n return false;\n\n }", "_checkIfComplete() {\n\n\t\tif(this._matchedCards === this.rows*this.cols) {\n\n\t\t\t// Delay for the animations\n\t\t\tsetTimeout(() => {\n\n\t\t\t\talert(`You have score...
[ "0.76427466", "0.75901294", "0.7515177", "0.7477865", "0.74562544", "0.737909", "0.7303943", "0.72832525", "0.72832525", "0.7264419", "0.71999615", "0.7139335", "0.7131091", "0.7120752", "0.7042524", "0.70148474", "0.7011935", "0.7009413", "0.6982949", "0.6980421", "0.6942211...
0.68045783
27
Check if the game ID exists
function checkId(id){ // Read returns "ID_NOT_FOUND" if after iteration it doesnt find game with // specified ID let gameJsonArray = reader.read(id); if(gameJsonArray == "ID_NOT_FOUND") return WRONG_ID; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async isNotValidGameID(id) {\n if (id === '') {\n return true;\n }\n try {\n let snapshot = await this.db.getRef(`games`).orderByKey().equalTo(id).once('value');\n if (snapshot.val() == null) { // We want to make sure the game doesn't exist yet\n console.log(`Game ID (${id}) is valid...
[ "0.7769897", "0.6762202", "0.6533328", "0.6526197", "0.6513447", "0.6414351", "0.63780636", "0.63732934", "0.632636", "0.63113624", "0.6188926", "0.6170654", "0.6108004", "0.6096203", "0.60873115", "0.6084831", "0.60343456", "0.5999287", "0.59984", "0.5956601", "0.5923147", ...
0.7164941
1
Check if is the correct round
function checkRound(id, player){ let gameJson = reader.read(id).game; let last_round = gameJson.movements.length - 1; //If no move was made, checks to see if the move is from the first player if(gameJson.movements.length == 0 && gameJson.firstPlayer == player) return VALID; if(gameJson.movements.length == 0 && gameJson.firstPlayer != player) return WRONG_ROUND; if(gameJson.movements[last_round].movement.player == player) return WRONG_ROUND; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function has_round(ls, current_round){\r\n\r\n var round = (current_round !== null) ? current_round.split(' ') : null;\r\n\r\n if (round != null){\r\n var round_compare = ['Round '+round[1], 'Round '+ (--round[1])];\r\n\r\n for(var i=0; i < round_compare.length; ++i){\r\n //alert(rou...
[ "0.7213593", "0.67229235", "0.65547574", "0.64649296", "0.6388813", "0.6346499", "0.6344081", "0.6307989", "0.62026435", "0.6190968", "0.6190968", "0.618866", "0.61842614", "0.61813766", "0.61795115", "0.6169554", "0.6166224", "0.6164857", "0.6164857", "0.61486644", "0.614511...
0.0
-1
Check if the game has a winner or is a draw
function checkWin(id, player, x, y){ let gameJson = reader.read(id).game; let winner = '#' let virtualBoard = [ ['#', '#', '#'], ['#', '#', '#'], ['#', '#', '#'] ]; if(gameJson.movements.length == 0){ return VALID; } // Populates the virtualBoard with the moves for(let i = 0; i < gameJson.movements.length; i++){ j = gameJson.movements[i].movement.x; k = gameJson.movements[i].movement.y; virtualBoard[j][k] = gameJson.movements[i].movement.player; } virtualBoard[x][y] = player; if(checkCol(virtualBoard, x, player)) return WINNER if(checkLine(virtualBoard, y, player)) return WINNER if(checkDiag(virtualBoard, player)) return WINNER let round = gameJson.movements.length - 1; round = gameJson.movements[round].movement.round; if(winner == '#' && round == 8){ return DRAW; } return VALID; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gameIsDraw(game) {\n return game.winner === undefined && game.turn === 9;\n}", "function checkForWin() {\r\n if (game_1.isWinningState(board)) {\r\n var winner = game_1.detectWinner(board);\r\n view_1.displayGameOver(winner);\r\n }\r\n else if (game_1.isDrawState(board)) {\r\n ...
[ "0.83116937", "0.8167785", "0.78186053", "0.7805983", "0.7671077", "0.7603425", "0.75892293", "0.7552873", "0.75362235", "0.75251955", "0.7521628", "0.75119185", "0.7506108", "0.7469283", "0.742842", "0.74101084", "0.73744833", "0.7325786", "0.7314765", "0.7297275", "0.729697...
0.0
-1
Call functions that validate the move.
function validateMove(moveData){ let move = moveData.movement; // Checks conditions before trying to see a winner if(checkId(moveData.id) == WRONG_ID) return WRONG_ID; if(checkEnd(moveData.id) == END) return END; if(checkRound(moveData.id, moveData.player) == WRONG_ROUND) return WRONG_ROUND; if(checkPosition(moveData.id, move.x, move.y) == WRONG_POS) return WRONG_POS; // Check if the games continues or if it has a winner or if it is a draw status = checkWin(moveData.id, moveData.player, move.x, move.y); return status; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "moveIsValid() {}", "isValidMove(){\n\n }", "validatePosition() {\n\n }", "function validateMove(value) {\n switch (value) {\n case \"ones\":\n case \"twos\":\n case \"threes\":\n case \"fours\":\n case \"fives\":\n case \"sixes\":\n case \"chance\":\n ...
[ "0.76095885", "0.7563932", "0.65470994", "0.64211345", "0.64187384", "0.61983836", "0.6197822", "0.6182796", "0.6180657", "0.61766225", "0.61533093", "0.61339474", "0.6096995", "0.60783094", "0.6069268", "0.5997508", "0.5978371", "0.59370774", "0.5839926", "0.5828299", "0.582...
0.61057097
12
React has AMD support so when require is present it will behave as a module The react example however expects a global React so we need to put it back into global space.
function globalizeReact() { var global = (function () { return this; })(); global.React = global.React || react; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function App() {\n return (\n //JSX=>needs to import React\n <div >\n Hello Worldfff\n </div>\n );\n}", "render() {\n return (\n <div className=\"App\">\n <h1>My React App</h1>\n <p>This is really working</p>\n </div>\n );\n // Above jsx in return stmt gets compil...
[ "0.6661715", "0.6306126", "0.61163706", "0.60769916", "0.6032304", "0.5880644", "0.58634394", "0.58572793", "0.5849332", "0.5821018", "0.5715654", "0.57093525", "0.5686781", "0.5651314", "0.564205", "0.5640679", "0.55866855", "0.55866855", "0.5574941", "0.55454385", "0.553154...
0.7505162
0
1. Reverse a Number
function reverseNumber(n) { return parseInt(n.toString().split("").reverse().join("")) * Math.sign(n); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reverseNumber (n) {\n\n}", "function reverseInteger(number) {\nvar reversed = 0;\n\n}", "function reverse (num) {\n let rev = 0\n while (num > 0) {\n rev *= 10\n rev += num % 10\n num = Math . floor (num / 10)\n }\n return (rev)\n}", "function reverse(num) {\n va...
[ "0.86050004", "0.81810045", "0.79700994", "0.79189616", "0.7892923", "0.7872614", "0.77796406", "0.776392", "0.7750039", "0.7747371", "0.7734854", "0.77169967", "0.7678498", "0.7663459", "0.76226306", "0.76176083", "0.7613296", "0.76117253", "0.75998646", "0.7534196", "0.7526...
0.7918117
4
3. Longest Common Subsequence
function LCS(x, y) { let string = ""; let n = 0; for (let i = 0; i < y.length; i++) { for (let k = n; k < x.length; k++) if (y[i] === x[k]) { string += y[i]; n = ++k; break; } } return string; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function longestCommonSubsequence(text1, text2) {\n /*\n - Think of the rows as the outer loop and the columns as the inner loop.\n - Use 2 pointers, one for each string (imagine it being a matrix). One is for rows and the other for columns.\n - Rows -> text1\n - Columns -> text2\n - Like in th...
[ "0.72899485", "0.71720195", "0.7160475", "0.7063165", "0.7048045", "0.70024633", "0.68107575", "0.6775209", "0.6766909", "0.67241937", "0.66730076", "0.6632015", "0.66088074", "0.65912217", "0.6436072", "0.64148295", "0.6408796", "0.6384666", "0.6363513", "0.63428426", "0.633...
0.0
-1
Merge item data ret.result = [ [item1_a, item1_b, ...], [item2_a, item2_b, ...], ... ]; ret.names = [ itemname_1, itemname_2, ... ];
function _mergeItemsData(items, except_names) { const ret = {}; const item_names = []; for (let i = 0; i < items.length; i++) { const item = items[i]; if (except_names.indexOf(items[i].name) >= 0) continue; const name_key = ('0' + item.match_level).slice(-3) + '_' + item.name; if (name_key in ret) { ret[name_key].push(item); } else { ret[name_key] = [item]; item_names.push(item.name); } } const keys = Object.keys(ret); const ret_sorted = []; for (let i = 0; i < keys.length; i++) { ret[keys[i]].sort(_sortItemInSameName); // sort in same item ret_sorted.push(ret[keys[i]]); } ret_sorted.sort(_sortItemByMatchLevel); // sort by match level return { result: ret_sorted, names: item_names }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function merge(item1, item2, item3) {\n var result = Object.create(null);\n var items = [item1, item2, item3];\n for (var i = 0; i < 3; i++) {\n var item = items[i];\n if (typeof item === 'object' && item) {\n for (var key in item) {\n result[key] = item[key];\n ...
[ "0.6584769", "0.6047336", "0.6045097", "0.5931019", "0.59197944", "0.582042", "0.57650375", "0.5722605", "0.56928474", "0.56814826", "0.5668966", "0.5627736", "0.56030893", "0.55946505", "0.55673265", "0.55437887", "0.5517511", "0.5515251", "0.55022645", "0.54848456", "0.5463...
0.75121075
0
Convert to Fuzzy name
function _fuzzyName(name) { // 使用されない(と思われる)記号の削除(/\^$*+?.|[]{};"'%&=~@`,_!#) name = name.replace(/[\/\\\^\$\*\+\?\.\|\[\]\{\}\;\"\'\%\&\=\~\@\`\,\_\!\#]/g, ''); // 「:」「:」「・」「・」スペース、タブを無視 name = name.replace(/[::・・  \t]/g, ''); // 括弧を全角に統一 name = name.replace(/\(/g, '(').replace(/\)/g, ')'); // カナを統一 return fuzzyKana(name); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "correctName() {\n\t\tthis.name = this.stringCorrector.getMon(this.name);\n\t}", "function normalize(name) {\n return name.replace(/[- _]+/g, '').toLowerCase();\n }", "function normalize(name) {\n return name.replace(/[- _]+/g, '').toLowerCase();\n }", "function tidyName(name) {\n var r...
[ "0.62886757", "0.6226444", "0.6226444", "0.59146327", "0.58775526", "0.58744985", "0.5837227", "0.5800777", "0.57886124", "0.5754456", "0.5744995", "0.57383525", "0.5708164", "0.5701565", "0.56960076", "0.5690939", "0.56625783", "0.56535876", "0.56404686", "0.5638587", "0.562...
0.71595263
0
draw nodes and links
function transit(){ links = links.data(linksData, function(d){ return d.edgeId; }); links.enter() .append("path") .attr("stroke", "#555") .attr("stroke-width", 1) //.attr("opacity", 0.5) .attr("id", function(d, i){ return d.source.id + "link" + d.target.id; }) .attr("class", function(d) { var provClass = "" if(d.isProvenance) provClass = " provenanceLink" return "link " + d.linkType + " " + d.linkStatus + provClass; }) .attr("fill", "none"); links.exit() .transition() .duration(transitionDisapearTime) .attr("opacity", 0) .remove(); linkArrow = linkArrow.data(linksData, function(d){ return d.edgeId; }); linkArrow.enter() .append("polygon") .attr("fill", "#555") linkArrow.exit() .transition() .duration(transitionDisapearTime) .attr("opacity", 0) .remove(); labels = labels.data(textData, function(d){ return d.nodeId; }); labels.enter() .append("g") .classed("label", true) .attr("id", function(d, i){ if (d.type == "nodeLabel"){ return "nodeLabelG" + d.node.id; } else if (d.type == "linkLabel"){ return "linkLabelG" + d.node.src + "-" + d.node.tgt; } else if (d.type == "edgeLinkLabel"){ return "edgeLinkLabelG" + nodesData[d.node.tgt].id; } return "labelPartG" + i; }); labels.exit() .transition() .duration(transitionDisapearTime) .attr("opacity", 0) .remove(); var test = labels.append("circle") .attr("r", 0) labelFrame = labels .append("g") .attr("class", function(d){ if (d.type == "nodeLabel"){ return "nodeLabel"; } else if (d.type == "linkLabel"){ return "linkLabel"; } else if (d.type == "edgeLinkLabel"){ return "edgeLinkLabel"; } return "unusedLable"; }) .attr("id", function(d, i){ if (d.type == "nodeLabel"){ return "nodeLabel" + d.node.id; } else if (d.type == "linkLabel"){ return "linkLabel" + d.node.src + "-" + d.node.tgt; } else if (d.type == "edgeLinkLabel"){ return "edgeLinkLabel" + nodesData[d.node.tgt].id; } return "labelPart" + i; }) .attr("opacity", 0); labelText = labelFrame .filter(function(d, i){ return i % 2 == 1; }) .append("text") .text(function(d, i){ if (d.type == "nodeLabel" && d.node.type == "anchor"){ return d.content; } if (d.content.length > 20){ d.alt = d.content.slice(0, 7) + "..." + d.content.slice(d.content.length - 10, d.content.length); return d.alt; } return d.content; }) .attr("fill", function(d){ if (d.type == "nodeLabel"){ return "white"; } if (d.type == "linkLabel" || d.type == "edgeLinkLabel"){ return "black"; } return "none"; }) .attr("font-weight", function(d){ if (d.type == "nodeLabel"){ return "bold"; } return "normal"; }) .attr("font-family", "Arial") .attr("font-size", 12) .attr("opacity", 0.8) .attr("x", function(d){ d.width = this.getBBox().width //+ textHeight / 3 * 2; if (d.type == "nodeLabel"){ d.node.labelWidth = d.width; } return -(d.width / 2); }) .attr("y", -3); labelBoard = labelFrame .filter(function(d, i){ return i % 2 == 1; }) .append("path") .attr("stroke-width", 0) .attr("stroke", function(d){ return "red"; if (d.type == "nodeLabel"){ return "#ddd"; } else if (d.type == "linkLabel"){ return "#555"; } }) .attr("id", function(d){ if (d.type == "nodeLabel"){ return "nodeLabelBoard" + d.node.id; } else if (d.type == "linkLabel"){ return "linkLabelBoard" + d.node.src + "-" + d.node.tgt; } else if (d.type == "edgeLinkLabel"){ return "edgeLinkLabelBoard" + nodesData[d.node.tgt].id; } }) .attr("fill", function(d){ if (d.type == "nodeLabel"){ if (d.node.isForcedByUser) return "rgb(42,98,126)"; if (d.node.isTemporary) return "#888"; return "#555"; } if (d.type == "linkLabel" || d.type == "edgeLinkLabel"){ return "#ddd"; } return "none"; }) .attr("d", function(d){ if (d.type != "nodeLabel" && d.type != "linkLabel" && d.type != "edgeLinkLabel"){ d.width = 0; return ""; } var textWidth = d.width; var dx = -textWidth / 2; var dy = 0; return "M " + dx + " " + dy + " L " + (dx + textWidth) + " " + dy + " Q " + (dx + textWidth + textHeight / 3) + " " + (dy - textHeight / 2) + " " + (dx + textWidth) + " " + (dy - textHeight) + " L " + dx + " " + (dy - textHeight) + " Q " + (dx - textHeight / 3) + " " + (dy - textHeight / 2) + " " + dx + " " + dy; }); labelBoard.moveToBack(); labelApproveBoard = labels .filter(function(d, i){ //console.log(JSON.stringify(d)); return d.type == "linkLabel" && d.node.original.linkStatus == "TemporaryLink"; }) .append("rect") .attr("fill", "transparent") .classed("clickBoard", true) .attr("r", nodeRadius+1) .attr("opacity", 1) .attr("stroke-width", 2) .attr("stroke", "red") .attr("width", function(d){ return 8; }) .attr("height", function(d){ return 8; }) .attr("x", function(d){ var w = Math.ceil(this.parentNode.childNodes[1].getBBox().width); return -4; }) .attr("y", function(d){ var h = Math.ceil(this.parentNode.childNodes[1].getBBox().height); return -h+15; }) .on("click", function(d){ if(linkApproveClickListener != null) linkApproveClickListener(d.node.original, d3.event); }); labelClickBoard = labels .filter(function(d, i){ return (i % 2 == 1) && d.node.type != "anchor"; }) .append("rect") .classed("clickBoard", true) .attr("id", function(d){ if (d.type == "nodeLabel"){ return "nodeLabelClickBoard" + d.node.id; } else if (d.type == "linkLabel"){ return "linkLabelClickBoard" + d.node.src + " " + d.node.tgt; } else if (d.type == "edgeLinkLabel"){ return "edgeLinkClickBoard" + nodesData[d.node.tgt].id; } }) .attr("fill", "transparent") .attr("width", function(d){ var w = Math.ceil(this.parentNode.childNodes[1].getBBox().width); return w; }) .attr("height", function(d){ var h = Math.ceil(this.parentNode.childNodes[1].getBBox().height); return h; }) .attr("x", function(d){ var w = Math.ceil(this.parentNode.childNodes[1].getBBox().width); return -w / 2; }) .attr("y", function(d){ var h = Math.ceil(this.parentNode.childNodes[1].getBBox().height); return -h; }) .on("click", function(d){ if (d.type == "linkLabel" || d.type == "edgeLinkLabel"){ if(linkClickListener != null) linkClickListener(d.node.original, d3.event); } else { if(nodeClickListener != null) nodeClickListener(d.node.original, d3.event); } //console.log(d.type); }) .on("mouseover", function(d){ var frameId = ""; showNodeHelp(worksheetId, d.node.original); //console.log(d.content); if (d.type == "nodeLabel"){ frameId = "#nodeLabelG" + d.node.id; } else if (d.type == "linkLabel"){ frameId = "#linkLabelG" + d.node.src + "-" + d.node.tgt; } else if (d.type == "edgeLinkLabel"){ frameId = "#edgeLinkLabelG" + nodesData[d.node.tgt].id; } if (d.alt != undefined){ d3.select(frameId) .select("text") .text(function(d){ return d.content; }) .attr("x", function(d){ d.width = this.getBBox().width return -(d.width / 2); }) d3.select(frameId) .select("path") .transition() .duration(500) .attr("d", function(d){ var textWidth = d.width; var dx = -textWidth / 2; var dy = 0; return "M " + dx + " " + dy + " L " + (dx + textWidth) + " " + dy + " Q " + (dx + textWidth + textHeight / 3) + " " + (dy - textHeight / 2) + " " + (dx + textWidth) + " " + (dy - textHeight) + " L " + dx + " " + (dy - textHeight) + " Q " + (dx - textHeight / 3) + " " + (dy - textHeight / 2) + " " + dx + " " + dy; }) } d3.select(frameId) .select("path") .attr("stroke-width", 2); d3.select(frameId) .moveToFront(); }) .on("mouseout", function(d, i){ hideHelp(); var frameId = ""; if (d.type == "nodeLabel"){ frameId = "#nodeLabelG" + d.node.id; } else if (d.type == "linkLabel"){ frameId = "#linkLabelG" + d.node.src + "-" + d.node.tgt; } else if (d.type == "edgeLinkLabel"){ frameId = "#edgeLinkLabelG" + nodesData[d.node.tgt].id; } if (d.alt != undefined){ d3.select(frameId) .select("text") .text(function(d){ return d.alt; }) .attr("x", function(d){ d.width = this.getBBox().width return -(d.width / 2); }) d3.select(frameId) .select("path") .transition() .duration(200) .attr("d", function(d){ var textWidth = d.width; var dx = -textWidth / 2; var dy = 0; return "M " + dx + " " + dy + " L " + (dx + textWidth) + " " + dy + " Q " + (dx + textWidth + textHeight / 3) + " " + (dy - textHeight / 2) + " " + (dx + textWidth) + " " + (dy - textHeight) + " L " + dx + " " + (dy - textHeight) + " Q " + (dx - textHeight / 3) + " " + (dy - textHeight / 2) + " " + dx + " " + dy; }) } d3.select(frameId) .select("path") .attr("stroke-width", 0); d3.select(frameId) .moveToBack(); }); labelLinks = labelLinks.data(textLinksData, function(d){ return d.edgeId; }); labelLinks.enter() .append("line") .classed("labelLinks", true) .attr("stroke-width", 0); labelLinks.exit() .transition() .duration(transitionDisapearTime) .attr("opacity", 0) .remove(); nodesData.forEach(function(d){ if (d.noLayer){ d.position.x = -1; d.position.y = -1; } else { d.position.x = d.xpos; d.position.y = height - nodeRadius - d.layer * unitLinkLength; } }) nodes = nodes.data(nodesData, function(d){ return d.nodeId; }); nodes.enter() .append("circle") .classed("node", true) .attr("r", nodeRadius) .attr("opacity", 0.7) .attr("fill", "red") .attr("id", function(d, i){ return "node" + d.id; }) .call(drag) .on("click", function(d){ if(anchorClickListener != null && d.original.nodeType == "ColumnNode") anchorClickListener(d.original, d3.event); var offset = Math.max(xOffset - leftPanelWidth,0); if (d.outside.isOutside && !d.noLayer){ if (d.position.x < offset){ var destination = Math.max(0, d.position.x - windowWidth / 2); var xPosition = offset; var differ = Math.max(30, (xPosition - destination) / 200); var interval = setInterval(function(){ xPosition -= differ; if (xPosition > destination){ $(window).scrollLeft(xPosition); } else { clearInterval(interval); } }, 10); } else { var destination = Math.min(width - windowWidth, d.position.x - windowWidth / 2); var xPosition = offset; var differ = Math.max(30, (destination - xPosition) / 200); var interval = setInterval(function(){ xPosition += differ; if (xPosition < destination){ $(window).scrollLeft(xPosition); } else { clearInterval(interval); } }, 10); } } }) .on("dblclick", function(d) { d3.select(this).classed("fixed", d.fixed = false); d.position.x = d.xpos; d.position.y = height - nodeRadius - d.layer * unitLinkLength; }) .on("mouseover", function(d){ if(anchorMouseListener != null && !d.isTemporary && !d.outside.isOutside) anchorMouseListener(d.original, d3.event); d3.select(this) .transition() .duration(500) .attr("opacity", 1) .attr("r", nodeRadius * 1.5); d3.select("#nodeLabel" + d.id) .attr("opacity", 1); d.showLabel = true; if (d.parent){ d3.select("#nodeLabel" + d.parent) .attr("opacity", 1); nodesData[d.parent].showLabel = true; } if (nodesChildren[d.id] == undefined){ return; } nodesChildren[d.id].forEach(function(e){ if (nodesData[e].degree >= 2){ d3.select("#nodeLabel" + e) .attr("opacity", 1); nodesData[e].showLabel = true; } }); labelForce.start(); }) .on("mouseout", function(d){ d3.select(this) .transition() .duration(500) .attr("opacity", 0.7) .attr("r", nodeRadius) if (d.noLayer){ } else if (d.outside.isOutside){ if (d.degree < 3){ d3.select("#nodeLabel" + d.id) .attr("opacity", 0); d.showLabel = false; } if (d.parent && nodesData[d.parent].degree < 3){ d3.select("#nodeLabel" + d.parent) .attr("opacity", 0); d.showLabel = true; } if (nodesChildren[d.id] == undefined){ return; } nodesChildren[d.id].forEach(function(e){ if (nodesData[e].degree < 3){ d3.select("#nodeLabel" + e) .attr("opacity", 0); nodesData[e].showLabel = false; } }); } else if (d.type == "anchor"){ d3.select("#nodeLabel" + d.id) .attr("opacity", 0); d.showLabel = false; } }); nodes.transition() .duration(500) .attr("r", nodeRadius); nodes.exit() .transition() .duration(transitionDisapearTime) .attr("opacity", 500) .remove(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw(nodes, links, accessors) {\n function nodeKey(n) {\n return n.id;\n }\n\n function linkKey(d) {\n return d.source.id + \"-\" + d.target.id;\n }\n\n var root = accessors.root,\n rootparent = accessors.rootparent,\n berects = accessors.berects;\n...
[ "0.76891696", "0.7185416", "0.70329934", "0.68590117", "0.6822951", "0.67826533", "0.6776398", "0.67660433", "0.6743505", "0.6738982", "0.67203295", "0.6608142", "0.65944296", "0.6591529", "0.6569237", "0.65656024", "0.6555526", "0.65239567", "0.6520787", "0.6504471", "0.6499...
0.0
-1
tick function for forcelayout
function tick(e){ labelForce.start(); var k = 0.03 * e.alpha; var kY = 0.05; nodes .attr("cx", function(d) { if (d.outside.isOutside){ var tmpXOffset = Math.max(Math.min(xOffset, maxXOfferset) - leftPanelWidth, 0); return d.x = Math.max(tmpXOffset + nodeRadius + d.labelWidth / 2, Math.min(tmpXOffset + windowWidth - nodeRadius - d.labelWidth / 2, d.x)); } if (d.isTemporary){ var tmpXOffset = Math.max(Math.min(xOffset, maxXOfferset) - leftPanelWidth, 0); return d.x = Math.max(tmpXOffset + nodeRadius + d.labelWidth / 2, Math.min(tmpXOffset + windowWidth - nodeRadius - d.labelWidth / 2, d.x)); } var differX = d.position.x - d.x; if (d.type == "anchor"){ d.x += differX * kY; if (Math.abs(d.position.x - d.x) < 20){ d.x = d.position.x; } } else { d.x += differX * kY; } return d.x; }) .attr("cy", function(d) { if (d.outside.isOutside){ d.y += -d.y * k; return d.y = Math.max(nodeRadius + 12, Math.min(height - nodeRadius, d.y)); } var differY = d.position.y - d.y; if (d.type == "anchor"){ d.y += differY * kY; if (Math.abs(d.position.y - d.y) < 20 || d.y >= height - nodeRadius){ d.y = d.position.y; } } else { d.y += differY * kY; } return d.y = Math.max(nodeRadius, Math.min(height - nodeRadius, d.y)); }); labels.each(function(d, i){ if (i % 2 == 0){ if (d.type == "linkCircle"){ var a = nodesData[d.node.src]; var b = nodesData[d.node.tgt]; d.y = (a.y + b.y) / 2; d.x = (a.x + b.x) / 2 + (nodesData[d.node.tgt].x - nodesData[d.node.src].x) / 6; /*var i, j; for (i = 0; i < 1; i += 0.1){ if (getXofLabel(d, i, d.y)){ break; } } i -= 0.1; for (j = 0; j < 0.1; j += 0.01){ if (getXofLabel(d, i + j, d.y)){ break; } } */ } else if (d.type == "edgeLinkCircle"){ var a = d.node.src; var b = nodesData[d.node.tgt]; d.x = (a.x + b.x) / 2 + (b.x - a.x) / 6; d.y = (a.y + b.y) / 2; } else { d.x = d.node.x; d.y = d.node.y; } } else { var dx = textData[i - 1].x; var dy = textData[i - 1].y; d.y = dy; d.x = dx; } }) //if (!firstTime){ links.call(updateLink); labels.call(updateLabel); labelLinks.call(updateLabelLink); //} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tick() {\n\n\n\n}", "function adjustTicks(evt, obj) {\n //Using adjustTM attribute to adjust the \n //number of major ticks to a best feasible value\n if(adjustTickCB.checked) {\n cpuGauge.setChartAttribute('adjustTM', 1);\n }\n else{\n cpuGauge.s...
[ "0.73944414", "0.682223", "0.67963153", "0.6743678", "0.6735817", "0.6732614", "0.6612211", "0.6607621", "0.6588134", "0.658552", "0.6574418", "0.65004045", "0.64797336", "0.6474218", "0.6459773", "0.6453222", "0.64354014", "0.64354014", "0.64354014", "0.64354014", "0.6435401...
0.652173
11
calculate the X of inside labels
function getXofLabel(d, t, y){ var a = nodesData[d.node.src]; var b = nodesData[d.node.tgt]; var ax = a.x - (a.x - b.x) / 3; var by = b.y - (b.y - a.y) / 3; var Ax = ((1 - t) * b.x) + (t * b.x); var Ay = ((1 - t) * b.y) + (t * by); var Bx = ((1 - t) * b.x) + (t * ax); var By = ((1 - t) * by) + (t * a.y); var Cx = ((1 - t) * ax) + (t * a.x); var Cy = ((1 - t) * a.y) + (t * a.y); var Dx = ((1 - t) * Ax ) + (t * Bx); var Dy = ((1 - t) * Ay ) + (t * By); var Ex = ((1 - t) * Bx ) + (t * Cx); var Ey = ((1 - t) * By ) + (t * Cy); var Px = ((1 - t) * Dx ) + (t * Ex); var Py = ((1 - t) * Dy ) + (t * Ey); d.x = Px; return Py < y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function labelX() {\n const l = d3.select(this.parentNode).select('line');\n // grabbing the values of the x1, x2, and y1 attributes\n const labelX1 = parseInt(l.attr('x1'));\n const labelX2 = parseInt(l.attr('x2'));\n // calculating and returing the x value for the message's label\n return (labe...
[ "0.72030365", "0.7129162", "0.64457476", "0.6408409", "0.63157684", "0.6233945", "0.61558497", "0.61423355", "0.6127629", "0.597459", "0.5899964", "0.5838808", "0.57775325", "0.5777112", "0.57612383", "0.5754495", "0.5706438", "0.56695443", "0.56623083", "0.5634547", "0.56305...
0.64515316
2
calculate coordinate on the bezier curve
function getXofBezier(d, ax, by, t, y){ var a = d.source; var b = d.target; var x = b.x; var tmpWidth = d.width / 2; /*var tmpWidth = 100; var obj = d3.select("nodeLabel" + b.id) .attr("id", function(d){ tmpWidth = d.width / 2; })*/ var Ax = ((1 - t) * b.x) + (t * b.x); var Ay = ((1 - t) * b.y) + (t * by); var Bx = ((1 - t) * b.x) + (t * ax); var By = ((1 - t) * by) + (t * a.y); var Cx = ((1 - t) * ax) + (t * a.x); var Cy = ((1 - t) * a.y) + (t * a.y); var Dx = ((1 - t) * Ax ) + (t * Bx); var Dy = ((1 - t) * Ay ) + (t * By); var Ex = ((1 - t) * Bx ) + (t * Cx); var Ey = ((1 - t) * By ) + (t * Cy); var Px = ((1 - t) * Dx ) + (t * Ex); var Py = ((1 - t) * Dy ) + (t * Ey); d.arrow.y = Py; d.arrow.x = Px; if (Py < y || Math.abs(Px - x) > tmpWidth){ return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBezierCoordinate_(t, c1, c2) {\n // Special case start and end.\n if (t === 0 || t === 1) {\n return t;\n }\n\n // Step one - from 4 points to 3\n var ic0 = t * c1;\n var ic1 = c1 + t * (c2 - c1);\n var ic2 = c2 + t * (1 - c2);\n\n // Step two - from 3 points to 2\n ic0 += t * (ic1 - ic0);\...
[ "0.71968454", "0.7118496", "0.7062146", "0.70015705", "0.68523693", "0.6840736", "0.67959577", "0.67570305", "0.664707", "0.652432", "0.6464292", "0.6379293", "0.63783765", "0.6375702", "0.6375702", "0.6375702", "0.6375702", "0.6375702", "0.6375702", "0.6375702", "0.63476676"...
0.6212585
28
compute the rotate slope of arrow
function getArrowAngle(d, ax, by, t){ var a = d.source; var b = d.target; var Ax = ((1 - t) * b.x) + (t * b.x); var Ay = ((1 - t) * b.y) + (t * by); var Bx = ((1 - t) * b.x) + (t * ax); var By = ((1 - t) * by) + (t * a.y); var Cx = ((1 - t) * ax) + (t * a.x); var Cy = ((1 - t) * a.y) + (t * a.y); var Dx = ((1 - t) * Ax ) + (t * Bx); var Dy = ((1 - t) * Ay ) + (t * By); var Ex = ((1 - t) * Bx ) + (t * Cx); var Ey = ((1 - t) * By ) + (t * Cy); var Px = ((1 - t) * Dx ) + (t * Ex); var Py = ((1 - t) * Dy ) + (t * Ey); d.slope = (d.arrow.y - Py != 0) ? (d.arrow.x - Px) / (d.arrow.y - Py) : 1; d.angle = -Math.atan(d.slope) / Math.PI * 180; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function d4_svg_lineSlope(p0, p1) {\n return (p1[1] - p0[1]) / (p1[0] - p0[0]);\n}", "function d3_svg_lineSlope(p0, p1) {\n return (p1[1] - p0[1]) / (p1[0] - p0[0]);\n}", "function d3_svg_lineSlope(p0, p1) {\n return (p1[1] - p0[1]) / (p1[0] - p0[0]);\n}", "function d3_svg_lineSlope(p0, p1) {\n return (p...
[ "0.6454321", "0.644054", "0.644054", "0.644054", "0.641223", "0.63831383", "0.6358351", "0.6326031", "0.61402464", "0.61375976", "0.61293375", "0.6111723", "0.60750264", "0.60469913", "0.60439175", "0.6031762", "0.6028233", "0.6028233", "0.602351", "0.6000093", "0.6000093", ...
0.67335373
0
collision detection for outside nodes
function collideOutside(d){ var r = d.width / 2 + textHeight, nx1 = d.x - r, nx2 = d.x + r, ny1 = d.y - textHeight, ny2 = d.y; return function(quad, x1, y1, x2, y2) { if (quad.point && (quad.point !== d)) { var x = d.x - quad.point.x, y = (d.y - quad.point.y), lx = Math.abs(x), ly = Math.abs(y), rx = d.width / 2 + quad.point.width / 2, ry = textHeight; if (ly >= ry || lx >= rx){ return true; } ly = (ly != 0) ? (ly - ry) / ly * 0.5 : (ly - ry) * 0.5; y *= ly; d.y = Math.max(d.y - y, textHeight); quad.point.y = Math.min(quad.point.y + y, height); } return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "detectCollision() {\n // first check edgeGroup for lanes\n let self = this;\n this.edgeGroup.children.forEach((edgeViewGroup) => {\n let edgeModel = self.edgeCollection.getModel(edgeViewGroup.modelId);\n let edgePaths = edgeViewGroup.children;\n let isColliding...
[ "0.7331335", "0.7211608", "0.7209922", "0.71835136", "0.7143065", "0.7049127", "0.70250607", "0.6956548", "0.6938193", "0.6924827", "0.69174004", "0.6893398", "0.68471664", "0.68434554", "0.6841742", "0.68280387", "0.6825077", "0.679894", "0.6797989", "0.67934567", "0.6762788...
0.0
-1
detect the strong connect component in the graph
function detectCycle(){ SCCNodes = d3.range(nodesData.length).map(function(d, i){ return {id : nodesData[i].id, index : -1}; }) map.clear(); for (var i = 0; i < SCCNodes.length; i++){ if (SCCNodes[i].index == -1 && SCCNodes[i].id in nodesChildren){ strongConnect(SCCNodes[i]); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "connects(candidate, edge) {\n return ((candidate && edge) && (candidate.a.x == edge.a.x && candidate.a.y == edge.a.y ||\n candidate.a.x == edge.b.x && candidate.a.y == edge.b.y ||\n candidate.b.x == edge.a.x && candidate.b.y == edge.a.y ||\n candidate.b.x == edge.b.x && cand...
[ "0.62838316", "0.62782127", "0.62586546", "0.62280375", "0.6071325", "0.60480595", "0.6043892", "0.6007995", "0.6007995", "0.6007995", "0.59538627", "0.5946243", "0.5883565", "0.5880302", "0.5880302", "0.5835692", "0.5821448", "0.5778127", "0.577309", "0.5741601", "0.5719249"...
0.5750273
19
set layer and position for each node
function setLayer(tmpLinkData, tmpE){ //layer is set from bottem to top, one layer per loop. The anchors are layer 0. //change evalutes how many node's layer has set in one loop, if no node's layer is set, change is 0. It means all node's layer is set properly var change = anchorData.length; var baseLayer = new ArrayList(); anchorData.forEach(function(d){ baseLayer.add(d.id); }); //for (var j = 0; j < 5; j++){ var prevChange = -1; var numChances = 0; while (change > 0){ //tmpLayerMap is a set of nodes that change their layer in this loop, they will be considered as the base layer for next iteration. //the base layer of first iteration is anchors, their layer is 0. //console.log("baseLayer: "); //baseLayer.print(); var nextLayer = new ArrayList(); if(prevChange == change) { numChances++; } else { numChances = 0; } prevChange = change; change = 0; if(numChances > 10) { console.log("In a loop to many time, just breaking out"); maxLayer -= 9; break; } //parse all edges tmpLinkData.forEach(function(d){ var src = d.source; var tgt = d.target; //flag to check if one link need to be evaluated. It is used to avoid infinity loop of cycle. //when target id is in the base layer, the source will be set will layer = target's layer + 1, if this edge dose not comprise a cycle, the third edge of above example. if (baseLayer.contains(tgt)){ var e = src + " " + tgt; var flag = true; cycleSet.forEach(function(cycleInstance){ if (cycleInstance.contains(e)){ //when the edge set has only one edge, this edge will comprise a cycle based on the tree we build befor, the tree consists of all edge we evaluated before if (cycleInstance.size > 1){ //remove the edge from edge set. cycleInstance.removeByValue(e); } else { flag = false; } } }); //set the source node's layer, and record the source node id for next iteration if (flag){ nodesData[src].layer = nodesData[tgt].layer + 1; if (!nextLayer.contains(src)){ nextLayer.add(src); } change++; //console.log("id: " + src + " layer: " + nodesData[src].layer); } } }); baseLayer = nextLayer; //maxLayer is the max layer value we set. maxLayer++; //console.log("change: " + change); } maxLayer--; /* nodesData.forEach(function(d, i){ console.log(i + " " + d.layer); }) */ //store the node id in the sequence of layer //xPos is the x position for nodes in the unit of column's width layerMap = d3.range(maxLayer + 1) .map(function(d){ return []; }); nodesData.forEach(function(d){ if (d.layer != undefined){ if (!d.unAssigned){ if(d.layer > maxLayer) d.layer = maxLayer; layerMap[d.layer].push(d.id); } } }); //set xpos of nodes, check whether a node is a outside nodes; var offset = Math.max(xOffset - leftPanelWidth,0); layerMap.forEach(function(d, i){ if (i > 0){ d.forEach(function(e){ var tmp = []; nodesChildren[e].forEach(function(f){ if (!nodesData[f].outside.isOutside){ tmp.push(nodesData[f].xpos); } }); if (tmp.length == 0){ nodesData[e].outside.isOutside = true; nodesData[e].xpos = -1; } else { nodesData[e].xpos = (d3.min(tmp) + d3.max(tmp)) / 2; } }); } else { d.forEach(function(e){ var tmpX = nodesData[e].xpos; if (tmpX - nodeRadius > offset && tmpX + nodeRadius < offset + windowWidth){ nodesData[e].outside.isOutside = false; } else { nodesData[e].outside.isOutside = true; } }) } }); //for node that has no layer, set it as outside node nodesData.forEach(function(d){ if (d.layer == undefined){ d.outside.isOutside = true; d.noLayer = true; d.layer = -1; d.xpos = -1; } }); //set the edge link tmpE.forEach(function(d, i){ var srcIndex = nodesData.length * 2 + edgeIdMap[d.source] * 2 + 1; textData[srcIndex].layer = (nodesData[textData[srcIndex].node.src].layer + nodesData[textData[srcIndex].node.tgt].layer) / 2; var edge = {}; edge.source = textData[srcIndex]; edge.target = idMap[d.target]; edge.id = linksData.length; edge.linkType = d.linkType; edge.type = "edgeLink"; edge.node = {}; edge.node.original = d; linksData.push(edge); var node = {}; node.src = edge.source; node.tgt = edge.target; node.original = d; textData.push({ node : node, type : "edgeLinkCircle", content : d.label }); textData.push({ node : node, type : "edgeLinkLabel", content : d.label, nodeId : d.id }); textLinksData.push({ source : textData.length - 2, target : textData.length - 1, edgeId : d.id }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setNodePosition(){\n\t\t//console.log(print);\n\t\tvar change = 0;\n\t\tvar offset = Math.max(xOffset - leftPanelWidth,0);\n\n\t\t//set xpos of nodes, and check if node is an outside node\n\t\tlayerMap.forEach(function(d, i){\n\t\t\tif (i > 0){\n\t\t\t\td.forEach(function(e){\n\t\t\t\t\tvar tmp = [];\n\t\...
[ "0.66169477", "0.6423226", "0.6336292", "0.63146806", "0.6251254", "0.62142676", "0.6211252", "0.61971015", "0.61276275", "0.6117264", "0.6094329", "0.6081297", "0.602919", "0.6013294", "0.6006735", "0.5918335", "0.5888945", "0.5874689", "0.5865207", "0.58272475", "0.58267397...
0.6159369
8
when move over show the coordinate
function mousemove(){ var ary = d3.mouse(this); pos.attr("x", ary[0] + 2) .attr("y", ary[1] + 2) //.attr("x", 100) //.attr("y", 100) .text(Math.round(ary[0]) + ", " + Math.round(ary[1])); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "startOver() {\n //x cordinates\n this.x = this.beginX;\n //y cordinates\n this.y = this.beginY;\n }", "function onMouseMove(e) {\n\t\t var p = self.LL2C(e.latlng);\n\t\t var region = \"Hinterlands\";\n\t\t if (IsValidCoord(p.x, p.y) == true) {\n\t\t\t\tif (self.showpositio...
[ "0.7125222", "0.7015854", "0.6966599", "0.6771103", "0.67640007", "0.6707928", "0.66533715", "0.66343117", "0.6527919", "0.6526985", "0.6505445", "0.64926314", "0.6466924", "0.64642304", "0.64415", "0.6415712", "0.6376348", "0.6373153", "0.6369629", "0.63659483", "0.6355234",...
0.60220855
73
print the Extented svg
function printExtentedSVG(resolution, callback){ var recordWidth = windowWidth; windowWidth = width + 100; print = true; firstTime = true; setNodePosition(); var objSVG = document.getElementById(htmlElement); setTimeout(function(){ saveSvgAsPng(objSVG, htmlElement + ".png", resolution); windowWidth = recordWidth; print = false; firstTime = true; setNodePosition(); if(callback) callback(); }, 1500); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printDiagram() {\n var svgWindow = window.open();\n if (!svgWindow) return; // failure to open a new Window\n var printSize = new go.Size(1700, 2960);\n var bnds = myDiagram.documentBounds;\n var svg = myDiagram.makeSvg({ scale: 1.0, position: new go.Point(0, 0), size: bnds });\n svgWindow.document...
[ "0.6743461", "0.6506312", "0.63639826", "0.6286437", "0.6142964", "0.60708266", "0.59901714", "0.59224033", "0.5870231", "0.5839356", "0.58369815", "0.5816496", "0.5795811", "0.578825", "0.57724506", "0.57682407", "0.5766095", "0.57507014", "0.57491463", "0.5739798", "0.57219...
0.642943
2
set the outside nodes
function setNodePosition(){ //console.log(print); var change = 0; var offset = Math.max(xOffset - leftPanelWidth,0); //set xpos of nodes, and check if node is an outside node layerMap.forEach(function(d, i){ if (i > 0){ d.forEach(function(e){ var tmp = []; nodesChildren[e].forEach(function(f){ if (!nodesData[f].outside.isOutside){ tmp.push(nodesData[f].xpos); } }); if (tmp.length == 0){ if (!nodesData[e].outside.isOutside){ change++; } nodesData[e].outside.isOutside = true; nodesData[e].xpos = -1; } else { if (nodesData[e].outside.isOutside){ change++; } nodesData[e].xpos = (d3.min(tmp) + d3.max(tmp)) / 2; if (!d.fixed){ nodesData[e].position.x = nodesData[e].xpos; } nodesData[e].outside.isOutside = false; } }); } else { d.forEach(function(e){ var tmpX = nodesData[e].xpos; if (tmpX - nodeRadius > offset && tmpX + nodeRadius < offset + windowWidth){ if (nodesData[e].outside.isOutside){ change++; } nodesData[e].outside.isOutside = false; } else { if (!nodesData[e].outside.isOutside){ change++; } nodesData[e].outside.isOutside = true; } }) } }); //Set the color, opacity of nodes based on the status of isOutside nodes.each(function(d){ /*if (d.noLayer){ d.outside.isOutside = true; d3.select(this) .attr("opacity", 0.8) .attr("r", nodeRadius) .attr("fill", "red"); } */ if (d.fixed && !(d.x - nodeRadius > offset && d.x + nodeRadius < offset + windowWidth)){ d.fixed = false d3.select(this).classed("fixed", false); d.position.x = d.xpos; d.position.y = height - nodeRadius - d.layer * unitLinkLength; } if (d.outside.isOutside && !d.noLayer){ if (d.unAssigned){ } d3.select(this) .transition() .duration(500) .attr("opacity", 0.5) .attr("r", nodeRadius) .attr("fill", function(d){ return cScale(d.index + 1); }); } else { d3.select(this) .transition() .duration(500) .attr("opacity", 0.7) .attr("r", nodeRadius) .attr("fill", "red"); } //console.log(d.id + " " + d.outside.isOutside + " " + d.position.x); }); //console.log(change) //when some node changes its status, the correspoding links, labels and the x position of inside nodes should also change. if (change > 0 || firstTime){ firstTime = false; d3.select(htmlElement).selectAll(".nodeLabel") .attr("opacity", function(d){ if (d.node.noLayer){ d.node.showLabel = true; return 1; } if (d.type == "nodeLabel" && d.node.outside){ if ((!d.node.outside.isOutside && (print || d.node.type != "anchor")) || (d.node.outside.isOutside && d.node.degree >= 3)){ d.node.showLabel = true; return 1; } } d.node.showLabel = false; return 0; }); d3.select(htmlElement).selectAll(".linkLabel") .attr("opacity", function(d){ if (d.type == "linkLabel"){ // if (nodesData[d.node.tgt].noLayer){ // d.show = true; // return 1; // } // if (nodesData[d.node.tgt].type == 'anchor' && !nodesData[d.node.tgt].outside.isOutside){ // d.show = true; // return 1; // } if ((d.node.src < nodesData.length && nodesData[d.node.src].noLayer == undefined && nodesData[d.node.src].outside.isOutside) || (d.node.tgt < nodesData.length && nodesData[d.node.tgt].noLayer == undefined && nodesData[d.node.tgt].outside.isOutside)){ d.show = false; return 0; } d.show = true; return 1; } }); d3.select(htmlElement).selectAll(".edgeLinkLabel") .attr("opacity", function(d){ //console.log(d.index); if (!d.node.src.show || (nodesData[d.node.tgt].noLayer == undefined && nodesData[d.node.tgt].outside.isOutside)) { d.show = false; return 0; } d.show = true; return 1; }); /*d3.select(htmlElement).selectAll(".clickBoard") .attr("fill", function(d){ if (d.content == "edgeLinks"){ if (nodesData[d.node.tgt].outside.isOutside || !d.node.src.show){ return "node"; } return "transparent"; } else if (d.type == "linkLabel"){ if (nodesData[d.node.src].outside.isOutside || nodesData[d.node.tgt].outside.isOutside){ return "none"; } return "transparent"; } return d.node.showLabel ? "transparent" : "none"; });*/ links.classed("outsideLink", function(d){ /*if (d.type == "edgeLink"){ return d.target.outside.isOutside; }*/ if (d.target.noLayer){ return false; } if (d.source.outside && d.target.outside){ if (d.target.type == 'anchor' && !d.target.outside.isOutside){ return false; } return d.source.outside.isOutside || d.target.outside.isOutside; } return false; }); force.start(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setnodevals()\n\t{\t\t\t\n\t\tnode.attr(\"dx\", nodedx)\n\t\t\t.attr(\"dy\", \".31em\")\n\t\t\t.attr(\"transform\", nodetrans)\n\t\t\t.style(\"text-anchor\", nodeanchor);\t\t\t\n\t}", "function set_edges() {\n }", "function setNode(event){\n let currentNode=event.currentTarget;\n \n let in...
[ "0.61790544", "0.61105037", "0.596654", "0.5902017", "0.58920354", "0.5835467", "0.58043253", "0.57917565", "0.5741501", "0.57403207", "0.567706", "0.563775", "0.561289", "0.5568379", "0.556793", "0.55645645", "0.55585444", "0.5557802", "0.55332965", "0.5519979", "0.55150294"...
0.6971496
0
This widget won't work if twitter's script element is inside Muuri's item a workaround is to append the script in the body then after rendering the widget the script won't be needed, remove the script
async initialize(config) { this.url = config.url; this.appendWidgetScript(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadTwitterScript() {\r\n let script = document.createElement('script');\r\n let timeline = $(\"#twitter-timeline\");\r\n let cb = () => {\r\n // When the script is loaded we bind to the widget rendering event to display it\r\n twttr.events.bind(\"rendered\", (event) => {\r\n t...
[ "0.7027387", "0.6657876", "0.662013", "0.6569377", "0.64639616", "0.61946857", "0.60226387", "0.5974326", "0.5954488", "0.59468216", "0.5897612", "0.57864773", "0.5774971", "0.5735202", "0.5723938", "0.57057834", "0.56732565", "0.56584907", "0.56492054", "0.5604597", "0.55219...
0.0
-1
Function co mot tham so In ra dong chu xin chao ai do
function sayHello1(name) { console.log("xin chao ban " + name); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function play()\n{\n // Ajoute un son aleatoire a la sequence (lettre)\n sequence = \"BVRJB\"\n\n // Joue la sequence\n i = 0;\n const metronome = setInterval( function () {\n joueSon(sequence[i++]);\n if (i >= sequence.length) clearInterval(metronome);\n }, 1000);\n\n // Attend ...
[ "0.6244601", "0.6050607", "0.6043991", "0.6035437", "0.60172033", "0.59919804", "0.59884286", "0.5940228", "0.592741", "0.591725", "0.5877944", "0.58555156", "0.5805895", "0.57942426", "0.5776347", "0.5765639", "0.5748116", "0.5711459", "0.5687192", "0.56823725", "0.5674503",...
0.0
-1
ES6 : Default Parameter
function sayHello3(name = "Nguyen Van A", year = 2006) { console.log("Ten: ", name); console.log("Tuoi: ", 2021 - year); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function foo(param = 'no') {\n return 'yes';\n}", "function _defaultArg(name, _default) {\n return isUndefined(name) ? _default : name;\n}", "function default_val(arg, val) {\n\treturn typeof arg === \"undefined\" ? val : arg;\n} // default_val()", "function defaultParams(a, b, c = 0) {\n console.log(a,...
[ "0.7328649", "0.72967654", "0.7241274", "0.72003436", "0.7157617", "0.7148041", "0.71224415", "0.70831746", "0.7082701", "0.7079471", "0.7062405", "0.70551056", "0.6988318", "0.6988123", "0.69633704", "0.69492364", "0.69368815", "0.69094497", "0.6862026", "0.6839885", "0.6836...
0.0
-1
Function tra ve ket qua
function sum(a = 10, b = 20) { let result = a + b; return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pazymiuVidurkis(q,w,e,r,t) {\n var atsakymas = (q+w+e+r+t)/5;\n console.log(atsakymas);\n}", "function TinhTheoLoaiXe(sokm, tgcho, giaLoai1, giaLoai2, giaLoai3, tgChoTheoLoai) {\n var tien = 0;\n if (sokm <= 1) {\n tien = sokm * giaLoai1 + tgcho * tgChoTheoLoai;\n // console.log(ti...
[ "0.67818755", "0.6415324", "0.63214684", "0.626947", "0.6201867", "0.6187434", "0.617482", "0.6130544", "0.61142975", "0.607618", "0.6021152", "0.5990943", "0.59845257", "0.5968847", "0.5967085", "0.5918712", "0.59179467", "0.5869713", "0.5865554", "0.5826383", "0.5823686", ...
0.0
-1
Bai tap thuc hanh
function helloEveryone() { console.log("Xin chao cac ban"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fl_outToRosh_ha_shana_btn ()\n\t\t{\n\t\t\tif(freez == \"false\"){\n\t\t\tconsole.log(\"hit\")\n\t\t\tthis.sufgania.alpha=1\t\n\t\t\tthis.karpas.alpha=1\n\t\t\tthis.levivot.alpha=1\n\t\t\tthis.haroset.alpha=1\n\t\t\tthis.maza.alpha=1\n\t\t\tthis.hasa.alpha=1\n\t\t\tthis.beiza.alpha=1\n\t\t\tthis.hazeret.a...
[ "0.5937581", "0.58166575", "0.57696664", "0.57558507", "0.5686059", "0.5673694", "0.56118727", "0.5574644", "0.5550992", "0.55406624", "0.5540473", "0.5538652", "0.55234766", "0.5521139", "0.54720956", "0.5470282", "0.54533744", "0.5449491", "0.5449491", "0.54328203", "0.5432...
0.0
-1
2021 =>21 1999 =>21
function findCentury(year) { return Math.ceil(year / 100); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "yearToAcademicYear () {\n return this + \"-\" + (Number(this) + 1).toString().slice(-2);\n }", "function yearComparator(auto1, auto2){\n return auto2.year - auto1.year;\n}", "function find2020() {\n for (i = 0; i < puzzleInput.length; i++) {\n let num1 = puzzleInput[i];\n for (j = 0; pu...
[ "0.6269711", "0.60029393", "0.5993992", "0.5923982", "0.57941824", "0.57910234", "0.5782172", "0.5767492", "0.57529604", "0.5713791", "0.56953984", "0.5645329", "0.5613068", "0.5595255", "0.55934644", "0.5559049", "0.5543837", "0.55406713", "0.55332834", "0.5518242", "0.54927...
0.0
-1
Hides the install button.
hideButton() { if (this._installButton) { this._installButton.classList.toggle('hidden', true); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hideCheck() {\n\t\t//Don't hide if installed. Stay green and showing\n\t\tif (this.props.installed === false) {\n\t\t\tthis.setState({\n\t\t\t\tcheckShown: false\n\t\t\t});\n\t\t}\n\t}", "function hideTableGeneratorButton() {\n\tdocument.getElementById(\"tableGeneratorButton\").hidden = true;\n}", "function hi...
[ "0.6739643", "0.6404779", "0.63474065", "0.6332822", "0.6251196", "0.61993206", "0.61639464", "0.6108836", "0.609082", "0.60833913", "0.60477144", "0.59398144", "0.59176326", "0.5905843", "0.5895185", "0.5887763", "0.5880351", "0.58651066", "0.5851685", "0.5847293", "0.583129...
0.8499632
0
Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case. For the purpose of this exercise, you should also capitalize connecting words like the and of.
function titleCase(str) { console.log(str); let arr = str.split(" "); let c = []; for (let i = 0; i < arr.length; i++) { let letters = arr[i].split(""); let a = []; for (let j = 0; j < letters.length; j++) { if (j === 0) { let capital = letters[j].toUpperCase(); a.unshift(capital); } else { let lower = letters[j].toLowerCase(); a.push(lower); } } let b = a.join(""); c.push(b); } let d = c.join(" "); console.log(d); return d; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Capitaliser(input) {\n const eachWord = input.split(\" \");\n for (let index = 0; index < eachWord.length; index++) {\n eachWord[index] = eachWord[index][0].toUpperCase() + eachWord[index].substr(1);\n }\n return eachWord.join(\" \");\n}", "function capitalizeWord(string) {\n //I-s...
[ "0.8637432", "0.84475136", "0.8434862", "0.8429906", "0.8429339", "0.8428503", "0.8409515", "0.8396267", "0.8377574", "0.8368863", "0.83550066", "0.83416367", "0.8336212", "0.83168066", "0.83115155", "0.83078897", "0.8307857", "0.82995975", "0.82959765", "0.82885295", "0.8287...
0.0
-1
Filter and List Messages
function ListMessages(auth) { var gmail = google.gmail('v1'); var query= "from: notifications@github.com view pull request"; nock('https://www.googleapis.com/gmail/v1/users') .get('/jaga4494/messages').reply(200, { username: 'davidwalshblog', firstname: 'David' }); return new Promise(function (resolve, reject) { gmail.users.messages.list({ auth: auth, userId: 'me', q: query, }, function(err, response,body) { if (err) { console.log('The API returned an error: ' + err); return; } var obj = JSON.parse(body); resolve(obj); /* var msgs = response.messages; console.log('- %s', msgs); if (msgs.length == 0) { console.log('No message found.'); } else { console.log('Message:'); //console.log('- %s', msgs.messages[1].id); for (var i = 0; i < msgs.length; i++) { var msg = msgs[i]; console.log('- %s', msg.id); } }*/ }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterMessage(input) {\n\t\n}", "function searchMessages() {\n\tvar input, filter, ul, li, i, a, txtValue;\n\tinput = document.getElementById(\"searchMessages\");\n\tfilter = input.value.toUpperCase();\n\tul = document.getElementById(\"chat-list\");\n\tli = ul.getElementsByClassName(\"chat-list-group\")...
[ "0.7184745", "0.70755327", "0.6901593", "0.6598752", "0.6376389", "0.63663375", "0.6323981", "0.62957156", "0.6265196", "0.62555665", "0.6243934", "0.62256247", "0.6216996", "0.6195781", "0.61940604", "0.6169644", "0.6131701", "0.61117643", "0.6097445", "0.60845214", "0.60774...
0.572753
64
Filter and List Messages
function ListMessages(auth) { var gmail = google.gmail('v1'); var query= "from: notifications@github.com view pull request"; nock('https://www.googleapis.com/gmail/v1/users') .get('/jaga4494/messages').reply(200, { username: 'davidwalshblog', firstname: 'David' }); return new Promise(function (resolve, reject) { gmail.users.messages.list({ auth: auth, userId: 'me', q: query, }, function(err, response,body) { if (err) { console.log('The API returned an error: ' + err); return; } var obj = JSON.parse(body); resolve(obj); /* var msgs = response.messages; console.log('- %s', msgs); if (msgs.length == 0) { console.log('No message found.'); } else { console.log('Message:'); //console.log('- %s', msgs.messages[1].id); for (var i = 0; i < msgs.length; i++) { var msg = msgs[i]; console.log('- %s', msg.id); } }*/ }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterMessage(input) {\n\t\n}", "function searchMessages() {\n\tvar input, filter, ul, li, i, a, txtValue;\n\tinput = document.getElementById(\"searchMessages\");\n\tfilter = input.value.toUpperCase();\n\tul = document.getElementById(\"chat-list\");\n\tli = ul.getElementsByClassName(\"chat-list-group\")...
[ "0.7184745", "0.70755327", "0.6901593", "0.6598752", "0.6376389", "0.63663375", "0.6323981", "0.62957156", "0.6265196", "0.62555665", "0.6243934", "0.62256247", "0.6216996", "0.6195781", "0.61940604", "0.6169644", "0.6131701", "0.61117643", "0.6097445", "0.60845214", "0.60774...
0.572753
65
This is server side code
function addNumber(a, b) { return a + b; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nlobjServerResponse() {\n}", "async index({request, response}) {\r\n\r\n\t\t\r\n\t}", "ServerCallback() {\n\n }", "function handleServerRequest()\n{\n\t//send data to the div or html element for notifications\n}", "function onRequest(context) {\n \tif (context.request.method === 'GET') \n ...
[ "0.62183964", "0.6122819", "0.5952691", "0.5828281", "0.57874674", "0.5785966", "0.57858", "0.5730429", "0.57283986", "0.56313807", "0.55977434", "0.5547084", "0.55373186", "0.5517536", "0.55062413", "0.5498267", "0.546626", "0.54585594", "0.5452792", "0.54404724", "0.5430282...
0.0
-1
runs the given command based on the name
function runCommand(commandName,options){ /* set prompt options */ _prompts[commandName] = { name:commandName, message: options.prompt.message, type: (options.prompt.type !== undefined ? options.prompt.type : 'input'), } /* if type is list set choices option for prompt */ if(options.prompt.type === 'list' || options.prompt.type === 'checkbox'){ _prompts[commandName].choices = (typeof options.prompt.choices === 'function' ? options.prompt.choices(_values) : options.prompt.choices); } /* Run prompt command */ inquirer.prompt(_prompts[commandName]).then(method(commandName,options)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function execCommand(name) {\n var args = [].slice.call(arguments, 1);\n var kw = toKeyword(name);\n args.unshift(kw);\n return lt.objs.command.exec_BANG_.apply(lt.objs.command.command, args);\n }", "command(name) {\n return this.module.command(name);\n }", "function execute(comm...
[ "0.76029205", "0.70871305", "0.6576685", "0.65479213", "0.64989746", "0.63711435", "0.630713", "0.6299099", "0.6192801", "0.612655", "0.6120804", "0.60527354", "0.59381735", "0.5933343", "0.591746", "0.5892281", "0.586834", "0.5859855", "0.585839", "0.58515793", "0.58228123",...
0.56663114
33
This method acts as a filter for which command to run next based on the action property
function toCommand(commandName,action,res){ if(!action) console.error(commandName,' does not have an "action" to perform, please assign it one'); /* exit process on command action of 'exit' */ if(!action || action.toLowerCase() === 'exit'){ console.error('Exiting process due to command; ',commandName); process.exit(1); } /* go to final task command with values upon seeing an 'end' action */ else if(action.toLowerCase() === 'end'){ _command(_values); } /* go the the next command specified in 'action' */ else{ _currentTaskCommand = action; if(_taskCommands[_currentTaskCommand] === undefined){ console.error('No command exists by the name of ',_currentTaskCommand); process.exit(1); } if(_values[_currentTaskCommand] === undefined || typeof _values[_currentTaskCommand] === 'object' || _taskCommands[_currentTaskCommand].repeatable){ runCommand(_currentTaskCommand,_taskCommands[_currentTaskCommand]); } else{ res = _values[_currentTaskCommand]; toCommand(_currentTaskCommand,(typeof _taskCommands[_currentTaskCommand].action === 'function' ? _taskCommands[_currentTaskCommand].action(res,_values) : _taskCommands[_currentTaskCommand].action),res); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isForAction(action) {\n return this.command.action === action;\n }", "function performNextAction() {\n console.log('performNextAction()');\n var nextAction = get('nextAction');\n if (nextAction) {\n nextAction = JSON.parse(nextAction);\n remove('nextAction');\n switch (nextAction.type...
[ "0.6483178", "0.62221134", "0.6140569", "0.5831329", "0.58130765", "0.57658666", "0.5709937", "0.56884074", "0.56884074", "0.56884074", "0.56792754", "0.56528974", "0.5576044", "0.5566889", "0.55459636", "0.5545801", "0.5545801", "0.55245095", "0.5505852", "0.54845023", "0.54...
0.50577265
61
Main method that is ran whenever a value is to be set
function method(commandName, options){ return function(res){ addValue(commandName, options, res[commandName]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setValue() {\n }", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "function initWatchVal() {}", "fu...
[ "0.64196295", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", "0.6399928", ...
0.0
-1
Sends a request to the API using the JSONp protocol
function newRequest() { var title = document.getElementById("title").value; title = title.trim(); title = title.replace(" ","+"); var author = document.getElementById("author").value; author = author.trim(); author = author.replace(" ","+"); var isbn = document.getElementById("isbn").value; isbn = isbn.trim(); isbn = isbn.replace("-",""); // Connects possible query parts with pluses var query = ["",title,author,isbn].reduce(fancyJoin); // The JSONp part. Query is executed by appending a request for a new // Javascript library to the DOM. It's URL is the URL for the query. // The library returned just calls the callback function we specify, with // the JSON data we want as an argument. if (query != "") { // remove old script var oldScript = document.getElementById("jsonpCall"); if (oldScript != null) { document.body.removeChild(oldScript); } // make a new script element var script = document.createElement('script'); // build up complicated request URL var beginning = "https://www.googleapis.com/books/v1/volumes?q=" var callback = "&callback=handleResponse" script.src = beginning+query+callback script.id = "jsonpCall"; // put new script into DOM at bottom of body document.body.appendChild(script); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "jsonp(url, callbackParam) {\n return this.request('JSONP', url, {\n params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'),\n observe: 'body',\n responseType: 'json'\n });\n }", "jsonp(url, callbackParam) {\n return this.request('JSONP', url, {\n params: new Http...
[ "0.6687796", "0.6516182", "0.6516182", "0.6516182", "0.6516182", "0.6516182", "0.6473043", "0.642902", "0.62760824", "0.6184003", "0.60437214", "0.5991566", "0.59835905", "0.59655803", "0.5964626", "0.5906631", "0.5866129", "0.58597314", "0.58276665", "0.58257616", "0.5810411...
0.0
-1
Used above, for joining possibly empty strings with pluses
function fancyJoin(a,b) { if (a == "") { return b; } else if (b == "") { return a; } else { return a+"+"+b; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function joinData(data) {\n return withoutEmptyStrings(data).join(\" ; \");\n}", "function joinProse(array)\n{\n var length = array.length;\n switch (length) {\n case 0:\n return \"\";\n case 1:\n return array[0];\n default:\n return _.reduce(array.slice(1, length - 1), funct...
[ "0.6554332", "0.6304", "0.6215415", "0.6090299", "0.6090299", "0.6090299", "0.6090299", "0.6090299", "0.6090299", "0.6090299", "0.6090299", "0.6090299", "0.6090299", "0.60782015", "0.60782015", "0.60715866", "0.60444844", "0.60444844", "0.6018703", "0.6018703", "0.6018703", ...
0.6786303
0
The callback function, which gets run when the API returns the result of our query / Replace with your code!
function handleResponse(bookListObj) { var bookList = bookListObj.items; /* where to put the data on the Web page */ var bookDisplay = document.getElementById("bookDisplay"); /* write each title as a new paragraph */ for (i=0; i<bookList.length; i++) { var book = bookList[i]; var title = book.volumeInfo.title; var titlePgh = document.createElement("p"); /* ALWAYS AVOID using the innerHTML property */ titlePgh.textContent = title; bookDisplay.append(titlePgh); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function callAPI(query) {\r\n\tconsole.log('Calling API with query: ' + query);\r\n\t$.get(\"https://api.soundcloud.com/tracks?client_id=b3179c0738764e846066975c2571aebb\",\r\n\t\t {'q': query,\r\n\t\t 'limit': '20'},\r\n\t\t function(data) {\r\n\t\t// PUT IN YOUR CODE HERE TO PROCESS THE SOUNDCLOUD API'S RESP...
[ "0.66919136", "0.6685966", "0.65328956", "0.6441609", "0.64311993", "0.64059484", "0.637439", "0.6368524", "0.6366407", "0.63570154", "0.63570154", "0.63570154", "0.63570154", "0.63570154", "0.62984645", "0.62219214", "0.62196636", "0.6199115", "0.6187492", "0.6182562", "0.61...
0.0
-1
this is a temporary fix, while the client doesn't load item defs from the XML files. we pass this data on login events.
function getAssetInfo(){ return { 'position': {"x":-18,"y":-17,"w":37,"h":17}, 'thumb': "iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM\/rhtAAAAHElEQVR42u3BAQEAAACCIP+vbkhA\nAQAAAAAAfBoZKAABfmfvpAAAAABJRU5ErkJggg==", }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n dimDefinitions.getDefinitions().then((defs) => {\n vm.fullItem = dimItemService.getItem({ id: $stateParams.itemId });\n if (!vm.fullItem) {\n return;\n }\n vm.item = angular.copy(vm.fullItem);\n vm.originalItem = vm.item.originalItem;\n vm.definition = de...
[ "0.5748463", "0.55164236", "0.53796166", "0.5344184", "0.5259042", "0.5256958", "0.5169989", "0.51638", "0.5134933", "0.51117456", "0.5097181", "0.5095454", "0.50896466", "0.50818", "0.5047476", "0.5036078", "0.50360745", "0.5025489", "0.498207", "0.49803063", "0.49770433", ...
0.0
-1
onRealtimeChange Sweeps through all the blinking cells checking whether any cell should stop blinking (i.e. if the elapsed time since the status changed exceeds the configured threshold).
function blinkChecker() { const blinkers = mt.querySelectorAll('.blink'); for (let i = 0; i < blinkers.length; i++) { const cell = blinkers[i]; const sample = data.getParentGroupForAbsolutePath(cell.id) .samples[cell.id.toLowerCase()]; if (sample && SampleUtils.statusChangedRecently(sample, conf.blinkIfNewStatusThresholdMillis)) { cell.className = cell.className.replace(/blink blink-\w+/, ''); } } } // blinkChecker
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeStatus() {\n for (let i = 0; i <= 5; i++) {\n delay(i, timerValues.currentSecond);\n }\n // if (didMountRef.current) {\n // } else didMountRef.current = true;\n }", "_processDelayedTriggers() {\n if (this.isDestroyed) return;\n let hasChange = false;\n this._delayedTrigg...
[ "0.59838164", "0.58558714", "0.5646531", "0.5603906", "0.5603906", "0.554309", "0.5522416", "0.549008", "0.5475295", "0.544291", "0.5417059", "0.54146546", "0.54032856", "0.5370975", "0.53327507", "0.531633", "0.5298158", "0.5263667", "0.5263667", "0.5249394", "0.52420706", ...
0.66011703
0
invoke all of the above!
function invokeFacebookDewaller() { // append these styles by default, always appendStyle(defaultStyles); // since we couldn't find css selectors to detect if a user is logged // out on mobile, we have to do this.. :( const logo = document.querySelectorAll(`#${MOBILE_HEADER_ID} a`); const isMobileLoggedOut = logo && logo.length > 0 && logo[0].href === MOBILE_LOGIN_URL; hidePopout() if (isMobileLoggedOut) { appendStyle(mobileStyles); } // else if its desktop, start observing changes else if (logo.length < 1) { observeAndCloseExpandingCTA(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "apply () {}", "function _____SHARED_functions_____(){}", "private public function m246() {}", "_reflow() {\n this._init();\n }", "transient private protected internal function m182() {}", "private internal function m248() {}", "transient protected internal function m189() {}", "__previnit(){}", ...
[ "0.61486787", "0.6095275", "0.59704304", "0.5846701", "0.5834664", "0.57588583", "0.5750848", "0.56572425", "0.5624521", "0.55888045", "0.557692", "0.5556176", "0.55210626", "0.5507142", "0.54975337", "0.54920316", "0.5489686", "0.5488511", "0.54846907", "0.54807717", "0.5478...
0.0
-1
tested POST in Postman
function generateToken(user) { // header payload and verify signature // payload -> username, id, roles, expiration date const payload = { sub: user.id, fullname: user.fullname, username: user.username, phonenumber: user.phonenumber }; const options = { expiresIn: "1d" }; // verify signature -> a secret, 'process.env.JWT_SECRET' IS HAVING ISSUES return jwt.sign(payload, process.env.JWT_SECRET, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function postName() {\n logPadded(\"/GET \" + AUT_HOSTNAME);\n let post_api = new AUT.POST_API();\n let req = rb.setAPI(post_api)\n .replaceInURL('{{post}}', 'post')\n .replaceInJSONBody('{{name}}','Gabriel')\n .addHeader('Content-Type', 'application/json')\n .replaceInHeaders('{{Bearer}}','MyToken'...
[ "0.6802846", "0.6643565", "0.6438033", "0.63552797", "0.63202626", "0.6265566", "0.6237132", "0.621714", "0.62097484", "0.6123745", "0.6116276", "0.610653", "0.60986143", "0.6095306", "0.6087789", "0.60817474", "0.60777634", "0.6069204", "0.6051701", "0.6047475", "0.60450596"...
0.0
-1
Method Hoisting => To reduce cluttering But we should look for better alternatives
function getExperiences(limit) { return new Promise((resolve, reject) => { Experiences.find((err, obj) => { if (err) { console.log('error:', err); reject(err); } else { resolve(obj); } }).limit(limit); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "myBestMethod(){\n\n }", "function hoistingFunc()\n{ \n console.log('hoisting ordinary fufunc')\n \n}", "function fm(){}", "function hoist_2() {\n var message='Hoisting is all the rage!'\n return (message);\n }", "function hoge() {}", "function fn() {\n\t\t }", "function fCommonFunctiona...
[ "0.6062986", "0.59748125", "0.58538485", "0.5770878", "0.5760765", "0.5755574", "0.57280743", "0.57028717", "0.5671102", "0.56617004", "0.5609969", "0.5583225", "0.55815053", "0.55673355", "0.55618614", "0.5560218", "0.5559", "0.55583125", "0.55583125", "0.55583125", "0.55437...
0.0
-1
courtesy of w3schools, from:
function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "static private internal function m121() {}", "function Wn(){}", "static final private internal function m106() {}", "function Pythia() {}", "function Scdr() {\r\n}", "transient prote...
[ "0.58017325", "0.5790286", "0.5572558", "0.54797405", "0.5363318", "0.53116834", "0.5230014", "0.5218948", "0.51847404", "0.5126241", "0.5100212", "0.509153", "0.5084706", "0.5082649", "0.50633335", "0.5053083", "0.50342613", "0.5034033", "0.50327814", "0.5032252", "0.5026983...
0.0
-1
This is an empty array where peoples names & katzDeli Line Will be stored
function takeANumber(katzDeliLine,name) { katzDeliLine.push(name); // adding names of customers to the array katzDeliLine var number = katzDeliLine.length; // how many customers are in the array return `Welcome, ${name}. You are number ${number} in line.` //returning }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function destructivelyAppendKitten(array, name) {\n kittens.push(\"Ralph\");\n return array;\n}", "function addingHonorific(honorific, nameArr) {\n let output = [];\n if (nameArr.length == 0) {\n return nameArr;\n }\n for (name of nameArr) {\n console.log(name)\n for (let char ...
[ "0.5804787", "0.57776666", "0.57100576", "0.57060647", "0.5695514", "0.5693508", "0.56860673", "0.5670398", "0.5625604", "0.5616661", "0.56055313", "0.55768836", "0.5566456", "0.5519512", "0.55134654", "0.54859585", "0.54769814", "0.54467183", "0.5438823", "0.5438229", "0.543...
0.0
-1
Create the grid on screen
function createGrid(grid, type) { deleteGrid(grid); grid.classList.remove('empty-grid'); grid.classList.remove('wall-grid'); grid.classList.remove('point-grid'); grid.classList.remove('pacman-grid'); switch (type) { case 'EMPTY': wall.classList.add('empty-grid'); wall.style.backgroundColor = '#FFF'; wall.style.border = '1px solid #E5E5E5'; case 'WALL': grid.classList.add('wall-grid'); grid.style.border = '1px solid #BEBEBE'; grid.style.backgroundColor = '#E5E5E5'; break; case 'POINT': let point = document.createElement('div'); grid.classList.add('point-grid'); grid.style.backgroundColor = "transparent"; point.style.backgroundColor = '#F8B090'; point.style.borderRadius = '50%'; point.style.padding = '10px'; point.style.transform = 'scale(0.2)'; point.style.position = 'absolute'; grid.appendChild(point); break; case 'PACMAN': let pacman = document.createElement('div'); grid.classList.add('pacman-grid'); grid.style.backgroundColor = "transparent"; pacman.style.backgroundColor = '#26A69A'; pacman.style.borderRadius = '50%'; pacman.style.padding = '10px'; pacman.style.transform = 'scale(0.6)'; pacman.style.position = 'absolute'; grid.appendChild(pacman); break; } grid.addEventListener('mousedown', updateGrid); grid.addEventListener('mouseover', mouseOverEvent); grid.addEventListener('mouseup', mouseUpEvent); addID(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createGrid(width, height) {\n\n}", "function _createGrid() {\n\t_grid = [$game.VIEWPORT_WIDTH];\n\tvar i = $game.VIEWPORT_WIDTH;\n\twhile(--i >= 0) {\n\t\t_grid[i] = [$game.VIEWPORT_HEIGHT];\n\t\tvar j = $game.VIEWPORT_HEIGHT;\n\t\twhile(--j >= 0) {\n\t\t\t//place random object\n\t\t\tvar item = _makeRa...
[ "0.804228", "0.79481465", "0.79037184", "0.7850515", "0.78166574", "0.7792787", "0.778525", "0.76863337", "0.7627451", "0.7592078", "0.7573319", "0.7566132", "0.75278264", "0.7494713", "0.7482197", "0.74779546", "0.7464974", "0.74450034", "0.74395144", "0.7438352", "0.7436363...
0.0
-1
Delete the grid on screen
function deleteGrid(grid) { grid.classList.remove('wall-grid'); grid.classList.remove('point-grid'); grid.classList.remove('pacman-grid'); grid.classList.add('empty-grid'); grid.removeAttribute('style'); grid.innerHTML = ''; grid.style.border = '1px solid #E5E5E5'; grid.style.backgroundColor = '#FFF'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeGrid() {\n grid.empty();\n}", "function deleteBoard(){\n\tif(grid != null){\n \t\tdocument.body.removeChild(grid);\n \t}\n}", "function deleteGrid(){\n grid.innerHTML = '';\n }", "function deleteGrid(){\n var myNode = document.getElementById('grid-container');\n while(myNode.fir...
[ "0.8240118", "0.8050491", "0.79045475", "0.7678401", "0.7616826", "0.7613384", "0.7505608", "0.7442434", "0.742878", "0.7427919", "0.73852193", "0.7344209", "0.732582", "0.73198044", "0.7295637", "0.7200764", "0.71590126", "0.71507716", "0.7128", "0.7119615", "0.7116384", "...
0.7597433
6
Checks for flag > draws
function mouseOverEvent(e) { if (e.button == 0) { if (left_click_drag_flag) { createGrid(this, active_object); } } if (e.buttons == 2) { if (right_click_drag_flag) { deleteGrid(this); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkDraw() {\n\t\tif (!this.checkWin()) {\n\t\t\tfor (var i = 0; i < 3; i++) {\n\t\t\t\tfor (var j = 0; j < 3; j++) {\n\t\t\t\t\tif (this.board[i][j] == '-') {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}", "function drawing(){\n\t\treturn M.status == 'drawing';\n\t...
[ "0.70300305", "0.7016894", "0.7013878", "0.6940285", "0.6912779", "0.6840337", "0.68261623", "0.6765162", "0.6748648", "0.6619517", "0.6605564", "0.6519338", "0.6493231", "0.64735246", "0.64451104", "0.64253426", "0.6425103", "0.63631594", "0.6356713", "0.6353787", "0.6350529...
0.0
-1
Checks for flag > stop drawing
function mouseUpEvent(e) { switch (e.button) { case 0: left_click_drag_flag = false; break; case 2: right_click_drag_flag = false; break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "stopdraw(ev) {\n this.is_drawing = false;\n }", "function stopDrawing(event) {\n isDrawing = false;\n [lastX, lastY] = [0, 0];\n}", "function endingPoint() {\n painting = false;\n ctx.beginPath();\n }", "function stop (){\n\t\t\t\t// Switch the paint status to false\n\t\t\t\tpaint = false;...
[ "0.77894545", "0.76637816", "0.74050754", "0.7364355", "0.7339853", "0.7305041", "0.72641885", "0.72250944", "0.7168692", "0.6922854", "0.6756381", "0.6728722", "0.67209077", "0.66912043", "0.6664792", "0.6659806", "0.66434693", "0.66144294", "0.66121805", "0.66078514", "0.65...
0.0
-1
Checks if mouse has reached out of bounds
function mouseLeaveEvent() { left_click_drag_flag = false; right_click_drag_flag = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boundsCheck(xM, yM, x, y, w, h){ \n if(xM > x && xM < x + w && yM > y && yM < y+ h){\n return true; //mouse in boundary \n }else{\n return false; //mouse not in boundary \n } \n}", "boundsCheck(xM, yM, x, y, w, h){ \n if(xM > x && xM < x + w && yM > y && yM < y...
[ "0.73939806", "0.728551", "0.70700103", "0.7066472", "0.70056903", "0.6969794", "0.6950059", "0.6938393", "0.6898686", "0.68246645", "0.6819011", "0.6811353", "0.6806776", "0.677719", "0.6762019", "0.6762019", "0.6732886", "0.6728688", "0.67238617", "0.67154896", "0.66656756"...
0.0
-1
Select objects from Object Selection
function selectObject(obj) { if (obj == 'WALL') { buttonObjectWall.classList.add('button-object-active'); } else { active_object = this.value; resetSelectObject(); this.classList.add('button-object-active'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GET_SELECTION_OBJECTS(nodesToSelect,btCanvas) {\n\t\tvar nodes = {};\n\t\tvar nodesToSelectObj;\n\t\t\n\t\tvar asyncGetObjs = new Deferred();\n\t\t\n\t\tbtCanvas.getAllNodes().then(function(canvasNodes){\n\t\t\tif(nodesToSelect instanceof String) {\n\t\t\t\tvar nodeId = nodesToSelect;\n\t\t\t\tnodesToSele...
[ "0.63035685", "0.60754573", "0.605465", "0.5982493", "0.5980544", "0.5978813", "0.59754485", "0.59696496", "0.59694123", "0.59479326", "0.5923019", "0.59040385", "0.5875845", "0.5863877", "0.5838378", "0.5810194", "0.57753915", "0.5772462", "0.57420677", "0.5731014", "0.57288...
0.0
-1
Reset object selectors, default: WALL
function resetSelectObject() { let e = document.getElementsByClassName('button-object'); for (let i = 0; i < e.length; i++) { e[i].classList.remove('button-object-active'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetObjects()\n {\n //remove rectangles for collidable bodies\n this.buttons.forEach(this.deleteBody, this, true);\n this.spikes.forEach(this.deleteBody, this, true);\n\n this.startdoors.destroy();\n this.enddoors.destroy();\n this.buttons.destroy();\n this.spik...
[ "0.6695651", "0.64745295", "0.6332994", "0.6328398", "0.6297724", "0.61921024", "0.6152285", "0.61299545", "0.60786873", "0.60747224", "0.6068768", "0.60511", "0.6044823", "0.60345256", "0.5995003", "0.594371", "0.5932144", "0.5927758", "0.59202194", "0.5913779", "0.59134203"...
0.6578862
1
Get information from HTML Gets grid as object
function getGrid(pos) { let childs = c.childNodes; return childs[pos]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getgridobj() {\n\n return gridobj;\n\n }", "function getTableDataFromHtml() {\n\n }", "async getBasicInfo(){\n //<== Html selectors ==>\n const fieldNameClassName = \".gsc_oci_field\";\n const valueClassName = \".gsc_oci_value\";\n\n // <== Logic ==>\n\n ...
[ "0.62952757", "0.6100271", "0.5985714", "0.58489484", "0.58190185", "0.5813813", "0.5769689", "0.5646969", "0.5642653", "0.5636922", "0.563019", "0.5532093", "0.5487082", "0.5481826", "0.54785156", "0.54755294", "0.5474268", "0.53948504", "0.5391853", "0.539051", "0.5388551",...
0.5571909
11
Gets classes of grid
function getGridClass(pos) { let childs = c.childNodes; let classes = childs[pos].className.split(' '); return classes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getGridListClassName() {\n let className = 'mdc-grid-list';\n if (this.discrete) {\n className = ` ${className} mdc-grid-list--tile-aspect-${this.discrete}`;\n }\n return className;\n }", "classes() {\n return this.dataset.reduce(function(acc, val) {\n if (!a...
[ "0.6726289", "0.656211", "0.6380683", "0.6373211", "0.63535035", "0.6170914", "0.6142879", "0.60805404", "0.6044492", "0.6039013", "0.5991184", "0.59665126", "0.59512544", "0.5889567", "0.5839026", "0.5799785", "0.5792509", "0.5755829", "0.5738841", "0.5723032", "0.5712661", ...
0.7735994
0
Render the map by removing borders
function renderMap() { for (let i = 0; i < gs; i++) { let grid = getGrid(i); if (getGridClass(i) != 'wall-grid') { grid.style.border = 'none'; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeBorders() {\n for (let i = 0; i < resultingMap.length; i++) {\n for (let j = 0; j < resultingMap[i].length; j++) {\n if (i <= 5 || j <= 5 || i + 5 >= resultingMap.length || j + 5 >= resultingMap[i].length) {\n resultingMap[i][j] = 1.5;\n ...
[ "0.6837888", "0.676992", "0.66784406", "0.6600019", "0.65457547", "0.652174", "0.6381404", "0.6335877", "0.63255894", "0.6270208", "0.6211184", "0.6188512", "0.6187455", "0.61447555", "0.613084", "0.61243486", "0.6120234", "0.6116621", "0.61153203", "0.61013836", "0.6096328",...
0.8033667
0
Move grid from one position to another
function moveGrid(from, to) { let fromGrid = getGrid(from); let toGrid = getGrid(to); let type = null; if (getGridClass(from).includes('wall-grid')) { type = 'WALL'; } if (getGridClass(from).includes('point-grid')) { type = 'POINT'; } if (getGridClass(from).includes('pacman-grid')) { type = 'PACMAN'; } createGrid(toGrid, type); deleteGrid(fromGrid); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "move (grid) {\n if (this.orientation.dir === Orientation.left) {\n this.position.col--;\n } else if (this.orientation.dir === Orientation.right) {\n this.position.col++;\n } else if (this.orientation.dir === Orientation.up) {\n this.position.row--;\n } else if (this.orientation.dir === O...
[ "0.7277735", "0.70626795", "0.6920805", "0.68316376", "0.682442", "0.6781662", "0.6776107", "0.66860545", "0.6669701", "0.6667203", "0.66266286", "0.6598193", "0.6496671", "0.6494922", "0.6493021", "0.64929867", "0.6491298", "0.6466314", "0.6463256", "0.6459151", "0.64571863"...
0.77663064
0
Add 0624 IDs to grids
function addID() { for (let i = 0; i < gs; i++) { if (getGrid(i) != undefined) { getGrid(i).id = i; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createElIds () {\n // squares on the board\n for (var i = 0; i < num_rows(); i++) {\n for (var j = 0; j < num_cols(); j++) {\n let square = i + '-' + j;\n squareElsIds[square] = square + '-' + uuid()\n }\n }\n }", "function createElIds() {\n // squares ...
[ "0.6835014", "0.68223274", "0.6530076", "0.64857787", "0.62546915", "0.6206812", "0.6076561", "0.6065555", "0.59931254", "0.59067154", "0.588301", "0.58692056", "0.57911515", "0.5734439", "0.5693299", "0.5677939", "0.5676703", "0.5676455", "0.56720906", "0.5645174", "0.562828...
0.68958646
0
Reset direction of player
function resetDirection() { left = false; up = false; right = false; down = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() {\n player.x = 0;\n player.y = 0;\n }", "function resetPlayer() {\n player.x = 210;\n player.y = 380;\n}", "function reset() {\n player.x = 200;\n player.y = 380;\n}", "resetPlayerPos () {\n player.x = 200;\n player.y = 400;\n this.gotGift = ...
[ "0.74985015", "0.7396591", "0.7369337", "0.72865397", "0.72732425", "0.71855325", "0.7099323", "0.69636613", "0.6897125", "0.68936783", "0.6665725", "0.6629178", "0.6627006", "0.66111535", "0.65860325", "0.6536323", "0.64991385", "0.6470816", "0.64644617", "0.64529437", "0.64...
0.7733612
0
The ReportIemContext simplifies the signature for all of the functions to pass context around
function reportItemContext(RS, CurrObj, CurrObjIndex, CurrObjParent, $HTMLParent, Style, CurrLocation, ApplyBackgroundColor) { this.RS = RS; this.CurrObj = CurrObj; this.CurrObjIndex = CurrObjIndex; this.CurrObjParent = CurrObjParent; this.$HTMLParent = $HTMLParent; this.Style = Style; this.CurrLocation = CurrLocation; this.ApplyBackgroundColor = ApplyBackgroundColor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "processContext(context) {}", "function LContext() {}", "function LContext() {}", "function LContext() {}", "function LContext() { }", "function LContext() { }", "function handleContext(which)\n{\n}", "ShowAsContext() {}", "function ExContext1() {\n console.log('This is ExContext1');\n}", "functi...
[ "0.55455905", "0.50620794", "0.50620794", "0.50620794", "0.5027646", "0.5027646", "0.50211567", "0.5018765", "0.4989319", "0.49651268", "0.49556524", "0.49556524", "0.49051723", "0.49051723", "0.48534697", "0.48258108", "0.4811757", "0.4753377", "0.47380167", "0.47245184", "0...
0.5079132
1
Temp measurement mimics the server measurement object
function tempMeasurement(height, width) { this.Height = height; this.Width = width; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function temp_sensor() {\r\n var celsius = temp.value();\r\n var fahrenheit = celsius * 9.0/5.0 + 32.0;\r\n console.log(celsius + \" degrees Celsius, or \" +\r\n Math.round(fahrenheit) + \" degrees Fahrenheit\");\r\n\r\n deviceClient.publish(\"status\",\"json\",'{\"d\" : { \"temp...
[ "0.68377304", "0.65977776", "0.63589317", "0.62703145", "0.62618816", "0.6237961", "0.6230184", "0.6226041", "0.6220357", "0.62076133", "0.6195554", "0.60817236", "0.6050298", "0.5998605", "0.5990062", "0.592125", "0.5838621", "0.5780955", "0.57771784", "0.57393694", "0.57215...
0.60075486
13
Report Item Location is used my the layout to absolute position objects in a rectangle/section/column
function reportItemLocation(index) { this.TopDelta = 0; this.Height = 0; this.Left = 0; this.Index = index; this.IndexAbove = null; this.NewHeight = null; this.NewTop = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function RowLayoutResult(){this.layoutedBounds=new RectangleF(0,0,0,0);}", "function layout(item) {\n let groupContainer = requireContainer();\n\n let style = styles.get(item.decoration.style);\n if (!style) {\n (0,_utils__WEBPACK_IMPORTED_MODULE_1__.logErrorMessage)(`Unknown decoration style: ${it...
[ "0.5833411", "0.5710618", "0.5598458", "0.5542617", "0.5485298", "0.5453277", "0.54371893", "0.5434338", "0.5397356", "0.5314588", "0.53019327", "0.5265581", "0.5257372", "0.5240789", "0.52221084", "0.5216181", "0.51899916", "0.5183845", "0.5183437", "0.5166687", "0.5156476",...
0.6942143
0
The Floating header object holds pointers to the tablix and its row and col header objects
function floatingHeader($tablix, $rowHeader, $colHeader) { this.$tablix = $tablix; this.$rowHeader = $rowHeader; this.$colHeader = $colHeader; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function UltraGrid_InitialiseHeaders(theObject)\n{\n\t//internal function that builds a header\n\tfunction _BuildHeaderObject(header, theObject, index)\n\t{\n\t\t//create the object\n\t\tvar newHeader = new IntObject_IntObject({ Id: \"UltraGrid_\" + theObject.DataObject.Id + \"_Header_\" + index, Class: __NEMESIS_...
[ "0.65234226", "0.6505486", "0.6413109", "0.6380549", "0.6181069", "0.6154904", "0.6051827", "0.59653074", "0.58937305", "0.58296263", "0.5820199", "0.5790314", "0.56836903", "0.5657634", "0.5587748", "0.5529591", "0.5523908", "0.5519103", "0.5504231", "0.5486227", "0.5486227"...
0.7719048
0
import Search from "./components/Search";
function App() { return ( <> <FetchData /> </> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n return (\n\n <div>\n This is React search Component !\n </div>\n );\n }", "render() { \n return (\n <div className='container'>\n <h1 className='text-center mt-3'>REACT 101</h1>\n <SearchBar/>\n ...
[ "0.7420102", "0.66341865", "0.66134113", "0.65840745", "0.64439327", "0.6428957", "0.6334326", "0.62824976", "0.6137709", "0.61185277", "0.61111546", "0.61076826", "0.60945904", "0.6078033", "0.6075763", "0.60537434", "0.60469407", "0.60238415", "0.6021306", "0.60123175", "0....
0.0
-1
constructor This is the exported function/class
function GeolocationHandler(browserGeolocation) { watching = false; geolocation = browserGeolocation; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "consructor() {\n }", "constructor() {\n\t\t// ...\n\t}", "constructur() {}", "constructor (){}", "constructor() {\n\n\t}", "constructor() {\n }", "constructor() {\r\n // ohne Inhalt\r\n }", "function _construct()\n\t\t{;\n\t\t}", "constructor(){\r\n\t}", "constructor(){}...
[ "0.8267086", "0.8056631", "0.7920508", "0.7919077", "0.78359854", "0.7832339", "0.7801367", "0.7770227", "0.769394", "0.76896954", "0.76896954", "0.76896954", "0.76896954", "0.76896954", "0.76896954", "0.76896954", "0.7660997", "0.7660997", "0.7631949", "0.7561031", "0.753324...
0.0
-1
?&q is looking for the username after the = and return the results
searchUser(username) { return fetch(`${remoteURL}/users/?&q=${username}`).then((result) => result.json()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function retSearchStr(usrInput) {\n var query = \"https://en.wikipedia.org//w/api.php?action=query&format=json&origin=\\*&uselang=user&list=search&srsearch=\"; // MediaWiki web service API\n return query + encodeURI(usrInput);\n }", "function getUserName() {\n // check the url and store it in a variable ...
[ "0.65719706", "0.654805", "0.6448841", "0.6435348", "0.6280947", "0.6273593", "0.6236742", "0.61222726", "0.6096036", "0.6086386", "0.5988079", "0.595955", "0.5952544", "0.5940601", "0.5893327", "0.5888152", "0.5844223", "0.58391535", "0.58031386", "0.5800306", "0.579948", ...
0.64330864
4
Create a quick build, installing any required dependencies first if they're not resolvable.
function build(args, appConfig, cb) { if (args._.length === 1) { return cb(new _errors.UserError('An entry module must be specified.')); } let dist = args._[2] || 'dist'; (0, _runSeries2.default)([cb => (0, _utils.install)(appConfig.getQuickDependencies(), { args, check: true }, cb), cb => (0, _cleanApp2.default)({ _: ['clean-app', dist] }, cb), cb => (0, _webpackBuild2.default)(`${appConfig.getName()} app`, args, () => createBuildConfig(args, appConfig.getQuickBuildConfig()), cb)], cb); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function installBuildDependencies() {\n const dependencyList = 'libyaml-dev libgdbm-dev libreadline-dev libncurses5-dev zlib1g-dev libffi-dev'\n\n await installDependencies('ruby-build', dependencyList);\n}", "async function installBuildDependencies() {\n const dependencyList = 'libyaml-dev libgdbm-dev ...
[ "0.66804874", "0.66804874", "0.6013059", "0.5803856", "0.57553476", "0.5716739", "0.56893337", "0.562359", "0.5620348", "0.56062967", "0.5593605", "0.55020136", "0.5477642", "0.5471858", "0.54423535", "0.54423535", "0.5436799", "0.5436477", "0.54091054", "0.54032296", "0.5330...
0.4998332
47
Create default command config for a quick app build and merge any extra config provided into it.
function createBuildConfig(args, options) { let { commandConfig: extraConfig = {}, defaultTitle, renderShim, renderShimAliases } = options; let entry = _path2.default.resolve(args._[1]); let dist = _path2.default.resolve(args._[2] || 'dist'); let mountId = args['mount-id'] || 'app'; let production = process.env.NODE_ENV === 'production'; let filenamePattern = production ? '[name].[chunkhash:8].js' : '[name].js'; let config = { babel: { stage: 0 }, devtool: 'source-map', output: { chunkFilename: filenamePattern, filename: filenamePattern, path: dist, publicPath: '/' }, plugins: { html: { mountId, title: args.title || defaultTitle }, // A vendor bundle can be explicitly enabled with a --vendor flag vendor: args.vendor } }; if (renderShim == null || args.force === true) { config.entry = { app: [entry] }; } else { // Use a render shim module which supports quick prototyping config.entry = { app: [renderShim] }; config.plugins.define = { NWB_QUICK_MOUNT_ID: JSON.stringify(mountId) }; config.resolve = { alias: _extends({ // Allow the render shim module to import the provided entry module 'nwb-quick-entry': entry }, renderShimAliases) }; } if (args.polyfill === false || args.polyfills === false) { config.polyfill = false; } return (0, _webpackMerge2.default)(config, extraConfig); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildAppConfiguration({\n auth,\n broker,\n cache,\n system,\n telemetry\n}) {\n const systemOptions = {\n ...DEFAULT_SYSTEM_OPTIONS,\n networkClient: new HttpClient(system == null ? void 0 : system.proxyUrl, system == null ? void 0 : system.customAgentOptions),\n loggerOptions: (system == ...
[ "0.6103762", "0.5995827", "0.59254086", "0.58840877", "0.5857223", "0.5810362", "0.57954615", "0.575109", "0.5693987", "0.566224", "0.5651829", "0.5620182", "0.55713636", "0.5534196", "0.5529791", "0.5519509", "0.5496052", "0.5459381", "0.5455807", "0.5424215", "0.54218477", ...
0.6128931
0
Create default command config for quick serving and merge any extra config provided into it.
function createServeConfig(args, options) { let { commandConfig: extraConfig = {}, defaultTitle, renderShim, renderShimAliases } = options; let entry = _path2.default.resolve(args._[1]); let dist = _path2.default.resolve(args._[2] || 'dist'); let mountId = args['mount-id'] || 'app'; let config = { babel: { stage: 0 }, output: { filename: 'app.js', path: dist, publicPath: '/' }, plugins: { html: { mountId, title: args.title || defaultTitle } } }; if (args.force === true || renderShim == null) { config.entry = [entry]; } else { config.entry = [renderShim]; config.plugins.define = { NWB_QUICK_MOUNT_ID: JSON.stringify(mountId) }; config.resolve = { alias: _extends({ // Allow the render shim module to import the provided entry module 'nwb-quick-entry': entry }, renderShimAliases) }; } if (args.polyfill === false || args.polyfills === false) { config.polyfill = false; } return (0, _webpackMerge2.default)(config, extraConfig); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mergeOptions() {\n\t\tthis.config = _.defaultsDeep(this.configFile, ServiceBroker.defaultOptions);\n\n\t\tthis.config = this.overwriteFromEnv(this.config);\n\n\t\tif (this.flags.silent) this.config.logger = false;\n\n\t\tif (this.flags.hot) this.config.hotReload = true;\n\n\t\t// console.log(\"Merged configuration...
[ "0.61444956", "0.59835136", "0.590307", "0.5881614", "0.5878789", "0.5798412", "0.5797724", "0.57779974", "0.5774831", "0.57666975", "0.5728066", "0.57263243", "0.5717967", "0.566221", "0.564617", "0.5633163", "0.5629365", "0.5624385", "0.55647796", "0.5557433", "0.55330676",...
0.58796704
4
Run a quick development server, installing any required dependencies first if they're not resolvable.
function serve(args, appConfig, cb) { if (args._.length === 1) { return cb(new _errors.UserError('An entry module must be specified.')); } (0, _runSeries2.default)([cb => (0, _utils.install)(appConfig.getQuickDependencies(), { args, check: true }, cb), cb => (0, _webpackServer2.default)(args, createServeConfig(args, appConfig.getQuickServeConfig()), cb)], cb); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function start() {\n if (!process.env.NODE_ENV) {\n process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV);\n }\n await run(checkVersion);\n await run(runServer);\n}", "async function startServer() {\n await startDevServer({\n readCliArgs: false,\n readFileConfig: true\n });\...
[ "0.6731838", "0.6694959", "0.6655131", "0.65913445", "0.6408564", "0.6335635", "0.6249138", "0.62113506", "0.6200073", "0.6175052", "0.61630344", "0.61295074", "0.6089659", "0.6070909", "0.6019326", "0.60121924", "0.598745", "0.5977397", "0.59683424", "0.5962741", "0.5951064"...
0.5494848
69
ouvrir la boite de dialogue info
function BBCodeGen() { // Vérifie présence champs if($("#titre").val()!="" && $("#categories").val()!="" && $("#resume").val()!="" && $("#url").val()!="") { // Détermine la réponse juste var ReponseJuste = 1 if ($("#reponsejuste1").val()=="vrai") ReponseJuste=1; if ($("#reponsejuste2").val()=="vrai") ReponseJuste=2; if ($("#reponsejuste3").val()=="vrai") ReponseJuste=3; // Générer le bbcode var bbcode = $("#titre").val()+"\n\n"; bbcode += "[b]Catégories :[/b]"+$("#categories").val()+"\n"; bbcode += "\n[hr]\n"; bbcode += "[b]Fiche :[/b]\n"; bbcode += $("#resume").val()+"\n"; bbcode += "[url="+$("#url").val()+"]"+$("#url").val()+"[/url]\n"; bbcode += "\n[hr]\n"; bbcode += "[img]"+$("#urlimage").val()+"[/img]"; bbcode += "\n[hr]\n"; bbcode += "[b]Quizz :[/b]\n"; bbcode += "Question : "+$("#question").val()+"\n\n"; bbcode += "Réponse1 : "+$("#reponse1").val()+"\n"; bbcode += "Réponse2 : "+$("#reponse2").val()+"\n"; bbcode += "Réponse3 : "+$("#reponse3").val()+"\n\n"; bbcode += "Réponse juste : "+$("#reponsejuste:checked").val()+"\n\n"; // Afficher le BBCode var message="BBCode à copier dans votre sujet : \n\n"+bbcode; alert(message); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onEditar(idAnimal,Descripcion) {\n this.dialog.show({\n title: \"Editar Tipo de Mascota\",\n body: \"Ingrese el nombre del tipo de mascota:\",\n prompt: Dialog.TextPrompt({\n placeholder: Descripcion,\n initialValue: Descripcion,\n required: true\n }),\n actions: [D...
[ "0.69468594", "0.68498343", "0.6839529", "0.6814066", "0.67721844", "0.66275126", "0.6597601", "0.6576382", "0.6532506", "0.6525526", "0.6498749", "0.644756", "0.6444631", "0.64414155", "0.6421334", "0.6398535", "0.63751554", "0.63565385", "0.6335139", "0.6313727", "0.627246"...
0.0
-1
v8 likes predictible objects
function Item(fun, array) { this.fun = fun; this.array = array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareLike(a,b){\n var al = a.idLikesProp.length;\n var bl = b.idLikesProp.length;\n if(al > bl) return -1;\n if(bl > al) return 1;\n return 0;\n}", "function lookAround() {\n var objectDescription = \"\"\n tj.see().then(function(objects) {\n objects.forEach(function(each) {\n ...
[ "0.527866", "0.52612406", "0.51951283", "0.518796", "0.51302594", "0.5044646", "0.48934332", "0.4857401", "0.484017", "0.48302925", "0.482028", "0.4812441", "0.4808473", "0.47852293", "0.47828078", "0.47574478", "0.47493434", "0.4739314", "0.47239366", "0.4703992", "0.4703992...
0.0
-1
Invokes `cb(event, listener, id)`. Avoids using call if no scope is provided. The `(listener,id)` pair effectively forms the "dispatch" but are kept separate to conserve memory.
function forEachEventDispatch(event, cb) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; if ("production" !== process.env.NODE_ENV) { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length; i++) { if (event.isPropagationStopped()) { break; } // Listeners and IDs are two parallel arrays that are always in sync. cb(event, dispatchListeners[i], dispatchIDs[i]); } } else if (dispatchListeners) { cb(event, dispatchListeners, dispatchIDs); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function forEachEventDispatch(event,cb){var dispatchListeners=event._dispatchListeners;var dispatchIDs=event._dispatchIDs;if(true){validateEventDispatches(event);}if(Array.isArray(dispatchListeners)){for(var i=0;i < dispatchListeners.length;i++) {if(event.isPropagationStopped()){break;} // Listeners and IDs are tw...
[ "0.61467254", "0.5821978", "0.5809984", "0.573854", "0.56206864", "0.56206864", "0.559617", "0.559617", "0.559617", "0.559617", "0.559617", "0.559617", "0.559617", "0.559617", "0.55561894", "0.55561894", "0.55561894", "0.55561894", "0.55561894", "0.55561894", "0.55561894", ...
0.5537116
34
Standard/simple iteration through an event's collected dispatches.
function executeDispatchesInOrder(event, cb) { forEachEventDispatch(event, cb); event._dispatchListeners = null; event._dispatchIDs = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function forEachEventDispatch(event,cb){var dispatchListeners=event._dispatchListeners;var dispatchIDs=event._dispatchIDs;if(\"production\"!==process.env.NODE_ENV){validateEventDispatches(event);}if(Array.isArray(dispatchListeners)){for(var i=0;i<dispatchListeners.length;i++){if(event.isPropagationStopped()){break...
[ "0.63409483", "0.6319276", "0.6217342", "0.6129877", "0.61230683", "0.61230683", "0.61230683", "0.61230683", "0.61230683", "0.61230683", "0.61230683", "0.61230683", "0.6119871", "0.6119871", "0.61158526", "0.6079185", "0.6079185", "0.6079185", "0.6079185", "0.6079185", "0.607...
0.0
-1
Standard/simple iteration through an event's collected dispatches, but stops at the first dispatch execution returning true, and returns that id.
function executeDispatchesInOrderStopAtTrueImpl(event) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; if ("production" !== process.env.NODE_ENV) { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length; i++) { if (event.isPropagationStopped()) { break; } // Listeners and IDs are two parallel arrays that are always in sync. if (dispatchListeners[i](event, dispatchIDs[i])) { return dispatchIDs[i]; } } } else if (dispatchListeners) { if (dispatchListeners(event, dispatchIDs)) { return dispatchIDs; } } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function executeDispatchesInOrderStopAtTrueImpl(event){var dispatchListeners=event._dispatchListeners;var dispatchIDs=event._dispatchIDs;if(true){validateEventDispatches(event);}if(Array.isArray(dispatchListeners)){for(var i=0;i < dispatchListeners.length;i++) {if(event.isPropagationStopped()){break;} // Listeners...
[ "0.65572757", "0.6539089", "0.6519623", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", "0.64886063", ...
0.64958555
7
Execution of a "direct" dispatch there must be at most one dispatch accumulated on the event or it is considered an error. It doesn't really make sense for an event with multiple dispatches (bubbled) to keep track of the return values at each dispatch execution, but it does tend to make sense when dealing with "direct" dispatches.
function executeDirectDispatch(event) { if ("production" !== process.env.NODE_ENV) { validateEventDispatches(event); } var dispatchListener = event._dispatchListeners; var dispatchID = event._dispatchIDs; ("production" !== process.env.NODE_ENV ? invariant( !Array.isArray(dispatchListener), 'executeDirectDispatch(...): Invalid `event`.' ) : invariant(!Array.isArray(dispatchListener))); var res = dispatchListener ? dispatchListener(event, dispatchID) : null; event._dispatchListeners = null; event._dispatchIDs = null; return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function accumulateTwoPhaseDispatchesSingle(event){if(event&&event.dispatchConfig.phasedRegistrationNames){traverseTwoPhase(event._targetInst,accumulateDirectionalDispatches,event);}}", "function accumulateTwoPhaseDispatchesSingle(event){if(event&&event.dispatchConfig.phasedRegistrationNames){traverseTwoPhase(ev...
[ "0.71810013", "0.71810013", "0.71810013", "0.71810013", "0.71810013", "0.71810013", "0.71810013", "0.71810013", "0.71810013", "0.71810013", "0.70838493", "0.7037272", "0.6949391", "0.6947151", "0.6943267", "0.6943267", "0.6943267", "0.6943267", "0.6943267", "0.6943267", "0.69...
0.0
-1
Copyright 20132015, Facebook, Inc. All rights reserved. This source code is licensed under the BSDstyle license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory.
function makeEmptyFunction(arg) { return function() { return arg; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "function facebookLogin()\r\n{\r\n var fb = FBConnect.install();\r\n fb.connect(client_id,redir_url,\"touch\");\r\n fb.onConnect = onFBConnected;\r\n \r\n}", "__fbpReady(){super.__fbpReady();//this._FBPTraceWires()\n}", ...
[ "0.5549114", "0.5514418", "0.5481513", "0.5372689", "0.5372689", "0.53702396", "0.52763975", "0.52045953", "0.5182847", "0.5170223", "0.51573247", "0.5145919", "0.51428807", "0.50596404", "0.5054992", "0.5025982", "0.50133777", "0.50014573", "0.49750748", "0.49750748", "0.497...
0.0
-1
This function accepts and discards inputs; it has no side effects. This is primarily useful idiomatically for overridable function endpoints which always need to be callable, since JS lacks a nullcall idiom ala Cocoa.
function emptyFunction() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function noop(a,b,c){}", "function noop(a,b,c){}", "function _noop$1() {}", "adoptedCallback() {\n // nop\n }", "function noop (a, b, c) {}", "function noop (a, b, c) {}", "function noop (a, b, c) {}", "function noop (a, b, c) {}", "function noop (a, b, c) {}", "function noop (a, b, c) {}", ...
[ "0.60225993", "0.60225993", "0.59222984", "0.58900267", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477", "0.5855477",...
0.0
-1
Base class helpers for the updating state of a component.
function ReactComponent(props, context) { this.props = props; this.context = context; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n BaseState.update.call(this);\n }", "_update() {\n // Call subclass lifecycle method\n const stateNeedsUpdate = this.needsUpdate();\n // End lifecycle method\n debug(TRACE_UPDATE, this, stateNeedsUpdate);\n\n if (stateNeedsUpdate) {\n this._updateState();\n }\n }", "func...
[ "0.72174495", "0.6760336", "0.6674498", "0.6611827", "0.6539205", "0.65264326", "0.6489361", "0.6470911", "0.64590335", "0.63847995", "0.63539994", "0.6335737", "0.63053733", "0.6304823", "0.6271708", "0.6266727", "0.62187904", "0.6214442", "0.61935455", "0.6188449", "0.61573...
0.0
-1
Mark a component as needing a rerender, adding an optional callback to a list of functions which will be executed once the rerender occurs.
function enqueueUpdate(component) { ensureInjected(); // Various parts of our code (such as ReactCompositeComponent's // _renderValidatedComponent) assume that calls to render aren't nested; // verify that that's the case. (This is called by each top-level update // function, like setProps, setState, forceUpdate, etc.; creation and // destruction of top-level components is guarded in ReactMount.) ("production" !== process.env.NODE_ENV ? warning( ReactCurrentOwner.current == null, 'enqueueUpdate(): Render methods should be a pure function of props ' + 'and state; triggering nested component updates from render is not ' + 'allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate.' ) : null); if (!batchingStrategy.isBatchingUpdates) { batchingStrategy.batchedUpdates(enqueueUpdate, component); return; } dirtyComponents.push(component); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shouldRerender () {\n return false\n }", "function renderCallback() {\n\n while (TO_RENDER.length) {\n TO_RENDER.shift().notify();\n }\n\n TO_RENDER.added = {};\n\n while (ENV_QUEUE.length) {\n var env = ENV_QUEUE.shift();\n for (var key in env.revalidateQueue) {\n env.revalidateQueue[key]....
[ "0.63914156", "0.62118226", "0.5860591", "0.58191264", "0.55730593", "0.5489673", "0.54876024", "0.54651797", "0.5460382", "0.5452329", "0.54490745", "0.54490745", "0.54490745", "0.54490745", "0.54490745", "0.54490745", "0.54490745", "0.54490745", "0.5448425", "0.54472405", "...
0.0
-1
Enqueue a callback to be run at the end of the current batching cycle. Throws if no updates are currently being performed.
function asap(callback, context) { ("production" !== process.env.NODE_ENV ? invariant( batchingStrategy.isBatchingUpdates, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.' ) : invariant(batchingStrategy.isBatchingUpdates)); asapCallbackQueue.enqueue(callback, context); asapEnqueued = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function batchedCallback(callback) {\n\treturn function(err, res) {\n\t\tReactUpdates.batchedUpdates(callback.bind(null, err, res));\n\t}\n}", "function asap(callback,context){ true?invariant(batchingStrategy.isBatchingUpdates,'ReactUpdates.asap: Can\\'t enqueue an asap callback in a context where' + 'updates ar...
[ "0.644611", "0.6350327", "0.6277181", "0.6277181", "0.6277181", "0.6277181", "0.6277181", "0.6277181", "0.6277181", "0.6277181", "0.6223461", "0.62219334", "0.62219334", "0.62219334", "0.62219334", "0.62219334", "0.62219334", "0.62219334", "0.62219334", "0.62219334", "0.62219...
0.0
-1
A specialized pseudoevent module to help keep track of components waiting to be notified when their DOM representations are available for use. This implements `PooledClass`, so you should never need to instantiate this. Instead, use `CallbackQueue.getPooled()`.
function CallbackQueue() { this._callbacks = null; this._contexts = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EventPool() {\n this.events = [];\n}", "function EventsQueue() {}", "function EventWaiter() {\n this._waitingList = [];\n EventEmitter.call( this );\n}", "function EventQueue(callback) {\n this.events = [];\n this.buf = [];\n this.callback = callback;\n}", "constructor() {\n this.ev...
[ "0.6005983", "0.59798104", "0.59571034", "0.5806244", "0.57873327", "0.5781845", "0.5781845", "0.5756741", "0.5756741", "0.5556443", "0.5556443", "0.55078167", "0.54365236", "0.5365971", "0.5360991", "0.53335243", "0.53318685", "0.53318685", "0.53318685", "0.53318685", "0.533...
0.0
-1
Helper to call ReactRef.attachRefs with this composite component, split out to avoid allocations in the transaction mountready queue.
function attachRefs() { ReactRef.attachRefs(this, this._currentElement); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attachRefs() {\r\n\t ReactRef.attachRefs(this, this._currentElement);\r\n\t}", "function attachRefs() {\n\t\t ReactRef.attachRefs(this, this._currentElement);\n\t\t}", "function attachRefs() {\n\t\t ReactRef.attachRefs(this, this._currentElement);\n\t\t}", "function attachRefs() {\n\t\t ReactRef...
[ "0.7583925", "0.75462466", "0.75462466", "0.75462466", "0.754196", "0.754196", "0.754196", "0.754196", "0.754196", "0.74904114", "0.74904114", "0.74904114", "0.74904114", "0.74904114", "0.74904114", "0.74904114", "0.74904114", "0.74904114", "0.74904114", "0.74904114", "0.7490...
0.7531328
76
Mixin helper which handles policy validation and reserved specification keys when building React classses.
function mixSpecIntoComponent(Constructor, spec) { if (!spec) { return; } ("production" !== process.env.NODE_ENV ? invariant( typeof spec !== 'function', 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.' ) : invariant(typeof spec !== 'function')); ("production" !== process.env.NODE_ENV ? invariant( !ReactElement.isValidElement(spec), 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.' ) : invariant(!ReactElement.isValidElement(spec))); var proto = Constructor.prototype; // By handling mixins before any other properties, we ensure the same // chaining order is applied to methods with DEFINE_MANY policy, whether // mixins are listed before or after these methods in the spec. if (spec.hasOwnProperty(MIXINS_KEY)) { RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); } for (var name in spec) { if (!spec.hasOwnProperty(name)) { continue; } if (name === MIXINS_KEY) { // We have already handled mixins in a special case above continue; } var property = spec[name]; validateMethodOverride(proto, name); if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { RESERVED_SPEC_KEYS[name](Constructor, property); } else { // Setup methods on prototype: // The following member methods should not be automatically bound: // 1. Expected ReactClass methods (in the "interface"). // 2. Overridden methods (that were mixed in). var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); var isAlreadyDefined = proto.hasOwnProperty(name); var markedDontBind = property && property.__reactDontBind; var isFunction = typeof property === 'function'; var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && !markedDontBind; if (shouldAutoBind) { if (!proto.__reactAutoBindMap) { proto.__reactAutoBindMap = {}; } proto.__reactAutoBindMap[name] = property; proto[name] = property; } else { if (isAlreadyDefined) { var specPolicy = ReactClassInterface[name]; // These cases should already be caught by validateMethodOverride ("production" !== process.env.NODE_ENV ? invariant( isReactClassMethod && ( (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY) ), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name ) : invariant(isReactClassMethod && ( (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY) ))); // For methods which are defined more than once, call the existing // methods before calling the new property, merging if appropriate. if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) { proto[name] = createMergedResultFunction(proto[name], property); } else if (specPolicy === SpecPolicy.DEFINE_MANY) { proto[name] = createChainedFunction(proto[name], property); } } else { proto[name] = property; if ("production" !== process.env.NODE_ENV) { // Add verbose displayName to the function, which helps when looking // at profiling tools. if (typeof property === 'function' && spec.displayName) { proto[name].displayName = spec.displayName + '_' + name; } } } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_validate() {\n throw new Error('_validate not implemented in child class');\n }", "_validate() {\n\t}", "required(cb) {\n const { path: lodashPath, fieldSchema: appModelPart, handlerSpec, userContext, modelSchema, row } = this;\n const { schemaName } = modelSchema;\n const val = vutil.getVa...
[ "0.5342845", "0.5112662", "0.5045094", "0.5017068", "0.50010127", "0.49944904", "0.4963574", "0.4963574", "0.49479422", "0.49393803", "0.49313897", "0.49260977", "0.49147072", "0.49147072", "0.4913085", "0.49105555", "0.49105555", "0.4899184", "0.48627192", "0.48627192", "0.4...
0.0
-1
Return the deepest cached node whose ID is a prefix of `targetID`.
function findDeepestCachedAncestor(targetID) { deepestNodeSoFar = null; ReactInstanceHandles.traverseAncestors( targetID, findDeepestCachedAncestorImpl ); var foundNode = deepestNodeSoFar; deepestNodeSoFar = null; return foundNode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findDeepestCachedAncestor(targetID) {\n deepestNodeSoFar = null;\n ReactInstanceHandles.traverseAncestors(\n targetID,\n findDeepestCachedAncestorImpl\n );\n\n var foundNode = deepestNodeSoFar;\n deepestNodeSoFar = null;\n return foundNode;\n}", "function findDeepestCachedAncestor(targetID) ...
[ "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265", "0.74199265"...
0.7301463
63
Recomputes the plugin list using the injected plugins and plugin ordering.
function recomputePluginOrdering() { if (!EventPluginOrder) { // Wait until an `EventPluginOrder` is injected. return; } for (var pluginName in namesToPlugins) { var PluginModule = namesToPlugins[pluginName]; var pluginIndex = EventPluginOrder.indexOf(pluginName); ("production" !== process.env.NODE_ENV ? invariant( pluginIndex > -1, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName ) : invariant(pluginIndex > -1)); if (EventPluginRegistry.plugins[pluginIndex]) { continue; } ("production" !== process.env.NODE_ENV ? invariant( PluginModule.extractEvents, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName ) : invariant(PluginModule.extractEvents)); EventPluginRegistry.plugins[pluginIndex] = PluginModule; var publishedEvents = PluginModule.eventTypes; for (var eventName in publishedEvents) { ("production" !== process.env.NODE_ENV ? invariant( publishEventForPlugin( publishedEvents[eventName], PluginModule, eventName ), 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName ) : invariant(publishEventForPlugin( publishedEvents[eventName], PluginModule, eventName ))); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "orderPlugins() {\r\n debug('orderPlugins:before', this.pluginNames);\r\n const runLast = this._plugins\r\n .filter(p => p.requirements.has('runLast'))\r\n .map(p => p.name);\r\n for (const name of runLast) {\r\n const index = this._plugins.findIndex(p => p.name...
[ "0.79937375", "0.74689573", "0.7168156", "0.71348816", "0.71348816", "0.71348816", "0.7127607", "0.71214473", "0.71175057", "0.7116182", "0.7116182", "0.7116182", "0.7099919", "0.7099919", "0.7099919", "0.7090084", "0.7090084", "0.7090084", "0.7090084", "0.7090084", "0.709008...
0.0
-1
This is a cleanroom implementation of adler32 designed for detecting if markup is not what we expect it to be. It does not need to be cryptographically strong, only reasonably good at detecting if markup generated on the server is different than that on the client.
function adler32(data) { var a = 1; var b = 0; for (var i = 0; i < data.length; i++) { a = (a + data.charCodeAt(i)) % MOD; b = (b + a) % MOD; } return a | (b << 16); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validateAltText(el) {\n let altText = el.getAttribute(\"alt\");\n return {\n extractedText: altText,\n result: this.isDescriptiveText(altText),\n };\n }", "function shouldDecode(content,encoded){var div=document.createElement('div');div.innerHTML=\"<div a=\\\"\"+cont...
[ "0.5425373", "0.53432", "0.5292201", "0.51598614", "0.5134596", "0.51264", "0.5021328", "0.49580628", "0.49421448", "0.49421448", "0.49421448", "0.49421448", "0.49421448", "0.49421448", "0.49421448", "0.49421448", "0.49421448", "0.49421448", "0.49421448", "0.49421448", "0.494...
0.4982218
12
Creates a new React class that is idempotent and capable of containing other React components. It accepts event listeners and DOM properties that are valid according to `DOMProperty`. Event listeners: `onClick`, `onMouseDown`, etc. DOM properties: `className`, `name`, `title`, etc. The `style` property functions differently from the DOM API. It accepts an object mapping of style properties to values.
function ReactDOMComponent(tag) { validateDangerousTag(tag); this._tag = tag; this._renderedChildren = null; this._previousStyleCopy = null; this._rootNodeID = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createElement(type,config,children){var propName=void 0;// Reserved names are extracted\nvar props={};var key=null;var ref=null;var self=null;var source=null;if(config!=null){if(hasValidRef(config)){ref=config.ref;}if(hasValidKey(config)){key=''+config.key;}self=config.__self===undefined?null:config.__sel...
[ "0.5344124", "0.5321388", "0.5321388", "0.5321388", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "0.5305959", "...
0.0
-1
Processes any enqueued updates.
function processQueue() { if (updateQueue.length) { ReactComponentEnvironment.processChildrenUpdates( updateQueue, markupQueue ); clearQueue(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleUpdates(){\n\t\t//put per update scripts here\n\t\tconsole.log('update');\n\t}", "function processUpdate() {\n _nextUpdateHandle = null;\n\n var interactionCount = _interactionSet.size;\n _addInteractionSet.forEach(handle =>\n _interactionSet.add(handle)\n );\n _deleteInteractionSet.forEach(handle ...
[ "0.7014526", "0.689392", "0.6827723", "0.6666324", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.662469", "0.66...
0.66279507
6
Clears any enqueued updates.
function clearQueue() { updateQueue.length = 0; markupQueue.length = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearQueue(){updateQueue.length = 0;markupQueue.length = 0;}", "function clearQueue(){updateQueue.length=0;markupQueue.length=0;}", "function clearQueue() {\n updateQueue.length = 0;\n markupQueue.length = 0;\n}", "function clearQueue() {\n updateQueue.length = 0;\n markupQueue.length = 0;\n}", ...
[ "0.7569423", "0.7565586", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "0.7432019", "...
0.736212
70
Opera <= 12 includes TextEvent in window, but does not fire text input events. Rely on keypress instead.
function isPresto() { var opera = window.opera; return ( typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onElementKeyPress(event) {}", "onElementKeyPress(event) {}", "keypress ( target, keyText ) {\n target.dispatchEvent(_keyboardEventFor('keypress', Editor.KeyCode(keyText)));\n }", "function l(){var n=this,r=window||t;o(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1}...
[ "0.6486552", "0.6486552", "0.6222524", "0.6210569", "0.62018853", "0.61968917", "0.6190954", "0.6188825", "0.6188825", "0.6188825", "0.6188825", "0.6188825", "0.61852413", "0.61852413", "0.61852413", "0.61852413", "0.61640525", "0.61309344", "0.61041343", "0.60923654", "0.608...
0.0
-1
Return whether a native keypress event is assumed to be a command. This is required because Firefox fires `keypress` events for key commands (cut, copy, selectall, etc.) even though no character is inserted.
function isKeypressCommand(nativeEvent) { return ( (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command. !(nativeEvent.ctrlKey && nativeEvent.altKey) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isKeypressCommand(nativeEvent) {\r\n\t return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&\r\n\t // ctrlKey && altKey is equivalent to AltGr, and is not a command.\r\n\t !(nativeEvent.ctrlKey && nativeEvent.altKey);\r\n\t}", "function isKeypressCommand(nativeEvent) {\n // ...
[ "0.80084205", "0.7999546", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", "0.7998441", ...
0.80167186
4
Some event types have a notion of different registration names for different "phases" of propagation. This finds listeners by a given phase.
function listenerAtPhase(id, event, propagationPhase) { var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; return getListener(id, registrationName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listenerAtPhase(inst, event, propagationPhase) {\n\t\t var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];\n\t\t return getListener(inst, registrationName);\n\t\t}", "function listenerAtPhase(inst, event, propagationPhase) {\n\t\t var registrationName = event.dispat...
[ "0.6932249", "0.6932249", "0.69313186", "0.69313186", "0.69313186", "0.69313186", "0.69313186", "0.69313186", "0.69313186", "0.69313186", "0.69313186", "0.69313186", "0.69313186", "0.69313186", "0.69313186", "0.6924426", "0.6924426", "0.69004923", "0.69004923", "0.69004923", ...
0.0
-1
Tags a `SyntheticEvent` with dispatched listeners. Creating this function here, allows us to not have to bind or create functions for each event. Mutating the event's members allows us to not have to create a wrapping "dispatch" object that pairs the event with the listener.
function accumulateDirectionalDispatches(domID, upwards, event) { if ("production" !== process.env.NODE_ENV) { if (!domID) { throw new Error('Dispatching id must not be null'); } } var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured; var listener = listenerAtPhase(domID, event, phase); if (listener) { event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); event._dispatchIDs = accumulateInto(event._dispatchIDs, domID); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _on (event, listener) {\n if (typeof _events[event] !== 'object') {\n _events[event] = [];\n }\n\n _events[event].push(listener);\n }", "on(event: string, listener: Function): void {\n if (typeof this.__events[event] !== 'object') {\n this.__events[event] = [];\n ...
[ "0.6239649", "0.60972184", "0.56858253", "0.5662959", "0.56118935", "0.5524272", "0.544093", "0.544093", "0.544093", "0.54212564", "0.53958404", "0.5376563", "0.53646785", "0.53646785", "0.53646785", "0.53646785", "0.53646785", "0.53646785", "0.53646785", "0.53646785", "0.536...
0.0
-1