Skip to content

Instantly share code, notes, and snippets.

View cambiata's full-sized avatar

Jonas Nyström cambiata

View GitHub Profile
type FetchMachineContext =
| {
status: 'text',
text: string,
}
| {
status: 'empty'
}
export type FetchMachineEvent =
@cambiata
cambiata / Rust iterator implementation.rs
Created January 15, 2023 11:56
Rust iterator implementation
#[derive(Debug)]
pub struct TestItem {
val: usize,
}
#[derive(Debug)]
pub struct TestItems<'a> {
items: &'a Vec<&'a TestItem>,
idx: usize,
pos: usize,
class Signal {
constructor(initialValue) {
console.log('constuctor ' + initialValue);
this.value = initialValue;
this.listeners = [];
console.log(this.value);
console.log(this);
}
svg {
/* border: 5px orange solid; */
background: darkblue;
}
.circle {
stroke-dasharray: 190 1000;
stroke-dashoffset: 0;
stroke-linecap: round;
stroke-width: 17;
// https://github.com/HaxeFoundation/haxe/issues/9862#issuecomment-684807345
// Amazingly Safari 13 in 2020 does not support WebAudio without a prefix
// this abstract checks for `webkitAudioContext` if `AudioContext` is not available
@:forward
abstract AudioContext(js.html.audio.AudioContext) {
public inline function new(?contextOptions: js.html.audio.AudioContextOptions) {
if (js.Syntax.typeof(js.html.audio.AudioContext) != 'undefined') {
this = new js.html.audio.AudioContext(contextOptions);
// ./store/TestStore.js
import Signal from 'signals'; // yarn add signals
import React from 'react';
export var TestStore = function() {}
// Set initial value here, if other than null
TestStore.initValue = null;
TestStore.value = TestStore.initValue;
import './App.css';
// import filename from './hello.mei';
import filename from './sample.musicxml';
import { useEffect, useState } from 'react';
function App() {
return (
<div className="App">
<VerovioView />
</div>
// # install with Yarn:
// yarn add @szhsin/react-menu
// Drop this ReactMenu.hx file into your your haxe project src folder
@:jsRequire('@szhsin/react-menu')
extern class ReactMenu {
static function useMenuState(?options:ReactMenuStateOptions):{
@:optional
var state:ReactMenuState;
import react.ReactMacro.jsx;
import store.TestSignals;
using Std;
@:expose('App')
@:native('App')
function App() {
js.Lib.require('./App.css');
TestSignals.initValue = Hopp(222);
Example Haxe externs for js modules