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 / datediff.php
Last active July 30, 2016 22:35
Calculate different between two date
View datediff.php
function daysTo($from, $to, $round=true)
$diff = $to-$from;
$days = ($diff/86400)+1;
return $round==true ? floor($days) : round($days,2);
$from = strtotime($start_date); // tarikh mula
View gist:f6cbaaf2ef980a0a3536957ec4f5004c
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 /
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

Then, create /etc/nginx/snippets/

ssl on;
ssl_certificate /etc/letsencrypt/live/;
ssl_certificate_key /etc/letsencrypt/live/;
fadlisaad / gradient.css
Last active October 31, 2017 17:20
Gradient color background CSS
View gradient.css
.gradient {
background: linear-gradient(308deg, #4091eb, #6f5dbe 59%, #8446aa 86%, #903a9f);
fadlisaad /
Created September 24, 2018 03:15
Backup database using mysqldump with daily, weekly and monthly incremental
# Preventive Maintenance Script
# Coded by Pikri Mohammad
# Updated on 5 April 2017
fadlisaad / update.sql
Last active October 2, 2021 14:36
Find and replace Wordpress
View update.sql
UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, '','');
UPDATE wp_posts SET post_content = replace(post_content, '', '');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'','');
fadlisaad / Set.sql
Created December 12, 2021 12:26
SQL full mode
View Set.sql
SET GLOBAL sql_mode=(REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))
fadlisaad / gist:208ce0420aa9f120cfb343c07a0d3ea5
Created December 16, 2021 05:50
Generate self-signed certificate
View gist:208ce0420aa9f120cfb343c07a0d3ea5
openssl req -x509 -newkey rsa:2048 -keyout private-key.pem -out public.pem -sha256 -nodes -days 365
fadlisaad / README.txt
Created April 5, 2022 02:56
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at
View README.txt
Remix example project is present when Remix loads for the very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
fadlisaad / contracts...3_Coda.sol
Created April 5, 2022 02:58
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at
View contracts...3_Coda.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.4.24;
//Safe Math Interface
contract SafeMath {
function safeAdd(uint a, uint b) public pure returns (uint c) {
c = a + b;