Skip to content

Instantly share code, notes, and snippets.

View smjuber's full-sized avatar
🙂
Howdy, Stranger.

Mehadi Hasan Juber smjuber

🙂
Howdy, Stranger.
View GitHub Profile
@gam3ov3r
gam3ov3r / gist:2724041
Created May 18, 2012 08:44 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@jazzsequence
jazzsequence / more_human_time_diff.php
Created June 1, 2012 23:19
a better WordPress human_time_diff
<?php
$last_modified = human_time_diff( the_modified_date('U','','', false), current_time('timestamp') );
$number_of_x = preg_replace('/[^0-9]*/', '', $last_modified);
if ( strpos( $last_modified, 'min' ) || strpos( $last_modified, 'hour' ) || strpos($last_modified, 'sec' ) ) {
$wiki_date = $last_modified;
} elseif ( $number_of_x > 365 ) {
$wiki_date = __( 'a long time' );
} elseif ( $number_of_x >= 180 ) {
$wiki_date = __( 'less than a year' );
} elseif ( $number_of_x >= 60 ) {
@ricardozea
ricardozea / ie67891011-css-hacks.txt
Last active February 2, 2023 15:17
IE CSS hacks - IE6, 7, 8, 9, 10, 11
IE6 Only
==================
_selector {...}
IE6 & IE7
==================
*html or { _property: }
IE7 Only
==================
<?php
// Numeric Page Navigation
function bones_page_navi() {
global $wp_query;
$bignum = 999999999;
if ( $wp_query->max_num_pages <= 1 )
return;
echo '<nav class="pagination">';
@srikat
srikat / functions.php
Last active September 29, 2019 07:53
How to use Customizer API to add settings for Header background color and background image in Genesis. https://sridharkatakam.com/how-to-use-customizer-api-to-add-settings-for-header-background-color-and-background-image-in-genesis/
/**
* HEX Color sanitization callback.
*
* - Sanitization: hex_color
* - Control: text, WP_Customize_Color_Control
*
* Note: sanitize_hex_color_no_hash() can also be used here, depending on whether
* or not the hash prefix should be stored/retrieved with the hex color value.
*
* @see sanitize_hex_color() https://developer.wordpress.org/reference/functions/sanitize_hex_color/
@themepaint
themepaint / Woocommerce Price Filter CSS
Created February 2, 2016 08:20
Woocommerce Price Filter CSS
.price_slider{
margin-bottom: 1em;
}
.price_slider_amount {
text-align: right;
line-height: 2.4em;
font-size: 0.8751em;
}
@taoyuan
taoyuan / npm-using-https-for-git.sh
Last active June 12, 2024 13:31
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@ControlledChaos
ControlledChaos / README.md
Last active September 21, 2023 05:54 — forked from saas786/sanitize_checkbox.php
Sanitization of WordPress Customizer controls

Sanitize the WordPress Customizer

WordPress Snippets