This file contains hidden or 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
export function projectMutableOverAutomergeDocV2<T extends object>( | |
json: any, | |
updateJson: (cb: (json: any) => any) => void, | |
typeSchema: TypeSchema<T> | |
): T { | |
if (typeof typeSchema != "object" || typeSchema.type != "Object") { | |
throw new Error("Expected object."); | |
} | |
let properties = typeSchema.properties; | |
let result = new Proxy<T>( |
This file contains hidden or 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
import { Cont, do_, exec, execR, } from "prelude"; | |
let freeVar = 0; | |
let code = ""; | |
function main(): Cont<void> { | |
return do_(() => { | |
let name = ask(_("What is your name?")); | |
print(append(_("Hello "), name)); | |
}); |
This file contains hidden or 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
import { Cont } from "prelude"; | |
let div = document.createElement("div"); | |
div.style.setProperty("position", "absolute"); | |
div.style.setProperty("left", "20px"); | |
div.style.setProperty("top", "20px"); | |
div.style.setProperty("width", "300px"); | |
div.style.setProperty("z-index", "100"); | |
div.style.setProperty("background-color", "rgba(0,0,0,0.7)"); | |
setTimeout(() => { |
This file contains hidden or 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 Extract<Type, Union> = Type extends Union ? Type : never; | |
export type TypeSchema<A> = | |
TypeSchemaInvariantMap<unknown, A> | | |
TypeSchemaRecursive<A> | | |
{ type: "MaybeUndefined", elemTypeSchema: TypeSchema<NonNullable<A>>, } | ( | |
A extends ({ has: true, value: unknown, } | { has: false, }) ? { type: "Optional", elemTypeSchema: TypeSchema<Extract<A, { value: unknown, }>["value"]>, } : | |
A extends boolean ? { type: "Boolean", } : | |
A extends number ? { type: "Number", } : | |
A extends string ? { type: "String", possibleValues?: string[], } : |
This file contains hidden or 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
import { SetStoreFunction, Store, createStore, reconcile, unwrap } from "solid-js/store"; | |
import { parseJsonViaPropertiesSchema, writeJsonViaPropertiesSchema } from "../model/PropertiesSchema"; | |
import { Result, err, ok } from "../model/Result"; | |
import { Component, ComponentType, IsComponent, IsComponentType } from "./Component"; | |
import { Registry } from "./Registry"; | |
import { generateUUID } from "three/src/math/MathUtils"; | |
import { parentComponentType } from "./components/ParentComponent"; | |
import { childrenComponentType, ChildrenState } from "./components/ChildrenComponent"; | |
import { Accessor, batch, createMemo, createSignal, onCleanup, untrack } from "solid-js"; |
This file contains hidden or 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 ProcessFile { | |
param( | |
[string]$inputFilename, | |
[string]$outputFilename | |
) | |
$csv = @() | |
$sr = New-Object System.IO.StreamReader($inputFilename) | |
try { | |
while ($true) { |
This file contains hidden or 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
Add-Type -ReferencedAssemblies ("Microsoft.Office.Interop.Excel") -TypeDefinition @" | |
using System; | |
using System.Collections.Generic; | |
using Excel = Microsoft.Office.Interop.Excel; | |
public static class Program { | |
public static void Main(string[] args) { | |
if (args.Length != 2) { | |
Console.WriteLine("Please pass input file name and output file name as arguments."); | |
return; |
This file contains hidden or 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
import { Vec2 } from "../math/Vec2"; | |
import { Result, err, ok } from "./Result"; | |
export type PropertiesSchema<A> = PropertiesSchemaInvMap<unknown,A> | PropertiesSchema2<A>; | |
type PropertiesSchemaInvMap<A,B> = { | |
type: "InvMap", | |
propertiesSchema: PropertiesSchema<A>, | |
fn1: (a: A) => B, | |
fn2: (b: B) => A, |
This file contains hidden or 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
use std::cell::{Cell, RefCell}; | |
use std::rc::{Rc, Weak}; | |
use std::ops::{Deref, DerefMut}; | |
pub struct FgrCtx { | |
observer: Rc<Node>, | |
dirty_nodes: Vec<Rc<Node>>, | |
transaction_depth: usize, | |
} |
This file contains hidden or 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
#[derive(Debug, PartialEq, Eq)] | |
pub enum ChunkNextResult { | |
Empty, | |
Char(char), | |
Eof, | |
} | |
pub struct Chunk<'a> { | |
next: Box<dyn FnMut()->ChunkNextResult+'a>, | |
unnext_stack: Vec<char>, |
NewerOlder