Skip to content

Instantly share code, notes, and snippets.


viduranga vidux

View GitHub Profile
vidux /
Created Aug 4, 2022
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.


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 / dumpsql_laravel.php
Created Mar 7, 2022
laravel dump msyql quary
View dumpsql_laravel.php
$el_quary // your quary from elequent
$query = str_replace(array('?'), array('\'%s\''), $el_quary->toSql());
$query = vsprintf($query, $el_quary->getBindings());
dd( $query);
vidux / BelongsToOneThrough.php
Created Mar 28, 2021
Laravel BelongsToOneThrough like relationship
View BelongsToOneThrough.php
//Model story
`Spreedsheet` have many `Rows` `Row` have many `RowValues`
`Spreedsheet` parent of `Rows`, `Rows` parent of `RowValues`
//table structure
vidux / EmailEvent.php
Created Jan 10, 2021
Laravel Email event listener for add / modify sender
View EmailEvent.php
namespace App\Listeners;
use Illuminate\Mail\Events\MessageSending;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class EmailEvent
vidux / ExampleMail.php
Created Jan 10, 2021
add sender to laravel Mailable build method
View ExampleMail.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
vidux / gist:c4a3be27c47e3b8bce3d3fccdea818a3
Created Dec 27, 2020
docker basics -install and permmsions
View gist:c4a3be27c47e3b8bce3d3fccdea818a3
#install docker
sudo apt install docker docker-compose
sudo groupadd docker
#assign currentr user to docker
sudo usermod -aG docker $USER
newgrp docker
#now you should able to run docker commands without sudo
vidux / add swapfile if ram is low
Last active Dec 26, 2020
fast install LAMP ubuntu server
View add swapfile if ram is low
#check swap
sudo swapon --show
#allocate swapfile (1G == 1 gigabyte)
sudo fallocate -l 1G /swapfile
#set permmission
sudo chmod 600 /swapfile
sudo mkswap /swapfile
vidux /
Last active Jul 14, 2020
Install Laravel in Mac

install composer

php -r "copy('', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e5325b19b381bfd88ce90a5ddb7823406b2a38cff6bb704b0acc289a09c8128d4a8ce2bbafcd1fcbdc38666422fe2806') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php

after succress download

vidux / app.js
Created Jun 30, 2020
Add keyboard avoiding view react native
View app.js
import React, {Component} from 'react';
const App =()=>
<ScrollView scrollEnabled={false} contentContainerStyle={{flex: 1}}>
<SafeAreaView style={{flex: 1, backgroundColor: 'white'}}>
<KeyboardAvoidingView behavior='position' contentContainerStyle={{flex: 1}} style={styles.mainContainer}>
<View style={styles.logoView}>
<Image source={logo} />
<Text style={{fontSize: deviceHeight/33, marginTop: deviceHeight/60}}>Welcome</Text>
<Text style={{fontSize: 14, marginTop: deviceHeight/80}}>Please sign in to continue</Text>
vidux / app.js
Created Apr 9, 2020
React Native google places autocomplete - geocode with strictbounds
View app.js
//"react-native-google-places-autocomplete": "1.4.1",
placeholder='search your address here'
minLength={2} // minimum length of text to search
returnKeyType={'search'} // Can be left out for default return key
keyboardAppearance={'light'} // Can be left out for default keyboardAppearance
listViewDisplayed='auto' // true/false/undefined
renderDescription={row => row.description} // custom description render