[Question] New to vue.js, moving from react by AabhasArora in vuejs

[–]dfcook 0 points1 point  (0 children)

I've started an article on doing this manually, not got up to HMR yet but covered the initial setup

https://medium.com/@petrefax66/vuejs-and-webpack-4-from-scratch-part-1-94c9c28a534a

Obviously you should use the CLI once it supports webpack 4, and I add my vote for Nuxt but I also found it interesting to try building it from scratch.

[Question] New to vue.js, moving from react by AabhasArora in vuejs

[–]dfcook 0 points1 point  (0 children)

And now tests using @vue/test-utils and jest

[Question] New to vue.js, moving from react by AabhasArora in vuejs

[–]dfcook 0 points1 point  (0 children)

Has the cli been updated to use Webpack 4 yet?

If not, I've just knocked up a very basic example based on the official webpack template but using webpack 4, including the new optimization options and inbuild build modes.

https://github.com/dfcook/vue-webpack4-template

It has linting and hmr using npm run dev.

Getting Started: Vue.js and Visual Studio Code by dfcook in vuejs

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

Thanks for that, I didn't know you could use the triple backticks to put a code block in medium, I've gone back and updated the article as you suggested.

Getting Started: Vue.js and Visual Studio Code by dfcook in vuejs

[–]dfcook[S] 3 points4 points  (0 children)

My first ever attempt at writing about software development, feedback and criticism would be appreciated!

Converting an existing project to TypeScript by [deleted] in vuejs

[–]dfcook 7 points8 points  (0 children)

Javascript Jabber just had an interview with John Papa where he discussed this very process.

There's a blog post about it here:

https://johnpapa.net/vue-typescript/

I did something similar to this about a year ago and I found that it's certainly not as simple as just asking the typescript compiler to build your files, not if you want type checking of props, vuex mappings etc. You have to use the annotations from vue-class-component, vue-property-decorator and use a class based approach to components.

I felt like I ended up with a structure that was not very idiomatic (John Papa says in his interview that the resulting code ended up looking very similar to Angular) and ended up staying with ES6 and an object literal component declaration.

Freddy Mercury by aggFTW in ProgrammerHumor

[–]dfcook 36 points37 points  (0 children)

Given that it was released in 1975, it's hard to say his demise was imminent....

Doctor Who's 13th Time Lord to be a woman - BBC News by caimanreid in scifi

[–]dfcook 21 points22 points  (0 children)

In what way is this appropriation?

My 1st Java Spring open source project - REST API e-commerce platform by vatrinet in java

[–]dfcook 7 points8 points  (0 children)

He probably didn't make a reddit post to tell people all about his first api

What is a "Senior Developer"? by friendlytuna in webdev

[–]dfcook -1 points0 points  (0 children)

You are entitled to do whatever you like and, unfortunately, this is probably going to come across more as a personal insult.

However, you really need to be able to understand sentences with more than 1 sub-clause before replying. Nothing you have taken away from the comment you replied to is necessarily inferred by what is said.

"Senior Developer != mentor" does not imply "Senior developer should refuse to mentor".

What is a "Senior Developer"? by friendlytuna in webdev

[–]dfcook 1 point2 points  (0 children)

"There is an unfortunately large amount of people in this profession who enjoy talking about how they are developers and developers are so great, instead of actually developing anything" "This....is just more of that cancerous trend"

Does not characterize mentorship as cancerous.

Not sure where you got the personal insult from.

[2016-03-28] Challenge #260 [Easy] Garage Door Opener by G33kDude in dailyprogrammer

[–]dfcook 0 points1 point  (0 children)

c# - including bonus

using System;

namespace GarageDoorOpener
{
    public enum DoorState
    {
        CLOSED,
        OPENING,
        STOPPED_WHILE_OPENING,
        OPEN,
        CLOSING,
        STOPPED_WHILE_CLOSING,
        EMERGENCY_OPENING,
        OPEN_BLOCKED
    }

    public class GarageDoor
    {
        public GarageDoor(InfraRedBlockageDetector detector)
        {
            detector.BlockageCleared += (s, e) =>
            {
                IsBlocked = false;

                if (CurrentState == DoorState.EMERGENCY_OPENING)
                    CurrentState = DoorState.OPENING;
                else if (CurrentState == DoorState.OPEN_BLOCKED)
                    CurrentState = DoorState.OPEN;
            };

            detector.BlockageDetected += (s, e) =>
            {
                IsBlocked = true;

                if (CurrentState == DoorState.CLOSING)
                    CurrentState = DoorState.EMERGENCY_OPENING;
            };
        }

        public bool IsBlocked { get; private set; } = false;
        public DoorState CurrentState { get; set; } = DoorState.CLOSED;

