Skip to content

Instantly share code, notes, and snippets.

jQuery(document).ready(function($) {
jQuery('button.btn').click(function() {
var submit_value = jQuery(this).attr("value");
var ajax_contact_form = "#ajax-contact-form-"+submit_value;
jQuery(ajax_contact_form).submit(function(e){
var cat_name = jQuery("select#cat_name-"+submit_value+" option:selected").val();
@MervinPraison
MervinPraison / breadcrumb-filter.php
Last active December 23, 2016 11:08
breadcrumb-filter.php
// define the wpseo_breadcrumb_single_link callback
function filter_wpseo_breadcrumb_single_link( $link_output, $link ) {
// make filter magic happen here...
foreach($link_output as $keys => $link_out ){
foreach ($link_out as $key=>$value) {
if($key=='term') {
if(get_term_meta( $value->term_taxonomy_id, 'post_url', true ))
@MervinPraison
MervinPraison / gruntfile.js
Last active June 23, 2017 15:07
Grunt Minify and Combine + Minify CSS
module.exports = function(grunt) {
grunt.initConfig({
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
@MervinPraison
MervinPraison / gruntfile.js
Created June 23, 2017 15:07
Grunt Minify CSS
module.exports = function(grunt) {
grunt.initConfig({
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
@MervinPraison
MervinPraison / gruntfile.js
Created June 23, 2017 15:08
Grunt Minify and Combine CSS
module.exports = function(grunt) {
grunt.initConfig({
cssmin: {
target: {
files: [{
expand: true,
cwd: 'release/css',
src: ['*.css', '!*.min.css'],
dest: 'release/css',
@MervinPraison
MervinPraison / gist:e15aa6b8bed77bd2d3eea34dfd3b84e9
Created July 25, 2017 08:28 — forked from wrburgess/gist:3711050
Permanently remove file from Git history

Reference

Remove sensitive files from Git/Github

In Terminal

git filter-branch --index-filter 'git rm --cached --ignore-unmatch [file path/name]' --prune-empty --tag-name-filter cat -- --all

Example:

@MervinPraison
MervinPraison / whatissoslow.php
Created July 25, 2017 08:29 — forked from Viper007Bond/whatissoslow.php
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
@MervinPraison
MervinPraison / custom-http-requests-timeout.php
Last active September 6, 2017 11:41 — forked from samuelaguilera/custom-http-requests-timeout.php
cURL error 28: Operation timed out error
<?php
// NOTE: THE CODE TO COPY/PASTE STARTS *BELOW* THIS LINE
// Setting a custom timeout value for cURL.
//Using a high value for priority to ensure the function runs after any other added to the same action hook.
add_action('http_api_curl', 'sar_custom_curl_timeout', 9999, 1);
function sar_custom_curl_timeout( $handle ){
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 30 ); // 30 seconds. Too much for production, only for testing.
curl_setopt( $handle, CURLOPT_TIMEOUT, 30 ); // 30 seconds. Too much for production, only for testing.
}
@MervinPraison
MervinPraison / Creating-Tables-Boilerplate-WordPress-Plugin.php
Created September 7, 2017 10:57
Creating Tables Boilerplate WordPress Plugin
<?php
/**
* @package Creating Tables Boilerplate WordPress Plugin
* @version 1.0
*/
/*
Plugin Name: Creating Tables Boilerplate WordPress Plugin
Plugin URI: https://praison.com/
Description: Creating Tables Boilerplate WordPress Plugin
Author: Mervin Praison
@MervinPraison
MervinPraison / gulpfile.js
Last active January 16, 2018 12:01
Gulpfile.js Example
var gulp = require('gulp'),
sass = require('gulp-sass');
var sassConfig = {
inputDirectory: 'resources/sass/**/*.scss',
outputDirectory: 'assets/css',
options: {
outputStyle: 'expanded'
}
}