This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
/** | |
* useScroll React custom hook | |
* Usage: | |
* const { scrollX, scrollY, scrollDirection } = useScroll(); | |
*/ | |
import { useState, useEffect } from "react"; | |
export function useScroll() { | |
const [lastScrollTop, setLastScrollTop] = useState(0); |
cd ~/ | |
mkdir .localhost-ssl | |
sudo openssl genrsa -out ~/.localhost-ssl/localhost.key 2048 | |
sudo openssl req -new -x509 -key ~/.localhost-ssl/localhost.key -out ~/.localhost-ssl/localhost.crt -days 3650 -subj /CN=localhost | |
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/.localhost-ssl/localhost.crt | |
npm install -g http-server | |
echo " | |
function https-server() { |
import { Component, h, cloneElement } from 'preact'; | |
export default class SwipeRecognizer extends Component { | |
tolerance = 100; | |
gesture = { x: [], y: [], match: '' }; | |
componentDidMount() { | |
this.base.addEventListener('touchstart', this.capture); | |
this.base.addEventListener('touchmove', this.capture); | |
this.base.addEventListener('touchend', this.compute) |
Trying to lazy load images. |
// To unzip the epub, move the ePub to a folder, cd to it then simply: | |
unzip MyEbook.epub | |
// To zip up an epub: | |
1. zip -X MyNewEbook.epub mimetype | |
2. zip -rg MyNewEbook.epub META-INF -x \*.DS_Store | |
3. zip -rg MyNewEbook.epub OEBPS -x \*.DS_Store | |
Some explanations necessary here. We start each line with two flags: |