Articles with category - PHP

Use Tailwind in Laravel

Posted on 1 year ago by Ping Cheng

Tailwind a very low-level CSS framework that only includes classes but does not contain any pre-defined components. This means you can define your own component styles without override the styles come with the CSS framework.

To have a better understanding of Tailwind, please read the official website: https://tailwindcss.com

Here are the steps that integrates the tailwind into your Laravel project:

Install

First, let's install the tailwind itself

# Using npm
npm install tailwindcss

# Using Yarn
yarn add tailwindcss

Then, let's install the PurgeCSS to cut off classes that we did not use to save our final css file size

# Using npm
npm install laravel-mix-purgecss --save-dev

# Using Yarn
yarn add laravel-mix-purgecss --dev

Create a configuration file

npx tailwind init

After ran the above command, you will find tailwind.config.js was generated on your project root directory.

Import Tailwind

Afte

...

[ Read More ]


Install Python 3.7 on CentOS 7

Posted on 1 year ago by Ping Cheng

CentOS series natively comes with Python 2 installed, since there are some system level parts are depending on python 2, it is not safe and easily to replace python 2 with python 3.

Therefore, this article would express install python with altinstall.

Step 1 Install dependency

yum install gcc openssl-devel bzip2-devel libffi-devel wget

Step 2 Download Python 3 source code

cd ~
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
tar xzf Python-3.7.2.tgz

Step 3 Install

cd Python-3.7.2.tgz
./configure --enable-optimizations
make altinstall

Note, if you encountered some error message such as no permission, please use sudo.

Verify

python3.7 -V
Python 3.7.2

python -V
Python 2.7.5

Create new swap file on CentOS 7 / RHEL 7

Posted on 1 year ago by Ping Cheng

Shared from https://sharadchhetri.com/2014/12/01/create-new-swap-file-centos-7-rhel-7/

In this tutorial we will learn how to create new swap file on CentOS 7 / RHEL 7. Generally on Cloud Servers ( AWS/ DigitalOcean) or VPS, swap space is not created by default. This requirement we can achieve within a few steps.

Prerequisites

Must have free space on mounted disk. You can check by using df -Th command.

Steps to create / add new swap file on Linux

1. Create swapfile-additional file with dd command in / (root). You can select any other partition but it should be mounted (For eg. /opt, /usr ,/NewMountedPartition)

dd if=/dev/zero of=/swapfile-additional bs=1M count=4048

dd = It is a unix command used for convert and copy a file
if = read from FILE instead of stdin
/dev/zero = /dev/zero is a special file in Unix-like operating systems that provides as many null characters (ASCII NUL, 0x00) as are read from it
of = write to FILE instead of

...

[ Read More ]

Search
Hand crafted with by Ping Cheng