Skip to content

Instantly share code, notes, and snippets.

@davidpiesse
davidpiesse / tailwind_md_colours.js
Last active November 30, 2020 21:35
Replace the default (still great) colors from Tailwind to those from Material Design maintaining the Tailwind naming convention
//Notes
//
//For mapping the 100-900 colors we have mapped as follows:
//darkest:900
//darker:700
//dark:600
//base:500
//light:400
//lighter:300
//lightest:100
@adamwathan
adamwathan / vue.sublime-snippet
Created February 5, 2018 20:24
Vue Component Snippet for Sublime
<snippet>
<content><![CDATA[
<template>
${0}
</template>
<script>
export default {
props: [${1}],
data() {
@jgodson
jgodson / checkout-script-messages.liquid
Last active November 30, 2020 21:39
Show script discount messages in checkout on your Shopify store
(function() {
// The events to listen for to append the messages
// page:change is all we really need, but the page:load will fire sooner
// so the messages will be less likely to pop-in
var events = ['page:load', 'page:change'];
events.forEach(function(event) {
document.addEventListener(event, appendScriptMessages);
});
@reinink
reinink / webpack.mix.js
Created November 20, 2017 13:19
Using Purgecss with Tailwind and Laravel Mix
let cssImport = require('postcss-import')
let cssNext = require('postcss-cssnext')
let glob = require('glob-all')
let mix = require('laravel-mix')
let purgeCss = require('purgecss-webpack-plugin')
let tailwind = require('tailwindcss')
mix.js('resources/assets/js/app.js', 'public/js')
.postCss('resources/assets/css/app.css', 'public/css/app.css', [
cssImport(),
@andrewdelprete
andrewdelprete / webpack.config.js
Last active April 12, 2023 01:55
Webpack: Tailwind CSS + PurgeCSS Example
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const path = require("path");
const glob = require("glob-all");
const PurgecssPlugin = require("purgecss-webpack-plugin");
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
@andrewdelprete
andrewdelprete / webpack.mix.js
Last active August 28, 2024 21:30
Laravel Mix: Tailwind CSS + PurgeCSS Example
let mix = require("laravel-mix");
let tailwindcss = require("tailwindcss");
let glob = require("glob-all");
let PurgecssPlugin = require("purgecss-webpack-plugin");
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
@dek4nice
dek4nice / multiple-blocks-in-jade-mixins.pug
Last active October 15, 2017 14:46
Multiple blocks in Jade/Pug mixins
//- Multiple blocks in jade mixins? #1693
//- https://github.com/pugjs/pug/issues/1693
//- [Issue on github]
//- https://github.com/pugjs/pug/issues/1693
h2 Issue
p
a(href='https://github.com/pugjs/pug/issues/1693' , target="_blank") Multiple blocks in jade mixins?
hr
@zakhardage
zakhardage / product price table
Created March 26, 2017 03:40
product price table - hard coded value categories
{% for variant in product.variants %}
{% assign option = variant.option1 | downcase %}
{% assign p = variant.price | money %}
{% unless option contains '+' or option contains 'swatch' %}
{% if option contains '1-4' %}
{% assign one = p %}
{% else %}
{% unless option contains '-' %}{% assign one = p %}{% endunless %}
{% endif %}
{% endunless %}
@zakhardage
zakhardage / cart using wholesale discount
Created March 18, 2017 05:07
cart using wholesale discount
{% if customer %}{% assign tags = customer.tags | join:' ' | downcase %}{% if tags contains 'wholesale' %}{% assign wholesale = true %}{% endif %}{% endif %}
{% if wholesale %}
{% if tags contains 'reorder' or customer.orders_count > 0 %}{% assign reorder = true %}{% endif %}
{% assign min = settings.cart-min | times:100 | minus:1 %}
{% if reorder %}{% assign min = setting.cart-min-reorder | times:100 | minus:1 %}{% endif %}
{% endif %}
<div class="meta grid">
{% if wholesale %}{% assign total = cart.total_price | divided_by:2 %}{% else %}{% assign total = cart.total_price %}{% endif %}
<p>{{ total | money | remove:' ' }}</p>
@zakhardage
zakhardage / Pop up and cookies
Created December 16, 2016 18:06
Pop up and cookies
// Newsletter popup
$(document).ready(function() {
$('.response').addClass('rte');
var coOkie = getCookie("bellePopup");
if (coOkie != "") {console.log('coOkie set');} else {newsletterPopup();}
});
function newsletterPopup() {
setTimeout(function() {
$('.overlay').fadeIn();
$('.pop').fadeIn();