Skip to content

Instantly share code, notes, and snippets.

View mattboon's full-sized avatar

Matt Berridge mattboon

View GitHub Profile
@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 / 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'
};
@mattboon
mattboon / gist:965501
Created May 10, 2011 22:24
Improved Facebook CSS
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("facebook.com") {
.ego_column, #pagelet_adbox {
display: none;
}
.fbx #globalContainer {
width: 1200px !important;
}
.hasLeftCol .hasRightCol #contentArea {
@mattboon
mattboon / gist:978263
Created May 18, 2011 09:17
Guide Custom Post Type
<?php
// CUSTOM POST TYPE
add_action('init', 'matt_guide_register');
function matt_guide_register() {
$labels = array(
'name' => _x('Guide', 'post type general name'),
'singular_name' => _x('Region', 'post type singular name'),
'add_new' => _x('Add new region', 'region item'),
'add_new_item' => __('Add new'),
'edit_item' => __('Edit region'),
@mattboon
mattboon / gist:1004224
Created June 2, 2011 10:29
Why you don't copy & paste directly from Microsoft Word into the WordPress visual editor!
<p><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Template>Normal.dotm</o:Template> <o:Revision>0</o:Revision> <o:TotalTime>0</o:TotalTime> <o:Pages>1</o:Pages> <o:Words>12</o:Words> <o:Characters>71</o:Characters> <o:Company>Mixd</o:Company> <o:Lines>1</o:Lines> <o:Paragraphs>1</o:Paragraphs> <o:CharactersWithSpaces>87</o:CharactersWithSpaces> <o:Version>12.256</o:Version> </o:DocumentProperties> <o:OfficeDocumentSettings> <o:AllowPNG /> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>0</w:Zoom> <w:TrackMoves>false</w:TrackMoves> <w:TrackFormatting /> <w:PunctuationKerning /> <w:DrawingGridHorizontalSpacing>18 pt</w:DrawingGridHorizontalSpacing> <w:DrawingGridVerticalSpacing>18 pt</w:DrawingGridVerticalSpacing> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>0</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>fa
@mattboon
mattboon / gist:1048651
Created June 27, 2011 10:34
Nav of hell
<ul>
<?php for ($i=6;$i<13;$i++): ?>
<li<?= $root_page_id==$i ? ' class="current"' : '' ?>>
<a href="<?= get_permalink($i); ?>"<?= $i==6 ? ' accesskey="0"' : '' ?>>
<?= get_the_title($i); ?>
</a>
</li>
<?php endfor; ?>
</ul>
@mattboon
mattboon / gist:1055097
Created June 29, 2011 21:51
WordPress Custom Post Type
<?php
//---- CUSTOM POST TYPE - EXECUTIVE DEVELOPERS --------------------------------------------------------
add_action('init', '_init_developer_post_type');
function _init_developer_post_type() {
// MAKE POST TYPE
//---------------------------
register_post_type( 'developer',
array(
@mattboon
mattboon / gist:1055103
Created June 29, 2011 21:54
WordPress Small Snippets - Clean Admin Panel
<?php
// Remove columns from Posts admin
add_filter('manage_posts_columns', 'my_posts_columns');
function my_posts_columns($defaults) {
unset($defaults['comments']);
unset($defaults['author']);
unset($defaults['tags']);
//unset($defaults['date']);
return $defaults;
}
@mattboon
mattboon / gist:1055110
Created June 29, 2011 21:57
WordPress Section Index w/ shortcode and many options
<?php $the_content = apply_filters('the_content', $post->post_content);
$the_content = explode("<p>[MENU]</p>",$the_content); ?>
<?= $the_content[0]; ?>
<?php
/* GET CUSTOM FIELDS */
$menu_type = get_post_meta($post->ID, 'menu_type', true);
$menu_page_curl = get_post_meta($post->ID, 'menu_page_curl', true);
$menu_custom_array = get_post_meta($post->ID, 'menu_custom_array', true);
$menu_more_text = get_post_meta($post->ID, 'menu_more_text', true);