Skip to content

Instantly share code, notes, and snippets.

View mayeenulislam's full-sized avatar
🤖
AI won't replace you

Mayeenul Islam mayeenulislam

🤖
AI won't replace you
View GitHub Profile
@mayeenulislam
mayeenulislam / privateGPT.md
Created March 22, 2024 05:41
Installing PrivateGPT on an Apple M3 Mac

Installing PrivateGPT on an Apple M3 Mac

# clone the repo and get into it
git clone https://github.com/imartinez/privateGPT && cd privateGPT

# install Python 3.11
pyenv install 3.11

# install make for running various scripts
@mayeenulislam
mayeenulislam / Default Taxonomy Term for CPT
Last active April 5, 2023 11:07
Make Default taxonomy term for Custom Post Type - WordPress
/**
* Author: Michael Fields
* Source: http://wordpress.mfields.org/2010/set-default-terms-for-your-custom-taxonomies-in-wordpress-3-0/
* Thanks a lot for the nice tweak
*/
/**
* Define default terms for custom taxonomies in WordPress 3.0.1
*
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', 'put your unique phrase here');
@mayeenulislam
mayeenulislam / app.css
Last active January 20, 2023 08:42
Multiple columns using PHP Loop
.test{
color: red;
font-size: 16px;
}
.content-body{
font-family: 'Siyam Rupali', 'SolaimanLipi', Vrinda, Arial, Helvetica, sans-serif;
font-size: 16px;
box-shadow: inset 1px -1px 1px #444,inset -1px 1px 1px #444; /* to make a border-like appearance */
width: 100%; /* to get the full width */
@mayeenulislam
mayeenulislam / css-tooltip.css
Last active January 20, 2023 06:08
CSS Tooltip and <acronym> tag
abbr {
position: relative;
cursor: pointer;
}
abbr:hover::after {
content: attr(title);
position: absolute;
white-space: nowrap;
background-color: #666;
@mayeenulislam
mayeenulislam / find-hidden-fields-blocking-foms.html
Created July 31, 2022 04:57
Find the hidden fields hidden, and are blocking the form submission. Source: cannot remember
<html>
<body>
<form id="my-form-id-here">
<input type="text" style="display: none"><br/>
<input type="text">
<button type="submit">Submit</button>
</form>
<script>
var targetForm = document.getElementById('my-form-id-here');
@mayeenulislam
mayeenulislam / english_to_bangla.js
Last active February 24, 2022 10:55 — forked from sharif2008/english_to_bangla.js
Converting English number to Bangla in Javascript
var finalEnlishToBanglaNumber={'0':'০','1':'১','2':'২','3':'৩','4':'৪','5':'৫','6':'৬','7':'৭','8':'৮','9':'৯'};
String.prototype.getDigitBanglaFromEnglish = function() {
var retStr = this;
for (var x in finalEnlishToBanglaNumber) {
retStr = retStr.replace(new RegExp(x, 'g'), finalEnlishToBanglaNumber[x]);
}
return retStr;
};
@mayeenulislam
mayeenulislam / truncateAmount.php
Last active September 5, 2021 06:02
Truncate amount in Indian money format like Lakh, Koti (Lac, Crore), and in US money format like Million, Billion, Trillion etc.
<?php
/**
* Truncate Amount (in Indian format).
*
* Return amount in lac/koti etc.
*
* @param integer $amount Amount.
*
* @link https://stackoverflow.com/q/42571702/1743124 (Concept)
*
@mayeenulislam
mayeenulislam / pending-post-bubble-in-admin-menu.php
Last active July 13, 2021 22:27
Show a pending posts count on Custom Post Type menu label like Plugin Update Notification count. Thanks to Samik Chattopadhyay for the nice snippet.
/**
* Get posts pending count as per Post Type.
* @param string $post_type
* @return integer Pending count.
*/
function project_get_pending_items( $post_type ) {
global $wpdb;
$pending_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = %s AND post_status = 'pending'", $post_type ) );
return (int) $pending_count;
}
@mayeenulislam
mayeenulislam / file-upload.html
Last active June 4, 2020 11:01
This is a demonstration (aka demo) of the setup of jQuery File Upload in a standalone file input. We're *not using* the `UI version` and the default validation was not working for us, so we ditched those and followed community provided raw checkup. Thanks to the StackOverflow thread for guiding to achieve my need: https://stackoverflow.com/q/174…
<!--
jQuery File Upload UI
jQuery File Upload is a huge plugin with a lot of functionalities.
And that made this a bit complex to find out how to implement a
basic upload feature like:
1. Multiple file upload
2. Validate on file types
3. Validate on file size