Moved to
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
' Flags for the options parameter | |
Const BIF_returnonlyfsdirs = &H0001 | |
Const BIF_dontgobelowdomain = &H0002 | |
Const BIF_statustext = &H0004 | |
Const BIF_returnfsancestors = &H0008 | |
Const BIF_editbox = &H0010 | |
Const BIF_validate = &H0020 | |
Const BIF_browseforcomputer = &H1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class Person | |
Private m_Age | |
Private m_Name | |
Public Default Function Init(Name, Age) | |
m_Name = Name | |
m_Age = Age | |
Set Init = Me | |
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function xuuid7(): string { | |
const randomUUID = crypto.randomUUID(); | |
const randomUUIDArray = uuidToBytes(randomUUID); | |
// Get the current timestamp in milliseconds | |
const timestamp = Math.floor(Date.now()); | |
// Convert the timestamp to a byte array | |
const timestampBytes = new Uint8Array(8); | |
const timestampView = new DataView(timestampBytes.buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See the following for a Scala example: <https://i.cs.hku.hk/~bruno/papers/Modularity2016.pdf> | |
/* Initial code */ | |
abstract class Exp { abstract evaluate(): number } | |
class Lit extends Exp { | |
constructor(readonly x: number){ super(); } | |
evaluate(): number { return this.x } | |
} | |
class Add extends Exp { | |
constructor(readonly left: Exp, readonly right: Exp) { super() } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ContError extends Error { returnValue = undefined; } | |
function callcc(fnCont) { | |
const contErr = new ContError("Unable to continue current continuation."); | |
const fnEscape = (returnValue) => { | |
contErr.returnValue = returnValue; | |
throw contErr; | |
} | |
try { | |
return fnCont(fnEscape); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We model the call stack using a linked list of Generators | |
// Each Generator has a _return field pointing back to its parent | |
function stepGen(gen, arg) { | |
const {done, value} = gen.next(arg) | |
if(done) { | |
if(gen._return) { | |
stepGen(gen._return, value) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never | |
type IntersectionToUnion<I> = (I extends any ? (x: I) => any : never) extends ((x: infer U) => any) ? U : never; | |
/** | |
* Zip two tuples together into a tuple of tuples | |
* @example | |
* ZipTuple<['name', 'age', 'isActive'], [string, number, boolean]> | |
* => [["name", string], ["age", number], ["isActive", boolean]] | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Random Integer from m to n excluding e | |
const randInt = (m: number, n: number, e?: number): number => { | |
const result = Math.floor(Math.random() * m) + n; | |
return e == undefined ? result : | |
result == e ? randInt(m, n, e) : | |
result | |
} | |
class Person { constructor(public weight: number) {} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Number Expressions */ | |
// data | |
type Exp = | |
{ tag: 'Lit', value: number } | | |
{ tag: 'Add', left: Exp, right: Exp } | |
// operations | |
function evaluate(exp: Exp): number { | |
switch (exp.tag) { |
NewerOlder