Skip to content

Instantly share code, notes, and snippets.

View tylersticka's full-sized avatar

Tyler Sticka tylersticka

View GitHub Profile
@tylersticka
tylersticka / gulpfile.js
Last active August 29, 2015 13:57
Example of bespoke Gulp task that includes Knockout templates
/**
* This project's actual gulpfile contains much more than this,
* but these are the relevant bits.
*/
// Node libraries
var fs = require('fs');
var path = require('path');
// Gulp + plugins
@tylersticka
tylersticka / gulpfile.js
Created July 17, 2014 21:53
Simple Knockout template inclusion with Gulp
// include gulp + template plugin
var gulp = require('gulp');
var template = require('gulp-template');
// include the koTemplates module locally
var koTemplates = require('./koTemplates');
// create the 'templates' task
gulp.task('templates', function () {
// single-page app, so just pipe through index
gulp.src('./src/templates/index.html')
@tylersticka
tylersticka / moment.js
Last active August 29, 2015 14:22
Simple moment helper for Handlebars
/*
* Format a date using Moment.
* Usage: {{moment date format="MMMM YYYY"}}
*/
var Handlebars = require('handlebars'),
_ = require('lodash'),
moment = require('moment');
Handlebars.registerHelper('moment', function (context, block) {
@tylersticka
tylersticka / times.js
Created August 4, 2015 23:42
Simple iteration helper for Handlebars
/**
* Iterate over a block a given number of times.
*
* Usage:
* <ul>
* {{#times 5}}<li>Item {{@index}}</li>{{/times}}
* </ul>
*/
var Handlebars = require('handlebars');
@tylersticka
tylersticka / styles.css
Created December 9, 2022 18:01
Mastodon Advanced View: Highlight Missing Alt Text
.media-gallery__item-thumbnail:has(img:not([alt])) {
position: relative;
}
.media-gallery__item-thumbnail:has(img:not([alt]))::after {
align-items: center;
background: rgb(191, 64, 64);
border-radius: 4px;
color: #fff;
content: 'No alt';
@tylersticka
tylersticka / gif-like.js
Last active November 21, 2024 19:39
Starting point for an animated GIF-like video web component
// https://cloudfour.com/thinks/video-gifs-are-forever-lets-make-them-better/
class GifLike extends HTMLElement {
static motionQuery = window.matchMedia(
"(prefers-reduced-motion: no-preference)"
);
connectedCallback() {
this.video = this.querySelector("video");