Skip to content

Instantly share code, notes, and snippets.

@mindfullsilence
mindfullsilence / debug.php
Created November 15, 2013 18:44
Print anything to the screen.
/**
* Echo Anything onto the page.
*
* @param mixed $msg
*/
function debug($msg)
{
echo '<pre style="background-color: saddlebrown; padding: 2em; margin: 2em; box-sizing: border-box;">';
echo '<code style="font-family: Menlo; font-weight: bold; color: mintcream; font-size: 12px;">';
echo '<br>';
@mindfullsilence
mindfullsilence / Theme Image Widget.php
Created December 11, 2013 03:02
Create a widget that will display an image from the theme directory, optionally wrapped with a link. Also has the option of defining whether or not to open said link in a new tab.
<?php
/*
Plugin Name: Theme Image widget
Description: Display an image from the theme directory in a widget.
*/
// initialize the widget on install
add_action('widgets_init', create_function('', 'return register_widget("pm_image_upload_widget");'));
// extend the Widget class with the new widget
@mindfullsilence
mindfullsilence / Flexible height background.less
Last active August 29, 2015 13:56
Applies 3 images to a single element for a flexible height background
// Basically really complicated looking, but very fast way to use multiple backgrounds
// for the flexible height areas. Applies a top no-repeat image, middle repeat-y image,
// and a bottom no-repeat image. You really only need to use one mixin when generating
// the background image stuff: ".flexible-height-background(@type, @screen)".
// @type should be the type of background you want. It should match the variable name
// for the image url within .image-vars()
//
// The screen is the media target you want: mobile, tablet, or desktop.
//
// Image filenames should be in the format:
<?php
/*
Template Name: Cover Page
*/
?>
@mindfullsilence
mindfullsilence / jQuery ScrollIt Plugin
Last active December 22, 2015 22:41
Scrolling animation wrapper
jQuery ScrollIt Plugin
@mindfullsilence
mindfullsilence / bootstrap-xl.less
Last active May 11, 2016 02:55
Twitter Bootstrap New Breakpoint Plugin
// xLarge screen / wide desktop
@screen-xl: 1300px;
@screen-xl-min: @screen-xl;
//** Deprecated `@screen-lg-desktop` as of v3.0.1
@screen-xl-desktop: @screen-xl-min;
// So media queries don't overlap when required, provide a maximum
@screen-lg-max: (@screen-xl-min - 1);
//== Container sizes
@mindfullsilence
mindfullsilence / index.js
Last active September 28, 2017 17:54
CSS media query in javascript using bootstrap classes
/**
* User: TimAnderson
* Date: 12/1/15
* Time: 1:25 PM
*/
/**
* Test responsive screen sizes by creating a visible-[screen]-block div. Passing multiple screen sizes will return true if one of them is true.
* See {@link http://codepen.io/mindfullsilence/pen/BjRJvN} for example usage.
* @requires jQuery
@mindfullsilence
mindfullsilence / wpcf7_select_posttype.php
Created August 18, 2014 16:25
Custom input fields for Contact Form 7 Wordpress Plugin
<?php
/**
** A base module for [select_posttype] and [select_posttype*]
**/
/* Shortcode handler */
add_action( 'wpcf7_init', 'wpcf7_add_shortcode_select_posttype' );
function wpcf7_add_shortcode_select_posttype() {
@mindfullsilence
mindfullsilence / functions.php
Created October 23, 2014 16:22
Wordpress - static admin bar
if(!is_admin() && is_user_logged_in()) {
remove_action( 'wp_footer', 'wp_admin_bar_render');
add_action( 'wp_head', 'wp_admin_bar_render', 1000 );
function make_admin_bar_static() {
echo '
<style type="text/css">
html[lang] {
margin-top: 0px !important;
}
@mindfullsilence
mindfullsilence / truthy_falsey
Created August 12, 2015 19:03
Falsey / Truthy JS Guide
Falsey values in JavaScript
false
0
-0
""
''
null
undefined
NaN