Skip to content

Instantly share code, notes, and snippets.

View samshameem's full-sized avatar

Shameem Ahmed Mulla samshameem

  • IonIdea Interactive Pvt. Ltd.
  • India
View GitHub Profile
@samshameem
samshameem / sorting.php
Created August 18, 2025 12:55
Sorting Alphanumeric string example
// ->order_by('REGEXP_REPLACE(mtd.mt_details_name, "[0-9]", ""), LENGTH(mtd.mt_details_name), mtd.mt_details_name','ASC', FALSE)->get()->result_array();
// ->order_by('REGEXP_SUBSTR(mtd.mt_details_name, "^[A-Za-z]+"), CAST(REGEXP_SUBSTR(mtd.mt_details_name, "[0-9]+") AS UNSIGNED), mtd.mt_details_name','ASC', FALSE)->get()->result_array();
->order_by('REGEXP_REPLACE(mtd.mt_details_name, "[0-9]+", LPAD("\\0", 5, "0"))','ASC', FALSE)->get()->result_array();
@samshameem
samshameem / main.py
Last active May 20, 2025 07:21
List All the API's
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from .access_control.middleware.error_handler import ExceptionHandler
from .access_control.middleware.auth_middleware import AuthMiddleware
from .access_control.middleware.rate_limiter import RateLimiter
from .access_control.routes import router as access_router
from .api.v1.routes import router as api_router
from itertools import count
app = FastAPI(
@samshameem
samshameem / HostNameRouter.php
Created October 21, 2024 18:01 — forked from chill117/HostNameRouter.php
Manage multiple hostnames (domains, sub-domains) within a single instance of CodeIgniter.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
Manage multiple hostnames (domains, sub-domains) within a single instance of CodeIgniter.
Example:
If you had the following domain/sub-domain style for your site:
your-domain.com
@samshameem
samshameem / my.cnf
Created September 25, 2023 12:31 — forked from Ishotihadus/my.cnf
Default my.cnf for MariaDB 10.3.12
# MariaDB database server configuration file.
#
# You can copy this file to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
@samshameem
samshameem / detecting-updated-data-attribute.js
Created September 7, 2022 05:54 — forked from brschwar/detecting-updated-data-attribute.js
Detect when an element's attribute value has changed (like mutation observer): example for 'data-select-content-val' that is updated with information dynamically.
$(function() {
// Here you register for the event and do whatever you need to do.
$(document).on('data-attribute-changed', function() {
var data = $('#contains-data').data('mydata');
alert('Data changed to: ' + data);
});
$('#button').click(function() {
$('#contains-data').data('mydata', 'foo');
// Whenever you change the attribute you will user the .trigger
@samshameem
samshameem / php-style-guide.md
Created August 26, 2022 06:14 — forked from ryansechrest/php-style-guide.md
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@samshameem
samshameem / countries.json
Created July 26, 2022 05:48 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@samshameem
samshameem / chmod_R.php
Created February 16, 2022 13:22 — forked from fitorec/chmod_R.php
Chmod Recursive for PHP.
<?php
/*
* Description: chmod recursive.
* Code-Base: official documentation php.net chmod function
* Link: http://www.php.net/manual/en/function.chmod.php#105570
*
* Example usage :
* chmod_R( 'mydir', 0666, 0777);
*
*/
@samshameem
samshameem / chmod_r.php
Created February 16, 2022 13:19 — forked from pnomolos/chmod_r.php
Recursive chmod for PHP
<?php
function chmod_R($path, $filemode = null, $dirmode = null, $skip_hidden = true) {
foreach (glob($path, GLOB_MARK) as $path) {
if ($skip_hidden && strpos($path, '.') === 0) {
continue;
}
if (is_dir($path)) {
if ($dirmode && !chmod($path, $dirmode)) {
$dirmode_str=decoct($dirmode);
print "Failed applying filemode '$dirmode_str' on directory '$path'\n";