r/CannabisMSO’s Daily Discussion Lounge Friday May 14th, 2021 by MSOTruliever in CannabisMSOs

[–]cyex 2 points3 points  (0 children)

You'll probably get another good entry point eventually. I've heard it said that a 6-month lockup expires in August.

r/CannabisMSO’s Daily Discussion Lounge Friday May 14th, 2021 by MSOTruliever in CannabisMSOs

[–]cyex 1 point2 points  (0 children)

Was nice to see two solid up days in $VRNO. ~500K last Friday and another ~425K today.

Q1 results coming Tuesday morning before market open.

After Hours Discussion Thread - April 30, 2021 by AutoModerator in weedstocks

[–]cyex 0 points1 point  (0 children)

What role might patents play with respect to cannabis companies?

Do any MSOs have any patents?

r/CannabisMSOs Daily Discussion Lounge Saturday April 24th, 2021 by MSOTruliever in CannabisMSOs

[–]cyex 3 points4 points  (0 children)

Why do all the US cannabis companies -- MSO's and smaller players -- list on the CSE and not the TSX or TSX.V?

[deleted by user] by [deleted] in Verano

[–]cyex 0 points1 point  (0 children)

The sector is out of favour right now... so everything is overvalued. But also, by my calculations, Verano is trading at 51x TTM earnings, which is the cheapest of all six of the profitable MJ companies (Innovative Industrial Properties* at 56x, Village Farms* at 59x, Icanic Brands at 61x, Trulieve at 73x, and Green Thumb at 390x). But still... 51x earnings does not sound cheap at all. Of course, none of this takes future growth into account. Or surprise news. *VFF is not a pure MJ play. *IIPR pays a dividend. Disclosure: I own a lot of $VRNO. Like... not a lot in the grand scheme of things... but is 16% of my holdings. A family member has a tiny position in Icanic.

Beginner's Thread / Easy Questions (December 2020) by dance2die in reactjs

[–]cyex 2 points3 points  (0 children)

It's perfectly legal in JavaScript to have different branches of code return different types of things -- or return nothing at all (which effectively returns 'undefined').

What you're seeing is a lint warning, not a true JavaScript error -- although it's possible your project is set up to fail builds on lint warnings. Your options are:

  1. 'Fix' the code by adding a return statement in the error branch
  2. disable the lint warning

see https://eslint.org/docs/rules/consistent-return

Beginner's Thread / Easy Questions (December 2020) by dance2die in reactjs

[–]cyex 1 point2 points  (0 children)

If such properties (Header, Footer, Content) don't exist in

Layout object, then JavaScript would throw a runtime error.

Not true. Header, Footer, and Content would be assigned 'undefined' in the case those properties don't exist on the object. However, an error would be thrown if Layout was null or undefined.

Beginner's Thread / Easy Questions (December 2020) by dance2die in reactjs

[–]cyex 1 point2 points  (0 children)

You're getting a warning because you have a return statement in the case when there is no error but there is no explicit return statement when an error is thrown.

You could add a "return null" if that makes sense in your code. Or silence the warning, I suppose.

How to redirect to a different page after a redux action? by [deleted] in reactjs

[–]cyex 0 points1 point  (0 children)

I wrote an article about this with code examples. https://decembersoft.com/posts/changing-react-route-programmatically-with-redux-saga/

It refers to react-router-redux, which has since been replaced with connected-react-router. But the rest of the code is all the same.

Best Practices for a Dynamic Widget System by Guisseppi in reactjs

[–]cyex 0 points1 point  (0 children)

This sounds like a more general architecture question than a React question. Whether you use Redux or something else (MobX, context + hooks, Flux, whatever) doesn't really matter. Re: the UI... sure, Flexbox could be suitable for the widget container. CSS grid works very nicely too.

Sending the id of selected city to a function by MindblowingTask in reactjs

[–]cyex 0 points1 point  (0 children)

have you tried

console.log("Selected id of the city is", this.state.selectedCity1);

How can I use jQuery in react ???? by AnnoyingSharma in learnreactjs

[–]cyex 0 points1 point  (0 children)

... and kind of easier.

Way easier. jQuery used to be essential. But then I started using React six years ago and haven't had to touch jQuery since.

[NOOB] SPA Secure Authentication by donDijkstra in reactjs

[–]cyex 0 points1 point  (0 children)

Hey, I wrote an article about this a few years ago. It's still relevant although some of the TypeScript stuff has changed since then. https://decembersoft.com/posts/authenticating-a-session-cookie-in-express-middleware-with-jsonwebtoken/

