Skip to content

Instantly share code, notes, and snippets.

View hasinhayder's full-sized avatar
🚀
Back on track, yayyyy!

Hasin Hayder hasinhayder

🚀
Back on track, yayyyy!
View GitHub Profile
@hasinhayder
hasinhayder / docker-compose.yml
Last active January 31, 2025 15:57
Quickly deploy mysql and phpMyAdmin with this docker compose file
services:
mysql:
image: mysql:8.4.3
restart: always
ports:
- 3306:3306
volumes:
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
@obiPlabon
obiPlabon / do-shortcode-callback.php
Created March 8, 2021 09:56
Call a shortcode function by tag name
<?php
/**
* Call a shortcode function by tag name.
*
* @param string $tag The shortcode whose function to call.
* @param array $atts The attributes to pass to the shortcode function. Optional.
* @param array $content The shortcode's content. Default is null (none).
*
* @return string|bool False on failure, the result of the shortcode on success.
*/
@obiPlabon
obiPlabon / elementor-disable-all-wp-widgets.php
Last active December 20, 2020 17:39
Disable or remove elementor widget from editor panel
<?php
/**
* Disable elementor registered widget.
*
* This will disable all WordPress native widgets
*
* @param \Elementor\Widgets_Manager $widgets_manager Instance of elementor widgets manager
*
* @author obiPlabon <https://obiPlabon.im>
*
@obiPlabon
obiPlabon / elementor-assign-category-snippet.php
Created December 11, 2020 10:44
Asssign any elementor widget to a different category
<?php
/**
* Asssign any elementor widget to a different category
*
* To override the existing category just pass [ 'your-custom-category' ]
* And to keep existing [ 'your-custom-category', 'basic' ]
* here 'your-custom-category' is any registered category slug
*
* @param array $config
@MichaelCurrin
MichaelCurrin / install_ruby_bundler.md
Last active February 21, 2025 05:53
Install Ruby and Bundler at the user level

Install Ruby and Bundler at the user level

Deprecated in favor of: gist.

Steps:

  1. Install Ruby at the user level.
    • Install with your package manager.
@parvezmrobin
parvezmrobin / intercepting http response.js
Last active September 18, 2020 15:08
Intercept / Log anything you write to your express response from anywhere from any file. Just add the following code to your `app.js`.
app.use((request, response, next) => {
// wheather `req.write` / `req.send` / `req.json`, express calls underlying `socket.write`
// thus intercepting `socket.write`
const backup = response.socket.write;
let code;
function newWriter(...args) {
for (const arg of args) {
if (typeof arg === 'string') {
@slava-vishnyakov
slava-vishnyakov / readme.md
Last active March 28, 2025 07:52
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@yaquawa
yaquawa / propagate_iframe_click_event.js
Created August 9, 2019 06:51
Propagate iframe click event
// Click event happened in iframe won't propagate to the containing element of it.
// This script provides a workaround to simulate the propagation of click event of iframe.
//
// inspired by https://gist.github.com/jaydson/1780598#gistcomment-2609301
(function ($) {
var selector = '[data-event-category][data-event-action]';
var $elementsContainIframe = $(selector).filter(function () {
return $(this).find('iframe,script').length;
@iqbalrony
iqbalrony / custom-icon-add-to-elementor.php
Last active February 10, 2025 22:58
Adding custom icon to icon control in Elementor.
<?php
/**
* Adding custom icon to icon control in Elementor
*/
function modify_icon_controls($controls_registry) {
//3696 material design icon classes
$material_design_icons_cls = 'mdi mdi-access-point, mdi mdi-access-point-network, mdi mdi-access-point-network-off, mdi mdi-account, mdi mdi-account-alert, mdi mdi-account-alert-outline, mdi mdi-account-arrow-left, mdi mdi-account-arrow-left-outline, mdi mdi-account-arrow-right, mdi mdi-account-arrow-right-outline, mdi mdi-account-badge, mdi mdi-account-badge-alert, mdi mdi-account-badge-alert-outline, mdi mdi-account-badge-horizontal, mdi mdi-account-badge-horizontal-outline, mdi mdi-account-badge-outline, mdi mdi-account-box, mdi mdi-account-box-multiple, mdi mdi-account-box-outline, mdi mdi-account-card-details, mdi mdi-account-card-details-outline, mdi mdi-account-check, mdi mdi-account-check-outline, mdi mdi-account-child, mdi mdi-account-child-circle, mdi mdi-account-circle, mdi mdi-account-circle-outline, mdi mdi-account-clock, mdi mdi-account-clock-
@iqbalrony
iqbalrony / Extend-exiting-Elementor-widget.php
Last active June 12, 2024 19:13
Add a custom control and render attribute to an existing Elementor widget
<?php
// This example will add a custom "select" drop down & "switcher" to the "testimonial" section
// and add custom "color" to the "testimonial style" section
add_action('elementor/element/before_section_end', 'add_control_in_existing_widget', 10, 3 );
function add_control_in_existing_widget( $section, $section_id, $args ) {
if( $section->get_name() == 'testimonial' && $section_id == 'section_testimonial' ){
// we are at the end of the "section_testimonial" area of the "testimonial"
$section->add_control(
'testimonial_name_title_pos' ,
[