Skip to content

Instantly share code, notes, and snippets.

@fgerschau
fgerschau / webpagetest.js
Last active March 29, 2020 14:51
WebPageTest integration
const WebPageTest = require('webpagetest');
const util = require('util');
const PUBLIC_URL = 'https://pomodoro-timer.app';
const wpt = new WebPageTest('https://www.webpagetest.org/', process.env.WPT_API_KEY);
const isCI = process.env.CI;
const reportError = (err, id) => {
console.error('\x1b[31m%s\x1b[0m', `
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
import React, { FC, useEffect } from 'react';
import { Snackbar, Button } from '@material-ui/core';
import * as serviceWorker from '../serviceWorker';
const ServiceWorkerWrapper: FC = () => {
const [showReload, setShowReload] = React.useState(false);
const [waitingWorker, setWaitingWorker] = React.useState<ServiceWorker | null>(null);
const onSWUpdate = (registration: ServiceWorkerRegistration) => {
setShowReload(true);
@fgerschau
fgerschau / keybindings.json
Created July 18, 2018 07:24
Keybindings for switching tabs in VSCode (open with ⌘K ⌘S)
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+0",
"command": "workbench.action.openLastEditorInGroup"
},
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1"
},
<placeholder loadingdata="posts" height="300px">
<ul>
<li ng-repeat="post in posts">
{{post.title}}
</li>
</ul>
</placeholder>
@fgerschau
fgerschau / placeholder.js
Last active August 17, 2017 09:17
AngularJS Placeholder Directive w/ Bootstrap
// Usage in pug/jade:
// placeholder(loadingdata="posts" height="300px")
// -> waits for 'posts' to be loaded
angularApp.directive('placeholder', function ($parse) {
function compile(element, attrs) {
element.children().attr('ng-show', attrs.loadingdata);
element.hide();
var height = attrs.height;
# Enable tab completion
source ~/git-completion.bash
# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
red="\[\033[0;31m\]"
lightred="\[\033[1;31m\]"
reset="\[\033[0m\]"