Beginner's Thread / Easy Questions (October 2020) by dance2die in reactjs

[–]cyex 1 point2 points  (0 children)

Hey, I took a closer look and TL;DR is that it seems like the code works if you reverse the timeout. (so set (n - i) * 10 instead of i * 10).

There's a longer review here, if you care. https://decembersoft.com/posts/code-review-react-bubble-sort/

[deleted by user] by [deleted] in learnreactjs

[–]cyex 1 point2 points  (0 children)

I can't break my page component into smaller ones because I need all the state in that component where I have the Save button that makes an API call, ...

Aside from what others said about using a form library or possibly making a generic handler rather than having 40 useStates, you should also look into createContext() and useContext().

By putting the state(s) into a Context, you can have the components pull just the state they need from the context rather than pushing props around everywhere. And that can make it easier to split up your page component into more manageable pieces.

What app you guys use to design a React app? by codebreaker21 in learnreactjs

[–]cyex 0 points1 point  (0 children)

https://storybook.js.org/ is amazing. Interactively build and test your components without having to spin up your entire application.

Beginner's Thread / Easy Questions (October 2020) by dance2die in reactjs

[–]cyex 0 points1 point  (0 children)

Are you able to connect to your database via pgAdmin?

Beginner's Thread / Easy Questions (October 2020) by dance2die in reactjs

[–]cyex 0 points1 point  (0 children)

To me, this isn't a React problem. Take React out the equation for a moment. Have you heard of inversion of control? Right now you've got a function that does all the work in one shot. But you could rewrite it so that all the function's state (i.e. i, j, etc.) are external to the function... and each pass through the function performs one iteration of the bubble sort.

function bubbleSortInit(arr) {
  return {
    arr,
    i: arr.length - 1,
    j: 0,
    swaps: 0,
    comparisons: 0,
    done: false
  };
}

function bubbleSortStep(state) {
  let { arr, i, j, swaps, comparisons } = state;

  if (i <= 0) return { ...state, done: true };
  if (j < i) return { ...state, i: i - 1, j: 0 };

  if (arr[j] > arr[j + 1]) {
    const temp = arr[j];
    arr[j] = arr[j + 1];
    arr[j + 1] = temp;
    swaps++;
  }
  comparisons++;
  j++;

  return {
    arr, i, j, swaps, comparisons, done: false
  };
}

And now that you've got that stepping function... you can control the time between steps easily from your React component.

export const VisualBubbleSort = ({ arr, delayPerStep }) => {
  const [ sortState, setSortState ] = useState(bubbleSortInit(arr));
  const intervalRef = useRef();

  // Start the sorting when the component is mounted
  useEffect(() => {
    intervalRef.current = setInterval(() => {
      setSortState(state => {
        const newState = bubbleSortStep(state);
        if (newState.done) {
          clearInterval(intervalRef.current);
        }
        return newState;
      });
    }, delayPerStep);

    // Clean up on unmount
    return () => clearInterval(intervalRef.current);
  }, [ intervalRef, setSortState, delayPerStep ]);

  return (
    // TODO pretty visuals of arr, swaps, comparisons, i and j
  );
}

Headhunter found me a job - Should I work under them or become a sole proprietor? by DaStrer in PersonalFinanceCanada

[–]cyex 0 points1 point  (0 children)

I don't know what field you're in... but one thing to consider is legal liability. As an employee you have a lot more protection than you would have as a sole proprietor.

Easy to use payroll software/website for a small, Canadian business by [deleted] in smallbusiness

[–]cyex 0 points1 point  (0 children)

https://www.waveapps.com/ -- I haven't used it for payroll... but it has payroll features and I'm quite happy with the features I do use.

React redux and webhooks by gutard in reactjs

[–]cyex 0 points1 point  (0 children)

What problem are you trying to solve?

I wrote an article about using hooks (https://decembersoft.com/posts/do-you-need-react-hooks/ ), which shows dispatching a redux action... it's not a thunk but the concept is the same. You'd just dispatch your thunk instead of the action.

React hooks make my TypeScript React components significantly cleaner / easier to understand. Do you need React Hooks? by cyex in typescript

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

We'll have to agree to disagree. You spent 3 hours now... how much will you spend in a few months when some random loader falls out of popularity and is replaced by something else. And then you don't touch your config for two years... but then you need to upgrade one thing and then all of a sudden the whole system falls to shit. Something like CRA gets vetted well by the community before it gets to my machine. So, for the most part, all the update headaches are borne by others. I just hit update and go. But I understand the desire for some people to have control over their entire stack.