Skip to content

Instantly share code, notes, and snippets.

View khairulhasanmd's full-sized avatar

Md. Khairul Hasan khairulhasanmd

View GitHub Profile
@khairulhasanmd
khairulhasanmd / query.sql
Created April 4, 2024 05:56
Mysql Get child table data as json in same row
SELECT a.id, a.product_name, a.pdf_url,
JSON_ARRAYAGG(
JSON_OBJECT(
'id', c.id,
'name', c.name
)
) AS tag
FROM products a
LEFT JOIN product_tags b ON (a.id = b.product_id)
LEFT JOIN tags c ON (b.tag_id = c.id)
@khairulhasanmd
khairulhasanmd / common.txt
Created December 8, 2021 08:03 — forked from saniyathossain/common.txt
Stacks, Coding Guidelines, Acronyms
STACKS:
Project management: Agile, Scrum, JIRA (tool)
Version Control: GIT, Github (Repo), Gitlab (Repo), Bitbucket (Repo), Azure (Repo)
Back-end: PHP (MVC (Model View Controller): Laravel, CakePHP, Symphony, Codeigniter, YII, micro-framework: Lumen, Slim), CMS (Content Management System): Wordpress, Prestashop, Joomla, Magento, Opencart
ORM (Object Relational Mapping): Eloquent (Built in with laravel framework), CakePHP ORM (Built in with CakePHP framework), RedBeanPHP
PHP modules: PHP FPM, PHP CLI
Unit Test: PHPUnit, Codeception, PEST (framework)
Async PHP: Swoole, ReactPHP, Laravel Octane
Cache: File, Memcache, Redis, Database
For a very fragile workaround, you can edit /usr/lib/python3/dist-packages/certbot_nginx/configurator.py and replace
return [challenges.HTTP01, challenges.TLSSNI01]
with
return [challenges.HTTP01]
(or you… can use the webroot plugin)

Using Git to Manage a Live Web Site

###Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

####Contents

@khairulhasanmd
khairulhasanmd / time-reqd.php
Last active July 13, 2017 06:26
php time required for a code run in seconds
<?php
$start = microtime(true);
//some code
$now = microtime(true);
echo $now - $start . '<br>';
$start = $now;
onchange="check_start_date(this)"
function check_start_date1(object) {
var name = 'input[name="' + object.name + '"]';
var objects = $(name);
var index = objects.index( object );
var leave_type_id = document.getElementsByName('leave_type_id[]');
var detail_start_date = document.getElementsByName('detail_start_date[]');
@khairulhasanmd
khairulhasanmd / jsidle.js
Created April 23, 2017 05:38
js idle detection
var timeout = null;
$(document).on('mousemove', function() {
if (timeout !== null) {
$(document.body).text('');
clearTimeout(timeout);
}
timeout = setTimeout(function() {
$(document.body).text('Mouse idle for 3 sec');
@khairulhasanmd
khairulhasanmd / controller and model functions list.php
Created April 22, 2017 06:11
controller and model functions list
<?php
public function test($value='')
{
echo '<h2>Controller</h2>'.$this->router->class.'<pre>';
$mthds = (get_class_methods ( $this->router->class ));
foreach ($mthds as $key => $value) {
echo $value.'<br>';
}
echo '</pre><h2>Model</h2>';
echo '<pre>'.$this->router->class.'_mdl';
@khairulhasanmd
khairulhasanmd / rest.php
Last active December 17, 2016 04:02
Rest API
//receiver
CREATE TABLE `sync` (
`name` varchar(100) NOT NULL,
`id` int(11) NOT NULL,
`address` varchar(100) NOT NULL,
`phone` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@khairulhasanmd
khairulhasanmd / biscuit.htm
Created September 25, 2016 04:37
taken from mdn
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.biscuit {
display: inline-block;
min-width: 20px;
vertical-align: baseline;
margin-left: 10px;
border-radius: 2px;