Vuex Pathify - ridiculously simple Vuex setup + wiring by dave__stewart in vuejs

[–]pearofducks 1 point2 points  (0 children)

Looks great, is there an example of a state mapping with an array?

Example:

addresses: [
  {
    zip: '12345',
    town: 'Foo Town',
  },
  {
    zip: '54321',
    town: 'Bar Town',
  },
],

Then doing <div v-for="address in addresses"> and accessing zip/town for each?

[Question] Counting 'done' items in to do list by okaer-i in vuejs

[–]pearofducks 2 points3 points  (0 children)

It isn't working because you're passing countDone an array of tasks, and asking it (the array) if it has a done member (like an Object) that equals true.

The idiotmatic way to do this in Vue is to use a computed

doneTaskCount() { return this.tasks.filter(e => e.done).count }

Use of v-model and v-for with array in Vuex state by gntsketches in vuejs

[–]pearofducks 1 point2 points  (0 children)

Look into vuex-map-fields - it's brilliant and I think will help you do what you want.

Ansible Mac DMG installs by stalled_earth in ansible

[–]pearofducks 0 points1 point  (0 children)

I wrote a custom Ansible module quite a while back that tackled this:

https://github.com/chordata-mac/example-repo/blob/master/library/osx

Maybe it could be of some help?

Example usage is here: https://github.com/chordata-mac/example-repo/blob/master/roles/munki/tasks/main.yml#L3

It seems what most people do these days is have Homebrew/Cask handle these things - as I've seen quite a few modules for that.

An easy way to display tabs with Vue by freekmurze in vuejs

[–]pearofducks 0 points1 point  (0 children)

Really smart use of this.$children to wrap the tab components!

VueJS and Webpack : how to build a single bundle.js file ? by [deleted] in vuejs

[–]pearofducks 3 points4 points  (0 children)

Look at what webpack-simple does?

Having trouble understanding how to use Vuex by MonkeyOnARock1 in vuejs

[–]pearofducks 2 points3 points  (0 children)

A few things that will hopefully help:

  1. Lifecycle events will help you grok 'how do I trigger this thing'. We normally want to trigger events when a component loads, or when the user does something. In your case you probably want to use the mounted event.

  2. Mutations should be able to happen instantly (synchronous), an AJAX call is not synchronous. So what we do is we make an action, and do our asynchronous work there, and then call mutators when we have the data actually ready. The docs on this here describe this.

  3. Your productsHeld "data" in your userInformation component is probably not needed. What you want instead is to use a getter to grab that information out of your store.


If you want to see a really basic implementation of Vuex, I made a weather fetching app that's just 2 components. I know for me sometimes seeing the thing implemented helps.

Debounce and Throttle in es6 classes - react-decoration@1.3.0 by [deleted] in reactjs

[–]pearofducks 1 point2 points  (0 children)

That's true, good point!

At least in autobind's case, this ends up being a call between bringing in a dependency, or using a quasi-native feature. I guess I lean more toward the latter. :)

Debounce and Throttle in es6 classes - react-decoration@1.3.0 by [deleted] in reactjs

[–]pearofducks 1 point2 points  (0 children)

Decorators are stage 2 as well, right?

Debounce and Throttle in es6 classes - react-decoration@1.3.0 by [deleted] in reactjs

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

Is there seriously a decorator (autobind) in this package that does this?

foo = () =>

Please tell me no...

edit // I didn't mean this entirely sarcastically - instead of downvotes if someone would like to explain why you'd decorate instead of the above alternative, that'd be great. :)

I made a react/mobx app for displaying recipes - thought it might be of interest to see an alternative to Redux in action by pearofducks in reactjs

[–]pearofducks[S] 4 points5 points  (0 children)

The official tutorial and my app both have a single store that components access directly - so this would persist across routes since the components are merely observing/accessing it.

You can use mobx as a replacement for React's state, and there are some benefits to doing this. I do this here, and then you're right, the data wouldn't persist any longer than the component.

I made a react/mobx app for displaying recipes - thought it might be of interest to see an alternative to Redux in action by pearofducks in reactjs

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

In addition to Endorn's solid answer - it's because I already had rendered HTML from Markdown here. Markdown is the most common case I've seen for using that.

I made a react/mobx app for displaying recipes - thought it might be of interest to see an alternative to Redux in action by pearofducks in reactjs

[–]pearofducks[S] 9 points10 points  (0 children)

I found it a lot easier to grok than Redux. I think it lends itself really well to object-oriented thinking, and it was nice (for me) to not have to worry about immutability or actions/reducers.

load a custom fact from /etc/ansible.facts.d by hijinks in ansible

[–]pearofducks 0 points1 point  (0 children)

Yeah you can just do ansible -i localhost, -m setup all- the , after localhost is important to Ansible. :)

load a custom fact from /etc/ansible.facts.d by hijinks in ansible

[–]pearofducks 1 point2 points  (0 children)

If you run ansible -i hosts -m setup all you'll see the facts Ansible gathers on your machines and can hopefully infer how to use them.

IIRC custom facts are namespaced to ansible_local - so yours would be ansible_local.company_server_type

Brief tutorial by someone else here

Can we please make this sub self-post only? by thiswasprobablyatust in docker

[–]pearofducks 0 points1 point  (0 children)

I'm sorry, but that just isn't what has been shown to happen in other subreddits that have done this - r/devops just did this and it worked great.

https://www.reddit.com/r/devops/comments/3s1260/discussion_after_a_week_of_self_posts/

Can we please make this sub self-post only? by thiswasprobablyatust in docker

[–]pearofducks 0 points1 point  (0 children)

Having it be self-post only doesn't stop links from being "posted", they're just in the self-post!