Skip to content

Instantly share code, notes, and snippets.

View mattboon's full-sized avatar

Matt Berridge mattboon

View GitHub Profile
<?php
// Return the page id by slug
// -------------------------------------------------------------
function get_ID_by_slug( $page_slug ) {
$page = get_page_by_path( $page_slug );
if ( $page ) {
return $page->ID;
} else {
return null;
@mattboon
mattboon / gist:9408252
Created March 7, 2014 09:19
Copy / Micro Copy Class Generator
=font-scale($sizes, $namespace: "copy", $micro_class: true)
@each $scale in $sizes
$current-breakpoint: nth($scale,1)
$current-font-size: nth($scale,2)
$base-size: $current-font-size !default
@if $current-breakpoint > 0
+mq-min($current-breakpoint)
.#{$namespace}
font-size: $current-font-size
@if $micro_class == true
@mattboon
mattboon / webfont-localstorage.js
Last active June 26, 2016 02:09
webfont-localstorage.js
function supportsWoff2() {
"use strict";
/*global FontFace*/
// Source: https://github.com/filamentgroup/woff2-feature-test
if (!window.FontFace) {
return false;
} else {
var f = new FontFace('t', 'url("data:application/font-woff2,") format("woff2")', {});
f.load();
return f.status === 'loading';
@mattboon
mattboon / server.js
Created June 3, 2015 09:37
server.js
// Middleware
var middleware = require('./middleware/components.js');
app.use(middleware);
// Require the core Styleguide
var Styleguide = require('../app/node_modules/styleguide/layout');
var styleguideProps = this.props;
// Json for all components
app.get('/components.json', function(req, res) {
@mattboon
mattboon / middleware.js
Created June 3, 2015 09:38
middleware.js
'use strict';
var glob = require('glob');
var objectAssign = require('react/lib/Object.assign');
var defaults = {
folder: './app/node_modules/components/',
extension: '.jsx'
};