Skip to content

Instantly share code, notes, and snippets.

@zenman
zenman / snippet.css
Created September 27, 2013 15:36
Find Empty Links
// Make links that are linking to the current page pulsate red
// so you can find and remove them. Really annoying but effective.
// I do all my development in webkit so this only works with that.
a[href="#"] {
background-color: red;
-webkit-animation: pulsate 1s ease-out;
-webkit-animation-iteration-count: infinite;
}
@-webkit-keyframes pulsate {
0% {background-color: #fff;}
@zenman
zenman / superfancyshadows.scss
Created September 16, 2013 22:14
Super fancy SCSS mixin for super fancy shadows
/*------------------------------------*\
   //Curled Drop Shadow
\*------------------------------------*/
//Usage: Requires parent element and then attach @mixin fancy-box-shadow($args);
//Descript: WARNING!!!!!!!!!!! If you use this attach z-index 0 to your body. For whatever reason if you don't attach a z-index to the body the shadow refuses to show up.
@mixin fancy-box-shadow($type, $params: 0px 10px 15px, $color: #000){
@if $type == lifted {
padding:1em;
margin:2em 10px 4em;
@zenman
zenman / snippet.php
Last active December 23, 2015 05:18
Add a bar at the bottom of the page that shows the template being used. Simply add to your functions.php file and comment out when done with it.
/*
* Add a bar at the bottom of the page that shows the template being used.
*/
function show_template() {
global $template;
$style = '
background-color:rgba(0,0,0,1);
position:fixed;
bottom:0;
right:0;
@zenman
zenman / snippet.htaccess
Created August 19, 2013 13:51
Eliminates font-related error messages in the developer tools console for Chrome.
# eliminate font-related error messages
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
# END GZIP
@zenman
zenman / snippet.js
Last active December 19, 2015 15:39
var scrollToAnchor = function() {
//cache some variables
var scrollElement = 'html, body',
$window = $(window);
//grab all the anchor links
$("a[href^='#']").click(function(e) {
//stop immediate scroll
e.preventDefault();
<?php
/*
* Use Parent Category
* Description: Causes subcategories to use their parent's template
*/
function load_cat_parent_template(){
global $wp_query;
if (!$wp_query->is_category) {
return true; // saves a bit of nesting
@zenman
zenman / snippet.php
Created June 4, 2013 19:41
Add basic WordPress pagination.
<?php
global $wp_query;
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'prev_next' => false
));
<?php
//hostname based google code, only run if on live site - Tom Horak
//placed right before closing body tag according to google best practice: http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55488
//moved to right before closing head tag per SEOverflow 05/25/12
$hostname = $_SERVER['HTTP_HOST']; //dev.zenman.com | localhost | Live server | etc..
switch ($hostname) {
case 'localhost': //do nothing
//echo '<!-- no google analytics code -->';
break;
@zenman
zenman / snippet.php
Last active December 16, 2015 03:49
Conditional Google Analytics code.
<?php
//hostname based google code, only run if on live site - By Tom Horak, modified by Tomas Mulder.
//placed right before closing head tag according to google best practice: https://support.google.com/analytics/answer/1008080?hl=en
$hostname = $_SERVER['HTTP_HOST']; //dev.zenman.com | localhost | Live server | etc..
switch ($hostname) {
case 'localhost': //do nothing
//echo '<!-- no google analytics code -->';
break;
case 'localhost:8888': //do nothing