Skip to content

Instantly share code, notes, and snippets.

View shahnCM's full-sized avatar
🎯
Focusing

Shahrier Mahir shahnCM

🎯
Focusing
View GitHub Profile
@shahnCM
shahnCM / GoLangCrash.md
Created June 1, 2023 21:30
Some GoLang programs to get you started
View GoLangCrash.md
package main

import (
	"fmt"
	"math"
	"strings"
)

func main() {
View Upgrade-Python39-from-Python36-Ubuntu-1804.md
View LaravelEasyCustomErrorMessageForValidator.php
$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
View Promises.js
// 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
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
<?php
namespace App\Services;
// Facades
use Illuminate\Support\Facades\DB;
use Exception;
class JsonFormatterService
{
View uG_adjList_dfs_bfs.js
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'],
@shahnCM
shahnCM / HandleInertiaRequests.php
Last active December 12, 2020 07:30
How to share data In with Laravel 8 Inertia-Jetstream
View HandleInertiaRequests.php
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Session;
class HandleInertiaRequests