Skip to content

Instantly share code, notes, and snippets.

View tieutantan's full-sized avatar
🍉
Focusing

Tran Ngoc Tan tieutantan

🍉
Focusing
View GitHub Profile
@tieutantan
tieutantan / custom.css
Created December 26, 2018 17:14
Custom btn-xs on Bootstrap 4
/* docs - https://github.com/twbs/bootstrap/issues/21881#issuecomment-341972830 */
.btn-group-xs > .btn, .btn-xs {
padding : .25rem .4rem;
font-size : .875rem;
line-height : .5;
border-radius : .2rem;
}
@tieutantan
tieutantan / file.html
Created December 18, 2018 17:47
Add Active Navigation Class Based on URL
<nav>
<ul>
<li><a href="http://domain.com/">Home</a></li>
<li><a href="http://domain.com/about/">About</a></li>
<li><a href="http://domain.com/clients/">Clients</a></li>
<li><a href="http://domain.com/contact/">Contact Us</a></li>
</ul>
</nav>
@tieutantan
tieutantan / elasticsearch.repo
Last active December 17, 2018 11:00
Elasticsearch Repository: wget -O /etc/yum.repos.d/elasticsearch.repo https://bit.ly/2QCXXVS
[elasticsearch-6.x]
name=Elasticsearch repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
@tieutantan
tieutantan / .htaccess
Created December 9, 2018 13:06
PHP Function Base Template
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
<FilesMatch "stream\.php|README\.md|composer*">
Order allow,deny
Deny from all
</FilesMatch>
@tieutantan
tieutantan / file.css
Last active December 4, 2018 11:38
Edit a background color of the elements in Bootstrap 4
.custom-color, .custom-color:hover, .custom-color:active {
background-color: #A3DBFF !important;
border-color: #A3DBFF !important;
}
@tieutantan
tieutantan / file.html
Created December 4, 2018 09:19
Display Flex CSS on Bootstrap 4
<div class="col-sm-6 px-0">
<h5>Recent <span class="badge badge-secondary">New</span></h5>
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center">
Cras justo odio
<span class="badge badge-primary badge-pill">12/12/12</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
Dapibus ac facilisis in
<span class="badge badge-primary badge-pill">12/12/12</span>
@tieutantan
tieutantan / file.html
Created November 29, 2018 11:58
Screen Resolution Detector Bootstrap 4
<!-- layout -->
<hr>
<small>
<div class="d-block d-sm-none">xs 576px</div>
<div class="d-none d-sm-block d-md-none">sm ≥ 576px</div>
<div class="d-none d-md-block d-lg-none">md ≥ 768px</div>
<div class="d-none d-lg-block d-xl-none">lg ≥ 992px</div>
<div class="d-none d-xl-block">xl ≥ 1200px</div>
</small>
<hr>
@tieutantan
tieutantan / backup.sh
Created October 10, 2018 03:58
Shell Script Backup Mysql Database
#!/bin/sh
DUMPFILE=/home/thisisusername/backups/db-`date +%Y-%m-%d-%H-%M`.sql.gz
mysqldump -uthisisusername -p'ZjOGUxPass' -hlocalhost database_name --force --triggers --single-transaction --opt --skip-lock-tables | sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' | gzip -9 -c > $DUMPFILE
@tieutantan
tieutantan / file.php
Last active October 4, 2018 04:40
PHP time manipulation
<?php
// counter 2018-09-23 10:01:27 to days old
function days_old($time)
{
$date = strtotime($time); # Converted to a PHP date (a second count)
$diff = $date - time(); # time returns current time in seconds
$days = floor($diff / (60 * 60 * 24)); # seconds/minute*minutes/hour*hours/day)
return abs($days); // number of days old
}
@tieutantan
tieutantan / sources.list
Last active September 30, 2018 07:21
Ubuntu 18.04 Bionic default /etc/apt/sources.list with server best of speed to VN
#deb cdrom:[Ubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.bangmod.cloud/ubuntu/ bionic main restricted
# deb-src http://mirrors.bangmod.cloud/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.bangmod.cloud/ubuntu/ bionic-updates main restricted