Skip to content

Instantly share code, notes, and snippets.

View michaelschofield's full-sized avatar

Michael Schofield michaelschofield

View GitHub Profile
@mreidsma
mreidsma / libguides_streamline.js
Last active February 22, 2017 19:10
Force single linked parents to take user directly to LibGuide on home page
// Make sure you are on the homepage
if($('#s-lg-index-list').length > 0) {
// Loop through all the subjects
$('#s-lg-index-cols').find('div.panel.panel-default').each(function() {
// Get the number of guides in this subject
var guides = $(this).find('.badge').text();
// console.log('Number of guides: ' + guides);
@scottopolis
scottopolis / wp-api-custom-taxonomies.php
Created October 27, 2015 22:27
Add custom taxonomies to the WP-API
<?php
function ms_add_tax_to_api() {
$taxonomies = get_taxonomies( '', 'objects' );
foreach( $taxonomies as $taxonomy ) {
$taxonomy->show_in_rest = true;
}
}
add_action( 'init', 'ms_add_tax_to_api', 30 );
@hdragomir
hdragomir / sm-annotated.html
Last active March 5, 2024 08:57
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active April 2, 2024 02:45
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@netpoetica
netpoetica / Setting up Nginx on Your Local System.md
Last active April 22, 2024 04:25
Setting up Nginx on Your Local System

#Setting up Nginx on Your Local System ###by Keith Rosenberg

##Step 1 - Homebrew The first thing to do, if you're on a Mac, is to install homebrew from http://mxcl.github.io/homebrew/

The command to type into terminal to install homebrew is:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
These are some features. They can be implemented in any order you prefer.
* an elevator responds to calls containing a source floor and direction
* an elevator delivers passengers to requested floors
* an elevator doesn't respond immediately. consider options to simulate time
* elevator calls are queued not necessarily FIFO
* you may validate passenger floor requests
* you may implement current floor monitor
* you may implement direction arrows
* you may implement doors (opening and closing)
@malarkey
malarkey / Contract Killer 3.md
Last active May 17, 2024 15:28
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@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
@tvandervossen
tvandervossen / gist:1231476
Created September 21, 2011 07:33
Mobile Safari viewport sizes on iOS 4.3 and 5
iPad
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3