Skip to content

Instantly share code, notes, and snippets.

View Andy-set-studio's full-sized avatar

Andy Bell Andy-set-studio

View GitHub Profile
@Andy-set-studio
Andy-set-studio / example.md
Created December 15, 2018 14:35
Filter posts by a passed year
title year layout
An example
2018
example.njk
@Andy-set-studio
Andy-set-studio / .eslintrc VANILLA
Last active November 20, 2018 15:12
ESLint Base
{
"env": {
"browser": true,
"es6": true
},
"parserOptions": {
"parser": "babel-eslint",
"sourceType": "module"
},
"rules": {
@Andy-set-studio
Andy-set-studio / service-worker.js
Created September 4, 2018 15:24
Bypass service worker on localhost
self.addEventListener('fetch', evt => {
// Define the hostnames that you want to ignore
const ignoredHosts = ['localhost'];
// Destructure the hostname out of the event's request URL by creating a new URL instance
const {hostname} = new URL(evt.request.url);
// Bail out if our definition contains this url
if (ignoredHosts.indexOf(hostname) >= 0) {
@Andy-set-studio
Andy-set-studio / stylebot.css
Created August 20, 2018 14:17
Custom styles to help me only check messages and notifications periodically on Twitter
.moments, .top-timeline-tweetbox, .dashboard-left, .dashboard-right, .home, .form-search, .right-actions {
display: none;
}
.content-main {
float: none;
margin: 0 auto;
}
@Andy-set-studio
Andy-set-studio / .eleventy.js
Last active August 20, 2018 19:35
Eleventy sort by order
const sortByOrder = require('./sort-by-order.js');
module.exports = function(eleventyConfig) {
eleventyConfig.addFilter('sortByOrder', sortByOrder);
}
@Andy-set-studio
Andy-set-studio / to-rem.scss
Created June 20, 2018 12:34
Convert pixel value to REM
/**
* To Rem
* -------------------------------------//
* Convert pixel value to REM
*/
@function to-rem($pixel-size: 16) {
@return ($pixel-size / 16) * 1rem;
}
@Andy-set-studio
Andy-set-studio / jump.js
Created October 23, 2017 20:35
[jQuery Jump module] Used for creating a smooth transition for anchor links etc. Will automatically look for bindable elements on 'DOMNodeInserted DOMNodeRemoved' events for ajax content insertions etc. Also utilises history API. #jQuery #legacyJSToRefactor
(function ($) {
$.fn.jump = function (options) {
var elem = $(this),
settings = {
scrollingParent: $('html, body'),
offsetPadding: 0,
scrollSpeed: 800,
target: []
};
@Andy-set-studio
Andy-set-studio / stroke.svg
Created October 23, 2017 20:32
[Static stroke width] Prevents fat stroke for svg paths with vector effects. Codepen: http://codepen.io/hankchizljaw/pen/OXvxyr
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Andy-set-studio
Andy-set-studio / diff.sh
Created October 23, 2017 20:29
[Git diff against other branch] #gitTricks
git diff --name-only OTHER_BRANCH_HERE
@Andy-set-studio
Andy-set-studio / todays-changes.sh
Created October 23, 2017 20:26
[Today's changes] #gitTricks
git log --since="1 day ago" --name-only --pretty=format: | sort | uniq