This is an alternative to the Modern Script Loading tchnique, that doesn't need to wait for the load
event.
This technique has been successfully tested down to IE9.
<!DOCTYPE html>
<html lang="en">
(function (context, trackingId, options) { | |
const history = context.history; | |
const doc = document; | |
const nav = navigator || {}; | |
const storage = localStorage; | |
const encode = encodeURIComponent; | |
const pushState = history.pushState; | |
const typeException = 'exception'; | |
const generateId = () => Math.random().toString(36); | |
const getId = () => { |
// stores/location.ts | |
import { writable, derived } from "svelte/store"; | |
import { beforeUpdate } from "svelte"; | |
export interface LocationStore { | |
current: Location | undefined; | |
previous: Location | undefined; | |
} |
//////////////////////////////////////////////////////////////////////////////// | |
// Create a directory called "pages" next to | |
// this file, put markdown files in there, and | |
// then run: | |
// | |
// ``` | |
// $ node build.mjs | |
// ``` | |
// | |
// Then deploy the "build" directory somewhere. |
// return true if the Web App is running as PWA (installed) | |
const isPWA = () => ( | |
matchMedia('(display-mode: standalone)').matches || | |
navigator.standalone || | |
document.referrer.includes('android-app://') | |
); |
const glob = require("glob"); | |
const fs = require("fs"); | |
const path = require("path"); | |
const { PurgeCSS } = require("purgecss"); | |
const cssnano = require("cssnano"); | |
const cheerio = require("cheerio"); | |
const minify = require("html-minifier").minify; | |
const sharp = require("sharp"); | |
// This runs on Netlify after Jekyll builds a full site. |
import {define as hookedDefinition} from 'hooked-elements'; // or wicked- | |
import css from 'ustyler'; | |
export const define = (selector, definition) => { | |
// let the library throw on duplicated selectors | |
const result = hookedDefinition(selector, definition); | |
// add styles for this selector | |
if (definition.style) css(definition.style); | |
// return the wicked/hooked magic 🌈 | |
return result; |
This is an alternative to the Modern Script Loading tchnique, that doesn't need to wait for the load
event.
This technique has been successfully tested down to IE9.
<!DOCTYPE html>
<html lang="en">
function dominantColorRGBA(pxv :ArrayLike<int>, pxcount :int, stride :int) :RGBA { | |
let cm = new Map<int,int[]>() | |
// average and count RGB values | |
for (let i = 0; i < pxcount; i += stride) { | |
let r = pxv[i], g = pxv[i + 1], b = pxv[i + 2], a = pxv[i + 3] | |
// key = (a << 24) + (r << 16) + (g << 8) + b | |
let key = (r << 16) + (g << 8) + b | |
// update or store entry in temporary map. |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
[...Array(10)].map(i=>(~~(Math.random()*36)).toString(36)).join('') | |
(Math.random()*0xFFFFFF<<0).toString(16); | |
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |