Skip to content

Instantly share code, notes, and snippets.

@kiennt2
kiennt2 / table-sticky-header.txt
Last active April 18, 2023 07:48
table sticky header
<div class="table-wrap">
<table>
<thead>
<tr><th>TH 1</th><th>TH 2</th></tr>
</thead>
<tbody>
<tr><td>A1</td><td>A2</td></tr>
<tr><td>B1</td><td>B2</td></tr>
<tr><td>C1</td><td>C2</td></tr>
<tr><td>D1</td><td>D2</td></tr>
@kiennt2
kiennt2 / flexbox.styl
Last active October 17, 2019 07:59
stylus - flexbox help
// Flex-box help
// Mobile First
.flexbox {
display flex
flex-direction row
flex-wrap nowrap
justify-content space-between
align-items center
align-content center
}
@kiennt2
kiennt2 / apache-nginx-ftp
Created June 20, 2019 07:42 — forked from solancer/apache-nginx-ftp
Correct permissions for /var/www/html
// Adding current user to www-data
sudo adduser $USER www-data
//change ownership to user:www-data and
sudo chown $USER:www-data -R /var/www/html
sudo chmod u=rwX,g=srX,o=rX -R /var/www/html
// change file permissions of existing files and folders to 755/644
sudo find /var/www/html -type d -exec chmod g=rwxs "{}" \;
@kiennt2
kiennt2 / Filter - Tree - JSON
Last active November 10, 2018 21:07
Filter - Tree - JSON
var data = [
{
name: 'a1', children: [
{
name: 'b1', children: [
{ name: 'gap' }, { name: 'bar' }
]
}
]
},
@kiennt2
kiennt2 / clip path hexagon rounded corners
Last active October 3, 2018 08:38
clip path hexagon rounded corners
<svg viewBox="0 0 1024 1024" style="width:100px;height:100px">
<defs>
<clipPath id="hexagon_clip">
<path id="hexagon" d="M75.094,306.009c0-27.5,19.413-61.375,43.14-75.277L468.861,25.286c23.727-13.902,62.553-13.902,86.28,0 l350.625,205.445c23.729,13.902,43.141,47.777,43.141,75.277v412c0,27.5-19.412,61.375-43.141,75.277L555.141,998.731 c-23.727,13.901-62.553,13.901-86.28,0L118.234,793.286c-23.727-13.902-43.14-47.777-43.14-75.277V306.009z" />
</clipPath>
</defs>
<image xlink:href="http://placehold.it/100x100" x="0" y="0" width="100%" height="100%" clip-path="url(#hexagon_clip)" />
<use xlink:href="#hexagon" x="0" y="0" stroke="#000" stroke-width="20" fill="transparent" />
</svg>
@kiennt2
kiennt2 / Multiple PHP versions
Created July 15, 2018 09:49
Multiple PHP versions
Multiple PHP versions, the easy way
5 min | by Michael Moravec – 27. 3. 2017
Always wanted to try or run your application with a different PHP version without breaking everything else? Why not, there is a way to run multiple versions in parallel!
Basics
There's a lot of use cases when one would need multiple PHP versions side by side. As an example, assume we have one legacy application and one modern application. The legacy one runs only on PHP 5.x whereas the modern one runs only on PHP 7.x. Virtually impossible and disjunctive setup you'd say, right? Before you start thinking about setting up second server with new PHP, consider the option of having two PHP versions side by side and letting your application choose one.
What do we need
@kiennt2
kiennt2 / Wordpress - nginx config
Created September 25, 2017 08:40
Wordpress - nginx config
server {
listen 80;
listen [::]:80;
server_name dev.domain.com;
root /home/kiennguyen/projects/foldername;
index index.php index.html index.htm;
@kiennt2
kiennt2 / Sublime - replace domain of special files
Created August 2, 2017 10:50
Sublime - replace domain of special files
(https?://[^\/]*?/)([^"]*?\.(jpg|png|js|webp|svg|css|pdf))
/media/courts-aws/assets/$2
@kiennt2
kiennt2 / M2 - remove base URL for files
Last active May 16, 2017 11:44
M2 - remove base URL for files
/vendor/magento/framework/View/Asset/File.php
public function getUrl()
{
return '/static/' . $this->getPath();
}
@kiennt2
kiennt2 / Magento 2 - nginx conf
Created April 19, 2017 04:20
Magento 2 - nginx conf
# cd /etc/nginx/
# sudo mkdir ssl
# sudo openssl req -x509 -sha256 -newkey rsa:2048 -keyout cert.key -out cert.pem -days 1024 -nodes -subj '/CN=www.domain.local'
upstream fastcgi_backend {
# use tcp connection
# server 127.0.0.1:9000;
# or socket
server unix:/run/php/php7.0-fpm.sock;
}