Skip to content

Instantly share code, notes, and snippets.

View alaminfirdows's full-sized avatar
🎯

Al-Amin Firdows alaminfirdows

🎯
View GitHub Profile
@alaminfirdows
alaminfirdows / Bengali.php
Created July 9, 2019 13:02
Laravel Bangla Date, Time and Number
<?php
class Bengali
{
// Numbers
public static $bn_numbers = ["১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯", "০"];
public static $en_numbers = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
// Months
public static $en_months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
public static $en_short_months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@alaminfirdows
alaminfirdows / js-en-to-bn.js
Created September 3, 2019 06:49
Convert English number to Bangla in Javascript
var bnNumbers = {
'0': '০',
'1': '১',
'2': '২',
'3': '৩',
'4': '৪',
'5': '৫',
'6': '৬',
'7': '৭',
'8': '৮',
@alaminfirdows
alaminfirdows / slug.php
Last active August 10, 2022 17:28
Generate UTF-8 Slug PHP
<?php
function createSlug($slug_text)
{
return utf8_encode(mb_strtolower(preg_replace('/[ ,.@#$%^&*()_\/=]+/', '-', trim($slug_text)), 'UTF-8'));
}
// echo createSlug('আমার সোনার বাংলা');
@alaminfirdows
alaminfirdows / Encryption.js
Created April 5, 2020 18:48 — forked from ve3/Encryption.js
Encrypt and decrypt between programming languages (PHP & JavaScript).
/**
* Encryption class for encrypt/decrypt that works between programming languages.
*
* @author Vee Winch.
* @link https://stackoverflow.com/questions/41222162/encrypt-in-php-openssl-and-decrypt-in-javascript-cryptojs Reference.
* @link https://github.com/brix/crypto-js/releases crypto-js.js can be download from here.
*/
class Encryption {
<?php
// Solution: 1
function getData($id = false){
if(!$id) return;
$array = [
['id' => 1, 'name'=> 'jamil', 'age' =>55],
['id' => 2, 'name'=> 'shahin', 'age' =>60],
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
#discount-bar {
@alaminfirdows
alaminfirdows / guest-book.png
Last active May 10, 2022 11:48
My Guestbook
guest-book.png
<div x-data="{ isChecked: false }" class="w-full">
<label for="myCheckbox" class="mt-3 inline-flex items-center cursor-pointer">
<span class="relative">
<span class="block w-10 h-6 bg-white rounded-full border border-gray-300"></span>
<span class="absolute block w-4 h-4 mt-1 ml-1 bg-gray-400 rounded-full shadow inset-y-0 left-0 focus-within:shadow-outline transition-transform duration-300 ease-in-out outline-none" :class="{'bg-purple-600 transform translate-x-full':isChecked}">
<input @click="isChecked = !isChecked" id="myCheckbox" type="checkbox" class="absolute opacity-0 w-0 h-0">
</span>
</span>
<span class="ml-3 text-sm" x-html="isChecked"></span>
</label>
<div class="relative flex justify-center" x-data="snackBarData()" x-init="hideAlert()">
<div class="fixed bottom-10 transition duration-300" x-show="isOpen" x-transition:leave="ease-in" x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0">
<div class="bg-red-500 text-white flex items-center space-x-5 text-sm font-bold px-4 py-3 rounded shadow" role="alert">
<span class="flex">alertMessage</span>
<button class="focus:outline-none" @click="isOpen = false">
<x-icons.x />
</button>
</div>
</div>
</div>
@alaminfirdows
alaminfirdows / Laravel-Container.md
Created February 18, 2021 17:11
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).