Skip to content

Instantly share code, notes, and snippets.

@emzo
emzo / _sizes.scss
Created November 29, 2012 14:20
Generate human friendly proportional size classes
// Based on the code in Griddle by @necolas
// http://necolas.github.com/griddle/
// =============================================================================
// Helper Functions
// =============================================================================
// Find the greatest common factor of two integers
@function gcf($a, $b) {
@if $b == 0 {
@emzo
emzo / gist:3052518
Created July 5, 2012 09:17
WP Protect user account from deletion
add_action( 'delete_user', 'dont_delete_user' );
function dont_delete_user( $id ) {
$dont_delete_ids = array( 1, 2, 3, 4 ); // protected user IDs
if ( in_array( $id, $dont_delete_ids ) )
wp_die( 'You cannot delete this user account.' );
}
@emzo
emzo / less_preprocessor.php
Created February 27, 2012 15:54
A LESS preprocessor for Wordless
<?php
require_once "wordless_preprocessor.php";
/**
* Compile LESS files using the `lessc` executable.
*
* LessPreprocessor relies on some preferences to work:
* - css.lessc_path (defaults to "/usr/bin/lessc"): the path to the lessc executable
* - css.output_style (defaults to "compressed"): the output style used to render css files
@emzo
emzo / dates-meta.php
Created October 25, 2011 15:54
WPAlchemy: Modify cloned item of repeating field group
<a style="float:right; margin:0 10px;" href="#" class="dodelete-dates button">Remove All Dates</a>
<p>Add dates on which this course will run.</p>
<?php while($mb->have_fields_and_multi('dates')): ?>
<?php $mb->the_group_open(); ?>
<?php $mb->the_field('date'); ?>
<p><input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>" class="datepicker" />
<a href="#" class="dodelete button">Remove Date</a></p>
@emzo
emzo / disable-plugins.php
Created October 4, 2011 20:11 — forked from markjaquith/disable-plugins-when-doing-local-dev.php
Disables specified WordPress plugins
<?php
/*
Plugin Name: Disable Plugins
Description: Disables plugins that you specify depending on the value of the WP_LOCAL_DEV constant
Version: 0.2
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/