├── Laravel └── my-first-badges │ ├── public │ ├── favicon.ico │ ├── robots.txt │ ├── .htaccess │ └── index.php │ ├── resources │ ├── css │ │ └── app.css │ ├── js │ │ ├── app.js │ │ └── bootstrap.js │ └── views │ │ └── welcome.blade.php │ ├── database │ ├── .gitignore │ ├── seeders │ │ └── DatabaseSeeder.php │ ├── migrations │ │ ├── 2014_10_12_100000_create_password_reset_tokens_table.php │ │ ├── 2014_10_12_000000_create_users_table.php │ │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ │ └── 2019_12_14_000001_create_personal_access_tokens_table.php │ └── factories │ │ └── UserFactory.php │ ├── bootstrap │ ├── cache │ │ └── .gitignore │ └── app.php │ ├── storage │ ├── logs │ │ └── .gitignore │ ├── app │ │ ├── public │ │ │ └── .gitignore │ │ └── .gitignore │ └── framework │ │ ├── sessions │ │ └── .gitignore │ │ ├── testing │ │ └── .gitignore │ │ ├── views │ │ └── .gitignore │ │ ├── cache │ │ ├── data │ │ │ └── .gitignore │ │ └── .gitignore │ │ └── .gitignore │ ├── tests │ ├── TestCase.php │ ├── Unit │ │ └── ExampleTest.php │ ├── Feature │ │ └── ExampleTest.php │ └── CreatesApplication.php │ ├── .gitattributes │ ├── package.json │ ├── vite.config.js │ ├── .gitignore │ ├── .editorconfig │ ├── app │ ├── Http │ │ ├── Controllers │ │ │ └── Controller.php │ │ ├── Middleware │ │ │ ├── EncryptCookies.php │ │ │ ├── VerifyCsrfToken.php │ │ │ ├── PreventRequestsDuringMaintenance.php │ │ │ ├── TrimStrings.php │ │ │ ├── TrustHosts.php │ │ │ ├── Authenticate.php │ │ │ ├── ValidateSignature.php │ │ │ ├── TrustProxies.php │ │ │ └── RedirectIfAuthenticated.php │ │ └── Kernel.php │ ├── Providers │ │ ├── BroadcastServiceProvider.php │ │ ├── AppServiceProvider.php │ │ ├── AuthServiceProvider.php │ │ ├── EventServiceProvider.php │ │ └── RouteServiceProvider.php │ ├── Console │ │ └── Kernel.php │ ├── Exceptions │ │ └── Handler.php │ └── Models │ │ └── User.php │ ├── routes │ ├── web.php │ ├── channels.php │ ├── api.php │ └── console.php │ ├── config │ ├── cors.php │ ├── services.php │ ├── view.php │ ├── hashing.php │ ├── broadcasting.php │ ├── filesystems.php │ ├── sanctum.php │ ├── cache.php │ ├── queue.php │ ├── auth.php │ ├── mail.php │ ├── logging.php │ ├── database.php │ ├── app.php │ └── session.php │ ├── phpunit.xml │ ├── .env.example │ ├── artisan │ ├── composer.json │ └── README.md ├── .github ├── ISSUE_TEMPLATE │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── CONTRIBUTING.md └── CODE_OF_CONDUCT.md ├── Python ├── Service Health Check │ ├── Readme.MD │ └── health_check.py ├── Countdown-Timer.md ├── password_generator.py ├── Number-Guessing-Game.md ├── Rock-Paper-Scissors.md ├── encrypt.md ├── subsequence-algorithm.md └── Password-Generator.md ├── LICENSE ├── README.md └── Javascript ├── ExpressJS └── simplerest.md ├── ReactJS ├── Calculator.md ├── Weather App in ReactJS.md ├── Calculator-test.md └── ToDoApp.md ├── Random-Joke-Generator.md └── Random-Quote-Generator.md /Laravel/my-first-badges/public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/resources/css/app.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 16 | 17 | $response->assertStatus(200); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 18 | 19 | return $app; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts(): array 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | expectsJson() ? null : route('login'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/routes/web.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | create(); 16 | 17 | // \App\Models\User::factory()->create([ 18 | // 'name' => 'Test User', 19 | // 'email' => 'test@example.com', 20 | // ]); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | */ 22 | public function boot(): void 23 | { 24 | // 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 16 | } 17 | 18 | /** 19 | * Register the commands for the application. 20 | */ 21 | protected function commands(): void 22 | { 23 | $this->load(__DIR__.'/Commands'); 24 | 25 | require base_path('routes/console.php'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $dontFlash = [ 16 | 'current_password', 17 | 'password', 18 | 'password_confirmation', 19 | ]; 20 | 21 | /** 22 | * Register the exception handling callbacks for the application. 23 | */ 24 | public function register(): void 25 | { 26 | $this->reportable(function (Throwable $e) { 27 | // 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest an idea or improvement for the project 4 | title: "[FEATURE REQUEST] - Your Feature Title Here" 5 | labels: enhancement 6 | assignees: '' 7 | --- 8 | 9 | ## Feature Request 10 | 11 | 12 | 13 | ## Problem Statement 14 | 15 | 16 | 17 | ## Proposed Solution 18 | 19 | 20 | 21 | ## Alternatives Considered 22 | 23 | 24 | 25 | ## Additional Context 26 | 27 | 28 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php: -------------------------------------------------------------------------------- 1 | string('email')->primary(); 16 | $table->string('token'); 17 | $table->timestamp('created_at')->nullable(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('password_reset_tokens'); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /Python/Service Health Check/Readme.MD: -------------------------------------------------------------------------------- 1 | # 🔍 Service Health Check (Python) 2 | 3 | A simple Python script to check the health of a web service (HTTP endpoint). 4 | Perfect for DevOps beginners who want to learn about monitoring, logging, and exit codes in automation. 5 | 6 | --- 7 | 8 | ## 🚀 Features 9 | - Checks if a given URL is reachable and returns HTTP 200 10 | - Logs results to `health_check.log` 11 | - Exits with: 12 | - `0` → Service is healthy 13 | - `1` → Service is unhealthy or unreachable 14 | - Useful in CI/CD pipelines, cron jobs, or container health checks 15 | 16 | --- 17 | 18 | ## 📦 Requirements 19 | - Python 3.7+ 20 | - `requests` library 21 | 22 | Install dependencies: 23 | ```bash 24 | pip install requests 25 | 26 | --- 27 | 28 | ## 🛠 Usage 29 | Run the script with a URL: 30 | python health_check.py https://example.com 31 | 32 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 24 | return redirect(RouteServiceProvider::HOME); 25 | } 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Pull Request 2 | 3 | ## Description 4 | 5 | 6 | 7 | ## Changes Made 8 | 9 | 10 | 11 | ## Related Issues 12 | 13 | 14 | 15 | ## Checklist 16 | 17 | - [ ] I have tested these changes locally. 18 | - [ ] I have added appropriate comments in the code, particularly in complex sections. 19 | - [ ] I have updated the documentation if needed. 20 | - [ ] My code follows the project's coding style guidelines. 21 | - [ ] I have added/modified tests to cover the changes. 22 | 23 | ## Screenshots (if applicable) 24 | 25 | 26 | 27 | ## Additional Context 28 | 29 | 30 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('name'); 17 | $table->string('email')->unique(); 18 | $table->timestamp('email_verified_at')->nullable(); 19 | $table->string('password'); 20 | $table->rememberToken(); 21 | $table->timestamps(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::dropIfExists('users'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('uuid')->unique(); 17 | $table->text('connection'); 18 | $table->text('queue'); 19 | $table->longText('payload'); 20 | $table->longText('exception'); 21 | $table->timestamp('failed_at')->useCurrent(); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::dropIfExists('failed_jobs'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->morphs('tokenable'); 17 | $table->string('name'); 18 | $table->string('token', 64)->unique(); 19 | $table->text('abilities')->nullable(); 20 | $table->timestamp('last_used_at')->nullable(); 21 | $table->timestamp('expires_at')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | */ 29 | public function down(): void 30 | { 31 | Schema::dropIfExists('personal_access_tokens'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | */ 26 | public function boot(): void 27 | { 28 | // 29 | } 30 | 31 | /** 32 | * Determine if events and listeners should be automatically discovered. 33 | */ 34 | public function shouldDiscoverEvents(): bool 35 | { 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Chrea Chanchhunneng 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Models/User.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | protected $fillable = [ 21 | 'name', 22 | 'email', 23 | 'password', 24 | ]; 25 | 26 | /** 27 | * The attributes that should be hidden for serialization. 28 | * 29 | * @var array 30 | */ 31 | protected $hidden = [ 32 | 'password', 33 | 'remember_token', 34 | ]; 35 | 36 | /** 37 | * The attributes that should be cast. 38 | * 39 | * @var array 40 | */ 41 | protected $casts = [ 42 | 'email_verified_at' => 'datetime', 43 | 'password' => 'hashed', 44 | ]; 45 | } 46 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | tests/Unit 10 | 11 | 12 | tests/Feature 13 | 14 | 15 | 16 | 17 | app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Programming Starters Project 2 | 3 | 🎉 Thank you for considering contributing to the Programming Starters Project! 🚀 4 | 5 | We welcome your contributions to make this repository a valuable resource for learners. Whether you want to add new projects, improve documentation, or fix issues, your efforts are appreciated. 6 | 7 | ## How to Contribute 8 | 9 | 1. Fork the repository. 10 | 2. Create a new branch for your contribution: `git checkout -b feature/your-feature-name`. 11 | 3. Make your changes and commit them: `git commit -m 'Add your feature'`. 12 | 4. Push to the branch: `git push origin feature/your-feature-name`. 13 | 5. Open a pull request with a clear title and description. 14 | 15 | ## Guidelines 16 | 17 | - Ensure your code follows best practices. 18 | - Be respectful and inclusive in your interactions. 19 | - If you're adding a new project, provide clear instructions and examples. 20 | - Test your changes before submitting a pull request. 21 | 22 | ## Code of Conduct 23 | 24 | By participating, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md). 25 | 26 | ## Need Help? 27 | 28 | If you have questions or need assistance, feel free to open an issue or reach out to chreachanchhunneng@gmail.com. 29 | 30 | Thank you for contributing! 🌟 31 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class UserFactory extends Factory 13 | { 14 | /** 15 | * The current password being used by the factory. 16 | */ 17 | protected static ?string $password; 18 | 19 | /** 20 | * Define the model's default state. 21 | * 22 | * @return array 23 | */ 24 | public function definition(): array 25 | { 26 | return [ 27 | 'name' => fake()->name(), 28 | 'email' => fake()->unique()->safeEmail(), 29 | 'email_verified_at' => now(), 30 | 'password' => static::$password ??= Hash::make('password'), 31 | 'remember_token' => Str::random(10), 32 | ]; 33 | } 34 | 35 | /** 36 | * Indicate that the model's email address should be unverified. 37 | */ 38 | public function unverified(): static 39 | { 40 | return $this->state(fn (array $attributes) => [ 41 | 'email_verified_at' => null, 42 | ]); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | by($request->user()?->id ?: $request->ip()); 29 | }); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Programming Starters Project 2 | 3 | 🚀 Welcome to the Programming Starters Project! This repository contains a curated collection of beginner-friendly projects in various programming languages and frameworks. Explore, learn, and code your way through hands-on projects to build your skills. 4 | 5 | ## How to Use 6 | 7 | 1. Explore language folders to find projects. 8 | 2. Each project is documented in Markdown files, providing step-by-step instructions and examples. 9 | 3. Choose a project, dive in, and start coding! 10 | 11 | ## Contributing 12 | 13 | We welcome contributions! If you have a project idea or want to improve existing projects, please check out our [Contributing Guidelines](.github/CONTRIBUTING.md). Your contributions help make learning to code more accessible. 14 | 15 | ⭐ If you find this project helpful, consider giving it a star! ⭐ It's a simple way to show your support. 16 | 17 | ## License 18 | 19 | This repository is open-sourced under the [MIT License](LICENSE). Feel free to use, modify, and share the content with others. 20 | 21 | Happy coding! 🚀✨ 22 | 23 | --- 24 | 25 | ## Contributors 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=my_first_badges 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=file 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailpit 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS="hello@example.com" 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_APP_NAME="${APP_NAME}" 55 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 56 | VITE_PUSHER_HOST="${PUSHER_HOST}" 57 | VITE_PUSHER_PORT="${PUSHER_PORT}" 58 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 59 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 60 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * We'll load the axios HTTP library which allows us to easily issue requests 3 | * to our Laravel back-end. This library automatically handles sending the 4 | * CSRF token as a header based on the value of the "XSRF" token cookie. 5 | */ 6 | 7 | import axios from 'axios'; 8 | window.axios = axios; 9 | 10 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 11 | 12 | /** 13 | * Echo exposes an expressive API for subscribing to channels and listening 14 | * for events that are broadcast by Laravel. Echo and event broadcasting 15 | * allows your team to easily build robust real-time web applications. 16 | */ 17 | 18 | // import Echo from 'laravel-echo'; 19 | 20 | // import Pusher from 'pusher-js'; 21 | // window.Pusher = Pusher; 22 | 23 | // window.Echo = new Echo({ 24 | // broadcaster: 'pusher', 25 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 26 | // cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', 27 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 28 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 29 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 30 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 31 | // enabledTransports: ['ws', 'wss'], 32 | // }); 33 | -------------------------------------------------------------------------------- /Javascript/ExpressJS/simplerest.md: -------------------------------------------------------------------------------- 1 | # Simple REST API with Express.js 2 | 3 | In this tutorial, we will create a simple REST API using Express.js, a popular Node.js framework. 4 | 5 | ## Prerequisites 6 | 7 | - Node.js installed 8 | - Basic knowledge of JavaScript 9 | 10 | ## Step 1: Initialize the Project 11 | 12 | First, create a new directory for your project and navigate into it: 13 | 14 | ```bash 15 | mkdir simplerest 16 | cd simplerest 17 | ``` 18 | 19 | Next, initialize a new Node.js project: 20 | 21 | ```bash 22 | npm init -y 23 | ``` 24 | 25 | Then, install Express.js: 26 | 27 | ```bash 28 | npm install express 29 | ``` 30 | 31 | ## Step 2: Create the Server 32 | 33 | Create a new file named `server.js` and add the following code to set up a basic Express server: 34 | 35 | ```javascript 36 | const express = require("express"); 37 | const app = express(); 38 | const port = 3000; 39 | 40 | app.get("/", (req, res) => { 41 | res.send("Hello World!"); 42 | }); 43 | 44 | app.listen(port, () => { 45 | console.log(`Server is running on http://localhost:${port}`); 46 | }); 47 | ``` 48 | 49 | ## Step 3: Run the Server 50 | 51 | To start the server, run the following command in your project directory: 52 | 53 | ```bash 54 | node server.js 55 | ``` 56 | 57 | You should see the message `Server is running on http://localhost:3000` in your terminal. Open your browser and navigate to `http://localhost:3000` to see the "Hello World!" message. 58 | -------------------------------------------------------------------------------- /Python/Service Health Check/health_check.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | Simple Service Health Check Script 4 | Author: Simardeep Singh 5 | Description: 6 | Checks the health of a given HTTP endpoint. 7 | Exits with code 0 if healthy, 1 if not. 8 | """ 9 | 10 | import sys 11 | import requests 12 | import logging 13 | from datetime import datetime 14 | 15 | # Configure logging 16 | logging.basicConfig( 17 | filename="health_check.log", 18 | level=logging.INFO, 19 | format="%(asctime)s - %(levelname)s - %(message)s" 20 | ) 21 | 22 | def check_service(url: str, timeout: int = 5) -> bool: 23 | """Check if the service at `url` is healthy.""" 24 | try: 25 | response = requests.get(url, timeout=timeout) 26 | if response.status_code == 200: 27 | logging.info(f"✅ Service healthy at {url}") 28 | return True 29 | else: 30 | logging.warning(f"⚠️ Service unhealthy at {url} - Status: {response.status_code}") 31 | return False 32 | except requests.RequestException as e: 33 | logging.error(f"❌ Error reaching {url}: {e}") 34 | return False 35 | 36 | if __name__ == "__main__": 37 | if len(sys.argv) != 2: 38 | print("Usage: python health_check.py ") 39 | sys.exit(1) 40 | 41 | url = sys.argv[1] 42 | healthy = check_service(url) 43 | 44 | if healthy: 45 | print(f"[{datetime.now()}] Service at {url} is UP ✅") 46 | sys.exit(0) 47 | else: 48 | print(f"[{datetime.now()}] Service at {url} is DOWN ❌") 49 | sys.exit(1) -------------------------------------------------------------------------------- /Laravel/my-first-badges/bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 12), 33 | 'verify' => true, 34 | ], 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Argon Options 39 | |-------------------------------------------------------------------------- 40 | | 41 | | Here you may specify the configuration options that should be used when 42 | | passwords are hashed using the Argon algorithm. These will allow you 43 | | to control the amount of time it takes to hash the given password. 44 | | 45 | */ 46 | 47 | 'argon' => [ 48 | 'memory' => 65536, 49 | 'threads' => 1, 50 | 'time' => 4, 51 | 'verify' => true, 52 | ], 53 | 54 | ]; 55 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /Python/Countdown-Timer.md: -------------------------------------------------------------------------------- 1 | # Countdown Timer in Python 2 | 3 | Welcome to the Countdown Timer project for Python! ⏲️ 4 | 5 | In this project, we'll create a simple countdown timer using Python. This project is great for learning about time manipulation and creating a practical application. Let's get started! 6 | 7 | ## Project Overview 8 | 9 | ### Objective 10 | 11 | Create a Python script that functions as a countdown timer. 12 | 13 | ### Features 14 | 15 | - Allow the user to set the duration of the countdown. 16 | - Display the countdown in seconds. 17 | - Notify the user when the countdown reaches zero. 18 | 19 | ## Project Structure 20 | 21 | Create a new Python script named `countdown_timer.py`. 22 | 23 | ## Instructions 24 | 25 | 1. **Get User Input:** 26 | - Prompt the user to enter the duration of the countdown in seconds. 27 | 28 | 2. **Countdown Display:** 29 | - Display the countdown in seconds, updating every second. 30 | 31 | 3. **Notification:** 32 | - Notify the user when the countdown reaches zero. You can use a sound alert or a simple console message. 33 | 34 | 4. **Run the Script:** 35 | - Execute the script and observe the countdown. 36 | 37 | ## Example Code 38 | 39 | ```python 40 | import time 41 | import winsound # Windows only, for sound notification 42 | 43 | def countdown_timer(duration): 44 | print(f"Countdown started for {duration} seconds.") 45 | 46 | for remaining_time in range(duration, 0, -1): 47 | print(f"Time remaining: {remaining_time} seconds") 48 | time.sleep(1) 49 | 50 | print("Countdown reached zero! Time's up!") 51 | 52 | # Sound notification (Windows only) 53 | winsound.Beep(1000, 1000) 54 | 55 | # Get user input for the duration of the countdown 56 | duration_input = int(input("Enter the duration of the countdown in seconds: ")) 57 | 58 | # Run the countdown timer 59 | countdown_timer(duration_input) 60 | ``` 61 | 62 | Feel free to customize the countdown timer, add features, or modify the structure as you see fit. Contributors can use this document as a guide to implementing the countdown timer in Python. 63 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The skeleton application for the Laravel framework.", 5 | "keywords": ["laravel", "framework"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.1", 9 | "guzzlehttp/guzzle": "^7.2", 10 | "laravel/framework": "^10.10", 11 | "laravel/sanctum": "^3.3", 12 | "laravel/tinker": "^2.8" 13 | }, 14 | "require-dev": { 15 | "fakerphp/faker": "^1.9.1", 16 | "laravel/pint": "^1.0", 17 | "laravel/sail": "^1.18", 18 | "mockery/mockery": "^1.4.4", 19 | "nunomaduro/collision": "^7.0", 20 | "phpunit/phpunit": "^10.1", 21 | "spatie/laravel-ignition": "^2.0" 22 | }, 23 | "autoload": { 24 | "psr-4": { 25 | "App\\": "app/", 26 | "Database\\Factories\\": "database/factories/", 27 | "Database\\Seeders\\": "database/seeders/" 28 | } 29 | }, 30 | "autoload-dev": { 31 | "psr-4": { 32 | "Tests\\": "tests/" 33 | } 34 | }, 35 | "scripts": { 36 | "post-autoload-dump": [ 37 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 38 | "@php artisan package:discover --ansi" 39 | ], 40 | "post-update-cmd": [ 41 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 42 | ], 43 | "post-root-package-install": [ 44 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 45 | ], 46 | "post-create-project-cmd": [ 47 | "@php artisan key:generate --ansi" 48 | ] 49 | }, 50 | "extra": { 51 | "laravel": { 52 | "dont-discover": [] 53 | } 54 | }, 55 | "config": { 56 | "optimize-autoloader": true, 57 | "preferred-install": "dist", 58 | "sort-packages": true, 59 | "allow-plugins": { 60 | "pestphp/pest-plugin": true, 61 | "php-http/discovery": true 62 | } 63 | }, 64 | "minimum-stability": "stable", 65 | "prefer-stable": true 66 | } 67 | -------------------------------------------------------------------------------- /Python/password_generator.py: -------------------------------------------------------------------------------- 1 | import random 2 | import string 3 | 4 | def get_user_choices(): 5 | # Get user input for password length 6 | length = int(input("Enter the desired password length: ")) 7 | 8 | # Prompt the user for character set preferences 9 | include_lowercase = input("Include lowercase letters? (y/n): ").strip().lower() == 'y' 10 | include_uppercase = input("Include uppercase letters? (y/n): ").strip().lower() == 'y' 11 | include_numbers = input("Include numbers? (y/n): ").strip().lower() == 'y' 12 | include_special_chars = input("Include special characters? (y/n): ").strip().lower() == 'y' 13 | 14 | return length, include_lowercase, include_uppercase, include_numbers, include_special_chars 15 | 16 | def build_character_set(include_lowercase, include_uppercase, include_numbers, include_special_chars): 17 | # Define character sets based on user input 18 | character_set = '' 19 | if include_lowercase: 20 | character_set += string.ascii_lowercase 21 | if include_uppercase: 22 | character_set += string.ascii_uppercase 23 | if include_numbers: 24 | character_set += string.digits 25 | if include_special_chars: 26 | character_set += string.punctuation 27 | 28 | return character_set 29 | 30 | def generate_password(length, character_set): 31 | # Ensure the character set is not empty 32 | if not character_set: 33 | raise ValueError("At least one character type must be selected") 34 | 35 | # Generate password 36 | password = ''.join(random.choice(character_set) for _ in range(length)) 37 | return password 38 | 39 | def main(): 40 | try: 41 | length, include_lowercase, include_uppercase, include_numbers, include_special_chars = get_user_choices() 42 | character_set = build_character_set(include_lowercase, include_uppercase, include_numbers, include_special_chars) 43 | password = generate_password(length, character_set) 44 | print(f"This You Generated Password: {password}") 45 | except ValueError as ve: 46 | print(f"Error: {ve}") 47 | except Exception as e: 48 | print(f"An unexpected error occurred: {e}") 49 | 50 | if __name__ == "__main__": 51 | main() 52 | -------------------------------------------------------------------------------- /Python/Number-Guessing-Game.md: -------------------------------------------------------------------------------- 1 | # Number Guessing Game in Python 2 | 3 | Welcome to the Number Guessing Game project for Python! 🐍 4 | 5 | In this project, we'll create a simple number guessing game where the computer randomly selects a number, and the player tries to guess it. Let's get started! 6 | 7 | ## Project Overview 8 | 9 | ### Objective 10 | 11 | Create a Python script that implements a number guessing game. 12 | 13 | ### Features 14 | 15 | - The computer generates a random number. 16 | - The player tries to guess the number. 17 | - Provide feedback on whether the guess is too high, too low, or correct. 18 | - Track the number of attempts. 19 | 20 | ## Project Structure 21 | 22 | Create a new Python script named `number_guessing_game.py`. 23 | 24 | ## Instructions 25 | 26 | 1. **Generate a Random Number:** 27 | - Use the `random` module to generate a random number between a predefined range. 28 | 29 | 2. **Get Player Input:** 30 | - Prompt the player to enter a guess. 31 | 32 | 3. **Compare and Provide Feedback:** 33 | - Compare the player's guess with the randomly generated number. 34 | - If the guess is correct, print a congratulatory message. 35 | - If the guess is too high or too low, provide feedback. 36 | 37 | 4. **Track Attempts:** 38 | - Keep track of the number of attempts made by the player. 39 | 40 | 5. **Play Again (Optional):** 41 | - After the game ends, ask the player if they want to play again. 42 | 43 | ## Example Code 44 | 45 | ```python 46 | import random 47 | 48 | def number_guessing_game(): 49 | # Generate a random number between 1 and 100 50 | target_number = random.randint(1, 100) 51 | 52 | attempts = 0 53 | 54 | while True: 55 | # Get player input 56 | guess = int(input("Enter your guess: ")) 57 | 58 | # Increment attempts 59 | attempts += 1 60 | 61 | # Compare and provide feedback 62 | if guess == target_number: 63 | print(f"Congratulations! You guessed the correct number in {attempts} attempts.") 64 | break 65 | elif guess < target_number: 66 | print("Too low! Try again.") 67 | else: 68 | print("Too high! Try again.") 69 | 70 | # Run the game 71 | number_guessing_game() 72 | ``` 73 | 74 | Feel free to enhance the game, add features, or modify the structure as you see fit. Contributors can use this document as a guide to implementing the number guessing game in Python. 75 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 41 | 'port' => env('PUSHER_PORT', 443), 42 | 'scheme' => env('PUSHER_SCHEME', 'https'), 43 | 'encrypted' => true, 44 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 45 | ], 46 | 'client_options' => [ 47 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 48 | ], 49 | ], 50 | 51 | 'ably' => [ 52 | 'driver' => 'ably', 53 | 'key' => env('ABLY_KEY'), 54 | ], 55 | 56 | 'redis' => [ 57 | 'driver' => 'redis', 58 | 'connection' => 'default', 59 | ], 60 | 61 | 'log' => [ 62 | 'driver' => 'log', 63 | ], 64 | 65 | 'null' => [ 66 | 'driver' => 'null', 67 | ], 68 | 69 | ], 70 | 71 | ]; 72 | -------------------------------------------------------------------------------- /Python/Rock-Paper-Scissors.md: -------------------------------------------------------------------------------- 1 | # Rock, Paper, Scissors Game in Python 2 | 3 | Welcome to the Rock, Paper, Scissors Game project for Python! ✊🏻✋🏻✌🏻 4 | 5 | In this project, we'll create a simple rock-paper-scissors game using Python. This classic game is great for practicing conditional statements and user input handling. Let's get started! 6 | 7 | ## Project Overview 8 | 9 | ### Objective 10 | 11 | Create a Python script that allows a user to play the rock-paper-scissors game against the computer. 12 | 13 | ### Features 14 | 15 | - Accept user input for their choice (rock, paper, or scissors). 16 | - Generate a random choice for the computer. 17 | - Determine the winner based on the game rules. 18 | 19 | ## Project Structure 20 | 21 | Create a new Python script named `rock_paper_scissors.py`. 22 | 23 | ## Instructions 24 | 25 | 1. **User Input:** 26 | - Prompt the user to enter their choice (rock, paper, or scissors). 27 | 28 | 2. **Computer's Choice:** 29 | - Generate a random choice for the computer (rock, paper, or scissors). 30 | 31 | 3. **Game Logic:** 32 | - Implement the game logic to determine the winner. 33 | - Rock beats scissors, scissors beats paper, and paper beats rock. 34 | 35 | 4. **Display Result:** 36 | - Print the user's choice, the computer's choice, and the result of the game. 37 | 38 | 5. **Run the Script:** 39 | - Execute the script and play the game against the computer. 40 | 41 | ## Example Code 42 | 43 | ```python 44 | import random 45 | 46 | def rock_paper_scissors(user_choice): 47 | choices = ['rock', 'paper', 'scissors'] 48 | computer_choice = random.choice(choices) 49 | 50 | print(f"Your choice: {user_choice}") 51 | print(f"Computer's choice: {computer_choice}") 52 | 53 | if user_choice == computer_choice: 54 | print("It's a tie!") 55 | elif ( 56 | (user_choice == 'rock' and computer_choice == 'scissors') or 57 | (user_choice == 'scissors' and computer_choice == 'paper') or 58 | (user_choice == 'paper' and computer_choice == 'rock') 59 | ): 60 | print("You win!") 61 | else: 62 | print("You lose!") 63 | 64 | # Get user input for their choice 65 | user_input = input("Enter your choice (rock, paper, or scissors): ").lower() 66 | 67 | # Run the rock-paper-scissors game 68 | rock_paper_scissors(user_input) 69 | ``` 70 | 71 | Feel free to customize the rock-paper-scissors game, add features, or modify the structure as you see fit. Contributors can use this document as a guide to implementing the rock-paper-scissors game in Python. 72 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /Javascript/ReactJS/Calculator.md: -------------------------------------------------------------------------------- 1 | # Calculator App in ReactJS 2 | 3 | Welcome to the Calculator App project for ReactJS! ⚛️ 4 | 5 | In this project, we'll create a simple calculator web application using ReactJS. Let's get started! 6 | 7 | ## Project Overview 8 | 9 | ### Objective 10 | 11 | Create a ReactJS application that functions as a calculator. 12 | 13 | ### Features 14 | 15 | - Display a calculator interface with numeric buttons and basic operations. 16 | - Perform addition, subtraction, multiplication, and division operations. 17 | - Display the result dynamically on the calculator screen. 18 | 19 | ## Project Structure 20 | 21 | Create a new ReactJS project using your preferred setup (e.g., Create React App) and organize the components accordingly. 22 | 23 | ## Instructions 24 | 25 | 1. **Set Up React App:** 26 | - Create a new ReactJS app using a tool like Create React App. 27 | - Set up the project structure and create necessary components. 28 | 29 | 2. **Calculator Interface:** 30 | - Design a calculator interface with numeric buttons (0-9) and basic operation buttons (+, -, *, /). 31 | 32 | 3. **State Management:** 33 | - Manage the state of the calculator to keep track of the input and display the result. 34 | 35 | 4. **Implement Operations:** 36 | - Implement functions to perform addition, subtraction, multiplication, and division based on user input. 37 | 38 | 5. **Display Result:** 39 | - Dynamically display the input and result on the calculator screen. 40 | 41 | 6. **Run the App:** 42 | - Start the development server and open the app in a web browser. 43 | 44 | ## Example Code 45 | 46 | ### Calculator Component (Calculator.js) 47 | 48 | ```jsx 49 | import React, { useState } from 'react'; 50 | 51 | const Calculator = () => { 52 | const [input, setInput] = useState(''); 53 | const [result, setResult] = useState(''); 54 | 55 | const handleButtonClick = (value) => { 56 | setInput((prevInput) => prevInput + value); 57 | }; 58 | 59 | const handleClear = () => { 60 | setInput(''); 61 | setResult(''); 62 | }; 63 | 64 | const handleCalculate = () => { 65 | try { 66 | setResult(eval(input).toString()); 67 | } catch (error) { 68 | setResult('Error'); 69 | } 70 | }; 71 | 72 | return ( 73 |
74 |
75 | 76 |
77 |
78 | 79 | {/* Include buttons for 0-9 and other operations */} 80 | 81 | 82 |
83 |
84 | ); 85 | }; 86 | 87 | export default Calculator; 88 | ``` 89 | 90 | Remember to customize the calculator app, add features, or modify the structure as you see fit. Contributors can use this document as a guide to implementing the calculator app in ReactJS. 91 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 43 | \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', 44 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 45 | ], 46 | ]; 47 | 48 | /** 49 | * The application's middleware aliases. 50 | * 51 | * Aliases may be used instead of class names to conveniently assign middleware to routes and groups. 52 | * 53 | * @var array 54 | */ 55 | protected $middlewareAliases = [ 56 | 'auth' => \App\Http\Middleware\Authenticate::class, 57 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 58 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 59 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 60 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 61 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 62 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 63 | 'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, 64 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 65 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 66 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 67 | ]; 68 | } 69 | -------------------------------------------------------------------------------- /Python/encrypt.md: -------------------------------------------------------------------------------- 1 | # encrypt files & data with python 2 | in this project we gonna make a simple encrypt file with python 3 | 4 | ## project overview 5 | 6 | ### install depencies 7 | 8 | pip3 install cryptography 9 | 10 | ### start write a code 11 | 12 | from cryptography.fernet import Fernet 13 | 14 | def write_key(): 15 | """ 16 | Generates a key and save it into a file 17 | """ 18 | key = Fernet.generate_key() 19 | with open("key.key", "wb") as key_file: 20 | key_file.write(key) 21 | 22 | def load_key(): 23 | """ 24 | Loads the key from the current directory named `key.key` 25 | """ 26 | return open("key.key", "rb").read() 27 | 28 | def encrypt(filename, key): 29 | """ 30 | Given a filename (str) and key (bytes), it encrypts the file and write it 31 | """ 32 | f = Fernet(key) 33 | with open(filename, "rb") as file: 34 | # read all file data 35 | file_data = file.read() 36 | # encrypt data 37 | encrypted_data = f.encrypt(file_data) 38 | # write the encrypted file 39 | with open(filename, "wb") as file: 40 | file.write(encrypted_data) 41 | 42 | def decrypt(filename, key): 43 | """ 44 | Given a filename (str) and key (bytes), it decrypts the file and write it 45 | """ 46 | f = Fernet(key) 47 | with open(filename, "rb") as file: 48 | # read the encrypted data 49 | encrypted_data = file.read() 50 | # decrypt data 51 | decrypted_data = f.decrypt(encrypted_data) 52 | # write the original file 53 | with open(filename, "wb") as file: 54 | file.write(decrypted_data) 55 | 56 | 57 | if __name__ == "__main__": 58 | import argparse 59 | parser = argparse.ArgumentParser(description="Simple File Encryptor Script") 60 | parser.add_argument("file", help="File to encrypt/decrypt") 61 | parser.add_argument("-g", "--generate-key", dest="generate_key", action="store_true", 62 | help="Whether to generate a new key or use existing") 63 | parser.add_argument("-e", "--encrypt", action="store_true", 64 | help="Whether to encrypt the file, only -e or -d can be specified.") 65 | parser.add_argument("-d", "--decrypt", action="store_true", 66 | help="Whether to decrypt the file, only -e or -d can be specified.") 67 | 68 | args = parser.parse_args() 69 | file = args.file 70 | generate_key = args.generate_key 71 | 72 | if generate_key: 73 | write_key() 74 | # load the key 75 | key = load_key() 76 | 77 | encrypt_ = args.encrypt 78 | decrypt_ = args.decrypt 79 | 80 | if encrypt_ and decrypt_: 81 | raise TypeError("Please specify whether you want to encrypt the file or decrypt it.") 82 | elif encrypt_: 83 | encrypt(file, key) 84 | elif decrypt_: 85 | decrypt(file, key) 86 | else: 87 | raise TypeError("Please specify whether you want to encrypt the file or decrypt it.") 88 | 89 | ### how to test our code 90 | $ python crypt_password.py data.csv --encrypt --salt-size 16 91 | -------------------------------------------------------------------------------- /Python/subsequence-algorithm.md: -------------------------------------------------------------------------------- 1 | 2 | # Subsequence algorithm 3 | 4 | Here is a detailed explanation of the algorithms for subsequences: 5 | 6 | A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. The problem of finding the longest common subsequence (LCS) between two sequences is a classic problem in computer science and dynamic programming. 7 | 8 | Longest Common Subsequence (LCS) Algorithm: 9 | The LCS algorithm finds the longest subsequence that is present in given sequences (arrays, strings, etc.). 10 | It uses dynamic programming to build a matrix where each cell `c[i][j]` represents the length of the longest common subsequence between the first i elements of one sequence and the first j elements of another. 11 | The algorithm iterates through the sequences and fills the matrix based on whether the elements at positions i and j are equal or not. 12 | By comparing the lengths of subsequences that include or exclude elements at positions i and j, it efficiently calculates the length of the longest common subsequence. 13 | The LCS algorithm has a time complexity of O(m*n) where m and n are the lengths of the input sequences. 14 | In the code I have provided, I have implemented a version of the longest common subsequence (LCS) algorithm in Python to find the LCS length between two sequences a and b. 15 | 16 | ``` 17 | def longest_common_subsequence(a, b): 18 | m = len(a) # Length of sequence a 19 | n = len(b) # Length of sequence b 20 | c = [[0] * (n + 1) for _ in range(m + 1)] # Create a matrix to store the lengths of longest common subsequences 21 | 22 | for i in range(1, m + 1): 23 | for j in range(1, n + 1): 24 | if a[i-1] == b[j-1]: # If the elements at positions i and j in sequences a and b are equal 25 | c[i][j] = c[i-1][j-1] + 1 # Increment the length of the common subsequence by 1 26 | else: 27 | c[i][j] = max(c[i-1][j], c[i][j-1]) # Take the maximum of the lengths of two sequences without the current elements 28 | 29 | return c # Return the matrix containing the lengths of longest common subsequences 30 | 31 | a = [1, 2, 3, 4, 5] 32 | b = [5, 4, 6, 8, 10] 33 | 34 | result = longest_common_subsequence(a, b) # Calculate the longest common subsequence between a and b 35 | for row in result: 36 | print(a) # Print sequence a 37 | print(row) # Print each row of the matrix containing the lengths of longest common subsequences 38 | ``` 39 | 40 | This code defines a function longest_common_subsequence that calculates the lengths of the longest common subsequences between two sequences a and b. It uses dynamic programming to fill a matrix c where `c[i][j]` stores the length of the longest common subsequence between the first i elements of a and the first j elements of b. 41 | 42 | After defining the function, it calculates the longest common subsequence between a = [1, 2, 3, 4, 5] and b = [5, 4, 6, 8, 10], and then prints each row of the matrix c which represents the lengths of the longest common subsequences. 43 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We, as contributors and maintainers, pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | - Being respectful of differing viewpoints and experiences 12 | - Giving and gracefully accepting constructive feedback 13 | - Focusing on what is best for the community 14 | - Showing empathy towards other community members 15 | 16 | Examples of unacceptable behavior by participants include: 17 | 18 | - The use of sexualized language or imagery and unwelcome sexual attention or advances 19 | - Trolling, insulting/derogatory comments, and personal or political attacks 20 | - Public or private harassment 21 | - Publishing others' private information, such as a physical or email address, without explicit permission 22 | - Other conduct that could reasonably be considered inappropriate in a professional setting 23 | 24 | ## Responsibilities of Contributors 25 | 26 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 27 | 28 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 29 | 30 | ## Scope 31 | 32 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 33 | 34 | ## Enforcement 35 | 36 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at chreachanchhunneng@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 37 | 38 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 39 | 40 | ## Attribution 41 | 42 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 43 | 44 | For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq 45 | 46 | -------------------------------------------------------------------------------- /Javascript/ReactJS/Weather App in ReactJS.md: -------------------------------------------------------------------------------- 1 | # 🌤️ Weather App in ReactJS 2 | 3 | Create a simple weather forecast app using React and a weather API like [OpenWeatherMap](https://openweathermap.org/api). This is a great project to practice working with APIs, handling async requests, and managing form input. 4 | 5 | --- 6 | 7 | ## 🎯 Objective 8 | 9 | Build a ReactJS application where users can enter a city and get current weather details like temperature, condition, and humidity. 10 | 11 | --- 12 | 13 | ## 🔧 Features 14 | 15 | * Input a city name to fetch weather info 16 | * Display temperature, weather condition, humidity, and wind speed 17 | * Error message for invalid city names 18 | * Optional: background changes based on weather condition 19 | 20 | --- 21 | 22 | ## 🧱 Project Structure 23 | 24 | ``` 25 | react-weather-app/ 26 | │ 27 | ├── src/ 28 | │ ├── components/ 29 | │ │ └── WeatherCard.js 30 | │ ├── App.js 31 | │ └── index.css 32 | │ 33 | └── public/ 34 | ``` 35 | 36 | --- 37 | 38 | ## 🛠️ Steps to Build 39 | 40 | ### 1. Set Up React App 41 | 42 | ```bash 43 | npx create-react-app react-weather-app 44 | cd react-weather-app 45 | npm start 46 | ``` 47 | 48 | ### 2. Get API Key 49 | 50 | Sign up at [OpenWeatherMap](https://openweathermap.org/) and get your API key. 51 | 52 | --- 53 | 54 | ### 3. Implement Core Logic 55 | 56 | #### Basic `App.js` Sample 57 | 58 | ```jsx 59 | import React, { useState } from 'react'; 60 | 61 | const App = () => { 62 | const [city, setCity] = useState(''); 63 | const [weather, setWeather] = useState(null); 64 | 65 | const fetchWeather = async () => { 66 | try { 67 | const res = await fetch( 68 | `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=YOUR_API_KEY&units=metric` 69 | ); 70 | const data = await res.json(); 71 | if (data.cod === 200) { 72 | setWeather(data); 73 | } else { 74 | setWeather(null); 75 | alert('City not found'); 76 | } 77 | } catch (err) { 78 | console.error(err); 79 | } 80 | }; 81 | 82 | return ( 83 |
84 |

