Skip to content

Instantly share code, notes, and snippets.

View vidux's full-sized avatar
:electron:
:electron::electron::electron::electron::electron::electron::electron::electron:

viduranga vidux

:electron:
:electron::electron::electron::electron::electron::electron::electron::electron:
View GitHub Profile
@vidux
vidux / react native sample folder structure.md
Created April 14, 2023 11:40
react native sample folder structure with redux
  • src/
    • actions/
      • actionTypes.js
      • authActions.js
      • cartActions.js
      • ...
    • components/
      • common/
        • Button/
  • Button.js
@vidux
vidux / watermark.php
Created December 23, 2022 13:55
add watermark to images in php
<?php
declare(strict_types=1);
// Set the directory containing the images
$dir = realpath(dirname(__FILE__)) . "/";
// Scan the directory for image files
$files = scandir($dir);
@vidux
vidux / bookmarks.md
Last active October 1, 2022 14:04
bookmarks
@vidux
vidux / PermissionSeeder.php
Created September 13, 2022 07:07
Laravel Permission Seeder Improved
<?php
//https://github.com/vidux/
//check more at https://gist.github.com/vidux
namespace Database\Seeders;
use Spatie\Permission\Models\Permission;
use Illuminate\Database\Seeder;
@vidux
vidux / jquary_snip1.js
Last active August 18, 2022 04:07
jquery code snippets
//run after juqary loaded
$(function(){
// other codes
});
//ajax setup csrf token
$.ajaxSetup({
headers: {
@vidux
vidux / things_for_better_future.md
Last active October 1, 2022 13:57
Common things to do for your future

Common things to do for your future

Hi! This was created with the aim of getting a basic tasks ideas for those who have no better vision what to do :P (like me). this is a task / responsible list for just take a idea.

disclaimer:

Do not consider this as your ultimate vision plan for this future. because everyone life statuses are dynamic and unique. It is not necessary to follow any of the points mentioned here in the same way, and you have to bear the responsibility when you follow the things here, and we would like to kindly inform you that I will not accept the responsibilities , any inconvenience due to the things mentioned here.


@vidux
vidux / dumpsql_laravel.php
Created March 7, 2022 15:56
laravel dump msyql quary
<?php
$el_quary // your quary from elequent
$query = str_replace(array('?'), array('\'%s\''), $el_quary->toSql());
$query = vsprintf($query, $el_quary->getBindings());
dd( $query);
//from https://stackoverflow.com/a/59403835/8926714
@vidux
vidux / BelongsToOneThrough.php
Created March 28, 2021 15:11
Laravel BelongsToOneThrough like relationship
<?php
//Model story
/*
`Spreedsheet` have many `Rows` `Row` have many `RowValues`
`Spreedsheet` parent of `Rows`, `Rows` parent of `RowValues`
*/
//table structure
/*
@vidux
vidux / EmailEvent.php
Created January 10, 2021 15:22
Laravel Email event listener for add / modify sender
<?php
//blog.vidu.dev
namespace App\Listeners;
use Illuminate\Mail\Events\MessageSending;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class EmailEvent
{
@vidux
vidux / ExampleMail.php
Created January 10, 2021 15:03
add sender to laravel Mailable build method
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class ExampleMail extends Mailable