Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
update given currency's rate
function rateUpdate(currency, rate) { document.getElementById(currency).lastChild.innerText = rate; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeRate () {\n var usValue = allRates[currentBank][rateType];\n if (usValue == 0) usValue = 1;\n currentRate = mainCurrency == 'us' ? usValue: 1.0 / usValue;\n}", "static set updateRate(value) {}", "function updatePrice(rate, quantity) {\n totalPrice += rate * quantity;\n console.log(total...
[ "0.761246", "0.74155176", "0.68693125", "0.68636954", "0.67461264", "0.6659202", "0.653797", "0.652924", "0.64960086", "0.64860386", "0.64044845", "0.63820803", "0.63754874", "0.6303256", "0.62808156", "0.6247319", "0.6246051", "0.6241229", "0.62128407", "0.6201062", "0.61769...
0.6727765
5
================================= API call functions ================================= GET latest with default options (base EUR, latest date available)
function APILatest(){ return fetch("https://api.exchangeratesapi.io/latest") .then(response => response.json()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static getLatest() { \r\n return fetch(\"<api-end-point>\").then(result => result.json());\r\n }", "fetchLatest() {\n return new Promise((resolve, reject) => {\n inet_utils_1.InetUtils.getHttp(this.endpoint).then(res => {\n cli_logger_1.Logger.logCyan(\"fetchLate...
[ "0.6789756", "0.67435586", "0.63092226", "0.59402424", "0.58956504", "0.58562756", "0.5767721", "0.57518774", "0.57518774", "0.5742494", "0.57172287", "0.5716364", "0.56819427", "0.5594693", "0.55875796", "0.5563956", "0.5563153", "0.5541688", "0.552778", "0.55039865", "0.546...
0.6606435
2
UI handler functions call upon API to get given day's (or previous) rates with given base currency, updates display
function newRequest(base, date) { APIDate(date, base).then(result => day_rates(result)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getAllRates() {\r\n axios.get(`https://api.exchangeratesapi.io/latest?base=${this.baseCurrency}`)\r\n .then((resp) => {\r\n this.dispatchBaseRates(resp.data.rates);\r\n })\r\n .catch((error) => console.error(error))\r\n }", "functi...
[ "0.7055848", "0.68549967", "0.6777663", "0.67203295", "0.6685183", "0.6634006", "0.662319", "0.66110414", "0.6600682", "0.65862787", "0.65846777", "0.65754443", "0.65744644", "0.6571459", "0.6570158", "0.6550004", "0.6512531", "0.65108395", "0.65092576", "0.6508001", "0.65070...
0.61932176
45
the date of rates to show has changed > make request
function dateChange(date) { newRequest(current_base, date); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkRateUpdate(){\n const dateUpdate = this.state.dateUpdate;\n \n if(typeof dateUpdate === \"number\"){\n const timeSinceLastUpdate = new Date() - dateUpdate;\n const timeMaxWithOutUpdate = 21600000 // 6h = 6 * 60 * 60 * 1000 = 21600000\n\n if (timeSinceLast...
[ "0.68238556", "0.63085014", "0.59809166", "0.59100187", "0.57911134", "0.57701653", "0.5766641", "0.5766641", "0.5766641", "0.5766641", "0.57269454", "0.5717667", "0.5679308", "0.56041795", "0.5596301", "0.55718213", "0.55605173", "0.5546859", "0.5532979", "0.55066645", "0.54...
0.7024889
0
if new base != current base, change currency and update rates
function baseChange(new_base) { if (new_base != current_base) { currency_element = document.getElementById(new_base); if (currency_element.parentNode.id == "timeout"){ return; } else { // exchange classes for display document.getElementById(current_base).classList.toggle("current_base"); document.getElementById(new_base).classList.toggle("current_base"); // update state variable and hidden form current_base = new_base; document.getElementById("base").setAttribute("value", current_base); // GET new rates //TODO: recalculate client-side from known rates newRequest(new_base, document.getElementById("date").value); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeRate () {\n var usValue = allRates[currentBank][rateType];\n if (usValue == 0) usValue = 1;\n currentRate = mainCurrency == 'us' ? usValue: 1.0 / usValue;\n}", "changeBaseCurrency() {\n this.setBaseCurrency( event.target.innerText );\n }", "function changeCurrency() {\n if ...
[ "0.77753097", "0.69727546", "0.69332355", "0.675621", "0.67396486", "0.6653318", "0.6653195", "0.66354585", "0.66269016", "0.6577677", "0.6571358", "0.65710366", "0.65649176", "0.65364087", "0.6511974", "0.6503685", "0.6475953", "0.64495414", "0.64453727", "0.6434703", "0.643...
0.7640752
1
These are algorthim probelms taken off of CodeSignal.com designed to help students and experts keep up on all levels of algos CodeSignal Level 2 : Edge of the Ocean Given an array of integers, find the pair of adjacent elements that has the largest product and return that product.
function adjacentElementsProduct(inputArray) { var max = inputArray[0] * inputArray[1]; // initalizing a max to compare though out the for loop for (var i = 1; i < inputArray.length - 1; i++) { if (inputArray[i] * inputArray[i + 1] > max) { max = inputArray[i] * inputArray[i + 1]; } } return max; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adjacentElementsProduct(inputArray) {\n let greatestProduct = -1000;\n for (i = 0; i < inputArray.length - 1; i++) {\n const product = inputArray[i] * inputArray[i + 1];\n console.log(\"product:\", product + \" index: \" + i);\n if (product > greatestProduct) {\n greatestProduct = product;...
[ "0.75779366", "0.75626177", "0.74970216", "0.7387552", "0.7164683", "0.70579857", "0.67938626", "0.6770695", "0.6735765", "0.6713349", "0.6662709", "0.6624614", "0.65957075", "0.6520634", "0.6472948", "0.64626604", "0.6435874", "0.6425404", "0.6420898", "0.6392384", "0.637289...
0.75208396
2
this algorithm has a visual attached inside the folder to show what is happening for various n's
function shapeArea(n) { let a = 1; // the base case if (n > 1) { a = 2 * (n - 1) * n + 1; // math using addtion of the rows of squares and then polynonial math to simplify } return a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawPattern(n) {\n for (var i = 1; i <= n; i++) {\n var spaces = n - i;\n var hashes = i;\n for (var sp = 0; sp < spaces; sp++) {\n process.stdout.write(\" \");\n }\n for (var has = 0; has < hashes; has++) {\n process.stdout.write(\"#\");\n }\n process.stdout.write(\"\\n\")...
[ "0.57724684", "0.5735787", "0.56877875", "0.5649553", "0.56126046", "0.5586668", "0.55824476", "0.55703884", "0.55536425", "0.5468992", "0.5457023", "0.5449705", "0.5421286", "0.54141057", "0.54037654", "0.53948575", "0.5341256", "0.5329164", "0.53283304", "0.532253", "0.5310...
0.0
-1
Given a sequence of integers as an array, determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array. Note: sequence a0, a1, ..., an is considered to be a strictly increasing if a0 < a1 < ... < an. Sequence containing only one element is also considered to be strictly increasing.
function almostStrictlyIncreasing(arr) { let hasRemove = false; let curr = arr[0]; // creating a pointer to compare three elements at a time for (let i = 1; i < arr.length; i++) { // one for loop makes it O(n) if (curr < arr[i]) { // we want to always be storing the smallest of the 3 elements we are looking at curr = arr[i]; } else { if (hasRemove) { return false; } if (i < 2) { //edge case curr = arr[i] } else { curr = arr[i] <= arr[i - 2] ? curr : arr[i]; // console.log(curr); } hasRemove = true; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function almostIncreasingSequence(sequence) {\n // we might need a variable, a boolean that keeps a track of wether we already removed an element or not.\n let removedNum = false\n let sequenceCopy = [...sequence]\n // we need to iterate over the arr\n for(let i = 0; i < sequenceCopy.length; i++){\n // as we...
[ "0.7663354", "0.75522715", "0.7054664", "0.6665379", "0.6620068", "0.6609417", "0.6518255", "0.65111774", "0.647112", "0.6413827", "0.63961834", "0.6381641", "0.6362585", "0.6358461", "0.6354912", "0.63332015", "0.62842435", "0.62699074", "0.62579495", "0.6242042", "0.6231008...
0.66386324
4
create container and set persistent set env vars and volumes deploy image via dockerfile
function endWithSuccess() { step1Callback({ message: { text: 'Adminer is deployed and available as http://srv-captain--' + data[CONTAINER_NAME] + ' to other apps.', type: SUCCESS }, next: null // this can be similar to step1next, in that case the flow continues... }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildDockerImage() {\n this.serverless.cli.log(`Building docker image: \"${this.provider.naming.getDockerImageName()}\"...`);\n\n // Get any additional run commands we'd like to include in the docker image\n let additionalRunCommands = \"\";\n if (this.serverless.service.custom\n && thi...
[ "0.60154396", "0.5992375", "0.57619923", "0.5759677", "0.57113296", "0.55127364", "0.5390795", "0.5362054", "0.5347046", "0.5236962", "0.5137803", "0.5117072", "0.505962", "0.500996", "0.4954212", "0.4842093", "0.48414856", "0.4822687", "0.47861522", "0.47614595", "0.4751218"...
0.0
-1
Get the browser specific vendor prefix
function getVendorPrefix() { var result; var properties = ["transform", "msTransform", "webkitTransform", "mozTransform", "oTransform"]; for (var i = 0; i < properties.length; i++) { if (typeof document.body.style[properties[i]] != "undefined") { result = properties[i]; break; } } switch (result) { case "msTransform": { return "-ms-"; break; } case "webkitTransform": { return "-webkit-"; break; } case "mozTransform": { return "-moz-"; break; } case "oTransform": { return "-o-"; break; } default: { return ""; break; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBrowserPrefix() {\n for (var i = 0; i < browserPrefixes.length; i++) {\n if(getHiddenPropertyName(browserPrefixes[i]) in document) {\n // return vendor prefix\n return browserPrefixes[i];\n }\n }\n \n // no vendor prefix needed\n return null;\n ...
[ "0.8505398", "0.8499392", "0.824145", "0.81418943", "0.81386495", "0.78952795", "0.7621907", "0.74894327", "0.69175744", "0.6917086", "0.69117224", "0.6894022", "0.68889564", "0.6875775", "0.6873361", "0.68701816", "0.6860845", "0.68528914", "0.6808424", "0.6794318", "0.67875...
0.80919313
5
Get rgb color from color name
function colorToRGB(colorName) { var temp = document.createElement("div"), color; temp.style.color = colorName; document.body.appendChild(temp); color = window.getComputedStyle(temp).color; document.body.removeChild(temp); return color; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getColorRGB(name) {\n\tvar nameLC = name.toLowerCase();\n\tvar leftIndex = 0;\n\tvar rightIndex = AllColorsRGB.length-1;\n\treturn getColorRGBSub(nameLC, leftIndex, rightIndex);\n}", "function colourNameToRGB(colourName) {\n\n}", "function css2rgb (s) {\n return cssColors[s.toLowerCase()]\n}", "fun...
[ "0.82687056", "0.8009727", "0.7455211", "0.7412397", "0.7407731", "0.7371618", "0.71954066", "0.7133266", "0.71200204", "0.70419306", "0.70324934", "0.7031817", "0.7012962", "0.7012466", "0.6971416", "0.6968523", "0.695869", "0.6953004", "0.6953004", "0.6935126", "0.69293565"...
0.7432746
3
Get filename from url
function getUrlFilename(url) { if (typeof url === 'string') { //remove query strings return url.split(/[?#]/)[0].split("/").pop(); } return undefined; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GetFilename(url){\n if (url){\n var m = url.toString().match(/.*\\/(.+?)\\./);\n if (m && m.length > 1){\n return m[1];\n }\n }\n return \"\";\n}", "function getFilename(url) {\n return url.split('/').pop();\n }", "function getFilename(url) {\n var lastSlashPos = ur...
[ "0.86758035", "0.8649319", "0.8345061", "0.83043873", "0.830406", "0.8120134", "0.76067877", "0.7205012", "0.712939", "0.7040149", "0.7039205", "0.7022591", "0.6936437", "0.69332385", "0.6928851", "0.6906016", "0.6814664", "0.67261726", "0.6698929", "0.6698809", "0.6634044", ...
0.8331504
3
The actual plugin constructor
function Plugin(el, options) { var self = this; this.$el = $(el); this.isLoaded = false; this.grid = null; this.settings = $.extend({}, defaults, options); validateSettings(this.settings); if (this.settings.color != "chroma") this.settings.color = colorToRGB(this.settings.color); if (chromaScreen == null) { chromaScreen = new ChromaScreen(); //force the icons to load this.$el.append("<span class='chrg-loadicon chrgi-image'></span>"); setTimeout(function () { self.$el.find(".chrg-loadicon").remove(); }, 100); } this._init(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this._init();\n }", "constructor() {\n\t\t// ...\n\t}", "consructor() {\n }", "constructor() {\r\n super()\r\n this.init()\r\n }", "init() {\n }", "constructor()\n {\n this.init();\n }", "function contruct() {\n\n ...
[ "0.7422684", "0.7349132", "0.7314277", "0.73003334", "0.7299704", "0.7292701", "0.72775894", "0.72354233", "0.7233936", "0.7181569", "0.71798736", "0.71798736", "0.71798736", "0.71798736", "0.71798736", "0.71761876", "0.7157667", "0.71499527", "0.71496284", "0.71496284", "0.7...
0.0
-1
" Script Title : " " Script Date : Sun Sep 13 21:50:51 2020 " "'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function Action() { web.url( { name : 'dd.xml', url : 'http://192.168.0.22:37616/dd.xml', resource : 1, recContentType : 'application/xml', referer : '', snapshot : 't23.inf' } ); web.url( { name : 'dd.xml_2', url : 'http://192.168.0.43:8060/dial/dd.xml', resource : 0, recContentType : 'text/xml', referer : '', snapshot : 't24.inf', mode : 'HTML', extraRes : [ {url : 'http://192.168.0.38:8008/ssdp/device-desc.xml', referer : ''} ] } ); web.setSocketsOption('SSL_VERSION', '2&3'); // Possible OAUTH authorization was detected. It is recommended to correlate the authorization parameters. lr.thinkTime(5); web.customRequest( { name : 'token', url : 'https://www.googleapis.com/oauth2/v4/token', method : 'POST', resource : 0, recContentType : 'application/json', referer : '', snapshot : 't25.inf', mode : 'HTML', body : 'client_id=77185425430.apps.googleusercontent.com&client_secret=OTJgUOQcT7lO7GsGZq2G4IlT&grant_type=refresh_token&refresh_token=1//0gn8Vfq1TXqA1CgYIARAAGBASNwF-L9IriNk8rl1QSND-iNc4nO_b0j5D46FnShXD209P8CjIDLfT-xfYzUUj6KUNMTMPyDyEsDE' } ); web.addCookie('LSOLH=|_SVI_Ch9BN2lTVmNmZkNURVR3TEM4U1VQdkI1WUZqbUpvR0JjEMWwuuDX7ugCGBAiP01BRURIZl9xakpDb2xuZWxDRDBMSWtuZEpwdmxNVXdIdnEyMXcycU54QktIRWhaeWZnLXJfSlpFS3lJQmhMMA_:|26451679:8129; DOMAIN=accounts.google.com'); web.addCookie('SEARCH_SAMESITE=CgQIrZAB; DOMAIN=accounts.google.com'); web.addCookie('ACCOUNT_CHOOSER=AFx_qI76SMzCk8KuZNc2GoZyS62UO2MgZNj623Hh3Jb6N9_VCWr-6IOxAgSd4mrqSj9Xz674CXAonblKr2klMoiIB7PxQyQ0JfcfOlvF-MJB9hdm6t857yNzKhkVHX4cktCU1HfndNYaDVYL12Gp1pctOpcHK1CvXsgAtpMDKdYFevxZPXOzauWcyR6kF3u_y-ccvBPYSAhVuVmmGxjGY97a3Kx9AEq1sg; DOMAIN=accounts.google.com'); web.addCookie('OGPC=19018621-1:19019710-1:19019903-1:19019990-1:19020037-1:; DOMAIN=accounts.google.com'); web.addCookie('SID=1AdpJEmRkjuvcFPyokYAoRFgLJOCR7zP3jDUQ-E5CvFj3HOfI0RU350EGoie-Wh_kANBUA.; DOMAIN=accounts.google.com'); web.addCookie('__Secure-3PSID=1AdpJEmRkjuvcFPyokYAoRFgLJOCR7zP3jDUQ-E5CvFj3HOf9yYwYLpdTXU5gFkz7VnRCQ.; DOMAIN=accounts.google.com'); web.addCookie('HSID=AxsCq0UEQOedosZkK; DOMAIN=accounts.google.com'); web.addCookie('SSID=As4SYfcrexlNv_Ra1; DOMAIN=accounts.google.com'); web.addCookie('APISID=VMjAkefyvlfZlqAe/AXj4FpGLTEvj5cgU0; DOMAIN=accounts.google.com'); web.addCookie('SAPISID=ieKIFJSgZYuHeBGP/ALI0UdrDs9q_-U-2e; DOMAIN=accounts.google.com'); web.addCookie('__Secure-3PAPISID=ieKIFJSgZYuHeBGP/ALI0UdrDs9q_-U-2e; DOMAIN=accounts.google.com'); web.addCookie('ANID=AHWqTUmosKig2Z69CfKLyq8y9PCr9PV0pQUwSTarmGOd8UH0j31RTdtSJyD6YKwN; DOMAIN=accounts.google.com'); web.addCookie('LSID=doritos|lso|o.calendar.google.com|o.groups.google.com|o.mail.google.com|o.myaccount.google.com|o.smartlock.google.com|s.AU|s.blogger|s.youtube|ss:1AdpJJnX8nrHNeELnbxWABZpiTEK6KDnZ4-20REIF2HkWU7tGooIe4CgkotuG5O95N2vgw.; DOMAIN=accounts.google.com'); web.addCookie('__Host-3PLSID=doritos|lso|o.calendar.google.com|o.groups.google.com|o.mail.google.com|o.myaccount.google.com|o.smartlock.google.com|s.AU|s.blogger|s.youtube|ss:1AdpJJnX8nrHNeELnbxWABZpiTEK6KDnZ4-20REIF2HkWU7tzMUacTOtT2vnpl58LgifkA.; DOMAIN=accounts.google.com'); web.addCookie('__Host-GAPS=1:lh2mlqXJu2DrL1RbnU1SZ5x2TqDPlduN3Aw4fRRofGa-cqPApsXM4ozyLiPM771imvalslEASGllqkVCgLCwckCeO0XiEw:UmJ7gXRAvPQwMhCs; DOMAIN=accounts.google.com'); web.addCookie('NID=204=BrusSTImAJYr3ud0lW2CeZlWx0m79MZxLcjAHbJ7Kv8LxYvgJQMWyZ9uPhiP-Nr2HBJ7j2-OOJ84DS9LevHTFaSro0OIB58_tzvZ7C4dAIxXV4zjhU1boCrteKx9gv5S8xMLWdfQ1DnO6GoKqFAzFF7825Q393KDrUAusqYLfcZSNCFmIovumJj16HwwKrHx2HB8feqKoYzXwXIOH8bOpleXi1KDkb7tsp2N2cl70hV177XMAQkF2z9q3KH302vXwi1j09CZoHz4U94z_OTgpZ1XYlortdubtFhwCAFyJaNOvXLgaLDomz2RZ-Sy-vMU-ACOOzJJTuDT5GtmOS-SJNIb5x0hUrsQaHOkliumYvOBFEByD5N_-WloGDacLDORhPACg2MdCxc6NwGGQ1c; DOMAIN=accounts.google.com'); web.addCookie('1P_JAR=2020-09-13-11; DOMAIN=accounts.google.com'); web.addCookie('SIDCC=AJi4QfHCdNNu4e3v6Zc84CAPOUxZ3rs2qvFNvqPjLzzCQgRIbwmZwYUQzMmEjEDM39zVOPDyHFs; DOMAIN=accounts.google.com'); web.addCookie('__Secure-3PSIDCC=AJi4QfF9gGvWSlYRYT5Xk7MxPfypDmszLQ_NaObgZw2qy-EQ2eTO4-mwjbokRuF2UxhNTz92Sjg; DOMAIN=accounts.google.com'); web.customRequest( { name : 'ListAccounts', url : 'https://accounts.google.com/ListAccounts?gpsia=1&source=ChromiumBrowser&json=standard', method : 'POST', resource : 0, recContentType : 'application/json', referer : '', snapshot : 't26.inf', mode : 'HTML', body : ' ' } ); web.url( { name : 'seed', url : 'https://clientservices.googleapis.com/chrome-variations/seed?osname=win&channel=stable&milestone=85', resource : 0, referer : '', snapshot : 't27.inf', mode : 'HTML' } ); web.customRequest( { name : 'token_2', url : 'https://www.googleapis.com/oauth2/v4/token', method : 'POST', resource : 0, recContentType : 'application/json', referer : '', snapshot : 't28.inf', mode : 'HTML', body : 'client_id=77185425430.apps.googleusercontent.com&client_secret=OTJgUOQcT7lO7GsGZq2G4IlT&grant_type=refresh_token&refresh_token=1//0gn8Vfq1TXqA1CgYIARAAGBASNwF-L9IriNk8rl1QSND-iNc4nO_b0j5D46FnShXD209P8CjIDLfT-xfYzUUj6KUNMTMPyDyEsDE&scope=https://www.googleapis.com/auth/chromesync' } ); return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Syntax()\r\n{\r\n var str =\r\n \"\\nDisplays or changes the current AllSrv EventLog server\\\\database\\\\table\\n\\n\"\r\n + \"Usage:\\n\\n\"\r\n + \" EventLogDB\\n\"\r\n + \" EventLogDB new_database_server\\\\database_name\\\\table_name\\n\\n\"\r\n // ----+----1----+----2----+----3---...
[ "0.58282375", "0.5415876", "0.5297184", "0.52508056", "0.5242654", "0.514065", "0.51013356", "0.5064932", "0.5064822", "0.50498706", "0.5047763", "0.50262547", "0.50224286", "0.5013315", "0.5006058", "0.4995002", "0.4977262", "0.4968951", "0.4955225", "0.49477196", "0.4941193...
0.0
-1
Send a message through the socket io
function sendMessage(event, message) { if(!mInitialized) { logger.warn('[socket-io] SocketIO is not initialized yet. Message cannot be sent.'); return null; } if(typeof message !== 'object') { logger.error('[socket-io] Message must be instanced of an object'); return null; } if(!message.id) { message.id = getUuid(); } logger.debug('[socket-io] sending message.', message); mSocket.emit(event, message); return message; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "send_message(message) {\n this.socket.send(message)\n }", "sendMessage(message) {\n self.socket.emit('message', message);\n }", "sendMessage(message) {\n this.socket.emit('message', message);\n }", "sendMessage(msg){\n this.socket.emit(\"client\", msg);\n }", "function sendMessa...
[ "0.8347874", "0.8197854", "0.8189819", "0.81272733", "0.80289936", "0.79081935", "0.78519994", "0.7726397", "0.7726397", "0.77181166", "0.7699171", "0.7625255", "0.75941515", "0.7578799", "0.75604457", "0.7512391", "0.749633", "0.74763256", "0.74634403", "0.74575", "0.7433256...
0.7217055
41
to bind arguments in the right order
function bindLastArgs(func, ...boundArgs) { return function(...baseArgs) { return func(...baseArgs, ...boundArgs); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bind(e,t){return function(){return t.apply(e,arguments)}}", "function bindAll(obj, rest_methodNames){\n\t var keys = arguments.length > 1?\n\t slice(arguments, 1) : functions(obj);\n\t forEach(keys, function(key){\n\t obj[key] = bind(obj[key], obj);\n\t ...
[ "0.6339624", "0.6179494", "0.61579794", "0.61268896", "0.6098452", "0.6093571", "0.6078842", "0.60740316", "0.59838414", "0.59652567", "0.5950213", "0.592349", "0.592349", "0.58733356", "0.5838824", "0.5826443", "0.5811871", "0.5776053", "0.57749194", "0.57636523", "0.5752319...
0.58993113
13
const Hash = require('ethlib/lib/hash')
function recover (message, signature, preFixed) { // if (!preFixed) { // message = hashMessage(message) // } return AccountLib.recover(message, signature) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Hash() {}", "function Hash() {}", "createHash() {\n return crypto.createHash(sha256);\n }", "function getHash(input) {\n return crypto.createHash(HASH_ALGO).update(input).digest('hex');\n}", "hash(input) {\n var hash = crypto.createHash('SHA256').update(input).digest('base64');\n ...
[ "0.6831328", "0.6831328", "0.64566994", "0.6370225", "0.63451433", "0.6331057", "0.62820363", "0.6253936", "0.6244649", "0.62189555", "0.6201864", "0.619763", "0.61919403", "0.6183146", "0.6180003", "0.6180003", "0.6180003", "0.61634576", "0.61290514", "0.6113615", "0.6090181...
0.0
-1
============================================================================ Connecting the ItemListUI to the Redux Store results in a new React component that can talk to the Store, and provide the UIcomponent with both dataprops and props containing functions to change the store. What pieces of the Redux Store should be passed to the ItemListUI as dataprops?
function mapStateToProps(state) { return { statuses: state.hnItems.statuses, listSize: state.prefs.currentListSize, selectedItem: state.hnItems.selectedItem, items: state.hnItems.items }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount() {\n this.props.getItems(); // calling the getItems action function everytime the component mounts which will add the items from db to the redux store so we can use it with react\n }", "constructor(props) {\n super(props)\n this.state = {\n list: [Login, Database, Servers, Websi...
[ "0.6468653", "0.6401795", "0.6349278", "0.6302506", "0.6233283", "0.622633", "0.61723995", "0.6153837", "0.6119619", "0.6107002", "0.6012966", "0.59878016", "0.596069", "0.5904298", "0.59039676", "0.5879047", "0.5870105", "0.5857768", "0.5832064", "0.58305115", "0.58289534", ...
0.55578613
42
============================================================================ A bunch of functional components to help render parts of the ItemList. Note how we choose not to connect the ListItem component. It can get its data and functions in the normal react way, because it was never a stateful component.
function ListHeader(props) { return ( <header id="ListHeader" className="panelHeader"> <Logo/>{' '} <span className="settingsIcon" onClick={props.doShowPrefs}> <SettingsIcon/> </span> </header> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function List(props){\n // the return is JSX that renders content\n // map takes an iterated item (object) from an array and corresponding index position\n console.log(props.itemList);\n\n return (\n <div>\n <hr/>\n {Object.keys(props.itemList).map((itemId) => {\n let item = props.itemList[...
[ "0.7539896", "0.7100483", "0.7082814", "0.7053092", "0.68697286", "0.68060225", "0.67752767", "0.67734855", "0.6744398", "0.6673171", "0.66574866", "0.66328835", "0.6603398", "0.6560499", "0.6555538", "0.6534529", "0.6533988", "0.6522465", "0.65148747", "0.6514132", "0.650138...
0.0
-1
sets the render loop state based on page's visibility
function handleDocumentVisibilityChange() { document.hidden ? stage.render.pause() : stage.render.resume(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleVisibilityChange() {\n if (document.hidden) {\n clearInterval(gameLoop);\n gameLoop = false;\n } else {\n gameLoop = startGameLoop();\n requestRender();\n }\n}", "onBecameVisible() {\n\n // Start rendering if needed\n if (!this.isRendering) {\n this.isRende...
[ "0.7349588", "0.68171394", "0.66750413", "0.6414819", "0.6274423", "0.6209494", "0.6209494", "0.61478233", "0.61149025", "0.6100365", "0.6064753", "0.60378283", "0.6019725", "0.60167575", "0.6007485", "0.5995984", "0.59495914", "0.5932772", "0.5890853", "0.58775806", "0.58701...
0.6254929
5
invoked when page has loaded registers window and document level event listeners required post object instantiation
function initListeners() { // resize canvas on window resize window.addEventListener( "resize", stage.resize); // pause and resume rendering loop when visibility state is changed document.addEventListener( "visibilitychange", handleDocumentVisibilityChange); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n setDomEvents();\n }", "onDOMReady() {\n\n\t\t\t// resize the canvas to fill browser window dynamically\n\t\t\twindow.addEventListener('resize', _onWindowResize, false);\n\t\t\t_onWindowResize();\n\t\t\t\n\t\t\t// Stop generic mouse events from propagating up to the document\n\t\t\tl...
[ "0.72526467", "0.71865726", "0.71388274", "0.7107237", "0.70587134", "0.7035369", "0.701863", "0.7014466", "0.69980234", "0.6961953", "0.692175", "0.68880177", "0.6870476", "0.68669003", "0.6827683", "0.68262094", "0.6824543", "0.6823731", "0.68191415", "0.6809931", "0.679319...
0.0
-1
invoked when page has loaded performs setup of stage and particles triggers the rendering loop
function initObjects() { particles = new ParticleGroup(); // create our stage instance stage = new Stage(document.querySelector("canvas")); // init the canvas bounds and fidelity stage.resize(); // populate particle group collection particles.populate(); // begin stage rendering with the renderAll draw routine on each tick stage.render.begin( particles.render.bind(particles)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "start() {\r\n\t\tthis.particles = [];\r\n\t\tthis._gameLoop()\r\n\t}", "setup() {\n\t\tthis.stage.removeAllChildren();\n\t\tthis.initBackground();\n\t\tthis.initReceptors();\n\t\tthis.initNotetrack();\n\t\tthis.initStats();\n\t\tthis.initTimeline();\n\t\tthis.initBackButton();\n\t}", "preload () {\n\t\tgame.st...
[ "0.71894497", "0.68482816", "0.6826072", "0.68204117", "0.67907554", "0.6785098", "0.67266387", "0.67149633", "0.67051125", "0.6648356", "0.6635603", "0.6618255", "0.6611027", "0.6598702", "0.659653", "0.6572881", "0.657135", "0.65504307", "0.6537074", "0.6526216", "0.6500258...
0.671523
7
renders an FPS value to the canvas topleft corner
function renderFPS(value) { context.save(); context.font = 10 * stage.pixelRatio + "px sans-serif"; context.fillStyle = "white"; context.textBaseline = "top"; context.fillText(value, 5 * stage.pixelRatio, 5 * stage.pixelRatio); context.restore(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawFPS() {\n if (fps === 0)\n return;\n\n ctx.font = '16px Arial';\n ctx.fillStyle = fpsColor;\n ctx.textAlign = 'right';\n ctx.fillText(fps, width - 10, 20);\n }", "function displayFPS() {\r\n let fps = frameRate();\r\n fill(255);\r\n stroke(0);\r\n text(\"FPS: \" + fps.toFixe...
[ "0.77180517", "0.7232161", "0.7231333", "0.6888497", "0.67679864", "0.6764411", "0.6583339", "0.6479671", "0.6472752", "0.64609236", "0.64305574", "0.642708", "0.640843", "0.6397963", "0.63955104", "0.63780487", "0.6337414", "0.63166237", "0.62993306", "0.62826234", "0.627972...
0.81214917
0
Paricle object construct: stores critical particle information regarding trajectory and location v: distance delta coefficient t: angular theta in degrees r: particle radius p: position on stage, x:y coordinate properties influence: radial influence of connectivity to other particles defines methods relating to particle rendering and comparison to other particle locations
function Particle(props) { // private particle properties var x = props.x || 0, y = props.y || 0, v = props.speed, t = props.theta, r = props.radius, influence = props.influence, color = props.color; // public properties and methods return { // position property getter: read-only get x() { return x; }, get y() { return y; }, // compares this particle location to another // returns a coefficient describing the ratio of closeness to particle influence influencedBy: function(a, b) { var hyp = Math.sqrt(Math.pow(a - x, 2) + Math.pow(b - y, 2)); return Math.abs(hyp) <= influence ? hyp / influence : 0; }, // render this particle to a given context render: function(ctx) { ctx.strokeStyle = color; ctx.lineWidth = 1 / r * r * stage.pixelRatio; ctx.beginPath(); ctx.arc(x || 10, y || 10, r, 0, 8); ctx.stroke(); }, // sets the position of this particle compared to its previous position // in relation to a total time delta since last positioning // positions infinitely loop within canvas bounds setPosition: function(timeDelta) { x += timeDelta / v * Math.cos(t); x = x > stage.width + r ? 0 - r : x; x = x < 0 - r ? stage.width + r : x; y += timeDelta / v / 2 * Math.sin(t); y = y > stage.height + r ? 0 - r : y; y = y < 0 - r ? stage.height + r : y; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Particle( x, y, z, mass,clothType ) {\n\tthis.position = new THREE.Vector3( x, y, z ).applyMatrix4(clothWorldMaths[clothType]);; // position\n\tthis.previous = new THREE.Vector3( x, y, z ).applyMatrix4(clothWorldMaths[clothType]);; // previous\n\t//this.original = new THREE.Vector3( -x, -y, -z ).applyMatr...
[ "0.6954294", "0.6926914", "0.682531", "0.679049", "0.66955096", "0.6682631", "0.66662246", "0.6660992", "0.66033196", "0.6602365", "0.6583229", "0.65821916", "0.6548962", "0.65478516", "0.6518588", "0.65103346", "0.65103346", "0.64966416", "0.6488436", "0.6481767", "0.6463267...
0.71717083
0
position property getter: readonly
get x() { return x; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get position() { return this._position; }", "get position() { return this._position; }", "get position() {\n return this._position;\n }", "get position() {\n\t\t\treturn {x: this.x, y: this.y};\n\t\t}", "get position() {\n return {\n x: this.x,\n y: this.y\n };\n ...
[ "0.84036463", "0.84036463", "0.81329423", "0.79884356", "0.79807997", "0.79523283", "0.79355067", "0.7516045", "0.74344975", "0.73971224", "0.73344284", "0.7279214", "0.7244633", "0.7239078", "0.71891975", "0.71810365", "0.7124599", "0.71165097", "0.7100535", "0.70594", "0.69...
0.0
-1
ParticleGroup object construct an object which controls higher level methods to create, destroy and compare a grouping of Particle instances. Holds a private collection of all existing particles
function ParticleGroup() { // particle instance array var _collection = [], // cache connector option property values _connectColor = options.connector.color, _connectWidth = options.connector.lineWidth, _particleCount = options.particle.count; // generates and returns a new particle instance with // randomized properties within ranges defined in the options object function _generateNewParticle() { return new Particle({ x: stage.width * Math.random(), y: stage.height * Math.random(), speed: getRandomWithinRange(options.particle.velocityRange) / stage.pixelRatio, radius: getRandomWithinRange(options.particle.sizeRange), theta: Math.round(Math.random() * 360), influence: options.particle.influence * stage.pixelRatio, color: options.particle.color }); // random number generator within a given range object defined by a max and min property function getRandomWithinRange(range) { return ((range.max - range.min) * Math.random() + range.min) * stage.pixelRatio; } } // loops through particle collection // sets the new particle location given a time delta // queries other particles to see if a connection between particles should be rendered function _checkForNeighboringParticles(ctx, p1) { // cache particle influence method var getInfluenceCoeff = p1.influencedBy; // particle collection iterator for (var i = 0, p2, d; i < _particleCount; i++) { p2 = _collection[i]; // conditional checks - ignore if p2 is the same as p1 // or if p2 has already been iterated through to check for neighbors if (p1 !== p2 && !p2.checked) { // compare the distance delta between the two particles d = getInfluenceCoeff(p2.x, p2.y); // render the connector if coefficient is non-zero if (d) { _connectParticles(ctx, p1.x, p1.y, p2.x, p2.y, d); } } } } // given two particles and an influence coefficient between them, // renders a connecting line between the two particles // the coefficient determines the opacity (strength) of the connection function _connectParticles(ctx, x1, y1, x2, y2, d) { ctx.save(); ctx.globalAlpha = 1 - d; ctx.strokeStyle = _connectColor; ctx.lineWidth = _connectWidth * (1 - d) * stage.pixelRatio; ctx.beginPath(); ctx.moveTo(x1, y1); ctx.lineTo(x2, y2); ctx.stroke(); ctx.restore(); } // public object return { // returns the size of the collection get length() { return _collection.length; }, // adds a particle object instance to the collection add: function(p) { _collection.push(p || _generateNewParticle()); }, // initial population of bar collection populate: function() { for (var i = 0; i < _particleCount; i++) { this.add(); } }, // loops through all particle instances within collection and // invokes instance rendering method on a given context at tick coefficient t render: function(ctx, t) { // loop through each particle, position it and render for (var i = 0, p; i < _particleCount; i++) { p = _collection[i]; p.checked = false; p.setPosition(t); p.render(ctx); } // loop through each particle, check for connectors to be rendered with neighboring particles for (var i = 0, p; i < _particleCount; i++) { p = _collection[i]; _checkForNeighboringParticles(ctx, p); p.checked = true; } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "AddParticleGroup(group) {\n this.m_particleGroups.push(group);\n }", "function ShaderParticleGroup( options ) {\n var that = this;\n\n that.fixedTimeStep = parseFloat( options.fixedTimeStep || 0.016 );\n\n // Uniform properties ( applied to all particles )\n ...
[ "0.72855717", "0.6753342", "0.67208356", "0.6392075", "0.6260642", "0.6238865", "0.6127212", "0.607939", "0.60537565", "0.6039142", "0.5987615", "0.5886198", "0.585662", "0.58550245", "0.5838522", "0.5835218", "0.5824207", "0.5813677", "0.57981443", "0.5787362", "0.5753566", ...
0.8085023
0
generates and returns a new particle instance with randomized properties within ranges defined in the options object
function _generateNewParticle() { return new Particle({ x: stage.width * Math.random(), y: stage.height * Math.random(), speed: getRandomWithinRange(options.particle.velocityRange) / stage.pixelRatio, radius: getRandomWithinRange(options.particle.sizeRange), theta: Math.round(Math.random() * 360), influence: options.particle.influence * stage.pixelRatio, color: options.particle.color }); // random number generator within a given range object defined by a max and min property function getRandomWithinRange(range) { return ((range.max - range.min) * Math.random() + range.min) * stage.pixelRatio; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createParticle(limits, size, sizeVariance, speed, emmitAngle) {\n var particle = {};\n var speed = speed + Math.random() * speed * this.speedVariance;\n particle.size = size + Math.random() * size * sizeVariance;\n particle.color = this.getRandomColor();\n particle.position = this.getRandomPosition(...
[ "0.74851036", "0.7247469", "0.71392226", "0.70040107", "0.6966195", "0.694453", "0.68271", "0.6791166", "0.67348284", "0.65737045", "0.6556467", "0.64611024", "0.6427572", "0.642559", "0.63383234", "0.6329465", "0.6325272", "0.6318862", "0.63096976", "0.62978864", "0.62882745...
0.75316447
0
random number generator within a given range object defined by a max and min property
function getRandomWithinRange(range) { return ((range.max - range.min) * Math.random() + range.min) * stage.pixelRatio; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "range(max, min){\n let num = Math.round(Math.random()*(min-max)+max);\n return num;\n}", "range(min, max) {\n\t\tlet r = Math.floor(Math.random() * max);\n\t\twhile(r < min)\n\t\t\tr = Math.floor(Math.random() * max);\n\t\treturn r;\n\t}", "range(min, max) {\n return lerp(min, max, Math.random())\n }"...
[ "0.829194", "0.8240162", "0.8190861", "0.8007563", "0.799668", "0.799668", "0.79546565", "0.79403424", "0.7939152", "0.79119116", "0.7901228", "0.7858549", "0.7850059", "0.78481555", "0.7835395", "0.7834641", "0.78286034", "0.78193796", "0.78157103", "0.78136396", "0.78103155...
0.0
-1
loops through particle collection sets the new particle location given a time delta queries other particles to see if a connection between particles should be rendered
function _checkForNeighboringParticles(ctx, p1) { // cache particle influence method var getInfluenceCoeff = p1.influencedBy; // particle collection iterator for (var i = 0, p2, d; i < _particleCount; i++) { p2 = _collection[i]; // conditional checks - ignore if p2 is the same as p1 // or if p2 has already been iterated through to check for neighbors if (p1 !== p2 && !p2.checked) { // compare the distance delta between the two particles d = getInfluenceCoeff(p2.x, p2.y); // render the connector if coefficient is non-zero if (d) { _connectParticles(ctx, p1.x, p1.y, p2.x, p2.y, d); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update(){\n\t\t\tfor(var i=0;i<particles.length;i++){\n\t\t\t\tvar p = particles[i];\n\n\t\t\t\t//Get distance between mouse and particle origin to see if particles should be affected by the mouse\n\t\t\t\tvar distanceorx = mouseX-p.orX;\n\t\t\t\tvar distanceory = mouseY-p.orY;\n\t\t\t\tvar distanceor = M...
[ "0.7213489", "0.70616245", "0.66962945", "0.6606778", "0.65849966", "0.6578582", "0.65508014", "0.6549707", "0.65288556", "0.6507623", "0.6478517", "0.64733064", "0.6447648", "0.64340925", "0.6377845", "0.6337875", "0.6273932", "0.626222", "0.6242222", "0.6219883", "0.6219883...
0.0
-1
given two particles and an influence coefficient between them, renders a connecting line between the two particles the coefficient determines the opacity (strength) of the connection
function _connectParticles(ctx, x1, y1, x2, y2, d) { ctx.save(); ctx.globalAlpha = 1 - d; ctx.strokeStyle = _connectColor; ctx.lineWidth = _connectWidth * (1 - d) * stage.pixelRatio; ctx.beginPath(); ctx.moveTo(x1, y1); ctx.lineTo(x2, y2); ctx.stroke(); ctx.restore(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function connect() {\n\tlet opacityValue = 1;\n\t// loop through all article and compare each particle with the rest of the particles\n\tfor (let a = 0; a < particleArray.length; a++) {\n\t\tfor (let b = a; b < particleArray.length; b++) {\n\t\t\tlet dx = particleArray[a].x - particleArray[b].x;\n\t\t\tlet dy = pa...
[ "0.6735768", "0.66838086", "0.65216315", "0.6386937", "0.6362347", "0.61969066", "0.6190527", "0.5991249", "0.59821826", "0.59290457", "0.5850204", "0.5788814", "0.57787627", "0.57339597", "0.57295424", "0.56974804", "0.5684453", "0.56444514", "0.5636302", "0.5630275", "0.561...
0.63992935
3
returns the size of the collection
get length() { return _collection.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function size(collection) {\n return collection.length;\n}", "size() {\n return this.collection.length;\n }", "size() { return this.collection.length }", "get size() {\n return _(this).collection.length;\n }", "get size() {\n return _(this).collection.length;\n ...
[ "0.87524766", "0.8636201", "0.85926175", "0.8553319", "0.8553319", "0.84365124", "0.8308433", "0.8308433", "0.8057132", "0.7899526", "0.78319705", "0.7824463", "0.7777237", "0.77677965", "0.7752511", "0.77243495", "0.7683644", "0.76759905", "0.7628747", "0.76261246", "0.75562...
0.8434961
6
Stage object construct provides a structure to store a canvas and its context upon isntantiation provides methods to interact with and adjust the canvas
function Stage(canvasEl) { // canvas element reference var canvas = canvasEl instanceof Node ? canvasEl : document.querySelector(canvasEl), // 2d context reference context = canvas.getContext("2d"), // cache the device pixel ratio pixelRatio = window.devicePixelRatio; // resize the canvas initially to fit its containing element function _adjustCanvasBounds() { var parentSize = canvas.parentNode.getBoundingClientRect(); canvas.width = parentSize.width; canvas.height = parentSize.height; } // updates the canvas dimensions relative to the device's pixel ratio for highest fidelity and accuracy function _adjustCanvasFidelity() { canvas.style.width = canvas.width + "px"; canvas.style.height = canvas.height + "px"; canvas.width *= pixelRatio; canvas.height *= pixelRatio; } // public object returned return { // dimension getters get height() { return canvas.height; }, get width() { return canvas.width; }, get pixelRatio() { return pixelRatio; }, init: function(el) { canvas = el; context = canvas.getContext("2d"); }, resize: function() { _adjustCanvasBounds(); _adjustCanvasFidelity(); }, render: (function() { // a flag indicating state of animation loop var paused = false, // animation request ID reported during loop requestID = null, // reference to a function detailing all draw operations per frame of animation renderMethod; // public methods return { // once invoked, creates a rendering loop which in turn invokes // drawMethod argument, passing along the delta (in milliseconds) since the last frame draw begin: function(drawMethod) { // cache the draw method to invoke per frame renderMethod = drawMethod; // a reference to requestAnimationFrame object // this should also utilize some vendor prefixing and a setTimeout fallback var requestFrame = window.requestAnimationFrame, // get initial start time latestTime, startTime = Date.now(), // during each interval, clear the canvas and invoke renderMethod intervalMethod = function(tick) { this.clear(); renderMethod( context, tick); }.bind(this); // start animation loop (function loop() { // calculate tick time between frames var now = Date.now(), tick = now - latestTime || 1; // update latest time stamp latestTime = now; // report tick value to intervalCallback intervalMethod(tick); // loop iteration if no pause state is set requestID = paused ? null : requestAnimationFrame(loop); })(); }, // clears the stage's canvas clear: function() { context.clearRect(0, 0, canvas.width, canvas.height); }, // pause the canvas rendering pause: function() { paused = true; cancelAnimationFrame(requestID); }, // resumes the animation with a given rendering method resume: function() { paused = false; this.begin(renderMethod); } } }()) }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupStage() {\n stage = new createjs.Stage(document.getElementById('canvas'));\n createjs.Ticker.setFPS(60);\n createjs.Ticker.addEventListener(\"tick\", function (e) {\n stage.update();\n });\n}", "render() {\n return (\n <canvas className=\"scene\" ref={ el => this.stage = ...
[ "0.71826893", "0.69983387", "0.6902372", "0.681853", "0.6761338", "0.6708181", "0.6694685", "0.665689", "0.66144633", "0.66089094", "0.65864515", "0.65783805", "0.6577889", "0.6543826", "0.65338916", "0.6525463", "0.6499473", "0.64937085", "0.64737415", "0.6466846", "0.646620...
0.7268047
0
resize the canvas initially to fit its containing element
function _adjustCanvasBounds() { var parentSize = canvas.parentNode.getBoundingClientRect(); canvas.width = parentSize.width; canvas.height = parentSize.height; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resize_canvas() {\n\t\t\tcanvas_elem.width = window.innerWidth / 2;\n\t\t\tcanvas_elem.height = window.innerWidth / 2;\n\n\t\t\tupdate_needed = true;\n\t\t}", "function resize() {\n\t\t\tcanvas.width = container.offsetWidth;\n\t\t\tcanvas.height = container.offsetHeight;\n\t\t}", "function resizeCanva...
[ "0.8299266", "0.8273515", "0.81563354", "0.80780077", "0.80456334", "0.8002118", "0.79955137", "0.7897859", "0.78821146", "0.78651285", "0.7785966", "0.7765786", "0.7751547", "0.7737329", "0.77371186", "0.7731429", "0.7720765", "0.77178705", "0.77173406", "0.7706378", "0.7678...
0.75942916
23
updates the canvas dimensions relative to the device's pixel ratio for highest fidelity and accuracy
function _adjustCanvasFidelity() { canvas.style.width = canvas.width + "px"; canvas.style.height = canvas.height + "px"; canvas.width *= pixelRatio; canvas.height *= pixelRatio; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScreenSize(){\n//updates width to be propotional to screen size\n canvasWidth = window.innerWidth*4/5;//2/3\n //updates height be propotional to the width\n canvasHeight = canvasWidth * 1/resolution;\n\t\n//this line updates the size of the canvas to the screen\t\n\tcanvas.style.width = canvasWidth+...
[ "0.7933569", "0.7865358", "0.76066124", "0.7564966", "0.7532874", "0.75174075", "0.75127923", "0.7510354", "0.7501026", "0.7495016", "0.7451179", "0.7432083", "0.7405967", "0.73771316", "0.73414344", "0.7340883", "0.73239756", "0.7286389", "0.72721386", "0.7270532", "0.724999...
0.7842629
2
endregion region Add Item To cart
function addToCart(pid) { if (sessionStorage.getItem("email") === null) { alert("Please login or signup") } else { console.log(sessionStorage.getItem("email")) $.post( '/addtocart', { id:pid, uemail:sessionStorage.getItem("email") }, (data) => { if (data.success) { updateCart() refreshList() alert("Added Successfully..") } else { alert(data.err) refreshList() } } ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addItemToCart() {}", "function addItemToCart() {}", "function addItemToCart(user, item) {}", "function addToCart(item) {\n\t// create item in cart\n\tconst row = document.createElement('tr');\n\n\trow.innerHTML = `\n\t\t<td>\n\t\t\t<img src=\"${item.image}\">\n\t\t</td>\n\t\t<td>\n\t\t\t${item.title...
[ "0.91853243", "0.91853243", "0.84782016", "0.81112266", "0.8037497", "0.80311644", "0.8011763", "0.8006375", "0.79988027", "0.7944295", "0.7929307", "0.78812647", "0.78729427", "0.7864621", "0.77854383", "0.77736884", "0.7744675", "0.7733168", "0.77319354", "0.7708971", "0.76...
0.0
-1
endregion region Remove Item From Cart
function deleteFromCart(pid) { if (sessionStorage.getItem("email") === null) { alert("Please login or signup") } $.post(`/subtractqty/${pid}`, (data) => { if (data.success) { alert("Successfully removed item to cart...!") refreshList() } else { alert('Some error occurred....!!' + data.err) refreshList() } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeItemFromCart() {\n var itemID = $(this).attr(\"id\");\n var positionInCart = itemID.slice(14, itemID.length);\n cartItems.splice(positionInCart, 1);\n updateCartDetails();\n}", "function removeItemFromCart(){\n\n}", "function removeOneItemFromCart() {\n var itemID = $(this).attr(\"id\");\n ...
[ "0.8579614", "0.84448445", "0.8309663", "0.8234156", "0.81186146", "0.81009585", "0.8053303", "0.7956632", "0.79045933", "0.7893916", "0.78807425", "0.7864648", "0.7814301", "0.78118587", "0.7800236", "0.779662", "0.7794581", "0.7784589", "0.7758626", "0.7730696", "0.7722483"...
0.0
-1
handles any map errors with geolocation
function handleLocationError(browserHasGeolocation, infoWindow, pos) { infoWindow.setPosition(pos); infoWindow.setContent(browserHasGeolocation ? 'Error: The Geolocation service failed.' : 'Error: Your browser doesn\'t support geolocation.'); infoWindow.open(map); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleGeoError() {\n console.log(\"Can't access geolocation\");\n }", "function handleGeolocateError() {\n\t\t\tui.showGeolocationError(true, false);\n\t\t\tui.showGeolocationSearching(false);\n\t\t}", "function geolocationError() {\n\t var options = {\n\t map: map,\n\t po...
[ "0.83676064", "0.80068874", "0.77278614", "0.7659898", "0.76338774", "0.75998306", "0.75596166", "0.75199443", "0.7512867", "0.7457813", "0.7414477", "0.7337102", "0.7328976", "0.7323292", "0.7295489", "0.7271337", "0.7255688", "0.7246692", "0.724454", "0.72422177", "0.723255...
0.7039394
60
Register Vue plugin globaly
registerVmProperty() { const { vmProperty, modules } = this.options; this.Vue.prototype[vmProperty] = modules; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "install(vue) {\n /* globalize class */\n vue.prototype.$input = this;\n vue.prototype.$mouse = this.mouse;\n vue.prototype.$keyboard = this.keyboard;\n }", "function initPlugins() {\n Vue.use(Vuex);\n Vue.use(VueRouter);\n Vue.use(VueI18n);\n Vue.use(DeviceHelper);\n ...
[ "0.70377153", "0.68452024", "0.673833", "0.66977006", "0.64981484", "0.6497063", "0.6476738", "0.6466657", "0.64384353", "0.64301777", "0.6344372", "0.6286446", "0.62495697", "0.62084204", "0.6097646", "0.60851705", "0.60738355", "0.6009192", "0.6003983", "0.598309", "0.59765...
0.6394534
10
Register each module provided in /config/modules
registerModules() { const { modules } = this.options; if (Object.keys(modules).length) { Object.keys(modules).forEach((moduleName) => { const module = modules[moduleName]; const hasPromisse = typeof module.then === 'function'; // Loaded module if (!hasPromisse) { this.registerModuleRoutes(module.routes); this.registerModuleStore(moduleName, module.store); return; } // Load lazy modules module.then((moduleLoaded) => { const { routes, store } = moduleLoaded.default; this.registerModuleRoutes(routes); this.registerModuleStore(moduleName, store); }); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async registerModules() {\n const { modules } = this.options;\n\n for (let index = 0; index < Object.keys(modules).length; index += 1) {\n const name = Object.keys(modules)[index];\n const module = modules[name];\n\n // eslint-disable-next-line no-await-in-loop\n await module.then((loaded...
[ "0.7980392", "0.7403039", "0.69663274", "0.669747", "0.66100794", "0.6436763", "0.64039534", "0.640303", "0.63723844", "0.636125", "0.6353212", "0.6327671", "0.629312", "0.620372", "0.61951995", "0.6128982", "0.61278737", "0.61278737", "0.6121877", "0.61155266", "0.6106688", ...
0.78784454
1
'Hi My name is Patrick' should be: 'ierdnA si eman iH'
function reverse(str) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static titleize(string) {\n let splitted = string.split(\" \")\n let sliced = splitted.slice(1)\n let result = [];\n if (splitted[0] !== splitted[0].charAt(0).toUpperCase()) {\n result.push(splitted[0].charAt(0).toUpperCase() + splitted[0].slice(1))\n } else {\n result.push(splitted[0] + s...
[ "0.6958504", "0.6786937", "0.6735072", "0.66513515", "0.6639237", "0.66336936", "0.6617713", "0.66121686", "0.6606657", "0.6590571", "0.6587826", "0.65844136", "0.65844136", "0.6575047", "0.6567975", "0.6567472", "0.6557297", "0.65552765", "0.65499526", "0.6537822", "0.653454...
0.0
-1
Parse the raw body of an aws response. This will throw an error if detected
function parseAwsResponse(body) { let doc = libxmljs.parseXml(body); let rootTagName = doc.root().name(); // First, let's see if (rootTagName === 'Error') { let children = doc.root().childNodes(); let code, message, requestId, hostId, resource; for (let child of children) { switch (child.name()) { case 'Code': code = child.text() || 'AWSProvidedNoCodeError'; break;; case 'Message': message = child.text() || 'AWS provided no message'; break;; case 'RequestId': requestId = child.text() || undefined; break;; case 'HostId': hostId = child.text() || undefined; break;; case 'Resource': resource = child.text() || undefined; default: break;; } } let err = new Error(message); err.code = code; err.resource = resource; err.requestId = requestId; err.hostId = hostId; if (err.code === 'SignatureDoesNotMatch') { for (let child of children) { switch (child.name()) { case 'AWSAccessKeyId': err.accessKeyId = child.text() || undefined; break;; case 'StringToSign': err.stringToSign = child.text() || undefined; break;; case 'CanonicalRequest': err.canonicalRequest = child.text() || undefined; break;; default: break;; } } } throw err; } return xml2json.toJson(body, {object: true}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseResponse(event)\n{\n // find body\n var newBody = ''\n if ('body' in event )\n {\n\tnewBody = event.body\n }\n else if ('payload' in event && 'body' in event.payload )\n {\n\tnewBody = event.payload.body\n }\n\n // if there's anything to do...\n if ( newBody.length > 0)\n {\n newBody =...
[ "0.61360574", "0.60329634", "0.5790155", "0.5681934", "0.5584679", "0.544962", "0.54298145", "0.53179884", "0.5285613", "0.52229017", "0.5184511", "0.5181398", "0.51677257", "0.5165544", "0.5148296", "0.5120068", "0.51165056", "0.5108302", "0.5084354", "0.50795203", "0.506559...
0.75495446
0
Happens when the mouse is moving inside the canvas
function myMove(e){ if (isDrag){ getMouse(e); mySel.x = mx - offsetx; mySel.y = my - offsety; // something is changing position so we better invalidate the canvas! invalidate(); } else if (isResizeDrag) { // time to resize! //getMouse(e); var oldx = mySel.x; var oldy = mySel.y; switch (expectResize) { case 0: mySel.x = mx; mySel.y = my; mySel.width += oldx - mx; mySel.height += oldy - my; break; case 1: mySel.y = my; mySel.width = mx - oldx; mySel.height += oldy - my; break; case 2: mySel.x = mx; mySel.width += oldx - mx; mySel.height = my - oldy; break; case 3: mySel.width = mx - oldx; mySel.height = my - oldy; break; } // something is changing position so we better invalidate the canvas! invalidate(); } getMouse(e); // if there's a selection see if we grabbed one of the selection handles /*if (mySel !== null && !isResizeDrag) { for (var i = 0; i < 4; i++) { // 0 1 // // 2 3 var cur = selectionHandles[i]; // we dont need to use the ghost context because // selection handles will always be rectangles if (mx >= cur.x && mx <= cur.x + mySelBoxSize && my >= cur.y && my <= cur.y + mySelBoxSize) { // we found one! expectResize = i; invalidate(); switch (i) { case 0: this.style.cursor='nw-resize'; break; case 1: this.style.cursor='ne-resize'; break; case 2: this.style.cursor='sw-resize'; break; case 3: this.style.cursor='se-resize'; break; } return; } } // not over a selection box, return to normal isResizeDrag = false; expectResize = -1; this.style.cursor='auto'; }*/ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handlemouseMove(e) {\n const rect = this.canvas.getBoundingClientRect();\n if (this.flag) {\n this.prevX = this.currX;\n this.prevY = this.currY;\n this.currX = e.clientX - rect.left;\n this.currY = e.clientY - rect.top;\n this.draw(this.template, this.ctx);\n }\...
[ "0.75774527", "0.75629383", "0.75225717", "0.7433533", "0.73974895", "0.72960675", "0.7284718", "0.7276813", "0.71952975", "0.7193912", "0.716133", "0.7142451", "0.70809686", "0.70698315", "0.7063418", "0.7061432", "0.70513904", "0.7050928", "0.7025467", "0.70240074", "0.7022...
0.0
-1
init(1, 1, false, 0); INITALIZE TIMER
function initTimer() { // debugger; if ($scope.duration > 0) { $scope.resetTimer(); $scope.startTimer(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Timer() {}", "function Timer(){\n}", "function timerStart(){\n\t\n\t\t\n\t}", "function resetInit() {\n\t//reset();\n\t//$interval = setInterval(init, 1200);\n\tinit();\n\tsetTimeout(resetInit, (($i+1) * 1000) + (Math.round((Math.random() * 1000))) );\n}", "function timerInit(){\n\t\ttimer = setTi...
[ "0.7441637", "0.72628427", "0.7207179", "0.71930945", "0.71708333", "0.7086937", "0.69810605", "0.69556236", "0.69450396", "0.6917357", "0.6887053", "0.6858597", "0.6853029", "0.6843425", "0.683171", "0.68102545", "0.6785996", "0.67739004", "0.67709094", "0.67698187", "0.6758...
0.6578879
42
Since product id can be changed by user, we need the index for the product we're editing to return the updated product to array.
findIndex(productId, allProducts) { let productIndex allProducts.map((prod, i) => { if (prod.id === productId) { productIndex = i } }) return productIndex }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setEditingProduct(state, payload) {\n state.editingProductIndex = payload.index;\n state.products[payload.index] = payload.product;\n }", "findEditingProduct({ commit }, editingProduct) {\n let IndexOfEditingProduct = this.state.products.findIndex(\n (product) => editingProduct.productna...
[ "0.79717505", "0.7603667", "0.70575297", "0.7002878", "0.6697222", "0.6618614", "0.6572697", "0.64045537", "0.63885313", "0.6330983", "0.6299501", "0.628502", "0.6271998", "0.62636966", "0.62230545", "0.6210987", "0.6206512", "0.6156588", "0.6155417", "0.6128129", "0.61272943...
0.62722725
12
Puts the edited product back where we found it.
mergeProducts() { const { productIndex, product } = this.state const products = this.props.allProducts products[productIndex] = product return products }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setEditingProduct(state, payload) {\n state.editingProductIndex = payload.index;\n state.products[payload.index] = payload.product;\n }", "function handleProductEdit() {\n var currentProduct = $(this)\n .parent()\n .parent()\n .data(\"product\");\n window.location.href...
[ "0.6702901", "0.6600971", "0.62429965", "0.60983837", "0.6068584", "0.59853834", "0.5851761", "0.5800466", "0.5700631", "0.5685338", "0.5646546", "0.5645069", "0.5614277", "0.5586923", "0.5575271", "0.5539336", "0.55377346", "0.55257076", "0.54896915", "0.548962", "0.54866475...
0.0
-1
Resize the renderer on window resize
function onWindowResize(event) { renderer.setSize(window.innerWidth, window.innerHeight); camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resize() {\n\twindowWidth = window.innerWidth;\n\twindowHeight = window.innerHeight;\n renderer.setSize(window.innerWidth,window.innerHeight);\n}", "function resize() {\n\twindowWidth = window.innerWidth;\n\twindowHeight = window.innerHeight;\n renderer.setSize(window.innerWidth,window.innerHeight);\n...
[ "0.8803078", "0.8803078", "0.81982815", "0.81314224", "0.81278026", "0.81037027", "0.81037027", "0.81037027", "0.8098557", "0.8084102", "0.80753183", "0.8072502", "0.80658865", "0.80658865", "0.8058625", "0.8058625", "0.8052596", "0.8051993", "0.80219364", "0.79865986", "0.79...
0.7898643
29
Function that's called each frame to render
function animate() { requestAnimationFrame(animate); render(); update(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render() {\n\t\trate = (droppedFrames > 0) ?\n\t\t\t((rate+(FPS/(droppedFrames*2)))/2):\n\t\t\t((rate + FPS)/2);\n\t\t\t\n\t\tcycleCounter = (cycleCounter + 1) % FPS;\n\t\tframeCounter = (frameCounter + 1) % 1e15;\n\t\t// just render every N frames to avoid a jarring display\n\t\tdroppedFrames = -1;\n\t\t...
[ "0.749709", "0.7416677", "0.73189294", "0.72901887", "0.7241669", "0.7238487", "0.72068244", "0.7197224", "0.7157766", "0.71452343", "0.7130681", "0.71286434", "0.71165407", "0.7107492", "0.71055204", "0.7101566", "0.70833606", "0.70760393", "0.7072055", "0.7068155", "0.70619...
0.0
-1
Update the controls and anything else you want to update in runtime
function update() { // Send time to shaders var delta = clock.getDelta(); landscapeUniforms.time.value += delta; landscapeMaterial.needsUpdate = true; // Move controls.update(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update() {\n controls.update();\n stats.update();\n }", "function update() {\n resize();\n controls.update();\n }", "function updateUI() {\n updatePlayerComponents(['points', 'teenagers', 'kettles', 'theaters', 'cps'])\n updatePriceComponents(['teenagers', 'kettles'...
[ "0.7788845", "0.76052356", "0.75519234", "0.7369807", "0.7323461", "0.7267204", "0.70299584", "0.6929734", "0.6929734", "0.6929734", "0.6927368", "0.691234", "0.69061416", "0.6876366", "0.6788752", "0.6737443", "0.6711937", "0.6701873", "0.6689763", "0.66535234", "0.6613702",...
0.0
-1
Render the current state of the scene through the current camera
function render() { renderer.render(scene, camera); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render() { \n \n renderer.render(scene,camera);\n}", "render() {\n\t\trenderer.render(scene, camera);\n\t}", "render() {\n\t\trenderer.render(scene, camera);\n\t}", "render() {\n this.renderer.render(this.scene, this.camera)\n }", "function render() {\n renderer.render(scene, came...
[ "0.83641386", "0.8318339", "0.8318339", "0.82211095", "0.82156074", "0.81844676", "0.81557477", "0.81321645", "0.8123683", "0.8118334", "0.80984807", "0.80809796", "0.8079101", "0.805883", "0.805883", "0.8058736", "0.80415046", "0.80400443", "0.8039001", "0.8011049", "0.80006...
0.8154676
7
functions / basicas Vehiculo: Crear, modificar, consultar Personas: Crear, modificar, consultar
function findVehiculo(dominio) { let vehicle; for (let i = 0; i < vehiculos.length; i++) { if (dominio === vehiculos[i]["dominio"]) { vehicle = i; } } return vehicle; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "verificaDados(){\n this.verificaEndereco();\n if(!this.verificaVazio()) this.criaMensagem('Campo vazio detectado', true);\n if(!this.verificaIdade()) this.criaMensagem('Proibido cadastro de menores de idade', true);\n if(!this.verificaCpf()) this.criaMensagem('Cpf deve ser válido', true...
[ "0.70242983", "0.667138", "0.66096854", "0.65978986", "0.64554083", "0.6424644", "0.6414119", "0.6384069", "0.6379261", "0.62841946", "0.62479496", "0.62260586", "0.6224567", "0.61867344", "0.61706704", "0.61499846", "0.6145696", "0.61257595", "0.6112289", "0.61025876", "0.61...
0.0
-1
end loop each site
function loadsite(siteId){ var rs_site = record.load({ type: 'customrecord_ew_site_form', id: siteId }); // rs_site.setValue({ // fieldId: 'custrecord_ew_site_lastinvdate', // value: true // }); rs_site.save(); } // eof loadsite
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function iteration() {\n // exit if we cross the max-depth level \n if (currentLink >= upTo) {\n casper.echo('Maximum depth exceeded!', 'WARNING');\n return casper.exit();\n }\n\n // exit if there are no more links to be crawled\n if (!links[currentLink]) {\n casper.echo('All Li...
[ "0.61879194", "0.5856281", "0.58250725", "0.57633936", "0.57425314", "0.57361263", "0.5702088", "0.5674531", "0.56601256", "0.5632711", "0.5604659", "0.55627316", "0.5481128", "0.5475009", "0.54616", "0.54444057", "0.5427394", "0.54197097", "0.5413502", "0.5410664", "0.540862...
0.0
-1
hide current level dropdowns
function hideAllDropdowns(except) { var siblings = except.siblings(); siblings.removeClass(options.hoverClass).each(function(){ var item = $(this); clearTimeout(item.data('timer')); }); siblings.filter('.' + options.dropClass).each(function(){ var item = jQuery(this).removeClass(options.dropClass); if(item.data('drop').length) { dropdownEffects[options.effect].animate({drop:item.data('drop'), state:false, speed:options.animSpeed}); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hideDropDown() {\n var isFilter = function(ele) {\n if (ele !== null) {\n if (ele.className) {\n if ((ele.className.indexOf(\"subContainer\") >= 0) || (ele.className.indexOf(\"subContainer\") >= 0) || (ele.className.indexOf(\"sortBy\") >= 0)) {\n return true;\n ...
[ "0.723765", "0.7058027", "0.7058027", "0.7058027", "0.7058027", "0.7058027", "0.6988483", "0.69630086", "0.6916694", "0.6869001", "0.66840136", "0.65784836", "0.655668", "0.65076715", "0.64974755", "0.64783394", "0.64658004", "0.6386395", "0.6366835", "0.6348379", "0.6347579"...
0.6094937
48
is a < b < c
function isTriplet (a, b, c) { if (a < b && b < c) { return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function greaterThanLessThan (a,b,c) {\nreturn (a < b < c)\n}", "function isLess(a, b) {\nreturn (a < b);\n}", "function isLess(a, b) {\n return a < b;\n}", "function isLess(a, b) {\n\treturn a < b;\n}", "function isLess(a, b){\n return a < b;\n}", "function trueOrFalse(a , b) {\r\n return a < b;\...
[ "0.8046574", "0.7229582", "0.7071496", "0.70621765", "0.7052353", "0.6948323", "0.6812866", "0.6770562", "0.67679405", "0.6733488", "0.66844976", "0.6574854", "0.65269923", "0.6524762", "0.6515354", "0.6495533", "0.6491182", "0.6489137", "0.64506835", "0.6444279", "0.64308715...
0.68825734
6
does a^2 + b^2 = c^2
function isPythag (a, b, c) { if (a*a + b*b === c*c) { return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sumation(a, b, c) {\n let tot = (a + b) * c;\n return tot;\n }", "function foo(a, b, c) {\n return (-b + sqrt(b ^ 2 - 4 * a * c)) / (2 * a)\n}", "function crazySum(a, b){\n if(a === b){\n return 3 * (a + b);\n }\n}", "function S(a, b, c) {\n var ans = ...
[ "0.7109327", "0.7003141", "0.6978301", "0.6659007", "0.66257864", "0.6555955", "0.65525633", "0.65422463", "0.6540325", "0.6536099", "0.65007865", "0.6452427", "0.64140356", "0.64139247", "0.64131004", "0.640503", "0.63999945", "0.63962984", "0.6374293", "0.6346124", "0.63461...
0.0
-1
relate to UI,UX functions for overlay transition (on,off)
function overlay_on(){ document.getElementById("overlay_on").style.display = "block"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleOverlay() {\r\n this.state.overlay ? this.setState({overlay: false}) : this.setState({overlay: true})\r\n }", "function off() {\n document.getElementById(\"overlay\").style.display = \"none\";\n}", "function onClick(ev) {\n if (ev.target.id === overlayId) overlayOff();\n}", "function offOverlay()...
[ "0.69562113", "0.6453587", "0.64006025", "0.62502795", "0.6236902", "0.62030405", "0.6195105", "0.61741114", "0.6154695", "0.61425316", "0.6142154", "0.6117717", "0.6106802", "0.6095861", "0.6090895", "0.6090895", "0.6090895", "0.608922", "0.608922", "0.6058791", "0.6056942",...
0.59351784
30
add multiple objects, n is number of objects
function add_object(n){ for (var i=1; i<n; i++){ var div = document.createElement('div'); div.innerHTML = document.getElementById('init').innerHTML; document.getElementById('append').appendChild(div); } objects = document.querySelectorAll("#object"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addInput(n) {\n if (!n) n = 1;\n for (let i = 0; i < n; i++) {\n inputValues.push({\n selectedParticipantId: null,\n amount: AmountValueStoreFactory(),\n inputId: nextInputId++ // used for repeated element unique key\n });\n }\n}", "addHouses(NUMBER) {\r\n let counter = 0;...
[ "0.6129207", "0.5952799", "0.59207785", "0.5845697", "0.5839558", "0.5815167", "0.5782983", "0.57243794", "0.5702252", "0.5695256", "0.5672259", "0.56346893", "0.56059945", "0.55899644", "0.55835116", "0.558241", "0.5580426", "0.5579656", "0.55712414", "0.55513805", "0.553945...
0.6866595
0
create random value of R,G,B separately and combine to RGB color code
function rand_color(n){ diff = Math.floor(Math.random() * n); if (diff_prev == diff){ diff = Math.floor(Math.random() * n); } diff_prev == diff; var r = Math.floor(Math.random() * 256); var g = Math.floor(Math.random() * 256); var b = Math.floor(Math.random() * 256); var rd=r, gd=g, bd=b; var rand = Math.floor(Math.random() * 3); if(cnt == 40) h = 10; switch(rand){ case 0 : ((r-h) < 0) ? rd = (r+h) : rd = (r-h); ((g-h) < 0) ? gd = (g+h) : gd = (g-h); break; case 1 : ((r-h) < 0) ? rd = (r+h) : rd = (r-h); ((b-h) < 0) ? bd = (b+h) : bd = (b-h); break; case 2 : ((g-h) < 0) ? gd = (g+h) : gd = (g-h); ((b-h) < 0) ? bd = (b+h) : bd = (b-h); break; } gener_color = "rgb("+r+", "+g+", "+b+")"; trans_color = "rgb("+rd+", "+gd+", "+bd+")"; //span_gen_color.textContent = gener_color; //span_trs_color.textContent = trans_color; //span_diff_pos.textContent = diff+1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateRandomColorValues () {\n r = Math.round(Math.random() * (256));\n g = Math.round(Math.random() * (256));\n b = Math.round(Math.random() * (256));\n}", "function getRandomColorRGB() {\n return 'rgb(' + calcRndGen(255, true).toString() + \",\" + calcRndGen(255, true).toString() + ...
[ "0.8470762", "0.8173055", "0.80963635", "0.80834687", "0.8054526", "0.80227786", "0.80021375", "0.7990343", "0.79826325", "0.79593027", "0.7953351", "0.79408675", "0.7928638", "0.79282635", "0.7918799", "0.79184645", "0.79134315", "0.78974664", "0.7886154", "0.788611", "0.785...
0.0
-1
apply color to all objects
function set_color(){ for (var i=0; i<objects.length; i++){ if(i == diff) objects[i].style.background = trans_color; else objects[i].style.background = gener_color; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setColor(color) {\n if (!(color instanceof Color))\n throw new Error('Color needed! >.<');\n\n for (let i=0; i < this.objects.length; i++)\n this.objects[i].setColor(color);\n }", "function updateColors() {\n\tfor (var i=0; i<allTissues.length; i++){\n\t\tchangeFillColor(al...
[ "0.6952635", "0.6545423", "0.6522723", "0.6487149", "0.6452798", "0.6446517", "0.6442556", "0.64062405", "0.63991946", "0.6397263", "0.63831425", "0.6364559", "0.6350064", "0.63192266", "0.6303634", "0.6298454", "0.6247573", "0.6240698", "0.6228963", "0.6228041", "0.6226997",...
0.7255252
0
add more objects to fit in matrix
function add_more(m,n){ //console.log('make '+m+'by'+m+'matrix and add '+n+'objects'); var headID = document.getElementsByTagName("head")[0]; var cssNode = document.createElement('link'); cssNode.type = 'text/css'; cssNode.rel = 'stylesheet'; cssNode.href = '/views/main'+m+'.css'; headID.appendChild(cssNode); num_objects = m; add_object(n); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "add(Obj) {\r\n if(Obj instanceof Matrix)\r\n this.data = this.data.map((rows,main_index) => {\r\n return rows.map((cols,sub_index) => {\r\n return cols+(Obj.data[main_index][sub_index] || 0);\r\n });\r\n });\r\n else if(typeof Obj == \"number\")\r\n this.data = this.data.map(rows =>...
[ "0.6289553", "0.62797874", "0.6230526", "0.61965764", "0.61351746", "0.6133268", "0.61055917", "0.59140337", "0.58241343", "0.58077157", "0.5754931", "0.56376886", "0.5637626", "0.56269574", "0.55742633", "0.556606", "0.55541795", "0.5542617", "0.5531354", "0.55291265", "0.55...
0.6448993
0
EventListener for click input
function touch(){ for (var i=0; i<objects.length; i++){ objects[i].addEventListener("click", function(){ if (this.style.background === trans_color) clear(); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_onInputClick(event) {\n // We have to stop propagation for click events on the visual hidden input element.\n // By default, when a user clicks on a label element, a generated click event will be\n // dispatched on the associated input element. Since we are using a label element as our\n ...
[ "0.70145106", "0.6659657", "0.65987396", "0.6576322", "0.6498361", "0.64878994", "0.644658", "0.6439281", "0.64387083", "0.6351269", "0.63178957", "0.6314638", "0.6255677", "0.6219555", "0.6175928", "0.61652625", "0.6153014", "0.6143733", "0.6141592", "0.61209524", "0.6118086...
0.0
-1
go to next stage
function clear(){ for (var i=0; i<objects.length; i++) objects[i].style.background = trans_color; //clearTimeout(time); initialize(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "gotoNextStep() {\n this.gotoStep(this.currentStep + 1);\n }", "function goToStage(_stageName) {\n var nextStage = engine.stages[_stageName];\n if(nextStage) {\n nextStages.push(nextStage);\n }\n }", "function nextStage() {\r\n level++;\r\n ...
[ "0.73710644", "0.7325706", "0.7202521", "0.71768785", "0.70454955", "0.69657636", "0.69629014", "0.6944064", "0.69320893", "0.68980294", "0.6852378", "0.6802835", "0.67697746", "0.67555577", "0.6720858", "0.66861165", "0.6641859", "0.6621524", "0.66032463", "0.65590376", "0.6...
0.0
-1
after gameover, enable fadein transition and send stage data to rank page
function end(){ overlay_on(); setTimeout("location.href = '/auth/ranking?'+score_sum;",1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showStage(stage) {\n\n\tvar data = JSON.stringify({\n\t\t'hasMerlin' : 0,\n\t\t'name' : PlayerName,\n\t\t'accepted' : stage\n\t})\n\tsocketConn.send(data);\n\tdocument.getElementById(\"merlinPrompt\").innerText = \"\";\n\tdocument.getElementById(\"merlinYes\").style.display = \"none\";\n\tfor(var i=0; i<5...
[ "0.6491921", "0.6446599", "0.62518257", "0.62451154", "0.62250614", "0.618549", "0.61609703", "0.61537", "0.61502016", "0.6148065", "0.61175686", "0.61045974", "0.6099879", "0.6091684", "0.6086379", "0.6081907", "0.6075753", "0.6069614", "0.60598564", "0.60589224", "0.6047799...
0.0
-1
function show login page
function beforeLogin() { $('#home-page').hide() $('#login-page').show() $('#register-page').hide() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showLogin() {\n clearErrorMsg();\n showView('loginForm');\n showLinks(['registerLink']);\n}", "function showLogin(req, res){\n\tres.render('pages/login');\n}", "function login() {\n if(validateCredentials()){\n window.location.href = \"Om Gyldne.html\";\n } else {\n helpte...
[ "0.81180376", "0.75781983", "0.74828595", "0.7415436", "0.73515576", "0.73337203", "0.7186098", "0.7154488", "0.7151947", "0.7130559", "0.71288836", "0.71288794", "0.71085733", "0.7088151", "0.7079468", "0.70624274", "0.70249337", "0.69937897", "0.6992946", "0.6947668", "0.69...
0.6633936
52
function show home page
function afterLogin () { $('#home-page').show() fetchBook() $('#login-page').hide() $('#register-page').hide() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showHomePage() {\n $('#greet-user').text('Bookmarks');\n $('#logout-button').hide();\n $('#login-div').show();\n $('#register-div').hide();\n $('#bookmarks-view').hide();\n }", "function showHome(request){\n\trequest.respond(\"This is the hom...
[ "0.794151", "0.7681839", "0.7588483", "0.7533071", "0.7473014", "0.74275", "0.73056966", "0.72681403", "0.72201437", "0.7149867", "0.71100265", "0.70965433", "0.7067996", "0.7034248", "0.70281553", "0.7012573", "0.6992136", "0.69431174", "0.6859465", "0.68574727", "0.684774",...
0.0
-1
Created by Tivie on 13072015.
function getDefaultOpts (simple) { 'use strict'; var defaultOptions = { omitExtraWLInCodeBlocks: { defaultValue: false, describe: 'Omit the default extra whiteline added to code blocks', type: 'boolean' }, noHeaderId: { defaultValue: false, describe: 'Turn on/off generated header id', type: 'boolean' }, prefixHeaderId: { defaultValue: false, describe: 'Specify a prefix to generated header ids', type: 'string' }, ghCompatibleHeaderId: { defaultValue: false, describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)', type: 'boolean' }, headerLevelStart: { defaultValue: false, describe: 'The header blocks level start', type: 'integer' }, parseImgDimensions: { defaultValue: false, describe: 'Turn on/off image dimension parsing', type: 'boolean' }, simplifiedAutoLink: { defaultValue: false, describe: 'Turn on/off GFM autolink style', type: 'boolean' }, excludeTrailingPunctuationFromURLs: { defaultValue: false, describe: 'Excludes trailing punctuation from links generated with autoLinking', type: 'boolean' }, literalMidWordUnderscores: { defaultValue: false, describe: 'Parse midword underscores as literal underscores', type: 'boolean' }, literalMidWordAsterisks: { defaultValue: false, describe: 'Parse midword asterisks as literal asterisks', type: 'boolean' }, strikethrough: { defaultValue: false, describe: 'Turn on/off strikethrough support', type: 'boolean' }, tables: { defaultValue: false, describe: 'Turn on/off tables support', type: 'boolean' }, tablesHeaderId: { defaultValue: false, describe: 'Add an id to table headers', type: 'boolean' }, ghCodeBlocks: { defaultValue: true, describe: 'Turn on/off GFM fenced code blocks support', type: 'boolean' }, tasklists: { defaultValue: false, describe: 'Turn on/off GFM tasklist support', type: 'boolean' }, smoothLivePreview: { defaultValue: false, describe: 'Prevents weird effects in live previews due to incomplete input', type: 'boolean' }, smartIndentationFix: { defaultValue: false, description: 'Tries to smartly fix indentation in es6 strings', type: 'boolean' }, disableForced4SpacesIndentedSublists: { defaultValue: false, description: 'Disables the requirement of indenting nested sublists by 4 spaces', type: 'boolean' }, simpleLineBreaks: { defaultValue: false, description: 'Parses simple line breaks as <br> (GFM Style)', type: 'boolean' }, requireSpaceBeforeHeadingText: { defaultValue: false, description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)', type: 'boolean' }, ghMentions: { defaultValue: false, description: 'Enables github @mentions', type: 'boolean' }, ghMentionsLink: { defaultValue: 'https://github.com/{u}', description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.', type: 'string' }, encodeEmails: { defaultValue: true, description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities', type: 'boolean' }, openLinksInNewWindow: { defaultValue: false, description: 'Open all links in new windows', type: 'boolean' } }; if (simple === false) { return JSON.parse(JSON.stringify(defaultOptions)); } var ret = {}; for (var opt in defaultOptions) { if (defaultOptions.hasOwnProperty(opt)) { ret[opt] = defaultOptions[opt].defaultValue; } } return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "transient final protected i...
[ "0.67360765", "0.67161655", "0.6507846", "0.6216088", "0.6196618", "0.61791945", "0.6137245", "0.59916586", "0.5960525", "0.5917684", "0.58703583", "0.5868781", "0.58440703", "0.5833846", "0.5796323", "0.57489467", "0.5710376", "0.56925315", "0.56770813", "0.56413406", "0.562...
0.0
-1
it's faster to have 3 separate regexes for each case than have just one because of backtracing, in some cases, it could lead to an exponential effect called "catastrophic backtrace". Ominous!
function parseInside (txt, left, right) { if (options.simplifiedAutoLink) { txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals); } return left + txt + right; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initRegex() {\n if (typeof general_regex !== 'undefined') {\n return;\n }\n\n regexs = {};\n regex_raw = '~';\n regex_not_raw = `(?<!${regex_raw})`;\n\n // Update lookarounds regex\n lookaround_regexs = {\n 'block': new RegExp(`${regex_not_raw}(?=\\\\{\\\\[)( ?){1,}block...
[ "0.61917454", "0.61585927", "0.57830405", "0.5677387", "0.5677387", "0.5677387", "0.5677387", "0.5677387", "0.5677387", "0.56314474", "0.5603926", "0.5557267", "0.55530494", "0.55402535", "0.5528544", "0.55261046", "0.55046576", "0.54819673", "0.5445459", "0.5437462", "0.5433...
0.0
-1
funkcja podpieta pod button w informacji, ustawia ciasteczko i chowa belke
function cookie_info_ok(){ ustaw_Ciastko(cookie_info_cookie,'1',cookie_info_delay); jQuery('#cookie_info_box').css({ 'display':'none' }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function llenarBotonCulminado(){\n var retorno='<button type=\"button\" class=\"btn btn-xs btn-default btn-block\"><span class=\"glyphicon glyphicon-pencil\"></span> Culminado</button>'\n return retorno\n }", "function llenarBotonEvaluacion(){\n var retorno='<button type=\"button\" class=\"btn btn-xs...
[ "0.6692574", "0.6686059", "0.6503257", "0.641487", "0.62536895", "0.6237047", "0.61980873", "0.61798674", "0.6173235", "0.6146224", "0.6142187", "0.6136776", "0.6106744", "0.61055547", "0.6078149", "0.6071115", "0.60583454", "0.6055064", "0.6052093", "0.6038671", "0.60268205"...
0.0
-1
budowanie i stylowanie paska z informacja
function cookie_info_box(){ jQuery('body').append('<div id="cookie_info_box">'+tresc+' <button onclick="cookie_info_ok();" tabindex="1" id="cookie_info_ok">Akceptuję<'+'/button> <a href="'+link+'" tabindex="1">Więcej informacji<'+'/a><'+'/div>'); jQuery('#cookie_info_box').css({ 'width':'90%', 'position':'fixed', 'left':'0', 'top':'0', 'z-index':'999', 'padding':'7px 5%', 'text-align':'center', 'font-size':'13px', 'font-family':'Arial, serif', 'background':cookie_info_box_bg, 'color':cookie_info_box_color }); jQuery('#cookie_info_box a').css({ 'color':cookie_info_box_color }); jQuery('#cookie_info_box button').css({ 'border':'none', 'border-radius':'3px', 'background':cookie_info_button_bg, 'color':cookie_info_button_color, 'cursor':'pointer', 'font-weight':'bold', 'margin':'0 20px', 'padding':'4px 12px' }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formAtt(elem){\n\t//changing element border width to draw more attention\n\tdocument.getElementById(elem).style.borderWidth=\"4px\";\n\t//changing element background to highlight the problem field\n\tdocument.getElementById(elem).style.backgroundColor=\"pink\";\n\t//change border color to add more emphasi...
[ "0.5882851", "0.58237296", "0.57145774", "0.56791985", "0.5647164", "0.56417567", "0.5634879", "0.5578551", "0.5577355", "0.5555888", "0.5534786", "0.5534292", "0.5528092", "0.5498977", "0.5473664", "0.54641664", "0.5419056", "0.5415846", "0.54128706", "0.5399231", "0.5392835...
0.0
-1
Called immediately after a component is mounted. Starts the data loading.
componentDidMount() { this.songsListScreenModel.loadSongsList(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount()\n\t{\n\t\tthis.loadData();\n\t}", "componentDidMount() {\n\t\t$('html').removeClass('loading');\n\t\tthis._getData();\n\t}", "componentDidMount() {\n this.loadData();\n }", "componentDidMount() {\n this.loadData();\n }", "componentDidMount() {\n this.loadData(...
[ "0.73063266", "0.7266823", "0.71715736", "0.71715736", "0.71715736", "0.7167554", "0.7167554", "0.7124689", "0.7118156", "0.7116908", "0.70601207", "0.70264363", "0.7013533", "0.6949533", "0.69202614", "0.6788918", "0.6743077", "0.6727023", "0.6724403", "0.66923517", "0.66887...
0.0
-1
retrieve all learning groups
function getLearningGroups() { return breeze.EntityQuery .from(learningGroupType.defaultResourceName) .using(manager) .execute() .then(function (data) { return data.results; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLearningGroupsSelectors() {\n return datacontext.getLearningGroups()\n .then(function (data) {\n vm.learningGroups = data;\n });\n }", "function all() {\n\t if (resetNeeded) reset(), resetNeeded = false;\n\t return groups;\n\t }", "function all() {\...
[ "0.7444817", "0.6453696", "0.63762355", "0.6235793", "0.6131386", "0.599168", "0.5938922", "0.59177077", "0.59173757", "0.5868118", "0.5825475", "0.58188486", "0.5816284", "0.57885575", "0.57768387", "0.57103425", "0.570846", "0.57039624", "0.5690104", "0.562576", "0.5585387"...
0.7717944
0
gets a specific learning group
function getLearningGroup(id) { // first try to get the data from the local cache, but if not present, grab from server return manager.fetchEntityByKey('LearningGroups', id, true) .then(function (data) { common.logger.log('fetched learning group from ' + (data.fromCache ? 'cache' : 'server'), data); return data.entity; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getGroup() { return group; }", "function randomGroup(group) {\n const randomNumber = Math.floor(Math.random() * group.length);\n return group[randomNumber];\n}", "function getLearningGroupsSelectors() {\n return datacontext.getLearningGroups()\n .then(function (data) {\n vm.lear...
[ "0.6700681", "0.63183606", "0.59724236", "0.59284014", "0.5916031", "0.57629955", "0.57213145", "0.5703851", "0.5677881", "0.5677881", "0.5677881", "0.56656504", "0.56530106", "0.5556387", "0.55178463", "0.5448488", "0.5436404", "0.5432111", "0.5387484", "0.5338875", "0.53369...
0.70351535
0
creates a new learning group
function createLearningGroup(initialValues) { return manager.createEntity(learningGroupType, initialValues); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createGroup(groupName){\n var newGroup = {\n name: groupName,\n tabs:[],\n open:false,\n active:true\n }\n groups.push(newGroup);\n storeGroups();\n}", "createAllignmentGroup() {\r\n //prompt to assign names \r\n let allignment = prompt(\"Enter new allignment group:\");\r\n...
[ "0.6677799", "0.60903794", "0.60309196", "0.59757614", "0.58943987", "0.586747", "0.58380544", "0.5836067", "0.58290625", "0.5784115", "0.57674396", "0.5697667", "0.56536925", "0.5639096", "0.56389755", "0.5635642", "0.5619486", "0.55818444", "0.5580157", "0.557902", "0.55785...
0.7960621
0
retrieve all learning groups, using ngHttp service
function getCourses() { return breeze.EntityQuery .from(courseType.defaultResourceName) .using(manager) .execute() .then(function(data){ return data.results; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLearningGroups() {\n return breeze.EntityQuery\n .from(learningGroupType.defaultResourceName)\n .using(manager)\n .execute()\n .then(function (data) {\n return data.results;\n });\n }", "function getLearningGroupsSelectors() {\n return datacontext.getLearn...
[ "0.72202647", "0.6731836", "0.65911794", "0.65084124", "0.648799", "0.6389435", "0.6377511", "0.62523276", "0.62257314", "0.6167405", "0.6160798", "0.60275334", "0.5964174", "0.5951194", "0.5915855", "0.589564", "0.5869105", "0.57599336", "0.5750659", "0.57409143", "0.5736153...
0.0
-1
retrieve courses for a specific learning group
function getCoursesForLearningGroup(learningGroupId) { // get learning group (hopefully from cache)... return getLearningGroup(learningGroupId) .then(function () { // query that always works console.log("MON courseType.custom: " + courseType.custom); var query = breeze.EntityQuery .from(courseType.defaultResourceName) // query that works in Office365 / SPO and versions of SharePoint 2013 // that have XXX 201X applied (this CU includes a bugfix) .where('LearningGroupId', 'eq', learningGroupId); /* In case it did not work aconnell has a hack (described in #5.12): */ // .where('LearningGroup.Id', 'eq', learningGroupId) // .select(courseType.custom.defaultSelect + ',LearningGroup.Id') // .expand('LearningGroup'); return manager.executeQuery(query) .then(function (data) { return data.results; }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getStudentCourse(gid) {\n let s = this.getStudent(gid);\n return s.courses;\n\n }", "function getListCourse(){\n\t\t$http.get(app.baseUrl + \"admin/api/course/\" + $scope.categoryId).then(function(response) {\n\t\t\t$scope.courses = response.data;\n\t\t});\n\t}", "function getCourses(school, text){\n x...
[ "0.7070153", "0.6799553", "0.6700198", "0.6650066", "0.6410687", "0.6355776", "0.6260138", "0.620283", "0.61416113", "0.6132186", "0.6122635", "0.60938257", "0.6052544", "0.60350585", "0.60314435", "0.60311925", "0.6012075", "0.60016954", "0.59954184", "0.5947709", "0.5936734...
0.7617182
0
gets a specific course
function getCourse(id) { // first try to get the data from the local cache, but if not present, grab from server return manager.fetchEntityByKey('Course', id, true) .then(function (data) { common.logger.log('fetched course from ' + (data.fromCache ? 'cache' : 'server'), data); return data.entity; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getCourse(id) {\n for (var i = 0; i < _courses.length; i++) {\n if (_courses[i].id === id) {\n return _courses[i];\n }\n }\n}", "function getCourse(courseId) {\n datacontext.getCourse(courseId)\n .then(function (data) {\n vm.course = data;\n });\n }", "func...
[ "0.7502446", "0.7447892", "0.7381238", "0.7052184", "0.70108217", "0.6995827", "0.6840323", "0.680128", "0.6798033", "0.67963874", "0.6756513", "0.67503315", "0.67493516", "0.6736568", "0.6703969", "0.654548", "0.6535134", "0.64983535", "0.64868146", "0.6461831", "0.6443541",...
0.7273609
3
reverts all changes back to their original state (basically telling breeze to ignore changes that we just did
function revertChanges() { return manager.rejectChanges(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "flushChanges () {\n this._lastTransactionWasUndo = true;\n }", "revert() { }", "function flushChanges() {\n self.changes = [];\n }", "function flushChanges() {\n self.changes = [];\n }", "reset() {\n this.modified = false;\n }", "clearDirtyState() {\n this._dirty = ...
[ "0.7176343", "0.7143989", "0.7122079", "0.7122079", "0.7111335", "0.6957277", "0.69152653", "0.68946475", "0.68711644", "0.68672293", "0.68634444", "0.680314", "0.6740249", "0.66604173", "0.6637279", "0.66255313", "0.66068065", "0.656402", "0.6562866", "0.6562866", "0.6562866...
0.7808706
0
Call this when device has gone online.
function connection_online() { // Unblock. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onOnline() {\n\tdeviceIsOnLine = true;\n}", "function onOffline() {\n\tdeviceIsOnLine = false;\n}", "_online() {\n // if we've requested to be offline by disconnecting, don't reconnect.\n if (this.currentStatus.status != \"offline\") this.reconnect();\n ...
[ "0.7226638", "0.7193484", "0.70843613", "0.6834329", "0.682158", "0.6789002", "0.67516613", "0.6735568", "0.6697981", "0.66147095", "0.6556517", "0.654355", "0.65374", "0.65095437", "0.6466966", "0.6465551", "0.6455446", "0.64251566", "0.63995975", "0.636913", "0.6330661", ...
0.61678535
26
Call this when device has gone offline.
function connection_offline() { // Block. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onOffline() {\n\tdeviceIsOnLine = false;\n}", "function onOffline() {\n $rootScope.$apply(function() {\n $rootScope.online = false;\n });\n }", "function offlineState() {\n\t\t\t//handle offline network state\n\t\t\tconsole.log(\"app is now offline\");\n\t\t\t//show ons alert dialo...
[ "0.7498755", "0.74765563", "0.73891896", "0.7331131", "0.70797884", "0.6931668", "0.686885", "0.6851752", "0.6577789", "0.65482104", "0.6512527", "0.65046924", "0.64224136", "0.64024186", "0.6334219", "0.63164276", "0.6268956", "0.6268956", "0.6268956", "0.6254524", "0.623536...
0.6887439
6
Verificar si existe un token de usuario y sigue siendo valido
loggedIn(){ console.debug(this.getToken()); return !!this.getToken(); //return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validateUser(token) {\n return this.name === token;\n }", "async tokenExists(token) {\n\n // parameter token doesn't exist\n if (!this._parameterExists(token)) {\n return false;\n }\n\n try {\n // token exists\n if...
[ "0.73246974", "0.69274056", "0.69058263", "0.67387784", "0.67099226", "0.6634846", "0.66143245", "0.64877486", "0.6400111", "0.6356766", "0.6338607", "0.63310856", "0.6314907", "0.6302184", "0.62752956", "0.62728065", "0.6268369", "0.6239677", "0.62135756", "0.621027", "0.620...
0.0
-1
3D TRANSFORMATION AND PROJECTION get transformed model without projection
getTransform(verticies) { return verticies.map((vertex) => { // get transform values const [translationX, translationY, translationZ] = this.translation; const [rotationX, rotationY, rotationZ] = this.rotatation; const [scaleX, scaleY, scaleZ] = this.scaleFactor; // rotate the shape let rotatedVertex = [...vertex]; rotatedVertex = this.rotateX(rotatedVertex, rotationX); rotatedVertex = this.rotateY(rotatedVertex, rotationY); let [x, y, z] = rotatedVertex; // scale and translate the shape x = scaleX * x + translationX; y = scaleY * y + translationY; z = scaleZ * z + translationZ; return [x, y, z]; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "project(ax, ay, az, angles){\r\n var x = ax - this.camera_p.x;\r\n var y = ay - this.camera_p.y;\r\n var z = az - this.camera_p.z;\r\n \r\n var dx = angles.cy*(angles.sz*y + angles.cz*x) - angles.sy*z;\r\n var dy = angles.sx*(angles.cy*z + angles.sy*(angles.sz*y + angles.cz*x)) + angles.cx*(angle...
[ "0.7132224", "0.68284106", "0.6717954", "0.66893595", "0.6614909", "0.653818", "0.6478948", "0.6473981", "0.64714926", "0.64459884", "0.6434001", "0.6429961", "0.64135164", "0.6393653", "0.63844794", "0.63732", "0.63466984", "0.63457495", "0.63406414", "0.6328221", "0.6295469...
0.0
-1
The output should be, numbers printed in ascending order. Also print 'Bye' when you have printed all numbers. You can not modify the functions.
function printOne(callback) { setTimeout(function () { console.log('1'); return callback(); }, 100 * Math.random()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ascendentAlphabeticOder() {\n userOutput.sort(User.alphabeticOrder)\n}", "function printList(numbers) {\n\tconsole.log(\"Printing sorted list of size \" + numbers.length + \".\");\n for (var i=0; i<numbers.length; i++) {\n console.log(\"Number \" + numbers[i] + \" at position \" + i + \".\");\n ...
[ "0.65246713", "0.64771044", "0.6342027", "0.6196395", "0.6165612", "0.6113118", "0.60663044", "0.6029013", "0.6026974", "0.59831643", "0.5951342", "0.5904664", "0.58222413", "0.58130026", "0.5786532", "0.57652986", "0.57635325", "0.57596", "0.57454896", "0.57451934", "0.57130...
0.0
-1
false => NYT true => guardian
function handleSwitch() { setswitchst(prev=>!prev); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sara (country) {\n if (country.language == \"en\" && country.isIsland == false && country.population < 50) return true;\n else return false;\n}", "function isHometown(town){\n return town === 'San Francisco';\n}", "function checkMyLocation(){\n\n\t//trunkate(longitude, latitude); // is this c...
[ "0.6674892", "0.6594479", "0.6008048", "0.59568185", "0.5926676", "0.5922094", "0.5913752", "0.5913752", "0.58648413", "0.5852946", "0.5835752", "0.58326226", "0.5806411", "0.5801742", "0.5774677", "0.57675064", "0.5760941", "0.5748803", "0.57076037", "0.5700897", "0.56905955...
0.0
-1
[VERY NEW] create a new variable object params with max and min value
function calculateTagsParams(tags) { const params = { max: 0, min: 999999 } // [VERY NEW] START LOOP for every tags for (let tag in tags) { //console.log(tag + ' is used ' + tags[tag] + ' times '); /* first option - standard if*/ // [VERY NEW] set value for params.max as tags[tag] only if the value is higher than current if (tags[tag] > params.max) { params.max = tags[tag]; //console.log('params.max:', params.max); } if (tags[tag] < params.min) { params.min = tags[tag]; //console.log('params.min:', params.min); } //params.max = tags[tag]; /* second option - short if */ //params.max = tags[tag] > params.max ? tags[tag] : params.max; /* third option - math.max */ //params.max = Math.max(tags[tag], params.max); } return params; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get value(){ \r\n return { \r\n min : this._value[ 0 ], \r\n max : this._value[ 1 ]\r\n };\r\n }", "function setMinMaxValues(min, max) {\n numberGuessInput.min = min;\n numberGuessInput.max = max;\n}", "calculateLimits(){\n let { options } = this\n const { data } ...
[ "0.6783306", "0.6663964", "0.6660487", "0.6578921", "0.6557954", "0.64512557", "0.6335412", "0.62729156", "0.62388116", "0.6237682", "0.6204319", "0.6165976", "0.616245", "0.61591053", "0.6125878", "0.60918653", "0.6059303", "0.6059303", "0.59968925", "0.59704584", "0.5955509...
0.6255514
8
funzione per aggiungere oggetti
function creaVocabolo(pNome, pDescrizione) { if (dizionario.length == 0) { dizionario.push({ nome: pNome, descrizione: pDescrizione }) addContent(pNome, pDescrizione); } else { var found = false; for (i = 0; i < dizionario.length; i++) { if (dizionario[i].nome == pNome) { found = true; break; } } if (!found) { dizionario.push({ nome: pNome, descrizione: pDescrizione }) addContent(pNome, pDescrizione); } } localStorage.setItem('dizionario', JSON.stringify(dizionario)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function atualizaTodosGraficos() {\n\tvar diasMonitorados = diasMonitoradosPaciente();\n\tatualizaComBoxGrafico(diasMonitorados);\n\tvar diaAtual = dadosDiaAtual(diasMonitorados);\n\n\tgraficoPressaoArterial(diaAtual.dadosHoras);\n\tgraficoSaturacaoOxigenio(diaAtual.dadosHoras);\n\tgraficoFrequenciaCardiaca(diaAtu...
[ "0.5772954", "0.5764208", "0.56797075", "0.5660771", "0.5656834", "0.5624767", "0.55983895", "0.5584076", "0.55672", "0.5526605", "0.5524456", "0.5518277", "0.5514508", "0.55066407", "0.5496681", "0.54960525", "0.54673064", "0.5456788", "0.54455066", "0.54230213", "0.54215664...
0.0
-1
funzione per richiamare oggetti
function getVocaboli(ricerca) { for (i = 0; 0 < dizionario.length; i++) { if (dizionario[i].nome == ricerca) { return dizionario[i]; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dibujarPoligono(elem) {\n\n\tif(elem != undefined){\n\n\t\tlet hover; //LO USO POR SI EN ALGÚN MODULO DEBO CAMBIAR EL COLOR AL HACER UN CAMBIO DE COLOR EN EL HOVER\n\t\tlet label; //LO USO PARA EL MODULO DE ASIGNAR EN BARRIOS\n\t\t\n\t\tif(moduloActivado == \"NINGUNO\" ){\n\t\t\t//LIMPIO SI HAY UN POLIGON...
[ "0.5612063", "0.5586374", "0.5572551", "0.5555998", "0.55472285", "0.549075", "0.5458758", "0.5405292", "0.54019713", "0.5393895", "0.5385477", "0.53841984", "0.53563166", "0.5347542", "0.5346847", "0.5306801", "0.5305685", "0.5263006", "0.5251651", "0.5241662", "0.5223933", ...
0.0
-1
getting data from people.json
async function getPeople(){ const { data } = await axios.get('https://gist.githubusercontent.com/robherley/5112d73f5c69a632ef3ae9b7b3073f78/raw/24a7e1453e65a26a8aa12cd0fb266ed9679816aa/people.json'); return data; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getAllPeople() {\n const responseData = await fetch(\"https://ghibliapi.herokuapp.com/people\");\n\n const response = await responseData.json();\n\n return response;\n }", "function loadFamilyMembers() {\n fetch('json/family.json')\n .then(function(response) {\n return response.json();\n...
[ "0.68314505", "0.6778465", "0.6455208", "0.64488834", "0.6436285", "0.6436285", "0.6414431", "0.6410368", "0.6390599", "0.63405335", "0.6309547", "0.6301045", "0.6297168", "0.6291742", "0.6291594", "0.62797433", "0.627736", "0.6249573", "0.6241707", "0.62367123", "0.6212069",...
0.758931
1
Checking "id" for getPersonById()
function checkID(id,data) { if(!Number.isInteger(id)) { throw `Please enter a valid id.` } else if(id < 1 || id > data.length ) { throw `Given id is out of bound.` } else { return id; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPerson(id) {\n for (var i = 0; i < peopleArray.length; i++) {\n if (peopleArray[i].id == id) {\n return peopleArray[i];\n }\n }\n return '404';\n}", "getPersona(id) {\n let persona = this.personas.filter(persona => persona.id === id)[0];\n\n /*\n ...
[ "0.7403598", "0.70418465", "0.69516635", "0.6922267", "0.6910073", "0.6886381", "0.67447126", "0.6568197", "0.65472054", "0.65472054", "0.6523016", "0.6476233", "0.6456515", "0.6409082", "0.64081824", "0.63496023", "0.6294303", "0.62556434", "0.62496835", "0.62482166", "0.624...
0.0
-1
region Projects Functions Save a new project:
function SaveNewProject(){ var btn= $("#btnSaveProject"); $("#ModalTitle").text('ADD NEW PROJECT'); btn.off('click'); btn.on('click',(event)=>{ //Get the inputs references var name= $("#txtProjectName"); var Details= $("#txtDetails"); var inputs= [name,Details]; if (Validate(inputs)){ //create the object for sent to firebase database var date= new Date(); //Get the current user: var user= $("#LoginUser").text(); var Project= { Name: name.val(), Details: Details.val(), Created: date.getDate()+ '/'+date.getMonth()+'/'+date.getFullYear(), Progress: 0.0, UserName: user }; //save data to the database: database.collection('Project').add(Project).then(function(){ //success message alert(`El Proyecto: ${name.val()} fue guardado correctamente`); ClearInput(inputs); Get_ProjectList(); //Update the projects list: }).catch(function(error){ alert("A Ocurrido un error al ingresar los datos"); console.log(error); }) } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "save() {\n get(this, 'project').save().then(() => {\n this._enterReadMode();\n this._inferIfNeedsDescription();\n });\n }", "function saveDatatoProject(newValue) {\n const newProject = {\n ...projectData\n };\n\n newProject[\"aktivni\"] = newValue; //sna...
[ "0.7467968", "0.74651206", "0.73471063", "0.7321257", "0.72760534", "0.72169214", "0.71308714", "0.7123506", "0.7030681", "0.70028645", "0.6941053", "0.68595487", "0.6828979", "0.67870814", "0.6718898", "0.67042595", "0.66962045", "0.66726196", "0.66405237", "0.6636826", "0.6...
0.6639516
19
region Home client functions:
function MensajeDContacto(){ var nombre= $("#txtNombreCt"); var email= $("#txtCorreoCt"); var asunto= $("#txtAsuntoCt"); var mensaje= $("#txtMensajeCt"); var inputs= [nombre,email,asunto,mensaje]; if (Validate(inputs)){ alert(`Un mensaje a la dirección: ${email.val()}, fue enviado al nombre de: ${nombre.val()}`); ClearInput(inputs); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clientsStartup(){\n clients = clientIO.getClients();\n}", "function initclient() {\n\tvar model=new RemoteModel();\n\tvar view=new UserView();\n\tvar controller=new Controller(model,view);\n\tmodel.init();\n\tgeid('userinterface').innerHTML=\"client initialized\";\n\tgeid('title').innerHTML=\"IOktopu...
[ "0.6382658", "0.63480717", "0.6271121", "0.61364686", "0.60209763", "0.6003396", "0.5944739", "0.5943556", "0.59435225", "0.5836226", "0.5807815", "0.57912546", "0.57883465", "0.57883465", "0.5753102", "0.57515955", "0.5750421", "0.57461727", "0.57456195", "0.57284373", "0.57...
0.0
-1
XXX Add a relative_to attribute for interpreting the translation in spaces other than the local space (relative to the parent).
translate(vec) { const movement = vec3.zero.slice(); vec3.add(movement, this.position, vec); this.position = movement; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setRelativeTranslation(translation) {\n if(!translation.type || translation.type !== \"Vec3\") {\n if(!this.renderer.production) {\n throwWarning(this.type + \": Cannot set translation because the parameter passed is not of Vec3 type:\", translation);\n }\n\n ...
[ "0.59827626", "0.59039176", "0.5827378", "0.57191217", "0.5497457", "0.5400742", "0.53711396", "0.5366476", "0.53616744", "0.52704275", "0.5252196", "0.52429223", "0.5234877", "0.52115154", "0.52045715", "0.5193831", "0.51878315", "0.5182791", "0.51772374", "0.51748836", "0.5...
0.47957647
58
Generates a resolve object previously configured in constant.JS_REQUIRES (config.constant.js)
function loadSequence() { var _args = arguments; return { deps: ['$ocLazyLoad', '$q', function ($ocLL, $q) { var promise = $q.when(1); for (var i = 0, len = _args.length; i < len; i++) { promise = promiseThen(_args[i]); } return promise; function promiseThen(_arg) { if (typeof _arg === 'function') return promise.then(_arg); else return promise.then(function () { var nowLoad = requiredData(_arg); if (!nowLoad) return $.error('Route resolve: Bad resource name [' + _arg + ']'); return $ocLL.load(nowLoad); }); } function requiredData(name) { if (jsRequires.modules) for (var m in jsRequires.modules) if (jsRequires.modules[m].name && jsRequires.modules[m].name === name) return jsRequires.modules[m]; return jsRequires.scripts && jsRequires.scripts[name]; } }] }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resolveFor() {\r\n var _args = arguments;\r\n return {\r\n ___deps: ['$ocLazyLoad', '$q', function($ocLL, $q) {\r\n // Creates a promise chain for each argument\r\n var promiseChain = $q.when(1); // empty promis...
[ "0.58584124", "0.58021456", "0.578844", "0.57689834", "0.56053644", "0.5587856", "0.5490664", "0.5298922", "0.5246605", "0.5241532", "0.5184956", "0.51826674", "0.5148058", "0.5147385", "0.5147385", "0.5127657", "0.50985587", "0.5094028", "0.5082364", "0.50134987", "0.4955004...
0.4708654
61
Handle the start/end value constraining to 0..180, etc...
function clean_start_end_value(value){ // In case we pass in a number value = value.toString(); let changed = false; let new_value; if(value == ''){ // Check if empty string new_value = 0; changed = true; }else if(value.charAt(0) == '0'){ // Remove leading zeroes new_value = parseInt(value,10); changed = true; }else{ // Check if we exceed the limits for the start or end value new_value = parseInt(value,10); if(new_value > 180){ new_value = 180; changed = true; }else if(new_value < 0){ new_value = 0; changed = true; } } if(changed){ return new_value; }else{ return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateRange(activity, xValue, yValue) {\n\n}", "set bounds(value) {}", "rangeMapping(value, from, to) {\n return Math.floor(to[0] + (value - from[0]) * (to[1] - to[0]) / (from[1] - from[0]));\n }", "limits() {\n var keys = Object.keys(this.data);\n var min = parseInt(this.data[ke...
[ "0.6689874", "0.62834823", "0.6269869", "0.6231782", "0.6179317", "0.6128973", "0.60412896", "0.60296786", "0.60296786", "0.6023593", "0.60190034", "0.6006521", "0.5986064", "0.59630275", "0.58944094", "0.5882504", "0.5882504", "0.5882504", "0.5882504", "0.58604693", "0.58604...
0.65151143
1
Add temporary event listener for mousemove
function onStepDividerDrag(event){ mw.update_step_durations(drag_data, event.pageX, event.shiftKey); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMoveListener() {\n if(!listener.move) {\n document.addEventListener('mousemove', mouseMove, false);\n listener.move = true;\n }\n }", "on_mousemove(e, localX, localY) {\n\n }", "function bindMouseMove() {\r\n canvas.addEventListener('mousemove', function(e) {\r\n ...
[ "0.7879588", "0.75772965", "0.74769527", "0.7347611", "0.72266364", "0.7183163", "0.71751505", "0.71604633", "0.7145914", "0.7099674", "0.7076496", "0.70749044", "0.7058276", "0.70141417", "0.7010749", "0.70091766", "0.69945765", "0.6991167", "0.6980828", "0.6980135", "0.6955...
0.0
-1
object to check if a question is answered correctly upload user answers to the database
function getAllAnswers(readyFunction) { quizClient = new XMLHttpRequest(); var url = "http://developer.cege.ucl.ac.uk:" + httpPortNumber + "/allAnswers"; //get url with non-hardcoded port number quizClient.open("GET", url); quizClient.onreadystatechange = readyFunction; try { quizClient.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); } catch (e) { // this only works in internet explorer } quizClient.send(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkUserAnswer(answer) {\n//when the user selects an answer and it is exactly equal to an index in the correctAnswer object key,\n\tif(answer.text() === questionList[getCurrentIndex()].ansArray[questionList[getCurrentIndex()].correctAnswer]) {\n return true;\n console.log(true);\n } else {\n re...
[ "0.66782504", "0.6634931", "0.65979856", "0.65793616", "0.6535577", "0.6509558", "0.64725405", "0.6460733", "0.64486414", "0.6417369", "0.64014983", "0.6396989", "0.63869345", "0.6337917", "0.6336814", "0.633621", "0.6329948", "0.6321916", "0.6304643", "0.6298786", "0.6287086...
0.0
-1
to check if user has already answered the question
function checkRepeatQuestion(question_id){ for(var i = 0 ; i < allAnswers.length ; i++){ // if the port id has been found on the database on the same question if(allAnswers[i].question_id == question_id && allAnswers[i].port_id == httpPortNumber){ // display the chosen and the correct answers to the user return {'answer_selected': allAnswers[i].answer_selected, 'correct_answer': allAnswers[i].correct_answer}; } } return -1; //flag to detect if question has not been solved }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkUserAnswer(answer) {\n//when the user selects an answer and it is exactly equal to an index in the correctAnswer object key,\n\tif(answer.text() === questionList[getCurrentIndex()].ansArray[questionList[getCurrentIndex()].correctAnswer]) {\n return true;\n console.log(true);\n } else {\n re...
[ "0.73742044", "0.69606", "0.68704116", "0.68447226", "0.6828885", "0.6783673", "0.6760458", "0.66977996", "0.668895", "0.66622144", "0.66312754", "0.6594741", "0.65929717", "0.65744895", "0.6572207", "0.65684164", "0.65663403", "0.65567344", "0.6523644", "0.6520653", "0.65113...
0.68620414
3
add message into chat window
function addMessage(author, message) { if(author == myName) { $('#chatbox').append('<p class="myMsg"><span>me</span>' + ': ' + message + '</p>'); } else { $('#chatbox').append('<p class="otherMsg"><span style="font-weight: bold;">' + author + '</span>' + ': ' + message + '</p>'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addChatMessage(r) {\n\tvar chat = document.getElementById('chat_box');\n\tchat.innerHTML += formatChatMessage(r);\n\tchat.scrollTop = chat.scrollHeight;\n}", "function addMsg(room, msg, username)\n{\n //get the room\n var $room = $(\"#\"+room);\n\n //if no window is open, make a new one\n if...
[ "0.7870589", "0.77185494", "0.7665702", "0.752433", "0.74839723", "0.74695", "0.7435884", "0.74173456", "0.7415586", "0.7410998", "0.73758984", "0.7367728", "0.73578703", "0.73357165", "0.73291206", "0.7306232", "0.7291778", "0.7290415", "0.72766715", "0.7258159", "0.72513777...
0.70677495
50
Function Challenge 5 5h 37 min
function collect(gen, array) { return function () { var value = gen(); if (value !== undefined) { array.push(value); }; return value; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timePenalty() {\n timeRem =- 5;\n}", "function incorrect1(){\n totalTime = (totalTime- questionTime)\n console.log('-15')\n Q2()\n \n}", "function challenge3() {\n\n}", "function challenge2() {\n\n}", "function startover(){\n time = 10;\n correctanswer = 0;\n ...
[ "0.67201406", "0.6349121", "0.63186055", "0.6233984", "0.61129385", "0.6094651", "0.60894084", "0.6077223", "0.6077223", "0.6077223", "0.606872", "0.606774", "0.606774", "0.6067667", "0.60600024", "0.6052836", "0.6052836", "0.60483", "0.60457605", "0.60427576", "0.60410655", ...
0.0
-1
will do a function calling loop until gets value accepted by preducate
function filter (gen, predicate) { return function () { var value; do { value = gen(); } while ( value !==undefined && !predicate(value) ); return value; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async resolveWhile(predicate) {\n let x = await this.next();\n let shouldContinue = predicate(x.value);\n while ((!x.done) && shouldContinue) {\n x = await this.next();\n shouldContinue = predicate(x.value);\n }\n }", "function until(condiiton, block)\n{\n\tva...
[ "0.62812376", "0.5834331", "0.5755098", "0.5702624", "0.5698593", "0.56493473", "0.5637271", "0.5616448", "0.56115264", "0.55585706", "0.5525874", "0.5520028", "0.5511583", "0.549858", "0.549797", "0.54913175", "0.5466795", "0.5463426", "0.5458323", "0.54566133", "0.5455536",...
0.0
-1
Function Challenge 6 5h 47
function gensymf(prefix) { var number = 0; return function () { number += 1; return prefix + number; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function challenge2() {\n\n}", "function challenge3() {\n\n}", "function solution(s) {\n\n}", "function challenge1() {\n\n}", "function challenge1() {\n\n}", "function solution(A) {\n\n}", "function exercise07() {}", "function exercise11() {}", "function solution(arr){\n\n}", "function exercise06...
[ "0.70380205", "0.703487", "0.6749478", "0.6708105", "0.6708105", "0.64549625", "0.6441679", "0.64034915", "0.6390859", "0.6141166", "0.61223066", "0.60784066", "0.57858026", "0.5769408", "0.57559204", "0.57461077", "0.5726352", "0.57244235", "0.56870174", "0.5675087", "0.5660...
0.0
-1
mozna uzyc switch zeby ogarnac dwa pierwsze znaki a pozniej je dodawac albo sposobu ponizej
function fibonaccif (a, b) { return function () { var next = a; a = b; b += next; return next; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onSwitch() {}", "onSwitch() {}", "onSwitch() {}", "function handleSwitch() {\n setswitchst(prev=>!prev);\n }", "function switchMode(){\n\t\ttoggleSwitch(addrSwitch);\n\t\tif (compMode()==\"data\"){\n\t\t\t//$('.led-a').each(function(){ toggleLedOff($(this)); });\n\t\t\tfor(var i=0; i<=7; i++){\n\t\t\...
[ "0.7111927", "0.7111927", "0.7111927", "0.69630766", "0.6812079", "0.6564894", "0.6483519", "0.64675194", "0.64420897", "0.6392814", "0.628601", "0.6264702", "0.620821", "0.6150405", "0.614268", "0.61327916", "0.6109294", "0.6104258", "0.6097151", "0.609049", "0.60850585", ...
0.0
-1