Skip to content

Instantly share code, notes, and snippets.

@celsowhite
celsowhite / shopify_shipping_confirmation.liquid
Last active October 1, 2016 03:16
Shopify Shipping Confirmation Email Template
<!--
Adjustments to the Shopify 'Shipping Confirmation' email template to show partially fulfilled items.
-->
<title>Shipping confirmation for order {{ name }}</title>
<!-- If all items were fulfilled -->
{% if fulfillment.item_count == item_count %}
@celsowhite
celsowhite / wp_post_mail_hooks.php
Created January 21, 2016 13:53
Automatic emails sent to wordpress admins depending on the status of a post. Easy ability for team members to keep up to date with content publishing without going into the backend.
/*=========================================
Draft to Under Construction Project Hook
Upon changing the status of a post with a specific parent from draft to published, send an email notifying the team.
Codex reference: https://codex.wordpress.org/Post_Status_Transitions
=========================================*/
function draft_to_under_construction_project( $new_status, $old_status, $post ) {
if ($post->post_type == 'projects' && $post->post_parent == 7334 && $old_status == 'draft' && $new_status == 'publish') {
@celsowhite
celsowhite / smooth_scroll.js
Last active May 14, 2018 16:07
Smooth scroll links. Uses event delegation.
/*----------------------------
SMOOTH SCROLL
----------------------------*/
$( "body" ).on( "click", ".smooth_scroll", function() {
// Breakpoint to adjust the offset distance.
const tabletLandscapeBreakpoint = window.matchMedia("(max-width: 1024px)");
@celsowhite
celsowhite / mailchimp.js
Last active October 25, 2018 11:11
Snippet for Mailchimp ajax form submissions.
<!-- Email Signup HTML -->
<div class="mc_embed_signup">
<form action="//trago.us11.list-manage.com/subscribe/post-json?u=6a6ec6ff09e1e698609b74747&amp;id=b6a9a7c361&c=?" method="post" name="mc-embedded-subscribe-form" class="validate mc-embedded-subscribe-form newsletter__form" novalidate>
<input type="submit" value="Submit" name="submit" id="mc-embedded-subscribe" class="button"><input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_bfaeb9f9cfe94bf88ebe82105_58d7ecad1c" tabindex="-1" value=""></div>
</form>
<div class="mce-responses" class="clear">
<div class="response mce-error-response" style="display:none"></div>
{% comment %}
Template used sitewide for each time a product is displayed.
This template handles the product/variant images, showing product information and variants.
At the bottom of the html is a script that dynamically show price and updates the selected variant ID.
The script for adding the product to the cart is in scripts.js.
{% endcomment %}
@celsowhite
celsowhite / sass_keyframe_color_mixin.scss
Last active January 16, 2017 17:58
Sass snippet for when you need to do the same keyframe animation for different elements but use different colors.
// Setup a map for the color variables.
$colorMap: (firstBlue: #297189, secondBlue: #BEEBEB, thirdBlue: #A2DAE0, fourthBlue: #81C4D4, fifthBlue: #5099AA);
// Loop through each to create the selector and keyframes function
@each $colorName, $color in $colorMap {
// Selector for this specific svg component.
import React from 'react';
import ReactDOM from 'react-dom';
class ItemField extends React.Component {
render() {
return (
<form onSubmit={(e) => this.props.onSubmit(e)}>
<input type="text" value={this.props.inputValue} onChange={(e) => this.props.onChange(e)} />
<input type="submit" value="Submit" />
</form>
@celsowhite
celsowhite / parallax.js
Created July 1, 2017 17:39
Parallax function that can be applied to any element on a page. Control the elements speed and rotation.
/*=================================
General Parallax Elements
=================================*/
const parallaxItems = document.querySelectorAll('.parallax_item');
const windowHeight = window.innerHeight;
// Check each item to see if it is in view on page load so we can set a base position
@celsowhite
celsowhite / git_workflow.md
Last active January 16, 2019 21:04
Celso White LLC git workflow and collaboration.

Overall Points

  • Never develop directly on master. Always do your changes on a feature branch.
  • Primary tasks of merging pull requests and deleting remote feature branches should be done by the project owner/person with access to the clients FTP.

New developer on project. Needs to clone repo and start a fresh new feature branch.