« first day (2500 days earlier)      last day (2450 days later) » 

12:00 AM
that's a lot of extra maintenance
why does vue force you to jump through those hoops? What value does it provide?
 
@towc ah
@ssube I wouldn't say that's "a lot" of extra maintenance, especially with linting
 
@ssube I have very few counterarguments to that
I'm ok with this. It has its problems, but it also has its benefits
 
@Zirak fair enough, but his argument for it was that renaming things is easier, which is definitely not true
@towc the benefits being?
 
Maybe the upside is being able to, say, name a component in your template one thing (like header) but during instance creation time give it a select component
One time have header be a SuperGreatHeader and another time have it be a LameHeader
 
12:02 AM
namely, it's easier to rename A if you want to use another component name but not change the template, and it's all enclosed in a single object
 
Or something
 
ok, last one is probably not a good one, as react doesn't actually steer off from that pattern too much
 
there's no reason react can't do that
you can even take FooComponent as an argument somewhere along the way, it's just a function (as Benjamin pointed out)
 
In react you'd maybe do it with a props variable
 
it can, but you add a minimal layer to that. You probably don't want to break the import XXX from './XXX' pattern, so you're going to need to define const C = A somewhere in the code
 
12:03 AM
if anything, React might be more flexible since you can change it at runtime, because you're not passing it upstream in the module export
 
while you only need to assign the proper property name in the vue object
 
vue probably has its reason, maybe ease of implementation since the template and the object creation are at very different times and scopes
 
export default class B extends React.Component {
  constructor(props) {
    this.elem = props.elem;
  }
  ...
  render() {
    const A = this.elem;

    return (
      <div>
        <A/>
        ...
      </div>
    );
  }
  ...
}
how would you do that in vue?
(that is more verbose than it needs to be, so it looks more like the original)
 
one of the other things, is that I think it's less magic. React has jsx, which makes it somewhat magic, but it's ok. Vue relies on actual strings to generate its html. It makes more sense if you don't need vue to rely on the real name of the component. You may not even know what it is, so you just pass the template name as a property name of the components object
 
JSX compiles to new Foo and string literals
 
12:06 AM
tbh when prototyping for myself I don't use jsx at all
 
it's pretty boring, actually
 
It's more fun that way
 
@ssube I don't think there's a trivial way to do that, you would need to make use of hooks :/
 
I've used React without JSX and vice versa a few times
@towc so the extra reference prevents you from easily replacing components?
what value does it have, then?
 
@ssube which is using the actually present function. Vue doesn't do that. It's just a different way of implementing it, I don't think either is better
in what case would you actually do that though?
But yeah, it is definitely less flexible in that matter, I can't defend vue on this one
 
12:08 AM
Change implementation of a component at runtime? Any time you're writing a container.
It's also useful for lists, which you could argue are containers of items.
 
I mean, Vue's way of doing it is using it's internal reference system, rather than the scoped system of components, which are 2 different ways of implementing human-readable components
 
Right, but scoping is better.
 
and that's because Vue prefers to parse the whole thing itself, and it needs to do that internally because of the way components are written
 
But why do you need to keep that registry of internal references?
 
Although you can use jsx with vue which kinda works
@towc that makes anything that's not global so much harder - like code splitting
 
12:10 AM
"internal reference system" sounds an awful lot like "single, global scope"
 
You would have to just rely on components declaring all their referenced components
 
I mean, yeah, you could dynamically build the template string, which is kind of what jsx does, but urgh
 
JSX is just sugar for function calls.
 
JSX doesn't do anything, it's transpiled away.
 
You can use it with Vue, nothing magic - there's a babel plugin that does the translation.
At that point you might as well just use Preact+MobX which does the same thing but has a big ecosystem
 
12:11 AM
and the fact that names of functions can refer to different functions every time they're used is what makes it dynamic. It's not really jsx, my fault
sure, vue is less flexible than react when it comes to that
I can definitely agree with it
 
