Skip to content

Instantly share code, notes, and snippets.

View hongc-cc's full-sized avatar
🎯
Focusing

Hong C. hongc-cc

🎯
Focusing
View GitHub Profile
@hongc-cc
hongc-cc / Productivity.md
Last active June 22, 2020 14:15
Dev Tools
Productivity
Branding & Design System
Color Tool
  • Colorbox - For generating color palette transit from one to another
<form method="post" action="" id="login-form" accept-charset="UTF-8">
<input type="hidden" name="action" value="users/login">
<input type="hidden" name="redirect" value="{{redirect}}">
<div class="form-group">
<label for="email">Email</label>
<input id="email" type="text" name="loginName" class="form-control">
</div>
@hongc-cc
hongc-cc / gist:9da1b030a7313312f1a2f67689ecb4c3
Created September 28, 2016 05:10
[CraftCMS] Comparing the cart products to the discount coupon applied.
// collect productIds in the cart
{% set currentDiscount = craft.commerce.getDiscountByCode(order.couponCode) %}
{% if currentDiscount %}
{% if not cartProductIds in currentDiscount.productIds %}You have no products in the cart that meet this discount{% endif %}
{% endif %}
@hongc-cc
hongc-cc / similarVariants.twig
Last active September 27, 2016 04:28
[CraftCMS] Finding similar products by variants' fields
{# scenario
variants -> similar variants by variant's category -> variants group by product's "device" category field
#}
{# Similar Variants with eager loading #}
{% set similarVariants = craft.commerce.variants({
relatedTo: someElements,
with: ['product.device', 'product.url']
}).find() %}
{% set similarVariantsByProduct = similarVariants | group('product.device | last ') %}
@hongc-cc
hongc-cc / transfade.js
Created December 10, 2015 05:54 — forked from haydenbleasel/transfade.js
Medium-style vertical fading parallax scroll modifier for Stellar.js
// Custom transform and opacity modifier for Stellar.js
$.stellar.positionProperty.transfade = {
setPosition: function(element, newLeft, originalLeft, newTop, originalTop) {
var distance = newTop - originalTop;
var rate = $(window).height() / 5;
element.css('transform', 'translate3d(0, ' + distance + 'px, 0').css('opacity', 1 - (distance / rate));
}
};
$.stellar({
@hongc-cc
hongc-cc / gist:6a9d6a8391dd9ac9e143
Last active October 14, 2015 10:01
example of using bem constructor
$placeholder: $black;
$aspect-ratio: ( '16to9': 9/16, '4to3': 3/4, '3to2': 2/3, '2to3': 3/2, '3to4': 4/3, '9to16': 16/9 );
@include object(figure) {
@include element(container) {
position: relative;
display: block;
width: 100%;
overflow: hidden;
// picturefill positioning