Skip to content

Instantly share code, notes, and snippets.

View saaiful's full-sized avatar
🏠
Working from home

Saiful Islam saaiful

🏠
Working from home
View GitHub Profile
@saaiful
saaiful / CORS.php
Last active May 6, 2023 18:15
Enable CORS via Middleware in Laravel
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
class CORS
{
@saaiful
saaiful / currency.json
Last active January 25, 2025 19:29
Gold Rate (BD) - Bangladesh Jewellers Samity. Update @ 2025-01-26 01:29:50
{"BDT":{"country":"Bangladesh","capital":"Dhaka","country_code_iso2":"BD","currency_code":"BDT","currency_symbol_int":"Tk","currency_symbol":"\u09f3","currency_name":"Bangladeshi Taka","rate":108.746847},"EUR":{"country":"Ireland","capital":"Dublin","country_code_iso2":"IE","currency_code":"EUR","currency_symbol_int":"\u20ac","currency_symbol":"\u20ac","currency_name":"Euro","rate":0.92065300000000005},"XOF":{"country":"Togo","capital":"Lome","country_code_iso2":"TG","currency_code":"XOF","currency_symbol_int":"CFA","currency_symbol":"CFA","currency_name":"CFA Franc BCEAO","rate":603.90879600000005},"BGN":{"country":"Bulgaria","capital":"Sofia","country_code_iso2":"BG","currency_code":"BGN","currency_symbol_int":"BGN","currency_symbol":"\u043b\u0432.","currency_name":"Bulgarian Lev","rate":1.8008},"BAM":{"country":"Bosnia and Herzegovina","capital":"Sarajevo","country_code_iso2":"BA","currency_code":"BAM","currency_symbol_int":"KM","currency_symbol":"KM","currency_name":"Bosnia-Herzegovina Convertible Mark","
@saaiful
saaiful / bill2.php
Created July 1, 2020 13:21
Bill in AJAX
<?php
if (isset($_POST['unit'])) {
$total = 0;
$unit = (int) $_POST['unit'];
function calculate($unit, $range, $price)
{
$xunit = $range[1] - $range[0] + 1;
if ($unit <= $xunit && $unit > 0) {
$bill = $unit * $price;
# Set SMS to Text Mode
AT+CMGF=1
# Set SMS to PDU Mode
AT+CMGF=0
service vesta stop
rm -f /etc/yum.repos.d/vesta.repo
yum erase vesta* -y
rm -f /etc/apt/sources.list.d/vesta.list
rm -rf /usr/local/vesta
yum erase httpd httpd-tools apr apr-util vesta nginx httpd exim vesta* -y
yum autoremove -y
@saaiful
saaiful / sendy.conf
Created May 3, 2019 12:44
Nginx configuration file example for Sendy (http://sendy.co/).
server {
listen ip:port;
server_name domain.name;
root root_folder;
index index.php index.html index.htm;
location / {
location = / {
try_files $uri $uri/ /index.php?$query_string;
}
<?php
//store images
public function store(Request $request)
{
try{
if($request->hasFile('file')){ //max 921600bytes or, 900KB - this value will be changed dynamically from settings
foreach ($request->file as $file) {
@saaiful
saaiful / domain.sh
Created October 31, 2018 04:41
Vesta php pool fix
#----------------------------------------------------------#
# WEB #
#----------------------------------------------------------#
# Web template check
is_web_template_valid() {
if [ ! -z "$WEB_SYSTEM" ]; then
tpl="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$1.tpl"
stpl="$WEBTPL/$WEB_SYSTEM/$WEB_BACKEND/$1.stpl"
if [ ! -e "$tpl" ] || [ ! -e "$stpl" ]; then
@saaiful
saaiful / mobile.js
Created June 23, 2018 17:32
Vee-Validate mobile number validator (Bangladesh)
import VeeValidate from 'vee-validate';
Vue.use(VeeValidate, { inject: false });
VeeValidate.Validator.extend('mobile', {
getMessage: field => `The number is not valid for Bangladesh.`,
validate: value => {
var strongRegex = new RegExp("^(8801[756891]{1}[0-9]{8}|01[756891]{1}[0-9]{8})$");
if(value=='') return true;
return strongRegex.test(value);
}
});