I just don't get what it does better than the Preact+MobX stack.
 
that doesn't make it lesser than react+mobx though
wait, I need to google preact
 
It seems like a solid framework, just not really different.
Preact is faster-than-vue react basically.
Without the patents
 
yeah, it's very similar with some compromises
 
oh, that
 
12:14 AM
@towc well, it's missing a feature
 
minified react which loads fast
 
MobX gives you model bindings like in Vue, and there is absolutely no magic
You can reason about the whole stack, that's neat.
 
@ssube I didn't say it wasn't possible, just not as easy as with react
 
You can mix in other observables.
@towc ok, so it's just more expensive
 
Your view layer, change detection, routing, etc are all modular, composable and easily tested in separation.
 
12:15 AM
@BenjaminGruenbaum Every time I see you I feel a bit guilty for not having even looked at mobx yet
 
@Zirak nothing spectacular to look at - it's just data binding.
 
I actually find vue and mobx equally magic
oh nvm just figured it out
 
mobx is pretty explicit about what it's doing and why
 
It replaces your properties with getter/setter pairs (or a proxy), when you get one in an observed place or a computed function - it registers that. When you set to that property it looks at all the registered places and reruns them.
 
actually no, haven't figured it out
 
12:17 AM
Also there are Map/Set shims that do this that come built in.
 
I know for a fact that vue just uses the manually inputted properties as templates, then creates its own setter/getter system for it, which makes it look fairly functional
I guess mobx does the same
but how does a function know it should change value?
 
it gets called
 
MobX is explicit about it, and your view is decoupled from it so it's not just for view state
 
or rather, that some of the things that defined it should change?
 
When a function gets called it keeps track of all the getters called, when a setter is called for one of those getters it reruns the function
It's automatic because of that- and quite simple
 
12:19 AM
// VUE
...
computed: {
  x() { console.log('hello'); return this.a + this.b }
}
 
Right, MobX does that
 
@BenjaminGruenbaum but some getters may not be called on the first call
 
class Person {
  @observable firstName = "";
  @computed get greeting() {
    return `"Hello ${firstName}`;
  }
}
@towc that's fine, if a getter was not called on the first call then you know it will not impact a branch in the function and is not needed for the second call. That's pretty clever.
Not at all magic though, just an argument on why it can do that.
 
x() {
  return this.a ? this.b : this.c
}
say a is true on the first call. The only getters registered are a and b... oh wait
 
Right, let's say this.c changed and this.a is true and hasn't changed. Do we really need to run this function again?
 
12:21 AM
if a changes, the function gets recalled anyway
 
which then calls c
 
yeah ok, that makes sense
 
if c is actually never used, it will never be registered, but then...
if you're not using it, you don't care about updates to it. It seems overly naive at first, but it's actually just really efficient.
 
And then there are all the people doing this manually with reselect XD
 
12:22 AM
this will probably never happen in my code, but what if it's something like this? x() { return Math.random() < .5 ? this.a : this.b }?
 
If you have an impure computed function then the framework doesn't care about you.
For all MobX cares you can rot in hell :D
 
ok, that makes sense, I should be properly punished
 
That's always the same with change detection systems though.
 
the random factor should be its own property
 
not to mention, if (p)react decides to render again, that might cause flickering
so there's a good chance it will break long before MobX gets involved
 
12:23 AM
The render function in React (or Vue) should always be pure.
 
