Skip to content

Instantly share code, notes, and snippets.

View khanzadimahdi's full-sized avatar
🤔
Don't ration passion!

mahdikhanzadi khanzadimahdi

🤔
Don't ration passion!
View GitHub Profile
@asukakenji
asukakenji / 0-go-os-arch.md
Last active November 18, 2025 02:32
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@chuckrincon
chuckrincon / ConfigServiceProvider.php
Last active October 10, 2023 14:13
Load all your lumen config files painless.
<?php
namespace App\Providers;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
class ConfigServiceProvider extends ServiceProvider
{
@viktorpetryk
viktorpetryk / mailhog-install.md
Last active February 3, 2025 14:27
MailHog installation on Ubuntu

Install & Configure MailHog

  1. Download and make it executable
wget https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
sudo cp MailHog_linux_amd64 /usr/local/bin/mailhog
sudo chmod +x /usr/local/bin/mailhog
  1. Make MailHog as a service
@khanzadimahdi
khanzadimahdi / laravel-multiple-upload.php
Last active January 23, 2019 20:19
laravel upload helper (upload single or multiple files + retrieve uploaded file's info)
<?php
if(!function_exists('fileUpload')){
/**
* upload files (single and multiple)
*
* @param \Illuminate\Http\Request $request
* @param $inputName
* @param string $disk
* @return array|mixed
@khanzadimahdi
khanzadimahdi / fontwawesome-icons-4.7.json
Created September 25, 2018 17:09
fontawesome 4.7 icons list json
{
"icons": [
"fa fa-glass",
"fa fa-music",
"fa fa-search",
"fa fa-envelope-o",
"fa fa-heart",
"fa fa-star",
"fa fa-star-o",
"fa fa-user",
@khanzadimahdi
khanzadimahdi / download-file-with-server.php
Last active January 23, 2019 20:38
download file in server using php
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
set_time_limit(0);
function download ($file_source, $file_target) {
echo 'starting';
$rh = fopen($file_source, 'rb');
$wh = fopen($file_target, 'w+b');
if (!$rh || !$wh) {
@khanzadimahdi
khanzadimahdi / laravel-on-delete.js
Last active February 4, 2019 06:51
laravel on delete request ask yes-no question
//use jquery and sweetAlert2
$(document).ready(function() {
$("form input[name~=_method][value~=DELETE]").closest('form').submit(function(event) {
event.preventDefault();
var form = $(this); //wrap this in jQuery
swal({
title: "are you sure?",
text: "do you realy want to delete this item?",
type: "warning",
showCancelButton: true,
@abdallahokasha
abdallahokasha / Install_robo3t_Ubuntu.md
Last active April 8, 2025 13:16
Install Robo3t on Ubuntu18.04 and make a desktop icon for it

Install Robo3t On Ubuntu 18.04

Download the package form Robo3t or using wget
wget https://download.robomongo.org/1.2.1/linux/robo3t-1.2.1-linux-x86_64-3e50a65.tar.gz
Extract here using

tar -xvzf robo3t-1.2.1-linux-x86_64-3e50a65.tar.gz

@khanzadimahdi
khanzadimahdi / string-limit.js
Created April 23, 2019 05:46
limit strings length in pure javascript
// add some prototypes
String.prototype.limit = function(length = 150, tail = '...') {
return this.substr(0, length) + (this.length > length ? tail : '');
};
// how to use:
'this is an string'.limit(5);
// or it can be like the below
let name = 'this is my name';
@khanzadimahdi
khanzadimahdi / data-uri-regex-rfc2397.md
Last active March 22, 2025 13:33
regex pattern base64 data uri according to RFC 2397

pattern:

^data:((?:\w+\/(?:(?!;).)+)?)((?:;[\w\W]*?[^;])*),(.+)$

test this pattern on regexr: https://regexr.com/4inht

regex pattern to match RFC 2397 data URL