Skip to content

Instantly share code, notes, and snippets.

View mmarj's full-sized avatar
🏠
Spreading H@ppiness!!

MM Aurangajeb mmarj

🏠
Spreading H@ppiness!!
View GitHub Profile
@danjjohnson
danjjohnson / functions.php
Last active August 25, 2021 18:39
WPJM: Limit file upload size
<?php
function limit_upload_size_limit_for_non_admin( $limit ) {
if ( ! current_user_can( 'manage_options' ) ) {
$limit = 1000000; // 1mb in bytes
}
return $limit;
}
add_filter( 'upload_size_limit', 'limit_upload_size_limit_for_non_admin' );
@maateen
maateen / cellular-tax-calc.py
Created August 30, 2016 10:58
This will take a float number as input and show the total number with tax. (Bangladesh)
#/usr/bin/python3
print("Press 'Ctrl+C' to exit this tool.")
try:
while True:
print("\nPlease input price in BDT: ")
a = float(input())
b=a+((a*5)/100)
c=b+((b*15)/100)
d=c+((a*1)/100)
@eguven
eguven / brew-list.sh
Last active August 17, 2025 22:27
List all packages installed using Homebrew and their sizes
# this original one uses values returned from 'brew info'
brew list --formula | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
# faster alternative using 'du'
du -sch $(brew --cellar)/*/* | sed "s|$(brew --cellar)/\([^/]*\)/.*|\1|" | sort -k1h
@vovafeldman
vovafeldman / functions.php
Last active October 27, 2021 14:05
Freemius - weDocs Permalinks
<?php
/**
* Customize docs permalinks parsing.
*
* @author Vova Feldman
*/
function freemius_docs_permastruct_rewrite() {
if ( post_type_exists( 'docs' ) ) {
// Modify root slug to "help" instead of docs.
@vovafeldman
vovafeldman / _sections-header.scss
Last active October 27, 2021 14:01
Freemius - weDocs Pretty Sections
// Header search
.page-header
{
.wedocs-search-form
{
position: relative;
input
{
@include placeholder(#999);
@zacscott
zacscott / wpcom-cdn.php
Last active March 13, 2025 18:36
Use the WP.com Photon image CDN without installing JetPack
<?php
/**
* Plugin Name: Photon CDN
* Version: 1.1
* Description: Use the WP.com Photon image CDN without installing JetPack
* Author: Zachary Scott
*/
namespace zacscott;
anonymous
anonymous / vc-blocks-load.php
Created March 25, 2017 02:39
<?php
if (!defined('ABSPATH')) die('-1');
// Class started
class stockVCExtendAddonClass {
function __construct() {
// We safely integrate with VC with this hook
add_action( 'init', array( $this, 'stockIntegrateWithVC' ) );
@nuhil
nuhil / js.md
Last active July 1, 2024 20:45
Javascript Handbook
@chrismccoy
chrismccoy / gutenberg.txt
Last active September 26, 2025 12:19
Gutenberg Resources
Eliminate All Blocks from Editor
wp.data.dispatch( 'core/block-editor' ).resetBlocks([]);
How to Use WordPress Block Builder to Create Custom Page Layouts Easily
https://www.webfactoryltd.com/blog/how-to-use-wordpress-block-builder-to-create-custom-page-layouts-easily/
How to Extend or Create Variations for WordPress Blocks
https://getbutterfly.com/how-to-extend-or-create-variations-for-wordpress-blocks/
How to disable and lock Gutenberg blocks
@tylerlwsmith
tylerlwsmith / acf-google-maps.php
Created April 11, 2018 11:08
JavaScript-free implementation of Google Maps with WordPress Advanced Custom Fields
<?php
/**
* Set constants for Google Maps JS API key--used for ACF's backend map--and Google Maps
* Embed API Key, used for generating maps on the site front end.
*
* @link https://developers.google.com/maps/documentation/javascript/get-api-key
* @link https://developers.google.com/maps/documentation/embed/get-api-key
*/
const GOOGLE_MAPS_JS_API_KEY = 'MAPS-JS-API-KEY';