Skip to content

Instantly share code, notes, and snippets.

View trungpv1601's full-sized avatar
🤖
Diversifying; Practical; more code than talk.

trungpv trungpv1601

🤖
Diversifying; Practical; more code than talk.
View GitHub Profile
@trungpv1601
trungpv1601 / Dismiss keyboard on React Native.MD
Last active March 15, 2017 05:00
Dismiss keyboard on React Native: Tắt keyboard khi chạm ra ngoài TextInput

Dismiss keyboard on React Native: Tắt keyboard khi chạm ra ngoài TextInput

import React, { Component } from 'react';
import { TouchableWithoutFeedback, View, TextInput } from 'react-native';
import dismissKeyboard from 'react-native/Libraries/Utilities/dismissKeyboard';

export default class LoginForm extends Component {

 constructor(props) {
@trungpv1601
trungpv1601 / facebook-invite-like-post-like-page.js
Created April 6, 2017 04:01
Invite people like post like page facebook
// Go to post page -> click show popup people like post -> run script
// 04/06/2017
var keepContinue = 0;
var cancel = setInterval(function(){
keepContinue++;
var seeMore = document.getElementsByClassName('pam uiBoxLightblue uiMorePagerPrimary');
if(seeMore.length == 1) {
seeMore[0].click();
} else {
inviteAll();
@trungpv1601
trungpv1601 / backup_restore_mysql_gzip.sh
Last active April 28, 2017 05:50
Backup & Restore Mysql gzip
// Backup
mysqldump -u root -p databasename | gzip > databasename.sql.gz
// Restore
zcat databasename.sql.gz | mysql -u root -p databasename
@trungpv1601
trungpv1601 / tar_untar_linux
Created July 13, 2017 06:35
tar and untar linux .tar.gz
sudo tar -zcvf xxx.tar.gz /var/xxx/
sudo tar -xzvf xxx.tar.gz
@trungpv1601
trungpv1601 / laravel-worker.conf
Created July 13, 2017 06:36
Supervisor laravel queue
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/xxx/artisan queue:work redis --timeout=0 --tries=8
autostart=true
autorestart=true
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/xxx/worker.log
@trungpv1601
trungpv1601 / .htaccess
Last active October 13, 2018 04:00
Alias apache2 config
RewriteBase /laravel-site
@trungpv1601
trungpv1601 / create_user_database_mysql
Created July 13, 2017 06:40
Create user and database mysql
CREATE DATABASE xxxDatabase;
CREATE USER 'xxxUser'@'localhost' IDENTIFIED BY 'xxxPassword';
GRANT ALL PRIVILEGES ON xxxDatabase.* TO 'xxxUser'@'localhost';
FLUSH PRIVILEGES;
@trungpv1601
trungpv1601 / config
Created July 14, 2017 06:24
Laravel in a Sub Directory with NGINX
location ^~ /xxx {
alias /var/www/xxx/public;
try_files $uri $uri/ @xxx;
location ~* \.php {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/xxx/public/index.php;
}
@trungpv1601
trungpv1601 / index.php
Created July 21, 2017 07:33
PHP SQL Server: Call Stored Proceduree PDO MSSQL PARAM OUT
<?php
try
{
$conn = new PDO ("sqlsrv:server=(local);Database=DatabaseName", "user", "password");
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
// Param
$idReturn = 0; // Param Out
$name = 'Name'; // Pram In