Skip to content

Instantly share code, notes, and snippets.

View P0lip's full-sized avatar

Jakub Rożek P0lip

View GitHub Profile
function add(a, b) {
return a + b;
}
// 1. IC feedback unitialized
add(23, 44);
// 2. now it's pre-monomorphic
add(2, 88);
// let’s optimize 'add' on its next call
%OptimizeFunctionOnNextCall(add);

Keybase proof

I hereby claim:

  • I am p0lip on github.
  • I am p0lip (https://keybase.io/p0lip) on keybase.
  • I have a public key ASD1kAvjS4vvtN1_dL2CRrjfPB_dKa06BHiKDVBCTd61uwo

To claim this, I am signing this object:

@P0lip
P0lip / spectral-4-migration.md
Created July 15, 2019 14:20
Migrating to Spectral 4.0

If you haven't written a custom ruleset, never used a config and use Spectral via CLI only, it's very likely you are unaffected by any of the breaking changes we introduced, therefore you might upgrade your Spectral version right away. Our docs have been updated, so you can always refer to them, but to make the transition less painful, this migration guide covers the most notable changes.

Note, 3.0 version was a bit of a transition-version, without any significant changes, besides the config file we removed in 4.0. That said, the following migration is kind of 2.x/3.x to 4.x.

@P0lip
P0lip / spell-checker.js
Last active September 30, 2022 15:52
Spectral spell-checker custom function
// https://cdn.skypack.dev/nspell
import nspell from 'https://cdn.skypack.dev/pin/[email protected]/mode=imports,min/optimized/nspell.js';
import { fetch } from '@stoplight/spectral-runtime';
import { createRulesetFunction } from '@stoplight/spectral-core';
function fetchAsset(lang, ext) {
return fetch(`https://unpkg.com/dictionary-${lang}/index.${ext}`).then(r => r.text());
}
const instances = new Map();