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">
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); |
Like PHP's htmlentities()/htmlspecialchars() functions, JavaScript is easy to implement it.
/**
import React, { Suspense, useState } from "react"; | |
import { unstable_createResource as createResource } from "react-cache"; | |
import { | |
Combobox, | |
ComboboxInput, | |
ComboboxList, | |
ComboboxOption | |
} from "./Combobox2.js"; | |
function App({ tabIndex, navigate }) { |
let UserContext = React.createContext(); | |
class App extends React.Component { | |
state = { | |
user: null, | |
setUser: user => { | |
this.setState({ user }); | |
} | |
}; |
// | |
// Figma project stats | |
// Pulls statistics like number of files, frames, versions etc for a project. | |
// | |
// Usage: | |
// export FIGMA_API_ACCESS_TOKEN='your-token' | |
// node figma-project-stats.js <project-id> | |
// | |
// You can generate tokens in your account settings or at | |
// https://www.figma.com/developers/explorer#personal-access-token |
// handy method to create a Higher Order Component out of a | |
// Render Prop Component (like a Context.Consumer). | |
// handles, statics, displayName, refs, and value forwarding | |
function createHOCFromRenderProp({prop, Consumer}) { | |
return Component => { | |
function Wrapper(props, ref) { | |
return ( | |
<Consumer> | |
{value => <Component {...{...props, [prop]: value, ref}} />} |