Weather App

85 | setCity(e.target.value)} 90 | /> 91 | 92 | 93 | {weather && ( 94 |
95 |

{weather.name}

96 |

{weather.main.temp} °C

97 |

{weather.weather[0].description}

98 |

Humidity: {weather.main.humidity}%

99 |
100 | )} 101 |
102 | ); 103 | }; 104 | 105 | export default App; 106 | ``` 107 | 108 | --- 109 | 110 | ## 🎨 Bonus Ideas 111 | 112 | * Show weather icons using OpenWeatherMap's icon set 113 | * Animate loading state 114 | * Convert units (°C ⇄ °F) 115 | * Save search history 116 | 117 | --- 118 | 119 | ## 📦 Useful Tools 120 | 121 | * [OpenWeatherMap API Docs](https://openweathermap.org/current) 122 | * Axios (alternative to `fetch`) 123 | * Tailwind CSS for styling 124 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. This will override any values set in the token's 45 | | "expires_at" attribute, but first-party sessions are not affected. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Token Prefix 54 | |-------------------------------------------------------------------------- 55 | | 56 | | Sanctum can prefix new tokens in order to take advantage of numerous 57 | | security scanning initiatives maintained by open source platforms 58 | | that notify developers if they commit tokens into repositories. 59 | | 60 | | See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning 61 | | 62 | */ 63 | 64 | 'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''), 65 | 66 | /* 67 | |-------------------------------------------------------------------------- 68 | | Sanctum Middleware 69 | |-------------------------------------------------------------------------- 70 | | 71 | | When authenticating your first-party SPA with Sanctum you may need to 72 | | customize some of the middleware Sanctum uses while processing the 73 | | request. You may change the middleware listed below as required. 74 | | 75 | */ 76 | 77 | 'middleware' => [ 78 | 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class, 79 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 80 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 81 | ], 82 | 83 | ]; 84 | -------------------------------------------------------------------------------- /Javascript/ReactJS/Calculator-test.md: -------------------------------------------------------------------------------- 1 | # React Calculator 2 | 3 | A simple calculator built with React that allows users to perform basic arithmetic operations such as addition, subtraction, multiplication, and division. The calculator has an intuitive user interface, making it easy to use for anyone. 4 | 5 | ## Features 6 | 7 | - **Basic Operations**: Supports addition, subtraction, multiplication, and division. 8 | - **Clear Functionality**: Reset the input and result with a clear button. 9 | - **Error Handling**: Displays an error message for invalid expressions. 10 | - **Responsive Design**: Adapts to different screen sizes with a simple layout. 11 | - **Read-only Input Field**: The input field is read-only to prevent manual editing while performing calculations. 12 | 13 | 14 | 15 | 16 | ## Main Code 17 | 18 | ### Calculator Component (App.jsx) 19 | 20 | ```jsx 21 | import { useEffect, useState } from "react"; 22 | 23 | function App() { 24 | const [input, setInput] = useState(""); 25 | const buttons = ["C", 0, "=", "/", 1, 2, 3, "*", 4, 5, 6, "-", 7, 8, 9, "+"]; 26 | const [result, setResult] = useState(""); 27 | 28 | const handleClick = (value) => { 29 | setInput((prev) => prev + value); 30 | }; 31 | 32 | const handleClear = () => { 33 | setInput(""); 34 | setResult(""); 35 | }; 36 | 37 | const handleChange = (e) => { 38 | setInput(e.target.value); 39 | }; 40 | 41 | const handleEvaluate = () => { 42 | if ( 43 | input === "" || 44 | /[+\-*/]$/.test(input.charAt(input.length - 1)) || 45 | input.length <= 2 46 | ) { 47 | console.log(input.length); 48 | setResult("Error"); 49 | } else { 50 | let out = eval(input); 51 | setResult(out); 52 | setInput(""); 53 | } 54 | }; 55 | 56 | return ( 57 |
64 |

React Calculator

65 | 72 |
{result}
73 | 74 |
86 | {buttons.map((button) => ( 87 | 96 |
97 | 98 | 99 | 100 | 101 | ``` 102 | 103 | ### JavaScript (`random_joke_generator.js`) 104 | ```js 105 | async function getRandomJoke() { 106 | const response = await fetch('https://official-joke-api.appspot.com/random_joke'); 107 | const data = await response.json(); 108 | 109 | document.getElementById('joke-setup').innerText = data.setup; 110 | document.getElementById('joke-punchline').innerText = data.punchline; 111 | } 112 | 113 | getRandomJoke(); 114 | ``` 115 | ### Enjoy the Laughter! 116 | We hope you enjoy the random jokes and have a great time using the Random Joke Generator! Feel free to contribute or share your own favorite jokes! 117 | 118 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | 'lock_path' => storage_path('framework/cache/data'), 56 | ], 57 | 58 | 'memcached' => [ 59 | 'driver' => 'memcached', 60 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 61 | 'sasl' => [ 62 | env('MEMCACHED_USERNAME'), 63 | env('MEMCACHED_PASSWORD'), 64 | ], 65 | 'options' => [ 66 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 67 | ], 68 | 'servers' => [ 69 | [ 70 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 71 | 'port' => env('MEMCACHED_PORT', 11211), 72 | 'weight' => 100, 73 | ], 74 | ], 75 | ], 76 | 77 | 'redis' => [ 78 | 'driver' => 'redis', 79 | 'connection' => 'cache', 80 | 'lock_connection' => 'default', 81 | ], 82 | 83 | 'dynamodb' => [ 84 | 'driver' => 'dynamodb', 85 | 'key' => env('AWS_ACCESS_KEY_ID'), 86 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 87 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 88 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 89 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 90 | ], 91 | 92 | 'octane' => [ 93 | 'driver' => 'octane', 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Cache Key Prefix 101 | |-------------------------------------------------------------------------- 102 | | 103 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache 104 | | stores there might be other applications using the same cache. For 105 | | that reason, you may prefix every cache key to avoid collisions. 106 | | 107 | */ 108 | 109 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 110 | 111 | ]; 112 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Job Batching 79 | |-------------------------------------------------------------------------- 80 | | 81 | | The following options configure the database and table that store job 82 | | batching information. These options can be updated to any database 83 | | connection and table which has been defined by your application. 84 | | 85 | */ 86 | 87 | 'batching' => [ 88 | 'database' => env('DB_CONNECTION', 'mysql'), 89 | 'table' => 'job_batches', 90 | ], 91 | 92 | /* 93 | |-------------------------------------------------------------------------- 94 | | Failed Queue Jobs 95 | |-------------------------------------------------------------------------- 96 | | 97 | | These options configure the behavior of failed queue job logging so you 98 | | can control which database and table are used to store the jobs that 99 | | have failed. You may change them to any database / table you wish. 100 | | 101 | */ 102 | 103 | 'failed' => [ 104 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 105 | 'database' => env('DB_CONNECTION', 'mysql'), 106 | 'table' => 'failed_jobs', 107 | ], 108 | 109 | ]; 110 | -------------------------------------------------------------------------------- /Javascript/ReactJS/ToDoApp.md: -------------------------------------------------------------------------------- 1 | # Todo App in ReactJS 2 | 3 | Welcome to the Todo App project for ReactJS! ⚛️ 4 | 5 | In this project, we'll create a todo list web application using ReactJS. Let's get started! 6 | 7 | ## Project Overview 8 | 9 | ### Objective 10 | 11 | Create a ReactJS application that functions as a todo list. 12 | 13 | ### Features 14 | 15 | - Add new todo items. 16 | - Mark items as completed. 17 | - Delete todo items. 18 | - Filter items by all, active, and completed. 19 | 20 | ## Project Structure 21 | 22 | Create a new ReactJS project using your preferred setup (e.g., Create React App) and organize the components accordingly. 23 | 24 | ## Instructions 25 | 26 | 1. **Set Up React App:** 27 | - Create a new ReactJS app using a tool like Create React App. 28 | - Set up the project structure and create necessary components. 29 | 30 | 2. **Todo Interface:** 31 | - Design an interface with an input field for adding new todo items and a list to display the todos. 32 | 33 | 3. **State Management:** 34 | - Manage the state of the todos to keep track of the list of items, their completion status, and current filter. 35 | 36 | 4. **Add Todo Item:** 37 | - Implement functionality to add new items to the todo list. 38 | 39 | 5. **Mark as Completed:** 40 | - Implement functionality to mark items as completed. 41 | 42 | 6. **Delete Todo Item:** 43 | - Implement functionality to delete items from the todo list. 44 | 45 | 7. **Filter Items:** 46 | - Implement functionality to filter items by all, active, and completed. 47 | 48 | 8. **Run the App:** 49 | - Start the development server and open the app in a web browser. 50 | 51 | ## Example Code 52 | 53 | ### Calculator Component (Calculator.js) 54 | 55 | ```jsx 56 | import React, { useState } from 'react'; 57 | 58 | const TodoApp = () => { 59 | const [todos, setTodos] = useState([]); 60 | const [newTodo, setNewTodo] = useState(''); 61 | const [filter, setFilter] = useState('all'); 62 | 63 | const handleAddTodo = () => { 64 | if (newTodo.trim() !== '') { 65 | setTodos([...todos, { text: newTodo, completed: false }]); 66 | setNewTodo(''); 67 | } 68 | }; 69 | 70 | const handleToggleComplete = (index) => { 71 | const updatedTodos = todos.map((todo, i) => 72 | i === index ? { ...todo, completed: !todo.completed } : todo 73 | ); 74 | setTodos(updatedTodos); 75 | }; 76 | 77 | const handleDeleteTodo = (index) => { 78 | const updatedTodos = todos.filter((_, i) => i !== index); 79 | setTodos(updatedTodos); 80 | }; 81 | 82 | const handleFilterChange = (newFilter) => { 83 | setFilter(newFilter); 84 | }; 85 | 86 | const filteredTodos = todos.filter((todo) => { 87 | if (filter === 'all') return true; 88 | if (filter === 'active') return !todo.completed; 89 | if (filter === 'completed') return todo.completed; 90 | return true; 91 | }); 92 | 93 | return ( 94 |
95 |

Todo App

96 | setNewTodo(e.target.value)} 100 | placeholder="Add a new todo" 101 | /> 102 | 103 |
104 | 105 | 106 | 107 |
108 |
    109 | {filteredTodos.map((todo, index) => ( 110 |
  • 111 | handleToggleComplete(index)} 114 | > 115 | {todo.text} 116 | 117 | 118 |
  • 119 | ))} 120 |
121 |
122 | ); 123 | }; 124 | 125 | export default TodoApp; 126 | ``` 127 | 128 | Remember to customize the todo app, add features, or modify the structure as you see fit. Contributors can use this document as a guide to implementing the todo app in ReactJS. -------------------------------------------------------------------------------- /Laravel/my-first-badges/README.md: -------------------------------------------------------------------------------- 1 |

Laravel Logo

2 | 3 |

4 | Build Status 5 | Total Downloads 6 | Latest Stable Version 7 | License 8 |

9 | 10 | ## About Laravel 11 | 12 | Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: 13 | 14 | - [Simple, fast routing engine](https://laravel.com/docs/routing). 15 | - [Powerful dependency injection container](https://laravel.com/docs/container). 16 | - Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. 17 | - Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). 18 | - Database agnostic [schema migrations](https://laravel.com/docs/migrations). 19 | - [Robust background job processing](https://laravel.com/docs/queues). 20 | - [Real-time event broadcasting](https://laravel.com/docs/broadcasting). 21 | 22 | Laravel is accessible, powerful, and provides tools required for large, robust applications. 23 | 24 | ## Learning Laravel 25 | 26 | Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. 27 | 28 | You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch. 29 | 30 | If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. 31 | 32 | ## Laravel Sponsors 33 | 34 | We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com). 35 | 36 | ### Premium Partners 37 | 38 | - **[Vehikl](https://vehikl.com/)** 39 | - **[Tighten Co.](https://tighten.co)** 40 | - **[WebReinvent](https://webreinvent.com/)** 41 | - **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** 42 | - **[64 Robots](https://64robots.com)** 43 | - **[Curotec](https://www.curotec.com/services/technologies/laravel/)** 44 | - **[Cyber-Duck](https://cyber-duck.co.uk)** 45 | - **[DevSquad](https://devsquad.com/hire-laravel-developers)** 46 | - **[Jump24](https://jump24.co.uk)** 47 | - **[Redberry](https://redberry.international/laravel/)** 48 | - **[Active Logic](https://activelogic.com)** 49 | - **[byte5](https://byte5.de)** 50 | - **[OP.GG](https://op.gg)** 51 | 52 | ## Contributing 53 | 54 | Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). 55 | 56 | ## Code of Conduct 57 | 58 | In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). 59 | 60 | ## Security Vulnerabilities 61 | 62 | If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. 63 | 64 | ## License 65 | 66 | The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). 67 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | ], 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | User Providers 48 | |-------------------------------------------------------------------------- 49 | | 50 | | All authentication drivers have a user provider. This defines how the 51 | | users are actually retrieved out of your database or other storage 52 | | mechanisms used by this application to persist your user's data. 53 | | 54 | | If you have multiple user tables or models you may configure multiple 55 | | sources which represent each model / table. These sources may then 56 | | be assigned to any extra authentication guards you have defined. 57 | | 58 | | Supported: "database", "eloquent" 59 | | 60 | */ 61 | 62 | 'providers' => [ 63 | 'users' => [ 64 | 'driver' => 'eloquent', 65 | 'model' => App\Models\User::class, 66 | ], 67 | 68 | // 'users' => [ 69 | // 'driver' => 'database', 70 | // 'table' => 'users', 71 | // ], 72 | ], 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Resetting Passwords 77 | |-------------------------------------------------------------------------- 78 | | 79 | | You may specify multiple password reset configurations if you have more 80 | | than one user table or model in the application and you want to have 81 | | separate password reset settings based on the specific user types. 82 | | 83 | | The expiry time is the number of minutes that each reset token will be 84 | | considered valid. This security feature keeps tokens short-lived so 85 | | they have less time to be guessed. You may change this as needed. 86 | | 87 | | The throttle setting is the number of seconds a user must wait before 88 | | generating more password reset tokens. This prevents the user from 89 | | quickly generating a very large amount of password reset tokens. 90 | | 91 | */ 92 | 93 | 'passwords' => [ 94 | 'users' => [ 95 | 'provider' => 'users', 96 | 'table' => 'password_reset_tokens', 97 | 'expire' => 60, 98 | 'throttle' => 60, 99 | ], 100 | ], 101 | 102 | /* 103 | |-------------------------------------------------------------------------- 104 | | Password Confirmation Timeout 105 | |-------------------------------------------------------------------------- 106 | | 107 | | Here you may define the amount of seconds before a password confirmation 108 | | times out and the user is prompted to re-enter their password via the 109 | | confirmation screen. By default, the timeout lasts for three hours. 110 | | 111 | */ 112 | 113 | 'password_timeout' => 10800, 114 | 115 | ]; 116 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", 32 | | "postmark", "log", "array", "failover", "roundrobin" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'url' => env('MAIL_URL'), 40 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 41 | 'port' => env('MAIL_PORT', 587), 42 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 43 | 'username' => env('MAIL_USERNAME'), 44 | 'password' => env('MAIL_PASSWORD'), 45 | 'timeout' => null, 46 | 'local_domain' => env('MAIL_EHLO_DOMAIN'), 47 | ], 48 | 49 | 'ses' => [ 50 | 'transport' => 'ses', 51 | ], 52 | 53 | 'postmark' => [ 54 | 'transport' => 'postmark', 55 | // 'message_stream_id' => null, 56 | // 'client' => [ 57 | // 'timeout' => 5, 58 | // ], 59 | ], 60 | 61 | 'mailgun' => [ 62 | 'transport' => 'mailgun', 63 | // 'client' => [ 64 | // 'timeout' => 5, 65 | // ], 66 | ], 67 | 68 | 'sendmail' => [ 69 | 'transport' => 'sendmail', 70 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), 71 | ], 72 | 73 | 'log' => [ 74 | 'transport' => 'log', 75 | 'channel' => env('MAIL_LOG_CHANNEL'), 76 | ], 77 | 78 | 'array' => [ 79 | 'transport' => 'array', 80 | ], 81 | 82 | 'failover' => [ 83 | 'transport' => 'failover', 84 | 'mailers' => [ 85 | 'smtp', 86 | 'log', 87 | ], 88 | ], 89 | 90 | 'roundrobin' => [ 91 | 'transport' => 'roundrobin', 92 | 'mailers' => [ 93 | 'ses', 94 | 'postmark', 95 | ], 96 | ], 97 | ], 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Global "From" Address 102 | |-------------------------------------------------------------------------- 103 | | 104 | | You may wish for all e-mails sent by your application to be sent from 105 | | the same address. Here, you may specify a name and address that is 106 | | used globally for all e-mails that are sent by your application. 107 | | 108 | */ 109 | 110 | 'from' => [ 111 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 112 | 'name' => env('MAIL_FROM_NAME', 'Example'), 113 | ], 114 | 115 | /* 116 | |-------------------------------------------------------------------------- 117 | | Markdown Mail Settings 118 | |-------------------------------------------------------------------------- 119 | | 120 | | If you are using Markdown based email rendering, you may configure your 121 | | theme and component paths here, allowing you to customize the design 122 | | of the emails. Or, you may simply stick with the Laravel defaults! 123 | | 124 | */ 125 | 126 | 'markdown' => [ 127 | 'theme' => 'default', 128 | 129 | 'paths' => [ 130 | resource_path('views/vendor/mail'), 131 | ], 132 | ], 133 | 134 | ]; 135 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Deprecations Log Channel 26 | |-------------------------------------------------------------------------- 27 | | 28 | | This option controls the log channel that should be used to log warnings 29 | | regarding deprecated PHP and library features. This allows you to get 30 | | your application ready for upcoming major versions of dependencies. 31 | | 32 | */ 33 | 34 | 'deprecations' => [ 35 | 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 36 | 'trace' => false, 37 | ], 38 | 39 | /* 40 | |-------------------------------------------------------------------------- 41 | | Log Channels 42 | |-------------------------------------------------------------------------- 43 | | 44 | | Here you may configure the log channels for your application. Out of 45 | | the box, Laravel uses the Monolog PHP logging library. This gives 46 | | you a variety of powerful log handlers / formatters to utilize. 47 | | 48 | | Available Drivers: "single", "daily", "slack", "syslog", 49 | | "errorlog", "monolog", 50 | | "custom", "stack" 51 | | 52 | */ 53 | 54 | 'channels' => [ 55 | 'stack' => [ 56 | 'driver' => 'stack', 57 | 'channels' => ['single'], 58 | 'ignore_exceptions' => false, 59 | ], 60 | 61 | 'single' => [ 62 | 'driver' => 'single', 63 | 'path' => storage_path('logs/laravel.log'), 64 | 'level' => env('LOG_LEVEL', 'debug'), 65 | 'replace_placeholders' => true, 66 | ], 67 | 68 | 'daily' => [ 69 | 'driver' => 'daily', 70 | 'path' => storage_path('logs/laravel.log'), 71 | 'level' => env('LOG_LEVEL', 'debug'), 72 | 'days' => 14, 73 | 'replace_placeholders' => true, 74 | ], 75 | 76 | 'slack' => [ 77 | 'driver' => 'slack', 78 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 79 | 'username' => 'Laravel Log', 80 | 'emoji' => ':boom:', 81 | 'level' => env('LOG_LEVEL', 'critical'), 82 | 'replace_placeholders' => true, 83 | ], 84 | 85 | 'papertrail' => [ 86 | 'driver' => 'monolog', 87 | 'level' => env('LOG_LEVEL', 'debug'), 88 | 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 89 | 'handler_with' => [ 90 | 'host' => env('PAPERTRAIL_URL'), 91 | 'port' => env('PAPERTRAIL_PORT'), 92 | 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), 93 | ], 94 | 'processors' => [PsrLogMessageProcessor::class], 95 | ], 96 | 97 | 'stderr' => [ 98 | 'driver' => 'monolog', 99 | 'level' => env('LOG_LEVEL', 'debug'), 100 | 'handler' => StreamHandler::class, 101 | 'formatter' => env('LOG_STDERR_FORMATTER'), 102 | 'with' => [ 103 | 'stream' => 'php://stderr', 104 | ], 105 | 'processors' => [PsrLogMessageProcessor::class], 106 | ], 107 | 108 | 'syslog' => [ 109 | 'driver' => 'syslog', 110 | 'level' => env('LOG_LEVEL', 'debug'), 111 | 'facility' => LOG_USER, 112 | 'replace_placeholders' => true, 113 | ], 114 | 115 | 'errorlog' => [ 116 | 'driver' => 'errorlog', 117 | 'level' => env('LOG_LEVEL', 'debug'), 118 | 'replace_placeholders' => true, 119 | ], 120 | 121 | 'null' => [ 122 | 'driver' => 'monolog', 123 | 'handler' => NullHandler::class, 124 | ], 125 | 126 | 'emergency' => [ 127 | 'path' => storage_path('logs/laravel.log'), 128 | ], 129 | ], 130 | 131 | ]; 132 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Database Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here are each of the database connections setup for your application. 26 | | Of course, examples of configuring each database platform that is 27 | | supported by Laravel is shown below to make development simple. 28 | | 29 | | 30 | | All database work in Laravel is done through the PHP PDO facilities 31 | | so make sure you have the driver for your particular database of 32 | | choice installed on your machine before you begin development. 33 | | 34 | */ 35 | 36 | 'connections' => [ 37 | 38 | 'sqlite' => [ 39 | 'driver' => 'sqlite', 40 | 'url' => env('DATABASE_URL'), 41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 42 | 'prefix' => '', 43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 44 | ], 45 | 46 | 'mysql' => [ 47 | 'driver' => 'mysql', 48 | 'url' => env('DATABASE_URL'), 49 | 'host' => env('DB_HOST', '127.0.0.1'), 50 | 'port' => env('DB_PORT', '3306'), 51 | 'database' => env('DB_DATABASE', 'forge'), 52 | 'username' => env('DB_USERNAME', 'forge'), 53 | 'password' => env('DB_PASSWORD', ''), 54 | 'unix_socket' => env('DB_SOCKET', ''), 55 | 'charset' => 'utf8mb4', 56 | 'collation' => 'utf8mb4_unicode_ci', 57 | 'prefix' => '', 58 | 'prefix_indexes' => true, 59 | 'strict' => true, 60 | 'engine' => null, 61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 63 | ]) : [], 64 | ], 65 | 66 | 'pgsql' => [ 67 | 'driver' => 'pgsql', 68 | 'url' => env('DATABASE_URL'), 69 | 'host' => env('DB_HOST', '127.0.0.1'), 70 | 'port' => env('DB_PORT', '5432'), 71 | 'database' => env('DB_DATABASE', 'forge'), 72 | 'username' => env('DB_USERNAME', 'forge'), 73 | 'password' => env('DB_PASSWORD', ''), 74 | 'charset' => 'utf8', 75 | 'prefix' => '', 76 | 'prefix_indexes' => true, 77 | 'search_path' => 'public', 78 | 'sslmode' => 'prefer', 79 | ], 80 | 81 | 'sqlsrv' => [ 82 | 'driver' => 'sqlsrv', 83 | 'url' => env('DATABASE_URL'), 84 | 'host' => env('DB_HOST', 'localhost'), 85 | 'port' => env('DB_PORT', '1433'), 86 | 'database' => env('DB_DATABASE', 'forge'), 87 | 'username' => env('DB_USERNAME', 'forge'), 88 | 'password' => env('DB_PASSWORD', ''), 89 | 'charset' => 'utf8', 90 | 'prefix' => '', 91 | 'prefix_indexes' => true, 92 | // 'encrypt' => env('DB_ENCRYPT', 'yes'), 93 | // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Migration Repository Table 101 | |-------------------------------------------------------------------------- 102 | | 103 | | This table keeps track of all the migrations that have already run for 104 | | your application. Using this information, we can determine which of 105 | | the migrations on disk haven't actually been run in the database. 106 | | 107 | */ 108 | 109 | 'migrations' => 'migrations', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Redis Databases 114 | |-------------------------------------------------------------------------- 115 | | 116 | | Redis is an open source, fast, and advanced key-value store that also 117 | | provides a richer body of commands than a typical key-value system 118 | | such as APC or Memcached. Laravel makes it easy to dig right in. 119 | | 120 | */ 121 | 122 | 'redis' => [ 123 | 124 | 'client' => env('REDIS_CLIENT', 'phpredis'), 125 | 126 | 'options' => [ 127 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 128 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 129 | ], 130 | 131 | 'default' => [ 132 | 'url' => env('REDIS_URL'), 133 | 'host' => env('REDIS_HOST', '127.0.0.1'), 134 | 'username' => env('REDIS_USERNAME'), 135 | 'password' => env('REDIS_PASSWORD'), 136 | 'port' => env('REDIS_PORT', '6379'), 137 | 'database' => env('REDIS_DB', '0'), 138 | ], 139 | 140 | 'cache' => [ 141 | 'url' => env('REDIS_URL'), 142 | 'host' => env('REDIS_HOST', '127.0.0.1'), 143 | 'username' => env('REDIS_USERNAME'), 144 | 'password' => env('REDIS_PASSWORD'), 145 | 'port' => env('REDIS_PORT', '6379'), 146 | 'database' => env('REDIS_CACHE_DB', '1'), 147 | ], 148 | 149 | ], 150 | 151 | ]; 152 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/app.php: -------------------------------------------------------------------------------- 1 | env('APP_NAME', 'Laravel'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Application Environment 24 | |-------------------------------------------------------------------------- 25 | | 26 | | This value determines the "environment" your application is currently 27 | | running in. This may determine how you prefer to configure various 28 | | services the application utilizes. Set this in your ".env" file. 29 | | 30 | */ 31 | 32 | 'env' => env('APP_ENV', 'production'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Application Debug Mode 37 | |-------------------------------------------------------------------------- 38 | | 39 | | When your application is in debug mode, detailed error messages with 40 | | stack traces will be shown on every error that occurs within your 41 | | application. If disabled, a simple generic error page is shown. 42 | | 43 | */ 44 | 45 | 'debug' => (bool) env('APP_DEBUG', false), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Application URL 50 | |-------------------------------------------------------------------------- 51 | | 52 | | This URL is used by the console to properly generate URLs when using 53 | | the Artisan command line tool. You should set this to the root of 54 | | your application so that it is used when running Artisan tasks. 55 | | 56 | */ 57 | 58 | 'url' => env('APP_URL', 'http://localhost'), 59 | 60 | 'asset_url' => env('ASSET_URL'), 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Application Timezone 65 | |-------------------------------------------------------------------------- 66 | | 67 | | Here you may specify the default timezone for your application, which 68 | | will be used by the PHP date and date-time functions. We have gone 69 | | ahead and set this to a sensible default for you out of the box. 70 | | 71 | */ 72 | 73 | 'timezone' => 'UTC', 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Application Locale Configuration 78 | |-------------------------------------------------------------------------- 79 | | 80 | | The application locale determines the default locale that will be used 81 | | by the translation service provider. You are free to set this value 82 | | to any of the locales which will be supported by the application. 83 | | 84 | */ 85 | 86 | 'locale' => 'en', 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Application Fallback Locale 91 | |-------------------------------------------------------------------------- 92 | | 93 | | The fallback locale determines the locale to use when the current one 94 | | is not available. You may change the value to correspond to any of 95 | | the language folders that are provided through your application. 96 | | 97 | */ 98 | 99 | 'fallback_locale' => 'en', 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Faker Locale 104 | |-------------------------------------------------------------------------- 105 | | 106 | | This locale will be used by the Faker PHP library when generating fake 107 | | data for your database seeds. For example, this will be used to get 108 | | localized telephone numbers, street address information and more. 109 | | 110 | */ 111 | 112 | 'faker_locale' => 'en_US', 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Encryption Key 117 | |-------------------------------------------------------------------------- 118 | | 119 | | This key is used by the Illuminate encrypter service and should be set 120 | | to a random, 32 character string, otherwise these encrypted strings 121 | | will not be safe. Please do this before deploying an application! 122 | | 123 | */ 124 | 125 | 'key' => env('APP_KEY'), 126 | 127 | 'cipher' => 'AES-256-CBC', 128 | 129 | /* 130 | |-------------------------------------------------------------------------- 131 | | Maintenance Mode Driver 132 | |-------------------------------------------------------------------------- 133 | | 134 | | These configuration options determine the driver used to determine and 135 | | manage Laravel's "maintenance mode" status. The "cache" driver will 136 | | allow maintenance mode to be controlled across multiple machines. 137 | | 138 | | Supported drivers: "file", "cache" 139 | | 140 | */ 141 | 142 | 'maintenance' => [ 143 | 'driver' => 'file', 144 | // 'store' => 'redis', 145 | ], 146 | 147 | /* 148 | |-------------------------------------------------------------------------- 149 | | Autoloaded Service Providers 150 | |-------------------------------------------------------------------------- 151 | | 152 | | The service providers listed here will be automatically loaded on the 153 | | request to your application. Feel free to add your own services to 154 | | this array to grant expanded functionality to your applications. 155 | | 156 | */ 157 | 158 | 'providers' => ServiceProvider::defaultProviders()->merge([ 159 | /* 160 | * Package Service Providers... 161 | */ 162 | 163 | /* 164 | * Application Service Providers... 165 | */ 166 | App\Providers\AppServiceProvider::class, 167 | App\Providers\AuthServiceProvider::class, 168 | // App\Providers\BroadcastServiceProvider::class, 169 | App\Providers\EventServiceProvider::class, 170 | App\Providers\RouteServiceProvider::class, 171 | ])->toArray(), 172 | 173 | /* 174 | |-------------------------------------------------------------------------- 175 | | Class Aliases 176 | |-------------------------------------------------------------------------- 177 | | 178 | | This array of class aliases will be registered when this application 179 | | is started. However, feel free to register as many as you wish as 180 | | the aliases are "lazy" loaded so they don't hinder performance. 181 | | 182 | */ 183 | 184 | 'aliases' => Facade::defaultAliases()->merge([ 185 | // 'Example' => App\Facades\Example::class, 186 | ])->toArray(), 187 | 188 | ]; 189 | -------------------------------------------------------------------------------- /Python/Password-Generator.md: -------------------------------------------------------------------------------- 1 | ```python 2 | import random 3 | import string 4 | 5 | def get_user_choices(): 6 | # Get user input for password length 7 | length = int(input("Enter the desired password length: ")) 8 | 9 | # Prompt the user for character set preferences 10 | include_lowercase = input("Include lowercase letters? (y/n): ").strip().lower() == 'y' 11 | include_uppercase = input("Include uppercase letters? (y/n): ").strip().lower() == 'y' 12 | include_numbers = input("Include numbers? (y/n): ").strip().lower() == 'y' 13 | include_special_chars = input("Include special characters? (y/n): ").strip().lower() == 'y' 14 | 15 | return length, include_lowercase, include_uppercase, include_numbers, include_special_chars 16 | 17 | def build_character_set(include_lowercase, include_uppercase, include_numbers, include_special_chars): 18 | # Define character sets based on user input 19 | character_set = '' 20 | if include_lowercase: 21 | character_set += string.ascii_lowercase 22 | if include_uppercase: 23 | character_set += string.ascii_uppercase 24 | if include_numbers: 25 | character_set += string.digits 26 | if include_special_chars: 27 | character_set += string.punctuation 28 | 29 | return character_set 30 | 31 | def generate_password(length, character_set): 32 | # Ensure the character set is not empty 33 | if not character_set: 34 | raise ValueError("At least one character type must be selected") 35 | 36 | # Generate password 37 | password = ''.join(random.choice(character_set) for _ in range(length)) 38 | return password 39 | 40 | def main(): 41 | try: 42 | length, include_lowercase, include_uppercase, include_numbers, include_special_chars = get_user_choices() 43 | character_set = build_character_set(include_lowercase, include_uppercase, include_numbers, include_special_chars) 44 | password = generate_password(length, character_set) 45 | print(f"This You Generated Password: {password}") 46 | except ValueError as ve: 47 | print(f"Error: {ve}") 48 | except Exception as e: 49 | print(f"An unexpected error occurred: {e}") 50 | 51 | if __name__ == "__main__": 52 | main() 53 | ``` 54 | 55 | --- 56 | 57 | ### Code Explanation 58 | 59 | #### 1. **Library Imports** 60 | ```python 61 | import random 62 | import string 63 | ``` 64 | - **`random`**: This library is used to generate random choices. In this case, it helps to randomly select characters for the password. 65 | - **`string`**: Provides constants for character sets like lowercase letters, uppercase letters, digits, and punctuation, which will be used to construct the password. 66 | 67 | #### 2. **Function: `get_user_choices()`** 68 | ```python 69 | def get_user_choices(): 70 | # Get user input for password length 71 | length = int(input("Enter the desired password length: ")) 72 | 73 | # Prompt the user for character set preferences 74 | include_lowercase = input("Include lowercase letters? (y/n): ").strip().lower() == 'y' 75 | include_uppercase = input("Include uppercase letters? (y/n): ").strip().lower() == 'y' 76 | include_numbers = input("Include numbers? (y/n): ").strip().lower() == 'y' 77 | include_special_chars = input("Include special characters? (y/n): ").strip().lower() == 'y' 78 | 79 | return length, include_lowercase, include_uppercase, include_numbers, include_special_chars 80 | ``` 81 | - **`input()`**: Asks the user for the length of the password and whether to include lowercase, uppercase, numbers, and special characters. It processes the input to return booleans (`True` if the user selects 'y', and `False` otherwise). 82 | - **`.strip().lower()`**: Cleans the input by removing any surrounding whitespace and converting it to lowercase for uniform comparison. 83 | 84 | #### 3. **Function: `build_character_set()`** 85 | ```python 86 | def build_character_set(include_lowercase, include_uppercase, include_numbers, include_special_chars): 87 | # Define character sets based on user input 88 | character_set = '' 89 | if include_lowercase: 90 | character_set += string.ascii_lowercase 91 | if include_uppercase: 92 | character_set += string.ascii_uppercase 93 | if include_numbers: 94 | character_set += string.digits 95 | if include_special_chars: 96 | character_set += string.punctuation 97 | 98 | return character_set 99 | ``` 100 | - **`character_set`**: An empty string that will be populated based on user preferences. Each condition (`if`) checks whether the user opted to include certain character types. If they did, it appends that set to the `character_set` string. 101 | - **`string.ascii_lowercase`**: Contains all lowercase letters ('a' to 'z'). 102 | - **`string.ascii_uppercase`**: Contains all uppercase letters ('A' to 'Z'). 103 | - **`string.digits`**: Contains all digits ('0' to '9'). 104 | - **`string.punctuation`**: Contains all punctuation characters (e.g., `!`, `@`, `#`, etc.). 105 | 106 | This function returns the combined character set based on the user's choices. 107 | 108 | #### 4. **Function: `generate_password()`** 109 | ```python 110 | def generate_password(length, character_set): 111 | # Ensure the character set is not empty 112 | if not character_set: 113 | raise ValueError("At least one character type must be selected") 114 | 115 | # Generate password 116 | password = ''.join(random.choice(character_set) for _ in range(length)) 117 | return password 118 | ``` 119 | - **`if not character_set:`**: Ensures the user has selected at least one character type. If no character type is selected, the function raises a `ValueError`. 120 | - **Password generation**: 121 | - **`random.choice(character_set)`**: Selects a random character from the `character_set`. 122 | - **`''.join(... for _ in range(length))`**: This creates a string by joining random characters together. The loop runs for the number of times equal to the length specified by the user. 123 | 124 | This function returns the generated password. 125 | 126 | #### 5. **Function: `main()`** 127 | ```python 128 | def main(): 129 | try: 130 | length, include_lowercase, include_uppercase, include_numbers, include_special_chars = get_user_choices() 131 | character_set = build_character_set(include_lowercase, include_uppercase, include_numbers, include_special_chars) 132 | password = generate_password(length, character_set) 133 | print(f"This You Generated Password: {password}") 134 | except ValueError as ve: 135 | print(f"Error: {ve}") 136 | except Exception as e: 137 | print(f"An unexpected error occurred: {e}") 138 | ``` 139 | - **`try` block**: The code attempts to run the password generation process and catch any errors that may occur. 140 | - **`ValueError`**: If no character types were selected, this specific error will be raised. 141 | - **`Exception`**: Catches any other unexpected errors and prints the corresponding message. 142 | 143 | This is the main driver function that ties together the user input, character set construction, and password generation. 144 | 145 | #### 6. **Entry Point** 146 | ```python 147 | if __name__ == "__main__": 148 | main() 149 | ``` 150 | - This block checks if the script is being run as the main program. If it is, it calls the `main()` function to start the process. If the script is imported as a module elsewhere, the `main()` function will not execute automatically. 151 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/config/session.php: -------------------------------------------------------------------------------- 1 | env('SESSION_DRIVER', 'file'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Session Lifetime 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Here you may specify the number of minutes that you wish the session 29 | | to be allowed to remain idle before it expires. If you want them 30 | | to immediately expire on the browser closing, set that option. 31 | | 32 | */ 33 | 34 | 'lifetime' => env('SESSION_LIFETIME', 120), 35 | 36 | 'expire_on_close' => false, 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Session Encryption 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This option allows you to easily specify that all of your session data 44 | | should be encrypted before it is stored. All encryption will be run 45 | | automatically by Laravel and you can use the Session like normal. 46 | | 47 | */ 48 | 49 | 'encrypt' => false, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Session File Location 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When using the native session driver, we need a location where session 57 | | files may be stored. A default has been set for you but a different 58 | | location may be specified. This is only needed for file sessions. 59 | | 60 | */ 61 | 62 | 'files' => storage_path('framework/sessions'), 63 | 64 | /* 65 | |-------------------------------------------------------------------------- 66 | | Session Database Connection 67 | |-------------------------------------------------------------------------- 68 | | 69 | | When using the "database" or "redis" session drivers, you may specify a 70 | | connection that should be used to manage these sessions. This should 71 | | correspond to a connection in your database configuration options. 72 | | 73 | */ 74 | 75 | 'connection' => env('SESSION_CONNECTION'), 76 | 77 | /* 78 | |-------------------------------------------------------------------------- 79 | | Session Database Table 80 | |-------------------------------------------------------------------------- 81 | | 82 | | When using the "database" session driver, you may specify the table we 83 | | should use to manage the sessions. Of course, a sensible default is 84 | | provided for you; however, you are free to change this as needed. 85 | | 86 | */ 87 | 88 | 'table' => 'sessions', 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Session Cache Store 93 | |-------------------------------------------------------------------------- 94 | | 95 | | While using one of the framework's cache driven session backends you may 96 | | list a cache store that should be used for these sessions. This value 97 | | must match with one of the application's configured cache "stores". 98 | | 99 | | Affects: "apc", "dynamodb", "memcached", "redis" 100 | | 101 | */ 102 | 103 | 'store' => env('SESSION_STORE'), 104 | 105 | /* 106 | |-------------------------------------------------------------------------- 107 | | Session Sweeping Lottery 108 | |-------------------------------------------------------------------------- 109 | | 110 | | Some session drivers must manually sweep their storage location to get 111 | | rid of old sessions from storage. Here are the chances that it will 112 | | happen on a given request. By default, the odds are 2 out of 100. 113 | | 114 | */ 115 | 116 | 'lottery' => [2, 100], 117 | 118 | /* 119 | |-------------------------------------------------------------------------- 120 | | Session Cookie Name 121 | |-------------------------------------------------------------------------- 122 | | 123 | | Here you may change the name of the cookie used to identify a session 124 | | instance by ID. The name specified here will get used every time a 125 | | new session cookie is created by the framework for every driver. 126 | | 127 | */ 128 | 129 | 'cookie' => env( 130 | 'SESSION_COOKIE', 131 | Str::slug(env('APP_NAME', 'laravel'), '_').'_session' 132 | ), 133 | 134 | /* 135 | |-------------------------------------------------------------------------- 136 | | Session Cookie Path 137 | |-------------------------------------------------------------------------- 138 | | 139 | | The session cookie path determines the path for which the cookie will 140 | | be regarded as available. Typically, this will be the root path of 141 | | your application but you are free to change this when necessary. 142 | | 143 | */ 144 | 145 | 'path' => '/', 146 | 147 | /* 148 | |-------------------------------------------------------------------------- 149 | | Session Cookie Domain 150 | |-------------------------------------------------------------------------- 151 | | 152 | | Here you may change the domain of the cookie used to identify a session 153 | | in your application. This will determine which domains the cookie is 154 | | available to in your application. A sensible default has been set. 155 | | 156 | */ 157 | 158 | 'domain' => env('SESSION_DOMAIN'), 159 | 160 | /* 161 | |-------------------------------------------------------------------------- 162 | | HTTPS Only Cookies 163 | |-------------------------------------------------------------------------- 164 | | 165 | | By setting this option to true, session cookies will only be sent back 166 | | to the server if the browser has a HTTPS connection. This will keep 167 | | the cookie from being sent to you when it can't be done securely. 168 | | 169 | */ 170 | 171 | 'secure' => env('SESSION_SECURE_COOKIE'), 172 | 173 | /* 174 | |-------------------------------------------------------------------------- 175 | | HTTP Access Only 176 | |-------------------------------------------------------------------------- 177 | | 178 | | Setting this value to true will prevent JavaScript from accessing the 179 | | value of the cookie and the cookie will only be accessible through 180 | | the HTTP protocol. You are free to modify this option if needed. 181 | | 182 | */ 183 | 184 | 'http_only' => true, 185 | 186 | /* 187 | |-------------------------------------------------------------------------- 188 | | Same-Site Cookies 189 | |-------------------------------------------------------------------------- 190 | | 191 | | This option determines how your cookies behave when cross-site requests 192 | | take place, and can be used to mitigate CSRF attacks. By default, we 193 | | will set this value to "lax" since this is a secure default value. 194 | | 195 | | Supported: "lax", "strict", "none", null 196 | | 197 | */ 198 | 199 | 'same_site' => 'lax', 200 | 201 | /* 202 | |-------------------------------------------------------------------------- 203 | | Partitioned Cookies 204 | |-------------------------------------------------------------------------- 205 | | 206 | | Setting this value to true will tie the cookie to the top-level site for 207 | | a cross-site context. Partitioned cookies are accepted by the browser 208 | | when flagged "secure" and the Same-Site attribute is set to "none". 209 | | 210 | */ 211 | 212 | 'partitioned' => false, 213 | 214 | ]; 215 | -------------------------------------------------------------------------------- /Javascript/Random-Quote-Generator.md: -------------------------------------------------------------------------------- 1 | # Random Quote Generator in JavaScript 2 | 3 | Welcome to the Random Quote Generator project for JavaScript! 🚀 4 | 5 | In this project, we'll create a simple web page that displays random quotes. Let's get started! 6 | 7 | ## Project Overview 8 | 9 | ### Objective 10 | 11 | Create a JavaScript script that fetches and displays random quotes from an API. 12 | 13 | ### Features 14 | 15 | - Fetch random quotes from a public API. 16 | - Display the quotes dynamically on a web page. 17 | - Allow users to refresh the page to get a new random quote. 18 | 19 | ## Project Structure 20 | 21 | Create a new HTML file named `index.html` and a JavaScript file named `random_quote_generator.js`. 22 | 23 | ## Instructions 24 | 25 | 1. **Set Up HTML Structure:** 26 | - Create an HTML file with a basic structure, including an area to display the random quote. 27 | 28 | 2. **Fetch Quotes from API:** 29 | - Use JavaScript to fetch random quotes from a public API (e.g., [Quotable API](https://api.quotable.io/random)). 30 | 31 | 3. **Display Quotes Dynamically:** 32 | - Update the HTML content dynamically to display the fetched quotes. 33 | 34 | 4. **Handle Page Refresh:** 35 | - Allow users to refresh the page to get a new random quote. 36 | 37 | 5. **Run the Script:** 38 | - Open the HTML file in a web browser to see the random quotes in action. 39 | 40 | ## Example Code 41 | 42 | ### HTML (index.html) 43 | 44 | ```html 45 | 46 | 47 | 48 | 49 | 55 | 56 | 57 | 63 | 64 | 65 | 68 | 69 | 70 | 73 | 74 | 179 | 180 | 181 | 182 | 183 |
184 | 185 | 186 |
187 | 188 | 189 |
190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | Quote To be Displayed Here 200 | 201 | 202 | 203 | 204 | 205 |
206 | Author to be Displayed Here 207 |
208 | New Quote 210 |
211 | 212 | 213 |
214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | Quote To be Displayed Here 224 | 225 | 226 | 227 | 228 | 229 |
230 | Author to be Displayed Here 231 |
232 | 233 | New Quote 235 |
236 |
237 |
238 | 239 | 240 | 241 | 242 | 243 | 244 | ``` 245 | 246 | ### JavaScript (random_quote_generator.js) 247 | 248 | ```js (random_quote_generator.js) 249 | // Global Variable used to store the quotes 250 | // fetched from the API 251 | var data; 252 | let front = true; 253 | 254 | // Getting the front and the back author boxes 255 | const authors = document.querySelectorAll(".author"); 256 | 257 | // Getting the front and the back texts 258 | const texts = document.querySelectorAll(".text"); 259 | 260 | // Getting the body 261 | const body = document.getElementById("body"); 262 | 263 | // Getting the buttons 264 | const button = document.querySelectorAll(".new-quote"); 265 | 266 | const blockFront = document.querySelector(".block__front"); 267 | const blockBack = document.querySelector(".block__back"); 268 | 269 | const authorFront = authors[0]; 270 | const authorBack = authors[1]; 271 | 272 | const textFront = texts[0]; 273 | const textBack = texts[1]; 274 | 275 | const buttonFront = button[0]; 276 | const buttonBack = button[1]; 277 | 278 | 279 | // An arrow function used to get a quote randomly 280 | const displayQuote = () =>{ 281 | 282 | // Generates a random number between 0 283 | // and the length of the dataset 284 | let index = Math.floor(Math.random()*data.length); 285 | 286 | // Stores the quote present at the randomly generated index 287 | let quote = data[index].text; 288 | 289 | // Stores the author of the respective quote 290 | let author = data[index].author; 291 | 292 | // Making the author anonymous if no author is present 293 | if(!author){ 294 | author = "Anonymous" 295 | } 296 | 297 | // Replacing the current quote and the author with a new one 298 | 299 | if(front){ 300 | // Changing the front if back-side is displayed 301 | textFront.innerHTML = quote; 302 | authorFront.innerHTML = author; 303 | }else{ 304 | // Changing the back if front-side is displayed 305 | textBack.innerHTML = quote; 306 | authorBack.innerHTML = author; 307 | } 308 | 309 | front = !front; 310 | 311 | } 312 | 313 | // Fetching the quotes from the type.fit API using promises 314 | fetch("https://type.fit/api/quotes") 315 | .then(function(response) { 316 | return response.json(); 317 | }) // Getting the raw JSON data 318 | .then(function(data) { 319 | 320 | // Storing the quotes internally upon 321 | // successful completion of request 322 | this.data = data; 323 | 324 | // Displaying the quote When the Webpage loads 325 | displayQuote() 326 | }); 327 | 328 | 329 | // Adding an onclick listener for the button 330 | function newQuote(){ 331 | 332 | // Rotating the Quote Box 333 | blockBack.classList.toggle('rotateB'); 334 | blockFront.classList.toggle('rotateF'); 335 | 336 | // Displaying a new quote when the webpage loads 337 | displayQuote(); 338 | } 339 | ``` 340 | 341 | Feel free to customize the random quote generator, add features, or modify the structure as you see fit. Contributors can use this document as a guide to implementing the random quote generator in JavaScript. 342 | -------------------------------------------------------------------------------- /Laravel/my-first-badges/resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Laravel 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 |
20 | @if (Route::has('login')) 21 |
22 | @auth 23 | Home 24 | @else 25 | Log in 26 | 27 | @if (Route::has('register')) 28 | Register 29 | @endif 30 | @endauth 31 |
32 | @endif 33 | 34 |
35 |
36 | 37 | 38 | 39 |
40 | 41 | 120 | 121 |
122 | 132 | 133 |
134 | Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}) 135 |
136 |
137 |
138 |
139 | 140 | 141 | --------------------------------------------------------------------------------