Skip to content

Instantly share code, notes, and snippets.

View mahbubme's full-sized avatar
🤞
Focusing

Mahbubur Rahman mahbubme

🤞
Focusing
View GitHub Profile
@mahbubme
mahbubme / DNS Prefetch domains
Created October 8, 2021 09:19 — forked from lukecav/DNS Prefetch domains
WP Rocket - Advanced Options Prefetch DNS requests examples
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
name: Version checks
on:
push:
branches:
- master
pull_request:
jobs:
# Compares the header information in the readme.txt and the main plugin file
@mahbubme
mahbubme / form-conversion.js
Last active September 21, 2020 15:14
Track MonsterInsights forms
const submitButtons = document.querySelectorAll("input[type='submit']");
submitButtons.forEach( formButton => {
formButton.addEventListener(
"click",
function (evt) {
__gaTracker(
"send",
"event",
"form",
"conversion",
@mahbubme
mahbubme / functions.php
Last active August 21, 2019 04:12
Update _EventStartDateUTC & _EventEndDateUTC meta of tribe events.
<?php
// update utc time for tribe events
function wpuf_update_event_details( $post_id, $form_id, $form_settings, $form_vars ) {
if ( !empty( $post_id ) && !empty( $form_settings['post_type'] ) && $form_settings['post_type'] == 'tribe_events' ) {
$eventStartDate = isset( $_POST['_EventStartDate'] ) ? $_POST['_EventStartDate'] : '';
$eventEndDate = isset( $_POST['_EventEndDate'] ) ? $_POST['_EventEndDate'] : '';
if ( !empty( $eventStartDate ) || !empty( $eventEndDate ) ) {
update_post_meta( $post_id, '_EventStartDateUTC', $eventStartDate );
@mahbubme
mahbubme / solution.php
Created May 14, 2019 04:39
Hide posts tab from WPUF account page
<?php
function wpuf_sections_customize($sections){
$posts_tab_index = null;
foreach ($sections as $index => $value) {
if ($value['slug'] == 'posts') {
$posts_tab_index = $index;
}
}
@mahbubme
mahbubme / solution.php
Created December 28, 2018 05:12
Function to return WPUF edit post URL
<?php
function wpuf_post_edit_link() {
global $post;
$edit_page = (int) wpuf_get_option( 'edit_page_id', 'wpuf_frontend_posting' );
$post_id = $post->ID;
$url = add_query_arg( array('pid' => $post->ID), get_permalink( $edit_page ) );
return wp_nonce_url( $url, 'wpuf_edit' );
}
@mahbubme
mahbubme / solution.php
Last active September 3, 2020 22:11
Change WPUF default thumbnail image
<?php
function wpuf_default_featured_image() {
return "https://mahbub.me/wp-content/uploads/2017/01/i.png"
}
add_filter( "wpuf_no_image", "wpuf_default_featured_image" );
/**
* Don't change these constants!
*/
const DODGER = document.getElementById('dodger')
const GAME = document.getElementById('game')
const GAME_HEIGHT = 400
const GAME_WIDTH = 400
const LEFT_ARROW = 37 // use e.which!
const RIGHT_ARROW = 39 // use e.which!
const ROCKS = []
@mahbubme
mahbubme / ACF Country List
Created October 3, 2018 04:12 — forked from yaronguez/ACF Country List
Country list formatted for Advanced Custom Fields select dropdown
afghanistan : Afghanistan
albania : Albania
algeria : Algeria
american_samoa : American Samoa
andorra : Andorra
angola : Angola
anguilla : Anguilla
antigua_and_barbuda : Antigua and Barbuda
argentina : Argentina
armenia : Armenia
@mahbubme
mahbubme / criticalcss-bookmarklet-devtool-snippet.js
Created September 21, 2018 06:41 — forked from PaulKinlan/criticalcss-bookmarklet-devtool-snippet.js
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");