render function? Vue? Oh, I never! (I'm saying this with the superior disappointed british voice)
 
that's pretty important for react's algorithms, afaik
 
ok, so now that I got that, I don't think any other part of vue is really magic
I can't say I completely understand every detail, but I think I could figure it out
 
What does Vue do to your HTML template and what's all the v-if? How do they compile?
With React, there are no "special directives" like v-if, it's literally all just function calls.
If you need an if you use a regular JS if, with a for you'd .map - it's all plain JS with sugar to make it nicer than writing HTML.
 
you're not forced to use directives in vue
 
12:26 AM
Not having to learn another if/each syntax is pretty great
@towc how do you use JS in the template?
 
You're not forced to, but you're expected to
 
Zirak awesome posters yeah I remember talking about that
 
@ssube like you would in react
I probably need to double-check the extent of that
 
Glad you chose both blue and red
 
@towc in React your templates are JavaScript
 
12:27 AM
ok then 😛 the same way you'd use it in jsx :P
 
render() {
  if (this.red) {
    return <Red />;
  } else {
    return <Blue />;
  }
}
 
You're literally writing a JS function that returns a virtual dom Element.
 
what's the equivalent?
 
JSX is just JavaScript - it's just syntax to make <Foo> into React.createElement(Foo, {}, {}) with props and such.
 
the recommended way to do it is with using directives. Let me double check something before I spout idiotic things
 
12:28 AM
Technically, it doesn't even have to be React.createElement. Luggage uses it to produce PDFs.
 
Yeah, it can desugar into any function call.
 
JSX does look kinda weird in the middle of a file, but it actually introduces very little new syntax and no new constructs, which is pretty important.
 
ok, yup, you can't trivially add a template within a template in vue
eg, you can't {{ message.split('').map((x) => { }}<div>{{x}}</div>{{ }) }}
the upside is that directives are easily defined in javascript, encouraging more modularity
but yeah, doesn't feel too elegant
 
more modularity? Isn't that another dependency, and one that isn't explicitly imported?
 
(in case you didn't know, it's perfectly fine to do {{ message.split('') }} in vue, or add any other normal js in {{ }})
@ssube you don't have to specify directives globally, just like components
 
12:36 AM
ok, so how do you register a new one to use in your previous example?
 
(I'm literally just looking up the docs now)
<template>
  <div>
    <A v-stuff />
    ...
  </div>
</template>

<script>
...
import A from './A';

export default {
   ...
   components: {
     A
   },
   directives: {
     stuff: { ...hooks }
   }
}
</script>
but stuff is just an object, so you can import it just as easily as A
 
in JSX, that's just a method call
 
the hooks for that kind of split-map might look something like this:
 
no registering things, no extra module with a directive
so far it sounds like Vue makes you write a lot more code for the same result
Typescript does that, but does some substantial linting in exchange. What does Vue do for you?
 
It's cohesive
All the parts you'd use (state, router, etc) are a part of the same package
So nothing ever stops being maintained
 
12:41 AM
unless it all stops being maintained
 
stuff: {
  update (el, binding, node) {
    this.message.split('').forEach( (x) => {
      const div = document.createElement( 'div' );
      div.textContent = x;
      el.appendChild( div );
    });
  }
}
 
Vue is pretty popular
 
which is why you might want to set up atomic directives like v-if and v-for and use those when you can
 
@towc what about {message.split('').map(x => <A>{x}</A>)} :D?
In React you can do that (and it's useful to not just create divs)
 
sure, react handles that in its own, often better, way
 
12:43 AM
In Vue you'd just use a v-for and do the split in your model
That's still worse though
 
react is usually more concise, which is not (on its own) better, but it does make the links between things more obvious
same file, imports at the top, simply referencing variables, etc
 
Of course conciseness is better
 
@BenjaminGruenbaum my rebuttal: perl
 
> concise - giving a lot of information clearly and in a few words; brief but comprehensive.
 
react is both concise and clear
well, I sit corrected
 
12:45 AM
@BenjaminGruenbaum not really, you can do the pure calculation in the template
 
But I see what you mean
 
<div v-for="char in message.split('')" >
  {{ char }}
</div>
 
Right, that's fugly :D
 
terse and clear would be a better choice of words
 
@BenjaminGruenbaum well, it's what you do in react
 
12:45 AM
It just makes so much sense for rendering to just be a non-magical function that returns an Element type.
No DSL
 
@ssube oy :/
 
It would have been great if the DOM did that.
Except that one time it did and no one noticed and then it stopped
 
@towc ?
 
for me, vue's structure and working makes it extremely more intuitive, and makes me a lot more productive than react
 
Of course, it wasn't hygenic, but it worked, sort of
 
12:47 AM
I don't know exactly why, but that's the fact
 
@towc you clearly don't understand how either work :D
Go build both, in small scale.
 
I haven't used vue in months, actually
 
React's API is tiny
you can get a vaguely working version together in a weekend
 
and React I kind of understand, I just don't particularly like it
I've used angular for the past month though
I don't want to talk about it. Urgh.
and it's almost 3 am
it's not like I'm doing anything tomorrow
 
you can get a vaguely anything with both react and angular over a weekend
 
1:02 AM
hi, does anyone here have experience with p5.js?
I got this bird to work with an ellipse that I drew, but when I try to use a local image instead the bird doesn't work (Supposed to work like flappy bird) pengu.drmath.xyz/flappypengu , tried looking it up on the p5 site but couldnt figure out where the issue is
 
1:18 AM
correct me if wrong: node synchronously runs asynchronous call(back)s.
 
thank you, i'm reading your answer
 
2:06 AM
omg I found a movie I didn't hate
 
twilight?
 
Idiocracy
I only noticed one blatant factual error
 
2:19 AM
ya idiocracy is a good moive
doe anyone know if there is a log method on the array prototype in node?
 
@Arrow log? as in console.log?
 
no just log
I can't overwrite it
 
@Arrow log as in what?
afaik there's no method called "log"
 
Array.prototype.log = Array.prototype.log;
if(Array.prototype.log === undefined) {
    Object.defineProperty(Array.prototype, 'log', {
        enumerable: false,
        value: function () {
            (this).forEach(function(item){
                console.log(item);
            });
        }
    });
}
 
but what are you trying to do?
 
2:22 AM
I am trying to define my own log method so i can see the results
 
oh
But why put it on the array prototype?
 
so I can do [1,2,3,4].log()
 
lol, forget it, I didn't realize that node had a log method on the array.prototpye. I thought that was strange
 
It does?
It doesn't on my installation
 
2:29 AM
That's what I'm getting.
 
What is what you're getting?
 
anyone have experience with p5.js?
 
​​​​​[ 'length',​​​​​
​​​​​  'constructor',​​​​​
​​​​​  'toString',​​​​​
​​​​​  'toLocaleString',​​​​​
​​​​​  'join',​​​​​
​​​​​  'pop',​​​​​
​​​​​  'push',​​​​​
​​​​​  'reverse',​​​​​
​​​​​  'shift',​​​​​
​​​​​  'unshift',​​​​​
​​​​​  'slice',​​​​​
​​​​​  'splice',​​​​​
​​​​​  'sort',​​​​​
​​​​​  'indexOf',​​​​​
​​​​​  'lastIndexOf',​​​​​
​​​​​  'copyWithin',​​​​​
​​​​​  'find',​​​​​
​​​​​  'findIndex',​​​​​
​​​​​  'fill',​​​​​
​​​​​  'includes',​​​​​
​​​​​  'entries',​​​​​
​​​​​  'keys',​​​​​
 
How did you get that?
 
what version of node do you have
 
2:32 AM
8.1
 
i have 8.3
how do I print out the function ?
 
idk, what happens if you call it?
 
I get log is not a function
 
What is displayed when you print it directly?
 
May I see the code? @Hello
 
2:35 AM
if I drew an ellipse, it works
 
undefined
 
but when I change it to an image it doesn't work
 
is also another method called list
 
uhhh wtf
 
does he same thing
undefined
 
2:36 AM
5 mins ago, by Kendall Frey
How did you get that?
 
I don't know. maybe I installed a package globally
 
I meant the list of names
 
Object.getOwnPropertyNames
 
weird, I did that and didn't get those
 
console.log(Object.getOwnPropertyNames(Array.prototype))
 
2:38 AM
Don't seem to find anything on google
 
Ya I already searched google
 
I'd check for a package that might be polluting it
 
!!> Object.getOwnPropertyNames(Array.prototype)
 
@Arrow ["length","toSource","toString","toLocaleString","join","reverse","sort","push"‌​,"pop","shift","unshift","splice","concat","slice","lastIndexOf","indexOf","forEa‌​ch","map","filter","reduce","reduceRight","some","every","find","findIndex","copy‌​Within","fill","entries","keys","includes","constructor"]
 
i'm trying to append to a component's state's array property but it will not grow beyond the initial two elements i initialize it with.  i'm not sure if this is due to my misunderstanding of react, or of javascript.  i can't see to debug this.

	constructor() {
		super()

		this.state = {
			children: ["one", "two"]
		}
	}

	componentDidMount() {

		this.addChild("one")
		this.addChild("two")
	}

	addChild(name) {

		var newChildren = this.state.children.slice();
		newChildren.push(name)

		this.setState({
 
2:42 AM
that is so weird, I am starting to get worried.
 
maybe your problem is because bird.show() @Hello
 
oh
 
your code is `this.show = function() {
image(img, 0, 0, 50, 50);
}`, so that's why it didn't move
 
ok I think I know what it is, no need to worry.
 
try something like image(img, this.x, this.y ... ) or so
 
2:47 AM
yeah, that worked
thanks hehe
 
:) happy to help, and i want to play it~
 
haha
im very new to P5
:D
but its actually so awesome.
lots of fun stuff i can make
 
 
1 hour later…
4:23 AM
How Angular2+ looks to me :/ goo.gl/mEoVin [warning nsfw]
 
4:42 AM
@Zirak what will you be putting through the amp?
 
5:02 AM
The Office is so awesome... so so awesomee
 
 
2 hours later…
6:58 AM
Just got a downvote there too @MadaraUchiha
Is this abuse or are people just that stupid?
Like, holy fuck - that dude must have wasted thousands of hours of peoples' time
 
hey dude don't worry, i reading it
 
7:26 AM
i just touch the last comment. i'm too newbie to this issue :P
 
8:00 AM
Hi Folks,
 
@PratikAmbani Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Anybody active here?
I want to execute javascript on a page at frequent interval. can anybody please suggest me how do I do that?
pls ping me solution on pratikaambani at gmail.com
 
Is this an example of asynchronous call?
 
@PratikAmbani please google "frequent interval javascript"
 
@PratikAmbani what's your budget?
 
8:13 AM
blindguy mcsqueezy
 
are "promise returning functions" in this ans means the parameters of executor?
 
I did, but no success.
Still looking for the same.
 
@Niing No
It means a any function that returns a promise.
function foo() {
  return new Promise(.....);
}
 
So the callbacks of .then() can throw?
 
@Niing only for errors.
@MadaraUchiha any idea how that got 4 upvotes?
It's terrible advice and all
 
8:26 AM
thanks
 
I'm guessing stupidity.
 
bad education
so i3 madara?
 
Say, @BenjaminGruenbaum @Mosho in the mobx-boilerplate example, you only have one store, and it seems like you pass that one store explicitly pretty much everywhere
Into the router, into the main component, etc.
(I'm talking about AppState.ts)
How does that work out when you have multiple stores?
 
Don't remember.
It just passes the appState store inside - looking at the code.
That doesn't mean you can't inject or do other useful stuff, it's just an example of passing flow.
The example is made to be altered like a boilerplate rather than abstracted
 
apparently my whole debian file system turned into a read-only fs
only meta files seem to be ok (like processes)
running dmesg just exits the terminal
 
8:31 AM
Classic
 
it happened after I force-quit vscode
 
@towc Have you tried using jQuery?????
 
@phenomnomnominal A strat and a prs
@towc Reboot and if that doesn't work, boot into an image and run fsck
 
guess I'll do that
 
though in most distros you run fsck on boot anyway
 
8:34 AM
well, if it doesn't work, I'll be loosing a lot of things. Better upload some files now, if I can
 
Why would you be losing things if it's read-only?
 
(mostly dotfiles. They're not a big deal, but a pain to reconfigure at every install. I should get a github repo)
@Zirak the booting process won't be able to create tmp files, which might risk making debian unbootable
I'm not entirely sure how it works
 
Just format it?
 
Just run fsck.
 
You'll still be able to read files from the disk
 
8:35 AM
@Zirak oh, externally? Ok, that makes sense
 
Or revert it to an earlier snapshot
 
oh, right "boot into an image"
 
Boot as another OS, mount that hdd, bam kablam
 
It should prompt you to run fsck if you reboot.
 
ok, rebooting
 
8:36 AM
And we never saw him again
 
If you're running Ubuntu, your grub menu probably has a "Recovery boot" option.
 
lol @Zirak
 
Get root access, and fsck /dev/sdX
 
Why don't you have backups of your data anyway 0_o? Who keeps things they care about directly on their computer anymore?
 
You put the things you care about in the caring hands of other people you don't know
 
8:37 AM
Like, code is in source control, images are on image storage, videos ditto, music ,etc. Chrome settings are on your gmail, IDE configs are in your GH anyway. What's the big deal of just formatting for 30 minutes and then setting up for another 5
@Zirak the things you care about are already in the caring hands of people you don't know - unless you actually do read all the code your OS runs :D
 
you don't know me bitch
 
Bitch please
I'd rate Google Drive as more secure than your computer
Your computer is so insecure - IE toolbars are getting counseling for being molested on it.
Your computer is so insecure it makes a lot of uneducated remarks very loudly to get noticed.
Your computer is so insecure it has a fake girlfriend computer it tells everyone about.
 
Oh yeah, if it's so insecure, explain this:
BOOM
 
it tried fsck-ing (I think). It said it detected some errors on the file system
 
That's because you're using Chrome which is a god tier level 6 web browser. It's "securing" all your data and private information on its servers and then offering you great deals on products you wanted to buy anyway.
Can save a ton of money on lube
 
8:41 AM
Computer literally tells me it's as secure as the vast Vandertunt fortune
(speaking of which, did everyone already see the last Archer season? @BenjaminGruenbaum, @rlemon, @SterlingArcher?)
 
a loading bar appeared, then said "UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY", and opened an initramfs shell. I'll google this out. The capital words don't look promising
 
Checks real quick if I missed a season
@Zirak ( I think I did, but might re-watch if you make a compelling argument for it)
 
@towc eh, just fsck /dev/sdX
It's okay
 
@towc just format it? You can download all that porn again anyway
 
@BenjaminGruenbaum (it was a nice season. not great, less funny, but I dunno, I really liked it)
 
8:44 AM
doing fsck /dev/dm-1 as that's where the errors seemed to be
it's asking me questions
 
dm-1?
That's devicemapper
 
is that a bad thing?
ok, so said yes to a lot of things, then exited the shell, now it's doing things
 
Did you use lvm? or LUKS?
 
I use both
ok, file system works fine now :D
 
@towc grats
 
8:46 AM
do you think I broke some other major thing?
 
probably, we'll soon find out
 
@towc good luck
 
I'm actually curious how long this debian's lasted me
 
@Zirak given it's a Sunday, and you're here - what's up? Got some time off finally?
 
I'm actually just leaving
toodles
 
8:50 AM
Awww
Are you back in civilization land (Tel Aviv) soon @Zirak ?
There's a talk next week about fetch
On the 28th I think
 

« first day (2500 days earlier)      last day (2450 days later) »