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 / 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 static.js
gulp.task('static', function() {
return gulp.src('src/static/**')
.pipe(gulp.dest('build'));
}
@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 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');
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 */
}
@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 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));
});
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'),
You can’t perform that action at this time.