Skip to content

Instantly share code, notes, and snippets.

View samsolomon's full-sized avatar

Sam Solomon samsolomon

View GitHub Profile
// Add percentage of white to a color
@function tint($color, $percent){
@return mix(white, $color, $percent);
}
// Add percentage of black to a color
@function shade($color, $percent){
@return mix(black, $color, $percent);
}
@samsolomon
samsolomon / Smooth Typekit Loading
Created January 5, 2016 16:26
Prevents typekit js from thrashing layouts.
<script type="text/javascript" src="//use.typekit.net/XXXXXXX.js"></script>
<!-- <script>try{Typekit.load();}catch(e){}</script> -->
<script>try{Typekit.load({ classes: false, events: false }); }catch(e){}</script>
@samsolomon
samsolomon / Create Random Number in Liquid
Last active September 30, 2019 02:52
This code will work to give you a random number to use in Liquid. Works in customer.io.
<!--create a semi-random number using the last second of the send date-->
{% capture time_seed %}
{{ 'now' | date: "%s" }}
{% endcapture %}
<!--manupulate using lots of maths-->
{% assign random = time_seed | times: 1103515245 | plus: 12345 | divided_by: 65536 | modulo: 32768 | modulo: 10 %}
<!--return number-->
{{ random }}