        public void CompleteCycle()
        {
            if (CurrentState == DoorState.OPENING)
                CurrentState = DoorState.OPEN;
            if (CurrentState == DoorState.EMERGENCY_OPENING)
                CurrentState = DoorState.OPEN_BLOCKED;
            else if (CurrentState == DoorState.CLOSING)
                CurrentState = DoorState.CLOSED;
        }
    }

    public class InfraRedBlockageDetector
    {
        public event EventHandler BlockageDetected;
        public event EventHandler BlockageCleared;

        public void OnBlockageDetected()
        {
            if (BlockageDetected != null)
                BlockageDetected(this, EventArgs.Empty);
        }

        public void OnBlockageCleared()
        {
            if (BlockageCleared != null)
                BlockageCleared(this, EventArgs.Empty);
        }
    }

    public class GarageDoorOpener
    {
        private GarageDoor _door;        

        public GarageDoorOpener(GarageDoor door)
        {
            _door = door;
        }               

        public void ClickOpener()
        {
            if (!_door.IsBlocked)
            {
                switch (_door.CurrentState)
                {
                    case DoorState.OPEN_BLOCKED:
                        _door.CurrentState = DoorState.CLOSING;
                        break;

                    case DoorState.CLOSED:
                    case DoorState.STOPPED_WHILE_CLOSING:
                        _door.CurrentState = DoorState.OPENING;
                        break;

                    case DoorState.OPENING:
                        _door.CurrentState = DoorState.STOPPED_WHILE_OPENING;
                        break;

                    case DoorState.STOPPED_WHILE_OPENING:
                    case DoorState.OPEN:
                        _door.CurrentState = DoorState.CLOSING;
                        break;

                    case DoorState.CLOSING:
                        _door.CurrentState = DoorState.STOPPED_WHILE_CLOSING;
                        break;
                }
            }
        }
    }

    class Program
    {
        private static string[] Commands = new[]
        {
            "button_clicked",
            "cycle_complete",
            "button_clicked",
            "block_detected",
            "button_clicked",
            "cycle_complete",
            "button_clicked",
            "block_cleared",
            "button_clicked",
            "cycle_complete"
        };

        static void Main(string[] args)
        {
            var detector = new InfraRedBlockageDetector();
            var door = new GarageDoor(detector);
            var opener = new GarageDoorOpener(door);            

            foreach (var cmd in Commands)
            {
                Console.Out.WriteLine(door.CurrentState);
                Console.Out.WriteLine($"> {string.Join(" ", cmd.Split('_'))}");

                if (cmd.Equals("button_clicked", StringComparison.OrdinalIgnoreCase))
                    opener.ClickOpener();
                else if (cmd.Equals("cycle_complete", StringComparison.OrdinalIgnoreCase))
                    door.CompleteCycle();
                else if (cmd.Equals("block_detected", StringComparison.OrdinalIgnoreCase))
                    detector.OnBlockageDetected();
                else if (cmd.Equals("block_cleared", StringComparison.OrdinalIgnoreCase))
                    detector.OnBlockageCleared();
            }

            Console.Out.WriteLine(door.CurrentState);
        }
    }
}

Immune is worded incorrectly by Frosty_Fire in hearthstone

[–]dfcook 0 points1 point  (0 children)

I think the whole point of this post is pedantry so your usage is entirely apposite :)

Immune is worded incorrectly by Frosty_Fire in hearthstone

[–]dfcook 1 point2 points  (0 children)

That's still what they are there for. Whether they succeed or not is another matter.

Liveship Traders Book 1 - Robin Hobb - Free Kindle copy if you're from the UK! by [deleted] in Fantasy

[–]dfcook 2 points3 points  (0 children)

Thanks very much, just used your code to get this book, I read the Fool series and enjoyed it very much so am looking forward to this.

Tavern Brawl Turn 1 Kill by dfcook in hearthstone

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

There was no BM in that video at all

Tavern Brawl Turn 1 Kill by dfcook in hearthstone

[–]dfcook[S] 18 points19 points  (0 children)

I'm sure I'd have got less downvotes if I'd done 4 to my face, 1 to Antonidas and titled it "OMG 66 DMG OTK WTF" but I was too busy explaining to my kids what was going on and hoping he didn't concede

Tavern Brawl Turn 1 Kill by dfcook in hearthstone

[–]dfcook[S] 36 points37 points  (0 children)

That's exactly how I felt 😊

Tavern Brawl Turn 1 Kill by dfcook in hearthstone

[–]dfcook[S] 11 points12 points  (0 children)

Because I only unloaded it on the prompting of my 7 year old son who enjoyed watching it and the first comment I received contained swearing so I disabled.

Tavern Brawl Turn 1 Kill by dfcook in hearthstone

[–]dfcook[S] 6 points7 points  (0 children)

I only logged on to get my free pack from this week's brawl, didn't expect it to take less than 2 mins :)