We install certutil and pk12util if necessary:
sudo apt install libnss3-tools
On Linux, Chromium uses the NSS Shared DB. Check if you have the ~/.pki/nssdb directory:
ls $HOME/.pki/nssdb
| /** @jsx h */ | |
| // You only need custom elements for this!!! | |
| import 'skatejs-web-components/src/native-shim'; | |
| import { Component, define, h, prop } from 'skatejs'; | |
| import ShadowNode, { scopeCss, scopeTree } from './shadow-node'; | |
| // Converts real DOM nodes into Incremental DOM nodes. | |
| // | |
| // This is orthogonal to this gist, but makes it so we can distribute real |
We install certutil and pk12util if necessary:
sudo apt install libnss3-tools
On Linux, Chromium uses the NSS Shared DB. Check if you have the ~/.pki/nssdb directory:
ls $HOME/.pki/nssdb
| /** | |
| * Load a script by injecting a `<script>` element to the DOM `<head>`. | |
| * | |
| * @param {string} src - the URI to fetch the script from | |
| * @return {Promise} that gets resolved once the script is loaded. | |
| */ | |
| function loadScriptIntoBrowser(src) { | |
| return new Promise((resolve) => { | |
| const scriptNode = document.createElement('script'); | |
| scriptNode.src = src; |
| #!/bin/bash | |
| files=$(git diff --cached --name-only | grep '\.jsx\?$') | |
| # Prevent ESLint help message if no files matched | |
| if [[ $files = "" ]] ; then | |
| exit 0 | |
| fi | |
| failed=0 | |
| for file in ${files}; do |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent| #!/bin/bash | |
| # This script builds (a subset of) the AlkuThree-Light font | |
| # from source files made public by Opetushallitus (oph.fi). | |
| # Whether or not this infringes on copyrights or other rights | |
| # is anyone's guess. | |
| # | |
| # Prerequisites: wget & fontforge | |
| # Optionally: fonttools (ttx) for repeatable builds | |
| # (sha1 should probably be 5d2eba6728246b7050500b3c8cac4780f99f4728) |
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; | |
| public class Example { | |
| public static void main(String[] args) { | |
| String result = StringReplacer.replace("Hello World!", Pattern.compile("\\d+"), m -> ("" + (Integer.parseInt(m.group()) * 2)); | |
| } | |
| } |
| // [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (: | |
| Array.prototype.flatMap = function(lambda) { | |
| return Array.prototype.concat.apply([], this.map(lambda)); | |
| }; |
| #!/usr/bin/env bash | |
| # names of latest versions of each package | |
| export VERSION_PCRE=pcre-8.38 | |
| export VERSION_OPENSSL=openssl-1.0.2d | |
| export VERSION_NGINX=nginx-1.9.7 | |
| # URLs to the source directories | |
| export SOURCE_OPENSSL=https://www.openssl.org/source/ | |
| export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ |