Skip to content

Instantly share code, notes, and snippets.

@xieyuheng
xieyuheng / Bin.i
Created September 21, 2023 16:18 — forked from bojidar-bg/Bin.i
Binary type with addition and multiplication for interaction nets, https://inet.run/playground/
// Example usage:
// bend b1 b1 b0 // = 0b110 = 4+2 = 6
// zero add1 add1 add1 add1 add1 add1 add1 ntob // 8 Nat -> 8 Bin
// bmul // = 6 * 7 = 42
// // -> takes 61 steps; doing the same with Nat mul takes 125 steps
// Type defitinion
type Bin -- @Type end
node bend
@xieyuheng
xieyuheng / pokedex_ascii.h
Created May 19, 2022 17:50 — forked from MatheusFaria/pokedex_ascii.h
151 Pokemon ASCII Art
/**
* The ASCII arts were extracted from:
* - http://www.fiikus.net/?pokedex
* - http://www.world-of-nintendo.com/pictures/text/
* And also generated with:
* - http://www.text-image.com
*/
#ifndef __POKE_IMG__
#define __POKE_IMG__
「蝉语 / Cicada Language」一个可以用来辅助数学定理之证明的程序语言。
《蝉语手册》(语言的主要文档):https://readonly.link/manuals/gitlab.com/cicada-lang/cicada
《蝉语独白》(中文)(一个模仿 Little Book 的小册子):https://readonly.link/books/github.com/xieyuheng/cicada-monologues
项目主页:https://cicada-lang.org
欢迎大家转发给可能会感兴趣的朋友哦~
/* stylelint-disable font-family-no-missing-generic-family-keyword */
@font-face {
font-family: 'KaTeX_AMS';
src: url(fonts/KaTeX_AMS-Regular.woff2) format('woff2'), url(fonts/KaTeX_AMS-Regular.woff) format('woff'), url(fonts/KaTeX_AMS-Regular.ttf) format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'KaTeX_Caligraphic';
src: url(fonts/KaTeX_Caligraphic-Bold.woff2) format('woff2'), url(fonts/KaTeX_Caligraphic-Bold.woff) format('woff'), url(fonts/KaTeX_Caligraphic-Bold.ttf) format('truetype');
<template>
<div class="flex flex-col h-screen">
<ManualPageHeader class="hidden md:block" :state="state" />
<SlideUp class="md:hidden block">
<ManualPageHeader
ref="mobileHeaderElement"
v-show="scrollDirection === 'up'"
:state="state"
@toggleNavbar="showNavbar = !showNavbar"
/>
<template>
<div class="max-w-3xl mx-auto">
<PageError
v-if="error"
:error="error"
:subtitle="config.lang.zh ? '书籍 >_<' : 'Books >_<'"
/>
<div v-else-if="!state" class="px-4 py-6 font-sans text-xl text-gray-500">
<div v-if="config.lang.zh" class="font-bold">书籍加载中⋯⋯</div>
import { Resource } from "../resource"
import * as Mongo from "mongodb"
import ty, { Schema } from "@xieyuheng/ty"
import crypto from "crypto"
export abstract class MongoResource<T, Pk extends keyof T> extends Resource<
T,
Pk
> {
abstract name: string
@xieyuheng
xieyuheng / gist:eda52cd48b6301cccf8dfcb411e8780f
Created October 2, 2021 11:26
learn from others' pages
# learn from others' pages
- https://sandimetz.com -- author of "99bottles" and "POODR"
- https://martinfowler.com -- author of "refactoring" and "PoEAA"
- https://www.kentbeck.com -- founder of TDD and XP
- https://adamwathan.me -- creator of tailwindcss
- https://calebporzio.com -- creator of alpine.js
- https://alpinejs.dev/patterns -- "Alpine Component Patterns" course
- https://reinink.ca -- creator of inertia.js
@xieyuheng
xieyuheng / resource-1-and-2.ts
Last active September 30, 2021 15:36
Comparing generic `Resource` class API
// NOTE `id` in `data`
export abstract class Resource1<T, Pk extends keyof T> {
abstract primary_key: Pk
abstract create(input: Omit<T, Pk>): Promise<T>
abstract create_many(inputs: Array<Omit<T, Pk>>): Promise<Array<T>>
abstract get(pk: T[Pk]): Promise<T | undefined>
abstract get_or_fail(pk: T[Pk]): Promise<T>
@xieyuheng
xieyuheng / group-theory.ts
Created August 14, 2021 17:19
group theory in classical logic
export function imply(x: boolean, y: boolean): boolean {
return !x || y
}
export function equ(x: boolean, y: boolean): boolean {
return imply(x, y) && imply(y, x)
}
export abstract class Equivalence<T> {
abstract eq(a: T, b: T): boolean