Skip to content

Instantly share code, notes, and snippets.

# Install nginx
apt-get update && apt-get install -y nginx
# Install mysql
apt-get update && apt-get install mysql-server
# Install "software-properties-common" (for the "add-apt-repository")
apt-get update && apt-get install -y \
software-properties-common locales
@thinhhung
thinhhung / beanstalkd.service
Created January 9, 2018 08:18 — forked from ifduyue/beanstalkd.service
Install beanstalkd on CentOS 7
[Unit]
Description=Beanstalkd is a simple, fast work queue
[Service]
User=nobody
Restart=always
RestartSec=500ms
ExecStart=/usr/local/bin/beanstalkd -b /var/lib/beanstalkd
LimitNOFILE=10240
@thinhhung
thinhhung / imagemagick-install-steps
Created February 2, 2018 06:35 — forked from rodleviton/imagemagick-install-steps
Installing Image Magick on Ubuntu 14.04
sudo -i
cd
apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y
wget http://www.imagemagick.org/download/ImageMagick-6.8.7-7.tar.gz
tar xzvf ImageMagick-6.8.9-1.tar.gz
cd ImageMagick-6.8.9-1/
./configure --prefix=/opt/imagemagick-6.8 && make
checkinstall
# Laravel
Trust proxies:
https://laravel.com/docs/5.5/requests#configuring-trusted-proxies
# Wordpress
Edit wp-config.file
<?php
define('WP_HOME','https://site.com');
define('WP_SITEURL','https://site.com');
$_SERVER['HTTPS'] = 'on';
@thinhhung
thinhhung / gist:356dbbfd7852c479fd22cf05f6c76184
Created March 22, 2018 01:28 — forked from jrmadsen67/gist:bd0f9ad0ef1ed6bb594e
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
@thinhhung
thinhhung / gist:157a305c956f9d640ed721a1c452193a
Created March 22, 2018 01:28 — forked from jrmadsen67/gist:bd0f9ad0ef1ed6bb594e
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
@thinhhung
thinhhung / multiple_ssh_setting.md
Created April 4, 2018 06:58 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@thinhhung
thinhhung / .eslintrc
Created June 19, 2018 03:12 — forked from radiovisual/.eslintrc
React Native AirBnB ESLint Config
{
"parser": "babel-eslint",
"plugins": [
"react",
"react-native"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
@thinhhung
thinhhung / React-Directory-Layout.md
Created August 9, 2018 06:16 — forked from koistya/React-Directory-Layout.md
File and folder naming convention for React.js components

File and folder naming convention for React.js components

Directory Layout #1

/actions/...
/components/common/Link.js
/components/common/...
/components/forms/TextBox.js
/components/forms/TextBox.res/style.css