sachaw
sachaw
Explore posts from servers
DDeno
Created by sachaw on 7/13/2024 in #help
Importing deno modules with import maps
Hi, I am currently trying to import a deno library either locally or via url. The library contains a deno.json file containing an import map for jar packages. I have tried importing the mod.ts file (which thows an error complaining about local imports (no import map to resolve them). Also tried importing the deno.json but you can't import json modules like this AFAIK. Any ideas? Thanks.
5 replies
DDeno
Created by sachaw on 6/25/2024 in #help
Way too iterate over Deno.serve connections?
Hi, as a lot of the old http api's are now deprecated, I would like to know if there is a nice way to achieve the following: Create a Deno.serve instance, iterate over each request, my goal is to put this in an async generator that yields upgraded websockets. This is doable with the Deno.listen api, but now that the Deno.serveHttp is deprecated, I'm not sure how to proceed. Thanks.
4 replies
SSolidJS
Created by sachaw on 4/29/2024 in #support
Force effect computation, or alternate approach?
I'm trying to write my own force directed graph, I am able to display nodes and links just fine with a random initial coordinate. I also have a simple function that calculates the next positions for the nodes. However I need to call that function at a rather high rate. When I put it inside of an interval, nothing gets updated. I'm pobbably missing something here. Any assistance would be much appreciated.
11 replies
SSolidJS
Created by sachaw on 11/21/2023 in #support
Most concise upsert for store?
I'm wondering if there was a more efficient way of doing an upsert operation? This is what I'm doing currently:
const updateNodes = (node: Node) => {
setLocalState(
"nodes",
produce((nodes) => {
const nodeIndex = nodes.findIndex((n) => n.id === node.id);

if (nodeIndex !== -1) {
nodes[nodeIndex] = node;
} else {
nodes.push(node);
}
}),
);
};
const updateNodes = (node: Node) => {
setLocalState(
"nodes",
produce((nodes) => {
const nodeIndex = nodes.findIndex((n) => n.id === node.id);

if (nodeIndex !== -1) {
nodes[nodeIndex] = node;
} else {
nodes.push(node);
}
}),
);
};
3 replies
SSolidJS
Created by sachaw on 11/19/2023 in #support
Nicest way of having computed properties in a store?
I'm trying to model my store in a concise way, I want to have some base properties, and some computed properties, I think the cleanest way is to use getter/setters but currently they are not reactive as I'm clearly doing something wrong. This is what I have currently:
interface LocalState {
currentOperatorId: string;
currentOperator?: Operator;
operators: Operator[];
nodes: Node[];
}

const [localState, setLocalState] = createStore<LocalState>({
currentOperatorId: "",
// Inline getter, not currently reactive.
get currentOperator(): Operator | undefined {
return this.operators.find((op) => op.id === this.currentOperatorId);
},
nodes: [],
operators: [],
});

// External setter method, more code
const setCurrentOperator = (operatorId: string) =>
setLocalState("currentOperatorId", operatorId);
interface LocalState {
currentOperatorId: string;
currentOperator?: Operator;
operators: Operator[];
nodes: Node[];
}

const [localState, setLocalState] = createStore<LocalState>({
currentOperatorId: "",
// Inline getter, not currently reactive.
get currentOperator(): Operator | undefined {
return this.operators.find((op) => op.id === this.currentOperatorId);
},
nodes: [],
operators: [],
});

// External setter method, more code
const setCurrentOperator = (operatorId: string) =>
setLocalState("currentOperatorId", operatorId);
13 replies
RRailway
Created by sachaw on 10/6/2023 in #✋|help
Plan for open source orginizations
Hi, I've used Railway for quite some time now and very happy with the service. I am looking to move some services of our open source organization over, but none of the current plans fit very well. We quickly run into an issue where say we wanted 5 maintainers to have access, that would run us $100/month + usage where chances are some of those admins will never or very infrequency login. Not asking for a handout and happy to pay appropriately for usage, but the seat model for teams just doesn't work for us. Would this be something that can be negotiated?
4 replies
RRailway
Created by sachaw on 2/22/2023 in #✋|help
Redis Unreachable
Hi, after working flawlessly for ages, my redia instance is now unreachable Project: 1fc338ae-1d70-457c-999b-2e6d11f66192
4 replies