Skip to content

Instantly share code, notes, and snippets.

View bishwajitme's full-sized avatar

Bishwajit Halder bishwajitme

View GitHub Profile
@bishwajitme
bishwajitme / get-page-by-slug.php
Created April 6, 2021 07:45 — forked from matheuseduardo/get-page-by-slug.php
get_page_by_slug - wordpress
<?php
/**
* Retrieve a page given its slug.
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $page_slug Page slug
* @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
* Default OBJECT.
* @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
@bishwajitme
bishwajitme / label-to-placeholder.js
Created February 6, 2021 11:34 — forked from makeusabrew/label-to-placeholder.js
Simple jQuery snippet to convert form labels into inline placeholders
$("form :input").each(function(index, elem) {
var eId = $(elem).attr("id");
var label = null;
if (eId && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1) {
$(elem).attr("placeholder", $(label).html());
$(label).remove();
}
});
<?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
@bishwajitme
bishwajitme / breadcrumbs-functions.php
Created November 20, 2020 16:50 — forked from tinotriste/breadcrumbs-functions.php
Wordpress: Breadcrumbs function
<?php
/*=============================================
= BREADCRUMBS =
=============================================*/
// to include in functions.php
function the_breadcrumb() {
$sep = ' > ';
@bishwajitme
bishwajitme / pearson-correlation.js
Created November 29, 2018 19:33 — forked from matt-west/pearson-correlation.js
Pearson Correlation (JavaScript)
/**
* @fileoverview Pearson correlation score algorithm.
* @author matt.west@kojilabs.com (Matt West)
* @license Copyright 2013 Matt West.
* Licensed under MIT (http://opensource.org/licenses/MIT).
*/
/**
* Calculate the person correlation score between two items in a dataset.
@bishwajitme
bishwajitme / config.py
Created December 21, 2017 23:57 — forked from bonzanini/config.py
Twitter Stream Downloader
consumer_key = 'your-consumer-key'
consumer_secret = 'your-consumer-secret'
access_token = 'your-access-token'
access_secret = 'your-access-secret'