Skip to content

Instantly share code, notes, and snippets.

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

Fadli Saad fadlisaad

🏠
Working from home
View GitHub Profile
@fadlisaad
fadlisaad / gradient.css
Last active October 31, 2017 17:20
Gradient color background CSS
.gradient {
background: linear-gradient(308deg, #4091eb, #6f5dbe 59%, #8446aa 86%, #903a9f);
}
@fadlisaad
fadlisaad / nginx-instruction.md
Last active August 10, 2017 04:35
Letsencrypt manual renewal for nginx

First run this command in console:

certbot certonly --webroot -w /path/to/webroot/ -d domain.name

Then, create /etc/nginx/snippets/ssl-domain.name.conf

ssl on;
ssl_certificate /etc/letsencrypt/live/domain.name/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.name/privkey.pem;
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
location / {
if (!-e $request_filename){
rewrite ^(.+)$ /index.php?url=$1 break;
}
}
@fadlisaad
fadlisaad / datediff.php
Last active July 30, 2016 22:35
Calculate different between two date
<?php
function daysTo($from, $to, $round=true)
{
$diff = $to-$from;
$days = ($diff/86400)+1;
return $round==true ? floor($days) : round($days,2);
}
//usage
$from = strtotime($start_date); // tarikh mula