Skip to content

Instantly share code, notes, and snippets.

@mattmckenny
mattmckenny / bootstrap-less-inline-media-query
Created March 18, 2015 13:41
Bootstrap/Less mixin to add responsive media query within original selector's declaration
//
// Load core variables
// --------------------------------------------------
@import "variables.less";
.breakpoint(@class, @rules) when (@class = xs) {
@media (min-width: @screen-xs-min) and (max-width: @screen-xs-max) {@rules();}
}
.breakpoint(@class, @rules) when (@class = sm) {
@wpscholar
wpscholar / remote-media-loader.php
Last active April 5, 2022 08:57
Load media from a remote site so you don't have to download the uploads directory.
<?php
/**
* Loads media from a remote site when on a local dev environment.
* Eliminates the need to download the uploads directory from the remote site for testing purposes.
*/
if ( 'mydomain.dev' === $_SERVER['HTTP_HOST'] ):
add_filter( 'upload_dir', function ( $uploads ) {
$uploads['baseurl'] = 'http://mydomain.com/wp-content/uploads';
@dana-ross
dana-ross / setup-new-mac.sh
Last active September 10, 2016 00:45
Re-create my dev environment if my laptop fails
#!/bin/bash
# (not really -- run these commands by hand & pay attention to the comments)
# Homebrew: The missing package manager for OS X
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
# Fish: Finally, a command line shell for the 90s
brew install fish
# Git
// Brightness math based on:
// http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx
$red-magic-number: 241;
$green-magic-number: 691;
$blue-magic-number: 68;
$brightness-divisor: $red-magic-number + $green-magic-number + $blue-magic-number;
@function brightness($color) {
// Extract color components
@justintadlock
justintadlock / register-post-type.php
Last active July 17, 2024 10:14
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public