query stringlengths 9 14.6k | document stringlengths 8 5.39M | metadata dict | negatives listlengths 0 30 | negative_scores listlengths 0 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
set the next entry of this entry | setNextEntry(entry)
{
this.nextEntry=entry;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setNext(next) {\n this._next = next;\n }",
"setNext(next) {\r\n this.next = next;\r\n }",
"next() {\n this._index++;\n }",
"function next() {\n setStartIndex(startIndex + settings.itemNumber);\n setEndIndex(endIndex + settings.itemNumber);\n }",
"next(node) {\n this.ne... | [
"0.64820415",
"0.6384774",
"0.60696507",
"0.6031765",
"0.59448105",
"0.5932259",
"0.5905691",
"0.5894584",
"0.58613056",
"0.58167624",
"0.5813776",
"0.5813776",
"0.5813776",
"0.5813776",
"0.5813776",
"0.5813776",
"0.5813776",
"0.5813776",
"0.5813776",
"0.5813776",
"0.5813776"... | 0.745001 | 0 |
return output data of this entry | genOutput()
{
var data=this.props.data;
data.title=this.entryFields[0].current.innerText;
data.imglink=this.entryFields[1].current.innerText;
data.tags=this.entryFields[2].current.innerText.split(",");
return data;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get output() {\n\t\treturn this.__output;\n\t}",
"get output() {\n\t\treturn this._output;\n\t}",
"function getOutput() {\n return outputValue;\n }",
"get output() { return new Output (this); }",
"getOutput()\n {\n var res=[];\n for (var x=0;x<this.entries.length;x++)\n {\... | [
"0.69454265",
"0.6879717",
"0.67869306",
"0.6480763",
"0.62165415",
"0.60414743",
"0.569748",
"0.5646958",
"0.56350845",
"0.5634807",
"0.56278175",
"0.56250125",
"0.56250125",
"0.5609663",
"0.5599207",
"0.5573612",
"0.55727756",
"0.5571534",
"0.55684376",
"0.5563439",
"0.5563... | 0.712626 | 0 |
override paste event to plain paste | textPasteOverride(e)
{
e.preventDefault();
document.execCommand("insertHTML",false,e.clipboardData.getData("text/plain"));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"handlePaste(event) {\n event.preventDefault();\n }",
"function paste(e) {\n var str, clipboardData;\n\n e = e || window.event;\n\n // Stop data actually being pasted into div\n e.stopPropagation();\n e.preventDefault();\n\n clipboardData = e.clipboardData || window.clipboardData;\n\n ... | [
"0.7566165",
"0.73612607",
"0.7228835",
"0.7118371",
"0.71135855",
"0.701797",
"0.69953644",
"0.6973485",
"0.6816813",
"0.6788955",
"0.67412066",
"0.6673219",
"0.66632783",
"0.6543726",
"0.6506792",
"0.6470181",
"0.6444756",
"0.64104396",
"0.6403394",
"0.6401143",
"0.6398138"... | 0.75625974 | 1 |
Get data from spreadsheets and goodreads | function getSpreadsheetsData(){
return gsjson({
spreadsheetId: '1foghwIYxxYSF2cj6kA9Wrl_JfAiloBI_a0r4XjxJGGQ',
listOnly: true,
})
.then(function(result) {
// console.log(result);
return separateArrayResults(result)
})
.catch(function(err) {
console.log(err.mes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function fetchSpreadsheet() {\n const doc = new GoogleSheet(\"1sZHp76yPeLfuXeigccDwGDk4bU_abVQYeOVzzZ9oiwE\")\n await promisify(doc.useServiceAccountAuth)(creds)\n const info = await promisify(doc.getInfo)()\n const sheet = info.worksheets[0]\n const rows = await promisify(sheet.getRows)({\n offset: ... | [
"0.7156805",
"0.702522",
"0.6853781",
"0.67891604",
"0.67847914",
"0.6746769",
"0.67202693",
"0.6708074",
"0.66973",
"0.6690491",
"0.6678444",
"0.6666431",
"0.6661933",
"0.6641013",
"0.65767163",
"0.65021765",
"0.6442378",
"0.63804936",
"0.6357326",
"0.6331103",
"0.62913716",... | 0.714675 | 1 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// gameplay functions // ///////////////////// //////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// newGame() is invoked ... | function newGame() {
game = new Game();
clearTable();
bet("player", betAmt) && deal();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function newHand() {\n /* Don't begin a new hand if we only have 1 player */\n if (game.players.length < 2){\n game.errorMessage = \"You cannot play with only one player.\";\n return;\n }\n \n /* Reset board */\n clearBoard();\n\n /* Move the dealer button and the blinds */\n ... | [
"0.72426796",
"0.70964056",
"0.7029032",
"0.6943764",
"0.69207394",
"0.6910242",
"0.6856485",
"0.6797354",
"0.67664707",
"0.6746947",
"0.6735579",
"0.6718408",
"0.6675236",
"0.6640725",
"0.6638348",
"0.6632196",
"0.66237473",
"0.661237",
"0.6597434",
"0.6591126",
"0.6541369",... | 0.842567 | 0 |
deal() first disables changing the bet amount, replaces the Deal button with the Double, Hit and Stay buttons, and plays a card shuffling sound. Next it makes a call to the deckofcards API if it hasn't yet or if there is less than 3/4 of a deck left. If it makes the call it stores the deckId for later calls for cards, ... | function deal() {
betChangeAllowed = false;
game.player.isDone = false;
$deal.addClass("hidden");
$(".hit, .stay, .double").removeClass("hidden");
cardPackage.load();
cardPackage.play();
if (deckId === "" || cardsLeft < 39) {
getJSON(newDeckURL + decks, function(data) {
deckId = data.deck_id;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deal() {\n\n // If no card has been dealt yet, make a new deck\n if ( $('#player-hand').children().length === 0 ) {\n deck = new Deck();\n }\n\n // If card count gets below 16 at time of deal click, use new deck\n if (deck.numCardsLeft() <= 16) {\n deck = new Deck();\n }\n\... | [
"0.8075676",
"0.78711164",
"0.7731571",
"0.7585177",
"0.7580019",
"0.74365747",
"0.74304926",
"0.7350088",
"0.732578",
"0.723406",
"0.71311444",
"0.711238",
"0.711238",
"0.7102687",
"0.7087121",
"0.7085688",
"0.70267916",
"0.69723856",
"0.6931127",
"0.68979865",
"0.68747854",... | 0.81795186 | 0 |
draw4() calls drawCard() four times, alternating between the dealer and the player. | function draw4() {
// The first call for the dealer's hole card specifies that its image is to be replaced with the cardBack image.
drawCard({
hand: "dealer",
image: cardBack
});
// The second call for the player's first card specifies that once the card is retrieved the chips and wager amount
// are ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function drawCard(player){\n updateHand(player);\n applyDrawAnimation(player);\n gameState.updateDeckLength();\n\n}",
"function drawPlayers () {\n player1.draw();\n player2.draw();\n player3.draw();\n player4.draw();\n}",
"function drawCard() {\n if(discard_index === -1 || discard_index === dis... | [
"0.70935047",
"0.6909746",
"0.6636134",
"0.65527755",
"0.6537803",
"0.64898324",
"0.6392308",
"0.63352376",
"0.6325131",
"0.629459",
"0.6292317",
"0.62277323",
"0.6218541",
"0.619848",
"0.6163185",
"0.61613685",
"0.61429673",
"0.61389667",
"0.6132906",
"0.6120306",
"0.6097855... | 0.851573 | 0 |
drawCard() takes an object as an argument to allow for optional parameters. These are hand, image, and callback. hand refers to the string value of the hand to deal a card to, such as "dealer" and "split1a". image will replace the card's face image with the URL specified. callback is a function to be run upon completio... | function drawCard(options) {
// drawCard() first makes a call to the API with an updated URL to draw 1 card from the current deck.
var cardURL = `${API}draw/${deckId}/?count=1`;
getJSON(cardURL, function(data, cb) {
// variable for holding html string created
var html;
// hand is set to options.hand t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"drawCard(card) {\n //this method will recieve a card object with the name value and suit\n // and depending on the parrametes passed we can draw the card in canvas\n //or other DOM elements\n }",
"function button_drawCard(deck, hand, player) {\r\n\tdrawCardFromLibrary(deck, hand, player);... | [
"0.7466751",
"0.7407548",
"0.70126116",
"0.672753",
"0.66795534",
"0.66584086",
"0.6435856",
"0.64164007",
"0.6360229",
"0.6276329",
"0.6219857",
"0.6214012",
"0.6190452",
"0.61746544",
"0.61255",
"0.60366213",
"0.5999083",
"0.59850425",
"0.5968977",
"0.59642774",
"0.59622157... | 0.7983589 | 0 |
couldDealerHaveBlackjack() checks to see if the dealer's up card is a 10, jack, queen, king, or ace. If it's an ace it shows the Insurance button. If it's an ace, 10, jack, queen, or king it sets dealerCouldHaveBlackjack to true. | function couldDealerHaveBlackjack() {
switch (game.dealer.cards[1]) {
case 'ACE':
console.log("Insurance is available");
$insuranceButton.removeClass("hidden");
case '10':
case 'JACK':
case 'QUEEN':
case 'KING':
console.log('Dealer could have Blackjack');
game.dealerCouldHa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function dealerTurn() {\n var gameOver = false;\n var revealHoleCard = true;\n var playerPoints = playerHand.getPoints();\n var dealerPoints = dealerHand.getPoints();\n var playerHasBlackJack = playerHand.hasBlackJack();\n var dealerHasBlackJack = dealerHand.hasBlackJack();\n\n $('#doubledown'... | [
"0.6627514",
"0.651939",
"0.63814926",
"0.6288088",
"0.6267523",
"0.6150785",
"0.6006072",
"0.59711444",
"0.59516704",
"0.59417564",
"0.5915476",
"0.581518",
"0.58084327",
"0.5784954",
"0.5783298",
"0.5764364",
"0.57634187",
"0.574329",
"0.5742335",
"0.5717486",
"0.5692518",
... | 0.80856156 | 0 |
checkSplit() takes two arguments: hand and test. hand refers to the string value of the hand to deal a card to, such as "dealer" and "split1a". test is a boolean value the specifies whether or not to allow splitting regardless of matching card values | function checkSplit(hand, test) {
// A new array is created to hold the two card values
// For each card in the hand the numeric value is passed to the new array.
var checkSplitArr = game[hand].cards.map(function(card) {
if (card === "KING" || card === "QUEEN" || card === "JACK") {
return "10";
} el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkSplit() {\n\tif (playerCards[0].value === playerCards[1].value && playerBank >= bet) {\n\t\tsplit.css('visibility', 'visible');\n\t}\n}",
"function playerCanSplit(arrayOfCards) {\n var canSplit = false;\n\n var cardOne = parseInt( arrayOfCards[0].slice(0, -1) )\n var cardTwo = parseInt( arrayOfC... | [
"0.65679497",
"0.6509103",
"0.6226771",
"0.6100988",
"0.5613508",
"0.54887974",
"0.5406119",
"0.5401924",
"0.5366061",
"0.5263944",
"0.5206029",
"0.5048033",
"0.50390327",
"0.5020799",
"0.5006423",
"0.5005643",
"0.4997695",
"0.49920335",
"0.49892768",
"0.49794537",
"0.4969317... | 0.81448823 | 0 |
ending the hand // ////////////////// | function handEnd(hand) {
game[hand].isDone = true;
!game[hand].isSplit && game.handsToPlay--;
checkFocus();
game.handsToPlay > 0 ? highlight(game.currentHand) : highlight("none");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"end() {\n\t\tthis.endCalled = true;\n\t}",
"end() {\n\t\n }",
"end() {\n super.end();\n }",
"putFromHand()\n {\n if(this.keepItem(hand.take))\n {\n hand.removeItem()\n }\n }",
"function endAI(win)\n{\n\n\n}",
"end() { }",
"function End () {}",
"funct... | [
"0.67424154",
"0.6638471",
"0.65541834",
"0.65274394",
"0.6462372",
"0.64004016",
"0.62779087",
"0.62779087",
"0.6240663",
"0.6233197",
"0.6208023",
"0.6202966",
"0.61840355",
"0.6171527",
"0.61512566",
"0.61450857",
"0.6127575",
"0.61255",
"0.6119379",
"0.60976434",
"0.60867... | 0.681098 | 0 |
JSON request function with JSONP proxy // | function getJSON(url, cb) {
//var JSONP_PROXY = 'https://jsonp.afeld.me/?url=';
// THIS WILL ADD THE CROSS ORIGIN HEADERS
var request = new XMLHttpRequest();
request.open('GET', /*JSONP_PROXY + */url);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
cb(JSON.parse(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function jsonpRequest(url, data)\r\n {\r\n // Build URL parameters from data object.\r\n let params = \"\";\r\n // For each key in data object...\r\n for (let key in data)\r\n {\r\n if (data.hasOwnProperty(key))\r\n {\r\n ... | [
"0.7459032",
"0.7432068",
"0.7356001",
"0.7229045",
"0.7229045",
"0.7229045",
"0.7229045",
"0.7229045",
"0.7229045",
"0.7229045",
"0.7229045",
"0.6973307",
"0.6941406",
"0.6766412",
"0.6719236",
"0.6710365",
"0.6659039",
"0.66589284",
"0.66302395",
"0.6554394",
"0.6547599",
... | 0.7481641 | 0 |
look up material ID given its name if lazy is set, preregister the name and return an ID | function getMaterialId(reg, name, lazyInit) {
var id = reg._matIDs[name]
if (id === undefined && lazyInit) {
id = reg.registerMaterial(name)
}
return id
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getMaterialId(reg, matIDs, name, lazyInit) {\n if (!name) return 0\n var id = matIDs[name]\n if (id === undefined && lazyInit) id = reg.registerMaterial(name)\n return id\n}",
"function getMaterialId(reg, matIDs, name, lazyInit) {\n if (!name) return 0\n var id = matIDs[name]\n if (... | [
"0.7774869",
"0.7774869",
"0.65249413",
"0.5935007",
"0.56559134",
"0.54977816",
"0.54430777",
"0.53891706",
"0.53664523",
"0.53421515",
"0.52799374",
"0.5278144",
"0.5270013",
"0.5258325",
"0.52452403",
"0.5224242",
"0.5207639",
"0.52071136",
"0.51345074",
"0.5067106",
"0.50... | 0.7972569 | 0 |
helper function to set the zIndex of elements. arg "e": map key: one of "className:" "tagName:" or "id:" value: corresponding class name, tag name, or id key: "zIndex:", value: the zIndex value to be set. | function setZindex(e) {
if (e.id) {
var elem = document.getElementById(e.id);
if (elem) {
elem.style.zIndex = e.zIndex;
};
} else if (e.tagName) {
var elems = document.getElementsByTagName(e.tagName);
for (var i = 0; i < elems.length; i++) {
elems[0].style.zIndex = e.zIndex;
};
} ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setZIndex(div, zIndex){\n\t\tobj=bw.dom? document.getElementById(div).style:bw.ie?document.all[div].style:\n\t\t\tbw.ns4?document.layers[div]:0;\n\tif(obj){ obj.zIndex=Number(zIndex);}\t\n\t}",
"function zIndexControl(elem) {\n zIndexCount++;\n elem.css(\"z-index\", zIndexCount);\n}",
"function ... | [
"0.67815024",
"0.66019946",
"0.6472558",
"0.6472558",
"0.6472558",
"0.646175",
"0.64407456",
"0.64407456",
"0.64407456",
"0.64407456",
"0.6440318",
"0.6440318",
"0.6424155",
"0.63950753",
"0.6336716",
"0.6252565",
"0.6185538",
"0.611655",
"0.61104375",
"0.6069274",
"0.5922256... | 0.79597497 | 0 |
helper fn, returns outer height incl margin and padding of element | function outerHeight(elem) {
var style = window.getComputedStyle(elem, null);
var h = (! style) ? 0 : parseInt(style.getPropertyValue("height"))
+ parseInt(style.getPropertyValue("margin-top"))
+ parseInt(style.getPropertyValue("margin-bottom"))
+ parseInt(style.getPropertyValue("padding-top"))
+ ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get outerHeight() {\n const bottom = parseFloat(this.css('margin-bottom'));\n const top = parseFloat(this.css('margin-top'));\n return (this.height + bottom + top) || 0;\n }",
"getOuterHeight(withMargin) { // eslint-disable-line no-unused-vars\r\n return 0\r\n }",
"f... | [
"0.8186674",
"0.8030919",
"0.7912104",
"0.7879915",
"0.7800348",
"0.7415964",
"0.7163833",
"0.7059678",
"0.70346683",
"0.68709135",
"0.6869282",
"0.68446654",
"0.68419147",
"0.6762405",
"0.67476904",
"0.6718377",
"0.6685679",
"0.662273",
"0.65425414",
"0.65425414",
"0.649797"... | 0.81270087 | 1 |
curtain_listener is the event listener that fixes and unfixes the curtains as the window is scrolled. | function curtain_listener(e) {
var winY = window.scrollY; //scrollTop
if (winY > hts[num] && num < hts.length) { //scrolling down
// change current curtain to next one
num += 1;
curtains.currentCurtain = num;
// unfix next curtain
crtns[num - 1].style.position = "relative";
// update ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"addListener() {\n window.addEventListener('scroll', this.handleScroll)\n }",
"function windowScrollHandler() {\n\n if (isScrolling) return;\n\n // act on next animation frame\n requestAnimationFrame(function() {\n\n var wY = window.pageYOffset, i, activate;\n for (i = 0; i < element.le... | [
"0.6115532",
"0.60994625",
"0.59548783",
"0.59548783",
"0.59490234",
"0.5856867",
"0.58285064",
"0.57633793",
"0.5740199",
"0.5740199",
"0.57142526",
"0.569723",
"0.5695932",
"0.568586",
"0.56751746",
"0.5667963",
"0.56633884",
"0.56629485",
"0.56139386",
"0.558551",
"0.55656... | 0.76323813 | 0 |
set the html elements to their corresponding global values state argument is one of 2 possible states | function setElements(state) {
document.getElementById('gameStatus').textContent = state;
document.getElementById('wins').textContent = wins;
document.getElementById('artist').textContent = artist.artist;
document.getElementById('song').textContent = hiddenSong.join('');
document.getElementById('lett... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setGameElements() { \n\tswitch(gameState) { \n\n\t\tcase 'started':\n\t\t\tnewGameElemBasic.style.display = 'none';\n\t\t\tpickElem.style.display = 'block';\n\t\t\tresultsElem.style.display = 'block';\n\t\t\tbreak;\n\t\tcase 'rules':\n\t\t\tnewGameElemBasic.style.display = 'none';\n\t\t\tpickElem.style.di... | [
"0.63960534",
"0.626023",
"0.60254765",
"0.60059845",
"0.59988946",
"0.59049404",
"0.5772676",
"0.57552946",
"0.5685077",
"0.56421155",
"0.5640028",
"0.56274074",
"0.562497",
"0.56080997",
"0.55821127",
"0.5581573",
"0.55756414",
"0.5538929",
"0.55379134",
"0.5533755",
"0.553... | 0.6531805 | 0 |
given a word and a letter, returns an array of numbers where that letter occurs in the word. Returns an empty array if the letter doesn't occur | function getIndexesOfLetters(word, letter) {
var indexes = [];
for(var i = 0; i < word.length; ++i) {
if (letter.toLowerCase() === word.charAt(i).toLowerCase()) {
indexes.push(i);
}
}
return indexes;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"IsTheLetterHere(letter, word) {\n let indices = [];\n let idx = word.indexOf(letter);\n\n while (idx !== -1){\n indices.push(idx);\n idx = word.indexOf(letter, idx + 1);\n }\n\n return indices\n }",
"function getPositions(letter, word){\n let splitWord = Array.from(word); //splits st... | [
"0.7959849",
"0.7582528",
"0.7209121",
"0.71042174",
"0.697703",
"0.6818392",
"0.67799836",
"0.67651254",
"0.672313",
"0.6703772",
"0.6648594",
"0.66400737",
"0.6576569",
"0.65687275",
"0.6528805",
"0.6519438",
"0.6502765",
"0.64713556",
"0.64645094",
"0.6442611",
"0.64220315... | 0.80820477 | 0 |
Get the radius for a symbol based on the attribute gini | function getRadius(gini){
// Used Natural Breaks (Jenks) for gini 2018 values
// 0 - .462 | .463 - .494 | .495 - above
if (gini <= .462 && (filterVal === 0 || filterVal === 1)){
return 8;
}
else if (gini > .462 && gini <= .494 && (filterVal === 0 || filterVal === 2)){
return 16;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get radius() {}",
"get radius() {}",
"function radius(o){return o*17+17;}",
"function calcPropRadius(attValue) {\n //scale factor to adjust symbol size evenly\n var scaleFactor = 1;\n //area based on attribute value and scale factor\n var area = attValue * scaleFactor;\n //radius calculated ba... | [
"0.7073915",
"0.7073915",
"0.69140357",
"0.6622871",
"0.6602087",
"0.66019094",
"0.6593505",
"0.658271",
"0.65770996",
"0.6573071",
"0.6571429",
"0.6571429",
"0.6571429",
"0.65655315",
"0.652393",
"0.6481422",
"0.64789355",
"0.64396673",
"0.6398184",
"0.6346159",
"0.6346159",... | 0.7105286 | 0 |
Change of color for MarkAsImportant feature | function setStyleMarkedAsImportant(el) {
el.classList.toggle('mark-important');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function styleMarker(feature) {\n return {\n fillColor: \"purple\",\n color: \"black\",\n fillOpacity: \"0.8\"\n }\n}",
"function markimportant(idofinput) {\n let ret = idofinput.replace('imp', '');\n // console.log(ret)\n let ele = document.getElementById(\"Note\" + ret)\n // console.... | [
"0.60898966",
"0.60828495",
"0.59528804",
"0.593713",
"0.5909309",
"0.58577543",
"0.5765757",
"0.5725106",
"0.57203525",
"0.5703064",
"0.5674675",
"0.56703043",
"0.5658935",
"0.5627426",
"0.5618217",
"0.5592341",
"0.55781996",
"0.55781996",
"0.55704856",
"0.5546525",
"0.55200... | 0.7295039 | 0 |
input: jquery selector output: handlebar template to be appended | function compileTemplate (selector) {
return Handlebars.compile($(selector).html());
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handlebars(nome, cognome, eta){\r\n var source = $(\"#entry-template\").html();\r\n var template = Handlebars.compile(source);\r\n\r\n var context = {\r\n nome: nome,\r\n cognome: cognome,\r\n eta: eta,\r\n };\r\n\r\n var html = template(context);\r\n $(\".container\").append(html);\r\n}",
... | [
"0.6247509",
"0.58757865",
"0.57988745",
"0.577429",
"0.576794",
"0.57473123",
"0.57377243",
"0.57184696",
"0.56845814",
"0.5642576",
"0.5600516",
"0.5569342",
"0.55562663",
"0.55505705",
"0.5540059",
"0.5525328",
"0.55243427",
"0.55219924",
"0.55007946",
"0.549904",
"0.54797... | 0.5910231 | 1 |
gets pledges thru ajax renders them onto the page as a list | function renderPledges() {
// ajax GET call
$.ajax({
url: "/api" + pathname + "/pledges"
}).
done(function(data) {
// add the name of the list in html
console.log("success getting rep's pledges");
$('#pledge_list').prepend("<h1 class='pledge_list_title'>Pledges</h1>");
// loop through each ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function listItems() {\n\t// Might return JS, or HTML\n}",
"function listResults(data,div) {\n\n var newsDiv = document.getElementById(div);\n for ( var i = 0; i < 50; i++) {\n\n list = renderResults(newsDiv ,data.response.results[i]);\n }\n}",
"function renderList(data) {\n\t\tvar totalResults =... | [
"0.65037805",
"0.6463622",
"0.6399749",
"0.63978636",
"0.6394058",
"0.6366338",
"0.63526326",
"0.6351573",
"0.630447",
"0.6281897",
"0.62682617",
"0.6261446",
"0.62447613",
"0.62359214",
"0.6208439",
"0.6200108",
"0.6193507",
"0.61730725",
"0.6164144",
"0.6164144",
"0.6155214... | 0.669079 | 0 |
gets user information (name, handle, img url, etc) thru ajax renders it onto the page, then renders the pledge feed | function getUserInfo() {
$.ajax({
url: "/api" + pathname,
type: "GET"
}).
done(function(data) {
console.log("Successfully received user data");
// get + append template
var userInfoTemplate = compileTemplate("#user_info");
$(".profile_upper").append(userInfoTemplate({user: data}));
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function renderPledges() {\n // ajax GET call\n $.ajax({\n url: \"/api\" + pathname + \"/pledges\"\n }).\n done(function(data) {\n // add the name of the list in html\n console.log(\"success getting rep's pledges\");\n $('#pledge_list').prepend(\"<h1 class='pledge_list_title'>Pledges</h1>\");\n\n ... | [
"0.73191935",
"0.6222713",
"0.62121135",
"0.6198285",
"0.6171483",
"0.6168461",
"0.6137755",
"0.61204326",
"0.61190176",
"0.60345507",
"0.5991489",
"0.59601736",
"0.5954413",
"0.59108967",
"0.5869744",
"0.5862154",
"0.5857542",
"0.5818742",
"0.58111364",
"0.5806579",
"0.58056... | 0.751559 | 0 |
sumOdds(numbers): receives an array of numbers returns the sum of only the ODD numbers e.g. sumOdds([1, 2, 3, 4, 5, 6, 7, 8, 9]) > 25 sumOdds([3, 7, 8, 15, 2, 1, 13]) > 39 dont know how to add numbers[i] to the oddsNum | function sumOdds(numbers) {
let oddNums = 0;
for (let i = 0; i < numbers.length; i++) {
if (numbers[i] % 2 === 1) {
oddNums += numbers[i];
}
}
return oddNums;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sumOdds(numbers) {\n let odds = [];\n for (let i = 0; i < numbers.length; i++) {\n if (numbers[i] % 2 === 1) odds.push(numbers[i]);\n }\n return odds.reduce((a, b) => a + b, 0);\n}",
"function sumOdds(numbers) {\n let total = 0;\n for (let index = 0; index <= numbers.l... | [
"0.8859294",
"0.8770602",
"0.8622075",
"0.8554334",
"0.85280555",
"0.84315646",
"0.81856936",
"0.8142267",
"0.8089216",
"0.79897964",
"0.78438205",
"0.7771953",
"0.7753165",
"0.7670077",
"0.76566267",
"0.76320136",
"0.75373524",
"0.7507418",
"0.7348597",
"0.7338669",
"0.73386... | 0.8785933 | 1 |
characterCount(string, c): receives a string and a character returns the number of times `c` occurs in the string note: this has to be caseinsensitive e.g. characterCount("Michael Stephenson", "e") > 3 characterCount("Character Count is clever", "c") > 4 Hint: Use string methods to make it caseinsensitive dont know how... | function characterCount(string, c) {
string = string.toLowerCase();
let strCount = 0;
let i = 0;
while (i < string.length) {
if (string[i] === c) {
strCount = strCount + 1;
}
i++;
}
return strCount;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function characterCount(string, c) {\n var regex = new RegExp(c, \"g\");\n return string.toLowerCase().match(regex).length;\n}",
"function count(s, c) { \n var count = 0; \n \n for (var i = 0; i < s.length; i++) { \n if(s.charAt(i) == c){ \n count++; \n } \n } \n return count; \n}",
"fu... | [
"0.892008",
"0.8453599",
"0.824983",
"0.8185935",
"0.8182701",
"0.81768674",
"0.8102068",
"0.80785793",
"0.8055182",
"0.8022166",
"0.7992195",
"0.79748416",
"0.7959907",
"0.79502004",
"0.7948407",
"0.7932683",
"0.7904968",
"0.7813767",
"0.7806472",
"0.7804093",
"0.774615",
... | 0.8945738 | 0 |
differences(numbers): receives an array of numbers returns an array that has the difference in the values of the numbers array. see example below for clarification. e.g. differences([1, 3, 7, 9, 12]) > [2, 4, 2, 3] 3 1 = 2 7 3 = 4 9 7 = 2 12 9 = 3 differences([11, 35, 52, 14, 56]) > [24, 17, 38, 42] | function differences(numbers) {
let integerDiff = [];
for (let i = 1; i < numbers.length; i++) {
integerDiff.push(numbers[i] - numbers[i - 1]);
}
return integerDiff;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function differences(numbers) {\n var diffs = [];\n for (let i = 0; i < numbers.length; i++) {\n if (i + 1 < numbers.length) {\n diffs.push(numbers[i + 1] - numbers[i]);\n }\n }\n return diffs;\n}",
"function diff(A) { return A.slice(1).map(function (n, i) { return n - A[i] }... | [
"0.8678402",
"0.68717164",
"0.6512953",
"0.6393057",
"0.6177719",
"0.6141932",
"0.6113453",
"0.61001074",
"0.60516894",
"0.6043911",
"0.6037368",
"0.60304904",
"0.6028781",
"0.60193133",
"0.60045815",
"0.5979692",
"0.5976286",
"0.597562",
"0.5941589",
"0.59072685",
"0.5817389... | 0.83863765 | 1 |
largestIncrement(numbers): receives an array of numbers returns the largest difference between two consecutive numbers in the array see example below for clarification e.g. largestIncrement([1, 3, 7, 9, 12]) > 4 3 1 = 2 7 3 = 4 9 7 = 2 12 9 = 3 largest: 4 largestIncrement([11, 35, 52, 14, 56, 601, 777, 888, 999]) > 545 | function largestIncrement(numbers) {
let largestIncr = 0;
for (let i = 0; i < numbers.length; i++) {
if (numbers[i + 1] - numbers[i] > largestIncr) {
largestIncr = numbers[i + 1] - numbers[i];
}
}
return largestIncr;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function largestIncrement(numbers) {\n var max = differences(numbers).reduce(function (a, b) {\n return Math.max(a, b);\n });\n return max;\n}",
"function maxNumber(numbers) {\n let currentMax = numbers[0];\n let i = 0;\n while ( i < numbers.length) {\n if (numbers[i] > currentMax) {\n ... | [
"0.8966273",
"0.73818994",
"0.72019255",
"0.7126497",
"0.70634586",
"0.7054417",
"0.703824",
"0.70280707",
"0.69640225",
"0.69381183",
"0.680461",
"0.67947733",
"0.67886174",
"0.67423505",
"0.6661849",
"0.66334593",
"0.66280556",
"0.66223216",
"0.6544662",
"0.6530813",
"0.652... | 0.8243565 | 1 |
afterX(numbers, x): receives an array of numbers, and a number `x`. returns an array of every number in `numbers` that occurs after `x`. assume there are no duplicate numbers. e.g. afterX([1, 2, 3, 4, 5, 6, 7, 8, 9], 3) > [4, 5, 6, 7, 8, 9] afterX([11, 35, 52, 14, 56, 601, 777, 888, 999], 52) > [14, 56, 601, 777, 888, ... | function afterX(numbers, x) {
for (let i = 0; i < numbers.length; i++)
if (numbers[i] === x) {
return numbers.slice(i + 1, numbers.length);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function afterX(numbers, x) {\n return numbers.splice(numbers.indexOf(x) + 1);\n}",
"function afterX(numbers, x) {}",
"static sumOfXNumbers(numbers, X) {\n let result = 0;\n for (let i = 0; i < X; i++) {\n result += numbers[i];\n }\n return result;\n }",
"function... | [
"0.7784076",
"0.7655992",
"0.50522846",
"0.4963907",
"0.48660246",
"0.47567368",
"0.47449282",
"0.47078532",
"0.46935996",
"0.45933074",
"0.45898524",
"0.45497623",
"0.4519256",
"0.45155576",
"0.44939613",
"0.44922543",
"0.44915587",
"0.4491304",
"0.44892433",
"0.44518352",
"... | 0.7977044 | 0 |
elementInArray(numbers, x): receives an array of numbers, and a number `x`. returns true if `x` is found in the array, false otherwise e.g. elementInArray([5, 6, 7], 6) > true elementInArray([5, 6, 7], 8) > false | function elementInArray(numbers, x) {
for (let i = 0; i < numbers.length; i++) {
if (numbers[i] === x) {
return true;
}
}
return false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function elementInArray(numbers, x) {\n return numbers.includes(x);\n}",
"function containsElement(array, number){\n\n // returns boolean\n}",
"function contains(array, x) {\n let isInArray = false;\n\n array.forEach(element => {\n if (element === x) {\n isInArray = true;\n ... | [
"0.9002835",
"0.8236635",
"0.8064538",
"0.76862377",
"0.7615368",
"0.7606972",
"0.7528901",
"0.751575",
"0.7454594",
"0.73607063",
"0.7353527",
"0.73395747",
"0.73362124",
"0.72455585",
"0.7237694",
"0.722273",
"0.7205235",
"0.71936893",
"0.7166268",
"0.7147281",
"0.7059336",... | 0.90573514 | 0 |
Builds the dictionary for the encoder. For this dictionary (Javascript object) the key is the character and the value at that key is an index which counts up from 0 to the size of the desired initial dictionary. | function buildDictEnc(d, sel, custom){
var idx = 0;
switch(sel){
case "ASCII":
for (idx = 0; idx < 128; idx++){
d[String.fromCharCode(idx)] = idx;
}
break;
case "UTF-8":
for (idx = 0; idx < 256; idx++){
d[String.from... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateDict(){\n let alphabets = generateAlphabets();\n let dict = new Object();\n let i ;\n for(i =0; i< alphabets.length ;i++ ){\n dict[alphabets[i]] = [];\n }\n return dict;\n }",
"function generateExampleDict(maxStrLen) {\n\tlet input = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', ... | [
"0.64199793",
"0.58076996",
"0.57463807",
"0.57452923",
"0.5705455",
"0.5672274",
"0.5627633",
"0.56178325",
"0.56155133",
"0.55927247",
"0.5571136",
"0.5566921",
"0.5480933",
"0.54089445",
"0.5345635",
"0.5345405",
"0.5345405",
"0.53225356",
"0.5297603",
"0.529187",
"0.52424... | 0.6036127 | 1 |
append a row to the end of the table with strings t1, ..., t6 and an optional identifier number | function insertRow(table, t1, t2, t3, t4, t5, t6, id){
var row = table.insertRow(-1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
var cell4 = row.insertCell(3);
var cell5 = row.insertCell(4);
var cell6 = row.insertCell(5);
cell1.innerHTML ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addRow(table, values, startInd) {\n var cell;\n // for all cells in the table\n for (var i = 0; i < values.length; i++) {\n // insert a cell at startInd\n cell = table.rows[0].insertCell(startInd++);\n // make the innerHTML of the cell cells[i]\n cell.innerHTML = value... | [
"0.6578051",
"0.6446594",
"0.64445513",
"0.6402625",
"0.639769",
"0.6378541",
"0.6252433",
"0.6221498",
"0.6184727",
"0.61424685",
"0.61263543",
"0.6088102",
"0.60310477",
"0.59661317",
"0.5956154",
"0.5946327",
"0.59432125",
"0.591653",
"0.59052014",
"0.58174336",
"0.5805472... | 0.7598971 | 0 |
Uses the counter objects to determine entropy. Similar to python's collections.Counter see here: | function calcEntropy(c, n){ //c = counterobject, n = number of symbols
sum = 0.0;
for (var key in c){
var value = c[key];
sum += (value/n)*Math.log2(n/value);
}
return sum;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function entropy(obj){\n return -Iterator.values(obj)\n .map(p=>p*Math.log2(p))\n .sum()\n}",
"function entropy(s) {\n var sum = 0,len = s.length;\n process(s, function(k, f) {\n var p = f/len;\n sum -= p * Math.log(p) / Math.log(2);\n });\n console.... | [
"0.6640293",
"0.65675795",
"0.6339104",
"0.6059943",
"0.5960226",
"0.59354436",
"0.5786201",
"0.57598305",
"0.5703839",
"0.56595075",
"0.56517404",
"0.56475",
"0.56172466",
"0.56123346",
"0.55950046",
"0.5565991",
"0.5507254",
"0.5507254",
"0.54346836",
"0.5406775",
"0.539100... | 0.65899503 | 1 |
Check if custom dictionary textbox should be loaded | function onDictSel(e){
div = document.getElementById("custom-dict-box");
if (e.value === "custom") {
div.style.display = "block";
}
else{
div.style.display = "none";
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isLoaded(dict) {\n return Object.keys(dict).length > 0\n}",
"function loadFromDict(dict){\n for(let key in dict){\n document.getElementById(key).value = dict[key];\n }\n}",
"function loadDictionary(dictURL) {\n $.ajax({url: dictURL,\r\n dataType: \"json\",\r\n success: fun... | [
"0.58437794",
"0.5631699",
"0.559396",
"0.54312533",
"0.5429492",
"0.5333734",
"0.53208756",
"0.5277037",
"0.51886946",
"0.51548713",
"0.5150504",
"0.5148434",
"0.5084383",
"0.5053211",
"0.5037986",
"0.5032106",
"0.5008618",
"0.50075966",
"0.49987713",
"0.496926",
"0.49672663... | 0.63016194 | 0 |
Operation to be completed when decode button is pressed. Collects the input string, builds a dictionary, decodes input, displays table and output, and calculates some metrics | function decode(){
var inputText = document.getElementById("input-str");
let originalStr = inputText.value;
let tab = document.getElementById("lzw-tab");
let table = document.getElementById("lzw-tab").getElementsByTagName('tbody')[0];
let p = document.getElementById("enc-output");
let p_dec = do... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Decoder() {\n}",
"function encode(){\n var inputText = document.getElementById(\"input-str\");\n let originalStr = inputText.value;\n let numInputSym = originalStr.length;\n let table = document.getElementById(\"lzw-tab\").getElementsByTagName('tbody')[0];\n let p = document.getElementByI... | [
"0.59212947",
"0.57625335",
"0.5653117",
"0.56306636",
"0.5598396",
"0.5555051",
"0.55504483",
"0.5536229",
"0.5515614",
"0.5451266",
"0.5442408",
"0.54279065",
"0.5414523",
"0.54021627",
"0.53760886",
"0.5336981",
"0.5320312",
"0.5252144",
"0.5248763",
"0.5177977",
"0.514939... | 0.6563717 | 0 |
Enables/Disables bitstream button depending on whether binary is selected | function onRadixSel(e){
check = document.getElementById("use-bitstream");
if(e.value === "2"){
check.disabled = false;
}
else{
check.disabled = true;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function enableRegisterStoreDoRegButton() {\n const createStoreRegStoreNameArea = document.getElementById('createStoreRegStoreNameArea');\n const createStoreRegStoreDescArea = document.getElementById('createStoreRegStoreDescArea');\n const createStoreRegStoreImg = document.getElementById('createStoreRegSt... | [
"0.61675745",
"0.61264145",
"0.60811895",
"0.6055989",
"0.60533834",
"0.60406584",
"0.5968369",
"0.5968369",
"0.5964036",
"0.5960266",
"0.5937719",
"0.5922055",
"0.5918955",
"0.58980715",
"0.5883707",
"0.58833814",
"0.58761585",
"0.58649063",
"0.58372116",
"0.5836133",
"0.581... | 0.6469296 | 0 |
Select everything in a container | function selectText1(containerid) {
//from stack overflow: https://stackoverflow.com/questions/24553251/is-it-possible-to-restrict-the-range-of-select-all-ctrla
if (document.selection) {
var range = document.body.createTextRange();
range.moveToElementText(document.getElementById(cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function selectText(containerid) {\n window.getSelection().selectAllChildren( document.getElementById( containerid) );\n}",
"function selectAll() {\n\t\tif(unique <= 0) {\n\t\t\tselections = [];\n\t\t} else {\n\t\t\tselections = [[limits.minX, limits.maxX, limits.minY, limits.maxY, leftMarg, leftMarg + drawW, t... | [
"0.63044506",
"0.5770055",
"0.5730954",
"0.5614796",
"0.5612676",
"0.5603099",
"0.55547386",
"0.5546496",
"0.5544237",
"0.5544237",
"0.5544237",
"0.5522569",
"0.5502777",
"0.547375",
"0.5471278",
"0.5464512",
"0.5450894",
"0.54430765",
"0.54430765",
"0.5440121",
"0.5432713",
... | 0.5982106 | 1 |
Register component and primitive. | function register() {
// register component before register primitive.
AFRAME.registerComponent(component_1.COMPONENT_NAME, component_1.L2D_COMPONENT);
AFRAME.registerPrimitive(primitive_1.PRIMITIVE_NAME, primitive_1.L2D_PRIMITIVE);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_registerComponent(comp) {\n let id = this.nextComponentId++;\n\n comp.id = id;\n this.componentMapping.set(id, comp);\n }",
"register() { }",
"static register(name, component, singleton = false) {\n\t\tComponent.registry[name] = {component:component, singleton:singleton... | [
"0.66870064",
"0.6511892",
"0.6499214",
"0.64107704",
"0.6220895",
"0.60533655",
"0.5973479",
"0.5952799",
"0.5896395",
"0.58673483",
"0.583378",
"0.5721473",
"0.5623091",
"0.5597725",
"0.5592612",
"0.55663365",
"0.55147517",
"0.54806525",
"0.54685956",
"0.54420847",
"0.54389... | 0.75796944 | 0 |
Get Midi Ports Info | function getPorts(midiInterface){
var portCount = midiInterface.getPortCount()
, ports = []
for (var i = 0; i < portCount ; i++) {
var port = {
name : midiInterface.getPortName(i)
, num : i
}
ports.push(port)
}
return ports
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function listMidiOutputs(){\n print(\"Output Devices:\");\n for(var i = 0; i < midiOutDeviceList.length; i++) {\n print(\"(\" + (i+1) + \") \" + midiOutDeviceList[i]); // Get rid of MS wavetable synth\n };\n }",
"function getSerialPorts() {\n SerialPort.list(function (error,... | [
"0.6287718",
"0.6138722",
"0.61376625",
"0.608389",
"0.60469216",
"0.5885371",
"0.5841918",
"0.580133",
"0.5782523",
"0.5748182",
"0.5692473",
"0.5668585",
"0.5667471",
"0.5611964",
"0.55335146",
"0.5483173",
"0.5478807",
"0.5475872",
"0.5395804",
"0.53859985",
"0.5375364",
... | 0.71328884 | 0 |
For 2d cube cubeMaterial.side = THREE.DoubleSide; Setting an initial random color for the material | function pickColor(params) {
cubeMaterial.color.setRGB(
Math.random(100, 256),
Math.random(100, 256),
Math.random(100, 256)
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function RandomColor(){\r\n if(shapeColor.length > 0){\r\n\t\tvar newColor = Random.Range(0, shapeColor.length);\r\n\t\tGetComponent.<Renderer>().material.color = shapeColor[newColor];\r\n\t}\r\n}",
"function setRandomColor() {\n\tcolor1.value = getRandomColor();\n\tcolor2.value = getRandomColor();\n\tsetGrad... | [
"0.6575673",
"0.64615643",
"0.63058186",
"0.6232466",
"0.6223694",
"0.6197121",
"0.61576176",
"0.6103832",
"0.60915095",
"0.6086849",
"0.60826826",
"0.6066202",
"0.604309",
"0.6022676",
"0.6007216",
"0.5991989",
"0.59868765",
"0.5959339",
"0.59582746",
"0.59582746",
"0.595714... | 0.73214614 | 0 |
Draws current score of the players | drawScore() {
RoundScore(this.ctx, this.player1Selction.wins, false);
RoundScore(this.ctx, this.player2Selction.wins, true);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function drawScore() {\n\tscore += 10*difficulty;\n\tnoStroke();\n\tif (drawit){\n\t\ttext(\"Score: \" + round(score/100), width / 2, 0.1*windowHeight);\n\t\ttext(\"Projectiles: \" + projectileCounter, 0.8*(width), 0.1*windowHeight);\n\t\ttext(\"Time left: \" + timeLeft + \" sec\", 0.2*(width), 0.1*windowHeight)... | [
"0.80631596",
"0.7901872",
"0.78129363",
"0.7804508",
"0.77444285",
"0.7670223",
"0.7668433",
"0.76678807",
"0.7629164",
"0.7593407",
"0.7591712",
"0.7556204",
"0.7552264",
"0.7546412",
"0.7538954",
"0.75378966",
"0.7516453",
"0.75083953",
"0.7501696",
"0.7468703",
"0.7466963... | 0.807866 | 0 |
Renders select character screen and allows user to select characters | selectCharacter() {
document.removeEventListener('keydown', this.startKeyDown);
selection(this.ctx);
this.addCharacterSelection();
document.addEventListener('keydown', this.selectKeyDown);
this.gameAnimationId = requestAnimationFrame(this.selectCharacter);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function characterScreen() {\n socket.emit('character selection screen');\n}",
"drawInputSelector() {\n if (!this.input_selected)\n return;\n // set the font and the size of the text\n this.ctx.font = this.text_size + \"px \" + this.text_font;\n // Set the color of the tex... | [
"0.70533574",
"0.6851193",
"0.6495594",
"0.64571846",
"0.6440868",
"0.6375002",
"0.63538635",
"0.63330305",
"0.6245652",
"0.6245652",
"0.620136",
"0.61990774",
"0.61889744",
"0.61780167",
"0.6128371",
"0.6092361",
"0.60909283",
"0.6075876",
"0.60430694",
"0.6032085",
"0.60312... | 0.6867005 | 1 |
Draws the position of selector for player 1 and player2 | addCharacterSelection() {
this.ctx.drawImage(
p1Select,
SELECTION_POSITION[this.player1Selction.index].x,
SELECTION_POSITION[this.player1Selction.index].y,
CHARACTER_SELECTION.ryu.width * SCALE_SPRITE,
CHARACTER_SELECTION.ryu.height * SCALE_SPRITE
);
this.ctx.drawImage(
p2Select,
SELECTION_P... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function menu() {\n // draws one player and two play menu\n if (onePlayerDif == false && twoPlayer == false && onePlayer == false) {\n\n //hover\n if (mouseX < width / 2 && mouseX > 0 && mouseY > 0 && mouseY < height) {\n // dark blue background\n fill(125, 140, 163);\n rect(width / 4, heigh... | [
"0.69692945",
"0.6540391",
"0.6441429",
"0.6413727",
"0.6370225",
"0.62315285",
"0.6225749",
"0.6164625",
"0.6159168",
"0.6141019",
"0.6120446",
"0.61085624",
"0.6073094",
"0.602483",
"0.6019774",
"0.6015609",
"0.5992756",
"0.59833115",
"0.59808624",
"0.5975833",
"0.5937797",... | 0.6919757 | 1 |
Resets the state for players during fighting when key up | keyUpHandler() {
if (this.player1.animationComplete) {
this.player1.currentState = resetState(this.player1.currentState);
this.player1.currentState.isIdle = true;
this.player1.keyListener = true;
this.player1.animationComplete = false;
}
if (this.player2.animationComplete) {
this.player2.currentSta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resetGame() {\n $('span').text('');\n winCondition = false;\n players.player1 = [];\n players.player2 = [];\n}",
"function resetCharactersState() {\n player.reset();\n allEnemies.forEach((bug) => bug.reset());\n}",
"resetKeys() {\n for (let key of Object.keys(this.gamepad))\n ... | [
"0.6777261",
"0.6776693",
"0.6711378",
"0.6682865",
"0.66597205",
"0.66347325",
"0.662749",
"0.6621277",
"0.66153294",
"0.66106063",
"0.66077447",
"0.66024226",
"0.6595064",
"0.659432",
"0.6575439",
"0.65723443",
"0.6559918",
"0.6554619",
"0.65532464",
"0.6513635",
"0.6511028... | 0.6803745 | 0 |
Create a new DefaultXpringClient. The DefaultXpringClient will use gRPC to communicate with the given endpoint. | static defaultXpringClientWithEndpoint(grpcURL, forceWeb = false) {
return utils_1.default() && !forceWeb
? new DefaultXpringClient(new grpc_network_client_1.default(grpcURL))
: new DefaultXpringClient(new grpc_network_client_web_1.default(grpcURL));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static defaultXrpClientWithEndpoint(grpcUrl, network, forceWeb = false) {\n return utils_1.default() && !forceWeb\n ? new DefaultXrpClient(new grpc_xrp_network_client_1.default(grpcUrl), network)\n : new DefaultXrpClient(new grpc_xrp_network_client_web_1.default(grpcUrl), network);\n ... | [
"0.6431757",
"0.5840371",
"0.52431655",
"0.50255",
"0.4857935",
"0.4692951",
"0.46265063",
"0.46027052",
"0.4583841",
"0.45467064",
"0.45187387",
"0.45023024",
"0.44978672",
"0.44828212",
"0.44803134",
"0.4478476",
"0.44769776",
"0.44769353",
"0.4458594",
"0.4458594",
"0.4456... | 0.73907477 | 0 |
Retrieve the transaction status for a given transaction hash. | async getTransactionStatus(transactionHash) {
const transactionStatus = await this.getRawTransactionStatus(transactionHash);
// Return pending if the transaction is not validated.
if (!transactionStatus.isValidated) {
return transaction_status_1.default.Pending;
}
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async getPaymentStatus(transactionHash) {\n return await this.coreXrplClient.getTransactionStatus(transactionHash);\n }",
"getTxStatus (txId) {\n const txMeta = this.getTx(txId)\n return txMeta.status\n }",
"async function getTransactionStatus(txId) {\n const status = await arweave.transactio... | [
"0.7790106",
"0.7044816",
"0.6705284",
"0.6642671",
"0.6640404",
"0.66247094",
"0.6396292",
"0.63926554",
"0.6366751",
"0.636624",
"0.63601893",
"0.62823504",
"0.6172061",
"0.5668016",
"0.55059814",
"0.54799163",
"0.54792786",
"0.54707617",
"0.54090434",
"0.5404226",
"0.53851... | 0.8225748 | 0 |
Send the given amount of XRP from the source wallet to the destination address. | async send(drops, destinationAddress, sender) {
if (!xpring_common_js_1.Utils.isValidXAddress(destinationAddress)) {
throw new Error(XpringClientErrorMessages.xAddressRequired);
}
const classicAddress = xpring_common_js_1.Utils.decodeXAddress(sender.getAddress());
if (!classi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async sendXrp(amount, destinationAddress, sender) {\n return await this.sendXrpWithDetails({\n amount,\n destination: destinationAddress,\n sender,\n });\n }",
"function sendTokens(targetAddress, amount) {\n try {\n const value = amount*1e18;\n const trans... | [
"0.7505088",
"0.64993775",
"0.6459362",
"0.6448846",
"0.6397539",
"0.6326194",
"0.6325309",
"0.62035197",
"0.6114145",
"0.60785395",
"0.5978065",
"0.5965977",
"0.5930917",
"0.59228355",
"0.5915497",
"0.59091556",
"0.58834875",
"0.5864708",
"0.58438325",
"0.5831102",
"0.581650... | 0.6730187 | 1 |
global debug: false GameSoundManager Plays sounds in space, on entities and deals with cross network stuff! | function GameSoundManager() {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function playAttackSound() {\n\t\tif (isGameBegun == true && isGameOver == false && gamePausedForAnotherDefender == false) {\n\t\t\tvar audio = new Audio(\"assets/images/Fire.mp3\");\n\t\t\taudio.play();\n\t\t}\t\t\n\t}",
"playSound(sound){\n this.gameEngine.queueSound(sound)\n }",
"static playSound_Player... | [
"0.72667646",
"0.7240996",
"0.7185181",
"0.71832734",
"0.7119522",
"0.6955323",
"0.68844765",
"0.6860281",
"0.6800265",
"0.67954105",
"0.6790519",
"0.6773416",
"0.6759007",
"0.67432874",
"0.67399627",
"0.6716385",
"0.67116326",
"0.67112356",
"0.66888905",
"0.6685709",
"0.6685... | 0.73672557 | 0 |
============================================================================= stopRainbow This function stops to change a color. ============================================================================= | function stopRainbow()
{
if (act) {
objActive.style.color = clrOrg;
clearInterval(TimerID);
act = 0;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function rainbow() { // Enable and disable rainbows\n rainbows ^= 1; // XOR Gate, alternates between 0 and 1\n}",
"function doRainbow(obj)\n{\n if (act == 0) {\n act = 1;\n if (obj)\n objActive = obj;\n else\n objActive = event.srcElement;\n clrOrg = objAct... | [
"0.7087563",
"0.669039",
"0.6305563",
"0.63013417",
"0.6225339",
"0.62161285",
"0.6193665",
"0.61810464",
"0.61787224",
"0.6169807",
"0.61329037",
"0.61251634",
"0.61080056",
"0.60688657",
"0.6010177",
"0.5964213",
"0.5951666",
"0.5943583",
"0.5921397",
"0.59143",
"0.58673966... | 0.8079418 | 0 |
============================================================================= doRainbowAnchor This function begins to change a color. (of a anchor, automatically) ============================================================================= | function doRainbowAnchor()
{
if (act == 0) {
var obj = event.srcElement;
while (obj.tagName != 'A' && obj.tagName != 'BODY') {
obj = obj.parentElement;
if (obj.tagName == 'A' || obj.tagName == 'BODY')
break;
}
if (obj.tagName == 'A' && obj.hre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Mozilla_doRainbowAnchor(e)\n{\n if (act == 0) {\n obj = e.target;\n while (obj.nodeName != 'A' && obj.nodeName != 'BODY') {\n obj = obj.parentNode;\n if (obj.nodeName == 'A' || obj.nodeName == 'BODY')\n break;\n }\n\n if (obj.nodeName == ... | [
"0.76055294",
"0.6989771",
"0.66418326",
"0.6551029",
"0.6407933",
"0.6273014",
"0.62361306",
"0.6221621",
"0.61809653",
"0.6139883",
"0.6111268",
"0.60927904",
"0.6077228",
"0.6074602",
"0.6073046",
"0.6009338",
"0.59582216",
"0.59402335",
"0.5927922",
"0.5910682",
"0.577255... | 0.78281254 | 0 |
============================================================================= stopRainbowAnchor This function stops to change a color. (of a anchor, automatically) ============================================================================= | function stopRainbowAnchor()
{
if (act) {
if (objActive.tagName == 'A') {
objActive.style.color = clrOrg;
clearInterval(TimerID);
act = 0;
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Mozilla_stopRainbowAnchor(e)\n{\n if (act) {\n if (objActive.nodeName == 'A') {\n objActive.style.color = clrOrg;\n clearInterval(TimerID);\n act = 0;\n }\n }\n}",
"function stopRainbow()\n{\n if (act) {\n objActive.style.color = clrOrg;\n ... | [
"0.8007711",
"0.7416885",
"0.68503195",
"0.649717",
"0.6283378",
"0.60221916",
"0.59235275",
"0.59004945",
"0.5821022",
"0.577804",
"0.57536256",
"0.57087064",
"0.56882596",
"0.56767786",
"0.56346387",
"0.5619643",
"0.56039757",
"0.5603578",
"0.5586971",
"0.5581375",
"0.55722... | 0.81984437 | 0 |
============================================================================= Mozilla_doRainbowAnchor(for Netscape6 and Mozilla browser) This function begins to change a color. (of a anchor, automatically) ============================================================================= | function Mozilla_doRainbowAnchor(e)
{
if (act == 0) {
obj = e.target;
while (obj.nodeName != 'A' && obj.nodeName != 'BODY') {
obj = obj.parentNode;
if (obj.nodeName == 'A' || obj.nodeName == 'BODY')
break;
}
if (obj.nodeName == 'A' && obj.href... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function doRainbowAnchor()\n{\n if (act == 0) {\n var obj = event.srcElement;\n while (obj.tagName != 'A' && obj.tagName != 'BODY') {\n obj = obj.parentElement;\n if (obj.tagName == 'A' || obj.tagName == 'BODY')\n break;\n }\n\n if (obj.tagName ==... | [
"0.8126477",
"0.72622156",
"0.6660142",
"0.64516956",
"0.61627424",
"0.6108634",
"0.6010936",
"0.5993733",
"0.58817756",
"0.5800363",
"0.57920355",
"0.57640725",
"0.5693625",
"0.5640622",
"0.5621246",
"0.55911726",
"0.55782557",
"0.55773973",
"0.5548349",
"0.55303085",
"0.552... | 0.8579972 | 0 |
============================================================================= Mozilla_stopRainbowAnchor(for Netscape6 and Mozilla browser) This function stops to change a color. (of a anchor, automatically) ============================================================================= | function Mozilla_stopRainbowAnchor(e)
{
if (act) {
if (objActive.nodeName == 'A') {
objActive.style.color = clrOrg;
clearInterval(TimerID);
act = 0;
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function stopRainbowAnchor()\n{\n if (act) {\n if (objActive.tagName == 'A') {\n objActive.style.color = clrOrg;\n clearInterval(TimerID);\n act = 0;\n }\n }\n}",
"function Mozilla_doRainbowAnchor(e)\n{\n if (act == 0) {\n obj = e.target;\n wh... | [
"0.81326455",
"0.7755982",
"0.74478644",
"0.6869865",
"0.61730695",
"0.5965889",
"0.55719805",
"0.549669",
"0.54669106",
"0.54184043",
"0.5416342",
"0.5408262",
"0.54003084",
"0.53590494",
"0.5359026",
"0.535336",
"0.5342291",
"0.53331906",
"0.5332878",
"0.53277355",
"0.53261... | 0.86620104 | 0 |
============================================================================= makeColor This function makes rainbow colors. ============================================================================= | function makeColor()
{
// Don't you think Color Gamut to look like Rainbow?
// HSVtoRGB
if (elmS == 0) {
elmR = elmV; elmG = elmV; elmB = elmV;
}
else {
t1 = elmV;
t2 = (255 - elmS) * elmV / 255;
t3 = elmH % 60;
t3 = (t1 - t2) * t3 / 60;
if (el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function rainbow (){\n let color = \"rgba(\"; // we must return a color that looks like this rgba(value,value,value,value) \n for (let i=0; i<3; i++){\n color = color + Math.floor(Math.random()*255)+ \",\"; //255 colors to be selected randomly\n }\n return color+ \"1)\"; // it will... | [
"0.7386069",
"0.73681504",
"0.705311",
"0.6965498",
"0.6905354",
"0.6898195",
"0.6862141",
"0.6858342",
"0.6603155",
"0.65652746",
"0.65390205",
"0.64634347",
"0.64557195",
"0.64510834",
"0.6443322",
"0.6416749",
"0.641476",
"0.63981307",
"0.634862",
"0.6319453",
"0.63038623"... | 0.7725292 | 0 |
find all of contracts only contain non terminated contracts. | static async findAllActive() {
const contracts = await Contract.findAll({
where: {
[Op.or]: [
{ status: 'new' },
{ status: 'in_progress' }
]
}
});
return contracts;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getContractsBagHasBalance() {\n let contracts = [];\n Object.keys(this.state.erc20Contracts).forEach((address) => {\n if ('balanceOfBag' in this.state.erc20Contracts[address] && this.state.erc20Contracts[address].balanceOfBag > 0) {\n contracts.push(address);\n }\n });\n return contrac... | [
"0.5857947",
"0.5397874",
"0.516309",
"0.5156566",
"0.512708",
"0.50597733",
"0.5038358",
"0.49810734",
"0.49807352",
"0.49736",
"0.49038607",
"0.48945183",
"0.4808939",
"0.47781986",
"0.47781262",
"0.47185302",
"0.4708184",
"0.468691",
"0.46845222",
"0.46749663",
"0.4668834"... | 0.5914119 | 0 |
Returns the profession that earned the most money (sum of jobs paid) for any contactor that worked in the query time range. | static async bestProfession(start = null, end = null) {
let max = 0;
let contract_id;
const contracts = await Contract.findAll({ where: { createdAt: { [Op.between]: [start, end] } } });
if (!contracts)
return;
const contract_ids = contracts.map(item => item['id']);
const jobs = await Job... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function bestPaidFreelancer(employees) {\nreturn employees\n.filter(e => e.freelancer)\n.reduce((acc, cur) =>{if(acc == undefined){\n return cur\n }\n return acc.salary > cur.salary ? acc : cur\n},undefined)\n.name\n}",
"function best_discounted_profit(number_of_items, competitors) {\n // console.log(A... | [
"0.58373386",
"0.5519875",
"0.54330146",
"0.53663886",
"0.5355409",
"0.52976483",
"0.52824026",
"0.5278164",
"0.5253965",
"0.51856756",
"0.5161803",
"0.514352",
"0.50879335",
"0.50855005",
"0.5038412",
"0.50281084",
"0.5022666",
"0.4982654",
"0.4981132",
"0.4976584",
"0.49707... | 0.6713418 | 0 |
Get all unpaid jobs for a user (either a client or contractor), for active contracts only. | static async unpaidJobsByUser(profile_id = null) {
if (profile_id === null || profile_id === undefined)
return;
Profile.hasMany(Contract, { foreignKey: 'ContractorId' })
Contract.belongsTo(Profile, { foreignKey: 'ContractorId' })
const contracts = await Contract.findAll({ where: { ContractorId: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static async getPendingJobs(user, queryParams) {\n return jobService.getPendingJobs(user, queryParams);\n }",
"static async getDeclinedJobs(user, queryParams) {\n return jobService.getDeclinedJobs(user, queryParams);\n }",
"static async userJobList(user_id) {\n\t\t// job list responce\n\t\treturn await... | [
"0.6567023",
"0.63906753",
"0.5648386",
"0.5404133",
"0.51870495",
"0.5153389",
"0.5119395",
"0.51169264",
"0.5070627",
"0.4999932",
"0.49989408",
"0.4989586",
"0.49295285",
"0.49013034",
"0.4885791",
"0.4875008",
"0.48589778",
"0.48513764",
"0.48376483",
"0.48306727",
"0.481... | 0.7090843 | 0 |
add width and height in pixelboard | function addPropertyInPixelBoard(size) {
const pixelBoard = document.getElementsByClassName('pixel-board')[0];
pixelBoard.style.width = `${40 * size}px`;
pixelBoard.style.height = `${40 * size}px`;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"set pixelWidth(value) {}",
"#buildBoard() {\n this.boardDisplay.style.width = `${this.board.width * this.pixelSize}px`;\n\n for (let i = 0; i < this.board.height; i++) {\n let col = [];\n for (let j = 0; j < this.board.width; j++) {\n let d = document.createElem... | [
"0.74342096",
"0.70488423",
"0.70015955",
"0.67264724",
"0.667739",
"0.65420425",
"0.63761926",
"0.6361449",
"0.6328296",
"0.6321883",
"0.6270923",
"0.62560105",
"0.6223617",
"0.62147623",
"0.62104225",
"0.61886895",
"0.6164192",
"0.6142348",
"0.6126638",
"0.60923004",
"0.607... | 0.7149771 | 1 |
add property in div | function addProperty(div) {
div.id = 'pixel';
div.className = 'pixel';
div.style.backgroundColor = 'white';
div.addEventListener('click', function (event) {
event.target.style.backgroundColor = colorCurrent;
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function appendProperty(divElement, className, innerText) {\n const propertyDiv = document.createElement(\"div\");\n propertyDiv.setAttribute(\"class\", className);\n propertyDiv.innerText = innerText;\n divElement.appendChild(propertyDiv);\n}",
"function setPanelProperties(div) {\n\tbgcolor=$(\"body\").css(... | [
"0.62559223",
"0.6233102",
"0.61037594",
"0.6100639",
"0.60728663",
"0.6058841",
"0.6057478",
"0.60173523",
"0.601199",
"0.6010685",
"0.6009397",
"0.6009397",
"0.5986276",
"0.5953228",
"0.59302294",
"0.59147346",
"0.5893446",
"0.5892019",
"0.5877644",
"0.58727074",
"0.5833986... | 0.69925183 | 0 |
QUATERNION TRANSFORM ROUTINES //////////////////////////////////////////////// STENCIL: reference quaternion code has the following functions: quaternion_from_axisangle | function quaternion_from_axisangle(axis, angle){
//[cos(Θ/2), ux sin(Θ/2), uy sin(Θ/2), uz sin(Θ/2)]
var x = axis[0];
var y = axis[1];
var z = axis[2];
return [Math.cos(angle/2), x*Math.sin(angle/2), y*Math.sin(angle/2), z*Math.sin(angle/2)];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"axisAngleToQuat(Vector3 axis, float angle)\n {\n var nor = new Vector3(axis);\n \n if (nor.normalize() != 0.0) {\n var phi = angle / 2.0;\n var si = Math.sin(phi);\n this[0] = Math.cos(phi);\n this[1] = nor[0] * si;\n this[2] = nor[1] * si;\n this[3] = nor[2] * si;\n }\n ... | [
"0.68262583",
"0.6673451",
"0.65714514",
"0.65084267",
"0.6497403",
"0.64086914",
"0.6405137",
"0.62996763",
"0.62054604",
"0.6174251",
"0.61625177",
"0.6085732",
"0.6077376",
"0.6020371",
"0.592883",
"0.5909334",
"0.58809507",
"0.58627105",
"0.5851058",
"0.5846229",
"0.58315... | 0.78692853 | 0 |
SfxrSynth Copyright 2010 Thomas Vian Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed o... | function SfxrSynth() {
// All variables are kept alive through function closures
//--------------------------------------------------------------------------
//
// Sound Parameters
//
//--------------------------------------------------------------------------
this._params = new SfxrParam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function SfxrSynth() {\n // All variables are kept alive through function closures\n\n //--------------------------------------------------------------------------\n //\n // Sound Parameters\n //\n //--------------------------------------------------------------------------\n\n this._params = new SfxrParam... | [
"0.70180374",
"0.5988662",
"0.5822578",
"0.57969606",
"0.56919336",
"0.5662923",
"0.56441057",
"0.563583",
"0.5587648",
"0.5584832",
"0.55592686",
"0.5523637",
"0.5477605",
"0.5393379",
"0.5361257",
"0.5359031",
"0.53569424",
"0.53505886",
"0.5341352",
"0.533847",
"0.5308199"... | 0.72390383 | 0 |
Fetch new messages from server 'last_message_id' ownards. | function getGetNewMessages() {
// Change to production URL before deoplyment.
url = 'http://localhost:8000/chat/latest-chat/' + room_id + '/' + last_message_id;
$.get(url, function (data, status) {
$.each(data, function (i, item) {
last_message_id = item.id;
msg_time = ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get lastMessage(){\n\t\treturn this.messages.get(\"id\", this.lastMessageID);\n\t}",
"fetchNewMessages({ getters, commit, dispatch }, { firstFetch } = { firstFetch: false }) {\n\t\tlet activeRooms = getters.allRooms.length ? getters.allRooms.filter(el => el.active) : []\n\t\tAppConnector.request({\n\t\t\tmodule:... | [
"0.6680752",
"0.65270126",
"0.6507579",
"0.6267142",
"0.62592447",
"0.6232092",
"0.6176149",
"0.61481464",
"0.60912335",
"0.60866266",
"0.6083877",
"0.60757697",
"0.6064867",
"0.60565126",
"0.60420924",
"0.60334414",
"0.6022024",
"0.5960382",
"0.595452",
"0.5920913",
"0.59075... | 0.66059494 | 1 |
Decompile the script, intended for debugging only | function script_decompile(binary, onecmd) {
var r = '', ptr = 6, labelcount = 0, labels = {};
if (onecmd >= 0) {
ptr = onecmd; // If we are decompiling just one command, set the ptr to that command.
} else {
if (binary.length < 6) { return '# Invalid script length'; }
var magic = Rea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function decompile(fun, env) {\n logc(\"decompile\", fun.name);\n increment(\"decompile\");\n\n if(!(fun instanceof Function))\n throw new TypeError(\"fun\");\n if(!(env instanceof Object))\n throw new TypeError(\"env\");\n\n // Decompile ?\n if(!(__decompile__))\n return fun;\n\n ... | [
"0.6703005",
"0.6287211",
"0.58977306",
"0.57336056",
"0.5600006",
"0.55433565",
"0.55373317",
"0.552537",
"0.5503423",
"0.54995394",
"0.5482289",
"0.54802257",
"0.5475963",
"0.54548496",
"0.5403242",
"0.538606",
"0.532429",
"0.531726",
"0.53145933",
"0.5308233",
"0.5274695",... | 0.7259037 | 0 |
Should handle anything that's a valid value to an href attribute href refers to the href attribute on the link, origin should include the protocol and host | function parseHref(href, origin) {
const jsHref = /^javascript/;
const hashStartHref = /^#/;
const noProtocolHref = /^\/\/.*/;
const relativeHref = /^\//;
let url;
let isValid;
try {
if (jsHref.test(href) || hashStartHref.test(href)) {
isValid = false;
return { isValid };
}
if (n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function done_or_undone(link){\n return link.getAttribute(\"href\");\n}",
"getHref() {\n return this.getAttribute('href');\n }",
"function dolink(elt)\r\n{\r\n\tif (elt.href === null || elt.href === undefined)\t\t\t\t// avoid undefs\r\n\t{\treturn(null);\t}\r\n\tvar url = decodeURI(elt.href)... | [
"0.63044024",
"0.63007444",
"0.61536264",
"0.6089848",
"0.60801536",
"0.5968812",
"0.5961585",
"0.5920951",
"0.591776",
"0.5860496",
"0.5805742",
"0.58040625",
"0.57979125",
"0.5795596",
"0.57860327",
"0.5751417",
"0.573974",
"0.5734221",
"0.5729832",
"0.5725669",
"0.5723683"... | 0.68266577 | 0 |
When a "config" query string parameter has been specified, set the default selected option to match. | function syncSelectedWithQSSetting() {
const searchParams = new URLSearchParams(location.search);
// Test for presence of "config" URL param.
if (searchParams.has("config")) {
// Get the current "config" param from URL
let currentConfig = searchParams.get("config");
// ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setDefaults() {\n Obj.each(selectConfigs, (config) => {\n const index = config.hasOwnProperty('default') ? config.default : 0;\n\n this.$(config.selector).selectedIndex = index;\n });\n }",
"initialValue(paramName) {\n const currentQueryParams = this.state.currentQueryParams;\n const urlQu... | [
"0.6082387",
"0.59157395",
"0.58204746",
"0.5590316",
"0.53753585",
"0.52590007",
"0.5241992",
"0.5209756",
"0.52072096",
"0.51487213",
"0.51453686",
"0.51085585",
"0.50867724",
"0.5045222",
"0.50399303",
"0.50379324",
"0.50182515",
"0.49750423",
"0.49631453",
"0.49547958",
"... | 0.6059399 | 1 |
find when it was last watered | function lastWater(){
var selectedButton = document.getElementsByClassName("selected");
var index = selectedButton[0].name;
var buffedIndex = index*maxLength;
let currentDate = new Date();
var latest;
if(date[buffedIndex] != null && date[buffedIndex +1] != null){
for(i = buffed... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getLastWatered(waterEvent, waterFreq) {\n return moment(waterEvent)\n .subtract(waterFreq, 'days')\n .format('lll');\n}",
"function last_reading(wreading) {\n //\n field_water.call(this, wreading, 'last_reading');\n //\n //Offload the static data; it will be overwriiten with new more ... | [
"0.66651756",
"0.60468775",
"0.59414715",
"0.58799726",
"0.5871583",
"0.5808659",
"0.57828903",
"0.577936",
"0.57162696",
"0.56485146",
"0.5638933",
"0.56378704",
"0.5636738",
"0.56192464",
"0.56192464",
"0.5617524",
"0.56163186",
"0.56008476",
"0.55972445",
"0.55895495",
"0.... | 0.6228458 | 1 |
Setter for airport object | function setAirportObj(airport) {
airportCode = airport;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getAirportObj() {\n return airportCode;\n }",
"function addAerport(airport) {\n airportsMap2.set(airport.name, airport);\n}",
"function AirPlane(props)\n{\n this.wingspan=props.wingspan;\n this.maxRangeOfFlight=props.maxRangeOfFlight;\n}",
"setAirResistance(airResistance){\n th... | [
"0.67469716",
"0.6642635",
"0.6020429",
"0.599269",
"0.5951576",
"0.5891961",
"0.57801235",
"0.5720733",
"0.55483913",
"0.54476154",
"0.5399996",
"0.536086",
"0.5329173",
"0.5293762",
"0.52802736",
"0.5255148",
"0.5111232",
"0.5067041",
"0.50629693",
"0.50532174",
"0.5037543"... | 0.85861105 | 0 |
Getter for airport object | function getAirportObj() {
return airportCode;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setAirportObj(airport) {\n airportCode = airport;\n }",
"function AirportInfo(code) {\n this.FAAURL = 'https://services.faa.gov/airport/status/';\n this.FAAFORMAT = '?format=application/json';\n this.respJSON = {};\n\n // get current airport info from the FAA using iata code (i.e... | [
"0.6627048",
"0.62268645",
"0.61649597",
"0.60069144",
"0.5918348",
"0.5906713",
"0.58824724",
"0.5769528",
"0.57653034",
"0.5751589",
"0.5709838",
"0.5708869",
"0.5697836",
"0.5694722",
"0.56622124",
"0.56284434",
"0.5603839",
"0.5583252",
"0.55544114",
"0.5536806",
"0.55356... | 0.85906684 | 0 |
Validates that field is a valid Canadian province | function canadianprovince(data, field, message, args, get) {
return new Promise(function (resolve, reject) {
const fieldValue = get(data, field);
if(!fieldValue) {
return resolve('validation skipped')
}
var canadianProvinces = ['ON', 'AB', 'BC', 'MB', 'NB', 'NL', 'NS', 'NT'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validarProvinciaa(cpostal){\n let cp_provincias = {\n 1: \"\\u00C1lava\", 2: \"Albacete\", 3: \"Alicante\", 4: \"Almer\\u00EDa\", 5: \"\\u00C1vila\",\n 6: \"Badajoz\", 7: \"Baleares\", 8: \"Barcelona\", 9: \"Burgos\", 10: \"C\\u00E1ceres\",\n 11: \"C\\u00E1diz\", 12: \"Castell\\u00F3n\",... | [
"0.6819033",
"0.6815127",
"0.6741084",
"0.6348876",
"0.6187208",
"0.6014407",
"0.59780955",
"0.5973791",
"0.59444845",
"0.58865994",
"0.58337665",
"0.5832392",
"0.5828375",
"0.57613856",
"0.5757375",
"0.5684699",
"0.5652161",
"0.56219274",
"0.55802006",
"0.55420077",
"0.55218... | 0.72589314 | 0 |
Messenger is the application's main class | function Messenger(feed) {
this.feed = feed;
this.init();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get() {\n return Messenger.getInstance();\n }",
"function _createMessenger(){\n _.defineProperty(this, MESSENGER_PROPERTY, new Messenger(this));\n}",
"function engage() {\n addEvent(window, 'message', onMessageReceived);\n }",
"on_message(message) {\r\n }",
"static get workerMe... | [
"0.63844794",
"0.6343988",
"0.6262216",
"0.61819226",
"0.60490406",
"0.59149843",
"0.5868806",
"0.58334035",
"0.5774686",
"0.5774566",
"0.5760234",
"0.57528406",
"0.57459277",
"0.5692223",
"0.5673296",
"0.5620754",
"0.55949515",
"0.5593957",
"0.55806804",
"0.556206",
"0.55434... | 0.649719 | 0 |
replicates array_get feature from laravel | array_get (i,k,d) {if (typeof d === 'undefined') { d = null; } if (!k) return i; let s = k.split('.'); let o = i; for(let x=0;x < s.length; x++) { if (null !== o && o.hasOwnProperty(s[x])) { o = o[s[x]]; } else { return d; }} return o;} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"array_fetch (arr,key) { let r = []; for (let k in arr) { if (arr.hasOwnProperty(k)) { if (this.array_has(arr[k],key)) { r.push(this.array_get(arr[k],key)); } } } return r; }",
"get(array, off) {\n }",
"get arr () {\n return this.order.map(i => this.raw[i])\n }",
"function array(){\n return array1... | [
"0.66892844",
"0.6282576",
"0.59292763",
"0.5784047",
"0.5741559",
"0.5646556",
"0.56438714",
"0.5638437",
"0.56069976",
"0.56016654",
"0.5570704",
"0.55559796",
"0.5552013",
"0.5532473",
"0.55246866",
"0.55169564",
"0.55029076",
"0.5497976",
"0.54880935",
"0.54635066",
"0.54... | 0.64224875 | 1 |
replicates array_dot feature from laravel | array_dot (i, p) {let o = {};p = p || ''; if (p) { p = p+'.'; } if (typeof i == 'object') { for (let k in i) { if (i.hasOwnProperty(k)) { if (typeof i[k] == 'object') { x = array_dot(i[k],k); for(let l in x) { o[p+l] = x[l]; } } else { o[p+k] = i[k]; } } } } return o;} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"dot() {}",
"function dotify(x, y) {\n if (x.length !== y.length) {\n throw new Error(\"Vectors to be dotted must be of the same length -\" +\n (\"got \" + x.length + \" and \" + y.length));\n }\n var slices = [];\n var nearestVec4 = Math.floor(x.length / 4);\n var nearestVec4Rema... | [
"0.5898877",
"0.53670627",
"0.5354545",
"0.52772766",
"0.52598035",
"0.5254744",
"0.5225276",
"0.52056533",
"0.5168092",
"0.5132995",
"0.5097106",
"0.5048695",
"0.50379455",
"0.5022639",
"0.5004373",
"0.5000661",
"0.49803734",
"0.49748066",
"0.49304903",
"0.49172348",
"0.4909... | 0.75462264 | 0 |
replicates array_except feature from laravel (does not account for array_dot subkeys) | array_except(a,ks){ let b = jQuery.extend(true, {}, a); ks.forEach(function(k){ delete b[k]; }); return b; } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"array_only(a,ks){ let b = jQuery.extend(true, {}, a); for(let k in a) { if (ks.indexOf(k) === -1) delete b[k]; } return b; }",
"except(keys) {\n return utils_1.lodash.omit(this.all(), keys);\n }",
"removeAllExcept(keyArray) {\n var obj = JSON.parse(window.localStorage.getItem(this.storageKey))... | [
"0.6864631",
"0.6660359",
"0.6272194",
"0.61778486",
"0.6163242",
"0.5855186",
"0.5810117",
"0.57840353",
"0.57019657",
"0.55859005",
"0.5567718",
"0.55547947",
"0.55517244",
"0.5541079",
"0.5517309",
"0.5477735",
"0.54630405",
"0.54509175",
"0.5415822",
"0.54033345",
"0.5380... | 0.7566482 | 0 |
replicates array_only feature from laravel (does not account for array_dot subkeys) | array_only(a,ks){ let b = jQuery.extend(true, {}, a); for(let k in a) { if (ks.indexOf(k) === -1) delete b[k]; } return b; } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function arrayLikeKeys() {\n\n}",
"array_except(a,ks){ let b = jQuery.extend(true, {}, a); ks.forEach(function(k){ delete b[k]; }); return b; }",
"only(keys) {\n return utils_1.lodash.pick(this.all(), keys);\n }",
"array_dot (i, p) {let o = {};p = p || ''; if (p) { p = p+'.'; } if (typeof i == 'obj... | [
"0.6692891",
"0.5954434",
"0.58231306",
"0.56937873",
"0.56686777",
"0.5603262",
"0.5587604",
"0.5540482",
"0.5509861",
"0.54544973",
"0.54256636",
"0.54136693",
"0.53788596",
"0.53403836",
"0.53264827",
"0.53242475",
"0.5304383",
"0.529723",
"0.5289607",
"0.52530545",
"0.525... | 0.6811177 | 0 |
replicates array_fetch feature from laravel | array_fetch (arr,key) { let r = []; for (let k in arr) { if (arr.hasOwnProperty(k)) { if (this.array_has(arr[k],key)) { r.push(this.array_get(arr[k],key)); } } } return r; } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"fetch() {\n const raw = this._sendRequest('query', this._query).map(val => {\n delete val.$hz_v$\n return val\n })\n if (this._query.find) {\n return raw.defaultIfEmpty(null)\n } else {\n return raw.toArray()\n }\n }",
"static fetchAll() {\n const db = getDb();\n ... | [
"0.62964594",
"0.5899572",
"0.58733255",
"0.5854649",
"0.5644523",
"0.5595928",
"0.54888284",
"0.5478316",
"0.5417586",
"0.54059494",
"0.53719443",
"0.5357313",
"0.53553826",
"0.5349985",
"0.5348675",
"0.5331521",
"0.5322275",
"0.5322275",
"0.5322275",
"0.53080153",
"0.528920... | 0.7306503 | 0 |
Determine if the message from Background.js is relevant | function handleBackgroundMessage(request, _, __) {
// This regular expression matches URL for pages with conversations
var REGEX = /https:\/\/app.intercom.io\/a\/apps\/\w*\/inbox\/.*\/conversations\/\d*/g
if (REGEX.test(request.tab.url) && request.tab.status == 'complete') {
// Since this page is a conversa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function background_onMessage (request, sender, sendResponse){\n //if (request.data.view) return;\n processMessage(request);\n }",
"function background_onMessage(request, sender, sendResponse) {\n if (request.data.view) return;\n processMessage(request);\n }",
"function messag... | [
"0.6593503",
"0.6353309",
"0.6116053",
"0.6111507",
"0.6077353",
"0.6052929",
"0.6032265",
"0.6018784",
"0.59610677",
"0.59318364",
"0.5923114",
"0.5875754",
"0.5844027",
"0.5839114",
"0.5814107",
"0.581363",
"0.58117795",
"0.578899",
"0.57836753",
"0.5728494",
"0.568469",
... | 0.66064024 | 0 |
Given a room, send a list of users in that room | function sendUsersInRoom(room) {
io.to(room).emit("usersInRoom", {
room,
users: getUsersInRoom(room),
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function trySendClientList(forRoom) \n{\n\tvar clientList = '';\n\n\tif (forRoom.globalView == undefined) {\n\t\treturn;\n\t}\n\t\n\tfor (var i = 0; i < forRoom.users.length; i++) {\n\t\tclientList += forRoom.users[i].userName + \" \";\n\t}\n\t\n\tforRoom.globalView.in(forRoom.roomName).emit('sendClientList', clie... | [
"0.73185784",
"0.7280361",
"0.71823734",
"0.71712303",
"0.7101949",
"0.69314426",
"0.6912975",
"0.6835488",
"0.6755961",
"0.6747061",
"0.67448515",
"0.67420965",
"0.67336",
"0.66563016",
"0.66284144",
"0.6614861",
"0.66043377",
"0.6557441",
"0.6533953",
"0.65119404",
"0.65086... | 0.8555197 | 0 |
function for counting the number of word in the file | function countWord(aContent){
var regExp = /\s/;
var numberWord = aContent.split(regExp).length; // '\s' finds the whitespace character
return numberWord;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function wordCount(data){\n var words=data.match(/\\S+/g);\n\n return words.length\n}",
"function wordCount(data) {\n\tvar pattern = /[a-zA-Z0-9_\\u0392-\\u03c9\\u0410-\\u04F9]+|[\\u4E00-\\u9FFF\\u3400-\\u4dbf\\uf900-\\ufaff\\u3040-\\u309f\\uac00-\\ud7af]+/g;\n\tvar m = data.match(pattern);\n\tvar count = ... | [
"0.7163678",
"0.711909",
"0.70597696",
"0.70375836",
"0.6931968",
"0.6886686",
"0.6871567",
"0.68261904",
"0.6800428",
"0.6771328",
"0.67079675",
"0.6706703",
"0.6706086",
"0.6695092",
"0.66586053",
"0.66455376",
"0.6612044",
"0.6602523",
"0.6595061",
"0.6595061",
"0.6595061"... | 0.7260823 | 0 |
Lorsque qu'on clique sur le bouton, le panier se vide ainsi que le localStorage | function viderPanier() {
const buttonViderPanier = document.querySelector(".vide-panier");
buttonViderPanier.addEventListener("click", () => {
localStorage.clear();
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function viderPanier() {\n localStorage.clear();// on le retire du localstorage\n location.reload();//Mise à jour de la page pour affichage de la suppression au client\n}",
"function envoiAuPanier() {\n // Selection du bouton panier\n const btnEnvoyerPanier = document.querySelector(\"#button__panier\");\... | [
"0.680953",
"0.6783442",
"0.6732417",
"0.6719604",
"0.6653714",
"0.6634558",
"0.65958524",
"0.6582046",
"0.6560248",
"0.6530125",
"0.65174854",
"0.65033835",
"0.64923817",
"0.64820915",
"0.64792335",
"0.6425998",
"0.64234996",
"0.636452",
"0.63550174",
"0.6344554",
"0.6343728... | 0.6893139 | 0 |
changing the images for the computer | function computerChangePaperImage() {
if (compPaperDisplay.style.display = "none") {
compPaperDisplay.style.display = "block";
cR();
cS();
} else {
setCompToNone();
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function changeImage(img) {\n img.setAttribute(\"src\", \"images/\" + aleatoire(1, 5) + \".jpeg\");\n }",
"function setImages() {\n \n for (var i = 0 ; i < photoPaths.length; i++) { \n\t\t//Calls reused function to change background image\n changeBackgroundImage('prod' + (i+1), photoPaths[i]... | [
"0.7288487",
"0.70928645",
"0.70253205",
"0.7010101",
"0.69923615",
"0.692248",
"0.6920542",
"0.6912234",
"0.69026625",
"0.6783318",
"0.67598796",
"0.6744226",
"0.6742475",
"0.6740774",
"0.6733038",
"0.67295784",
"0.6726747",
"0.66937065",
"0.66906315",
"0.66853404",
"0.66819... | 0.73853457 | 0 |
This generic function is used by anything that needs to do an AJAX GET to get back a JSON object. the datatype defaults to json unless explicitly set if explicitly set, must be html, text or xml | function ajaxGet(apiurl, on_success, datatype) {"use strict";
// NOTE: this get type takes an on_success() function.
// async calls can't return values --- there's no telling when they'll be done.
// but when it is done, we'll call the on_success function!
datatype = typeof datatype !== 'undefined' ? da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function jsonify(xhr) {\n var ctype = xhr.getResponseHeader('Content-Type');\n if (ctype && ctype.indexOf('application/json') > -1) {\n return JSON.parse(xhr.responseText);\n }\n }",
"function json_ajax(type, url, dataType, async, data, callback) {\r\n $.ajax(\r\n {\r... | [
"0.6243339",
"0.60959774",
"0.6040365",
"0.5925732",
"0.5921796",
"0.5887711",
"0.58658034",
"0.58633363",
"0.584545",
"0.58257437",
"0.58140165",
"0.57663655",
"0.5762774",
"0.57496446",
"0.57427555",
"0.57016295",
"0.5697258",
"0.56677693",
"0.565453",
"0.5647405",
"0.56372... | 0.6573096 | 0 |
Add edge from source to destination with cost | addEdge(source, destination, cost) {
if (!isString(source) || !isString(destination) || !isNumber(cost) || cost < 1) {
throw new Error('Data type mismatch, expects source, destination as string and cost as number greater than 1');
}
if(this.searchEdge(source, destination).length > 0){
throw new ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addEdge(origin, destination) {\n adjacencyList.get(origin).push(destination);\n adjacencyList.get(destination).push(origin);\n}",
"addEdge(from, to, weight) {\r\n if (this.edges.get(from) == undefined) {\r\n this.edges.set(from, new Map());\r\n }\r\n if (to != undefined) {\r\n i... | [
"0.70370233",
"0.6533389",
"0.6507102",
"0.6387974",
"0.63680613",
"0.6327174",
"0.6325205",
"0.6281668",
"0.62651527",
"0.62264866",
"0.6186661",
"0.6178111",
"0.6172414",
"0.60465276",
"0.60306674",
"0.59971625",
"0.5985511",
"0.5976761",
"0.59192413",
"0.59021735",
"0.5873... | 0.7635766 | 0 |
Remove resource from the step | onRemove() {
this.props.remove(this.props.step, this.props.resource);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function deleteStep() {\n\t// doesn't do anything right now. The delete step button should reference here\n}",
"removeLastStep()\n {\n if(this.stepId > 1)\n {\n this.$stepSection.querySelector(`.webcast-step-${--this.stepId}`).remove()\n }\n\n }",
"remove() {\n this.unp... | [
"0.66121674",
"0.6591845",
"0.6534124",
"0.63904387",
"0.63759935",
"0.63759935",
"0.6209696",
"0.61964136",
"0.617744",
"0.61502653",
"0.6143362",
"0.6131869",
"0.610063",
"0.6080093",
"0.60494304",
"0.60316753",
"0.60282505",
"0.6025717",
"0.5956277",
"0.59418684",
"0.59304... | 0.7685553 | 0 |
name: string; private id:string; private employes: string[] = []; | constructor(id, name, employes = []) {
this.id = id;
this.name = name;
this.employes = employes;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function employee(name,salary,experience){\r\n this.name=name;\r\n this.salary=salary;\r\n this.experience=experience;\r\n\r\n}",
"constructor(employees) {\n this.employees = employees;\n }",
"function Employee (name , email , department)\n{\n this.name= name ;\n this.email= email;\n ... | [
"0.67181456",
"0.67176336",
"0.66371286",
"0.6593269",
"0.6578261",
"0.6437507",
"0.63407767",
"0.6330175",
"0.6329175",
"0.6290674",
"0.6287338",
"0.62560916",
"0.62431604",
"0.61700124",
"0.61683834",
"0.61055845",
"0.6083901",
"0.6058639",
"0.60382265",
"0.6035494",
"0.603... | 0.76516956 | 0 |
Function is used to check whether selected product is linked product or not | function isLinkedProduct(store, record, isEdit) {
var isProductOfLinkedDocument = false;
var linkedId = "";
if (store && record) {
if (isEdit) {
linkedId = record.data.linkid;
} else {
linkedId = record.data.billid;
}
if (linkedId != "") {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"linked(service) {\n return this.props.linkedServices[service.exchangeInformation.path] ? true : false\n }",
"function checkCreativeList(formField, Product){\n\tif($.inArray(allOptionId,formField) != -1){\n\t\treturn true;\n\t}\n\t\n\tvar isAvail = false;\n\tfor(var j=0;j<Product.creative.length;j++... | [
"0.6001201",
"0.5906331",
"0.5868855",
"0.5802912",
"0.57681805",
"0.5766816",
"0.57353586",
"0.56703067",
"0.5649059",
"0.56098115",
"0.56016296",
"0.55916333",
"0.5577301",
"0.55653834",
"0.55485666",
"0.5535832",
"0.553267",
"0.5518238",
"0.5514058",
"0.5494221",
"0.549357... | 0.72812086 | 0 |
adiciona mascara de cnpj | function MascaraCNPJ(cnpj){
if(mascaraInteiro(cnpj)==false){
event.returnValue = false;
}
return formataCampo(cnpj, '00.000.000/0000-00', event);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function MascaraCNPJ(cnpj)\n{\n\tif(mascaraInteiro(cnpj)==false){\n\t\tevent.returnValue = false;\n\t}\n\treturn formataCampo(cnpj, '00.000.000/0000-00', event);\n}",
"function formatarCpfCnpj(campo) {\n\t\tvar vr = new String(campo.value);\n\t\tvr = replaceAll(vr, \".\", \"\");\n\t\tvr = replaceAll(vr, \"/\", \... | [
"0.7061903",
"0.60452396",
"0.56240976",
"0.55414593",
"0.54571897",
"0.5449444",
"0.5434565",
"0.54339737",
"0.5427429",
"0.5426878",
"0.5381005",
"0.5342121",
"0.53182423",
"0.53074795",
"0.529391",
"0.52550983",
"0.5247957",
"0.52373457",
"0.5227199",
"0.5199179",
"0.51960... | 0.69590384 | 1 |
adiciona mascara do celular | function MascaraCelular(cel){
if(mascaraInteiro(cel)==false){
event.returnValue = false;
}
return formataCampo(cel, '(00) 00000-0000', event);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mascaraCelular(){\n\n //aceita apenas no maximo 14 caracteres\n txtCelular.maxLength=\"14\";\n \n let texto = txtCelular.value;\n\n texto = texto.replace(/[^0-9]/g, \"\");//tudo que for diferente de número troca por nada\n texto = texto.replace(/(.)/, \"($1\");//no começo conta um e cons... | [
"0.6339097",
"0.6244949",
"0.6070471",
"0.5943399",
"0.5931991",
"0.5922387",
"0.578032",
"0.57709664",
"0.5736941",
"0.5720789",
"0.56984043",
"0.5696546",
"0.5627577",
"0.56242025",
"0.5615348",
"0.5594282",
"0.55866",
"0.5584745",
"0.55499667",
"0.5536243",
"0.5527141",
... | 0.7030868 | 0 |
adiciona mascara ao CPF | function MascaraCPF(cpf){
if(mascaraInteiro(cpf)==false){
event.returnValue = false;
}
return formataCampo(cpf, '000.000.000-00', event);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function MascaraCPF(cpf){\n if(mascaraInteiro(cpf)==false){\n event.returnValue = false;\n } \n return formataCampo(cpf, '000.000.000-00', event);\n }",
"function MascaraCPF(cpf) {\n if (mascaraInteiro(cpf) == false) {\n event.returnValue = false;\n }\n return formataCampo(c... | [
"0.6268643",
"0.620525",
"0.61939436",
"0.61659765",
"0.61527705",
"0.5950938",
"0.57770264",
"0.5670453",
"0.5669295",
"0.56481194",
"0.5621221",
"0.56034124",
"0.5595963",
"0.559307",
"0.5590158",
"0.55637944",
"0.5539102",
"0.5536123",
"0.55355084",
"0.55258524",
"0.551963... | 0.629994 | 0 |
verifica email pessoa fisica | function verificaEmailPF()
{
var email = document.CadastroCliente.txtEmail.value;
if ((email.length != 0) && ((email.indexOf("@") < 1) || (email.indexOf('.') < 2)))
{
document.getElementById("msg").innerHTML="E-mail incorreto!";
document.CadastroCliente.txtEmail.focus();
}
else
{
docu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function verifEmail() {\n const verifEmailData = contact.email;\n if (regex3(verifEmailData)) {\n console.log(\"OK pour l'email\");\n return true;\n } else {\n console.log(\"Email non valide\");\n return false;\n }\n }",
"function verificaEmailPJ()\n\t{\n\t\tvar... | [
"0.74898136",
"0.7403048",
"0.73650575",
"0.73528445",
"0.72277236",
"0.72010607",
"0.7184706",
"0.7147313",
"0.71039414",
"0.71005213",
"0.7099599",
"0.7088294",
"0.70163816",
"0.7003944",
"0.6961355",
"0.6956781",
"0.69158494",
"0.6898935",
"0.6888349",
"0.68854415",
"0.687... | 0.7516903 | 0 |
verifica email pessoa juridica | function verificaEmailPJ()
{
var email = document.CadastroPessoaJ.txtEmailE.value;
var email2 = document.CadastroPessoaJ.txtEmailR.value;
if ((email.length != 0) && ((email.indexOf("@") < 1) || (email.indexOf('.') < 2)))
{
document.getElementById("msg").innerHTML="E-mail incorreto!";
document.Ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function verifEmail() {\n const verifEmailData = contact.email;\n if (regex3(verifEmailData)) {\n console.log(\"OK pour l'email\");\n return true;\n } else {\n console.log(\"Email non valide\");\n return false;\n }\n }",
"function correo(email){\n\tvar emailReg ... | [
"0.7127648",
"0.712551",
"0.70887417",
"0.7064006",
"0.70355606",
"0.7008805",
"0.697624",
"0.6967093",
"0.6940204",
"0.6904511",
"0.6821287",
"0.681948",
"0.6778479",
"0.6773371",
"0.67719436",
"0.677176",
"0.67711765",
"0.6746369",
"0.6744049",
"0.6699034",
"0.6696716",
"... | 0.7351201 | 0 |
loop here, check if chaincode is up and running or not | function check_if_deployed(e, attempt){
if(e){
console.log('! looks like a deploy error, holding off on the starting the socket\n', e)
}
else if(attempt >= 15){ //tried many times, lets give up and pass an err msg
console.log('[preflight check]', attempt, ': failed too many times, giving up')
v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function isSetup(){\n //TODO for database team\n await main();\n return true;\n}",
"function check () {\n if (!consumer.client.initialBrokers && !consumer.client.initialBrokers.length) {\n return false\n }\n let connected = true\n consumer.client.initialBrokers.forEach(conn => {\n logger... | [
"0.56917804",
"0.56888396",
"0.56888396",
"0.55612046",
"0.5505369",
"0.54722196",
"0.5440591",
"0.54273415",
"0.54251915",
"0.5394619",
"0.5352858",
"0.5330411",
"0.53150713",
"0.52961177",
"0.52956164",
"0.5290681",
"0.5282668",
"0.5282406",
"0.52674323",
"0.5266008",
"0.52... | 0.6414856 | 0 |
got the block's stats, add to transactionHistroy if its a transaction | function cb_blockstats(e, stats){
if(e != null) console.log('blockstats error:', e)
else {
if(stats.transactions){
transactionUtil.addTransaction(stats.transactions[0], function(blockObj){
if(deployed){
ws.broadcastTransaction(blockObj.type, blockObj.transaction, JSON.stringify(blockObj)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function cb_blockstats(e, stats){\n\t\tif(chain_stats.height) stats.height = chain_stats.height - 1;\n\t\tsendMsg({msg: \"chainstats\", e: e, chainstats: chain_stats, blockstats: stats});\n\t}",
"function cb_blockstats(e, stats) {\n if (chain_stats.height) stats.height = chain_stats.height - 1;\n s... | [
"0.6753067",
"0.673087",
"0.660711",
"0.6525924",
"0.6344676",
"0.6044394",
"0.6013261",
"0.5960394",
"0.5947044",
"0.59425575",
"0.59235483",
"0.59062546",
"0.59019095",
"0.5789706",
"0.5775335",
"0.57494503",
"0.5721079",
"0.56945753",
"0.56734544",
"0.56646246",
"0.5652411... | 0.76294386 | 0 |
Returns all possible hand values (NOTE: An ace can be equal to 11 or 1) | function getHandValues(hand) {
let aceCount = 0;
let maxHandTotal = hand.reduce((total, card) => {
let val = parseInt(card.value);
let pVal = !isNaN(val) ? val :
card.value === "ACE" ? 11 : 10;
if (pVal == 11) aceCount++;
return total + pVal;
}, 0);
let h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function values(hand) {\n let total = totalExcludingAces(hand); // excludes aces\n let handVals = valuesExcludingAces(hand);\n\n let numAces = countAcesInHand(hand);\n\n handVals.forEach((card, idx) => {\n if (card === 'A') {\n numAces--;\n handVals[idx] = total + numAces <= BUST_LIMIT - ACE_VALUE... | [
"0.78008276",
"0.7068197",
"0.6961944",
"0.6697341",
"0.65248144",
"0.6473429",
"0.6374041",
"0.6370037",
"0.6362074",
"0.625613",
"0.6192666",
"0.60933614",
"0.60209465",
"0.6015333",
"0.60103935",
"0.59857416",
"0.59210855",
"0.590734",
"0.58777356",
"0.58481103",
"0.581989... | 0.7787043 | 1 |
this adds a pet to the local storage for the user | function addPet(petId){
petArray=JSON.parse(localStorage.getItem('savedPetsArray'));
console.log("pet added to saved pets");
petArray.push(petId);
localStorage.setItem('savedPetsArray', JSON.stringify(petArray));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addPet(petId) {\n\n petArray = JSON.parse(localStorage.getItem('savedPetsArray'));\n console.log(\"pet added to saved pets\");\n petArray.push(petId);\n localStorage.setItem('savedPetsArray', JSON.stringify(petArray));\n}",
"function addPet(data){\n var img = document.createElement(\"img\");\n img... | [
"0.7815438",
"0.692238",
"0.6691612",
"0.66859114",
"0.63654745",
"0.6357931",
"0.63507694",
"0.6344757",
"0.6239727",
"0.61761373",
"0.6143425",
"0.61036223",
"0.60601574",
"0.60357684",
"0.6031209",
"0.6024002",
"0.60219437",
"0.60128826",
"0.5998267",
"0.59935874",
"0.5990... | 0.77656454 | 1 |
Function to Open up the Pet page with more information about the saved Pet | function openPetPageForPet(petID) {
window.location.href = `./pet-page.html?id=${petID}`;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function openPetPageForPet(petID) {\n window.location.href = './pet-page.html?id=' + petID;\n}",
"function handlePetEdit() {\n var currentPet = $(this)\n .parent()\n .parent()\n .data(\"pet\");\n window.location.href = \"/cms?pet_id=\" + currentPet.id;\n }",
"function addPet(data){\n va... | [
"0.6840373",
"0.6262683",
"0.60554963",
"0.59236294",
"0.59155935",
"0.5899132",
"0.5871807",
"0.58053833",
"0.5805221",
"0.57959175",
"0.5759334",
"0.5750374",
"0.57406664",
"0.57106733",
"0.56777954",
"0.5644998",
"0.5441498",
"0.5430847",
"0.5397657",
"0.53512377",
"0.5344... | 0.6770943 | 1 |
goes through the saved pets array and displays them and call the load pet function | function allPets(){
//grabs the pets from the local storage
petArray=JSON.parse(localStorage.getItem('savedPetsArray'));
//makes sure its not null so it doesnt give us issues
if(petArray == null) return;
//goes through thr array and calls load pets on it
else{petArray.forEach(element => {
loadPets(element);... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function allPets() {\n //grabs the pets from the local storage\n petArray = JSON.parse(localStorage.getItem('savedPetsArray'));\n\n //makes sure its not null so it doesnt give us issues\n if (petArray == null) return;\n\n //goes through thr array and calls load pets on it \n else {\n petArray.forEach(fu... | [
"0.711397",
"0.6562268",
"0.6487068",
"0.6334751",
"0.62752324",
"0.6211356",
"0.60094213",
"0.6007263",
"0.5997415",
"0.5913603",
"0.5908368",
"0.5902736",
"0.58386654",
"0.57896924",
"0.5759866",
"0.5742636",
"0.57363474",
"0.57317597",
"0.5726783",
"0.57147354",
"0.5677811... | 0.7101999 | 1 |
Helper function creates href from href or uri | function ToHref(hrefOrUri) {
// determine href
var href = null;
if (hrefOrUri.substr(0, 7) != "http://") {
href = baseURL + hrefOrUri;
} else {
href = hrefOrUri;
}
return href;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function urlParse(href) {\n var parser = document.createElement('a');\n parser.href = href;\n return parser;\n }",
"function toURL(href) {\n if(typeof URL === 'function' && isLocation) {\n return new URL(href, location.toString());\n } else if (hasDocument) {\n var anc = document.create... | [
"0.69579506",
"0.6831514",
"0.65680933",
"0.6507708",
"0.63881737",
"0.62404144",
"0.6225945",
"0.6130587",
"0.61204225",
"0.60883254",
"0.6037844",
"0.6034168",
"0.59997994",
"0.5996345",
"0.5914219",
"0.58927023",
"0.58598465",
"0.5847497",
"0.58312154",
"0.58312154",
"0.58... | 0.73686284 | 0 |
this function takes as input a href from 'flattened' Restful Object, the payload and the http method it returns the output as given by the RO api | function PerformFunction(hrefOrUri, payload, functionMethod) {
var wrappedPayload = {};
for (var key in payload) {
wrappedPayload[key] = {
"value": payload[key]
}
console.log(wrappedPayload);
}
switch ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async getShortenedLinks() {\n try {\n const key = 'a869fe0d92824384aa94bed2dfd5c203'; // api key for rebrandly api\n let linkRequest = {\n destination: this.link,\n domain: { fullName: 'rebrand.ly' },\n };\n\n let requestHeaders = {\n 'Content-Type': 'app... | [
"0.5572737",
"0.5426831",
"0.5286188",
"0.5237103",
"0.515772",
"0.5036613",
"0.50210285",
"0.5014338",
"0.500015",
"0.49887303",
"0.49228594",
"0.4908341",
"0.48904642",
"0.48802203",
"0.48554257",
"0.4835123",
"0.48176864",
"0.48124546",
"0.4794783",
"0.47698686",
"0.476652... | 0.56367475 | 0 |
Toggles state.viewMode and then updates listing | toggleView(toggleVal) {
this.setState({viewMode: toggleVal},
() => {this.filterListings(this.props.listings)}
);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"listViewHandler() {\n // this.state.isEdit = !this.state.isEdit;\n this.setState({ isVisaList: !this.state.isVisaList });\n }",
"function viewList() {\n if (fileView === 'list') return;\n fileView = 'list';\n updateFilesList();\n document.getElementById('btn-tile').classList.remove('is-info');... | [
"0.71054584",
"0.674803",
"0.6385866",
"0.62912405",
"0.6266442",
"0.62581587",
"0.6248401",
"0.62144417",
"0.62053424",
"0.61988795",
"0.6184964",
"0.61689717",
"0.6118777",
"0.60646415",
"0.6038418",
"0.6004669",
"0.59951943",
"0.5972822",
"0.5962272",
"0.59605426",
"0.5957... | 0.70203006 | 1 |
creates HTML element for a Submit button that executes based on status of user | function newPostSubmitButton(user) {
if(user._id !== undefined) {
saveButton = document.createElement('button');
saveButton.setAttribute('style','border-radius:10px; border-width:0px; background-color:plum;padding: 15px 32px;');
saveButton.setAttribute('id', 'btnShow1');
saveButton.innerText = 'Subm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateSubmitButton() {\n let submitButton = `\n <button class=\"btn btn-red\" id=\"submit-button\" onclick=\"checkCompletion()\">Submit</button>\n `;\n rowFour.innerHTML = submitButton;\n}",
"addSubmitButton() {}",
"function writeSubmitButton() {\n $(\"#formSubmit\").append(\"<button id='su... | [
"0.71794176",
"0.696695",
"0.6705602",
"0.6615221",
"0.66093063",
"0.6579001",
"0.6530648",
"0.65253294",
"0.64815",
"0.647798",
"0.6450137",
"0.63645965",
"0.6353203",
"0.6349054",
"0.6314704",
"0.62768626",
"0.62667227",
"0.6234138",
"0.623397",
"0.62169415",
"0.61422354",
... | 0.69887507 | 1 |
creates HTML element for a Save To Drafts button that executes based on status of user | function newPostSaveButton(user){
draftButton = document.createElement('button');
draftButton.setAttribute('style','border-radius:10px;border-width:0px; background-color:plum;padding: 15px 32px;');
draftButton.setAttribute('id', 'btnShow2');
draftButton.innerText = 'Save To Drafts';
if(user._id !== undefined... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function saveDraft() {\n showNotification('The draft is saved.');\n draftIsSaved = true;\n}",
"function isSaveAsDraftClicked() {\n return (sessionStorage.getItem(\"saveasdraft\") == \"true\")\n}",
"function onSaveAsDraft() {\n var currentPage = $(\"#EntityFormView > h2\").text();\n if (currentPage.s... | [
"0.6370021",
"0.63562983",
"0.6216201",
"0.60559726",
"0.6023176",
"0.5964716",
"0.5947359",
"0.5916507",
"0.59057647",
"0.5896499",
"0.5881482",
"0.587705",
"0.58491766",
"0.5830152",
"0.57910454",
"0.57417333",
"0.57386124",
"0.5734665",
"0.5706295",
"0.5685784",
"0.5648835... | 0.7442625 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.