Skip to content

Instantly share code, notes, and snippets.

Avatar

David Sharp davidsharp

View GitHub Profile
@davidsharp
davidsharp / remark-star-wipe.css
Last active Nov 26, 2021
A neat little star wipe for Remark.js presentations
View remark-star-wipe.css
@-webkit-keyframes wipe {
0% {
-webkit-mask-size: 0% 0%;
}
100% {
-webkit-mask-size: 550% 550%;
}
}
.remark-visible .remark-slide-content {
@davidsharp
davidsharp / animated-sync-icon.jsx
Created Oct 28, 2021
An old animated sync icon, for an old version of React Native (0.40.0)
View animated-sync-icon.jsx
import React, {
PropTypes, Component
} from 'react';
import {
Animated, Easing
} from 'react-native';
// BYO sync icon
const SYNC = require('../images/sync.png')
@davidsharp
davidsharp / townscaper-overlook
Created Oct 27, 2021
Overlook, a Townscaper town with small quaint buildings and overbearing towers
View townscaper-overlook
HzRBnyQt1d2e-uD5L6T7PJdXrnt7_9Q_0_wNPSvW3Z797p9nAsLydSubwj0r1w273L6hdav9pk3mHpXrnt3v7iebbfm4J5uNPSvW3AAzZ7972F9NGAAAEE0yGAAE0nAuLytdSebCAkkkj0Bggctutw2LKApTLAobMAIJJJJpPBcXi7k82cbHpbL5a9QWSSXUAQ60CAS3YAQfC4l4J5t5RKAzhskk0FFA0pFA0nAidJujEAkDJA9JgbXib7kAAJ5IBA5sBAI5TAAQuEAQOJAQzRCAz1CASQ_UCAgckAgctAgc2Ag8pEAI52AA5IBA5aBA5TJAQSuNAQQOSAQQSO
@davidsharp
davidsharp / jump.css
Last active Oct 22, 2021
Lousy alternating jumping styles (good for jumping pumpkins 🎃)
View jump.css
.jump {
display: inline-block;
animation-duration: 1.5s;
animation-name: jump;
animation-iteration-count: infinite;
}
.jump.alt {
animation-delay: .75s;
}
@keyframes jump {
@davidsharp
davidsharp / sway.css
Last active Oct 21, 2021
A short and sweet CSS snippet for slightly spooky swaying text and more
View sway.css
.sway {
display: inline-block;
animation-duration: 2s;
animation-name: sway;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-in-out;
}
@keyframes sway {
from {
@davidsharp
davidsharp / local-storage-proxy.js
Created Aug 17, 2021
Example of using JS proxies as a wrapper for localStorage
View local-storage-proxy.js
// localStorageProxy.foo = 'bar'
// -> localStorage.getItem('foo') = 'bar'
localStorageProxy = new Proxy(localStorage, {
get: (r,n)=>r.getItem(n),
set: (r,n,v)=>r.setItem(n,v),
deleteProperty: (r,n)=>r.removeItem(name)
})
View vowel-reverser.js
// reverses the vowels of a (lowercase) word
(
s=>(r=/[aeiou]/g,x=s.match(r),c=x.length,s.replace(r,_=>x[--c]))
)('geographically') // -> gaigraphocelly
View vowel-sorter.js
// sorts the vowels in a (lowercase) word
(
s=>(r=/[aeiou]/g,x=s.match(r).sort(),c=0,s.replace(r,_=>x[c++]))
)('crocodile') // -> crecidolo
@davidsharp
davidsharp / autorun-retropie.js
Created May 1, 2021
(untested) interruptable node.js script for autorunning retropie on a raspberry pi
View autorun-retropie.js
const child_process = require('child_process')
const readline = require('readline');
let bootRP = true;
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
@davidsharp
davidsharp / deno-bitbar-template.js
Created Feb 5, 2021
Template for a(n uncompiled) deno bitbar plugin
View deno-bitbar-template.js
#!/usr/bin/env -S /usr/local/bin/deno run
import bitbar from 'https://esm.sh/bitbar';
bitbar([
{text: `Yo!`}
])