Skip to content

Instantly share code, notes, and snippets.

Mark Goodyear markgoodyear

Block or report user

Report or block markgoodyear

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@markgoodyear
markgoodyear / gist:9100177
Last active Aug 29, 2015
Example of a dev flag for gulp
View gist:9100177
// Define your plugins here, make sure you have `gulp-util`...
var gutil = require('gulp-util');
/**
* Define dev CLI flag
* Run `gulp --dev`
*/
var isDev = gutil.env.dev;
gulp.task('scripts', function() {
View functions.php
<?php
// All scripts to load here
function load_scripts() {
// Register script
wp_register_script('scrollup', get_template_directory_uri() . '/path/to/scripts/jquery.scrollUp.min.js', array('jquery'), '2.3.3', true );
// Enqueue it
wp_enqueue_script('scrollup');
@markgoodyear
markgoodyear / functions.php
Last active Aug 29, 2015
WordPress Dirty Active Menu
View functions.php
<?php
add_filter( 'nav_menu_css_class', 'add_parent_url_menu_class', 10, 2 );
function add_parent_url_menu_class( $classes = array(), $item = false ) {
// Get current URL
$current_url = current_url();
// Get homepage URL
View static.js
gulp.task('static', function() {
return gulp.src('src/static/**')
.pipe(gulp.dest('build'));
}
View extend.js
function extend (target, source) {
var a = Object.create(target);
Object.keys(source).map(function (prop) {
a[prop] = source[prop];
});
return a;
};
@markgoodyear
markgoodyear / SassMeister-input-HTML.html
Created Nov 27, 2014
Generated by SassMeister.com.
View SassMeister-input-HTML.html
<p>Normal</p>
<a class="btn btn--primary">Button</a>
<a class="btn btn--primary btn--outline">Button</a>
<a class="btn btn--secondary">Button</a>
<a class="btn btn--secondary btn--outline">Button</a>
<a class="btn btn--tertiary">Button</a>
<a class="btn btn--tertiary btn--outline">Button</a>
@markgoodyear
markgoodyear / SassMeister-input-HTML.html
Created Nov 26, 2014
Generated by SassMeister.com.
View SassMeister-input-HTML.html
<p>Normal</p>
<a class="btn btn--primary">Button</a>
<a class="btn btn--primary btn--outline">Button</a>
<a class="btn btn--secondary">Button</a>
<a class="btn btn--secondary btn--outline">Button</a>
<a class="btn btn--tertiary">Button</a>
<a class="btn btn--tertiary btn--outline">Button</a>
View Get structure pos.twig
{# Get the IDs of all the sections #}
{% set currentSectionId = entry.id %}
{% set allSectionIds = craft.entries.section('myStructure').level(1).ids() %}
{# Define var before loop #}
{% set sectionNumber = '' %}
{# Loop through all section IDs and find the one that matches the current #}
{% for key, sectionId in allSectionIds if sectionId == currentSectionId %}
View headhesive-swap-image.js
{
onStick: function () {
document.querySelector('.img-elem').src = '/path/to/stick-img.png'
},
onUnstick: function () {
document.querySelector('.img-elem').src = '/path/to/unstick-img.png'
},
}
@markgoodyear
markgoodyear / noRepeat.js
Created Jul 28, 2015
Swap `background-repeat: none` to `background-repeat: no-repeat`: https://twitter.com/hugogiraudel/status/625966606351495168
View noRepeat.js
var noRepeat = function () {
return function (css) {
css.eachDecl('background-repeat', function (decl) {
if (decl.value.indexOf('none') !== -1) {
decl.value = 'no-repeat';
}
});
};
};
You can’t perform that action at this time.