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
View 01-gulpfile.js
/*!
* gulp
* $ npm install gulp-ruby-sass gulp-autoprefixer gulp-cssnano gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache del --save-dev
*/
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
View clean.js
// Styles
gulp.task('styles', function() {
return gulp.src(config.sources.styles)
.pipe(sass({ errLogToConsole: true, outputStyle: 'expanded' }))
.pipe(prefix('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulpif(isProduction, mincss({ keepSpecialComments: 0 })))
.pipe(header(banner))
.pipe(gulp.dest(config.output.styles))
.pipe(reload(server));
});
@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 scroll.easing.js
function scrollTo(Y, duration, easingFunction, callback) {
var start = Date.now(),
elem = document.documentElement.scrollTop?document.documentElement:document.body,
from = elem.scrollTop;
if(from === Y) {
callback();
return; /* Prevent scrolling to the Y point if already there */
}
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'));
}
@markgoodyear
markgoodyear / task.js
Created Oct 11, 2014
Concat all modules first in Angular
View task.js
var paths = {
src: [
'src/scripts/app/**/*module*.js',
'src/scripts/app/**/*.js'
],
dest: 'app/assets/scripts'
};
gulp.task('scripts', function () {
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 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>
You can’t perform that action at this time.