Connect to Database
\c [databasename]
//src: https://github.com/swup/swup/blob/master/src/helpers/getCurrentUrl.js | |
const getCurrentUrl = () => { | |
return window.location.pathname + window.location.search; | |
}; | |
export default getCurrentUrl; |
//Src: https://github.com/swup/swup/blob/master/src/helpers/getDataFromHtml.js | |
import { queryAll } from '../utils'; | |
const getDataFromHtml = (html, containers) => { | |
let fakeDom = document.createElement('html'); | |
fakeDom.innerHTML = html; | |
let blocks = []; | |
for (let i = 0; i < containers.length; i++) { |
# src: https://stackoverflow.com/a/17824718/2823589 | |
git filter-branch --tree-filter "rm -rf node_modules" --prune-empty HEAD | |
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d | |
echo node_modules/ >> .gitignore | |
git add .gitignore | |
git commit -m 'Removing node_modules from git history' | |
git gc | |
git push origin master --force |
# best audio | |
youtube-dl -f bestaudio[ext=m4a] --embed-thumbnail --add-metadata | |
# best video and audio | |
youtube-dl -f best <video link> | |
# If you encounter any error during the muxing process or an issue with the video quality selection, you can use one of the following commands: | |
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4 <video link> | |
# optional: --yes-playlist |
body:before { | |
content: ''; | |
display: block; | |
position: fixed; | |
top: 0; | |
z-index: 7; | |
left: 0; | |
right: 0; | |
height: env(safe-area-inset-top); | |
width: 100%; |
addEventListener('fetch', event => { | |
// Prevent the default, and handle the request ourselves. | |
event.respondWith(async function() { | |
// Try to get the response from a cache. | |
const cachedResponse = await caches.match(event.request); | |
// Return it if we found one. | |
if (cachedResponse) return cachedResponse; | |
// If we didn't find a match in the cache, use the network. | |
return fetch(event.request); | |
}()); |
self.addEventListener('activate', function(event) { | |
var cacheAllowlist = ['pages-cache-v1', 'blog-posts-cache-v1']; | |
event.waitUntil( | |
caches.keys().then(function(cacheNames) { | |
return Promise.all( | |
cacheNames.map(function(cacheName) { | |
if (cacheAllowlist.indexOf(cacheName) === -1) { | |
return caches.delete(cacheName); |
//src: https://github.com/tretapey/svelte-pwa/blob/master/public/service-worker.js | |
'use strict'; | |
// Update cache names any time any of the cached files change. | |
const CACHE_NAME = 'static-cache-v1'; | |
// Add list of files to cache here. | |
const FILES_TO_CACHE = [ | |
'/offline.html', |