Skip to content

Instantly share code, notes, and snippets.

View BallParkWS's full-sized avatar

BallPark Web Solutions BallParkWS

View GitHub Profile
@BallParkWS
BallParkWS / SimpleAdblockDetection
Created December 29, 2014 22:00
Simple adblock detection
// The is a simple method to detect if a browser is using an adblock derivative, and if it is, offering up a simple message to the visitor. The intent is to simply notify them of possible formatting issues but can be modified to offer a warning or to request that they disable it to view specific content.
// ===============================
// PART ONE
// Add to site root as 'advertisement.js'
// ===============================
document.write('<div id="adblock"></div>');
@BallParkWS
BallParkWS / Bookmarklet to post a URL to Tweetbot
Last active August 29, 2015 14:06
Bookmarklet to post a URL to Tweetbot
javascript:window.location='tweetbot:///post?text='+encodeURI("\""+document.title+"\" ")+encodeURI(window.location)
@BallParkWS
BallParkWS / Regex for Tweetbot - ignore NFL teams
Last active August 29, 2015 14:06
Regex for Tweetbot - ignore NFL teams
(?i)(Ravens|Bills|Bengals|Browns|Broncos|Texans|Colts|Jaguars|Chiefs|Dolphins|Patriots|jets|Raiders|Steelers|chargers|Titans|Cardinals|Falcons|Panthers|Bears|Cowboys|Lions|packers|Vikings|saints|giants|Eagles|49ers|Seahawks|rams|Buccaneers|Redskins)
@BallParkWS
BallParkWS / WordPress functions.php hacks
Last active August 29, 2015 14:03
WordPress functions.php hacks
// A few handy additions for your functions.php file - updated as necessary.
// Hide admin bar on front-end when logged in
add_filter('show_admin_bar', '__return_false');
// remove unwanted paragraphs around shortcode autoop (http://codex.wordpress.org/Function_Reference/wpautop)
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
@BallParkWS
BallParkWS / WordPress - list and sort posts alphabetically
Created June 8, 2014 17:21
WordPress - list and sort posts alphabetically
<?php
$args = array( 'posts_per_page' => 10, 'order' => 'ASC', 'orderby' => 'title' );
$rand_posts = get_posts( $args );
foreach ( $rand_posts as $post ) :
setup_postdata( $post ); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach;
wp_reset_postdata();
?>
@BallParkWS
BallParkWS / US State Dropdown Form Element
Created June 8, 2014 17:09
Quick drop down list of US states for forms
<select id="statename">
<option value='AL'>Alabama</option>
<option value='AK'>Alaska</option>
<option value='AZ'>Arizona</option>
<option value='AR'>Arkansas</option>
<option value='CA'>California</option>
<option value='CO'>Colorado</option>
<option value='CT'>Connecticut</option>
<option value='DE'>Delaware</option>
<option value='FL'>Florida</option>
@BallParkWS
BallParkWS / Center A Div in CSS
Created June 8, 2014 17:06
Perfectly center a div in CSS
.div_name {
position: absolute;
width: 100px;
height: 100px;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -50px;
}
@BallParkWS
BallParkWS / WordPress theme path include
Created June 8, 2014 17:05
Quickly add the path to your themes directory in Wordpress
<?php include (TEMPLATEPATH . '/filename.php'); ?>
@BallParkWS
BallParkWS / Set Text Selection Colors in CSS
Created June 8, 2014 17:03
Setting text selection colors in css
/* Mozilla based browsers */
::-moz-selection {
background-color: #FFA;
color: #000;
}
/* Works in Safari */
::selection {
background-color: #FFA;
color: #000;
}
@BallParkWS
BallParkWS / Gravity Forms error styling
Created May 28, 2014 19:31
Gravity Forms error styling
/* Gravity forms error handling */
/* Default errors are not pleasant looking
add a bit of FontAwesome and !important CSS to make it look a little better. */
/* As seen on www.BallPark.ws */
/* Comment below for any questions or additions */
/* ############################################### */
#gform_submit_button_1 { /* check your form number */
background-color: #3F6EB1 !important;