Skip to content

Instantly share code, notes, and snippets.

<?php
add_action( 'init', 'add_videos_endpoint' );
function add_videos_endpoint(){
add_rewrite_endpoint( 'videos', EP_ROOT | EP_PAGES );
}
function az_videos_query_vars( $vars ) {
$vars[] = 'videos';
@azinkey
azinkey / .htaccess
Created March 5, 2020 04:45
laravel root htaccess file for remove public/ keyword from url to make SEO friendly url
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
<?php
/* Plugin Name: Hire Me
* Plugin URI: https://www.kadamtech.com
* Description: Simple and Easy plugin to manage Hire Me Content
* Version: 1.0.0
* Author: AZinkey
* Author URI: https://www.kadams.in?hero=azinkey
* License: GPLv2 or later
*/
@azinkey
azinkey / ZipCF.php
Created September 4, 2019 06:59
Create a Zip with contents in the current Direcory (php script)
<?php
/**
* zipCF - Create Zip File with directory content
* Author : Abdul Awal
* Article Url: http://go.abdulawal.com/1
* Version: 1.1
* Released on: February 26 2016
* Updated On: July 02, 2018
*/
?>
@azinkey
azinkey / MySQL date range filters
Created July 31, 2019 06:45
MySQL date range filters example
switch ($date_range) {
case 'yesterday':
$sql .= " AND date_modified BETWEEN SUBDATE(CURDATE(), INTERVAL 1 DAY) AND NOW()";
break;
case 'this_week':
$sql .= " AND YEARWEEK(date_modified, 1) = YEARWEEK(CURDATE(), 1)";
break;
case 'last_week':
$sql .= " AND YEARWEEK(date_modified) = YEARWEEK(NOW() - INTERVAL 1 WEEK)";
break;
@azinkey
azinkey / getimagesizealt.php
Created July 1, 2019 05:44
getimagesize Alternative (Faster alrternate Method)
function getimagesizeAlt($image_url) {
$handle = fopen($image_url, "rb");
$contents = "";
if ($handle) {
do {
$count += 1;
$data = fread($handle, 8192);
if (strlen($data) == 0) {
break;
XYZ - ABC
example.com Document
version: 0.1
date: <DATE>
Status: Initial Release
Developed by: XYZ
(@person)
@azinkey
azinkey / MOM
Created June 21, 2019 10:04
Note down a meeting conversion and sent it via email in professional format
Hi Folks,
Please have a look XYZ MOM discussion points:
Participants:
ABC Person
Persone @2
@azinkey
azinkey / idToColor.js
Last active June 11, 2019 07:30
integer number(id) to color code (12345 => #ffffff)
function idToColor(id){
var clrs = [];
clrs[0] = ['1','3','5','7','9','A','B','C','D','E'];
clrs[1] = ['2','4','6','8','0','F','1','3','5','7'];
var min=0, max=1;
var minC=0, maxC=9;
var randomC = Math.floor(Math.random() * (+maxC - +minC)) + +minC;
var $id = (id.length < 6) ? id.padEnd(6, randomC ) : id.slice(-6);
var $chars = $id.split('');