Skip to content

Instantly share code, notes, and snippets.

View tranghaviet's full-sized avatar

Hà Viết Tráng tranghaviet

View GitHub Profile
@tranghaviet
tranghaviet / bootstrap-4-sass-mixins-cheat-sheet.scss
Created October 4, 2018 11:35 — forked from anschaef/bootstrap-4-sass-mixins-cheat-sheet.scss
Bootstrap 4 Sass Mixins [Cheat sheet with examples]
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// Updated to Bootstrap v4.1.x
// @author https://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/v4-dev/scss/mixins
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12 !default;
$grid-gutter-width: 30px !default;
@tranghaviet
tranghaviet / php7-fpm_xdebug_nginx.md
Created September 29, 2018 03:44 — forked from rahilwazir/php7-fpm_xdebug_nginx.md
Quick guide to setup Nginx with PHP7-FPM and XDebug

PHP7

  • Ubuntu 16.04+
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt update
$ sudo apt install nginx php7.1-fpm php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-phpdbg php7.1-mbstring php7.1-gd php7.1-imap php7.1-ldap php7.1-pgsql php7.1-pspell php7.1-recode php7.1-soap php7.1-tidy php7.1-dev php7.1-intl php7.1-curl php7.1-zip php7.1-xml php-xdebug
@tranghaviet
tranghaviet / jQuery Change Event: Proper Binding
Created September 21, 2018 02:06 — forked from brandonaaskov/jQuery Change Event: Proper Binding
jQuery's change() event doesn't work as expected with input text fields. This, however, does work.
/*
For some reason, the change() event only fires when the input field loses focus.
Binding to other options ('change keypress paste focus textInput input') will
fire the event several times, which is bad. The below code works even when
content is pasted into the text field, and only fires once as expected.
*/
$('#search-form .term').bind('input', function(){
console.log('this actually works');
});
@tranghaviet
tranghaviet / gist:632ad392947b57d4b15c8d7778ac75c3
Created August 20, 2018 06:33 — forked from kamipo/gist:61ee662ee0b1127f0989
MySQL Unicode Collation Behavior

MySQL Unicode character set has following collations mainly:

  • xxx_bin: compare all characters by these code point as weight.
  • xxx_general_ci: compare almost characters by these code point as weight.
  • xxx_unicode_ci: compare all characters by these collating weight.

ref. http://dev.mysql.com/doc/refman/5.6/en/charset-unicode-sets.html

When xxx is utf8, can treat only BMP characters.

@tranghaviet
tranghaviet / README.md
Created July 15, 2018 05:43 — forked from yang-wei/README.md
ES6 destructing (and rest parameter)

We will first discussed how destructing and rest parameters can be used in ES6 - in arrays and objects. Then we will look at a few examples and also discuss some quiz.

arrays

var array = [1, 2, 3, 4];
var nestedArray = [1, 2, 3, 4, [7, 8, 9]];

var [a, b, c, d] = array;
console.log(a, b, c, d)
@tranghaviet
tranghaviet / .htaccess
Created May 29, 2018 04:13 — forked from thoop/.htaccess
Official prerender.io .htaccess for Apache.
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change http://example.com (at the end of the last RewriteRule) to your website url
<IfModule mod_headers.c>
#RequestHeader set X-Prerender-Token "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@tranghaviet
tranghaviet / accessing-virtualbox.md
Last active May 22, 2018 03:34
Accessing your Virtualbox Guest from your Host OS

Accessing your Virtualbox Guest from your Host OS

As a developer you want to ping and access the webserver on your virtual machine. This is a very simple solution to enable the bridge to the guest VM.

Requirements

  • VirtualBox (latest version)
  • A guest operation system (e.g. Ubuntu)
@tranghaviet
tranghaviet / CrossPlatGit.md
Last active August 15, 2019 08:09
Git config for cross platform line endings
@tranghaviet
tranghaviet / gist:d8e7651ce0ae585254cfd90bd41615b0
Created December 17, 2017 13:30 — forked from alekpopovic/gist:ce3635c7e29596e6f65154b1785e5ef9
Installing Laravel 5.2 on Ubuntu 16.04 and Apache2
Installing Laravel 5.2 on Ubuntu 16.04 and Apache2
This post will document how I installed Laravel 5.2, on Apache2 on an Ubuntu 16.04 server. Will will also install MySQL, as we will need a database, and PHP which is required by Laravel. This will be the starting point of most of my posts, so if you’re following along from scratch…this is “scratch!”
First thing you need, of course, is the Ubuntu 16.04 server, with an SSH connection. Follow these excellent instructions and get yourself sorted out with one. Make sure you also give the server a static IP address (step 8., in the linked instructions). Come back when you’re done.
Welcome back! Lets get started.