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
Move A row to another same-field talbe php
table:Foo
+------------+
|id|name|age |
+------------+
|2|Vidx| 24 |
+------------+
table:bar
+------------+
@vidux
vidux / Getdataview.js
Last active January 4, 2020 19:21
fast include redux-saga to react
//src/view/getdata/Getdataview.js
import React, { Component,} from 'react';
import { connect } from 'react-redux';
import actions from '../../redux/my_sub_redux_folder/actions';
const { getDataJson } = actions;//import any method from action file
class Getdataview extends Component {
constructor(props) {
super(props);
@vidux
vidux / test.php
Last active April 27, 2020 05:00
php/laravel read tail log file from code
<?php
$file = popen("tail /storge/logs/laravel.log", 'r');
while(!feof($file)) {
$buffer = fgets($file);
echo "$buffer<br/>\n";
ob_flush();
flush();
}
pclose($file);
@vidux
vidux / app.js
Created April 9, 2020 16:21
React Native google places autocomplete - geocode with strictbounds
//"react-native-google-places-autocomplete": "1.4.1",
<GooglePlacesAutocomplete
placeholder='search your address here'
minLength={2} // minimum length of text to search
autoFocus={true}
returnKeyType={'search'} // Can be left out for default return key https://facebook.github.io/react-native/docs/textinput.html#returnkeytype
keyboardAppearance={'light'} // Can be left out for default keyboardAppearance https://facebook.github.io/react-native/docs/textinput.html#keyboardappearance
listViewDisplayed='auto' // true/false/undefined
renderDescription={row => row.description} // custom description render
@vidux
vidux / app.js
Created June 30, 2020 16:02
Add keyboard avoiding view react native
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
vidux / laravelmac.md
Last active July 14, 2020 07:07
Install Laravel in Mac

install composer

php -r "copy('https://getcomposer.org/installer', '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
vidux / add swapfile if ram is low
Last active December 26, 2020 15:47
fast install LAMP ubuntu server
#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
vidux / gist:c4a3be27c47e3b8bce3d3fccdea818a3
Created December 27, 2020 03:16
docker basics -install and permmsions
#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
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
@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
{