Snippets frequently used with Sage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$hk-grotesk-path: '../fonts/hkgrotesk-'; | |
$weights: 300, 400, 500, 600, 700, 800, 900; | |
@each $weight in $weights { | |
@font-face { | |
font-family: 'hk grotesk'; | |
src: url('#{$hk-grotesk-path}#{$weight}-webfont.woff2') format('woff2'), | |
url('#{$hk-grotesk-path}#{$weight}-webfont.woff') format('woff'); | |
font-weight: $weight; | |
font-style: normal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chalk = require('chalk') | |
const {join} = require('path') | |
const sharp = require('sharp') | |
const request = require('request') | |
const {GraphQLClient} = require('graphql-request') | |
const SITEURL = `http://kellymears.vagrant` | |
/** | |
* Process image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
For a better understanding of ics requirements and time formats | |
please check https://gist.github.com/jakebellacera/635416 | |
*/ | |
// UTILS | |
// Check if string is a timestamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add new rewrite rule | |
*/ | |
function create_new_url_querystring() { | |
add_rewrite_rule( | |
'blog/([^/]*)$', | |
'index.php?name=$matches[1]', | |
'top' | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get a random floating point number between `min` and `max`. | |
* | |
* @param {number} min - min number | |
* @param {number} max - max number | |
* @return {number} a random floating point number | |
*/ | |
function getRandomFloat(min, max) { | |
return Math.random() * (max - min) + min; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This is free and unencumbered software released into the public domain. | |
* | |
* Anyone is free to copy, modify, publish, use, compile, sell, or | |
* distribute this software, either in source code form or as a compiled | |
* binary, for any purpose, commercial or non-commercial, and by any | |
* means. | |
* |