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 / 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";
@samshameem
samshameem / post-merge
Created December 28, 2021 13:55 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
Angular CLI version Angular version Node.js version TypeScript version
- 2.x 6.0.x or later minor version 2.0.x
1.0.6 4.x 6.9.x or later minor version 2.2.x
1.1.3 4.x 6.9.x or later minor version 2.3.x
1.2.7 4.x 6.9.x or later minor version 2.3.x
1.3.2 4.2.x or later minor version 6.9.x or later minor version 2.4.x
1.4.10 4.2.x or later minor version 6.9.x/8.9.x or later minor version 2.4.x
(1.5.6) 5.0.x 6.9.x/8.9.x or later minor version 2.4.x
1.5.6 5.1.x 6.9.x/8.9.x or later minor version 2.5.x
1.6.7 5.2.x or later minor version 6.9.x/8.9.x or later minor version 2.5.x