Skip to content

Instantly share code, notes, and snippets.

View gopperman's full-sized avatar

Greg Opperman gopperman

View GitHub Profile
@gopperman
gopperman / 01-gulpfile.js
Created February 13, 2016 01:38 — forked from markgoodyear/01-gulpfile.js
Comparison between gulp and Grunt. See http://markgoodyear.com/2014/01/getting-started-with-gulp/ for a write-up.
/*!
* 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'),
@gopperman
gopperman / gitsubmodules.md
Last active September 7, 2015 15:56
Just some basic commands for git submodules

Add a submodule

git submodule add https://github.com/chaconinc/DbConnector

Pull each submodule

git submodule foreach git pull origin master

@gopperman
gopperman / shopify.cart
Created May 16, 2014 01:09
Javascript for a quick cart view / add in shopify
var Shopify = Shopify || {};
jQuery(function($) {
Shopify.shop = "redacted.url";
Shopify.onCartUpdate = function(cart) {
$.getJSON('/cart.js', function (cart, textStatus) {
$('.cartcount').each(function() {
$(this).html(cart.item_count);
});
if (cart.item_count == 0) {
@gopperman
gopperman / jquery.megadropdowns
Last active August 29, 2015 14:01
JQuery function to load mega dropdowns
function loadRichMenus() {
if ($( document ).width() > 1179) {
$('.dropdown-product').each(function() {
if (!$(this).data("loaded")) {
$('.dd-container', this).load($(this).data('url'), function(){
});
$(this).data("loaded", true);
}
});
<!--
How to load Font Awesome asynchronously
Use: Just put this script on the bottom/footer of your web
-->
<script type="text/javascript">
(function() {
var css = document.createElement('link');
css.href = '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css';
css.rel = 'stylesheet';

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@gopperman
gopperman / gist:7418121
Last active December 28, 2015 01:09 — forked from anonymous/gist:7418114
JQuery in-page Smooth Scrolling
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
@gopperman
gopperman / gist:6428458
Created September 3, 2013 19:30
Javascript function suicide - have a function kill itself so that it only runs once
var init = function () {
// do the initializing
init = function() {
return false;
}
};
@gopperman
gopperman / gist:6166280
Last active December 20, 2015 17:09
These Wordpress filters demonstrate two methods to publish (and view) posts in the future. Great for events, etc.
add_filter( 'wp_insert_post_data', 'publish_future' );
/* Avoid publishing posts as 'future' in the first place.
function publish_future( $data ) {
if ( $data['post_status'] == 'future' && $data['post_type'] == 'post' )
$data['post_status'] = 'publish';
return $data;
}
jQuery(document).ready(function() {
jQuery.fn.cleardefault = function() {
return this.focus(function() {
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;
}