Skip to content

Instantly share code, notes, and snippets.

View kaleidawave's full-sized avatar
🏝️
I may be slow to respond.

Ben kaleidawave

🏝️
I may be slow to respond.
View GitHub Profile
-- Create the new table
CREATE TABLE words AS SELECT * FROM original_words;
-- Can use strlen instead
ALTER TABLE words DROP Count;
-- rogue row
DELETE FROM words WHERE NOT prefix(Definition, '"');
-- Some columns have their POS leak into the definition
@kaleidawave
kaleidawave / snippets.css
Last active December 19, 2023 16:57
Snippets for obsidian latex: https://github.com/artisticat1/obsidian-latex-suite and my custom CSS
.theme-dark {
--background-primary: rgb(14, 13, 11);
--background-secondary: black;
--text-normal: #d4d4d0;
}
.theme-light {
--text-normal: #1e1e1f;
--background-primary: #efedea;
--background-secondary: #e7e7e7;
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
fig, ax = plt.subplots()
ax.set_aspect("equal", adjustable="box")
(path,) = ax.plot([], [], marker="o", color="r", linewidth=1, markersize=0.2)
centres = ax.scatter([], [], marker="o", color="b", linewidth=0.1)

Trying Ezno checking today

This a short overview of some of the things you can do with Ezno today. If you find any problems, file an issue.

The following examples show some errors that have been caught using type checking, partial/const evaluation and effects.

To get started we will install oxidation-compiler which has bindings for Ezno's checker. (you can also get the binary from the releases page).

npm install -g oxidation-compiler@latest
@kaleidawave
kaleidawave / index.rs
Created April 12, 2023 16:42
rust-positions
/// Returns `(line, column)`. Return is zero based
fn get_line_column_from_string_and_idx(end: u32, char_indices: &mut CharIndices) -> (u32, u32) {
let (mut line, mut column) = (0, 0);
for (_, chr) in char_indices.take_while(|(idx, _)| *idx < end.try_into().unwrap()) {
if chr == '\n' {
line += 1;
column = 0;
} else {
column += chr.len_utf8() as u32;
}
const x = 2 + 5;
@kaleidawave
kaleidawave / generator.rs
Created February 9, 2023 21:51
Quasi-Quoted + constant compilation AST generating macro
use proc_macro::{token_stream, Delimiter, Spacing, TokenStream, TokenTree};
use proc_macro2::Span;
use quote::{format_ident, quote};
/// Used for generating parser::ASTNodes using proc macros
///
/// Turns token stream into string.
/// - Finds expressions and registers cursor locations
/// - Parses structure from string and turns it into Rust tokens
#[proc_macro]
@kaleidawave
kaleidawave / repl.rs
Created January 18, 2023 12:33
Ezno's wrapper for the Deno repl
use std::{collections::HashSet, io};
use argh::FromArgs;
use checker::{Project, TypeDefinitionModulePath};
use std::io::{BufRead, BufReader, Write};
use std::process::{Command, Stdio};
use crate::{
error_handling::print_error_warning_info_handler, file_system_resolver,
utilities::read_string_from_cli,
@kaleidawave
kaleidawave / crates-multiple.yml
Last active March 1, 2024 09:13
GH action for Rust
name: Release crate
on:
workflow_dispatch:
inputs:
version-one:
description: "major/minor/patch or semver"
required: false
default: "patch"
version-two:
@kaleidawave
kaleidawave / extractor.rs
Last active November 24, 2022 20:27
❓❓❓❓❓❓❓ (WIP, no judging)
use crate::{
expressions::object_literal::ObjectLiteralMethodBase, statements::class::ClassConstructorBase,
statements::class::ClassFunctionBase, statements::StatementFunctionBase, ArrowFunctionBase,
ExpressionFunctionBase,
};
use crate::{FunctionBase, FunctionBased, FunctionId, Visitable};
use std::collections::HashMap;
use std::marker::PhantomData;
// TODO generic function_id