├── java ├── github-copilot │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ └── java │ │ │ │ └── dev │ │ │ │ └── danvega │ │ │ │ └── githubcopilot │ │ │ │ ├── Test.java │ │ │ │ ├── utils │ │ │ │ ├── StringUtils.java │ │ │ │ ├── MathUtils.java │ │ │ │ └── CalendarUtils.java │ │ │ │ ├── GithubCopilotApplication.java │ │ │ │ ├── model │ │ │ │ └── Employee.java │ │ │ │ ├── controller │ │ │ │ └── EmployeeController.java │ │ │ │ └── service │ │ │ │ ├── EmployeeService.java │ │ │ │ └── WhiteboardService.java │ │ └── test │ │ │ └── java │ │ │ └── dev │ │ │ └── danvega │ │ │ └── githubcopilot │ │ │ ├── GithubCopilotApplicationTests.java │ │ │ └── service │ │ │ └── WhiteboardServiceTest.java │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ ├── maven-wrapper.properties │ │ │ └── MavenWrapperDownloader.java │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── mvnw.cmd ├── java-faker │ ├── java-faker-thumbnail.png │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ ├── maven-wrapper.properties │ │ │ └── MavenWrapperDownloader.java │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ └── java │ │ │ │ └── dev │ │ │ │ └── danvega │ │ │ │ └── javafaker │ │ │ │ ├── repository │ │ │ │ └── PersonRepository.java │ │ │ │ ├── config │ │ │ │ └── SampleDataConfig.java │ │ │ │ ├── JavaFakerApplication.java │ │ │ │ ├── controller │ │ │ │ └── PersonController.java │ │ │ │ ├── SampleDataLoader.java │ │ │ │ └── model │ │ │ │ ├── Address.java │ │ │ │ └── Person.java │ │ └── test │ │ │ └── java │ │ │ └── dev │ │ │ └── danvega │ │ │ └── javafaker │ │ │ └── JavaFakerApplicationTests.java │ ├── README.md │ ├── .gitignore │ ├── pom.xml │ ├── mvnw.cmd │ └── mvnw ├── java-records │ ├── src │ │ └── dev │ │ │ └── danvega │ │ │ ├── Employee.java │ │ │ ├── Main.java │ │ │ └── Person.java │ └── out │ │ └── production │ │ └── java-records │ │ └── dev │ │ └── danvega │ │ ├── Main.class │ │ └── Employee.class ├── stream-to-list │ └── src │ │ └── dev │ │ └── danvega │ │ ├── Developer.java │ │ └── Main.java └── java-faker-jdbc │ ├── pom.xml │ └── src │ └── main │ └── java │ └── dev │ └── danvega │ ├── model │ ├── Address.java │ └── Person.java │ └── Application.java ├── spring-boot ├── log4jv │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ └── java │ │ │ │ └── dev │ │ │ │ └── danvega │ │ │ │ └── log4jv │ │ │ │ └── Log4jvApplication.java │ │ └── test │ │ │ └── java │ │ │ └── dev │ │ │ └── danvega │ │ │ └── log4jv │ │ │ └── Log4jvApplicationTests.java │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ ├── maven-wrapper.properties │ │ │ └── MavenWrapperDownloader.java │ ├── .gitignore │ ├── pom.xml │ └── mvnw.cmd ├── crud-rest-api │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ ├── application-test.properties │ │ │ │ ├── application.properties │ │ │ │ ├── schema.sql │ │ │ │ └── data.sql │ │ │ └── java │ │ │ │ └── dev │ │ │ │ └── danvega │ │ │ │ ├── dao │ │ │ │ ├── DAO.java │ │ │ │ └── CourseJdbcDAO.java │ │ │ │ ├── CrudRestApiApplication.java │ │ │ │ ├── controller │ │ │ │ └── CourseController.java │ │ │ │ └── model │ │ │ │ └── Course.java │ │ └── test │ │ │ ├── resources │ │ │ └── sql │ │ │ │ ├── course_schema.sql │ │ │ │ └── course_data.sql │ │ │ └── java │ │ │ └── dev │ │ │ └── danvega │ │ │ ├── dao │ │ │ └── CourseJdbcDAOTest.java │ │ │ └── controller │ │ │ └── CourseControllerTest.java │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ ├── maven-wrapper.properties │ │ │ └── MavenWrapperDownloader.java │ ├── .gitignore │ ├── pom.xml │ ├── mvnw.cmd │ └── mvnw ├── hello-spring │ ├── hello-spring.iml │ ├── .settings │ │ ├── org.eclipse.jdt.apt.core.prefs │ │ ├── org.eclipse.m2e.core.prefs │ │ └── org.eclipse.jdt.core.prefs │ ├── target │ │ └── classes │ │ │ └── dev │ │ │ └── danvega │ │ │ ├── Application.class │ │ │ ├── model │ │ │ └── Course.class │ │ │ ├── config │ │ │ └── AppConfig.class │ │ │ ├── service │ │ │ ├── CrudService.class │ │ │ └── CourseService.class │ │ │ └── repository │ │ │ ├── CrudRepository.class │ │ │ └── CourseRepository.class │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── dev │ │ │ └── danvega │ │ │ ├── repository │ │ │ ├── CrudRepository.java │ │ │ └── CourseRepository.java │ │ │ ├── service │ │ │ ├── CrudService.java │ │ │ └── CourseService.java │ │ │ ├── config │ │ │ └── AppConfig.java │ │ │ ├── Application.java │ │ │ └── model │ │ │ └── Course.java │ ├── .idea │ │ ├── vcs.xml │ │ ├── .gitignore │ │ ├── misc.xml │ │ ├── compiler.xml │ │ ├── jarRepositories.xml │ │ └── uiDesigner.xml │ ├── pom.xml │ ├── .project │ └── .classpath └── records │ ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java │ ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.properties │ │ │ └── schema.sql │ │ └── java │ │ │ └── dev │ │ │ └── danvega │ │ │ └── records │ │ │ ├── EmployeeRepository.java │ │ │ ├── EmployeeController.java │ │ │ ├── Employee.java │ │ │ └── RecordsApplication.java │ └── test │ │ └── java │ │ └── dev │ │ └── danvega │ │ └── records │ │ ├── EmployeeTest.java │ │ ├── EmployeeControllerTest.java │ │ └── EmployeeRepositoryTest.java │ ├── .gitignore │ ├── pom.xml │ └── mvnw.cmd ├── README.md ├── nuxt ├── hello-nitro │ ├── server │ │ └── api │ │ │ ├── hello.js │ │ │ ├── now.ts │ │ │ └── posts.ts │ ├── .gitignore │ ├── assets │ │ └── css │ │ │ └── tailwind.css │ ├── README.md │ ├── tsconfig.json │ ├── pages │ │ ├── now.vue │ │ ├── posts │ │ │ └── [id].vue │ │ └── index.vue │ ├── package.json │ ├── tailwind.config.js │ └── nuxt.config.ts ├── hello-nuxt3 │ ├── server │ │ └── api │ │ │ └── hello.js │ ├── pages │ │ ├── about.vue │ │ └── index.vue │ ├── .gitignore │ ├── tsconfig.json │ ├── components │ │ ├── TheFooter.vue │ │ └── TheHeader.vue │ ├── nuxt.config.ts │ ├── layouts │ │ └── default.vue │ ├── package.json │ └── README.md ├── content-suggestions │ ├── .gitignore │ ├── assets │ │ └── css │ │ │ └── tailwind.css │ ├── tsconfig.json │ ├── tailwind.config.js │ ├── nuxt.config.ts │ ├── pages │ │ └── index.vue │ ├── README.md │ ├── package.json │ ├── server │ │ └── api │ │ │ └── notion.js │ └── components │ │ └── ContentGrid.vue └── hello-tailwind-3 │ ├── .gitignore │ ├── assets │ └── css │ │ └── tailwind.css │ ├── tsconfig.json │ ├── pages │ ├── index.vue │ └── features.vue │ ├── tailwind.config.js │ ├── package.json │ ├── nuxt.config.ts │ └── README.md └── .gitignore /java/github-copilot/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spring-boot/log4jv/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/main/resources/application-test.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YouTube 2 | A collection of tutorials for my YouTube channel 3 | -------------------------------------------------------------------------------- /nuxt/hello-nitro/server/api/hello.js: -------------------------------------------------------------------------------- 1 | export default () => "Hello, Nitro!"; 2 | -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/server/api/hello.js: -------------------------------------------------------------------------------- 1 | export default (req,res) => 'Hello World!'; 2 | -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/pages/about.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /nuxt/hello-nitro/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | .nuxt 4 | nuxt.d.ts 5 | .output 6 | .env -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | .nuxt 4 | nuxt.d.ts 5 | .output 6 | .env -------------------------------------------------------------------------------- /nuxt/content-suggestions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | .nuxt 4 | nuxt.d.ts 5 | .output 6 | .env -------------------------------------------------------------------------------- /nuxt/hello-tailwind-3/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | .nuxt 4 | nuxt.d.ts 5 | .output 6 | .env -------------------------------------------------------------------------------- /nuxt/hello-nitro/assets/css/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /nuxt/hello-tailwind-3/assets/css/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /nuxt/content-suggestions/assets/css/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/hello-spring.iml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /java/java-faker/java-faker-thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/java/java-faker/java-faker-thumbnail.png -------------------------------------------------------------------------------- /nuxt/hello-nitro/README.md: -------------------------------------------------------------------------------- 1 | # Nuxt 3 Server Example 2 | 3 | ## Posts 4 | 5 | ## Server 6 | 7 | ## Views 8 | 9 | 10 | -------------------------------------------------------------------------------- /nuxt/hello-nitro/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://v3.nuxtjs.org/concepts/typescript 3 | "extends": "./.nuxt/tsconfig.json" 4 | } 5 | -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://v3.nuxtjs.org/concepts/typescript 3 | "extends": "./.nuxt/tsconfig.json" 4 | } 5 | -------------------------------------------------------------------------------- /java/java-faker/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/java/java-faker/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /nuxt/content-suggestions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://v3.nuxtjs.org/concepts/typescript 3 | "extends": "./.nuxt/tsconfig.json" 4 | } 5 | -------------------------------------------------------------------------------- /nuxt/hello-tailwind-3/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://v3.nuxtjs.org/concepts/typescript 3 | "extends": "./.nuxt/tsconfig.json" 4 | } 5 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=false 3 | -------------------------------------------------------------------------------- /java/github-copilot/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/java/github-copilot/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-boot/log4jv/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/spring-boot/log4jv/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-boot/records/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/spring-boot/records/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/spring-boot/crud-rest-api/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /spring-boot/hello-spring/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /java/java-records/src/dev/danvega/Employee.java: -------------------------------------------------------------------------------- 1 | package dev.danvega; 2 | 3 | public record Employee(int id, String firstName, String lastName, String email) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/components/TheFooter.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/pages/index.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 8 | -------------------------------------------------------------------------------- /spring-boot/records/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.name=employees 2 | spring.datasource.generate-unique-name=false 3 | spring.h2.console.enabled=true 4 | -------------------------------------------------------------------------------- /java/java-records/out/production/java-records/dev/danvega/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/java/java-records/out/production/java-records/dev/danvega/Main.class -------------------------------------------------------------------------------- /java/stream-to-list/src/dev/danvega/Developer.java: -------------------------------------------------------------------------------- 1 | package dev.danvega; 2 | 3 | import java.util.List; 4 | 5 | public record Developer(String name, List languages) { 6 | } 7 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/target/classes/dev/danvega/Application.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/spring-boot/hello-spring/target/classes/dev/danvega/Application.class -------------------------------------------------------------------------------- /spring-boot/hello-spring/target/classes/dev/danvega/model/Course.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/spring-boot/hello-spring/target/classes/dev/danvega/model/Course.class -------------------------------------------------------------------------------- /java/java-records/out/production/java-records/dev/danvega/Employee.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/java/java-records/out/production/java-records/dev/danvega/Employee.class -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/nuxt.config.ts: -------------------------------------------------------------------------------- 1 | import { defineNuxtConfig } from 'nuxt3' 2 | 3 | // https://v3.nuxtjs.org/docs/directory-structure/nuxt.config 4 | export default defineNuxtConfig({ 5 | 6 | }) 7 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.generate-unique-name=false 2 | spring.datasource.name=course-platform 3 | spring.h2.console.enabled=true 4 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/target/classes/dev/danvega/config/AppConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/spring-boot/hello-spring/target/classes/dev/danvega/config/AppConfig.class -------------------------------------------------------------------------------- /spring-boot/hello-spring/target/classes/dev/danvega/service/CrudService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/spring-boot/hello-spring/target/classes/dev/danvega/service/CrudService.class -------------------------------------------------------------------------------- /java/java-faker/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.h2.console.enabled=true 2 | spring.datasource.generate-unique-name=false 3 | spring.datasource.name=people 4 | 5 | spring.jpa.show-sql=true 6 | -------------------------------------------------------------------------------- /nuxt/hello-tailwind-3/pages/index.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/target/classes/dev/danvega/service/CourseService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/spring-boot/hello-spring/target/classes/dev/danvega/service/CourseService.class -------------------------------------------------------------------------------- /nuxt/hello-nitro/server/api/now.ts: -------------------------------------------------------------------------------- 1 | import {IncomingMessage, ServerResponse} from 'http'; 2 | 3 | export default(req:IncomingMessage, res:ServerResponse) => { 4 | return new Date().toLocaleTimeString(); 5 | } 6 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/target/classes/dev/danvega/repository/CrudRepository.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/spring-boot/hello-spring/target/classes/dev/danvega/repository/CrudRepository.class -------------------------------------------------------------------------------- /spring-boot/records/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE EMPLOYEE( 2 | id integer IDENTITY primary key, 3 | first_name varchar(100), 4 | last_name varchar(100), 5 | email varchar(255) 6 | ); 7 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/target/classes/dev/danvega/repository/CourseRepository.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danvega/youtube/HEAD/spring-boot/hello-spring/target/classes/dev/danvega/repository/CourseRepository.class -------------------------------------------------------------------------------- /spring-boot/hello-spring/src/main/java/dev/danvega/repository/CrudRepository.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.repository; 2 | 3 | import java.util.List; 4 | 5 | public interface CrudRepository { 6 | 7 | List findAll(); 8 | } 9 | -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/layouts/default.vue: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /java/github-copilot/src/main/java/dev/danvega/githubcopilot/Test.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot; 2 | 3 | public class Test { 4 | public static void main(String[] args) { 5 | System.out.println("Hello World!"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "nuxi dev", 5 | "build": "nuxi build", 6 | "start": "node .output/server/index.mjs" 7 | }, 8 | "devDependencies": { 9 | "nuxt3": "latest" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /spring-boot/records/src/main/java/dev/danvega/records/EmployeeRepository.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.records; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | 5 | public interface EmployeeRepository extends CrudRepository { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /java/github-copilot/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /java/java-faker/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.2/apache-maven-3.8.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/components/TheHeader.vue: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /spring-boot/log4jv/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /spring-boot/records/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.2/apache-maven-3.8.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /java/java-faker/README.md: -------------------------------------------------------------------------------- 1 | # How to create sample data for your Java application 2 | 3 | Are you working on a new Java application and need to load some sample data? If so this tutorial is going to teach you how to use a project called Java Faker. 4 | 5 | 6 | ![](java-faker-thumbnail.png) 7 | -------------------------------------------------------------------------------- /nuxt/hello-nitro/pages/now.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 11 | -------------------------------------------------------------------------------- /nuxt/hello-nitro/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "nuxi dev", 5 | "build": "nuxi build", 6 | "start": "node .output/server/index.mjs" 7 | }, 8 | "devDependencies": { 9 | "nuxt3": "latest", 10 | "tailwindcss": "^3.0.7" 11 | }, 12 | "dependencies": {} 13 | } 14 | -------------------------------------------------------------------------------- /nuxt/hello-nitro/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | content: [ 3 | "./components/**/*.{js,vue,ts}", 4 | "./layouts/**/*.vue", 5 | "./pages/**/*.vue", 6 | "./plugins/**/*.{js,ts}", 7 | "./nuxt.config.{js,ts}", 8 | ], 9 | theme: { 10 | extend: {}, 11 | }, 12 | plugins: [], 13 | } 14 | -------------------------------------------------------------------------------- /nuxt/hello-tailwind-3/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | content: [ 3 | "./components/**/*.{js,vue,ts}", 4 | "./layouts/**/*.vue", 5 | "./pages/**/*.vue", 6 | "./plugins/**/*.{js,ts}", 7 | "./nuxt.config.{js,ts}", 8 | ], 9 | theme: { 10 | extend: {}, 11 | }, 12 | plugins: [], 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot/log4jv/src/test/java/dev/danvega/log4jv/Log4jvApplicationTests.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.log4jv; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class Log4jvApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /java/java-faker/src/test/java/dev/danvega/javafaker/JavaFakerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.javafaker; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class JavaFakerApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/main/java/dev/danvega/dao/DAO.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.dao; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | public interface DAO { 7 | List list(); 8 | 9 | T create(T t); 10 | 11 | Optional get(int id); 12 | 13 | void update(T t, int id); 14 | 15 | void delete(int id); 16 | } 17 | -------------------------------------------------------------------------------- /nuxt/hello-tailwind-3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "nuxi dev", 5 | "build": "nuxi build", 6 | "start": "node .output/server/index.mjs" 7 | }, 8 | "devDependencies": { 9 | "nuxt3": "latest", 10 | "tailwindcss": "^3.0.7" 11 | }, 12 | "dependencies": { 13 | "@heroicons/vue": "^1.0.5" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /java/github-copilot/src/test/java/dev/danvega/githubcopilot/GithubCopilotApplicationTests.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class GithubCopilotApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /java/github-copilot/src/main/java/dev/danvega/githubcopilot/utils/StringUtils.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot.utils; 2 | 3 | public class StringUtils { 4 | 5 | public String reverse(String s) { 6 | return new StringBuilder(s).reverse().toString(); 7 | } 8 | 9 | public String upperCase(String s) { 10 | return s.toUpperCase(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/main/resources/schema.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE course ( 2 | course_id integer identity NOT NULL, 3 | title varchar(80) NOT NULL, -- Course Title 4 | description varchar(500) NOT NULL, -- Course Description 5 | link varchar(255) NOT NULL, -- Course landing page link 6 | CONSTRAINT pk_course_course_id PRIMARY KEY (course_id) 7 | ); 8 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/src/main/java/dev/danvega/service/CrudService.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.service; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | public interface CrudService { 7 | 8 | List list(); 9 | 10 | T create(T t); 11 | 12 | Optional get(int id); 13 | 14 | void update(T t, int id); 15 | 16 | void delete(int id); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /java/github-copilot/src/test/java/dev/danvega/githubcopilot/service/WhiteboardServiceTest.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot.service; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | class WhiteboardServiceTest { 8 | 9 | @Test 10 | void isPalindrome() { 11 | assertTrue(WhiteboardService.isPalindrome("racecar")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /java/java-faker/src/main/java/dev/danvega/javafaker/repository/PersonRepository.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.javafaker.repository; 2 | 3 | import dev.danvega.javafaker.model.Person; 4 | import org.springframework.data.repository.CrudRepository; 5 | 6 | public interface PersonRepository extends CrudRepository { 7 | 8 | Person findByFirstNameEqualsAndLastNameEquals(String first, String last); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /nuxt/content-suggestions/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | purge: [ 3 | './components/**/*.{vue,js}', 4 | './layouts/**/*.vue', 5 | './pages/**/*.vue', 6 | './plugins/**/*.{js,ts}', 7 | './nuxt.config.{js,ts}', 8 | ], 9 | darkMode: false, // or 'media' or 'class' 10 | theme: { 11 | extend: {}, 12 | }, 13 | variants: { 14 | extend: {}, 15 | }, 16 | plugins: [ 17 | ], 18 | } 19 | -------------------------------------------------------------------------------- /java/java-faker/src/main/java/dev/danvega/javafaker/config/SampleDataConfig.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.javafaker.config; 2 | 3 | import com.github.javafaker.Faker; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | @Configuration 8 | public class SampleDataConfig { 9 | 10 | @Bean 11 | Faker faker() { 12 | return new Faker(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/test/resources/sql/course_schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS course; 2 | 3 | CREATE TABLE course ( 4 | course_id integer identity NOT NULL, 5 | title varchar(80) NOT NULL, -- Course Title 6 | description varchar(500) NOT NULL, -- Course Description 7 | link varchar(255) NOT NULL, -- Course landing page link 8 | CONSTRAINT pk_course_course_id PRIMARY KEY (course_id) 9 | ); 10 | -------------------------------------------------------------------------------- /java/java-records/src/dev/danvega/Main.java: -------------------------------------------------------------------------------- 1 | package dev.danvega; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | Employee dan1 = new Employee(1,"Dan","Vega","danvega@gmail.com"); 7 | System.out.println(dan1.toString()); 8 | 9 | Employee dan2 = new Employee(1,"Dan","Vega","danvega@gmail.com"); 10 | System.out.println("Employees are equal: " + dan2.equals(dan1)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /nuxt/hello-nitro/nuxt.config.ts: -------------------------------------------------------------------------------- 1 | import { defineNuxtConfig } from 'nuxt3' 2 | 3 | // https://v3.nuxtjs.org/docs/directory-structure/nuxt.config 4 | export default defineNuxtConfig({ 5 | build: { 6 | postcss: { 7 | postcssOptions: { 8 | plugins: { 9 | tailwindcss: {}, 10 | autoprefixer: {}, 11 | }, 12 | }, 13 | }, 14 | }, 15 | css: [ 16 | "~/assets/css/tailwind.css" 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /nuxt/content-suggestions/nuxt.config.ts: -------------------------------------------------------------------------------- 1 | import { defineNuxtConfig } from 'nuxt3' 2 | 3 | // https://v3.nuxtjs.org/docs/directory-structure/nuxt.config 4 | export default defineNuxtConfig({ 5 | build: { 6 | postcss: { 7 | postcssOptions: { 8 | plugins: { 9 | tailwindcss: {}, 10 | autoprefixer: {}, 11 | }, 12 | }, 13 | }, 14 | }, 15 | css: [ 16 | "~/assets/css/tailwind.css" 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /nuxt/hello-tailwind-3/nuxt.config.ts: -------------------------------------------------------------------------------- 1 | import { defineNuxtConfig } from 'nuxt3' 2 | 3 | // https://v3.nuxtjs.org/docs/directory-structure/nuxt.config 4 | export default defineNuxtConfig({ 5 | build: { 6 | postcss: { 7 | postcssOptions: { 8 | plugins: { 9 | tailwindcss: {}, 10 | autoprefixer: {}, 11 | }, 12 | }, 13 | }, 14 | }, 15 | css: [ 16 | "~/assets/css/tailwind.css" 17 | ], 18 | }) 19 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/main/java/dev/danvega/CrudRestApiApplication.java: -------------------------------------------------------------------------------- 1 | package dev.danvega; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class CrudRestApiApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(CrudRestApiApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /java/java-faker/src/main/java/dev/danvega/javafaker/JavaFakerApplication.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.javafaker; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class JavaFakerApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(JavaFakerApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /java/github-copilot/src/main/java/dev/danvega/githubcopilot/utils/MathUtils.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot.utils; 2 | 3 | public class MathUtils { 4 | 5 | int sum(int a, int b) { 6 | return a + b; 7 | } 8 | 9 | int subtract(int a, int b) { 10 | return a - b; 11 | } 12 | 13 | int multiply(int a, int b) { 14 | return a * b; 15 | } 16 | 17 | int divide(int a, int b) { 18 | return a / b; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /nuxt/content-suggestions/pages/index.vue: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /nuxt/hello-nitro/pages/posts/[id].vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | -------------------------------------------------------------------------------- /java/github-copilot/src/main/java/dev/danvega/githubcopilot/GithubCopilotApplication.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class GithubCopilotApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(GithubCopilotApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /nuxt/hello-nitro/server/api/posts.ts: -------------------------------------------------------------------------------- 1 | import posts from '../../data/posts.json'; 2 | import { IncomingMessage, ServerResponse } from 'http'; 3 | 4 | export default function(req: IncomingMessage,res: ServerResponse) { 5 | const { pathname, searchParams } = new URL(req.url!, `http://${req.headers.host}`); 6 | const id = pathname.split('/')[1]; 7 | if (!id) { 8 | return { 9 | posts 10 | } 11 | } else { 12 | return posts.find(post => post.id === parseInt(id)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15 3 | org.eclipse.jdt.core.compiler.compliance=15 4 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 6 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 7 | org.eclipse.jdt.core.compiler.processAnnotations=disabled 8 | org.eclipse.jdt.core.compiler.release=disabled 9 | org.eclipse.jdt.core.compiler.source=15 10 | -------------------------------------------------------------------------------- /java/java-faker/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | s 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /nuxt/hello-nuxt3/README.md: -------------------------------------------------------------------------------- 1 | # Nuxt 3 Minimal Starter 2 | 3 | We recommend to look at the [documentation](https://v3.nuxtjs.org). 4 | 5 | ## Setup 6 | 7 | Make sure to install the dependencies 8 | 9 | ```bash 10 | yarn install 11 | ``` 12 | 13 | ## Development 14 | 15 | Start the development server on http://localhost:3000 16 | 17 | ```bash 18 | yarn dev 19 | ``` 20 | 21 | ## Production 22 | 23 | Build the application for production: 24 | 25 | ```bash 26 | yarn build 27 | ``` 28 | 29 | Checkout the [deployment documentation](https://v3.nuxtjs.org/docs/deployment). -------------------------------------------------------------------------------- /java/github-copilot/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /spring-boot/log4jv/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /spring-boot/records/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /nuxt/content-suggestions/README.md: -------------------------------------------------------------------------------- 1 | # Nuxt 3 Minimal Starter 2 | 3 | We recommend to look at the [documentation](https://v3.nuxtjs.org). 4 | 5 | ## Setup 6 | 7 | Make sure to install the dependencies 8 | 9 | ```bash 10 | yarn install 11 | ``` 12 | 13 | ## Development 14 | 15 | Start the development server on http://localhost:3000 16 | 17 | ```bash 18 | yarn dev 19 | ``` 20 | 21 | ## Production 22 | 23 | Build the application for production: 24 | 25 | ```bash 26 | yarn build 27 | ``` 28 | 29 | Checkout the [deployment documentation](https://v3.nuxtjs.org/docs/deployment). -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /nuxt/content-suggestions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "nuxi dev", 5 | "build": "nuxi build", 6 | "start": "node .output/server/index.mjs" 7 | }, 8 | "devDependencies": { 9 | "@nuxtjs/tailwindcss": "^4.2.1", 10 | "autoprefixer": "^10.4.0", 11 | "nuxt3": "latest", 12 | "postcss": "^8.4.4", 13 | "tailwindcss": "^2.2.19" 14 | }, 15 | "dependencies": { 16 | "@heroicons/vue": "^1.0.5", 17 | "@notionhq/client": "^0.4.9", 18 | "h3": "^0.3.8", 19 | "install": "^0.13.0", 20 | "npm": "^8.2.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | out/ 4 | !.mvn/wrapper/maven-wrapper.jar 5 | !**/src/main/**/target/ 6 | !**/src/test/**/target/ 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | 17 | ### IntelliJ IDEA ### 18 | .idea 19 | *.iws 20 | *.iml 21 | *.ipr 22 | 23 | ### NetBeans ### 24 | /nbproject/private/ 25 | /nbbuild/ 26 | /dist/ 27 | /nbdist/ 28 | /.nb-gradle/ 29 | build/ 30 | !**/src/main/**/build/ 31 | !**/src/test/**/build/ 32 | 33 | ### VS Code ### 34 | .vscode/ 35 | 36 | .DS_Store 37 | node_modules/ 38 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /nuxt/hello-nitro/pages/index.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /java/github-copilot/src/main/java/dev/danvega/githubcopilot/utils/CalendarUtils.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot.utils; 2 | 3 | import java.time.LocalDate; 4 | import java.time.temporal.ChronoUnit; 5 | 6 | public class CalendarUtils { 7 | 8 | int calculateDaysBetweenDates(LocalDate startDate, LocalDate endDate) { 9 | return (int) ChronoUnit.DAYS.between(startDate, endDate); 10 | } 11 | 12 | int getDaysFromDate(LocalDate date) { 13 | return date.getDayOfMonth(); 14 | } 15 | 16 | int getYearFromDate(LocalDate date) { 17 | return date.getYear(); 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/src/main/java/dev/danvega/config/AppConfig.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.config; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | 7 | @Configuration 8 | @ComponentScan("dev.danvega") 9 | public class AppConfig { 10 | 11 | 12 | // @Bean 13 | // public CourseRepository getCourseRepository() { 14 | // return new CourseRepository(); 15 | // } 16 | // 17 | // @Bean("courseService") 18 | // public CourseService getCourseService() { 19 | // return new CourseService(getCourseRepository()); 20 | // } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot/log4jv/src/main/java/dev/danvega/log4jv/Log4jvApplication.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.log4jv; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | 8 | @SpringBootApplication 9 | public class Log4jvApplication { 10 | 11 | private static final Logger log = LoggerFactory.getLogger(Log4jvApplication.class); 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(Log4jvApplication.class, args); 15 | var message = "Hello World!"; 16 | log.info("Logging {}", message); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-boot/records/src/main/java/dev/danvega/records/EmployeeController.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.records; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | @RequestMapping("/employees") 9 | public class EmployeeController { 10 | 11 | private final EmployeeRepository employeeRepository; 12 | 13 | public EmployeeController(EmployeeRepository employeeRepository) { 14 | this.employeeRepository = employeeRepository; 15 | } 16 | 17 | @GetMapping 18 | public Iterable findAll() { 19 | return employeeRepository.findAll(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/src/main/java/dev/danvega/repository/CourseRepository.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.repository; 2 | 3 | import dev.danvega.model.Course; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | @Repository 10 | public class CourseRepository implements CrudRepository { 11 | 12 | @Override 13 | public List findAll() { 14 | List courses = new ArrayList<>(); 15 | Course springBoot = new Course(1, 16 | "Getting Started with Spring Boot 2", 17 | "Learn how to build a real application using Spring Framework 5 & Spring Boot 2", 18 | "https://www.danvega.dev/courses"); 19 | courses.add(springBoot); 20 | return courses; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-boot/records/src/main/java/dev/danvega/records/Employee.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.records; 2 | 3 | import org.springframework.data.annotation.Id; 4 | 5 | public record Employee(@Id Integer id, String firstName, String lastName, String email) { 6 | 7 | 8 | // public Employee(Integer id, String firstName, String lastName, String email) { 9 | // if(email.isEmpty() || email == null) { 10 | // throw new IllegalArgumentException("Email cannot be empty"); 11 | // } 12 | // this.id = id; 13 | // this.firstName = firstName; 14 | // this.lastName = lastName; 15 | // this.email = email; 16 | // } 17 | 18 | public Employee { 19 | if(email.isEmpty() || email == null) { 20 | throw new IllegalArgumentException("Email cannot be empty"); 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/src/main/java/dev/danvega/Application.java: -------------------------------------------------------------------------------- 1 | package dev.danvega; 2 | 3 | import dev.danvega.config.AppConfig; 4 | import dev.danvega.service.CourseService; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.annotation.AnnotationConfigApplicationContext; 7 | 8 | public class Application { 9 | 10 | 11 | public static void main(String[] args) { 12 | // CourseService dev.danvega.service = new CourseService(); // How do I want to explain this? 13 | // System.out.println(dev.danvega.service.list()); 14 | 15 | ApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class); 16 | CourseService service = applicationContext.getBean("courseService", CourseService.class); 17 | System.out.println(service.list()); 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot/records/src/main/java/dev/danvega/records/RecordsApplication.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.records; 2 | 3 | import org.springframework.boot.CommandLineRunner; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Profile; 8 | 9 | @SpringBootApplication 10 | public class RecordsApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(RecordsApplication.class, args); 14 | } 15 | 16 | @Bean 17 | @Profile("!test") 18 | public CommandLineRunner commandLineRunner(EmployeeRepository repository) { 19 | return args -> { 20 | repository.save(new Employee(null, "Dan", "Vega", "danvega@gmail.com")); 21 | }; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /java/java-faker/src/main/java/dev/danvega/javafaker/controller/PersonController.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.javafaker.controller; 2 | 3 | import dev.danvega.javafaker.model.Person; 4 | import dev.danvega.javafaker.repository.PersonRepository; 5 | import org.springframework.web.bind.annotation.*; 6 | 7 | @RestController 8 | @RequestMapping("/api/people") 9 | public class PersonController { 10 | 11 | private final PersonRepository personRepository; 12 | 13 | public PersonController(PersonRepository personRepository) { 14 | this.personRepository = personRepository; 15 | } 16 | 17 | // ex: http://localhost:8080/api/people/findBy?first=Lucas&last=Powlowski 18 | @GetMapping("/findBy") 19 | public Person findByFirstAndLast(@RequestParam String first, @RequestParam String last) { 20 | return personRepository.findByFirstNameEqualsAndLastNameEquals(first,last); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | dev.danvega 8 | hello-spring 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 16 13 | 16 14 | 15 | 16 | 17 | 18 | org.springframework 19 | spring-context 20 | 5.3.5 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | hello-spring 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | 25 | 1618428470159 26 | 27 | 30 28 | 29 | org.eclipse.core.resources.regexFilterMatcher 30 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /spring-boot/records/src/test/java/dev/danvega/records/EmployeeTest.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.records; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; 6 | import static org.junit.jupiter.api.Assertions.assertThrows; 7 | 8 | class EmployeeTest { 9 | 10 | @Test 11 | void testValidEmployee() { 12 | Employee e = new Employee(1, "Dan", "Vega", "danvega@gmail.com"); 13 | 14 | assertEquals(1,e.id()); 15 | assertEquals("Dan",e.firstName()); 16 | assertEquals("Vega",e.lastName()); 17 | assertEquals("danvega@gmail.com",e.email()); 18 | } 19 | 20 | @Test 21 | void invalidEmployeeShouldThrowIllegalArgumentException() { 22 | IllegalArgumentException illegalArgumentException = assertThrows(IllegalArgumentException.class, () -> { 23 | new Employee(1, "Dan", "Vega", ""); 24 | }); 25 | assertEquals("Email cannot be empty", illegalArgumentException.getMessage()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /java/github-copilot/src/main/java/dev/danvega/githubcopilot/model/Employee.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot.model; 2 | 3 | public class Employee { 4 | private int id; 5 | private String name; 6 | private String email; 7 | 8 | public Employee(int id, String name, String email) { 9 | this.id = id; 10 | this.name = name; 11 | this.email = email; 12 | } 13 | 14 | public int getId() { 15 | return id; 16 | } 17 | 18 | public void setId(int id) { 19 | this.id = id; 20 | } 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | public void setName(String name) { 27 | this.name = name; 28 | } 29 | 30 | public String getEmail() { 31 | return email; 32 | } 33 | 34 | public void setEmail(String email) { 35 | this.email = email; 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "Employee{" + "id=" + id + ", name=" + name + ", email=" + email + '}'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /java/java-faker-jdbc/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | dev.danvega 8 | java-faker-jdbc 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 16 13 | 16 14 | 15 | 16 | 17 | 18 | com.github.javafaker 19 | javafaker 20 | 1.0.2 21 | 22 | 23 | com.h2database 24 | h2 25 | 1.4.200 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/src/main/java/dev/danvega/service/CourseService.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.service; 2 | 3 | import dev.danvega.model.Course; 4 | import dev.danvega.repository.CourseRepository; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.List; 8 | import java.util.Optional; 9 | 10 | @Service 11 | public class CourseService implements CrudService { 12 | 13 | private CourseRepository courseRepository; 14 | 15 | public CourseService(CourseRepository courseRepository) { 16 | this.courseRepository = courseRepository; 17 | } 18 | 19 | @Override 20 | public List list() { 21 | return courseRepository.findAll(); 22 | } 23 | 24 | @Override 25 | public Course create(Course course) { 26 | return null; 27 | } 28 | 29 | @Override 30 | public Optional get(int id) { 31 | return Optional.empty(); 32 | } 33 | 34 | @Override 35 | public void update(Course course, int id) { 36 | 37 | } 38 | 39 | @Override 40 | public void delete(int id) { 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /java/github-copilot/README.md: -------------------------------------------------------------------------------- 1 | # GitHub Copilot for IntelliJ & Java 2 | 3 | This is the demo code for a tutorial I did on Github Copilot for Java developers. 4 | 5 | ## GitHub Copilot 6 | https://copilot.github.com/ 7 | ## MathUtils 8 | - add 9 | - subtract 10 | - multiply 11 | - divide 12 | ## StringUtils 13 | - reverse 14 | - uppercase 15 | ## CalendarUtils 16 | - calculateDaysBetweenDates 17 | - getDayFromDate 18 | - getYearFromDate 19 | ## Whiteboard 20 | - Practice some interview questions from https://javarevisited.blogspot.com/2011/06/top-programming-interview-questions.html#axzz7Abwb9Z9C 21 | ## Spring Boot 22 | - HelloController with a single endpoint 23 | - Employee Model with name and email 24 | - Employee Service 25 | - Employee Controller 26 | ## JavaScript 27 | - sum 28 | - reverse 29 | - findSubstring 30 | ## Notes 31 | - Github Copolit was released June 2021 32 | - This is still in the early stages and I expect that this project will only get better. 33 | - This is really a first look for me, I will need to incorporate it into my day to doy work to give a full review 34 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/main/resources/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO course(title, description, link) values ('Vue.js for Beginners: Up and Running with Vue','A beginner''s guide to learn the basics of the JavaScript Framework Vue.js.','https://www.udemy.com/course/vue-intro/?referralCode=E9DECFF78CA706D7A68A'); 2 | INSERT INTO course(title, description, link) values ('The Complete Apache Groovy Developer Course','Everything you need to know to get started with the Groovy Programming Language','https://courses.danvega.dev/p/the-complete-apache-groovy-developer-course'); 3 | INSERT INTO course(title, description, link) values ('Getting Started with Spring Boot 2','Learn how to build a real application using Spring Framework 5 & Spring Boot 2','https://courses.danvega.dev/p/spring-boot-2'); 4 | INSERT INTO course(title, description, link) values ('Learn Spring Boot','Spring Boot gives you all the power of the Spring Framework without all of the complexity.','https://courses.danvega.dev/p/spring-boot-intro'); 5 | INSERT INTO course(title, description, link) values ('Angular 4 Java Developers','Learn how to build Spring Boot & Angular apps by building a real world application with JHipster.','https://courses.danvega.dev/p/jhipster'); 6 | -------------------------------------------------------------------------------- /java/github-copilot/src/main/java/dev/danvega/githubcopilot/controller/EmployeeController.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot.controller; 2 | 3 | import dev.danvega.githubcopilot.model.Employee; 4 | import dev.danvega.githubcopilot.service.EmployeeService; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import java.util.List; 11 | 12 | @RestController 13 | @RequestMapping("/employees") 14 | public class EmployeeController { 15 | 16 | private final EmployeeService employeeService; 17 | 18 | public EmployeeController(EmployeeService employeeService) { 19 | this.employeeService = employeeService; 20 | } 21 | 22 | // get all employees 23 | @RequestMapping("/") 24 | public List getAllEmployees() { 25 | return employeeService.getAllEmployees(); 26 | } 27 | 28 | // get employee by id 29 | @GetMapping("/{id}") 30 | public Employee getEmployeeById(@PathVariable int id) { 31 | return employeeService.getEmployee(id); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/test/resources/sql/course_data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO course(title, description, link) values ('Vue.js for Beginners: Up and Running with Vue','A beginner''s guide to learn the basics of the JavaScript Framework Vue.js.','https://www.udemy.com/course/vue-intro/?referralCode=E9DECFF78CA706D7A68A'); 2 | INSERT INTO course(title, description, link) values ('The Complete Apache Groovy Developer Course','Everything you need to know to get started with the Groovy Programming Language','https://courses.danvega.dev/p/the-complete-apache-groovy-developer-course'); 3 | INSERT INTO course(title, description, link) values ('Getting Started with Spring Boot 2','Learn how to build a real application using Spring Framework 5 & Spring Boot 2','https://courses.danvega.dev/p/spring-boot-2'); 4 | INSERT INTO course(title, description, link) values ('Learn Spring Boot','Spring Boot gives you all the power of the Spring Framework without all of the complexity.','https://courses.danvega.dev/p/spring-boot-intro'); 5 | INSERT INTO course(title, description, link) values ('Angular 4 Java Developers','Learn how to build Spring Boot & Angular apps by building a real world application with JHipster.','https://courses.danvega.dev/p/jhipster'); 6 | -------------------------------------------------------------------------------- /spring-boot/records/src/test/java/dev/danvega/records/EmployeeControllerTest.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.records; 2 | 3 | import org.assertj.core.api.Assertions; 4 | import org.junit.jupiter.api.Test; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.boot.test.web.client.TestRestTemplate; 8 | import org.springframework.boot.web.server.LocalServerPort; 9 | 10 | import java.util.stream.StreamSupport; 11 | 12 | import static org.assertj.core.api.Assertions.*; 13 | import static org.junit.jupiter.api.Assertions.assertEquals; 14 | 15 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) 16 | class EmployeeControllerTest { 17 | 18 | @LocalServerPort 19 | private int port; 20 | 21 | @Autowired 22 | private TestRestTemplate restTemplate; 23 | 24 | @Test 25 | public void greetingShouldReturnDefaultMessage() throws Exception { 26 | Iterable employees = this.restTemplate.getForObject("http://localhost:" + port + "/employees/", Iterable.class); 27 | assertEquals(1, StreamSupport.stream(employees.spliterator(), false).count()); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /java/github-copilot/src/main/java/dev/danvega/githubcopilot/service/EmployeeService.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot.service; 2 | 3 | import dev.danvega.githubcopilot.model.Employee; 4 | import org.springframework.stereotype.Service; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | @Service 10 | public class EmployeeService { 11 | 12 | List employees = new ArrayList<>(); 13 | 14 | public EmployeeService() { 15 | employees.add(new Employee(1,"Dan Vega", "danvega@gmail.com")); 16 | } 17 | 18 | public List getAllEmployees() { 19 | return employees; 20 | } 21 | 22 | public Employee getEmployee(int id) { 23 | return employees.stream().filter(e -> e.getId() == id).findFirst().orElse(null); 24 | } 25 | 26 | public void addEmployee(Employee employee) { 27 | employees.add(employee); 28 | } 29 | 30 | public void updateEmployee(Employee employee) { 31 | Employee e = getEmployee(employee.getId()); 32 | e.setName(employee.getName()); 33 | e.setEmail(employee.getEmail()); 34 | } 35 | 36 | public void deleteEmployee(int id) { 37 | employees.removeIf(e -> e.getId() == id); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /spring-boot/records/src/test/java/dev/danvega/records/EmployeeRepositoryTest.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.records; 2 | 3 | import org.junit.jupiter.api.BeforeEach; 4 | import org.junit.jupiter.api.Test; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.autoconfigure.data.jdbc.DataJdbcTest; 7 | import org.springframework.test.context.ActiveProfiles; 8 | 9 | import java.util.List; 10 | import java.util.stream.StreamSupport; 11 | 12 | import static org.junit.jupiter.api.Assertions.assertEquals; 13 | 14 | @DataJdbcTest 15 | @ActiveProfiles("test") 16 | class EmployeeRepositoryTest { 17 | 18 | @Autowired 19 | EmployeeRepository repository; 20 | 21 | @BeforeEach 22 | void setUp() { 23 | List employees = List.of(new Employee(null, "Dan", "Vega", "danvega@gmail.com"), 24 | new Employee(null, "John", "Doe", "johndoe@gmail.com"), 25 | new Employee(null, "Jane", "Doe", "janedoe@gmail.com")); 26 | 27 | repository.saveAll(employees); 28 | } 29 | 30 | @Test 31 | void findAllEmployeesShouldReturnAllEmployees() { 32 | assertEquals(3, StreamSupport.stream(repository.findAll().spliterator(), false).count()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /java/stream-to-list/src/dev/danvega/Main.java: -------------------------------------------------------------------------------- 1 | package dev.danvega; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.stream.Collectors; 6 | 7 | public class Main { 8 | 9 | public static void main(String[] args) { 10 | // List languages = List.of("java","python","c++","c#","javascript"); 11 | // 12 | // // find all languages that start with java 13 | // List javaLanguages = new ArrayList<>(); 14 | // for(String language : languages) { 15 | // if(language.startsWith("java")) { 16 | // // java is to javascript as car is to carpet 17 | // javaLanguages.add(language); 18 | // } 19 | // } 20 | // System.out.println(javaLanguages); 21 | 22 | // List languages = List.of("java","python","c++","c#","javascript"); 23 | // 24 | // List javaLanguages = languages.stream().filter(language -> language.startsWith("java")).toList(); 25 | // 26 | // System.out.println(javaLanguages); 27 | 28 | List developers = List.of( 29 | new Developer("Dan", List.of("Java","JavaScript","TypeScript","C#")), 30 | new Developer("Joe", List.of("Java","TypeScript","C#")), 31 | new Developer("Andrew", List.of("TypeScript","C#")) 32 | ); 33 | 34 | List java = developers.stream().filter(developer -> developer.languages().contains("Java")).toList(); 35 | System.out.println(java); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/src/main/java/dev/danvega/model/Course.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.model; 2 | 3 | public class Course { 4 | 5 | private int courseId; 6 | private String title; 7 | private String description; 8 | private String link; 9 | 10 | public Course(int courseId, String title, String description, String link) { 11 | this.courseId = courseId; 12 | this.title = title; 13 | this.description = description; 14 | this.link = link; 15 | } 16 | 17 | public int getCourseId() { 18 | return courseId; 19 | } 20 | 21 | public void setCourseId(int courseId) { 22 | this.courseId = courseId; 23 | } 24 | 25 | public String getTitle() { 26 | return title; 27 | } 28 | 29 | public void setTitle(String title) { 30 | this.title = title; 31 | } 32 | 33 | public String getDescription() { 34 | return description; 35 | } 36 | 37 | public void setDescription(String description) { 38 | this.description = description; 39 | } 40 | 41 | public String getLink() { 42 | return link; 43 | } 44 | 45 | public void setLink(String link) { 46 | this.link = link; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "Course{" + 52 | "courseId=" + courseId + 53 | ", title='" + title + '\'' + 54 | ", description='" + description + '\'' + 55 | ", link='" + link + '\'' + 56 | '}'; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /java/java-faker-jdbc/src/main/java/dev/danvega/model/Address.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.model; 2 | 3 | public class Address { 4 | 5 | private int id; 6 | private String address; 7 | private String city; 8 | private String state; 9 | private String zip; 10 | 11 | public Address(String address, String city, String state, String zip) { 12 | this.address = address; 13 | this.city = city; 14 | this.state = state; 15 | this.zip = zip; 16 | } 17 | 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public String getAddress() { 23 | return address; 24 | } 25 | 26 | public void setAddress(String address) { 27 | this.address = address; 28 | } 29 | 30 | public String getCity() { 31 | return city; 32 | } 33 | 34 | public void setCity(String city) { 35 | this.city = city; 36 | } 37 | 38 | public String getState() { 39 | return state; 40 | } 41 | 42 | public void setState(String state) { 43 | this.state = state; 44 | } 45 | 46 | public String getZip() { 47 | return zip; 48 | } 49 | 50 | public void setZip(String zip) { 51 | this.zip = zip; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "Address{" + 57 | "id=" + id + 58 | ", address='" + address + '\'' + 59 | ", city='" + city + '\'' + 60 | ", state='" + state + '\'' + 61 | ", zip='" + zip + '\'' + 62 | '}'; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /java/github-copilot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.5.6 9 | 10 | 11 | dev.danvega 12 | github-copilot 13 | 0.0.1-SNAPSHOT 14 | github-copilot 15 | github-copilot 16 | 17 | 17 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-test 28 | test 29 | 30 | 31 | 32 | 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-maven-plugin 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /nuxt/content-suggestions/server/api/notion.js: -------------------------------------------------------------------------------- 1 | import { Client } from '@notionhq/client'; 2 | import { useBody } from 'h3' 3 | 4 | export default async (req, res) => { 5 | 6 | const notion = new Client({ auth: process.env.NOTION_API_KEY }); 7 | 8 | if(req.method === 'POST') { 9 | let content = await useBody(req) 10 | notion.pages.update({ 11 | page_id: content.id, 12 | properties: { 13 | 'Votes': { 14 | number: content.votes 15 | } 16 | } 17 | }) 18 | res.statusCode = 200; 19 | res.end(); 20 | } else { 21 | 22 | const database = await notion.databases.query({ database_id: process.env.NOTION_DATABASE_ID }); 23 | const suggestions = []; 24 | 25 | database.results.map(row => { 26 | suggestions.push({ 27 | id: row.id, 28 | title: row.properties.Title.title[0].text.content, 29 | description: row.properties.Description.rich_text[0].text.content, 30 | type: row.properties.Type.multi_select.map(type => { 31 | return {name: type.name, color: type.color} 32 | }), 33 | tags: row.properties.Tags.multi_select.map(tag => { 34 | return {name: tag.name, color: mapColor(tag.color)} 35 | }), 36 | votes: row.properties.Votes.number, 37 | dateCreated: row.properties["Date Created"].created_time 38 | }); 39 | }); 40 | 41 | return { 42 | suggestions 43 | } 44 | } 45 | 46 | function mapColor(color) { 47 | let mappedColor = color; 48 | if(color == 'purple') { 49 | mappedColor = 'indigo'; 50 | } 51 | return mappedColor; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /java/github-copilot/src/main/java/dev/danvega/githubcopilot/service/WhiteboardService.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.githubcopilot.service; 2 | 3 | public class WhiteboardService { 4 | 5 | // is palindrome? 6 | public static boolean isPalindrome(String str) { 7 | if (str == null) { 8 | return false; 9 | } 10 | int len = str.length(); 11 | for (int i = 0; i < len / 2; i++) { 12 | if (str.charAt(i) != str.charAt(len - i - 1)) { 13 | return false; 14 | } 15 | } 16 | return true; 17 | } 18 | 19 | // method will remove any given substring from a string 20 | public static String removeSubstring(String str, String sub) { 21 | if (str == null || sub == null) { 22 | return str; 23 | } 24 | int len = sub.length(); 25 | int index = str.indexOf(sub); 26 | if (index == -1) { 27 | return str; 28 | } 29 | StringBuilder sb = new StringBuilder(str); 30 | while (index != -1) { 31 | sb.delete(index, index + len); 32 | index = str.indexOf(sub, index); 33 | } 34 | return sb.toString(); 35 | } 36 | 37 | // count the number of times a substring occurs in a string 38 | public static int countSubstring(String str, String sub) { 39 | if (str == null || sub == null) { 40 | return 0; 41 | } 42 | int count = 0; 43 | int index = str.indexOf(sub); 44 | while (index != -1) { 45 | count++; 46 | index = str.indexOf(sub, index + sub.length()); 47 | } 48 | return count; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/main/java/dev/danvega/controller/CourseController.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.controller; 2 | 3 | import dev.danvega.dao.DAO; 4 | import dev.danvega.model.Course; 5 | import org.springframework.http.HttpStatus; 6 | import org.springframework.web.bind.annotation.*; 7 | import org.springframework.web.server.ResponseStatusException; 8 | 9 | import javax.validation.Valid; 10 | import java.util.List; 11 | import java.util.Optional; 12 | 13 | @RestController 14 | @RequestMapping("/courses") 15 | public class CourseController { 16 | 17 | private DAO dao; 18 | 19 | public CourseController(DAO dao) { 20 | this.dao = dao; 21 | } 22 | 23 | @GetMapping 24 | public List list() { 25 | return dao.list(); 26 | } 27 | 28 | @GetMapping("/{id}") 29 | public Course get(@PathVariable int id) { 30 | Optional course = dao.get(id); 31 | if(!course.isPresent()) { 32 | throw new ResponseStatusException(HttpStatus.NOT_FOUND,"Course Not Found."); 33 | } 34 | return course.get(); 35 | } 36 | 37 | @PostMapping 38 | @ResponseStatus(HttpStatus.CREATED) 39 | public Course create(@Valid @RequestBody Course course) { 40 | return dao.create(course); 41 | } 42 | 43 | @PutMapping("/{id}") 44 | @ResponseStatus(HttpStatus.NO_CONTENT) 45 | public void update(@Valid @RequestBody Course course, @PathVariable int id) { 46 | dao.update(course,id); 47 | } 48 | 49 | @DeleteMapping("/{id}") 50 | @ResponseStatus(HttpStatus.NO_CONTENT) 51 | public void delete(@PathVariable int id) { 52 | dao.delete(id); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /java/java-faker/src/main/java/dev/danvega/javafaker/SampleDataLoader.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.javafaker; 2 | 3 | import com.github.javafaker.Faker; 4 | import dev.danvega.javafaker.model.Address; 5 | import dev.danvega.javafaker.model.Person; 6 | import dev.danvega.javafaker.repository.PersonRepository; 7 | import org.springframework.boot.CommandLineRunner; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.util.List; 11 | import java.util.stream.Collectors; 12 | import java.util.stream.IntStream; 13 | 14 | @Component 15 | public class SampleDataLoader implements CommandLineRunner { 16 | 17 | private final PersonRepository personRepository; 18 | private final Faker faker; 19 | 20 | public SampleDataLoader(PersonRepository personRepository, Faker faker) { 21 | this.personRepository = personRepository; 22 | this.faker = faker; 23 | } 24 | 25 | @Override 26 | public void run(String... args) throws Exception { 27 | 28 | // create 100 rows of fake data 29 | List people = IntStream.rangeClosed(1,100) 30 | .mapToObj(i -> new Person( 31 | faker.name().firstName(), 32 | faker.name().lastName(), 33 | faker.phoneNumber().cellPhone(), 34 | faker.internet().emailAddress(), 35 | new Address( 36 | faker.address().streetAddress(), 37 | faker.address().city(), 38 | faker.address().state(), 39 | faker.address().zipCode()) 40 | )).collect(Collectors.toList()); 41 | 42 | personRepository.saveAll(people); 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /java/java-faker/src/main/java/dev/danvega/javafaker/model/Address.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.javafaker.model; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.GenerationType; 6 | import javax.persistence.Id; 7 | 8 | @Entity 9 | public class Address { 10 | 11 | @Id 12 | @GeneratedValue(strategy = GenerationType.IDENTITY) 13 | private int id; 14 | private String address; 15 | private String city; 16 | private String state; 17 | private String zip; 18 | 19 | public Address() { 20 | 21 | } 22 | 23 | public Address(String address, String city, String state, String zip) { 24 | this.address = address; 25 | this.city = city; 26 | this.state = state; 27 | this.zip = zip; 28 | } 29 | 30 | public int getId() { 31 | return id; 32 | } 33 | 34 | public String getAddress() { 35 | return address; 36 | } 37 | 38 | public void setAddress(String address) { 39 | this.address = address; 40 | } 41 | 42 | public String getCity() { 43 | return city; 44 | } 45 | 46 | public void setCity(String city) { 47 | this.city = city; 48 | } 49 | 50 | public String getState() { 51 | return state; 52 | } 53 | 54 | public void setState(String state) { 55 | this.state = state; 56 | } 57 | 58 | public String getZip() { 59 | return zip; 60 | } 61 | 62 | public void setZip(String zip) { 63 | this.zip = zip; 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return "Address{" + 69 | "id=" + id + 70 | ", address='" + address + '\'' + 71 | ", city='" + city + '\'' + 72 | ", state='" + state + '\'' + 73 | ", zip='" + zip + '\'' + 74 | '}'; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/main/java/dev/danvega/model/Course.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.model; 2 | 3 | import org.hibernate.validator.constraints.URL; 4 | 5 | import javax.validation.constraints.NotNull; 6 | 7 | public class Course { 8 | 9 | private int courseId; 10 | @NotNull 11 | private String title; 12 | @NotNull 13 | private String description; 14 | @URL 15 | private String link; 16 | 17 | public Course() { } 18 | 19 | public Course(String title, String description, String link) { 20 | this.title = title; 21 | this.description = description; 22 | this.link = link; 23 | } 24 | 25 | public Course(int courseId, String title, String description, String link) { 26 | this.courseId = courseId; 27 | this.title = title; 28 | this.description = description; 29 | this.link = link; 30 | } 31 | 32 | public int getCourseId() { 33 | return courseId; 34 | } 35 | 36 | public void setCourseId(int courseId) { 37 | this.courseId = courseId; 38 | } 39 | 40 | public String getTitle() { 41 | return title; 42 | } 43 | 44 | public void setTitle(String title) { 45 | this.title = title; 46 | } 47 | 48 | public String getDescription() { 49 | return description; 50 | } 51 | 52 | public void setDescription(String description) { 53 | this.description = description; 54 | } 55 | 56 | public String getLink() { 57 | return link; 58 | } 59 | 60 | public void setLink(String link) { 61 | this.link = link; 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return "Course{" + 67 | "courseId=" + courseId + 68 | ", title='" + title + '\'' + 69 | ", description='" + description + '\'' + 70 | ", link='" + link + '\'' + 71 | '}'; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /spring-boot/records/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.5.5 9 | 10 | 11 | dev.danvega 12 | records 13 | 0.0.1-SNAPSHOT 14 | records 15 | records 16 | 17 | 17 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jdbc 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-web 27 | 28 | 29 | 30 | com.h2database 31 | h2 32 | runtime 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-test 37 | test 38 | 39 | 40 | 41 | 42 | 43 | 44 | org.springframework.boot 45 | spring-boot-maven-plugin 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /java/java-records/src/dev/danvega/Person.java: -------------------------------------------------------------------------------- 1 | package dev.danvega; 2 | 3 | import java.util.Objects; 4 | 5 | public class Person { 6 | 7 | private Integer id; 8 | private String firstName; 9 | private String lastName; 10 | private String email; 11 | 12 | public Person(Integer id, String firstName, String lastName, String email) { 13 | this.id = id; 14 | this.firstName = firstName; 15 | this.lastName = lastName; 16 | this.email = email; 17 | } 18 | 19 | public Integer getId() { 20 | return id; 21 | } 22 | 23 | public void setId(Integer id) { 24 | this.id = id; 25 | } 26 | 27 | public String getFirstName() { 28 | return firstName; 29 | } 30 | 31 | public void setFirstName(String firstName) { 32 | this.firstName = firstName; 33 | } 34 | 35 | public String getLastName() { 36 | return lastName; 37 | } 38 | 39 | public void setLastName(String lastName) { 40 | this.lastName = lastName; 41 | } 42 | 43 | public String getEmail() { 44 | return email; 45 | } 46 | 47 | public void setEmail(String email) { 48 | this.email = email; 49 | } 50 | 51 | @Override 52 | public boolean equals(Object o) { 53 | if (this == o) return true; 54 | if (o == null || getClass() != o.getClass()) return false; 55 | Person person = (Person) o; 56 | return Objects.equals(id, person.id) && Objects.equals(firstName, person.firstName) && Objects.equals(lastName, person.lastName) && Objects.equals(email, person.email); 57 | } 58 | 59 | @Override 60 | public int hashCode() { 61 | return Objects.hash(id, firstName, lastName, email); 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return "Person{" + 67 | "id=" + id + 68 | ", firstName='" + firstName + '\'' + 69 | ", lastName='" + lastName + '\'' + 70 | ", email='" + email + '\'' + 71 | '}'; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /java/java-faker/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.5.4 9 | 10 | 11 | dev.danvega 12 | java-faker 13 | 0.0.1-SNAPSHOT 14 | java-faker 15 | java-faker 16 | 17 | 16 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jpa 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-web 27 | 28 | 29 | com.github.javafaker 30 | javafaker 31 | 1.0.2 32 | 33 | 34 | com.h2database 35 | h2 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-test 40 | test 41 | 42 | 43 | 44 | 45 | 46 | 47 | org.springframework.boot 48 | spring-boot-maven-plugin 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /java/java-faker-jdbc/src/main/java/dev/danvega/model/Person.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.model; 2 | 3 | public class Person { 4 | 5 | private int id; 6 | private String firstName; 7 | private String lastName; 8 | private String phoneNumber; 9 | private String email; 10 | private Address address; 11 | 12 | public Person(String firstName, String lastName, String phoneNumber, String email, Address address) { 13 | this.firstName = firstName; 14 | this.lastName = lastName; 15 | this.phoneNumber = phoneNumber; 16 | this.email = email; 17 | this.address = address; 18 | } 19 | 20 | public int getId() { 21 | return id; 22 | } 23 | 24 | public void setId(int id) { 25 | this.id = id; 26 | } 27 | 28 | public String getFirstName() { 29 | return firstName; 30 | } 31 | 32 | public void setFirstName(String firstName) { 33 | this.firstName = firstName; 34 | } 35 | 36 | public String getLastName() { 37 | return lastName; 38 | } 39 | 40 | public void setLastName(String lastName) { 41 | this.lastName = lastName; 42 | } 43 | 44 | public String getPhoneNumber() { 45 | return phoneNumber; 46 | } 47 | 48 | public void setPhoneNumber(String phoneNumber) { 49 | this.phoneNumber = phoneNumber; 50 | } 51 | 52 | public String getEmail() { 53 | return email; 54 | } 55 | 56 | public void setEmail(String email) { 57 | this.email = email; 58 | } 59 | 60 | public Address getAddress() { 61 | return address; 62 | } 63 | 64 | public void setAddress(Address address) { 65 | this.address = address; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return "Person{" + 71 | "id=" + id + 72 | ", firstName='" + firstName + '\'' + 73 | ", lastName='" + lastName + '\'' + 74 | ", phoneNumber='" + phoneNumber + '\'' + 75 | ", email='" + email + '\'' + 76 | ", address=" + address + 77 | '}'; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/test/java/dev/danvega/dao/CourseJdbcDAOTest.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.dao; 2 | 3 | import dev.danvega.model.Course; 4 | import org.junit.jupiter.api.Test; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.test.autoconfigure.data.jdbc.DataJdbcTest; 7 | import org.springframework.context.annotation.Import; 8 | 9 | import static org.junit.jupiter.api.Assertions.assertEquals; 10 | import static org.junit.jupiter.api.Assertions.assertNotNull; 11 | 12 | @DataJdbcTest 13 | @Import(CourseJdbcDAO.class) 14 | class CourseJdbcDAOTest { 15 | 16 | @Autowired 17 | private CourseJdbcDAO dao; 18 | 19 | @Test 20 | void contextLoads() { 21 | assertNotNull(dao); 22 | } 23 | 24 | @Test 25 | void list() { 26 | assertEquals(5,dao.list().size()); 27 | } 28 | 29 | @Test 30 | void create() { 31 | Course course = new Course(99,"TEST_TITLE","TEST_DESC","http://www.danvega.dev"); 32 | Course saved = dao.create(course); 33 | 34 | assertEquals(6,dao.list().size()); 35 | assertEquals(99,saved.getCourseId()); 36 | assertEquals("TEST_TITLE",saved.getTitle()); 37 | assertEquals("TEST_DESC",saved.getDescription()); 38 | assertEquals("http://www.danvega.dev",saved.getLink()); 39 | } 40 | 41 | @Test 42 | void get() { 43 | Course course = dao.get(1).get(); 44 | assertEquals(1,course.getCourseId()); 45 | assertEquals("Vue.js for Beginners: Up and Running with Vue",course.getTitle()); 46 | assertEquals("A beginner's guide to learn the basics of the JavaScript Framework Vue.js.",course.getDescription()); 47 | assertEquals("https://www.udemy.com/course/vue-intro/?referralCode=E9DECFF78CA706D7A68A",course.getLink()); 48 | } 49 | 50 | @Test 51 | void update() { 52 | Course course = dao.get(1).get(); 53 | course.setTitle("UPDATED_TITLE"); 54 | dao.update(course,1); 55 | 56 | Course updated = dao.get(1).get(); 57 | assertEquals("UPDATED_TITLE",updated.getTitle()); 58 | } 59 | 60 | @Test 61 | void delete() { 62 | dao.delete(1); 63 | assertEquals(4,dao.list().size()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.4.3 9 | 10 | 11 | dev.danvega 12 | crud-rest-api 13 | 0.0.1-SNAPSHOT 14 | crud-rest-api 15 | Spring Boot CRUD REST API 16 | 17 | 11 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jdbc 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-web 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-validation 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-devtools 36 | runtime 37 | true 38 | 39 | 40 | com.h2database 41 | h2 42 | runtime 43 | 44 | 45 | org.springframework.boot 46 | spring-boot-starter-test 47 | test 48 | 49 | 50 | 51 | 52 | 53 | 54 | org.springframework.boot 55 | spring-boot-maven-plugin 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /java/java-faker/src/main/java/dev/danvega/javafaker/model/Person.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.javafaker.model; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | public class Person { 7 | 8 | @Id 9 | @GeneratedValue(strategy = GenerationType.IDENTITY) 10 | private int id; 11 | private String firstName; 12 | private String lastName; 13 | private String phoneNumber; 14 | private String email; 15 | @OneToOne(cascade = CascadeType.ALL) 16 | @JoinColumn(name = "address_id", referencedColumnName = "id") 17 | private Address address; 18 | 19 | public Person() { 20 | } 21 | 22 | public Person(String firstName, String lastName, String phoneNumber, String email, Address address) { 23 | this.firstName = firstName; 24 | this.lastName = lastName; 25 | this.phoneNumber = phoneNumber; 26 | this.email = email; 27 | this.address = address; 28 | } 29 | 30 | public int getId() { 31 | return id; 32 | } 33 | 34 | public void setId(int id) { 35 | this.id = id; 36 | } 37 | 38 | public String getFirstName() { 39 | return firstName; 40 | } 41 | 42 | public void setFirstName(String firstName) { 43 | this.firstName = firstName; 44 | } 45 | 46 | public String getLastName() { 47 | return lastName; 48 | } 49 | 50 | public void setLastName(String lastName) { 51 | this.lastName = lastName; 52 | } 53 | 54 | public String getPhoneNumber() { 55 | return phoneNumber; 56 | } 57 | 58 | public void setPhoneNumber(String phoneNumber) { 59 | this.phoneNumber = phoneNumber; 60 | } 61 | 62 | public String getEmail() { 63 | return email; 64 | } 65 | 66 | public void setEmail(String email) { 67 | this.email = email; 68 | } 69 | 70 | public Address getAddress() { 71 | return address; 72 | } 73 | 74 | public void setAddress(Address address) { 75 | this.address = address; 76 | } 77 | 78 | @Override 79 | public String toString() { 80 | return "Person{" + 81 | "id=" + id + 82 | ", firstName='" + firstName + '\'' + 83 | ", lastName='" + lastName + '\'' + 84 | ", phoneNumber='" + phoneNumber + '\'' + 85 | ", email='" + email + '\'' + 86 | ", address=" + address + 87 | '}'; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /spring-boot/log4jv/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.6.1 9 | 10 | 11 | dev.danvega 12 | log4jv 13 | 0.0.1-SNAPSHOT 14 | log4jv 15 | log4jv 16 | 17 | 17 18 | 2.17.0 19 | 20 | 21 | 22 | org.springframework.boot 23 | spring-boot-starter 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-logging 28 | 29 | 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-starter-log4j2 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-starter-web 38 | 39 | 40 | 41 | org.projectlombok 42 | lombok 43 | true 44 | 45 | 46 | org.springframework.boot 47 | spring-boot-starter-test 48 | test 49 | 50 | 51 | 52 | 53 | 54 | 55 | org.springframework.boot 56 | spring-boot-maven-plugin 57 | 58 | 59 | 60 | org.projectlombok 61 | lombok 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /nuxt/hello-tailwind-3/pages/features.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 71 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/main/java/dev/danvega/dao/CourseJdbcDAO.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.dao; 2 | 3 | import dev.danvega.model.Course; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.dao.DataAccessException; 7 | import org.springframework.jdbc.core.JdbcTemplate; 8 | import org.springframework.jdbc.core.RowMapper; 9 | import org.springframework.stereotype.Component; 10 | 11 | import java.util.List; 12 | import java.util.Optional; 13 | 14 | @Component 15 | public class CourseJdbcDAO implements DAO { 16 | 17 | private static final Logger log = LoggerFactory.getLogger(CourseJdbcDAO.class); 18 | private JdbcTemplate jdbcTemplate; 19 | 20 | public CourseJdbcDAO(JdbcTemplate jdbcTemplate) { 21 | this.jdbcTemplate = jdbcTemplate; 22 | } 23 | 24 | /** 25 | * Maps a row in the database to a Course 26 | */ 27 | RowMapper rowMapper = (rs, rowNum) -> { 28 | Course course = new Course(); 29 | course.setCourseId(rs.getInt("course_id")); 30 | course.setTitle(rs.getString("title")); 31 | course.setDescription(rs.getString("description")); 32 | course.setLink(rs.getString("link")); 33 | return course; 34 | }; 35 | 36 | @Override 37 | public List list() { 38 | String sql = "SELECT course_id, title, description, link from course"; 39 | return jdbcTemplate.query(sql,rowMapper); 40 | } 41 | 42 | @Override 43 | public Course create(Course course) { 44 | String sql = "insert into course(title,description,link) values(?,?,?)"; 45 | int insert = jdbcTemplate.update(sql,course.getTitle(),course.getDescription(),course.getLink()); 46 | if(insert == 1) { 47 | log.info("New Course Created: " + course.getTitle()); 48 | } 49 | return course; 50 | } 51 | 52 | @Override 53 | public Optional get(int id) { 54 | String sql = "SELECT course_id,title,description,link from course where course_id = ?"; 55 | Course course = null; 56 | try { 57 | course = jdbcTemplate.queryForObject(sql,rowMapper,id); 58 | }catch (DataAccessException ex) { 59 | log.info("Course not found: " + id); 60 | } 61 | return Optional.ofNullable(course); 62 | } 63 | 64 | @Override 65 | public void update(Course course, int id) { 66 | String sql = "update course set title = ?, description = ?, link = ? where course_id = ?"; 67 | int update = jdbcTemplate.update(sql,course.getTitle(),course.getDescription(),course.getLink(),id); 68 | if(update == 1) { 69 | log.info("Course Updated: " + course.getTitle()); 70 | } 71 | } 72 | 73 | @Override 74 | public void delete(int id) { 75 | String sql = "delete from course where course_id = ?"; 76 | int delete = jdbcTemplate.update(sql,id); 77 | if(delete == 1) { 78 | log.info("Course Deleted: " + id); 79 | } 80 | } 81 | 82 | 83 | } 84 | -------------------------------------------------------------------------------- /java/java-faker-jdbc/src/main/java/dev/danvega/Application.java: -------------------------------------------------------------------------------- 1 | package dev.danvega; 2 | 3 | import com.github.javafaker.Faker; 4 | 5 | import java.sql.*; 6 | 7 | public class Application { 8 | 9 | private static final Faker faker = new Faker(); 10 | 11 | public static void main(String[] args) throws SQLException { 12 | 13 | try(Connection connection = DriverManager.getConnection("jdbc:h2:mem:people","sa","")) { 14 | createSchema(connection); 15 | 16 | // create 100 rows of fake data 17 | for(int i = 1; i <= 100; ++i) { 18 | createAddress(connection, i); 19 | createPerson(connection, i); 20 | } 21 | 22 | // print out all people 23 | printPeople(connection); 24 | } 25 | 26 | } 27 | 28 | private static void printPeople(Connection connection) throws SQLException { 29 | PreparedStatement findAllPeople = connection.prepareStatement("SELECT * FROM PERSON"); 30 | ResultSet rs = findAllPeople.executeQuery(); 31 | 32 | while(rs.next()) { 33 | String person = String.format("Person %d: %s | %s | %s | %s | (Address ID: %d)", 34 | rs.getInt("id"), 35 | rs.getString("first_name"), 36 | rs.getString("last_name"), 37 | rs.getString("phone_number"), 38 | rs.getString("email"), 39 | rs.getInt("address_id")); 40 | System.out.println(person); 41 | } 42 | } 43 | 44 | private static void createSchema(Connection connection) throws SQLException { 45 | Statement statement = connection.createStatement(); 46 | String addressSchema = "create table address (id integer, address varchar(255), city varchar(255), state varchar(255), zip varchar(255), primary key (id))"; 47 | String personSchema = "create table person (id integer, email varchar(255), first_name varchar(255), last_name varchar(255), phone_number varchar(255), address_id integer, primary key (id))"; 48 | 49 | statement.executeUpdate(addressSchema); 50 | statement.executeUpdate(personSchema); 51 | } 52 | 53 | private static void createAddress(Connection connection, int i) throws SQLException { 54 | String insertAddressSQL = "INSERT INTO ADDRESS (id,address,city,state,zip) VALUES(?,?,?,?,?)"; 55 | PreparedStatement createAddress = connection.prepareStatement(insertAddressSQL); 56 | createAddress.setInt(1, i); 57 | createAddress.setString(2, faker.address().streetAddress()); 58 | createAddress.setString(3, faker.address().city()); 59 | createAddress.setString(4, faker.address().state()); 60 | createAddress.setString(5, faker.address().zipCode()); 61 | createAddress.executeUpdate(); 62 | } 63 | 64 | private static void createPerson(Connection connection, int i) throws SQLException { 65 | String insertPersonSQL = "INSERT INTO PERSON (id,first_name,last_Name,phone_number,email,address_id) VALUES(?,?,?,?,?,?)"; 66 | PreparedStatement createPerson = connection.prepareStatement(insertPersonSQL); 67 | createPerson.setInt(1, i); 68 | createPerson.setString(2, faker.name().firstName()); 69 | createPerson.setString(3, faker.name().lastName()); 70 | createPerson.setString(4, faker.phoneNumber().cellPhone()); 71 | createPerson.setString(5, faker.internet().emailAddress()); 72 | createPerson.setInt(6, i); 73 | createPerson.executeUpdate(); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /nuxt/content-suggestions/components/ContentGrid.vue: -------------------------------------------------------------------------------- 1 | 2 | 65 | 66 | 85 | -------------------------------------------------------------------------------- /java/java-faker/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.6"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /java/github-copilot/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.6"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /spring-boot/log4jv/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.6"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /spring-boot/records/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.6"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.6"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/src/test/java/dev/danvega/controller/CourseControllerTest.java: -------------------------------------------------------------------------------- 1 | package dev.danvega.controller; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import dev.danvega.dao.DAO; 5 | import dev.danvega.model.Course; 6 | import org.junit.jupiter.api.BeforeAll; 7 | import org.junit.jupiter.api.Test; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; 10 | import org.springframework.boot.test.mock.mockito.MockBean; 11 | import org.springframework.http.MediaType; 12 | import org.springframework.test.web.servlet.MockMvc; 13 | 14 | import java.util.List; 15 | import java.util.Optional; 16 | 17 | import static org.hamcrest.Matchers.is; 18 | import static org.junit.jupiter.api.Assertions.assertNotNull; 19 | import static org.mockito.Mockito.doNothing; 20 | import static org.mockito.Mockito.when; 21 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; 22 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; 23 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; 24 | 25 | @WebMvcTest(CourseController.class) 26 | class CourseControllerTest { 27 | 28 | @Autowired 29 | private MockMvc mockMvc; 30 | 31 | @MockBean 32 | private DAO dao; 33 | 34 | @Autowired 35 | private ObjectMapper objectMapper; 36 | 37 | private static List courses; 38 | 39 | @BeforeAll 40 | static void beforeAll() { 41 | courses = List.of(new Course(1,"test_title","test_desc","http://www.danvega.dev")); 42 | } 43 | 44 | @Test 45 | void contextLoads() { 46 | assertNotNull(mockMvc); 47 | assertNotNull(dao); 48 | assertNotNull(objectMapper); 49 | } 50 | 51 | @Test 52 | public void list_ShouldReturnAllCourses() throws Exception { 53 | 54 | when(dao.list()).thenReturn(courses); 55 | 56 | mockMvc.perform(get("/courses")) 57 | .andExpect(status().isOk()) 58 | .andExpect(jsonPath("$.size()", is(courses.size()))) 59 | .andExpect(jsonPath("$[0].courseId", is(1))) 60 | .andExpect(jsonPath("$[0].title", is("test_title"))) 61 | .andExpect(jsonPath("$[0].description", is("test_desc"))) 62 | .andExpect(jsonPath("$[0].link", is("http://www.danvega.dev"))); 63 | } 64 | 65 | @Test 66 | public void get_ShouldReturnOneCourseById() throws Exception { 67 | final int courseId = 1; 68 | final Course course = new Course(courseId,"test_title","test_desc","http://www.danvega.dev"); 69 | 70 | when(dao.get(courseId)).thenReturn(Optional.of(course)); 71 | 72 | mockMvc.perform(get("/courses/{id}", courseId)) 73 | .andExpect(status().isOk()) 74 | .andExpect(jsonPath("$.title", is(course.getTitle()))) 75 | .andExpect(jsonPath("$.description", is(course.getDescription()))) 76 | .andExpect(jsonPath("$.link", is(course.getLink()))); 77 | } 78 | 79 | @Test 80 | public void shouldReturn404WithInvalidCourseId() throws Exception { 81 | final int courseId = 99; 82 | 83 | when(dao.get(courseId)).thenReturn(Optional.empty()); 84 | 85 | mockMvc.perform(get("/courses/{id}", courseId)) 86 | .andExpect(status().isNotFound()); 87 | } 88 | 89 | @Test 90 | public void create_ValidCourse_ShouldCreateNewCourse() throws Exception { 91 | Course course = new Course("test_title","test_desc","http://www.danvega.dev"); 92 | when(dao.create(course)).thenReturn(course); 93 | 94 | this.mockMvc 95 | .perform(post("/courses") 96 | .contentType(MediaType.APPLICATION_JSON) 97 | .content(objectMapper.writeValueAsString(course))) 98 | .andExpect(status().isCreated()); 99 | } 100 | 101 | @Test 102 | public void create_InvalidCourse_ShouldReturn400BadRequest() throws Exception { 103 | Course course = new Course("test_title","test_desc","not_a_url"); 104 | when(dao.create(course)).thenReturn(course); 105 | 106 | this.mockMvc 107 | .perform(post("/courses") 108 | .contentType(MediaType.APPLICATION_JSON) 109 | .content(objectMapper.writeValueAsString(course))) 110 | .andExpect(status().isBadRequest()); 111 | } 112 | 113 | @Test 114 | public void update_ValidCourse_ShouldUpdateExistingCourse() throws Exception { 115 | Course course = new Course("updated_title","updated_desc","http://www.danvega.dev"); 116 | doNothing().when(dao).update(course,1); 117 | 118 | this.mockMvc 119 | .perform(put("/courses/1") 120 | .contentType(MediaType.APPLICATION_JSON) 121 | .content(objectMapper.writeValueAsString(course))) 122 | .andExpect(status().isNoContent()); 123 | } 124 | 125 | @Test 126 | public void update_InvalidCourse_ShouldReturn400BadRequest() throws Exception { 127 | Course course = new Course("updated_title","updated_desc","not_a_url"); 128 | doNothing().when(dao).update(course,1); 129 | 130 | mockMvc 131 | .perform(put("/courses/1") 132 | .contentType(MediaType.APPLICATION_JSON) 133 | .content(objectMapper.writeValueAsString(course))) 134 | .andExpect(status().isBadRequest()); 135 | } 136 | 137 | @Test 138 | public void delete_ValidCourseId_ShouldDeleteCourse() throws Exception { 139 | doNothing().when(dao).delete(1); 140 | mockMvc.perform(delete("/courses/1")).andExpect(status().isNoContent()); 141 | } 142 | 143 | 144 | } 145 | -------------------------------------------------------------------------------- /nuxt/hello-tailwind-3/README.md: -------------------------------------------------------------------------------- 1 | # Nuxt 3 + Tailwind CSS 3 Starter 2 | 3 | This is a minimal starter template for Nuxt 3 projects with Tailwind CSS 3. It includes a simple template `pages/index.vue` and a Tailwind UI example component in `pages/features.vue`. To make the Tailwind UI component work this setup includes [heroicons](https://heroicons.com/). You can either clone this repo or use the steps below to to create a new Nuxt 3 + Tailwind CSS 3 project. 4 | 5 | ## Steps 6 | 7 | Start by creating a new Nuxt 3 project named `hello-tailwind-3` with the following command: 8 | 9 | `npx nuxi init hello-tailwind-3` 10 | 11 | Install Tailwind CSS as a development dependency with the following command: 12 | 13 | - `npm install -D tailwindcss` 14 | 15 | Create your `tailwind.config.js` file with the following content: 16 | 17 | - `npx tailwindcss init` 18 | 19 | Open up `tailwind.config.js` and add the paths to all of your template files under content: 20 | 21 | ```javascript 22 | module.exports = { 23 | content: [ 24 | "./components/**/*.{js,vue,ts}", 25 | "./layouts/**/*.vue", 26 | "./pages/**/*.vue", 27 | "./plugins/**/*.{js,ts}", 28 | "./nuxt.config.{js,ts}", 29 | ], 30 | theme: { 31 | extend: {}, 32 | }, 33 | plugins: [], 34 | } 35 | ``` 36 | 37 | Create a new file `assets/css/tailwind.css` and add the following add the @tailwind directives for each of Tailwind’s layers: 38 | 39 | ```css 40 | @tailwind base; 41 | @tailwind components; 42 | @tailwind utilities; 43 | ``` 44 | 45 | Open up `nuxt.config.js` and add the following: 46 | 47 | ```javascript 48 | import { defineNuxtConfig } from 'nuxt3' 49 | 50 | // https://v3.nuxtjs.org/docs/directory-structure/nuxt.config 51 | export default defineNuxtConfig({ 52 | build: { 53 | postcss: { 54 | postcssOptions: { 55 | plugins: { 56 | tailwindcss: {}, 57 | autoprefixer: {}, 58 | }, 59 | }, 60 | }, 61 | }, 62 | css: [ 63 | "~/assets/css/tailwind.css" 64 | ], 65 | }) 66 | ``` 67 | 68 | If you want to learn more about what the code above is doing visit the [documentation](https://v3.nuxtjs.org/docs/directory-structure/nuxt.config#css). The css option will allow you to define a css file that you want to set globally and include in any page. 69 | 70 | ## Vue Templates 71 | 72 | To get started you will need to remove `app.vue` and create a new page `pages/index.vue` with the following content: 73 | 74 | ```vue 75 | 80 | ``` 81 | 82 | If you start the app with `npm run dev` you should be able to visit http://localhost:3000/ and see the page you just created along with Tailwind 3 in action. 83 | 84 | ### Tailwind UI 85 | 86 | I also included a [Tailwind UI](https://tailwindui.com/components/marketing/sections/feature-sections) example component in `pages/features.vue` which you can use to test out your Tailwind CSS 3 configuration. To use this example component you will need to install the following dependencies: 87 | 88 | ```bash 89 | npm install @heroicons/vue 90 | ``` 91 | 92 | Create `pages/features.vue` with the following content: 93 | 94 | ```vue 95 | 126 | 127 | 165 | ``` 166 | 167 | If you start the app with `npm run dev` you should be able to visit http://localhost:3000/features and see the page you created with Tailwind UI. 168 | -------------------------------------------------------------------------------- /java/java-faker/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /java/github-copilot/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /spring-boot/log4jv/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /spring-boot/records/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /spring-boot/hello-spring/.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /spring-boot/crud-rest-api/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ]; then 38 | 39 | if [ -f /etc/mavenrc ]; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ]; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false 51 | darwin=false 52 | mingw=false 53 | case "$(uname)" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true ;; 56 | Darwin*) 57 | darwin=true 58 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 59 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 60 | if [ -z "$JAVA_HOME" ]; then 61 | if [ -x "/usr/libexec/java_home" ]; then 62 | export JAVA_HOME="$(/usr/libexec/java_home)" 63 | else 64 | export JAVA_HOME="/Library/Java/Home" 65 | fi 66 | fi 67 | ;; 68 | esac 69 | 70 | if [ -z "$JAVA_HOME" ]; then 71 | if [ -r /etc/gentoo-release ]; then 72 | JAVA_HOME=$(java-config --jre-home) 73 | fi 74 | fi 75 | 76 | if [ -z "$M2_HOME" ]; then 77 | ## resolve links - $0 may be a link to maven's home 78 | PRG="$0" 79 | 80 | # need this for relative symlinks 81 | while [ -h "$PRG" ]; do 82 | ls=$(ls -ld "$PRG") 83 | link=$(expr "$ls" : '.*-> \(.*\)$') 84 | if expr "$link" : '/.*' >/dev/null; then 85 | PRG="$link" 86 | else 87 | PRG="$(dirname "$PRG")/$link" 88 | fi 89 | done 90 | 91 | saveddir=$(pwd) 92 | 93 | M2_HOME=$(dirname "$PRG")/.. 94 | 95 | # make it fully qualified 96 | M2_HOME=$(cd "$M2_HOME" && pwd) 97 | 98 | cd "$saveddir" 99 | # echo Using m2 at $M2_HOME 100 | fi 101 | 102 | # For Cygwin, ensure paths are in UNIX format before anything is touched 103 | if $cygwin; then 104 | [ -n "$M2_HOME" ] && 105 | M2_HOME=$(cygpath --unix "$M2_HOME") 106 | [ -n "$JAVA_HOME" ] && 107 | JAVA_HOME=$(cygpath --unix "$JAVA_HOME") 108 | [ -n "$CLASSPATH" ] && 109 | CLASSPATH=$(cygpath --path --unix "$CLASSPATH") 110 | fi 111 | 112 | # For Mingw, ensure paths are in UNIX format before anything is touched 113 | if $mingw; then 114 | [ -n "$M2_HOME" ] && 115 | M2_HOME="$( ( 116 | cd "$M2_HOME" 117 | pwd 118 | ))" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="$( ( 121 | cd "$JAVA_HOME" 122 | pwd 123 | ))" 124 | fi 125 | 126 | if [ -z "$JAVA_HOME" ]; then 127 | javaExecutable="$(which javac)" 128 | if [ -n "$javaExecutable" ] && ! [ "$(expr \"$javaExecutable\" : '\([^ ]*\)')" = "no" ]; then 129 | # readlink(1) is not available as standard on Solaris 10. 130 | readLink=$(which readlink) 131 | if [ ! $(expr "$readLink" : '\([^ ]*\)') = "no" ]; then 132 | if $darwin; then 133 | javaHome="$(dirname \"$javaExecutable\")" 134 | javaExecutable="$(cd \"$javaHome\" && pwd -P)/javac" 135 | else 136 | javaExecutable="$(readlink -f \"$javaExecutable\")" 137 | fi 138 | javaHome="$(dirname \"$javaExecutable\")" 139 | javaHome=$(expr "$javaHome" : '\(.*\)/bin') 140 | JAVA_HOME="$javaHome" 141 | export JAVA_HOME 142 | fi 143 | fi 144 | fi 145 | 146 | if [ -z "$JAVACMD" ]; then 147 | if [ -n "$JAVA_HOME" ]; then 148 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 149 | # IBM's JDK on AIX uses strange locations for the executables 150 | JAVACMD="$JAVA_HOME/jre/sh/java" 151 | else 152 | JAVACMD="$JAVA_HOME/bin/java" 153 | fi 154 | else 155 | JAVACMD="$(which java)" 156 | fi 157 | fi 158 | 159 | if [ ! -x "$JAVACMD" ]; then 160 | echo "Error: JAVA_HOME is not defined correctly." >&2 161 | echo " We cannot execute $JAVACMD" >&2 162 | exit 1 163 | fi 164 | 165 | if [ -z "$JAVA_HOME" ]; then 166 | echo "Warning: JAVA_HOME environment variable is not set." 167 | fi 168 | 169 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 170 | 171 | # traverses directory structure from process work directory to filesystem root 172 | # first directory with .mvn subdirectory is considered project base directory 173 | find_maven_basedir() { 174 | 175 | if [ -z "$1" ]; then 176 | echo "Path not specified to find_maven_basedir" 177 | return 1 178 | fi 179 | 180 | basedir="$1" 181 | wdir="$1" 182 | while [ "$wdir" != '/' ]; do 183 | if [ -d "$wdir"/.mvn ]; then 184 | basedir=$wdir 185 | break 186 | fi 187 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 188 | if [ -d "${wdir}" ]; then 189 | wdir=$( 190 | cd "$wdir/.." 191 | pwd 192 | ) 193 | fi 194 | # end of workaround 195 | done 196 | echo "${basedir}" 197 | } 198 | 199 | # concatenates all lines of a file 200 | concat_lines() { 201 | if [ -f "$1" ]; then 202 | echo "$(tr -s '\n' ' ' <"$1")" 203 | fi 204 | } 205 | 206 | BASE_DIR=$(find_maven_basedir "$(pwd)") 207 | if [ -z "$BASE_DIR" ]; then 208 | exit 1 209 | fi 210 | 211 | ########################################################################################## 212 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 213 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 214 | ########################################################################################## 215 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 216 | if [ "$MVNW_VERBOSE" = true ]; then 217 | echo "Found .mvn/wrapper/maven-wrapper.jar" 218 | fi 219 | else 220 | if [ "$MVNW_VERBOSE" = true ]; then 221 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 222 | fi 223 | if [ -n "$MVNW_REPOURL" ]; then 224 | jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 225 | else 226 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 227 | fi 228 | while IFS="=" read key value; do 229 | case "$key" in wrapperUrl) 230 | jarUrl="$value" 231 | break 232 | ;; 233 | esac 234 | done <"$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 235 | if [ "$MVNW_VERBOSE" = true ]; then 236 | echo "Downloading from: $jarUrl" 237 | fi 238 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 239 | if $cygwin; then 240 | wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") 241 | fi 242 | 243 | if command -v wget >/dev/null; then 244 | if [ "$MVNW_VERBOSE" = true ]; then 245 | echo "Found wget ... using wget" 246 | fi 247 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 248 | wget "$jarUrl" -O "$wrapperJarPath" 249 | else 250 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" 251 | fi 252 | elif command -v curl >/dev/null; then 253 | if [ "$MVNW_VERBOSE" = true ]; then 254 | echo "Found curl ... using curl" 255 | fi 256 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 257 | curl -o "$wrapperJarPath" "$jarUrl" -f 258 | else 259 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 260 | fi 261 | 262 | else 263 | if [ "$MVNW_VERBOSE" = true ]; then 264 | echo "Falling back to using Java to download" 265 | fi 266 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 267 | # For Cygwin, switch paths to Windows format before running javac 268 | if $cygwin; then 269 | javaClass=$(cygpath --path --windows "$javaClass") 270 | fi 271 | if [ -e "$javaClass" ]; then 272 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 273 | if [ "$MVNW_VERBOSE" = true ]; then 274 | echo " - Compiling MavenWrapperDownloader.java ..." 275 | fi 276 | # Compiling the Java class 277 | ("$JAVA_HOME/bin/javac" "$javaClass") 278 | fi 279 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 280 | # Running the downloader 281 | if [ "$MVNW_VERBOSE" = true ]; then 282 | echo " - Running MavenWrapperDownloader.java ..." 283 | fi 284 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 285 | fi 286 | fi 287 | fi 288 | fi 289 | ########################################################################################## 290 | # End of extension 291 | ########################################################################################## 292 | 293 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 294 | if [ "$MVNW_VERBOSE" = true ]; then 295 | echo $MAVEN_PROJECTBASEDIR 296 | fi 297 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 298 | 299 | # For Cygwin, switch paths to Windows format before running java 300 | if $cygwin; then 301 | [ -n "$M2_HOME" ] && 302 | M2_HOME=$(cygpath --path --windows "$M2_HOME") 303 | [ -n "$JAVA_HOME" ] && 304 | JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") 305 | [ -n "$CLASSPATH" ] && 306 | CLASSPATH=$(cygpath --path --windows "$CLASSPATH") 307 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 308 | MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") 309 | fi 310 | 311 | # Provide a "standardized" way to retrieve the CLI args that will 312 | # work with both Windows and non-Windows executions. 313 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 314 | export MAVEN_CMD_LINE_ARGS 315 | 316 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 317 | 318 | exec "$JAVACMD" \ 319 | $MAVEN_OPTS \ 320 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 321 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 322 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 323 | -------------------------------------------------------------------------------- /java/java-faker/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Mingw, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | fi 118 | 119 | if [ -z "$JAVA_HOME" ]; then 120 | javaExecutable="`which javac`" 121 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 122 | # readlink(1) is not available as standard on Solaris 10. 123 | readLink=`which readlink` 124 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 125 | if $darwin ; then 126 | javaHome="`dirname \"$javaExecutable\"`" 127 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 128 | else 129 | javaExecutable="`readlink -f \"$javaExecutable\"`" 130 | fi 131 | javaHome="`dirname \"$javaExecutable\"`" 132 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 133 | JAVA_HOME="$javaHome" 134 | export JAVA_HOME 135 | fi 136 | fi 137 | fi 138 | 139 | if [ -z "$JAVACMD" ] ; then 140 | if [ -n "$JAVA_HOME" ] ; then 141 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 142 | # IBM's JDK on AIX uses strange locations for the executables 143 | JAVACMD="$JAVA_HOME/jre/sh/java" 144 | else 145 | JAVACMD="$JAVA_HOME/bin/java" 146 | fi 147 | else 148 | JAVACMD="`which java`" 149 | fi 150 | fi 151 | 152 | if [ ! -x "$JAVACMD" ] ; then 153 | echo "Error: JAVA_HOME is not defined correctly." >&2 154 | echo " We cannot execute $JAVACMD" >&2 155 | exit 1 156 | fi 157 | 158 | if [ -z "$JAVA_HOME" ] ; then 159 | echo "Warning: JAVA_HOME environment variable is not set." 160 | fi 161 | 162 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 163 | 164 | # traverses directory structure from process work directory to filesystem root 165 | # first directory with .mvn subdirectory is considered project base directory 166 | find_maven_basedir() { 167 | 168 | if [ -z "$1" ] 169 | then 170 | echo "Path not specified to find_maven_basedir" 171 | return 1 172 | fi 173 | 174 | basedir="$1" 175 | wdir="$1" 176 | while [ "$wdir" != '/' ] ; do 177 | if [ -d "$wdir"/.mvn ] ; then 178 | basedir=$wdir 179 | break 180 | fi 181 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 182 | if [ -d "${wdir}" ]; then 183 | wdir=`cd "$wdir/.."; pwd` 184 | fi 185 | # end of workaround 186 | done 187 | echo "${basedir}" 188 | } 189 | 190 | # concatenates all lines of a file 191 | concat_lines() { 192 | if [ -f "$1" ]; then 193 | echo "$(tr -s '\n' ' ' < "$1")" 194 | fi 195 | } 196 | 197 | BASE_DIR=`find_maven_basedir "$(pwd)"` 198 | if [ -z "$BASE_DIR" ]; then 199 | exit 1; 200 | fi 201 | 202 | ########################################################################################## 203 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 204 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 205 | ########################################################################################## 206 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 207 | if [ "$MVNW_VERBOSE" = true ]; then 208 | echo "Found .mvn/wrapper/maven-wrapper.jar" 209 | fi 210 | else 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 213 | fi 214 | if [ -n "$MVNW_REPOURL" ]; then 215 | jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 216 | else 217 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 218 | fi 219 | while IFS="=" read key value; do 220 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 221 | esac 222 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 223 | if [ "$MVNW_VERBOSE" = true ]; then 224 | echo "Downloading from: $jarUrl" 225 | fi 226 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 227 | if $cygwin; then 228 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 229 | fi 230 | 231 | if command -v wget > /dev/null; then 232 | if [ "$MVNW_VERBOSE" = true ]; then 233 | echo "Found wget ... using wget" 234 | fi 235 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 236 | wget "$jarUrl" -O "$wrapperJarPath" 237 | else 238 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" 239 | fi 240 | elif command -v curl > /dev/null; then 241 | if [ "$MVNW_VERBOSE" = true ]; then 242 | echo "Found curl ... using curl" 243 | fi 244 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 245 | curl -o "$wrapperJarPath" "$jarUrl" -f 246 | else 247 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 248 | fi 249 | 250 | else 251 | if [ "$MVNW_VERBOSE" = true ]; then 252 | echo "Falling back to using Java to download" 253 | fi 254 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 255 | # For Cygwin, switch paths to Windows format before running javac 256 | if $cygwin; then 257 | javaClass=`cygpath --path --windows "$javaClass"` 258 | fi 259 | if [ -e "$javaClass" ]; then 260 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 261 | if [ "$MVNW_VERBOSE" = true ]; then 262 | echo " - Compiling MavenWrapperDownloader.java ..." 263 | fi 264 | # Compiling the Java class 265 | ("$JAVA_HOME/bin/javac" "$javaClass") 266 | fi 267 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 268 | # Running the downloader 269 | if [ "$MVNW_VERBOSE" = true ]; then 270 | echo " - Running MavenWrapperDownloader.java ..." 271 | fi 272 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 273 | fi 274 | fi 275 | fi 276 | fi 277 | ########################################################################################## 278 | # End of extension 279 | ########################################################################################## 280 | 281 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 282 | if [ "$MVNW_VERBOSE" = true ]; then 283 | echo $MAVEN_PROJECTBASEDIR 284 | fi 285 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 286 | 287 | # For Cygwin, switch paths to Windows format before running java 288 | if $cygwin; then 289 | [ -n "$M2_HOME" ] && 290 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 291 | [ -n "$JAVA_HOME" ] && 292 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 293 | [ -n "$CLASSPATH" ] && 294 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 295 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 296 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 297 | fi 298 | 299 | # Provide a "standardized" way to retrieve the CLI args that will 300 | # work with both Windows and non-Windows executions. 301 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 302 | export MAVEN_CMD_LINE_ARGS 303 | 304 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 305 | 306 | exec "$JAVACMD" \ 307 | $MAVEN_OPTS \ 308 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 309 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 310 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 311 | --------------------------------------------------------------------------------