Skip to content

Instantly share code, notes, and snippets.

View kish2011's full-sized avatar
🏠
Working from home

Kishore Chandra Sahoo kish2011

🏠
Working from home
View GitHub Profile
@kish2011
kish2011 / compareimage.php
Created November 20, 2017 16:11 — forked from petecoop/compareimage.php
Using PHP's GD library compares the similarity between 2 images with the same dimensions. This is based on the colour's in spread out positions and returns a rating out of 100.
<?php
function compareImages($imagePathA, $imagePathB, $accuracy){
//load base image
$bim = imagecreatefromjpeg($imagePathA);
//create comparison points
$bimX = imagesx($bim);
$bimY = imagesy($bim);
$pointsX = $accuracy*5;
$pointsY = $accuracy*5;
$sizeX = round($bimX/$pointsX);
@kish2011
kish2011 / ngrok-installation.md
Created June 16, 2017 09:45 — forked from jwebcat/ngrok-installation.md
Installing ngrok on Mac

#Installing ngrok on OSX

  1. Download ngrok
  2. Unzip it to your Applications directory
  3. Create a symlink (instructions below)

Creating a symlink to ngrok

Run the following two commands in Terminal to create the symlink.

# cd into your local bin directory
@kish2011
kish2011 / remove_preview_step_wpjm.php
Created June 6, 2017 08:37 — forked from danfisher85/remove_preview_step_wpjm.php
Remove preview step for job and resume (WP Job Manager)
/**
* Remove the preview step for Job
* @param array $steps
* @return array
*/
if ( !function_exists( 'handyman_custom_submit_job_steps' ) ) {
function handyman_custom_submit_job_steps( $steps ) {
unset( $steps['preview'] );
return $steps;
}
@kish2011
kish2011 / Contract Killer 3.md
Created March 28, 2017 17:00
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@kish2011
kish2011 / functions.php
Created March 23, 2017 09:26 — forked from tripflex/functions.php
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
* to a class, you either have to have access to that class object, or it has to be a call
* to a static method. This method allows you to remove filters with a callback to a class
* you don't have access to.
*
* Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* WP_Job_Manager_Form_Register class.
*/
class WP_Job_Manager_Form_Register extends WP_Job_Manager_Form {
public static $form_name = 'register';
protected static $job_id;
protected static $preview_job;
protected static $steps;
@kish2011
kish2011 / functions.php
Created February 19, 2017 05:14 — forked from danjjohnson/functions.php
WP Job Manager: Append the post id to the permalink slug
function custom_job_post_type_link( $post_id, $post ) {
// don't add the id if it's already part of the slug
$permalink = $post->post_name;
if ( strpos( $permalink, strval( $post_id ) ) ) {
return;
}
// unhook this function to prevent infinite looping
remove_action( 'save_post_job_listing', 'custom_job_post_type_link', 10, 2 );
@kish2011
kish2011 / wordpress-plugin-svn-to-git.md
Created January 17, 2017 16:47 — forked from kasparsd/wordpress-plugin-svn-to-git.md
Using Git with Subversion Mirroring for WordPress Plugin Development
@kish2011
kish2011 / gist:193e95473a54e1b39f88ed6f67eb6be5
Created January 12, 2017 06:45 — forked from cubehouse/gist:3839159
WordPress Fake Page Generator - Use in Theme/Plugin to create non-existant pages dynamically
// create fake page called "chat-room"
// modify function and variable names with "ABCD" to whatever you like
// modify variable $fakepage_ABCD_url to the fake URL you require
add_filter('the_posts','fakepage_ABCD_detect',-10);
function fakepage_ABCD_detect($posts){
global $wp;
global $wp_query;
global $fakepage_ABCD_detect; // used to stop double loading

Combine, Minify and Inline CSS In WordPress, in the correct order

Installation

Use copypasta to add to a sub-dir of mu-plugins or use Composer:

  "require": {
 "shelob9/css-inliner" : "*"