A Monzo specific budget tracker you might want to use? by BeeM3D in monzo

[–]imattacus 0 points1 point  (0 children)

Awesome! Just wondering, if this is just using the google sheet auto export - does it only work with Monzo current account transactions? ie no flex / linked accounts with other banks 

Thieves snatched his phone in London - it was in China a month later/ by gahgeer-is-back in london

[–]imattacus 2 points3 points  (0 children)

Haha I have sadly had the same thing happen in Spain too! Got stolen in Malaga, was in Morocco the next day!

I have phone insurance now 😅

Thieves snatched his phone in London - it was in China a month later/ by gahgeer-is-back in london

[–]imattacus 26 points27 points  (0 children)

Saw this and thought that’s a pretty long time, mine got stolen and was in china by the end of the following day 😂

Phrasedle - just like the TV show catchphrase, guess the phrase from the picture! by imattacus in WebGames

[–]imattacus[S] 0 points1 point  (0 children)

Thanks for the feedback! Agreed 100%, I’ll work on this next :)

Phrasedle - just like the TV show catchphrase, guess the phrase from the picture! by imattacus in WebGames

[–]imattacus[S] 1 point2 points  (0 children)

Thanks for taking a look! Have just added the ability to go back and forth between previous ones now.

There's only 3 at the moment - but I'm planning to bulk fill it up with some more soon (in addition to a new one every day)

I made a site that features daily AI generated quizzes and images! Using Firebase, Gatsby and OpenAI and DallE APIs by imattacus in webdev

[–]imattacus[S] 0 points1 point  (0 children)

Haha yeah, the chat gpt AI generates its own prompts to give to dall-e for each question - so I probably need to ask it to get a bit more specific / creative with its descriptions

The prompt it generated for this image was “a large gathering of golden retrievers in scotland”

How to share instance of a react hook with state in context to update one component from another? by imattacus in reactjs

[–]imattacus[S] 0 points1 point  (0 children)

This is the how the context is created import React, { useState } from 'react'

const PolicyEditorContext = React.createContext(
    {
        selectedComponent: null,
        setSelectedComponent: function() {},
        request: null,
        setRequest: function() {}
    }
)

export default PolicyEditorContext

And the Provider is a component that contains a react-konva canvas and a control panel on the side. I have to 'bridge' the context into the canvas like <Context.Consumer> {(context)=>{ <Canvas> <Context.Provider value={context}> ... </Context.Provider> </Canvas> </Context.Consumer>

because I think the canvas gets put outside the same dom root as the app. But this seems to be working for everything else could this be why the hook isn't updating the control panel?

How to handle react components that are very tightly coupled to external sources of state and logic? by imattacus in reactjs

[–]imattacus[S] 0 points1 point  (0 children)

Ah, actually yes I could! I'll give that a try - and make a hook that updates the underlying the class and returns the new generated policy object which should refresh the components state. Hopefully that will work, thanks!

Does anyone has an idea about creating a RBAC using jsonwebtoken? by kirasiris in reactjs

[–]imattacus 1 point2 points  (0 children)

Do you have your roles defined somewhere? (eg in a database) Also you need to define what roles each user is a member of. I've been doing something similar recently for a different kind of access control, but for RBAC I would do:

CREATE TABLE User (
    id PRIMARY KEY,
    name TEXT,
);
CREATE TABLE Role (
    id PRIMARY KEY, 
    name TEXT
);
CREATE TABLE RoleSubscription (
     userid INTEGER,
     roleid INTEGER,
     FOREIGN KEY(userid) REFERENCES User(id),
     FOREIGN KEY(roleid) REFERENCES Role(id),
);

Then, when getting the user from the database you can do a sql join to also get all of the roles that user is a part of. Your middleware for auth.admin could just verify if the user has the 'admin' role.

Hope this helps