Skip to content

Instantly share code, notes, and snippets.

View lonekorean's full-sized avatar

Will Boyd lonekorean

View GitHub Profile
@lonekorean
lonekorean / gist:4d39b2a1013f574e3ede
Last active April 21, 2023 07:35
Simple web worker, worker file
self.addEventListener('message', receiveMessage);
function receiveMessage(e) {
self.postMessage('Sup, ' + e.data + '?');
}
@lonekorean
lonekorean / gist:46ebad9a941585cf32d4
Created March 22, 2015 03:49
Auto cache-buster
window.addEventListener('keydown', function(e) {
if (e.keyCode === 116 || (e.ctrlKey && e.keyCode === 82)) { // f5 or ctrl + r
// parse URL
var split = window.location.href.split('#');
var url = split[0];
var hash = split[1];
// set cache-busting query string param
var pair = 'cachebuster=' + Date.now();
if (url.indexOf('cachebuster=') > -1) {
@lonekorean
lonekorean / gist:7759870
Last active April 21, 2023 07:33
Gradient animation workaround
button {
background-image: linear-gradient(#5187c4, #1c2f45);
background-size: auto 200%;
background-position: 0 100%;
transition: background-position 0.5s;
/* ...and various other button styles */
}
button:hover {
@lonekorean
lonekorean / file.html
Last active April 21, 2023 07:30
Goo blobs SVG filter
<svg>
<defs>
<filter id="goo">
<feGaussianBlur in="SourceGraphic" stdDeviation="30" result="blur" />
<feColorMatrix in="blur" mode="matrix" values="
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 50 -16
" result="matrix" />
@lonekorean
lonekorean / file.txt
Last active March 30, 2023 19:34
Heroku login
heroku login
@lonekorean
lonekorean / file.css
Last active November 1, 2020 20:25
Prefers reduced motion test
@media (prefers-reduced-motion) {
*, *::before, *::after {
animation: none !important;
transition: none !important;
}
}
@lonekorean
lonekorean / file.scss
Created March 11, 2019 20:52
Coder's Block v6 code styles
@mixin code-wrap {
border: 1px dashed #ccc;
background-color: #f2f2f2;
}
code {
font-family: 'Source Code Pro', monospace;
}
// inline code
@lonekorean
lonekorean / file.js
Created December 20, 2018 15:45
A chunk of my gatsby-node.js
exports.createPages = ({ graphql, actions }) => {
return new Promise((resolve, reject) => {
graphql(`
{
allMarkdownRemark(
sort: { fields: [frontmatter___date], order: DESC }
) {
edges {
node {
fields {
@lonekorean
lonekorean / gist:1b9a17bbf235a7557a0e
Created June 10, 2015 20:39
Checkbox trickery, ordering with flexbox
.items {
display: flex;
flex-direction: column;
}
.done {
order: 1;
}
input:checked + label {
@lonekorean
lonekorean / file.js
Last active October 14, 2018 13:36
Custom properties for polka dots
CSS.registerProperty({
name: '--dot-spacing',
syntax: '<length>',
initialValue: '20px',
inherits: false
});
CSS.registerProperty({
name: '--dot-fade-offset',
syntax: '<percentage>',
initialValue: '0%',