Skip to content

Instantly share code, notes, and snippets.

View michaelschofield's full-sized avatar

Michael Schofield michaelschofield

View GitHub Profile
@michaelschofield
michaelschofield / IE-CSS-Hacks.css
Created June 5, 2012 17:22
IE CSS Hacks (IE6, IE7, and IE8)
/* ========================================
* I find these special character hacks for
* Internet Explorer super useful. Enjoy.
* ======================================== */
body {
color: red;
/* ===============================
* Change the text color to green
@michaelschofield
michaelschofield / Mobile-First_SASS_Stylesheet
Created July 30, 2012 21:28
Mobile-First SASS Stylesheet
/* ========================================================
* This is a mobile-first stylesheet I've lovingly adopted from
* the designers from Themble: it's just an intuitive skeleton.
* There is no actual styling going on in this gist, but it's
* completely up to you to fill in the blanks. Here's to a speedy
* development : ).
* So, basically, your base styles come first and exist
* outside the media queries and they'll be called in the
* beginning. Leave these for your lowest denominator: slow
/*
Maintain ratio mixin. Great for responsive grids, or videos.
https://gist.github.com/brianmcallister/2932463
$ratio - Ratio the element needs to maintain.
Examples
// A 16:9 ratio would look like this:
.element {
@michaelschofield
michaelschofield / gist:6141445
Created August 2, 2013 16:51
User-Friendly Labeling for WP Custom Post Type
/* ==================
* User-Friendly Labeling
*/ // Sometimes you don't want to remove, say, the editor
// from the post-type, but maybe you just want to
// call it something different.
function post_type_label_rewrite( $translation, $text, $domain ) {
global $post;
if ( !isset( $post->post_type ) ) { return $translation; }
@michaelschofield
michaelschofield / gist:6274020
Created August 19, 2013 20:49
Sticky Footer
html, body { height: 100%; }
#container {
min-height: 100%;
margin-bottom: -12em; // Arbitrary. Must be the same as footer height.
&:after {
content: "";
display: block;
}
## The Role of DRY Content in Responsive Web Design
The most daunting thing about splitting the joint-use public / academic Alvin Sherman Library website into two wasn't the ground-up design of an entirely new, mobile-first and flat public site, but ensuring that content could be targeted and yet never duplicated across a half-dozen library applications - which, of course, now included two entirely disparate websites. We knew that the success of this project wasn't whether our #libweb had a swanky new look, but if it had fresh, findable content our patrons cared about.
In this short talk, I'll introduce concepts of content modeling and sharing our strategy, showing how we created a third site purely to be the vehicle for content syndication, making it so that library staff could have just one place to enter content that would disseminate all across the library's web presence based on audience (kids, teens, adults, undergrads ... ) and context (research, events, ... ).
@michaelschofield
michaelschofield / json_api_create_post_with_custom_fields.php
Last active December 29, 2015 11:09
Extend the WP JSON API "Post" Controller to Modify Custom Field Values
// Add to the save() function in post.php
if ( !empty($values["custom"]) ) {
foreach ($values["custom"] as $metakey => $metavalue) {
update_post_meta($this->id,$metakey,$metavalue);
}
}
// create_post example
// http://localhost/site/?json=posts/create_post&dev=1&nonce=xxx&title=Post%20title&status=publish&custom[custom_field_1]=value1&custom[custom_field_2]=value2
@michaelschofield
michaelschofield / the_libweb_has_a_content_problem.md
Last active December 29, 2015 14:09
"Library Websites have a Content Problem" - A Session Proposal for Handheld Librarian 2014

Library Websites Have a Content Problem

A Session Proposal for Handheld Librarian 2014

Many libraries recently took the responsive leap with new websites designed on a fluid grid to deliver library content to the point of need. Whoa! Flipping that switch that increased the attention around the library website was a statement that the #libweb was no longer just an artifact but an important part in that whole library-without-walls thing.

Yet when the community talks about “responsive web design” we are still mostly

@michaelschofield
michaelschofield / good_dry_and_dynamic_proposal.md
Created November 29, 2013 18:06
Proposal for Code4Lib 2014: "Good, DRY, and Dynamic: Content Strategy for Libraries"

Good!, DRY, and Dynamic: Content Strategy for Libraries (Especially the Big Ones)

The responsibilities of the #libweb are exploding [it’s a good thing] and it’s no longer uncommon for libraries to manage or even home-grow multiple applications and sites. Often it’s at this point where we begin to suffer the absence of a content strategy when, say, business hours need to be updated sitewide a half-dozen times.

We were already feeling this crunch when we decided to further complicate the Nova Southeastern University Libraries by splitting the main library website into two. The Alvin Sherman Library, Research, and Information Technology Center is a unique joint-use facility that serves not only the academic community but the public of Broward County - and marketing a hyperblend of content through one portal just wasn't cutting it. With a web team of two, we knew that managing all this rehashed, disparate content was totally unsustainable.

I want to share in this talk how I went about making library content

@michaelschofield
michaelschofield / order_by_custom_field.php
Created December 10, 2013 17:25
Basic WP_Query() for ordering the loop by a custom field (i.e., start_date).
$args = array(
'meta_key' => 'start_date',
'orderby' => 'meta_value_num',
'post_type' => 'events'
);
$events = new WP_Query( $args );
if ( $events->have_posts()) : while ( $events->have_posts()) : $events->the_post();