This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
set encoding=utf-8 nobomb | |
filetype off | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" Vundle manages Vundle 😀 | |
Plugin 'VundleVim/Vundle.vim' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// recursively remove all attributes from a node and all its children | |
const recursiveRemove = node => { | |
removeAttributes(node) | |
while (node.childNodes.length > 0) { | |
for (let child of node.childNodes) { | |
node = child | |
if (node.nodeName !== 'IMG') { | |
recursiveRemove(child) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const animate = (el, delay = 0) => { | |
const node = el.childNodes[0] | |
// Check first if this node is a text node | |
if (node.nodeType === 3) { | |
const text = node.data.split('') | |
const html = text.reduce((acc, curr, index) => { | |
if (curr !== ' ') { | |
const wait = delay * index + delay | |
return (acc += `<span class="animate" style="animation-delay: ${wait}ms">${curr}</span>`) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useRef } from 'react' | |
const isElementInView = (el: HTMLElement) => { | |
const { top, bottom } = el.getBoundingClientRect() | |
// Add an offset so item doesn't load the moment a tiny part of the element is showing. | |
if (top < window.innerHeight - 125 && bottom > 125) { | |
return true | |
} | |
return false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// polyfill | |
import 'intersection-observer' | |
const setupIntersectionObserver = elements => { | |
// keep track of the current focused section as well as the previous. | |
// when the user scrolls up/reverse, we trigger the previous | |
let current, previous | |
const observer = new IntersectionObserver( | |
entries => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Parallax({ className }) { | |
let elements = [] | |
let screenHeight, animationId | |
window.requestAnimationFrame = | |
window.requestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
function(f) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Turn off server | |
sudo service nginx stop | |
// Renew certbot | |
certbot-auto renew —debug | |
// If failed, run this, then rerun renew command | |
sudo /opt/eff.org/certbot/venv/local/bin/pip install cryptography interface | |
// If failed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { debounce } from '../../utils' | |
const withMedia = Component => props => { | |
const [width, setWidth] = React.useState(window.innerWidth) | |
const toggleMedia = debounce(() => { | |
setWidth(window.innerWidth) | |
}, 250) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
export function WithConfirmation({ children }) { | |
const [hasConfirmed, setConfirm] = React.useState(false) | |
return children({ | |
hasConfirmed, | |
setConfirm, | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const capturePosition = () => { | |
const cachedPosition = window.pageYOffset | |
return { | |
freeze: () => { | |
document.body.style = | |
`position: fixed; | |
top: ${cachedPosition * -1}px; | |
width: 100%;` | |
}, | |
unfreeze: () => { |
OlderNewer