Skip to content

Instantly share code, notes, and snippets.

View decodedmrq's full-sized avatar
🏠
Working from home

Quyen Nguyen decodedmrq

🏠
Working from home
View GitHub Profile
@decodedmrq
decodedmrq / weather.sh
Created February 19, 2017 11:23 — forked from taylorotwell/weather.sh
Weather CLI
alias weather='curl -s wttr.in | sed -n "1,7p"'
@decodedmrq
decodedmrq / vhosts.conf
Created November 1, 2017 18:11
Laravel Virtual Host for Apache Example
<VirtualHost *:80>
DocumentRoot "/Users/myName/Projects/laravel/public"
ServerName myLaravel.dev
<Directory "/Users/myName/Projects/laravel/public">
AllowOverride All
Options FollowSymLinks +Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
** Apache
- Edit public/.htaccess of laravel application with wordpress in subfolder
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
export function number_format(number, decimals, dec_point, thousands_sep) {
if (number == null || !isFinite(number)) {
return number;
}
if (!decimals) {
let lengthOfNumber = number.toString().split('.').length;
decimals = lengthOfNumber > 1 ? lengthOfNumber : 0;
}
if (!dec_point) {
dec_point = '.';
@decodedmrq
decodedmrq / gist:8f120f59f34264dc0ff69f90ca91ff40
Created February 8, 2018 19:14
Composer - ErrorException: proc_open(): fork failed - Create swap memory - EC2
# /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
# /sbin/mkswap /var/swap.1
# /sbin/swapon /var/swap.1
@decodedmrq
decodedmrq / gist:4134e1e302ca543822c9cdca01cd2a4f
Created February 28, 2018 09:33
Laravel framework file permission - Security
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
[program:schools-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/ubuntu/projects/schools/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=ubuntu
numprocs=5
redirect_stderr=true
stdout_logfile=/home/ubuntu/projects/schools/storage/logs/worker.log
@decodedmrq
decodedmrq / ApiConector
Created July 26, 2018 14:29
Consuming Api with GuzzleHTTP
<?php
namespace Basemkhirat\API;
use Illuminate\Support\Facades\Config;
use GuzzleHttp\Client;
/**
* Class API
* @package Basemkhirat\API
*/
class API
{
@decodedmrq
decodedmrq / regex-japanese.txt
Created August 16, 2018 03:38 — forked from terrancesnyder/regex-japanese.txt
Regex for Japanese
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 (、。’)
@decodedmrq
decodedmrq / MySQL_5-7_macOS.md
Created September 11, 2018 01:53 — forked from robhrt7/MySQL_5-7_macOS.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.