package main
import (
"fmt"
"math"
"strings"
)
func main() {
View GoLangCrash.md
View Upgrade-Python39-from-Python36-Ubuntu-1804.md
Upgrade Python 3 version from 3.6 to 3.9 (Ubuntu 18.04)
Add the repository:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
verify the updated Python package list using this command
View LaravelEasyCustomErrorMessageForValidator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$validated = $request->validate( | |
[ | |
'checkedServices' => 'required', | |
'email' => 'required|email', | |
'message' => 'required|max:250' | |
], | |
[ | |
'checkedServices.required' => 'Please select atleast one service', | |
'email.required' => 'Please provide a email', | |
'message.required' => 'Please tell us about the reason you require the selected services', |
View DesignPatterns.md
Singleton Pattern
class Database {
private function __construct() {
echo "Connection Created";
}
public static function connect() {
if(!isset(self::$connection)) {
self::$connection = new Database();
}
View BasicTypeScript.md
Basics of TypeScript
// Boolean
let isCool: boolean = true
// Number
let age: number = 56
View Promises.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Handle Error Function | |
function handleError(fn) { | |
return function (...params) { | |
return fn(...params) | |
// .then(function (res) { | |
// console.log(`Safe Response: ${res}`) | |
// }) | |
.catch(function (err) { | |
console.error(`Oops, ${err.msg}`) | |
}) |
View MERN-Stack docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
# Database | |
mongodb: | |
image: mongo:latest | |
working_dir: /var/www/html | |
restart: 'always' | |
environment: | |
- MONGO_INITDB_ROOT_USERNAME=root |
View jsonSeeder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Services; | |
// Facades | |
use Illuminate\Support\Facades\DB; | |
use Exception; | |
class JsonFormatterService | |
{ |
View uG_adjList_dfs_bfs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nodes = 'A B C D E F G'.split(' ') | |
const edges = [ | |
['A', 'B'], | |
['B', 'C'], | |
['C', 'D'], | |
['D', 'E'], | |
['E', 'F'], | |
['F', 'G'], | |
['G', 'A'], |
View HandleInertiaRequests.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
use Inertia\Inertia; | |
use Session; | |
class HandleInertiaRequests |
NewerOlder