This gist contains the source code in my video series about Realtime Database triggers. You can watch the three parts here:
index.ts
contains the Cloud Functions code, and dialog.ts
contains the script to run
const observer = new PerformanceObserver((list) => { | |
for (const entry of list.getEntries()) { | |
// `name` will be either 'first-paint' or 'first-contentful-paint'. | |
const metricName = entry.name; | |
const time = Math.round(entry.startTime + entry.duration); | |
ga('send', 'event', { | |
eventCategory: 'Performance Metrics', | |
eventAction: metricName, | |
eventValue: time, |
Converting md files to html w/highlighting | |
0a) Create a root directory to pull in all the repos | |
0b) Recursively clone or pull each repo | |
$> git clone <repo_url> | git pull on the existing repos | |
0c) Create a TOC index.html file for the root folder | |
$> echo '<head>' >> index.html | |
$> echo '' >> index.html | |
$> echo '</head>' >> index.html | |
$> echo '<body>' >> index.html | |
$> ls >> temp.html |
"use strict"; | |
// Load plugins | |
const autoprefixer = require("autoprefixer"); | |
const browsersync = require("browser-sync").create(); | |
const cp = require("child_process"); | |
const cssnano = require("cssnano"); | |
const del = require("del"); | |
const eslint = require("gulp-eslint"); | |
const gulp = require("gulp"); |
<filter id="displacement" filterUnits="objectBoundingBox"> | |
<feTurbulence type="turbulence" baseFrequency="0.01" numOctaves="2" result="turb"/> | |
<feColorMatrix in="turb" result="huedturb" type="hueRotate" values="90"> | |
<animate attributeType="XML" attributeName="values" values="0;180;360" dur="6s" repeatCount="indefinite"/> | |
</feColorMatrix> | |
<feDisplacementMap in="SourceGraphic" in2="huedturb" scale="20" result="displace" xChannelSelector="B"/> | |
<feOffset dx="-5" dy="-5" in="displace" result="unoffsetdisplace"/> | |
</filter> |
class LazyVideoLoader { | |
constructor() { | |
this.videos = [].slice.call(document.querySelectorAll('.hero__bgvideo')); | |
// Abort when: | |
// - The browser does not support Promises. | |
// - There no videos. | |
// - If the user prefers reduced motion. | |
// - Device is mobile. | |
if ( |
This gist contains the source code in my video series about Realtime Database triggers. You can watch the three parts here:
index.ts
contains the Cloud Functions code, and dialog.ts
contains the script to run
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Test</title> | |
<style> | |
.slogan span:nth-child(odd) { | |
color: red; | |
} | |
</style> | |
</head> |
{ | |
"name": "tsquickstart", | |
"version": "1.0.0", | |
"description": "Boilerplate for quick one-off TypeScript projects. Just run `npm start`", | |
"scripts": { | |
"init": "test -f tsconfig.json || (tsc --init -t ESNext -m ESNext && npm install)", | |
"start": "npm run init && concurrently \"npm run watch\" \"npm run serve\"", | |
"serve": "http-server", | |
"watch": "tsc -p . --watch", | |
"build": "tsc -p ." |
// Gulp module imports | |
import {src, dest, watch, parallel, series} from 'gulp'; | |
import del from 'del'; | |
import livereload from 'gulp-livereload'; | |
import sass from 'gulp-sass'; | |
import minifycss from 'gulp-minify-css'; | |
import jade from 'gulp-jade'; | |
import gulpif from 'gulp-if'; | |
import babel from 'gulp-babel'; | |
import yargs from 'yargs'; |