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
@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
@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') {
@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 April 4, 2023 12:31
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' ,
[
@oseme-techguy
oseme-techguy / Correct_GnuPG_Permission.sh
Last active June 9, 2024 07:46
This fixes the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error while using Gnupg .
#!/usr/bin/env bash
# To fix the " gpg: WARNING: unsafe permissions on homedir '/home/path/to/user/.gnupg' " error
# Make sure that the .gnupg directory and its contents is accessibile by your user.
chown -R $(whoami) ~/.gnupg/
# Also correct the permissions and access rights on the directory
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
@dac514
dac514 / EventEmitter.php
Last active November 4, 2022 19:52
Refactor Your Slow Form Using PHP Generators and Event Streams
<?php
/**
* @license GPLv3 (or any later version)
* @see http://kizu514.com/blog/refactor-your-slow-form-using-php-generators-and-event-streams/
*/
namespace KIZU514;
class EventEmitter
{
@onetdev
onetdev / example.html
Last active December 12, 2022 19:15
VideoJS + XHR mod : Adding XHR interceptor
<link media="all" rel="stylesheet" href="https://unpkg.com/video.js@7.1.0/dist/video-js.css">
<script src="https://unpkg.com/video.js@7.1.0/dist/video.js"></script>
<video-js id="player">
<source src="//video/index.m3u8" type="application/x-mpegURL" />
</video-js>
<script>
var player = videojs("player");
var prefix = "key://";
var urlTpl = "https://domain.com/path/{key}";