Skip to content

Instantly share code, notes, and snippets.

View msmithstubbs's full-sized avatar

Matt Stubbs msmithstubbs

View GitHub Profile
#
# Quick script to migrate issues from Pivotal Tracker to GitHub
#
# Based on https://github.com/suitmymind/lighthouse-to-github/blob/master/migrate-lh-to-gh.rb
# and pivotal-tracker gem: https://github.com/jsmestad/pivotal-tracker
#
#
require 'pivotal-tracker'
require 'yaml'
@msmithstubbs
msmithstubbs / gist:1511716
Created December 22, 2011 20:23
Vim build options (with ruby enabled)
./configure --prefix=/usr/local --enable-rubyinterp --enable-multibyte --enable-cscope --enable-multi--enable-gui=no --disable-gpm
@msmithstubbs
msmithstubbs / gist:3897852
Last active October 11, 2015 17:58
Back In Stock registration form template
<!doctype html>
<!--[if lt IE 7]> <html class="ie6"> <![endif]-->
<!--[if IE 7]> <html class="ie7"> <![endif]-->
<!--[if IE 8]> <html class="ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
<head>
<meta name="viewport" content="width=device-width">
<style>
/*
* simple reset
@msmithstubbs
msmithstubbs / gist:3997215
Created November 1, 2012 22:46
Customise 'yakında tekrar stokta' button
// Find this in product.liquid:
} else {
var message = variant ? "Yakında tekrar stoklarımızda..." : "Yakında tekrar stoklarımızda...";
$('#add-to-cart', $product).addClass('disabled').attr('disabled', 'disabled').val(message);
}
// and change it to:
} else {
@msmithstubbs
msmithstubbs / gist:4038127
Created November 8, 2012 10:51
ANSI colour codes
# http://roguejs.com/2011-11-30/console-colors-in-node-js/
red = '\033[31m'
blue = '\033[34m'
reset = '\033[0m'
@msmithstubbs
msmithstubbs / gist:4044135
Created November 9, 2012 06:57
Hide the Notify Me button for a collection
{% assign in_clearance = false %}
{% for collection in product.collections %}
{% if collection.title == 'Clearance' %}
{% assign in_clearance = true %}
{% endif %}
{% endfor %}
{% if in_clearance %}
<a href="#" id="BIS_trigger" class="btn">Email when available</a>
@msmithstubbs
msmithstubbs / Email field.html
Created November 17, 2012 09:06
Adding a Notify Me form
<!-- Add this to your product.liquid just after the -->
<p id="notify">
<label>We can send you a one-time email when this product is back in stock. We won't use your address for anything else.</label>
<input type="email" id="notify_me">
<input type="submit" value="Notify me" class="btn button" onclick="BISPopover.create(document.getElementById('notify_me').value, {{variant.id}}).then(function(data) { if (data.status == 'OK') { alert(data.message) } else { alert('Pleasse check your email address is correct and try again.') } }); return false;">
</p>
@msmithstubbs
msmithstubbs / snippet-notify-me.liquid
Created November 25, 2012 11:45
Integrating Back In Stock with the notify me snippet
{% form 'contact' %}
{% if form.posted_successfully? %}
<p class="accent-text">Thanks! We will notify you when this product becomes available!</p>
{% else %}
<p>Click <a id="notify-me" href="#">here</a> to be notified by email when {{ product.title }} becomes available.</p>
{% endif %}
{% if form.errors %}
<div class="error feedback accent-text">
<p>Please provide a valid email address.</p>
</div>
@msmithstubbs
msmithstubbs / app.js
Created December 3, 2012 15:28
Assets belong to a model
// asset.js updated to have parentId and assetClass
var AssetSchema = new Schema({
urls: [AssetURLSchema],
md5: { type: String },
name: { type: String },
mimetype: { type: String },
family: { type: String },
format: { type: String },
uploaded: { type: Date, 'default': Date.now },
assetClass: { type: String, enum: ['image', 'font'] },