Skip to content

Instantly share code, notes, and snippets.

argumentarg1215091, 5096, 5099-5100, 5102, 5127, 5132, 5135-5142, 5301, 5306, 5309, 5347, 5352, 5355, 5363, 5368, 5371, 5379, 5384, 5387, 5395, 5400, 5403, 5411, 5416, 5419, 5427, 5432, 5435, 5443, 5448, 5451, 5469, 5474, 5477, 5603, 5608, 5611, 5619, 5624, 5627, 5635, 5640, 5643-5652, 5661, 5666, 5669-5676, 5683, 5688, 5691, 5701, 5706, 5709, 5718, 5723, 5726-5728, 5758, 5763, 5766, 5774, 5780-5784, 5793, 5798, 5801-5802, 58
BeforeAfterOccurrencesLine numbers
acGeneratoracGen750562, 50570-50571, 50916, 50924, 50927-50928
activeFunctionactiveFunc319526-19528
mancestorModule2827355-27364, 27396-27400, 27402, 27404, 27406-27410, 27438-27439
@michaelficarra
michaelficarra / roadmap.md
Last active May 8, 2026 23:25
iterator built-ins roadmap
#[derive(Debug, PartialEq, Eq)]
enum ArithmeticResult {
Overflow,
Underflow,
Accurate,
}
fn oracle(a: i64, b: i64) -> ArithmeticResult {
let a128 = i128::from(a);
let b128 = i128::from(b);
_cp_ is matched by either |WhiteSpace| or |LineTerminator|, or _cp_ has the same numeric value as a leading surrogate or trailing surrogate, then [...]
_func_ has a [[SourceText]] internal slot, _func_.[[SourceText]] is a sequence of Unicode code points, and HostHasSourceTextAvailable(_func_) is *true*, then [...]
[id="step-assignmenttargettype-web-compat", normative-optional] If the host is a web browser or otherwise supports <emu-xref href="#sec-runtime-errors-for-function-call-assignment-targets" title></emu-xref> and IsStrict(this |CallExpression|) is *false*, then [...]
<emu-not-ref>Record</emu-not-ref> that the binding for _N_ in _envRec_ has been initialized.
Append (_WL_.[[MostRecentLeaveEvent]], _enterEvent_) to _eventsRecord_.[[AgentSynchronizesWith]].
Append [[ArrayBufferByteLengthData]] and [[ArrayBufferMaxByteLength]] to _slots_.
Append scf(_cp_) to _t_.
Append the GlobalSymbolRegistry Record { [[Key]]: _stringKey_, [[Symbol]]: _newSymbol_ } to the GlobalSymbolRegistry List.
Append to _internalSl
@michaelficarra
michaelficarra / pascalsTriangleRow.js
Last active July 27, 2024 20:03
generate a row of Pascal's triangle in linear time and constant space
function* pascalsTriangleRow(row) {
let prev = 1;
for(let i = 1; i <= row; ++i) {
yield prev;
prev = (prev * (row - (i - 1))) / i;
}
yield 1;
}
Array.from(pascalsTriangleRow(19));
@michaelficarra
michaelficarra / once.js
Last active August 4, 2019 07:43
a loose approximation of a potential Function.prototype.once
Function.prototype.once = function () {
let fn = this;
let called = false;
return function() {
if (!called) {
called = true;
return fn.apply(this, arguments);
}
};
};
@michaelficarra
michaelficarra / index.js
Created November 15, 2018 22:16
capabilities
const safeApply = Date.call.bind(Date.apply);
const randomName = () => Math.random().toString(36).slice(2).toLowerCase();
class RevokedCapabilityException extends Error {}
class Capability {
constructor(behaviour, { name = randomName() } = {}) {
this.behaviour = behaviour;
this.name = Object.freeze([].concat(name));
}
@michaelficarra
michaelficarra / SetUsingHashCode.js
Last active June 10, 2017 17:35
Set using hashCode via ECMAScript interfaces proposal
// https://github.com/michaelficarra/ecmascript-interfaces-proposal
interface HasHashCode {
hashCode;
}
class SetUsingHashCode extends Set {
constructor(iterable) {
super();
this.#map = new Map;
for (let x of iterable) {
diff --git c/purescript.cabal i/purescript.cabal
index 4f4fcabd..699e8440 100644
--- c/purescript.cabal
+++ i/purescript.cabal
@@ -231,6 +231,7 @@ library
Language.PureScript.Sugar.TypeClasses
Language.PureScript.Sugar.TypeClasses.Deriving
Language.PureScript.Sugar.TypeDeclarations
+ Language.PureScript.Terms
Language.PureScript.Traversals
@michaelficarra
michaelficarra / append-template-tag.js
Created May 30, 2016 14:29
chainable template tag for joining a bunch of strings over many lines
function append(separator) {
return typeof separator === "string" ? appender(separator, "") : appender("", "").apply(this, arguments);
}
function appender(separator, s) {
return function tag(literalParts, ...computedParts) {
s += literalParts[0];
for (let i = 1; i < literalParts.length; ++i) {
s += computedParts[i - 1] + literalParts[i];
}