Skip to content

Instantly share code, notes, and snippets.

View raihan-uddin's full-sized avatar
🎯
Focusing

Md. Raihan Uddin raihan-uddin

🎯
Focusing
View GitHub Profile
DELIMITER $$
CREATE EVENT employeeResign
ON SCHEDULE EVERY 2 MINUTE
DO
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE rowId INT;
DECLARE employeeId INT;
ALTER TABLE `employees` ADD `last_increment_date` DATE NULL DEFAULT NULL AFTER `signature_by`, ADD `last_increment_amount` DOUBLE NULL DEFAULT NULL AFTER `last_increment_date`;
ALTER TABLE `employees` CHANGE `contact_end` `contact_end` DATE NULL DEFAULT NULL;
ALTER TABLE `complain_sheet2` CHANGE `qc_remarks` `qc_remarks` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
https://averagelinuxuser.com/after-installing-ubuntu-20-04/
https://ubuntuhandbook.org/index.php/2021/10/top-things-ubuntu-21-10-desktop/
php multiple version on same time
https://devanswers.co/run-multiple-php-versions-on-apache/
php switch version
https://tecadmin.net/install-php-ubuntu-20-04/
@raihan-uddin
raihan-uddin / gist:6498d7ac4a9252f36e03126a416b4ecc
Created November 1, 2021 03:37
MySQL monthly Sale of last 12 months including months with no Sale
SELECT
SUM(IF(month = 'Jan', total, 0)) AS 'Jan',
SUM(IF(month = 'Feb', total, 0)) AS 'Feb',
SUM(IF(month = 'Mar', total, 0)) AS 'Mar',
SUM(IF(month = 'Apr', total, 0)) AS 'Apr',
SUM(IF(month = 'May', total, 0)) AS 'May',
SUM(IF(month = 'Jun', total, 0)) AS 'Jun',
SUM(IF(month = 'Jul', total, 0)) AS 'Jul',
SUM(IF(month = 'Aug', total, 0)) AS 'Aug',
SUM(IF(month = 'Sep', total, 0)) AS 'Sep',
@raihan-uddin
raihan-uddin / find all IDs of children recursively.txt
Last active September 5, 2021 05:22
Managing Hierarchical Data in MySQL
http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/
//SELECT t1.title, t1.id, t1.root FROM chart_of_ac AS t1 LEFT JOIN chart_of_ac as t2 ON t1.id = t2.root WHERE t2.id IS NULL AND t1.title like '%cash%'
select leaf node of a parant
//SELECT TRIM(RIGHT(TRIM(concat_ws(' ', ifnull(t1.id,''), ifnull(t2.id,''), ifnull(t3.id,''), ifnull(t4.id,'') )),20)) as id FROM chart_of_ac AS t1 LEFT JOIN chart_of_ac AS t2 ON t2.root = t1.id LEFT JOIN chart_of_ac AS t3 ON t3.root = t2.id LEFT JOIN chart_of_ac AS t4 ON t4.root = t3.id WHERE t1.id = '3' ORDER BY t1.title
Problem 1: count elements
input:
list = [50, 20, 11, 5, 7, 50, 7]
output:
dict {5: 1, 7 : 2, 11: 1, 20: 1, 50: 2}
Problem 2:
n_list = [5,6,8,10, 9,12]
op_list = [6,8,10,12]
<?php
// Your code here!
// Method: POST, PUT, GET etc
// Data: array("param" => "value") ==> index.php?param=value
function CallAPI($method, $url, $data = false)
{
$curl = curl_init();
switch ($method)
@raihan-uddin
raihan-uddin / How-to.md
Created January 20, 2021 04:57 — forked from ux-powered/How-to.md
Deploy a Laravel-Vue project to a subdirectory

The guide how to deploy a Laravel-Vue project to a subdirectory.

Let's assume we want to deploy our app to http://example.com/projects/laravel-vue-demo/. Here's what you will need to do:

  1. Add the next keys to your .env config:
APP_PUBLIC_PATH=
VUE_PUBLIC_PATH=/
MYSQL CONFIGURATION:
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
## Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
#----------------------------------------------------
# !!!! Query Cache Config !!!!
#----------------------------------------------------
/* Initialise the date picker. */
if (!$.datepicker.initialized) {
$(document).mousedown($.datepicker._checkExternalClick)
.find(document.body).append($.datepicker.dpDiv); // added line
$.datepicker.initialized = true;
}