├── slides.pdf ├── public ├── robots.txt ├── favicon.ico ├── logo192.png ├── logo512.png ├── manifest.json └── index.html ├── .env_sample ├── .gitpod.Dockerfile ├── src ├── App.js ├── setupTests.js ├── App.test.js ├── index.css ├── reportWebVitals.js ├── index.js ├── App.css ├── components │ └── Form.js └── logo.svg ├── .gitignore ├── .gitpod.yml ├── package.json ├── nerdholidays.csv ├── README.md └── LICENSE /slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datastaxdevs/workshop-nerd-holidays/main/slides.pdf -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datastaxdevs/workshop-nerd-holidays/main/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datastaxdevs/workshop-nerd-holidays/main/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datastaxdevs/workshop-nerd-holidays/main/public/logo512.png -------------------------------------------------------------------------------- /.env_sample: -------------------------------------------------------------------------------- 1 | REACT_APP_ASTRA_DB_ID= 2 | REACT_APP_ASTRA_DB_REGION= 3 | REACT_APP_ASTRA_DB_TOKEN= 4 | -------------------------------------------------------------------------------- /.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gitpod/workspace-full:latest 2 | RUN bash -c ". .nvm/nvm.sh && nvm install 14.18.2 && nvm use 14.18.2 && nvm alias default 14.18.2" 3 | RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix 4 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import './App.css'; 2 | import Form from './components/Form' 3 | 4 | function App() { 5 | return ( 6 |
7 |
8 |
9 | ); 10 | } 11 | 12 | export default App; 13 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | .env 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | package.json 26 | package-lock* 27 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | /* background-color: #282c34; */ 4 | 5 | } 6 | 7 | .App-logo { 8 | height: 40vmin; 9 | pointer-events: none; 10 | } 11 | 12 | @media (prefers-reduced-motion: no-preference) { 13 | .App-logo { 14 | animation: App-logo-spin infinite 20s linear; 15 | } 16 | } 17 | 18 | .title { 19 | color: 282c34; 20 | } 21 | 22 | .label { 23 | color: purple; 24 | } 25 | 26 | .App-header { 27 | min-height: 100vh; 28 | display: flex; 29 | flex-direction: column; 30 | align-items: center; 31 | justify-content: center; 32 | font-size: calc(10px + 2vmin); 33 | color: white; 34 | } 35 | 36 | .App-link { 37 | color: #61dafb; 38 | } 39 | 40 | @keyframes App-logo-spin { 41 | from { 42 | transform: rotate(0deg); 43 | } 44 | to { 45 | transform: rotate(360deg); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: 2 | file: .gitpod.Dockerfile 3 | tasks: 4 | - name: setup 5 | before: | 6 | # REMOVE USER VALIDATION -Y ON JAVA 17 INSTALLATION 7 | sed -i '1,$s/sdkman_auto_answer=false/sdkman_auto_answer=true/' /home/gitpod/.sdkman/etc/config 8 | sed -i '1,$s/sdkman_selfupdate_enable=true/sdkman_selfupdate_enable=false/' /home/gitpod/.sdkman/etc/config 9 | 10 | # JAVA 17 INSTALL 11 | sdk install java 12 | 13 | mvn install -f backend/pom.xml -DskipTests 14 | npm --prefix ui install 15 | npm --prefix ui run build 16 | npm install @emotion/react 17 | npm install @emotion/styled 18 | npm install @mui/material 19 | npm install @mui/x-data-grid 20 | npm install axios 21 | curl -Ls "https://dtsx.io/get-astra-cli" | bash >> ./install.log 22 | command: | 23 | gp open README.md 24 | unset JAVA_TOOL_OPTIONS 25 | source /home/gitpod/.astra/cli/astra-init.sh 26 | # astra setup 27 | ports: 28 | - port: 8080 29 | onOpen: open-browser 30 | visibility: public 31 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nerd-holidays-react", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@emotion/react": "^11.10.8", 7 | "@emotion/styled": "^11.10.8", 8 | "@mui/material": "^5.12.3", 9 | "@mui/x-data-grid": "^6.3.1", 10 | "@testing-library/jest-dom": "^5.16.5", 11 | "@testing-library/react": "^13.4.0", 12 | "@testing-library/user-event": "^13.5.0", 13 | "axios": "^1.4.0", 14 | "dotenv": "^16.0.3", 15 | "react": "^18.2.0", 16 | "react-dom": "^18.2.0", 17 | "react-scripts": "5.0.1", 18 | "web-vitals": "^2.1.4" 19 | }, 20 | "scripts": { 21 | "start": "react-scripts start", 22 | "build": "react-scripts build", 23 | "test": "react-scripts test", 24 | "eject": "react-scripts eject" 25 | }, 26 | "eslintConfig": { 27 | "extends": [ 28 | "react-app", 29 | "react-app/jest" 30 | ] 31 | }, 32 | "browserslist": { 33 | "production": [ 34 | ">0.2%", 35 | "not dead", 36 | "not op_mini all" 37 | ], 38 | "development": [ 39 | "last 1 chrome version", 40 | "last 1 firefox version", 41 | "last 1 safari version" 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /nerdholidays.csv: -------------------------------------------------------------------------------- 1 | year_bucket,event_date,id,name 2 | 2023,20230102,6dcaf75c-fc82-4abc-a9c4-f309c243c9e4,Isaac Asimov's Birthday 3 | 2023,20230102,c5fc99ae-5152-4e32-ab66-69af3707c7e7,Sci-Fi Day 4 | 2023,20230115,594efae0-1fbf-4f25-96b7-6b02390bb837,Apple Computer Day 5 | 2023,20230207,5ab271a9-08d7-4d2c-8e76-a738cc067750,e Day 6 | 2023,20230314,da23f06d-1893-4301-aa16-5e8999db7bec,Pi Day 7 | 2023,20230325,dceadce5-3b19-4fd7-a382-c9e6f9c7031b,Fall of Sauron Day 8 | 2023,20230405,56cb1449-c175-4eb8-aa04-4fff735611ff,First Contact Day 9 | 2023,20230430,20675554-adc6-4947-8217-8b52243959c1,International Tabletop Day 10 | 2023,20230504,6738fb07-b405-45ea-aa56-bbafa9917e72,Star Wars Day 11 | 2023,20230525,c44a8343-6978-4674-a3e0-32ca77b843c4,Towel Day 12 | 2023,20230616,37aa46c9-b4ca-48dd-b4dc-c44324da1e36,Captain Picard Day 13 | 2023,20230628,7b4a030c-0107-4cb8-83c1-6b06be87622e,CAPS LOCK DAY 14 | 2023,20230728,632602b3-c53b-4ea7-8573-71bc76a8f962,SysAdmin Appreciation Day 15 | 2023,20230804,5f1fdef0-b48f-41c0-8a35-462b59116502,International Beer Day 16 | 2023,20230812,90e15a9a-367d-4e06-8f46-a6d294ab56ac,IBM PC Day 17 | 2023,20230919,61339711-8506-4c1f-a44e-b2add99153aa,Talk Like a Pirate Day 18 | 2023,20230922,f6374e5e-5204-4826-a724-bdd6fe75ea8a,Hobbit Day 19 | 2023,20231002,d919354d-f530-44a0-931d-5ae776a718b9,Ada Lovelace Day 20 | 2023,20231015,46289a89-76c5-4fa1-8ea5-2f1d597f2ae4,Marty McFly Day 21 | 2023,20231123,21a0fc78-c4c0-46b5-82bf-a6b301025a06,Tardis Day 22 | 2023,20231123,bb0c225b-45f1-408b-9444-703d4b01cd50,Fibonacci Day 23 | 2023,20231130,5fffd93b-936b-4d4d-a07d-1a1ffbefdbf4,Computer Security Day 24 | 2023,20231221,f8ff6ba9-eb06-4ba0-8cae-7e02e02c3077,Rush 2112 Day 25 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/components/Form.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect, Component } from 'react' 2 | import { DataGrid, GridRowsProp, GridColDef } from '@mui/x-data-grid'; 3 | import axios from 'axios' 4 | 5 | class Form extends Component { 6 | 7 | constructor(props) { 8 | super(props) 9 | 10 | this.state = { 11 | year: '', 12 | eventdata: [] 13 | } 14 | } 15 | 16 | handleYearChange = event => { 17 | this.setState({ 18 | year: event.target.value 19 | }) 20 | } 21 | 22 | handleSubmit = event => { 23 | event.preventDefault() 24 | 25 | let config = { 26 | headers: { 27 | 'Content-Type': 'application/json', 28 | 'Accept': 'application/json', 29 | 'X-Cassandra-Token': process.env.REACT_APP_ASTRA_DB_TOKEN 30 | } 31 | } 32 | 33 | // submit year to endpoint 34 | axios 35 | .get('https://' + process.env.REACT_APP_ASTRA_DB_ID + '-' + process.env.REACT_APP_ASTRA_DB_REGION + '.apps.astra.datastax.com/api/rest/v2/keyspaces/live_coding/nerd_holidays/' + this.state.year, config) 36 | .then(response => { 37 | this.setState({eventdata: response.data.data}) 38 | console.log(this.state.eventdata) 39 | }) 40 | .catch(error => { 41 | console.log(error) 42 | }) 43 | } 44 | 45 | render() { 46 | const columns: GridColDef[] = [ 47 | { field: 'id', headerName: 'id', width: 150 }, 48 | { field: 'name', headerName: 'Name', width: 250 }, 49 | { field: 'event_date', headerName: 'Event Date', width: 100 } 50 | ]; 51 | 52 | return ( 53 |
54 | 55 |
56 |

Nerd Holiday viewer

57 | 58 | 61 |
62 | 63 | 64 |
65 |
66 | 71 |
72 |
73 | ) 74 | } 75 | } 76 | 77 | export default Form -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React app to view Nerd Holidays on [Astra DB](https://astra.datastax.com/) 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Astra DB 6 | 7 | ### Create a new Astra database. 8 | 9 | If you do not have an [Astra](https://astra.datastax.com/) account, sign-up for one. Create a new database. You can name it whatever you like, but make sure to use "live_coding" as the (default) *keyspace* name. 10 | 11 | Pick Google Cloud Platform (GCP) as a provider, and select the region "us-east1" in "Moncks Corner, SC" to get access to the "free" tier. Your new database should be ready for you in just a few minutes! 12 | 13 | Once it is running, you can use Astra CLI 14 | 15 | Let's build a quick model to host data on Nerd Holidays. Open CQL Console (aka cqlsh) on Astra OR use the new [Astra CLI](https://www.datastax.com/blog/introducing-cassandra-astra-cli) to get access to the database console. 16 | 17 | First, let's switch over to our "live_coding" keyspace: 18 | 19 | ```sql 20 | use live_coding; 21 | ``` 22 | 23 | Copy/paste the DDL. 24 | 25 | ### Table Schema 26 | ```sql 27 | CREATE TABLE nerd_holidays ( 28 | year_bucket BIGINT, 29 | event_date BIGINT, 30 | name TEXT, 31 | id UUID, 32 | PRIMARY KEY ((year_bucket), event_date, id) 33 | ) WITH CLUSTERING ORDER BY (event_date ASC, id ASC); 34 | ``` 35 | 36 | Copy/paste the DML. 37 | 38 | ### Table Data 39 | ```sql 40 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 41 | VALUES (2023,20230102,UUID(),'Sci-Fi Day'); 42 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 43 | VALUES (2023,20230102,UUID(),'Isaac Asimov''s Birthday'); 44 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 45 | VALUES (2023,20230115,UUID(),'Apple Computer Day'); 46 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 47 | VALUES (2023,20230207,UUID(),'e Day'); 48 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 49 | VALUES (2023,20230314,UUID(),'Pi Day'); 50 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 51 | VALUES (2023,20230325,UUID(),'Fall of Sauron Day'); 52 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 53 | VALUES (2023,20230405,UUID(),'First Contact Day'); 54 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 55 | VALUES (2023,20230430,UUID(),'International Tabletop Day'); 56 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 57 | VALUES (2023,20230504,UUID(),'Star Wars Day'); 58 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 59 | VALUES (2023,20230525,UUID(),'Towel Day'); 60 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 61 | VALUES (2023,20230616,UUID(),'Captain Picard Day'); 62 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 63 | VALUES (2023,20230628,UUID(),'CAPS LOCK DAY'); 64 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 65 | VALUES (2023,20230728,UUID(),'SysAdmin Appreciation Day'); 66 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 67 | VALUES (2023,20230804,UUID(),'International Beer Day'); 68 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 69 | VALUES (2023,20230812,UUID(),'IBM PC Day'); 70 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 71 | VALUES (2023,20230919,UUID(),'Talk Like a Pirate Day'); 72 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 73 | VALUES (2023,20230922,UUID(),'Hobbit Day'); 74 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 75 | VALUES (2023,20231002,UUID(),'Ada Lovelace Day'); 76 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 77 | VALUES (2023,20231015,UUID(),'Marty McFly Day'); 78 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 79 | VALUES (2023,20231123,UUID(),'Tardis Day'); 80 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 81 | VALUES (2023,20231123,UUID(),'Fibonacci Day'); 82 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 83 | VALUES (2023,20231130,UUID(),'Computer Security Day'); 84 | INSERT INTO nerd_holidays (year_bucket, event_date, id, name) 85 | VALUES (2023,20231221,UUID(),'Rush 2112 Day'); 86 | ``` 87 | 88 | ## GitPod ## 89 | 90 | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/datastaxdevs/workshop-nerd-holidays) 91 | 92 | ## Environment file 93 | 94 | You will need to build a `.env` file in the project's root directory for it to know how to connect to Astra DB. There is an `.env_sample` file included to help you with this. Just rename that file to be your new `.env`, edit your values, and you're all set: 95 | 96 | ``` 97 | mv .env_sample .env 98 | ``` 99 | 100 | Edit this file, and define the following variables. The values can be retrieve from your account on https://astra.datastax.com. 101 | 102 | ``` 103 | REACT_APP_ASTRA_DB_ID= 104 | REACT_APP_ASTRA_DB_REGION= 105 | REACT_APP_ASTRA_DB_TOKEN= 106 | ``` 107 | 108 | ## React.js dependencies 109 | 110 | Be sure to install the following npm packages: 111 | 112 | ``` 113 | npm install @mui/material @emotion/react @emotion/styled 114 | npm install @mui/x-data-grid 115 | npm install axios 116 | ``` 117 | 118 | ## Available Scripts 119 | 120 | In the project directory, you can run: 121 | 122 | ### `npm start` 123 | 124 | Runs the app in the development mode.\ 125 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 126 | 127 | The page will reload when you make changes.\ 128 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------