Skip to content

Instantly share code, notes, and snippets.

View JodiWarren's full-sized avatar
🎯
Focusing

Jodi Warren JodiWarren

🎯
Focusing
View GitHub Profile
@JodiWarren
JodiWarren / dabblet.css
Created March 7, 2012 15:44
css position demo
/**
* css position demo
*/
#container
{
width: 400px;
position: relative;
border: 1px solid black;
@JodiWarren
JodiWarren / StartStopTimer.scpt
Created May 16, 2012 19:32
Start/stop current timer in Billings
tell application "Billings" to activate
tell application "System Events"
tell process "Billings"
tell menu bar 1
tell menu bar item "Slips"
tell menu "Slips"
if menu item "Start Timer" exists then
click menu item "Start Timer"
else
click menu item "Stop Timer"
@JodiWarren
JodiWarren / dabblet.css
Created June 13, 2012 12:17
A "deeper" indented text effect with the :before and :after pseudo-elements.
/**
* A "deeper" indented text effect with the :before and :after pseudo-elements.
*/
html, body {
height: 100%;
}
body {
margin: 0;
@JodiWarren
JodiWarren / FAQ Shortcode
Last active December 11, 2015 20:28
Simple Wordpress FAQ
/**
* Build the FAQ list for return. Dependent on an Advanced Custom Fields[http://www.advancedcustomfields.com/] repeater field 'faq' with containing 'question' [text] and 'answer' [wysiwyg].
*/
function jw1234_output_faq( $atts ){
if (get_field('faq')):
$jw1234_faq = get_field('faq');
$jw1234_question_index = "<ul class='faq-index'>";
$jw1234_question_list = "<ul class='faq-list'>";
@JodiWarren
JodiWarren / wp-is-page-or-child
Created January 31, 2013 17:16
Function to return true if the current page matches or is a child of a given slug. Call it like is_page_or_child('about');
function get_ID_by_slug($page_slug) {
$page = get_page_by_path($page_slug);
if ($page) {
return $page->ID;
} else {
return null;
}
}
function is_page_or_child($slug){
/*
Following this suggestion by @aral:
https://twitter.com/#!/aral/status/161833507423916032 and
https://twitter.com/#!/aral/status/161833979736096769
I realised that a CSS Pre-processor could help save some time here if you
use the same values for px and rem.
This works in SCSS:
*/
@JodiWarren
JodiWarren / _subnav.scss
Last active December 12, 2015 06:38
Subnav Menu Wordpress
#subnav {
li {
list-style-type: none;
}
a {
padding-left: 1em;
padding-right: 1em;
display: block
}
.menu-primary-container {
add_filter( 'walker_nav_menu_start_el', 'gt_add_menu_item_description', 10, 4);
function gt_add_menu_item_description( $item_output, $item, $depth, $args ) {
$desc = __( $item->post_content );
return preg_replace('/(<a.*?>[^<]*?)</', '$1' . "<small class=\"nav-desc\">{$desc}</small><", $item_output);
}
Test gist to see if the language dropdown ever works again.
@JodiWarren
JodiWarren / gist:4944113
Last active March 4, 2016 18:28 — forked from stuntbox/gist:4557917
With @laacz's updated code
/**
* Filter out hard-coded width, height attributes on all images in WordPress.
* https://gist.github.com/4557917
*
* This version applies the function as a filter to the_content rather than send_to_editor.
* Changes made by filtering send_to_editor will be lost if you update the image or associated post
* and you will slowly lose your grip on sanity if you don't know to keep an eye out for it.
* the_content applies to the content of a post after it is retrieved from the database and is "theme-safe".
* (i.e., Your changes will not be stored permanently or impact the HTML output in other themes.)
*