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 |
|---|---|---|---|---|---|---|
play audio for example( text to speak) VI author :manh quoc since 15/05/2014 | function playExampleVi(text) {
var audio = new Audio();
audio.src = 'http://www.vnspeak.com/speakit.php?txt=' + text;
audio.play();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function play(text){\n const utterance = new SpeechSynthesisUtterance(text);\n utterance.rate = 1;\n utterance.pitch = 1;\n speechSynthesis.speak(utterance);\n}",
"function speak(text){\n //micInstance.stop();\n var params = {\n text: text,\n voice: config.TextToSpeech.voice,\n ... | [
"0.7800973",
"0.7701055",
"0.76497346",
"0.7584689",
"0.7577453",
"0.74940395",
"0.7481287",
"0.7474552",
"0.74637717",
"0.7413998",
"0.7382842",
"0.73822683",
"0.73559296",
"0.7350704",
"0.73222005",
"0.7297825",
"0.72805077",
"0.726676",
"0.7249282",
"0.72331136",
"0.723187... | 0.8273581 | 0 |
Promise.all waits for all fulfillments (or the first rejection). | function All(promiseArray) {
return new Promise(function(resolve,reject) {
var args = Array.prototype.slice.call(promiseArray);
var results = []
if(args.length === 0)
return resolve(results);
var remaining = args.length;
function res(i,val) {
if(val ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function All(promises) {\n return new Promise((resolve, reject) => { // this line is used to return new promise\n let count = promises.length;\n\n function nextPromise() {\n if (--count === 0) resolve('done');\n } // call resolve when all the promises are done\n promises.f... | [
"0.7260185",
"0.70084006",
"0.69186074",
"0.67234796",
"0.6679983",
"0.6603845",
"0.6443431",
"0.6301312",
"0.6289097",
"0.627264",
"0.6238128",
"0.6202523",
"0.61139196",
"0.6094278",
"0.6059812",
"0.6014387",
"0.5986338",
"0.5950519",
"0.5946129",
"0.5946129",
"0.5946129",
... | 0.73166996 | 0 |
Converts the contacts array to a JSON string then Saves the string to localstorage at the key contacts | function saveContacts() {
window.localStorage.setItem("contacts", JSON.stringify(contacts))
drawContacts()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function objectifySavedContacts() {\n var contacts = localStorage.getItem('data');\n\n if (contacts) {\n var objectifiedContacts = contacts.split(';')\n .map(function (cont) {\n return JSON.parse(cont);\n });\n\n return objectifiedContacts;\n } else {\n ... | [
"0.7874502",
"0.785383",
"0.718564",
"0.718564",
"0.7055259",
"0.66296285",
"0.65681624",
"0.656396",
"0.6492313",
"0.6492313",
"0.64775234",
"0.64382607",
"0.6412804",
"0.6327026",
"0.62833315",
"0.6269512",
"0.6267317",
"0.6234663",
"0.62132865",
"0.62116766",
"0.62030566",... | 0.7933733 | 1 |
Toggles the visibility of the AddContact Form | function toggleAddContactForm() {
document.getElementById('new-contact-form').classList.toggle("hidden")
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toggleAddContactForm() {\n let root = document.documentElement;\n\n let newContact = document.getElementById(\"new-contact-form\")\n let plusMinus = document.getElementById(\"plus-minus\")\n\n if (contactAdd) {\n contactAdd = false\n\n newContact.classList.add(\"hidden\")\n plusMinus.classLis... | [
"0.7425844",
"0.73780584",
"0.73464274",
"0.71892333",
"0.7073225",
"0.69898903",
"0.69515646",
"0.69515646",
"0.6882336",
"0.68518496",
"0.6841175",
"0.6796149",
"0.6783407",
"0.6753915",
"0.6747339",
"0.67363393",
"0.6732894",
"0.67059624",
"0.6691466",
"0.669002",
"0.66834... | 0.8115395 | 1 |
Hides the join room box when the user successfully joins a room | function HideJoinRoom(){
document.getElementById('join-room').style.display="none";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function join_room_pop() {\n join_room.css(\"display\", \"block\");\n }",
"function func_join_room_pop() {\n join_room.css(\"display\", \"block\");\n}",
"function joinUserRoom(name) {\r\n divHome.hide();\r\n divRoom.show();\r\n socket.emit(\"joinRoom\", name);\r\n currentRoom = name;\r\n}",
"fun... | [
"0.73671794",
"0.711415",
"0.7018985",
"0.7014223",
"0.6890914",
"0.67102593",
"0.657768",
"0.64558214",
"0.64250296",
"0.63839626",
"0.63670045",
"0.6249279",
"0.62368983",
"0.6214901",
"0.6105152",
"0.5992302",
"0.59902316",
"0.5959945",
"0.5956927",
"0.5953859",
"0.5928470... | 0.74466616 | 0 |
If there is an error during joining a room display the error message | function setJoinError(error) {
var errorMessage = document.getElementById("join-error-message");
errorMessage.innerHTML = error;
errorMessage.style.display = "block";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handleJoinRoom(room_name){\n clearErrors();\n socket.emit(\"join_room\", room_name);\n }",
"function authenticateJoin(username,room){\n if(!Rooms.checkRoom(room)){\n return 'room doesn\\'t exist';\n }\n else if(Rooms.checkPlayerCount(room)>7){\n return 'room full'... | [
"0.67747873",
"0.6403214",
"0.6387755",
"0.6316273",
"0.6233587",
"0.6143143",
"0.6020871",
"0.5988205",
"0.59799033",
"0.5979633",
"0.596777",
"0.59042066",
"0.5834663",
"0.5832642",
"0.57825625",
"0.5730718",
"0.57248497",
"0.5722479",
"0.57219696",
"0.5720209",
"0.57074535... | 0.6417398 | 1 |
Validate the proper flags are passed in. | validateFlags (flags) {
// Exit if wallet not specified.
const name = flags.name
if (!name || name === '') {
throw new Error('You must specify a wallet with the -n flag.')
}
const avax = flags.avax
if (isNaN(Number(avax))) {
throw new Error('You must specify a quantity in AVAX with ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"validateFlags (flags) {\n // console.log(`flags: ${JSON.stringify(flags, null, 2)}`)\n\n // Exit if wallet not specified.\n const name = flags.name\n if (!name || name === '') {\n throw new Error('You must specify a wallet with the -n flag.')\n }\n\n const qty = flags.qty\n if (isNaN(Numb... | [
"0.7580194",
"0.68912417",
"0.6631517",
"0.6447321",
"0.6212512",
"0.6022667",
"0.5986614",
"0.58006656",
"0.5790068",
"0.5762083",
"0.57354116",
"0.5709845",
"0.5624311",
"0.5568451",
"0.55644643",
"0.5514563",
"0.551083",
"0.55020386",
"0.5495023",
"0.5488235",
"0.54589206"... | 0.7224797 | 1 |
Selects a UTXO from an array of UTXOs based on this optimization criteria: 1. The UTXO must be larger than or equal to the amount of AVAX to send. 2. The UTXO should be as close to the amount of AVAX as possible. i.e. as small as possible Returns a single UTXO object. | async selectUTXO (avax, utxos, isnAvax = false) {
let candidateUTXO = {}
const avaxBuffer = await this.xchain.getAVAXAssetID()
const assetDetail = await this.xchain.getAssetDescription(avaxBuffer)
const txFee = await this.xchain.getTxFee()
// 1 nAVAX is equal to 0.000000001 AVAX
let navax = ava... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getUTXO(fromAddress) {\n let utxos = []\n for(const block of this.chain) {\n for(const tx of block.transactions){\n // get all output tx\n for (let i=0; i<tx.txOut.length;i++) {\n if (tx.txOut[i].toAddress == fromAddress) {\n ... | [
"0.6049517",
"0.5976764",
"0.58927256",
"0.55318934",
"0.50106394",
"0.49723512",
"0.4892732",
"0.48218334",
"0.47638175",
"0.47315502",
"0.4613066",
"0.4458016",
"0.44563848",
"0.4439036",
"0.44355077",
"0.44121075",
"0.4404022",
"0.43973127",
"0.43871105",
"0.43833047",
"0.... | 0.6444737 | 0 |
Function created to storeCities. | function storeCities(){
localStorage.setItem("savedCity", JSON.stringify(savedCity));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function storeCities() {\n localStorage.setItem(\"cities\", JSON.stringify(cities));\n }",
"function storeCities(){\n localStorage.setItem(\"cities\", JSON.stringify(citiesArray));\n }",
"function savCities() {\n localStorage.setItem(\"saveCity\", JSON.stringify(cities));\n }",
... | [
"0.7364514",
"0.727036",
"0.7249595",
"0.7217401",
"0.7169838",
"0.7124404",
"0.71230304",
"0.70661855",
"0.70453733",
"0.70103073",
"0.6864415",
"0.67993104",
"0.6799254",
"0.66988915",
"0.667225",
"0.6649938",
"0.6637085",
"0.66249996",
"0.65786314",
"0.65729344",
"0.656227... | 0.7499474 | 0 |
currentDay function runs with the giving city from where the function is called, and with the createButton boolean true or false. | function currentDay(inputCity, createButton){
// Variable that holds the API url along with variables key, unit and inputed city from user.
const queryURL = "https://api.openweathermap.org/data/2.5/weather?appid=" + APIKey + imperialUnit + "&q=" + inputCity;
// AJAX call for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function city() {\n let cityName = $(this).text();\n currentWeather(cityName);\n get5Day(cityName);\n}",
"function dayButtonClicked() {\n if (night == false) {\n night = true;\n nightIn();\n return;\n }\n if (night == true) {\n night = false;\n dayIn();\n return;\n }\n}",
"function onC... | [
"0.68691313",
"0.67805153",
"0.6557033",
"0.6453229",
"0.63967985",
"0.6370309",
"0.6354954",
"0.6277295",
"0.6245603",
"0.61781263",
"0.6158528",
"0.61158",
"0.6094348",
"0.6089973",
"0.6075558",
"0.6040204",
"0.60292065",
"0.60158986",
"0.59915924",
"0.59398204",
"0.5932253... | 0.76257956 | 0 |
Function that creates a new button with the city name searched by the user. | function createBtn(){
// Remove existing buttons with the city name.
$(".cityBtn").remove();
// Create new button for each element inside the savedCity array.
savedCity.forEach(cn => {
// console.log(cn);
// Create a new butto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createcitybtn(city) {\n var citybutton = $(\"<button>\").addClass(\"citybutton button\");\n citybutton.text(city);\n $(\"#citylist\").append(citybutton);\n $(\"#citylist\").append(\"<br />\");\n}",
"function recentSearch() {\n var cityName = $(\"#search\").val().trim();\n var button = $(\"<but... | [
"0.78553957",
"0.7825736",
"0.763286",
"0.75950134",
"0.75568724",
"0.7497093",
"0.7391449",
"0.7385075",
"0.73447865",
"0.7334902",
"0.7242455",
"0.7230919",
"0.72066313",
"0.716309",
"0.70412064",
"0.7033622",
"0.7025236",
"0.699126",
"0.6982093",
"0.6968694",
"0.69606197",... | 0.7926703 | 0 |
Starts all requests that do not exceed request limits This method is invoked whenever a new request has been queued or a running request finished | function startAllAllowedRequests() {
for (let i = 0; i < waiting_tasks.length; i++) {
if (canStartRequest(waiting_tasks[i].hostname)) {
onRequestStart(waiting_tasks[i].hostname);
waiting_tasks[i].start();
// remove request from waiting requests list and update loop index
waiting_ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_issueNewRequestsAsync() {\n this._deferredUpdate = null;\n\n const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);\n\n if (freeSlots === 0) {\n return;\n }\n\n this._updateAllRequests();\n\n // Resolve pending promises for the top-priority requests\n for (let i... | [
"0.6628981",
"0.6625322",
"0.658616",
"0.6573614",
"0.6563562",
"0.65359145",
"0.6399605",
"0.63529646",
"0.6351921",
"0.6289156",
"0.62717116",
"0.62717116",
"0.61580175",
"0.6135651",
"0.6084854",
"0.60447055",
"0.60442245",
"0.6014789",
"0.5995843",
"0.59860396",
"0.598074... | 0.7608277 | 0 |
clear the flashing page title | function clearFlash() {
if (timeout) {
clearTimeout(timeout);
timeout = undefined;
}
document.title = original;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function clearTitle() {\n $('title').html(\"Blacksmith\");\n}",
"function titleClear(){\n document.querySelector(\".title\").style.display = \"none\";\n document.querySelector(\".line\").style.display = \"none\";\n document.querySelector(\".intro\").style.display = \"none\";\n docume... | [
"0.79916203",
"0.76807255",
"0.7311639",
"0.6959074",
"0.6955087",
"0.6925484",
"0.68691003",
"0.68407184",
"0.68332314",
"0.6786957",
"0.6736297",
"0.6689621",
"0.6628867",
"0.6573916",
"0.65599525",
"0.6555257",
"0.65461123",
"0.6541896",
"0.65411365",
"0.64804876",
"0.6468... | 0.8067197 | 0 |
FUNCTIONS// /////////// Afficher l'image du teddy. | function displayImageTeddy(teddy) {
let img = document.querySelector('#teddyImg')
img.setAttribute("src", `${teddy.image}`)
img.setAttribute("data-id", `${teddy._id}`)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function modifiedImgBack(image){\n image.src = image.id + '.jpg';\n }",
"function changeImageLeavesBack() {\n document.images['white-duck-leaves'].src ='./assets/images/white-duck-leaves.png'\n }",
"function changeImageMonocleBack() {\n document.images['white-duck-monocle'].src ='./assets/images/whit... | [
"0.71838117",
"0.6633162",
"0.660354",
"0.6599721",
"0.6592838",
"0.6565422",
"0.6547703",
"0.65361184",
"0.6443637",
"0.6437124",
"0.64339244",
"0.641671",
"0.64162356",
"0.63826543",
"0.6374062",
"0.6373162",
"0.63620394",
"0.63503903",
"0.6348611",
"0.63473195",
"0.6339134... | 0.75115514 | 0 |
Hides the weather filter container and displays all of the recipes in a grid format | function display_selected_recipes() {
document.querySelector('#weather-filter-container').style.display = 'none';
document.querySelector('#select-filters').style.display = 'block';
document.querySelector('#recipes-title').style.display = 'block';
document.querySelector('#grid-container').style.display =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function displayIngrList() { /*to show the all ingredient list*/\n loadFilteredIngr();\n document.getElementById(\"suggIngr\").style.display = \"flex\"; /*flex to allow suggIngr to appear in column*/\n document.querySelector(\"#ingrFilter .fa-chevron-up\").style.display = \"block\";\n document.querySel... | [
"0.6289912",
"0.62474346",
"0.61873883",
"0.61683863",
"0.60603213",
"0.60547364",
"0.6029845",
"0.6022186",
"0.59941155",
"0.5990943",
"0.5966412",
"0.5952374",
"0.5940943",
"0.58968645",
"0.5891171",
"0.5885731",
"0.58802897",
"0.5872718",
"0.58692014",
"0.5861815",
"0.5840... | 0.75827295 | 0 |
Displays all recipes for all kinds of weather if the user presses the 'View All' button | function display_all(recipes) {
recipes.forEach(recipe => {
recipe['weather'] = true;
});
display_selected_recipes();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function display_selected_recipes() {\n document.querySelector('#weather-filter-container').style.display = 'none';\n document.querySelector('#select-filters').style.display = 'block';\n document.querySelector('#recipes-title').style.display = 'block';\n document.querySelector('#grid-container').style.... | [
"0.7695121",
"0.67280036",
"0.6695334",
"0.6673275",
"0.65193284",
"0.64262086",
"0.63547933",
"0.6335299",
"0.6321468",
"0.6240727",
"0.61586416",
"0.6144569",
"0.613548",
"0.6102514",
"0.6085036",
"0.60047305",
"0.5994358",
"0.5990088",
"0.59569544",
"0.5951428",
"0.5897981... | 0.7840708 | 0 |
Selects the correct recipes for that kind of weather | function select_by_weather(recipes) {
recipes.forEach(recipe => {
recipe['weather'] = false;
});
let selectedChoices = findIfFilters("weather");
if (selectedChoices.length === 0) {
document.querySelector('#no-filter-chosen').style.display = 'block';
} else {
filter("weather",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function display_selected_recipes() {\n document.querySelector('#weather-filter-container').style.display = 'none';\n document.querySelector('#select-filters').style.display = 'block';\n document.querySelector('#recipes-title').style.display = 'block';\n document.querySelector('#grid-container').style.... | [
"0.6771611",
"0.6606252",
"0.6393852",
"0.63582134",
"0.6188069",
"0.5998609",
"0.59640473",
"0.5918877",
"0.5855814",
"0.58337325",
"0.57372856",
"0.57350427",
"0.57020134",
"0.5688214",
"0.56846714",
"0.56714064",
"0.5651607",
"0.56362104",
"0.56162107",
"0.55725336",
"0.55... | 0.77564096 | 0 |
Updates all the filter properties of all the recipe objects in window.recipes depending on the filters chosen by the user, so that the recipes can be selected based on these and either hidden or displayed | function filter(filter_type, choices) {
window.recipes.forEach(recipe => {
if (choices.length === 0) {
recipe[`${filter_type}`] = true;
}
if (filter_type === 'weather') {
let recipeProperties = recipe.getElementsByTagName('ul')[0].children;
for (let i = 0;... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function display_all(recipes) {\n recipes.forEach(recipe => {\n recipe['weather'] = true;\n });\n display_selected_recipes();\n}",
"function display_selected_recipes() {\n document.querySelector('#weather-filter-container').style.display = 'none';\n document.querySelector('#select-filters')... | [
"0.6702223",
"0.67011803",
"0.65662676",
"0.6565148",
"0.637609",
"0.6240561",
"0.6228511",
"0.6197171",
"0.61527103",
"0.6106958",
"0.6099209",
"0.6076114",
"0.6076114",
"0.6076114",
"0.6076114",
"0.6076114",
"0.6076114",
"0.6076114",
"0.6076114",
"0.6076114",
"0.60743695",
... | 0.6978485 | 0 |
This function searches for anaphores in the text and forms an array with them. | function getAnaphoraCount() {
text = workarea.textContent;
anaphora_candidates = [];
first_index = 0;
last_index = 0;
for(i=0; i < sentences.length-1; i++) {
if(sentences[i] == "`I must.") debugger;
first_word = sentences[i].match(/\S+/)[0];
check_higher_case = first_word.match(/[A-ZА-ЯЁ]/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function anagram(arrs) {\n var result = [];\n arrs.forEach((arr) => {\n // char to remove space from array\n var char = arr.replace(/\\s/g, '');\n var word = char.split('').sort().join(''); // eopr\n\n //check whether the object has the specified property\n if (!result.hasO... | [
"0.5588051",
"0.53818357",
"0.5325225",
"0.5282684",
"0.50899565",
"0.5088381",
"0.5072979",
"0.5035645",
"0.5030829",
"0.50273424",
"0.5017766",
"0.5016493",
"0.49978402",
"0.49876705",
"0.49868843",
"0.49556953",
"0.49533612",
"0.4944792",
"0.4932088",
"0.49320322",
"0.4931... | 0.6046376 | 0 |
This function searches for epiphoras in the text and forms an array with them. | function getEpiphoraCount() {
text = workarea.textContent;
epiphora_candidates = [];
first_index = 0;
last_index = 0;
for(i=0; i < sentences.length-1; i++) {
if(sentences[i].match(/\S+$/) == null) {
last_word = sentences[i].match(/\S+\s$/)[0];
}
else {
last_word = sentenc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function text_to_array(text, array)\n{\n\tvar array = array || [], i = 0, l;\n\tfor (l = text.length % 8; i < l; ++i)\n\t\tarray.push(text.charCodeAt(i) & 0xff);\n\tfor (l = text.length; i < l;)\n\t\t// Unfortunately unless text is cast to a String object there is no shortcut for charCodeAt,\n\t\t// and if text is... | [
"0.58446383",
"0.5692288",
"0.5643362",
"0.5239981",
"0.5211952",
"0.52095336",
"0.51864654",
"0.5185215",
"0.5150428",
"0.51325995",
"0.5126138",
"0.5120027",
"0.51147413",
"0.5112623",
"0.51062834",
"0.5054987",
"0.50448465",
"0.50188386",
"0.50021935",
"0.4973537",
"0.4964... | 0.638656 | 0 |
Logging out just requires removing the user's id_token and profile | function logout() {
deferredProfile = $q.defer();
localStorage.removeItem('id_token');
localStorage.removeItem('profile');
authManager.unauthenticate();
userProfile = null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function logout() {\n deferredProfile = $q.defer();\n localStorage.removeItem('id_token');\n localStorage.removeItem('profile');\n authManager.unauthenticate();\n userProfile = null;\n $state.go('login');\n }",
"function logOut() {\n localStorage.removeItem('idToken');\n localS... | [
"0.8138171",
"0.7940114",
"0.7839028",
"0.77994376",
"0.7772085",
"0.77600163",
"0.7719196",
"0.7713605",
"0.77088034",
"0.76964545",
"0.7678932",
"0.76670045",
"0.7623212",
"0.76101196",
"0.76044714",
"0.7587714",
"0.75530845",
"0.75442195",
"0.7542217",
"0.7535465",
"0.7534... | 0.80604535 | 1 |
BAD SESSION KILLER For cases when shop tries to reinstall us. ref to solution hack: | async function badSessionKillerReInstall(ctx, _next) {
if (ctx.request.header.cookie) {
if (
(ctx.request.url.split('?')[0] === '/' &&
ctx.request.querystring.split('&') &&
ctx.request.querystring.split('&')[0].split('=')[0] === 'hmac' &&
ctx.request.querystring.split('&')[1].split('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function badSessionKillerRedirect(ctx, next) {\n const { shop: shopOrigin } = ctx.session;\n\n const queryData = url.parse(ctx.request.url, true);\n const requestPath = ctx.request.url;\n if (\n shopOrigin &&\n queryData.query.shop &&\n shopOrigin !== queryData.query.shop\n ) {\n if (!reques... | [
"0.67468977",
"0.66138935",
"0.59475714",
"0.57612824",
"0.5756241",
"0.56617385",
"0.5651538",
"0.56376326",
"0.5597882",
"0.5528068",
"0.5514786",
"0.54664284",
"0.54555815",
"0.54440224",
"0.5432712",
"0.54175544",
"0.54167455",
"0.54066914",
"0.5403808",
"0.5399567",
"0.5... | 0.74862444 | 0 |
BAD SESSION KILLER Case there's a bad session kill it and redirect to auth flow | async function badSessionKillerRedirect(ctx, next) {
const { shop: shopOrigin } = ctx.session;
const queryData = url.parse(ctx.request.url, true);
const requestPath = ctx.request.url;
if (
shopOrigin &&
queryData.query.shop &&
shopOrigin !== queryData.query.shop
) {
if (!requestPath.match(/^\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function badSessionKillerReInstall(ctx, _next) {\n if (ctx.request.header.cookie) {\n if (\n (ctx.request.url.split('?')[0] === '/' &&\n ctx.request.querystring.split('&') &&\n ctx.request.querystring.split('&')[0].split('=')[0] === 'hmac' &&\n ctx.request.querystring.split('&')... | [
"0.64195216",
"0.6397031",
"0.6393355",
"0.631766",
"0.6306464",
"0.626547",
"0.6236522",
"0.62076956",
"0.6199399",
"0.61959356",
"0.614851",
"0.6135205",
"0.61322796",
"0.6127965",
"0.61026806",
"0.60913616",
"0.6071165",
"0.60692495",
"0.60609317",
"0.6057303",
"0.60517454... | 0.77617174 | 0 |
Removes the physics body colliders from the sprite but not overlap sensors. | removeColliders() {
this._collides = {};
this._colliding = {};
this._collided = {};
this._removeFixtures(false);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"onRemoveFromWorld() {\n //game.physicsEngine.world.removeBody(this.physicsObj);\n }",
"function removeOutOfBoundObj() {\n gameState.enemies.getChildren().forEach(enemy => {\n if (enemy.x > config.width + HALF_OBJ_PIXEL || enemy.x < -HALF_OBJ_PIXEL) {\n gameState.enemies.remove(enem... | [
"0.64641505",
"0.63221043",
"0.6303872",
"0.6266476",
"0.62528527",
"0.61161864",
"0.6047687",
"0.6042808",
"0.5715037",
"0.5688946",
"0.56785524",
"0.5659047",
"0.5656989",
"0.5647188",
"0.56171954",
"0.5594845",
"0.55844414",
"0.55761814",
"0.555861",
"0.55491245",
"0.55395... | 0.7001257 | 0 |
Removes overlap sensors from the sprite. | removeSensors() {
this._overlap = {};
this._overlaps = {};
this._overlapping = {};
this._overlapped = {};
this._removeFixtures(true);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function removeOutOfBoundObj() {\n gameState.enemies.getChildren().forEach(enemy => {\n if (enemy.x > config.width + HALF_OBJ_PIXEL || enemy.x < -HALF_OBJ_PIXEL) {\n gameState.enemies.remove(enemy);\n }\n });\n gameState.platformsEven.getChildren().forEach(platform => {\n i... | [
"0.63742995",
"0.5886565",
"0.58457756",
"0.56442356",
"0.5600117",
"0.5546436",
"0.5516453",
"0.5513831",
"0.55122197",
"0.5511275",
"0.55017287",
"0.5484007",
"0.54440993",
"0.5440689",
"0.54392076",
"0.5438434",
"0.54377514",
"0.54259807",
"0.542194",
"0.54074645",
"0.5404... | 0.7171138 | 0 |
Returns the first node in a linked list of the planck physics body's fixtures. | get fixture() {
return this.fixtureList;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get fixtureList() {\r\n\t\t\tif (!this.body) return null;\r\n\t\t\treturn this.body.getFixtureList();\r\n\t\t}",
"first(returnNode) {\n let node = this[this._start][this._next];\n return returnNode ? node : node.data;\n }",
"getFirst () {\n\t\treturn this.head;\n\t}",
"getFirst () {\n\t\tret... | [
"0.566847",
"0.5550254",
"0.5545852",
"0.5545852",
"0.5545852",
"0.5455136",
"0.53845984",
"0.53845984",
"0.52773535",
"0.5271643",
"0.5260438",
"0.5231135",
"0.51783586",
"0.5177588",
"0.5154129",
"0.51494235",
"0.5114569",
"0.51121306",
"0.50545233",
"0.4988757",
"0.4954843... | 0.5673129 | 0 |
Returns the first node in a linked list of the planck physics body's fixtures. | get fixtureList() {
if (!this.body) return null;
return this.body.getFixtureList();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get fixture() {\r\n\t\t\treturn this.fixtureList;\r\n\t\t}",
"first(returnNode) {\n let node = this[this._start][this._next];\n return returnNode ? node : node.data;\n }",
"getFirst () {\n\t\treturn this.head;\n\t}",
"getFirst () {\n\t\treturn this.head;\n\t}",
"getFirst () {\n\t\treturn t... | [
"0.5670101",
"0.55511737",
"0.5548006",
"0.5548006",
"0.5548006",
"0.54578245",
"0.5386264",
"0.5386264",
"0.52783704",
"0.5273938",
"0.52637506",
"0.5232764",
"0.5180677",
"0.5178833",
"0.5155045",
"0.5152204",
"0.51153433",
"0.51133215",
"0.50559485",
"0.49911925",
"0.49553... | 0.56664073 | 1 |
Draws a fixture. Used to draw the sprite's physics body. | _drawFixture(fxt) {
const sh = fxt.m_shape;
if (sh.m_type == 'polygon' || sh.m_type == 'chain') {
if (sh.m_type == 'chain') {
this.p.push();
this.p.noFill();
}
let v = sh.m_vertices;
this.p.beginShape();
for (let i = 0; i < v.length; i++) {
this.p.vertex(v[i].x * plSca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"draw() {\n let sprite = this.sprite;\n if (sprite == null)\n return;\n ctx.drawImage(sprite.sprite, sprite.animationFrame * sprite.width, 0, sprite.width, sprite.height, this.rect.x + sprite.xOffset, this.rect.y + sprite.yOffset, this.rect.width * sprite.xStretch, this.rect.height *... | [
"0.5845516",
"0.5777772",
"0.5775472",
"0.57509124",
"0.5714409",
"0.5713729",
"0.5693236",
"0.5692172",
"0.56509733",
"0.56364477",
"0.5627966",
"0.5584947",
"0.55848265",
"0.5582253",
"0.5577812",
"0.55737764",
"0.55628854",
"0.55615073",
"0.5527821",
"0.5527139",
"0.552402... | 0.71356446 | 0 |
Plays the animation, starting from the specified frame. | play(frame) {
this.playing = true;
if (frame !== undefined) this.frame = frame;
this.targetFrame = -1;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"play() {\n this.frame = window.requestAnimationFrame(()=>this.firstFrame());\n }",
"animate_start(frame) {\r\n this.sprite.animate = true;\r\n }",
"function playAnimation(sequenceArray) {\n\n //Reset any possible previous animations\n reset();\n\n //Figure out how many frames... | [
"0.74509704",
"0.7062324",
"0.69954747",
"0.68558973",
"0.6678242",
"0.663272",
"0.6590897",
"0.6588616",
"0.6556551",
"0.64773655",
"0.64632434",
"0.6458551",
"0.6437455",
"0.64117974",
"0.63575435",
"0.63106775",
"0.62889117",
"0.6288061",
"0.6278835",
"0.6277658",
"0.62776... | 0.72535974 | 1 |
Goes to the previous frame and stops. | previousFrame() {
if (this.frame > 0) this.frame = this.frame - 1;
else if (this.looping) this.frame = this.length - 1;
this.targetFrame = -1;
this.playing = false;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"gotoPrevFrame() {\n var prevFramePlayheadPosition = this.playheadPosition - 1;\n\n if (prevFramePlayheadPosition <= 0) {\n prevFramePlayheadPosition = this.length;\n }\n\n this.gotoFrame(prevFramePlayheadPosition);\n }",
"previousFrame() {\n\t\t\t\tif (this.frame > 0) this.frame = this.frame - ... | [
"0.7906292",
"0.7812864",
"0.7554695",
"0.74963164",
"0.74026585",
"0.7373975",
"0.73246425",
"0.73246425",
"0.72755533",
"0.7262534",
"0.7188262",
"0.70223796",
"0.69566983",
"0.692452",
"0.69226867",
"0.6881791",
"0.68798035",
"0.68631",
"0.6861956",
"0.6858386",
"0.6824034... | 0.79477596 | 0 |
Button method close sheet without saving. | closeWithoutSaving() {
const sheetName = this.get('closeSheetName')
this.get('fdSheetService').rollbackCurrentItem(sheetName);
this.confirmClose(sheetName);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"closeWithSaving() {\n const sheetName = this.get('closeSheetName')\n this.get('fdSheetService').saveCurrentItem(sheetName, true);\n }",
"function onClose() {\n if (!isActionSheetOpen.current) {\n Navigation.dismissOverlay(componentId);\n }\n }",
"function onClose() {\n if (!isActionSheetO... | [
"0.7764902",
"0.6784473",
"0.6784473",
"0.653303",
"0.63223547",
"0.63204664",
"0.6280046",
"0.62722516",
"0.6242167",
"0.62165785",
"0.61930865",
"0.61598074",
"0.6143568",
"0.61163086",
"0.60978764",
"0.6096772",
"0.6096772",
"0.6096772",
"0.6043881",
"0.60309917",
"0.59986... | 0.7401484 | 1 |
Button method save and close sheet. | closeWithSaving() {
const sheetName = this.get('closeSheetName')
this.get('fdSheetService').saveCurrentItem(sheetName, true);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"closeWithoutSaving() {\n const sheetName = this.get('closeSheetName')\n this.get('fdSheetService').rollbackCurrentItem(sheetName);\n this.confirmClose(sheetName);\n }",
"function save ()\n {\n $uibModalInstance.close(vm.item);\n }",
"function saveAndExit() {\n ... | [
"0.658167",
"0.652474",
"0.62201965",
"0.6186926",
"0.6125711",
"0.6085243",
"0.60583186",
"0.6017914",
"0.60128427",
"0.6012832",
"0.59898955",
"0.59464777",
"0.59022284",
"0.5885294",
"0.58716226",
"0.58231175",
"0.5816282",
"0.5790984",
"0.5676336",
"0.5676336",
"0.5667803... | 0.7764474 | 0 |
Returns a random phrase from the phrases array | getRandomPhrase () {
const phrases = this.phrases;
const randIndex = Math.floor(Math.random() * phrases.length);
return phrases[randIndex];
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getRandomPhrase() {\n const phrase = phrases[Math.floor(Math.random() * phrases.length)];\n return phrase;\n}",
"function getRandomPhraseAsArray(arr) {\n let pick = Math.floor(Math.random() * arr.length);\n return phrases[pick];\n}",
"getRandomPhrase() {\n const randomNumber = Math.floor(Ma... | [
"0.8513017",
"0.8383263",
"0.8343142",
"0.8343142",
"0.8343142",
"0.8326532",
"0.83141935",
"0.83011556",
"0.8273669",
"0.8270718",
"0.82391804",
"0.82370436",
"0.82281893",
"0.81543237",
"0.81147563",
"0.8100584",
"0.8100584",
"0.8094644",
"0.8080133",
"0.8065723",
"0.804620... | 0.84569424 | 1 |
classNuToText converts enum to class label. | function classNumToText (props){
const {colIndex, rowIndex,grid} = props;
let num = grid[colIndex][rowIndex];
switch (num){
case 1:
return "black";
case 2:
return "red";
case 11:
return "black wins";
case 12:
return "red wins";
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function _makeLabel (n) {\n if (Array.isArray(n)) return _arrayToVec(n);\n if (typeof n === 'object') return 'fa_' + (n._id);\n else return n.toFixed(6);\n}",
"static labelOf(t) {\n const label= !t.desc ? Filters.titlecase(t.name.replace(/[-_]/g, ' ')) /* friendlyish name */ :\n (typeof t.d... | [
"0.6098353",
"0.58898973",
"0.5831838",
"0.5758314",
"0.57263845",
"0.5697312",
"0.56697494",
"0.56542087",
"0.55759615",
"0.5569282",
"0.5538657",
"0.5526886",
"0.55071956",
"0.5488564",
"0.54478127",
"0.543742",
"0.5306785",
"0.5294057",
"0.5286106",
"0.527915",
"0.52445894... | 0.61397135 | 0 |
Se carga la lista de departamentos y municipios | async function obtenerDepartamentos() {
try {
let response = await axios.get(URL_departamentos)
let data = response.data.items
let result = []
// Opcion por defecto
result.push(<option value={0} key={0}>Seleccione una Opción</option>)
for (let index in dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDepartamentosDropdown() {\n $http.post(\"Departamentos/getDepartamentosTotal\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaDepartamentos.data = r.data.d.data;\n \n }\n })\n }",
"function cargar_municipios(datos_muni... | [
"0.6734986",
"0.66602004",
"0.653661",
"0.64129394",
"0.63565135",
"0.63446254",
"0.62949705",
"0.62602603",
"0.6212332",
"0.6197748",
"0.6147786",
"0.6145449",
"0.6130968",
"0.6126239",
"0.60202247",
"0.60123444",
"0.60041565",
"0.59630895",
"0.5961104",
"0.5932889",
"0.5875... | 0.73978484 | 0 |
Funcion para consultar en base de datos los nombres y apellidos a partir del numero de documento | async function obtenerNombreCompleto() {
// Se valida si se ha diligenciado el campo documento
if (watch('documento') !== ''){
try {
let URL = URL_nombre_completo
URL += watch('documento')
let response = await axios.get(URL)
let result = await response.data
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function remplirLesDonnees(data) {\n lesDocuments = data.lesDocuments;\n for (const documents of lesDocuments){\n afficherDocument(documents)\n }\n}",
"function buscarModulos(busqueda, regex) {\n\n return new Promise((resolve, reject) => {\n\n Modulo.find({}, 'nombre tipo estado usuario... | [
"0.5559556",
"0.5538495",
"0.553293",
"0.5397457",
"0.53570396",
"0.53490955",
"0.5326134",
"0.5321139",
"0.52882993",
"0.5284173",
"0.5243029",
"0.5240028",
"0.52252537",
"0.5212058",
"0.5206271",
"0.51986694",
"0.5192781",
"0.51623863",
"0.515546",
"0.5148614",
"0.5133019",... | 0.5905101 | 0 |
Recalcular listado de municipios con base al departamento seleccionado | async function recalcularMunicipios() {
try {
let URL = URL_municipios
URL += watch('departamento')
let response = await axios.get(URL)
let data = await response.data.items
let result = []
// Opcion por defecto
result.push(<option value={0} key={0}>Se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function obtenerDepartamentos() {\n try {\n let response = await axios.get(URL_departamentos)\n let data = response.data.items\n let result = []\n\n // Opcion por defecto\n result.push(<option value={0} key={0}>Seleccione una Opción</option>)\n \n for (le... | [
"0.6432732",
"0.6351011",
"0.6192081",
"0.61283785",
"0.6064947",
"0.59984577",
"0.5974175",
"0.59726495",
"0.59365463",
"0.5886678",
"0.5739219",
"0.5719336",
"0.5697672",
"0.56490976",
"0.5633712",
"0.56298995",
"0.56070954",
"0.55704844",
"0.55566484",
"0.5547164",
"0.5543... | 0.6978294 | 0 |
Agregar una persona a cargo en el datagrid de personas a cargo | function agregar() {
// Máximo pueden haber 4 personas a cargo
if (props.personasaCargo.length < 4){
let result = [...props.personasaCargo];
result.push([,"", "",])
cambiarPersonasaCargo(result);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"agregarPersonajes(personaje) {\n this.personajes.push(personaje);\n }",
"addPerson() {\n this.people.pushObject(this.personName);\n }",
"agregarPersona(id, nombre, sala) {\n\n let persona = { id, nombre, sala }\n\n //agregar la \"persona\" recibida al arreglo de personas\n ... | [
"0.64950323",
"0.6444278",
"0.6369781",
"0.62349975",
"0.6185863",
"0.60871744",
"0.6008432",
"0.59491014",
"0.5875018",
"0.58600676",
"0.58280057",
"0.57749724",
"0.5760148",
"0.5731279",
"0.5717448",
"0.5698203",
"0.5675311",
"0.56695163",
"0.5601724",
"0.55939764",
"0.5592... | 0.6652078 | 0 |
notify parent that tween has ended | tweenHasEnded (characterUID) {
// console.warn(`tweenHasEnded HAPPY GO LUCKY ${characterUID}`);
if (this.props.onTweenFinish) {
this.props.onTweenFinish(characterUID);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"notifyAnimationEnd() {}",
"function TweenComplete() {\n tweenSlide.eventComplete(function () {\n // Reset 'style' & 'transform' for slide\n that.ResetTFSlideCss();\n // Update the variable in toggle-end\n that.TOSLIDE.End(... | [
"0.74193245",
"0.6730198",
"0.65552783",
"0.65159416",
"0.64879155",
"0.6447675",
"0.6397675",
"0.6158307",
"0.6116692",
"0.6091322",
"0.60566294",
"0.5942789",
"0.5925302",
"0.5907035",
"0.58980256",
"0.58743864",
"0.58632576",
"0.58577156",
"0.5826781",
"0.5821376",
"0.5793... | 0.67982423 | 1 |
Interacts with smart contract to buy PCT | async function buyPCT() {
// Converts integer as Eth to Wei,
let amount = await ethers.utils.parseEther(transAmount.toString());
try {
await erc20.buyToken(transAmount, { value: amount });
// Listens for event on blockchain
await erc20.on("PCTBuyEvent", (from, to, amount) => {
setPendingFrom(from.toS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async approveCompound(){\n let spender = Compound.util.getAddress(Compound.cDAI, process.env.ETH_NETWORK);\n //spender = '0xF0d0EB522cfa50B716B3b1604C4F0fA6f04376AD'; //cDAI\n console.log('spender: ' + spender);\n let param = cDAI.methods().approve.call({ spender: spender, amount: '3000... | [
"0.6989427",
"0.68070185",
"0.6780074",
"0.67103094",
"0.6587158",
"0.6583129",
"0.65667874",
"0.65234774",
"0.65128905",
"0.64936507",
"0.64729595",
"0.6448512",
"0.64294785",
"0.6427884",
"0.6357085",
"0.6284114",
"0.6282304",
"0.6257249",
"0.62560284",
"0.6250145",
"0.6244... | 0.7291198 | 0 |
Interacts with smart contract to sell PCT | async function sellPCT() {
try {
await erc20.sellToken(transAmount);
// Listens for event on blockchain
await erc20.on("PCTSellEvent", (from, to, amount) => {
setPendingFrom(from.toString());
setPendingTo(to.toString());
setPendingAmount(amount.toString());
setIsPending(true);
})
} catch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async instantiate(ctx){\n console.log('************ Pharnet Transporter Smart Contract Instantiated *************');\n\t}",
"async approveCompound(){\n let spender = Compound.util.getAddress(Compound.cDAI, process.env.ETH_NETWORK);\n //spender = '0xF0d0EB522cfa50B716B3b1604C4F0fA6f04376AD'; //c... | [
"0.67187506",
"0.6597626",
"0.6564653",
"0.64804304",
"0.6382265",
"0.6372014",
"0.6367808",
"0.63591576",
"0.63151",
"0.6226985",
"0.6194143",
"0.6170448",
"0.6164739",
"0.61347854",
"0.61236125",
"0.6079861",
"0.6065798",
"0.60639936",
"0.60616034",
"0.6054455",
"0.6020632"... | 0.6857746 | 0 |
get a slice / part of the nodes queued objects for proccessing | function getQueuePart(node, size) {
var context = node.context();
var part = [];
if (size) {
if (context.object_queue.length >= size) {
for (var i = 0; i < size; i++) {
part.push(context.object_queue.shift());
}
} else {
var ql = context.object_queue.length;
for (var i = 0; i < ql; i++) {
par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function get () {\n\t\treturn queue.slice(nowPlaying);\n\t}",
"printQueue(){\n return this.queue.slice(this.front,this.rear+1);\n }",
"dequeue() {\n return this.processes.shift();\n // console.log('dequeu',this.processes[0]);\n }",
"function _sliceBuffer(amount) {\n var newBuff... | [
"0.62579674",
"0.59086746",
"0.58773434",
"0.58189785",
"0.5642547",
"0.5555309",
"0.5540773",
"0.5496877",
"0.5440474",
"0.5435695",
"0.53355855",
"0.5329713",
"0.53250897",
"0.5307996",
"0.5298105",
"0.5287273",
"0.5269881",
"0.52674496",
"0.52665085",
"0.5242574",
"0.52405... | 0.70424706 | 0 |
Scrape the panels at the top of the detail page for meta | function scrapePrimaryPanel (id, node) {
if (!package[id].headerMeta) package[id].headerMeta = {};
node.querySelectorAll('.panel-body .row').forEach(row=>{
const cells = row.querySelectorAll('div');
if (cells && cells.length>=2 ) {
package[id].headerMeta[cells[0].textContent.trim()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function panelMetaData(url){\n\tpanelView = 'metadata';\n\tpanelShow(220, 'meta');\n\t$('panelFrame').src = myPath+'ressource/lib/media.metadata.php?url='+url;\n}",
"function detail_result(json_parse) {\n\n document.getElementsByClassName('panel')[0].className = \"panel panel-default show\"\n document.getElement... | [
"0.57500005",
"0.5688017",
"0.56705713",
"0.562944",
"0.55332774",
"0.5521916",
"0.5467759",
"0.54354507",
"0.54200995",
"0.5387813",
"0.53846747",
"0.5364622",
"0.5349082",
"0.53436196",
"0.53361887",
"0.5308136",
"0.5254317",
"0.5233635",
"0.5202633",
"0.51862097",
"0.51658... | 0.6276835 | 0 |
every detail page has a set of tabs at the lower half, these are dynamically loaded here we take one tab section path, fetch it and scrape the meta from it | function getTabDetail (path,id) {
return limitedFetch(`${domain}${path}${id}`)
.then(res => res.text())
.then(body => {
var promises = []
const tabDom = new JSDOM(body);
tabDom.window.document.querySelectorAll('.panel.panel-default.collapsible')
.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fetchDetails (id) {\n return limitedFetch(`${domain}/item/Details/${id}`)\n .then(res => res.text())\n .then(body => {\n var promises = [];\n const detailDom = new JSDOM(body);\n\n // Get the primary image\n const pImg = detailDom.window.documen... | [
"0.5875801",
"0.57537854",
"0.56964403",
"0.56806237",
"0.56689864",
"0.5655047",
"0.562426",
"0.5557786",
"0.5549782",
"0.5543037",
"0.5510794",
"0.54657274",
"0.5425352",
"0.54248893",
"0.54025745",
"0.54022336",
"0.53904706",
"0.53764397",
"0.53661436",
"0.5364575",
"0.536... | 0.6655011 | 0 |
Exercise: make a superhero function take in 2 callbacks and return a string in each one of the callbacks describing the "superpower" | function superHero(power1, power2, callbackOne, callbackTwo) {
let powers = "my super powers are " + callbackOne(power1) + " and " + callbackTwo(power2);
return powers;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function superHero (name, callbackTwo){\n let hero = \"I am \" + name + \" and one of my powers is I can shoot lasers.\" + \" \";\n let otherSuperhero = callbackTwo();\n\n return hero + otherSuperhero;\n}",
"function greeter(fullname,cb){ //cb-call back function\n var message=cb(fullname);\n cons... | [
"0.7760503",
"0.5938532",
"0.58713496",
"0.5764805",
"0.5701683",
"0.5668318",
"0.5668318",
"0.5668318",
"0.56502336",
"0.5627756",
"0.5584426",
"0.55764854",
"0.5540673",
"0.5514954",
"0.5501167",
"0.5491166",
"0.5480826",
"0.54780596",
"0.54635334",
"0.5459715",
"0.5435841"... | 0.8757035 | 0 |
Compresses sourceDirectoryPath into a tar.gz | compressSourceDirectory(sourceDirectoryPath) {
return __awaiter(this, void 0, void 0, function* () {
const fileName = `${(0, uuid_1.v4)()}.tar.gz`;
console.log('CompressingSourceDirectory', sourceDirectoryPath, fileName);
yield tar.c({
gzip: true,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function gunzip(src){\n fs.createReadStream(src)\n .pipe(zlib.createGunzip())\n .pipe(fs.createWriteStream(path.join(__dirname,path.basename(src,'.gz'))));\n}",
"convertApkToZip (source, target){\n let cond = true;\n fs.rename(source, target, function(err) {\n if(err) {... | [
"0.5825395",
"0.5739603",
"0.5595743",
"0.53256303",
"0.5207444",
"0.5129628",
"0.51209956",
"0.50601107",
"0.5056975",
"0.5041073",
"0.5031814",
"0.50148463",
"0.50113493",
"0.49702588",
"0.49507222",
"0.49234024",
"0.49157044",
"0.4904952",
"0.48901677",
"0.48799825",
"0.48... | 0.8036816 | 0 |
Checks to see if the messenge is from an approved role or is the owner of the guild | function adminCheck(message){
if(message.channel.type != 'text') return;
if(message.guild.ownerID == message.author.id){return true;}
if(message.author.id == '105041932459184128'){return true;}
for( var [id, roles] of message.member.roles){
for (var index = 0; index < adminRoles.length; index++){
if(i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function checkAdminOrOwnerSender(msg){\n\n\tif (msg.author.id == msg.guild.ownerID ||\n\t\tmsg.member.roles.cache.some(role => role.name === \"Admin\") ||\n\t\tmsg.member.roles.cache.some(role => role.name === \"Admin role\") ||\n\t\tmsg.member.roles.cache.some(role => role.name === \"admin\")\n\t\t){\n\t\treturn ... | [
"0.7385408",
"0.6222284",
"0.6173132",
"0.61214364",
"0.6052044",
"0.6045111",
"0.60045683",
"0.60004276",
"0.59831333",
"0.59613657",
"0.57994515",
"0.56773937",
"0.563937",
"0.55982596",
"0.55914575",
"0.55329895",
"0.5532096",
"0.5506311",
"0.5503812",
"0.549643",
"0.54952... | 0.6928503 | 1 |
Load opportunity applications from database | getApplication (opportunityId, personId, forceReload) {
var d = $q.defer();
if(!this.loadedOpportunityApplications[`${opportunityId}-${personId}`] || forceReload === true) {
$http.get(`/api/opportunity_applications/${opportunityId}/${personId}`)
.then(response => {
var applicat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getEmployeeJobApplication(firstname) {\n\treturn Employee.findOne({firstname: firstname})\n\t .populate(\"applications\").exec((err, posts) =>{\n console.log(\"Populated Employee\" + posts)\n }\n\t \n)\n}",
"function loadCurrentApplication() {\n ApplicationsService\n .l... | [
"0.58995456",
"0.5616329",
"0.55552274",
"0.5461304",
"0.5388441",
"0.53872836",
"0.5376514",
"0.53718174",
"0.5323144",
"0.53102446",
"0.5290349",
"0.52407265",
"0.52389294",
"0.522918",
"0.5194129",
"0.5190767",
"0.5157819",
"0.5151134",
"0.5119506",
"0.5103304",
"0.5102935... | 0.5785937 | 1 |
Opens a view with opportunities | open(OpportunityId, OpportunityTitle, forceReload) {
$state.go('opportunities.view', {
OpportunityId: OpportunityId,
PrettyURL: Util.convertToSlug(OpportunityTitle),
forceReload: forceReload || false
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"open( viewName, options ){\n _history.push( this.current );\n _options.push( _currentOptions );\n\n viewport.replace( viewName, options );\n }",
"view(options) {\n return this.wizardInvokeService.openWizard(Object.assign(options, {\n title: this._buildTitle(options.service.entityName,... | [
"0.60245764",
"0.5902084",
"0.588091",
"0.58751684",
"0.58528507",
"0.5825909",
"0.57534933",
"0.5625358",
"0.56178623",
"0.56178623",
"0.55248815",
"0.5524539",
"0.55118287",
"0.5497018",
"0.54535663",
"0.5450773",
"0.54503196",
"0.542854",
"0.54111236",
"0.53768754",
"0.537... | 0.67139226 | 0 |
getting boundbox values for WheelMaps API and converting to proper format (bbox=west,south,east,north) as comma separated float numbers wich are longitude, latitude values in degrees. runs whenever the map is moved and calls getWheelMapNodes function with new bounds | function findBoundaries() {
google.maps.event.addListener(map, 'bounds_changed', function() {
const bounds = map.getBounds();
const NE = bounds.getNorthEast();
const SW = bounds.getSouthWest();
const coordinates = [`${SW}`, `${NE}`];
const fixed = coordinates.map(e => e.replace(/[{()}]/g, '')).map(e => ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getWheelMapNodes(bounds) {\n\tconst params = {\n\t\tapi_key: apiKey,\n\t\tbbox: bounds,\n\t\tper_page: 1000,\n\t}\n\tconst options = {\n\t\tmode: 'no-cors'\n\t}\n\tconst queryString = formatQuery(params)\n\tconst url = `${searchURL}?${queryString}`\n\tfetch(url, options)\n\t\t.then(response => {\n\t\t\tco... | [
"0.65064317",
"0.6287059",
"0.6096493",
"0.6087814",
"0.6083349",
"0.60483795",
"0.60168546",
"0.5967971",
"0.5747825",
"0.5703452",
"0.5682678",
"0.5669107",
"0.5515693",
"0.5515693",
"0.5488919",
"0.54792976",
"0.5460724",
"0.5445885",
"0.54415995",
"0.5440736",
"0.5421825"... | 0.757999 | 0 |
On input parameters, do redirection and convert constants to terms We do not redirect literals | function RDFMakeTerm(formula,val) {
if (typeof val != 'object') {
if (typeof val == 'string') {
return new RDFLiteral(val);
} else if (typeof val == 'undefined') {
return undefined;
} else { // @@ add converting of dates and numbers
alert("Can't make term from " + val + " of type " + t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function interpret(input) {\n console.log(\"calling interpret\");\n var cmd = {},\n tokens = input.trim().toLowerCase().split(\" \");\n cmd.action = tokens.shift();\n cmd.target = tokens.join(\" \");\n return cmd;\n}",
"constHandler() {\n\t\tlet constant = this.m_constMenu.value;\n\t\tlet constUnit = thi... | [
"0.49727756",
"0.49120852",
"0.49065593",
"0.48922473",
"0.48867127",
"0.48588923",
"0.48551345",
"0.4798961",
"0.47860354",
"0.47789928",
"0.47789928",
"0.4776643",
"0.47615755",
"0.47615755",
"0.47145283",
"0.4689574",
"0.46878794",
"0.46702182",
"0.46512684",
"0.46458772",
... | 0.5275294 | 0 |
selects one of recent addresses if the gap is too large, otherwise issues a new address | function issueOrSelectNextAddress(wallet, is_change, handleAddress) {
readNextAddressIndex(wallet, is_change, function (next_index) {
if (next_index < MAX_BIP44_GAP)
return issueAddress(wallet, is_change, next_index, handleAddress);
readLastUsedAddressIndex(wallet, is_change, function (last_used_index) {
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getBestAddress(addresses) {\n // Keep only the addresses with the best match code\n /**\n * I haven't found any test data with duplicate addresses that have\n * different match codes. Until I find any such data, there's no need\n * to compare match codes\n */... | [
"0.53035456",
"0.5300804",
"0.5250905",
"0.52014977",
"0.51555926",
"0.514475",
"0.51274574",
"0.50708115",
"0.49832755",
"0.49712998",
"0.48785564",
"0.4850904",
"0.48318028",
"0.4829284",
"0.4823226",
"0.47610778",
"0.47494188",
"0.470453",
"0.46989533",
"0.46976852",
"0.46... | 0.6008617 | 0 |
Pig Latin Translate the provided string to pig latin. Pig Latin takes the first consonant (or consonant cluster) of an English word, moves it to the end of the word and suffixes an "ay". If a word begins with a vowel you just add "way" to the end. | function translatePigLatin(str) {
var vowels = ['a', 'e', 'i', 'o', 'u', 'y'];
var newString;
if (vowels.indexOf(str[0]) === -1) {
if (vowels.indexOf(str[1]) !== -1) {
newString = str.substring(1) + str[0] + "ay";
}
else {
newString = str.substring(2) + str.substring(0, 2) + "ay";
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function translatePigLatin(str) {\n if (str.match(/^[aeiou]/)) return str + \"way\";\n\n const consonantCluster = str.match(/^[^aeiou]+/)[0];\n return str.substring(consonantCluster.length) + consonantCluster + \"ay\";\n}",
"function translatePigLatin (str) {\n if (str[0].match(/[aeiou]/)) {\n return str ... | [
"0.87265253",
"0.86137694",
"0.86125904",
"0.8587584",
"0.85815096",
"0.85756785",
"0.857152",
"0.8571477",
"0.8566992",
"0.85605",
"0.8553573",
"0.854837",
"0.85399777",
"0.8489173",
"0.8485551",
"0.8484349",
"0.84458375",
"0.843767",
"0.84170115",
"0.83805746",
"0.83746195"... | 0.8638507 | 1 |
Init all easing functions | initEasingFunctions() {
this.EASE_IN_EXPO = (l, r, x) => (l + (r - l) * Math.pow(2, (x - 1) * 7));
// 0.14285714285714285 == (1 / log(2, 128))
this.EASE_OUT_EXPO = (l, r, x) => (l + (r - l) * Math.log(x * 127 + 1) / Math.LN2 * 0.14285714285714285);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"constructLerpFunctions ()\n {\n\n // Quadratic\n\n // lerpStyleEaseOutQuadratic\n this.lerpFunctions['lerpStyle' + Transition[Transition.EaseOut] + Style[Style.Quadratic]] =\n (initial, lerpDistance, duration, currentTime) =>\n {\n return this.lerpStyleE... | [
"0.6453063",
"0.6268855",
"0.6184419",
"0.61578745",
"0.6140396",
"0.6131133",
"0.60724837",
"0.60382426",
"0.5910181",
"0.5877697",
"0.58274066",
"0.58142555",
"0.57591444",
"0.5753274",
"0.57452977",
"0.5741803",
"0.57268566",
"0.57193154",
"0.5716238",
"0.5686517",
"0.5627... | 0.8061174 | 0 |
Use the specified field to do a SEED viewer search in a new window. | function SeedViewerJump(fieldID) {
// Get the field value.
var myValue = document.getElementById(fieldID).value;
// Compute a URL from it.
var myURL = "seedviewer.cgi?page=SearchResult;action=check_search;pattern=" +
escape(myValue);
// Open it in a new window.
window.open(myURL, "sandbo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function newSearch(){\n window.open(engines[currEngine].url+document.getElementById('field').value,\"_self\");\n}",
"function elFinderBrowser (field_name, url, type, win) {\n tinymce.activeEditor.windowManager.open({\n file: '/elfinder/tinymce',// use an absolute path!\n title: 'elFinder 2.0'... | [
"0.68441963",
"0.6463543",
"0.5998885",
"0.5846973",
"0.5830578",
"0.5717801",
"0.5717801",
"0.5717801",
"0.5644476",
"0.5638895",
"0.5608091",
"0.5567042",
"0.55379945",
"0.55242723",
"0.55219734",
"0.5481006",
"0.5475833",
"0.5475833",
"0.5438335",
"0.5418618",
"0.5418618",... | 0.7478002 | 0 |
This method creates the code for a subroutine based on the data typed into the Method Generator form. | function GenerateModule(formID) {
// Get the method form and the relevant fields.
var myForm = document.getElementById(formID);
var mySignature = myForm.elements["Signature"].value;
var myDescription = myForm.elements["Description"].value;
var resultField = myForm.elements["Result"];
// The resu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generateCode(){\n\n}",
"async buildCode() {\n\t\tawait this._codeSource.generated.generate();\n\t}",
"make_code_item(code_expr, start_v) {\n this.code_item = code_expr\n this.code_item.prop_name_ser = \"cv\"\n this.code_item.override_create_elem = (line, show_v, change_func, prop_... | [
"0.6213255",
"0.5481304",
"0.53936106",
"0.534306",
"0.5260585",
"0.5231658",
"0.5099202",
"0.50868475",
"0.50540376",
"0.5043658",
"0.5037237",
"0.50279",
"0.50137424",
"0.50122625",
"0.5008102",
"0.50002736",
"0.4997255",
"0.49767616",
"0.4967764",
"0.49616757",
"0.49420545... | 0.57036096 | 1 |
only filter the data if there is no swipe action active | function trigger_filter(){
if (in_swipe){
setTimeout(trigger_filter(), 1000);
return false;
}else{
filter($('#volunteers'), 'div.volunteer_wrapper');
return true;
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function toggleFilter () {\n\t\tvar filterProp = Object.keys(vm.tp.filter());\n\t\tif (!$scope.showFilter && filterProp.length > 0) {\n\t\t\tvm.tp.filter({});\n\t\t}\n\t}",
"function onFilter() {\r\n let filteredDataBuffer = _.cloneDeep(completeData)\r\n const selectedDatasourcesNames = _.map(selec... | [
"0.6189222",
"0.6187581",
"0.6155522",
"0.6099966",
"0.5907959",
"0.5887164",
"0.5869275",
"0.5860046",
"0.58545834",
"0.58311486",
"0.5819183",
"0.58065426",
"0.578528",
"0.57836896",
"0.5768845",
"0.57682925",
"0.576386",
"0.5760661",
"0.57404083",
"0.573947",
"0.57302976",... | 0.6652571 | 0 |
Given an object and a key, "getProductOfAllElementsAtProperty" returns the product of all the elements in the array located at the given key. Notes: If the array is empty, it should return 0. If the property at the given key is not an array, it should return 0. If there is no property at the given key, it should return... | function getProductOfAllElementsAtProperty(obj, key) {
// your code here
var value = obj[key];
if(!Array.isArray(value) || !value.length || !value) {
return 0;
}
return value.reduce((acc,curr) => acc * curr);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getSumOfAllElementsAtProperty(obj, key) {\n\tvar newArray;\n\tvar result = 0;\n\tfor (var key1 in obj){\n\t\tconsole.log(\"obj[key1]: \", obj[key1])\n\t\tif (Array.isArray(obj[key])){\n\t\t\tnewArray = obj[key];\n\t\t\tconsole.log(\"newArray: \", newArray)\n\t\t\tfor (var i = 0; i < newArray.length; i++){... | [
"0.70237064",
"0.5944965",
"0.5692357",
"0.5555298",
"0.55425763",
"0.54273564",
"0.54032826",
"0.5289455",
"0.52718747",
"0.5265621",
"0.5261461",
"0.5261461",
"0.52513874",
"0.5237852",
"0.52337754",
"0.5232163",
"0.5173748",
"0.51517934",
"0.5140771",
"0.5136238",
"0.51325... | 0.8198416 | 0 |
function to call a mysql query to select all employeedog relations in the works table, inner joins on Employees to get the first and last names, and title, and inner joins on Dogs to get the name of the dogs. Used to populate the Works page of existing relationships. | function getWorks(res, mysql, context, complete) {
mysql.pool.query("SELECT Employees.id as eid, fname, lname, title, Dogs.id as did, name FROM Employees INNER JOIN Works ON Employees.id = Works.EmployeeID INNER JOIN Dogs ON Dogs.id = Works.DogID", function (error, results, fields) {
if (error) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getEmployees() {\n var query = `SELECT e.id, e.first_name, e.last_name, r.title Role, d.name AS department , r.salary,\n concat( manager.first_name,\" \",manager.last_name ) Manager\n FROM \n employee e\n left join role r\n on e.role_id = r.id\n left join department d \n on r.dep... | [
"0.55051655",
"0.5474818",
"0.5357269",
"0.53470254",
"0.52452296",
"0.52292633",
"0.51923335",
"0.5158399",
"0.51518667",
"0.51329124",
"0.51197284",
"0.51183325",
"0.5099864",
"0.50790703",
"0.5064515",
"0.5059265",
"0.5053948",
"0.50518966",
"0.50344944",
"0.5022322",
"0.5... | 0.6861224 | 0 |
fucntion to generate the text for the drop downs. | function generatetxt(keylist) {
var text, i;
// start the dropdown list with All.
text = "<option>All</option>";
// loop through array to populate the drop down.
for (i = 0; i < keylist.length; i++) {
text += "<option>" + keylist[i] + "</option>";
}
return text
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function create_form_drop_down(name,elements)\n{\n let drops = [];\n name += \"<m style='color: red; display: inline-block;'> * </m>\";\n for(let i = 0;i < elements.length ; i++)\n {\n drops.push(`<option value=\"${elements[i]}\">${elements[i]}</option>`)\n };\n return `<div class=\"input_... | [
"0.6655797",
"0.65427953",
"0.6528663",
"0.65286547",
"0.6527513",
"0.6521445",
"0.6498151",
"0.6486527",
"0.6465836",
"0.6464203",
"0.64605117",
"0.6449408",
"0.64329875",
"0.64152974",
"0.63974726",
"0.63766134",
"0.63613415",
"0.6350097",
"0.63302433",
"0.6330049",
"0.6326... | 0.75037146 | 0 |
Function that builds the table with song information. | function generateTable(performer = 'All', song = 'All', year = 'All', peakpos = 'All') {
if (song == 'All' && performer == 'All' && year == 'All' && peakpos == 'All') {
// Need to build query to gather information and the dropdown menus
url = local + "/get_top100_sql/search/*";
first = true
}
else {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fillTable() {\n for (let i in songsToAdd) {\n // console.log('index = ', songsToAdd[i]);\n const newtr = document.createElement('tr');\n\n let audio = document.createElement('audio');\n audio.src = songsToAdd[i].url;\n audio.setAttribute(\"id\", \"player\" + i);\n ... | [
"0.70723236",
"0.67753613",
"0.6573688",
"0.6554995",
"0.6449598",
"0.64373994",
"0.63667506",
"0.6361942",
"0.63363403",
"0.629647",
"0.626948",
"0.6234951",
"0.6206156",
"0.6204813",
"0.61975473",
"0.6185291",
"0.6178062",
"0.6136167",
"0.6112547",
"0.6111902",
"0.6095612",... | 0.68248993 | 1 |
Function call with includ of keyname and output of items selected What items were selected by the user? This function returns those items in an array. | function itemsselected(keyname) {
// clear out the array
itemselected = [];
for (var i = 0; i < keyname.options.length; i++) {
if (keyname.options[i].selected == true) {
itemselected.push(keyname.options[i].text);
}
}
return itemselected
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getArrSelectedItems(){\r\n\t\tvar objItems = getObjSelectedItems();\r\n\t\tvar arrItems = getArrItemsFromObjects(objItems);\r\n\t\t\r\n\t\treturn(arrItems);\r\n\t\t\r\n\t}",
"selections() {\n let selections = this.actions().filter(a => !a.args || !a.args.length || this.choice(a).match(/^literal\\(/))... | [
"0.6121311",
"0.6119395",
"0.61007607",
"0.6039065",
"0.6023287",
"0.5974661",
"0.5923218",
"0.58839667",
"0.5883318",
"0.58395505",
"0.5818361",
"0.5811872",
"0.5791036",
"0.5762048",
"0.5762048",
"0.5762048",
"0.5762048",
"0.5762048",
"0.5762048",
"0.5762048",
"0.5762048",
... | 0.78119045 | 0 |
Generate random string using template. Template contains all possible characters. | function rdmStrTemplate(length, template) {
var text = "";
for( var i=0; i < length; i++ )
text += template.charAt(Math.floor(Math.random() * template.length));
return text;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function generaterandomString() {\n var randomString = \"\";\n var possibleChars = \"1234567890abcdefghijklmnopqrstuvqwxyzABCDEFGHIJKLMNOPQRSTUVWYZ\";\n for (i = 0; i < 6; i++) {\n randomString += possibleChars.charAt(Math.floor(Math.random() * possibleChars.length));\n };\n return randomString;\n}",
"fu... | [
"0.69888777",
"0.669627",
"0.6691219",
"0.66865045",
"0.6677665",
"0.6671151",
"0.6661366",
"0.66596425",
"0.66577905",
"0.66567916",
"0.66538095",
"0.66532475",
"0.6651045",
"0.6650921",
"0.6643651",
"0.66301596",
"0.66176325",
"0.6615423",
"0.6613344",
"0.6608529",
"0.66004... | 0.7890595 | 0 |
Refresh the contents of the banners table | function refresh_banners(){
//Load banners table
$("#all_banners").load(base_url+"admin/webcomic_banners_table",function(response,status,xhr){
//Run on success
if(status != "error"){
//To trigger toggle buttons
//Ref: http://stackoverflow.com/questions/32586384/bootstrap-toggle-doesnt-work-a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function refreshTables() {\n\n\t\t$(\"#biomatcher-data-table\").html(\"<table id='biomatcher-data-table' class='table table-striped'><tr><th>Subject ID</th><th>Oligo Name</th><th>Oligo Seq</th><th>Mismatch Tolerance</th><th>Hit Coordinates</th></tr></table>\");\n\t}",
"function refreshTable(){\n $('.mbot_stats_... | [
"0.68356264",
"0.63887155",
"0.633209",
"0.62662894",
"0.62347686",
"0.62125695",
"0.62038743",
"0.61487585",
"0.61084926",
"0.60082346",
"0.59645474",
"0.59429735",
"0.5915868",
"0.59062",
"0.58778495",
"0.58699644",
"0.586978",
"0.58600825",
"0.584114",
"0.58376235",
"0.583... | 0.72958624 | 0 |
Notify the subclass the chart has been drawn. | didDrawChart () {
this.sendAction ('draw');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"draw() {\n this.plot = this.svg.append('g')\n .classed(\"plot\", true)\n .attr('transform', `translate(${this.margin.left},${this.margin.top})`);\n\n // Add the background\n this.plot.append(\"rect\")\n .attrs({\n fill: \"white\",\n ... | [
"0.61002517",
"0.60693294",
"0.6044449",
"0.601812",
"0.601812",
"0.60000837",
"0.5945412",
"0.5935441",
"0.59172916",
"0.59121513",
"0.58999246",
"0.58903676",
"0.589006",
"0.58432925",
"0.5827133",
"0.58247435",
"0.5780583",
"0.5777401",
"0.5775657",
"0.5775657",
"0.5775657... | 0.6939054 | 0 |
Function to conditionally display office number | function displayOfficeNumber(number) {
return `
<li class="list-group-item p-4"><span class="text-muted">Number:</span> ${number}</li>
`
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getOfficeNum() {\n console.log(this.officeNum);\n return this.officeNum;\n }",
"getOfficeNumber() {\n return this.officeNumber;\n }",
"getOfficeNumber() {\n return this.officeNumber;\n }",
"getOfficeNumber(){\n return this.officeNumber;\n }",
"getOfficeNumber(){\n ... | [
"0.6303637",
"0.62774193",
"0.62774193",
"0.6011769",
"0.6011769",
"0.59581363",
"0.5807605",
"0.5781148",
"0.56341565",
"0.5626605",
"0.5615796",
"0.55988145",
"0.5590253",
"0.5590089",
"0.55744964",
"0.5546996",
"0.5513979",
"0.54900706",
"0.54288006",
"0.5427741",
"0.54205... | 0.7251073 | 0 |
Function to conditionally display github link | function displayGithub(github) {
return `
<li class="list-group-item p-4"><span class="text-muted text-decoration-none">Github: </span><a href="https://github.com/${github}">${github}</a></li>
`
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createGithubURL(data) {\n var url = 'not found...';\n if (data['user'] != '' && data['repo'] != '') {\n url = \"https://github.com/\" + data['user'] + \"/\" + data['repo'] \n url += \"/blob/master/\" + createGithubPath(data);\n } else if (data['name'] != '') {\n ... | [
"0.6730691",
"0.6720269",
"0.6720269",
"0.66116107",
"0.6607243",
"0.6560302",
"0.64789194",
"0.63887894",
"0.62667286",
"0.6216382",
"0.6209078",
"0.60949594",
"0.60682434",
"0.6067024",
"0.6054763",
"0.6046112",
"0.6037835",
"0.5945642",
"0.59440583",
"0.59406525",
"0.59192... | 0.7065741 | 0 |
Function to conditionally display school | function displaySchool(school) {
return `
<li class="list-group-item p-4"><span class="text-muted">School: </span>${school}</li>
`
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getSchool() {\n return \"Novi Hogeschool\";\n}",
"function School(s, i) {\n let end = s.end;\n if(end === -1) {\n end = <small>present</small>;\n }\n\n return (\n <div key={i}>\n <h5 className=\"d-flex justify-content-between\">\n {s.school}\n <div>{s.star... | [
"0.69027483",
"0.6764708",
"0.63676643",
"0.6353806",
"0.63304585",
"0.6324548",
"0.6299248",
"0.62773156",
"0.62773156",
"0.62773156",
"0.6270707",
"0.623694",
"0.60843575",
"0.6073608",
"0.6073608",
"0.59600055",
"0.5902357",
"0.5886443",
"0.58758616",
"0.5867311",
"0.58222... | 0.71886736 | 0 |
Renders each post and determinds if the owner of the post is logged in if they are, then the private controls will display for that post. | renderPosts() {
const currentUserId = this.props.currentUser && this.props.currentUser._id;
return this.props.posts.map((post) => {
const showPrivateControls = post.owner === currentUserId;
return (
<Post
key={post._id}
post={post}
showPrivateControls={showPriv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function renderPosts() {\n // assign posts object to a variable\n var posts = memory.posts;\n // loop through posts object\n for (var i = 0; i < posts.length; i++) {\n // call render method\n memory.posts[i].render();\n };\n ... | [
"0.61182576",
"0.5912436",
"0.58889496",
"0.57879543",
"0.56358844",
"0.56314814",
"0.5619365",
"0.56162083",
"0.5608769",
"0.55909544",
"0.55852175",
"0.55669296",
"0.5553776",
"0.5478806",
"0.547557",
"0.5475503",
"0.5461073",
"0.5441703",
"0.5427389",
"0.54198253",
"0.5419... | 0.75782025 | 0 |
Inserts a post into the database and cleans the input field | handleSubmit(event){
event.preventDefault();
const text = ReactDOM.findDOMNode(this.refs.textInput).value.trim();
Meteor.call('posts.insert', text);
ReactDOM.findDOMNode(this.refs.textInput).value = '';
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function submitPost(e){\n e.preventDefault();\n var title = e.target.title.value;\n var description = e.target.description.value;\n \n // form must be complete\n if (!title.length || !description.length){\n return false;\n }\n \n Posts.insert({\n title: title,\n description: description,\n cre... | [
"0.6943133",
"0.6510186",
"0.6506645",
"0.6395315",
"0.6379262",
"0.63106877",
"0.6303043",
"0.6208591",
"0.6204298",
"0.60760504",
"0.60700125",
"0.6056233",
"0.59991676",
"0.59863317",
"0.5946237",
"0.5856076",
"0.5826098",
"0.57843584",
"0.5774151",
"0.5773466",
"0.5772802... | 0.6680405 | 1 |
Get a random integer less than n. | function randomInteger(n) {
return Math.floor(Math.random()*n);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function randomInteger(n) {\n return Math.floor(Math.random()*n);\n}",
"function randomInt(n) {\n return Math.floor(Math.random() * n);\n}",
"function randomInt(n) {\n return Math.floor(Math.random() * n);\n}",
"function randInt(n) {\n return Math.floor(Math.random() * n);\n}",
"function randomInt(... | [
"0.8336875",
"0.82785",
"0.82785",
"0.8262308",
"0.8220271",
"0.81919044",
"0.80949336",
"0.80651146",
"0.80477107",
"0.80191684",
"0.79673153",
"0.7959747",
"0.7956127",
"0.79488194",
"0.7933998",
"0.7919832",
"0.7916976",
"0.78993666",
"0.78851384",
"0.7881981",
"0.7857319"... | 0.8344091 | 0 |
drop down menu of percentage for event tips | function eventTipSelector() {
var a = document.getElementById("eventTipPercentage").value;
var b = document.getElementById("eventTipConfirm");
if(isNaN(a)) {b.innerHTML = "Nothing selected yet"}
else {
eventTipPercentage = parseInt(a);
b.innerHTML = "Event tip percentage will be considered to be " + eventTipPer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function populateTotalPercent(e, a) {\n if (\"carb\" == a) l = e + parseInt($(\"#protein_slider\").slider(\"value\")) + parseInt($(\"#fat_slider\").slider(\"value\"));\n else if (\"protein\" == a) l = e + parseInt($(\"#carb_slider\").slider(\"value\")) + parseInt($(\"#fat_slider\").slider(\"value\"));\n e... | [
"0.5988597",
"0.5934374",
"0.59144807",
"0.5864045",
"0.58455",
"0.583954",
"0.575667",
"0.5741157",
"0.56496006",
"0.5545232",
"0.5451211",
"0.54364514",
"0.5421094",
"0.54173905",
"0.54120904",
"0.5395018",
"0.5392512",
"0.5386217",
"0.5378401",
"0.53758323",
"0.5373406",
... | 0.6684503 | 0 |
drop down menu of number of servers | function numberOfServersSelector() {
var a = document.getElementById("numberOfServers").value;
var b = document.getElementById("numberOfServersConfirm");
if (isNaN(a)) {b.innerHTML = "Nothing selecteed yet"}
else {
numberOfServers = parseInt(a);
b.innerHTML = "All the tips will be devided for " + numberOfServ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setNumServers(num)\r\n{\r\n\tnumServers = num;\r\n}",
"function getServersList() {\n if (window.sos && window.sos.length > 0) {\n var selectSrv = document.getElementById('server-select');\n for (var i = 0; i < sos.length; i++) {\n var s... | [
"0.6775951",
"0.6555574",
"0.6059328",
"0.5746349",
"0.57424957",
"0.57357484",
"0.57013327",
"0.5697189",
"0.56877404",
"0.5594743",
"0.55696267",
"0.5562885",
"0.55440336",
"0.5468198",
"0.5442957",
"0.54289705",
"0.5403478",
"0.5400283",
"0.5398301",
"0.5358565",
"0.53509"... | 0.7307066 | 0 |
radio selector if the foodrunner is present. Returns boolean | function foodRunnerSelector() {
if (document.getElementById("foodRunnerYes").checked == true) {
doTipFoodRunner = true;
document.getElementById("foodRunnerConfirm").innerHTML = "Food Runner will be tipped out";}
else {
doTipFoodRunner = false;
document.getElementById("foodRunnerConfirm").innerHTML = "No tip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isRowSelectedForAppointment(){\n var radiosDonation = document.getElementsByClassName(\"appointRadios\");\n for(var i = 0; i<radiosDonation.length;i++){\n if(radiosDonation[i].type === \"radio\" && radiosDonation[i].checked){\n return true;\n }\n\n }\n return false;\n}",
"function ch... | [
"0.6002308",
"0.58931744",
"0.5828521",
"0.5742646",
"0.56536764",
"0.56038046",
"0.55680037",
"0.55601436",
"0.55237365",
"0.55095124",
"0.5492015",
"0.54885876",
"0.54846436",
"0.5467631",
"0.54601717",
"0.54254055",
"0.53941625",
"0.5364086",
"0.5344296",
"0.5340759",
"0.5... | 0.6645744 | 0 |
sets pageCounter to 1 and clears all fields | function resetForm() {
pageCounter = 1;
displayPage(pageCounter);
clearFields();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function resetPageCounter() {\n self.pagesLoaded = 0;\n self.newUpdatesApplied = 0;\n self.uncountedPosts = [];\n self.countedPosts = [];\n }",
"function ClearFields() { }",
"function clearPage(){\n\t\t$('#home,#subject,#schedule,#course,#... | [
"0.7346087",
"0.6599753",
"0.65950984",
"0.65709454",
"0.6534599",
"0.65146196",
"0.6491995",
"0.6454822",
"0.6358031",
"0.63314384",
"0.6330404",
"0.6313117",
"0.6299537",
"0.6282907",
"0.62757623",
"0.6265143",
"0.62592965",
"0.6256452",
"0.62539184",
"0.6234725",
"0.621137... | 0.7095952 | 1 |
checking if all the fields are empty | function allFieldsAreEmpty() {
if (
document.getElementById("net-sales").value == "" &&
document.getElementById("20-auto-grat").value == "" &&
document.getElementById("event-auto-grat").value == "" &&
document.getElementById("charge-tip").value == "" &&
document.getElementById("liquor").value == "" &&
documen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function empty(quote,fields){\n\t\t\tfor(var i=0;i<fields.length;i++){\n\t\t\t\tvar val=quote[fields[i]];\n\t\t\t\tif(typeof val!=\"undefined\") return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}",
"function noFieldsEmpty(_formData) {\n for (let entry of _formData) {\n if (entry[1] == \"\") {\n ... | [
"0.77111256",
"0.7642614",
"0.7631739",
"0.75279725",
"0.75074136",
"0.75000507",
"0.74902284",
"0.7412057",
"0.73563254",
"0.73508334",
"0.73485833",
"0.72842026",
"0.72627026",
"0.7204684",
"0.7203069",
"0.7171592",
"0.7144768",
"0.7129393",
"0.7107099",
"0.70860183",
"0.70... | 0.8069356 | 0 |
Look for the script element in the document where the assignment of the gameData JSON object occurs, then get the string representation of that object and parse it into a real JSON object. Return an object containing both the game data from the NY Times web page and an array representing the percentages of the max scor... | function getGameInfo(htmlTree) {
let gameData;
let scripts = Array.from(htmlTree.getElementsByTagName('script'));
scripts.some((script) => {
let text = script.innerText;
let pos = text.search('window.gameData = {');
if (0 <= pos && pos < 10) {
gameData = JSON.parse(text.substring(text.search('{'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function grabRankings() {\n var xhr = new XMLHttpRequest();\n xhr.onload = function() {\n if(xhr.status === 200) {\n responseObject = JSON.parse(xhr.responseText);\n document.getElementById('rank1Score').textContent = responseObject.leaders[0].score;\n document.getElementById('rank2Sc... | [
"0.6192845",
"0.584334",
"0.580582",
"0.576887",
"0.56662065",
"0.56290054",
"0.55862164",
"0.5520756",
"0.5490722",
"0.54222333",
"0.53992915",
"0.5394583",
"0.5370813",
"0.53122157",
"0.52942324",
"0.5267002",
"0.5242019",
"0.5237257",
"0.52069074",
"0.51976883",
"0.5186891... | 0.7461547 | 0 |
This section of function declarations defines functions used to save and reload the state of game play. One of the simplest functions in this app. Just bundle up the current values of the set of global variables representing the current state of play, and turn then into an object with a timestamp of now. Then store it ... | function saveGameClient() {
// The global variable gameState is updated with a new object
// representing the state of play (ie the values of the set of
// global variables representing the state of play) after every
// corrent guess. It is also updated with saving to the cloud.
gameState = {
gameAnswers,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function saveGame() {\r\n\tlocalStorage.setItem(\"Bread\", bread);\r\n\tlocalStorage.setItem(\"Eggs\", eggs);\r\n\tlocalStorage.setItem(\"Gold\", gold);\r\n\tlocalStorage.setItem(\"Demand\", demand);\r\n\tlocalStorage.setItem(\"Inflation\", inflation);\r\n\tlocalStorage.setItem(\"Clicks\", clicks);\r\n\tlocalStora... | [
"0.75118804",
"0.71475613",
"0.7055599",
"0.6839087",
"0.6786638",
"0.6718062",
"0.67095536",
"0.67042726",
"0.66944206",
"0.6693842",
"0.6671437",
"0.66608673",
"0.664546",
"0.66083384",
"0.6583981",
"0.65724957",
"0.65420926",
"0.65341526",
"0.65296257",
"0.6486333",
"0.645... | 0.755676 | 0 |
When everything is working right, if the player is say "Nick", this function simply replaces/initializes the value of cloudData.spellingBee.Nick.gameState with the current gameState. Everything else is handling exceptions. I am conservatively assuming that the cloudData object could be storing state for games/apps othe... | function updateCloudData(cloudData) {
if (_.isEqual(cloudData, {})) {
alert('Error: Cloud data not found. Reinitializing.');
cloudData = {};
}
if (!cloudData.hasOwnProperty('spellingBee')) {
alert('Error: Cloud data not found. Reinitializing.');
cloudData.spellingBee = {};
}
// Note we're futu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setGameState() {\n for(var i = 0; i < puzzle.length; i++) {\n if (i == 0 || i == puzzle.length - 1) {\n var t = \"locked\";\n } else {\n var t = \"\";\n }\n GAME_STATE.words[i] = {\n word: puzzle[i],\n team: t\n }\n }\n}",
"setEndGameState(gameState, timeUntilNextGam... | [
"0.6039112",
"0.5745764",
"0.5717538",
"0.57126975",
"0.5694864",
"0.56930715",
"0.56738824",
"0.5596391",
"0.5487357",
"0.5479356",
"0.546903",
"0.5464795",
"0.5464318",
"0.54640603",
"0.54422224",
"0.5415852",
"0.54131395",
"0.5403738",
"0.5399408",
"0.539439",
"0.53815126"... | 0.60040754 | 1 |
I guess I should have called this the saveCloudData function. Note that by doing a PUT, I am completely replacing the value of the jsonbin.io bin. That's why I get its previous value and update it. | async function setCloudData(cloudData) {
let cloudDataString = JSON.stringify(cloudData);
return (
fetch('https://api.jsonbin.io/b/5ebd62b88284f36af7bb1d7b', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'secret-key':
'$2b$10$oenHkCkZSs3jpqzXIrl1LeITtaIoYX... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async save() {\n // Check if anything has changed or stop here.\n const originData = await loadDataObject(this.dataKey)\n\n if (this.data === originData) {\n console.log('Nothing changed here for ' + this.dataKey)\n return\n }\n\n // Convert the modified data for the backend.... | [
"0.69098306",
"0.6108239",
"0.58967966",
"0.58610815",
"0.57895344",
"0.57467383",
"0.57168275",
"0.5714031",
"0.5679062",
"0.5661708",
"0.5655542",
"0.5650718",
"0.5606951",
"0.5576993",
"0.5565614",
"0.55526453",
"0.55526453",
"0.5545301",
"0.55349636",
"0.5522053",
"0.5513... | 0.68042624 | 1 |
I use a little hack: if the guessed word is one of the pangram words, I return its point value as a negative number. I return 1 if the word was already guessed. And I return 2 is the word does not contain the center letter. This kind of overloading of the returned value is not good practice. I should probably return an... | function guessValue(word) {
let value = 0;
// Already guessed this word.
if (answerList.includes(word)) {
return -1;
}
if (!word.includes(centerLetter)) {
return -2;
}
// Yeah! A correct guess.
if (gameAnswers.includes(word)) {
// Calculate points:
// Four-letter word: 1 point
// Lon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function oldScrabbleScorer(word) {\n\tword = word.toUpperCase();\n\tlet letterPoints = \"\";\n\tlet totalPoints = 0;\n \n\tfor (let i = 0; i < word.length; i++) {\n \n\t for (const pointValue in oldPointStructure) {\n \n\t\t if (oldPointStructure[pointValue].includes(word[i])) {\n\t\t\ttotalPoints += Number(point... | [
"0.68810844",
"0.6800661",
"0.65982825",
"0.6587615",
"0.65123993",
"0.64049006",
"0.63955486",
"0.6391548",
"0.6341365",
"0.6329915",
"0.6325798",
"0.6318751",
"0.62860936",
"0.6284235",
"0.6231502",
"0.6221663",
"0.621218",
"0.61690867",
"0.6100515",
"0.6096159",
"0.6032528... | 0.733901 | 0 |
A pretty simple helper function to get the name of the rank that corresponds to a range of scores. | function getRank(score) {
let rank;
// Iterate through the gameLevels array until we find the item whose score is
// greater than the current score. Then we return the name gameLevels item
// that just preceeds the item with the greater score.
gameLevels.some((level, idx, arr) => {
if (level[1] > score) {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getRank(position) {\n switch (position) {\n case 0:\n return \"Grand Master\";\n break;\n case 1:\n return \"Master\";\n break;\n case 2:\n return \"Knight\";\n break;\n ... | [
"0.6506712",
"0.63614553",
"0.6323023",
"0.6209956",
"0.6131018",
"0.60613716",
"0.6034984",
"0.5848471",
"0.5845241",
"0.5833916",
"0.580038",
"0.5776996",
"0.56660366",
"0.56584525",
"0.5654036",
"0.5643102",
"0.56083167",
"0.55943537",
"0.55868196",
"0.5577663",
"0.5544607... | 0.6377136 | 1 |
funzione per resettare la pagina e prepararla all'inserimento di nuovi risultati | function reset_risultati() {
// resetto l'input testuale
$('#testo-ricerca').val('');
// nascondo il titolo della pagina
$('.titolo-ricerca').removeClass('visible');
// svuoto il contenitore dei risultati
$('#risultati').empty();
// $('#risultati .card').re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function reset(){\n\n\n\thide_session(\"resumo\");\n\thide_session(\"nav_resumo\");\n\n\n\n\n\tfor (var i = 6; i >= 2; i--) {\n\t\tresetSession(i);\n\t}\n\n\t\n\n\tetapa_ants = 2;\n\tetapa = 1;\n\tresetou = 1;\n\tengineControler(etapa);\n\n\n\t\n}",
"function reset() {\n window.location.reload(); // recargar la... | [
"0.7067756",
"0.6879196",
"0.68318033",
"0.6798916",
"0.6689093",
"0.66830975",
"0.66439354",
"0.66439354",
"0.66439354",
"0.66439354",
"0.66439354",
"0.66439354",
"0.6604257",
"0.6565196",
"0.6503233",
"0.6502497",
"0.6497687",
"0.6385708",
"0.63773805",
"0.6311189",
"0.6309... | 0.7105593 | 0 |
Make sure the gutters options contains the element "CodeMirrorlinenumbers" when the lineNumbers option is true. | function setGuttersForLineNumbers(options) {
var found = false;
for (var i = 0; i < options.gutters.length; ++i) {
if (options.gutters[i] == "CodeMirror-linenumbers") {
if (options.lineNumbers) found = true;
else options.gutters.splice(i--, 1);
}
}
if (!found && options.lineN... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function setGuttersForLineNumbers(options) {\n\t\t var found = indexOf(options.gutters, \"CodeMirror-linenumbers\");\n\t\t if (found == -1 && options.lineNumbers) {\n\t\t options.gutters = options.gutters.concat([\"CodeMirror-linenumbers\"]);\n\t\t } else if (found > -1 && !options.lineNumbers) {\n\t... | [
"0.8098067",
"0.8057702",
"0.8057702",
"0.8057702",
"0.80440164",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.8008683",
"0.797834",
"... | 0.81615347 | 1 |
OPERATIONS Operations are used to wrap changes in such a way that each change won't have to update the cursor and display (which would be awkward, slow, and errorprone), but instead updates are batched and then all combined and executed at once. | function startOperation(cm) {
if (cm.curOp) ++cm.curOp.depth;
else cm.curOp = {
// Nested operations delay update until the outermost one
// finishes.
depth: 1,
// An array of ranges of lines that have to be updated. See
// updateDisplay.
changes: [],
delayedCallbacks: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"broadcastOps (ops) {\n ops = ops.map(function (op) {\n return Y.Struct[op.struct].encode(op)\n })\n var self = this\n function broadcastOperations () {\n if (self.broadcastOpBuffer.length > 0) {\n self.broadcast({\n type: 'update',\n ops: self.broadc... | [
"0.5928669",
"0.5846984",
"0.5811892",
"0.5811892",
"0.5811892",
"0.57582146",
"0.5750088",
"0.5750088",
"0.5750088",
"0.5748204",
"0.57327354",
"0.57228607",
"0.5708141",
"0.57010746",
"0.566736",
"0.56319124",
"0.56273514",
"0.56273514",
"0.56239206",
"0.56239206",
"0.56239... | 0.59463614 | 1 |
creates an SVG document from an SVG string | function svgStringToSvgDoc(svgStr) {
domParser = domParser || new DOMParser();
return domParser.parseFromString(svgStr, 'text/xml');
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function parseSVG(s) {\n var div = document.createElementNS('http://www.w3.org/1999/xhtml', 'div');\n div.innerHTML = '<svg xmlns=\"http://www.w3.org/2000/svg\">' + s + '</svg>';\n var frag = document.createDocumentFragment();\n while (div.firstChild.firstChild)\n frag.appendChild(div.firstChild... | [
"0.75140816",
"0.71869004",
"0.71869004",
"0.6974948",
"0.6965533",
"0.6849979",
"0.6670446",
"0.6670446",
"0.64448065",
"0.64039254",
"0.62163717",
"0.6209157",
"0.61591625",
"0.6141827",
"0.6136245",
"0.61281455",
"0.61281455",
"0.61185765",
"0.6115605",
"0.61153823",
"0.60... | 0.7517903 | 0 |
searializes an SVG element to an SVG string | function svgElemToSvgString(svgElement) {
xmlSerializer = xmlSerializer || new XMLSerializer();
return xmlSerializer.serializeToString(svgElement);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function svg2Stng(svgElem)\r\n{\r\n console.log(new XMLSerializer().serializeToString(svgElem))\r\n}",
"_toSvgElement(element) {\n const svg = this._svgElementFromString('<svg></svg>');\n const attributes = element.attributes;\n // Copy over all the attributes from the `symbol` to the new SV... | [
"0.76656824",
"0.74119186",
"0.74119186",
"0.70013684",
"0.6633132",
"0.657052",
"0.65189475",
"0.65092075",
"0.6476484",
"0.64705783",
"0.6456573",
"0.6454879",
"0.63603914",
"0.6310114",
"0.6258106",
"0.623604",
"0.6215797",
"0.6214846",
"0.61955726",
"0.61955726",
"0.60934... | 0.79693264 | 0 |
Returns the absolute url for the specified url | function getAbsoluteUrl(url) {
A_ELEMENT.href = url;
return A_ELEMENT.href;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getFullURL(url) {\n var a = document.createElement('a');\n a.href = url;\n return a.href;\n }",
"function toAbsoluteURL (url) {\n // Handle absolute URLs (with protocol-relative prefix)\n // Example: //domain.com/file.png\n if (url.search(/^\\/\\//) != -1) {\n return window... | [
"0.777866",
"0.7473583",
"0.73513216",
"0.732716",
"0.72549516",
"0.72297466",
"0.71396476",
"0.6937103",
"0.6899777",
"0.6756652",
"0.6742732",
"0.6655967",
"0.664927",
"0.6589297",
"0.65220743",
"0.6489137",
"0.64880466",
"0.6464443",
"0.64622873",
"0.64134383",
"0.64106077... | 0.7769693 | 1 |
Copy attributes from img element to svg element | function copyAttributes(imgElem, svgElem) {
var attribute;
var attributeName;
var attributeValue;
var attributes = imgElem.attributes;
for (var i = 0; i < attributes[_LENGTH_]; i++) {
attribute = attributes[i];
attributeName = attribute.name;
// Only copy attributes not explicitly ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function copyAttributes(imgElem, svgElem) {\n var attribute;\n var attributeName;\n var attributeValue;\n var attributes = imgElem.attributes;\n for (var i = 0; i < attributes[_LENGTH_]; i++) {\n attribute = attributes[i];\n attributeName = attribute.name;\n // Only copy attributes no... | [
"0.78961176",
"0.7520373",
"0.6999833",
"0.6665455",
"0.65811986",
"0.65811986",
"0.65682435",
"0.65424",
"0.6451338",
"0.6439209",
"0.6394841",
"0.6392599",
"0.6287087",
"0.62831736",
"0.62238914",
"0.61741483",
"0.6145235",
"0.6078623",
"0.60455096",
"0.6019436",
"0.5991443... | 0.77143013 | 1 |
This function appends a suffix to IDs of referenced elements in the in order to to avoid ID collision between multiple injected SVGs. The suffix has the form "injectX", where X is a running number which is incremented with each injection. References to the IDs are adjusted accordingly. We assume tha all IDs within the ... | function makeIdsUnique(svgElem, onlyReferenced) {
var idSuffix = ID_SUFFIX + uniqueIdCounter++;
// Regular expression for functional notations of an IRI references. This will find occurences in the form
// url(#anyId) or url("#anyId") (for Internet Explorer) and capture the referenced ID
var funcIriRege... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makeIdsUnique(svgElem) {\n var i, j;\n var idSuffix = '--inject-' + uniqueIdCounter++;\n // Get all elements with an id. The SVG spec recommends to put referenced elements inside <defs> elements, but\n // this is a requirement, therefore we have to search for IDs in the whole SVG.\n var idE... | [
"0.63779444",
"0.55859476",
"0.5484107",
"0.5185975",
"0.5111807",
"0.5004295",
"0.4979614",
"0.49662077",
"0.49658608",
"0.4954617",
"0.4936648",
"0.49113077",
"0.4878804",
"0.48087418",
"0.47553018",
"0.4747373",
"0.47371662",
"0.47152674",
"0.47152674",
"0.47152674",
"0.46... | 0.6656387 | 0 |
For cached SVGs the IDs are made unique by simply replacing the already inserted unique IDs with a higher ID counter. This is much more performant than a call to makeIdsUnique(). | function makeIdsUniqueCached(svgString) {
return svgString.replace(ID_SUFFIX_REGEX, ID_SUFFIX + uniqueIdCounter++);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function makeIdsUnique(svgElem) {\n var i, j;\n var idSuffix = '--inject-' + uniqueIdCounter++;\n // Get all elements with an id. The SVG spec recommends to put referenced elements inside <defs> elements, but\n // this is a requirement, therefore we have to search for IDs in the whole SVG.\n var idE... | [
"0.7607503",
"0.74090815",
"0.7375291",
"0.63290524",
"0.6321247",
"0.6248585",
"0.62436044",
"0.62361836",
"0.5967365",
"0.5899889",
"0.58067065",
"0.5780132",
"0.5780132",
"0.5773711",
"0.57683104",
"0.5718179",
"0.57106185",
"0.5701406",
"0.5701406",
"0.5688483",
"0.566358... | 0.81898516 | 0 |
Merges any number of options objects into a new object | function mergeOptions() {
var mergedOptions = {};
var args = arguments;
// Iterate over all specified options objects and add all properties to the new options object
for (var i = 0; i < args[_LENGTH_]; i++) {
var argument = args[i];
for (var key in argument) {
if (argument.hasOwnPro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mergeOptions() {\n var mergedOptions = {};\n var args = arguments;\n // Iterate over all specified options objects and add all properties to the new options object\n for (var i = 0; i < args[_LENGTH_]; i++) {\n var argument = args[i];\n for (var key in argument) {\n if (ar... | [
"0.8034266",
"0.7502732",
"0.74322397",
"0.7366113",
"0.7269508",
"0.7269508",
"0.7269508",
"0.7262569",
"0.7231465",
"0.71773815",
"0.70385635",
"0.699809",
"0.69956475",
"0.69956475",
"0.69956475",
"0.6982365",
"0.69774604",
"0.6951977",
"0.6951977",
"0.6951977",
"0.6951977... | 0.8006587 | 1 |
Builds an SVG element from the specified SVG string | function buildSvgElement(svgStr, verify) {
if (verify) {
var svgDoc;
try {
// Parse the SVG string with DOMParser
svgDoc = svgStringToSvgDoc(svgStr);
} catch (e) {
return NULL;
}
if (svgDoc[_GET_ELEMENTS_BY_TAG_NAME_]('parsererror')[_LENGTH_]) {
// DOMPa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function buildSvgElement(svgStr, verify) {\n var svgDoc;\n try {\n // Parse the SVG string with DOMParser\n svgDoc = getDOMParser().parseFromString(svgStr, 'text/xml');\n } catch(e) {\n return NULL;\n }\n if (verify && svgDoc[_GET_ELEMENTS_BY_TAG_NAME_]('parsererror')[_LENGTH_]) {\n ... | [
"0.76635474",
"0.73903733",
"0.73903733",
"0.72191787",
"0.7022371",
"0.67676675",
"0.67676675",
"0.674297",
"0.6597093",
"0.6597093",
"0.6534844",
"0.6462209",
"0.6455094",
"0.64137226",
"0.63835967",
"0.6375032",
"0.63557523",
"0.62803715",
"0.618561",
"0.618561",
"0.616711... | 0.783952 | 0 |
Item // subclass Outlayer Item | function Item() {
Outlayer.Item.apply(this, arguments);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Item() {\n Outlayer.Item.apply( this, arguments );\n}",
"function Item() {\n Outlayer.Item.apply( this, arguments );\n}",
"function Item() {\n Outlayer.Item.apply( this, arguments );\n}",
"function Item() {\n Outlayer.Item.apply( this, arguments );\n}",
"function Item() {\n Outlayer.Item.appl... | [
"0.8231318",
"0.8231318",
"0.8231318",
"0.8231318",
"0.8231318",
"0.8231318",
"0.8231318",
"0.8231318",
"0.8206128",
"0.8206128",
"0.8188334",
"0.7456059",
"0.71389025",
"0.70857316",
"0.7051181",
"0.7011173",
"0.69149035",
"0.6908785",
"0.68791884",
"0.68632305",
"0.68616295... | 0.8287553 | 0 |
Load plugin into page. | function loadPlugin() {
this.fs = document.createElement("embed");
this.fs.style.position = "absolute";
this.fs.style.left = "-9999px";
this.fs.id = "fs2";
this.fs.setAttribute("type", "application/x-thk-nico-dl");
document.documentElement.appendChild(this.fs);
fs2 = document.getElementById... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function loadPlugin($){\n\n\t\t\tif( !options.jqueryUrl.wasAlreadyLoaded ){\n\t\t\t\twindow.jQuery_loadedByMochup = $;\n\t\t\t}\n\n\t\t\tif( !(window.JSON && JSON.stringify) && options.jsonUrl ){\n\t\t\t\t$.getScript( options.jsonUrl );\n\t\t\t}\n\n\t\t\tif( $.fn.mochup ){\n\t\t\t\t$(options.scope).mochup();\n\t\t... | [
"0.66210955",
"0.6481543",
"0.6365908",
"0.63299286",
"0.6037717",
"0.597393",
"0.5954654",
"0.59455156",
"0.593641",
"0.58170253",
"0.581269",
"0.5741249",
"0.57350206",
"0.57270074",
"0.57204866",
"0.5720447",
"0.57045627",
"0.57045627",
"0.5681664",
"0.5654946",
"0.5654946... | 0.6645459 | 0 |
allows user to see another book result by scrolling through a set number (20) of results from the Taste Dive API | function tryAnotherBook(result) {
let counter = 0;
let suggestionLength = result.length - 2;
$(".bookSuggest").on("click", function(){
if (counter <= suggestionLength) {
counter++;
} else {
counter = 0;
}
$('.book-results').html("");
$(".book-results").append(`<h3>${result[counter]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"scrollToSpread(book){\n let bookEl = document.getElementById('book');\n if(bookEl && book) {\n let asksLength = Object.keys(book.asks).length;\n if (asksLength) bookEl.scrollTop = asksLength * 29.5;\n }\n }",
"function displayBookRecommendation(data) {\n const results = data.results.map((ite... | [
"0.67295945",
"0.6305331",
"0.62370694",
"0.6164374",
"0.5952009",
"0.5828901",
"0.58115536",
"0.5801181",
"0.57900554",
"0.5762507",
"0.57378715",
"0.5732193",
"0.57137305",
"0.57031465",
"0.57012165",
"0.56710154",
"0.5665251",
"0.56495315",
"0.5647906",
"0.5643825",
"0.564... | 0.6407485 | 1 |
Create a function named Make. Set its prototype to the Car function. Define a property `manufacturer` with a default value of empty string. | function Make (maker) {
this.manufacturer = maker;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function CarMaker() {}",
"function Make () {\n this.manufacturer = \"\";\n}",
"function CarMaker(){}",
"function Car(color, make, speed) {\n this.color = color;\n this.make = make;\n this.speed = speed;\n this.drive = function(speed, make) { console.log(\"The \" + make + \" is driving \" + speed... | [
"0.74377453",
"0.7348721",
"0.7265616",
"0.6743508",
"0.6692832",
"0.66849464",
"0.66726553",
"0.6617407",
"0.66161525",
"0.6610494",
"0.656416",
"0.65438724",
"0.6527263",
"0.65200615",
"0.6496172",
"0.6495241",
"0.6463314",
"0.6429576",
"0.6416479",
"0.6406495",
"0.6401555"... | 0.74469405 | 0 |
Create a function named Model. Set its prototype to the Make function. Define a property `modelName` with a default value of empty string. | function Model () {
this.modelName = "";
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createModel(name, mappings, methods) {\n /*\n * this looks weird. what it is doing is identical to the commented-out\n * Model function below. why we're doing it this way is that if we use\n * the commented-out version, all models created with this helper function\n * will appear in t... | [
"0.736441",
"0.71079105",
"0.67212886",
"0.65496856",
"0.63978666",
"0.63978666",
"0.62949276",
"0.6274179",
"0.6202178",
"0.60905194",
"0.6078804",
"0.6044896",
"0.60037524",
"0.5961307",
"0.58658206",
"0.5863754",
"0.5829947",
"0.5792462",
"0.57360977",
"0.5724725",
"0.5695... | 0.72997236 | 1 |
produce an item/tree for the named type; filling out defaults for all required fields. | static createItem(typeName, ctx=null) {
console.debug("Types.createItem", typeName);
if (typeof typeName !== 'string') {
throw new Error("expected type string");
}
var ret;
const type= allTypes.get( typeName );
if (!type ) {
throw new Error(`unknown type '${typeName}'`);
}
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static _processType(typeItem) {\n switch (typeItem.kind) {\n case 'variable-type':\n return Type.newVariableReference(typeItem.name);\n case 'reference-type':\n return Type.newManifestReference(typeItem.name);\n case 'list-type':\n return Type.newSetView(Manifest._processType... | [
"0.58500165",
"0.57982147",
"0.56861496",
"0.56564534",
"0.5598639",
"0.544062",
"0.544062",
"0.54211783",
"0.53805095",
"0.5370593",
"0.53423005",
"0.53210086",
"0.53138494",
"0.5289265",
"0.52819395",
"0.52743345",
"0.5271153",
"0.5224387",
"0.5216129",
"0.5214395",
"0.5198... | 0.6729465 | 0 |
creates the rating slider for filtering by rating (min = 0, max = 10) | function createRatingSlider(){
// create a range slider for the filter
// modified from: https://materializecss.com/range.html
const slider = document.getElementById('ratingSlider');
noUiSlider.create(slider, {
start: [0, 10],
connect: true,
step: 0.1,
orientation: 'horiz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function RatingSlider({ rating, handleOnRatingChange, initialRating }) {\n\n return (\n <div className=\"row justify-content-md-center my-3\">\n { initialRating ?\n <div className=\"pull-center col-12\">Ratings of <strong><span className=\"rate-color\">{rating}</span>/10</strong> or above</div>... | [
"0.6627384",
"0.6561542",
"0.6540523",
"0.6481119",
"0.63554305",
"0.63042694",
"0.6280117",
"0.6280117",
"0.6123423",
"0.6041436",
"0.60312474",
"0.5973375",
"0.5969273",
"0.5826653",
"0.57068956",
"0.5702316",
"0.56928325",
"0.56841946",
"0.56577665",
"0.5633318",
"0.562259... | 0.83261746 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.