Skip to content

Instantly share code, notes, and snippets.

View mohsinrasool's full-sized avatar
💪

Mohsin Rasool mohsinrasool

💪
View GitHub Profile
@mohsinrasool
mohsinrasool / MultiDimArrayPost.class.php
Last active February 27, 2024 19:57
Post multi-dimensional array using PHP Curl.
/**
* Post multi-dimensional array to a URL using PHP Curl.
* Usage:
* $req = new MultiDimArrayPost();
* $req->postToURL('http://xyz.com/post',$_POST);
*
* @package default
* @author Mohsin Rasool
*
**/
@mohsinrasool
mohsinrasool / Disable-PHP-Warnings.php
Created January 2, 2023 18:55
This WordPress mu-plugin disables php deprecated messages and warnings,
<?php
/*
Plugin Name: Disable PHP warnings
Description: This plugin disables php deprecated messages and warnings,
Version: 0.1
Author: mohsinrasool
Author URI: https://mohsinrasool.pk
*/
@mohsinrasool
mohsinrasool / .gitignore
Last active November 20, 2021 15:50 — forked from salcode/.gitignore
.gitignore file for WordPress - Bare Minimum Git
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
@mohsinrasool
mohsinrasool / script.js
Last active October 25, 2021 21:21
Convert Divi Tabs to Dropdown for Mobile
/** Step 1: Add "mobile-tab-dropdown" to Tab module
* Step 2: Add following script in Divi > Theme Options > Integration > "Add code to <body> tag"
*/
jQuery(document).ready(function () {
if($('.mobile-tab-dropdown').length) {
var html = '<div id="tabs-mobile-dropdown" class="dropdown" style="position: relative;width: 100%;margin: 10px 0;">'
html += '<select class="select-style " style="background: white;width: 100%;">';
$('.et_pb_tabs .et_pb_tabs_controls li').each(function() {
@mohsinrasool
mohsinrasool / bbpress-badgeos-user-achievements-under-avatar
Created August 21, 2015 14:27
This gists adds User's badges earned with badgeos plugin under his avatar in topics and replies of bbpress.
<?php
add_filter( 'bbp_get_reply_author_link', 'my_append_badges_via_filter', 10, 2 );
function my_append_badges_via_filter($author_link = '', $args) {
# Needed to get the user ID of the person intended to be displayed.
$user_id = bbp_get_reply_author_id( $args['post_id'] );
#Construct your output here.
$badge_output = '';
@mohsinrasool
mohsinrasool / year-directive.js
Created July 9, 2015 12:38
An AngularJS directive to create a dropdown of years
/**
* Usage: <year-select offset=0 range=10 />
*
*/
app.directive('yearSelect',function(){
var currentYear = new Date().getFullYear();
return {
restrict: 'AE',
replace: true,
@mohsinrasool
mohsinrasool / WPML: Minor edit checked by default
Created December 23, 2014 18:26
Enable the "Minor edit - dont'update translation" by WPML checkbox by default on post editing screen
/**
* Javascript added in admin screens
* 1. Enable the "Minor edit - dont'update translation" by WPML checkbox by default on post editing screen
*
* @return void
* @author mohsinrasool
**/
add_action('admin_footer', 'mr_admin_footer');
function mr_admin_footer()
/** Angular JS datepicker fix for mssql dates
*
*/
app.directive('datepickerLocaldate', ['$parse', function ($parse) {
var directive = {
restrict: 'A',
require: ['ngModel'],
link: link
};
@mohsinrasool
mohsinrasool / skyverge-interview-code-review-1.php
Created August 1, 2019 19:57
SkyVerge First Interview Code Review
<?php
/**
* This code retrieves course data from an external API and displays it in the user's
* My Account area. A merchant has noticed that there's a delay when loading the page.
*
* 1) What changes would you suggest to reduce or remove that delay?
* 2) Is there any other code changes that you would make?
*/
public function add_my_courses_section() {
// MR - Todos
@mohsinrasool
mohsinrasool / add-to-cart-variations.js
Created August 2, 2016 17:29
WooCommerce fix when product variations get removed after load.
/**
* This file contains the fix.
*/
/*global wc_add_to_cart_variation_params, wc_cart_fragments_params */
/*!
* Variations Plugin
*/
;(function ( $, window, document, undefined ) {