« first day (1827 days earlier)      last day (3122 days later) » 

12:00 AM
Mar 21 at 16:46, by Mosho
you should do whatever is easiest and fastest if your only goal is to get it up
 
crl
we need a $if like the current $rand, so I can switch between 'is' or 'are'
 
that's a lame command..
 
crl
indeed
 
@user2997204 .
 
There's a regex room? I bet that's a fun place.
 
12:10 AM
yes it is, and lonely
 
sounds poetic
 
i dont know why we have programming languages
so dumb
a hammer fixed everything
 
Hi Thor
 
@user2997204 you don't, but the question is: who knows?
lol
 
for example: i could fix this user called CS
with a hammer
 
12:12 AM
1.
 
so what are you guys working on?
 
crl
Are you the guy with a stuck sex?
 
I'm making a statue of CSø out of cheese.
He is.
 
crl
chill
 
12:31 AM
6 messages moved to Trash can
 
@Zirak Are you up too early or too late?
 
!!falcor or relay
 
@SomeGuy Yes
 
@Luggage relay
 
@Zirak Eloquent
 
12:52 AM
My son just got that
$10 on the nintendo e-shop came out yesterday
its actually really damn cool.. you can even make multiplayer games
 
@Loktar wth is that
 
basic programming on the 3ds
 
uhh
kinda kinky
@Loktar built-in accelerometer, gyro-sensor, microphone... so only this arduino modules would be about 10
 
what do you mean?
 
wait, you mean the language is 10 bucks?
 
12:58 AM
yea
its a program on the 3ds
you download it from the nintendo eshop
 
ok, nvm
that's cool
 
so you can make games, ect. on the 3ds, using the 3ds
can share them online as well
 
yo dawg
 
@Loktar That's neat
 
1:11 AM
@rlemon better than nothing?
 
Can some one explain what i am getting wrong in my animation here: jsfiddle.net/kt42jx61 if you mouse over then mouse out mid way through the animation it bugs out
 
@Dave time.
wrong x for your y
 
1:29 AM
Is there any JS analytics out there that can tell you the current memory being used by a JS program? I have a self executing function that apparently is causing the browser to run out of memory, and I can't find where in the script that variables aren't getting dumped
 
@Sparatan117 Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don'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.
 
@Sparatan117 chrom dev tools/ ff also
 
which tool in specific?
 
@Sparatan117 Profiles.
 
K I'll give it a shot
 
1:41 AM
@cs
thanks man
I guess something is wrong in this other guy's script. When the window loses focus, the entire window crashes
 
Hi
 
Hi
 
Call the fire department, because this is a harsh burn.
 
user406009
@Loktar That's pretty much how Trump works.
 
user406009
I can't wait to see him in the next debate.
 
1:48 AM
Lol he isn't lying
 
user406009
Who needs reality TV shows when we have the Trumpinator?
 
cracked me up man
 
Hey got a question here -
 
@coderMe Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don'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.
 
how would you test a pre-existing jQuery plugin? is there a good guide to testing pre-existing code?
 
1:54 AM
?
What do you mean?
 
Testing a jQuery plugin with Jasmine.js. jasmine.github.io
This is the first time I've written tests, but I'm not sure where to start. I would think you'd want to create a separate file which calls different methods in the plugin and tests the return values, right? What about functions which do Ajax calls? How do you test them (or anything, really) without modifying the original plugin?
 
I'm shit at testing so am no help sorry :/
 
3:07 AM
[express] If I res.send() a large amount of data (1mb) and the client is slow d/ling does that block other requests?
 
No
That happens in kernel land
 
even if it's a single string?
 
Yeah
Even if node did something weird (that I'm not aware of), it wouldn't do anything blocking
 
hm. seems i have one request blocking another.
pretty sure it's not the db
I'll have to investigate further if it keeps happening..
 
 
2 hours later…
m59
4:55 AM
Using bluebird 2.10 return Promise.all(myArray).spread // .spread is not a function
can't make sense of that
oops bad syntax there ^
ah hah
the start of the chain is a native promise
 
5:12 AM
you using es6? if so, spread is now redundant.
but there are other reasons to want a bluebird promise
 
m59
@Luggage Oh, how's that?
I know how to do some fancy es6 stuff, but nothing that clicks with this.
 
Promise.resolve([1, 2, 3]).then(([arg1, arg2, arg3]) => console.log(arg3))
 
m59
rad
 
destructuring..
 
m59
Yeah, I've only used objects. Way cool.
 
m59
5:32 AM
How would you tackle this?
thing.addEventListener(function() {
  if (condition) {
    // waiting for this
  }
});

// foo is async
foo(function() {
  // and this
});

thatStuff.then(function() {

})
 
foo is just called right away, then you want to wait for th event?
 
m59
waiting for both foo's cb to fire and the event listener's condition to have been met
 
var fooPromise

thing.addEventListener(function() {
  if (condition) {
    fooPromise.then(function() {
    });
  }
});

// foo is async
fooPromise = foo(function() {
  // and this
});
 
m59
hah, bad example. My bad. Foo can't return a promise. Just a sec, I'll show you what I'm doing (if it works).
 
it can if you Promisify() it.
otherwise, if you want nodebacks:
thing.addEventListener(function() {
  if (condition) {
    foo(function(err, result) {
        //...
    });
  }
});
but promisifying makes it simpler to 'pass around' and compose.
that's really all a promise is. a way to take the callback and pass it around
events can fire more than once, but promises only resolve once. What do you want to happen when the event fires a second time?
do foo() again, getting a new result, or just use the first result resolved?
 
m59
5:41 AM
It's complex.
 
it is programming.
 
m59
I marked the two spots. Those two things only happen once. I need to do some stuff once they both happen.
So, my problem is that I need to go promise nuts, right?
I can solve this easily from here with a variable/condition to check, but it's messy.
 
not nuts. but a promise is actually a simpel way to solve it. give me one minute
 
m59
ah! makes sense
but, it could resolve in either place, right?
 
put reject(err) in the other error spots, too. mic error and createOffer error
btw, what library is that?
 
m59
5:53 AM
library?
 
How the heck am I suppose to read this object?
{ [TypeError: Cannot include body with GET/HEAD request] filename: undefined }
I need to get the string "Cannot include body with GET/HEAD request" from it.
 
ohh, nevemrind, it's built in api
is it a string, or are you just getting that when you console.log it?
 
yes
 
which?
 
I can traverse through that object but I do not find that required string in it.
I get it in console.log
 
5:56 AM
try .message
 
Dint get you
What .message exactly?
 
try reading the property named message
theError.message
 
Bingo!
Thanks, man!
 
message is the normal property on all/most errors.
and errors don't serialize to the console very well.
which is dumb
 
I see.
 
m59
6:05 AM
@Luggage The thing that confuses me most about Promises is error handling. If I put reject in place of those error callbacks, how should I discern what went wrong?
make custom error types and catch those? That's the only way I know and it's ugly.
or conditional based on the error message?
reject('foo') vs reject('bar')?
 
6:40 AM
you are just converting error callback into the promise-style. catch the error on the promise side
.then(...)
.catch(function(err) {
});
 
hi everyone
 
@mohsin Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don'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.
 
m59
@Luggage I didn't quite phrase that right :)
 
a callback version for comparison: pastebin.com/UC0qbz2V
 
m59
I'm with all that
 
6:47 AM
one small difference. it won't start navigator.getUserMedia until icecandidate event.
 
m59
I don't have time right now, but I'd love your input on a longer block of code.
 
i need to go lose conciousness anyway
 
m59
same ;D
 
the promise version wasn't as clean because it was half-assed. it mixed callbacks and promises.
when done right, promises are more composable, and composing is what you are doing.
 
m59
I have this mega chain of promisy stuff, but the error handling gets whack.
 
6:49 AM
yea, they are better at erros becasue you can drop all the if (err) junk
 
m59
especially trying to cleanup the state that is being set in case of various errors/disconnects
 
errors bubble much more like a try { } catch {}
anywho. sleep time
 
m59
Peace
 
crl
I have some non-sense dreams, I was walking on the (calm) water near a cliff
 
What the fuck is wrong with the name?
 
crl
7:01 AM
the title? Farm ani.... ?
can't explain sorry
it appears to be Archer-related
 
crl
7:29 AM
@DenysSéguret why didn't you angularize Miaou?
well maybe doesn't make too much sense for some real time stuff
!!<input > or <input />?
 
@crl <input />
 
crl
!!learn how_old $rand(8,120)
 
@crl Command how_old forgotten.
@crl Command how_old learned
 
@crl Why would I ?
 
crl
for a bit less of jade (never used it, so I won't give any opinion on it sorry), and anyway, you certainly have to do a lot of ajax, so why not templating 'directly in ajax'
 
7:48 AM
@SterlingArcher chien.fr/actualite/…
 
@FlorianMargaine SterlingArcher is afk: ragequit
 
crl
@Denys don't mind, I'm just curious (and not too much experienced)
 
8:03 AM
@crl templating "directly in ajax"? What does that mean?
 
crl
@FlorianMargaine feeding/filling templates directly after/from some ajax requests
 
8:22 AM
@crl he has a complicated system for this, where he gets the raw data and feeds it in a template
Complicated because he needs stuff like plugins and sanitization etc
 
crl
which files may I ask?
(I'm looking at the source, because checking how to use passport)
 
@Luggage Run node with --track-sync-io
 
crl
@Zirak merge my weather PR pls, I need to check the weather, I've no other mean
 
oh, people are doing stuff. How odd. Will check.
 
is there anything better than linux?
 
8:36 AM
More linux
 
Windows 10
 
@Zirak lol
@Zirak I saw your ping btw, python class system is terrible, otherwise your code is mostly fine except for some nitpicks (but really, you're writing python in sexp, that's it...)
 
Was worried about that. Hopefully that'll change.
 
@Zirak namely, 2 nitpicks: (when (is foo None)) should be (unless foo), and the cond should be in the apply, not the other way around
The cond only lets you get the first argument of apply, so let it get only that :)
 
8:50 AM
ah, now what's a lispy difference
 
Putting the thingy in another thingy instead of the first thingy
 
if s/what/that/, yeah, that's an advantage of everything being an expression
That's usually the thing to grasp to write in a more lispy way
(well, one thing)
 
(apply (cond
            [(hasattr route op) (getattr route op)]
            [(hasattr route "__call__") route])
           args)
 
Are you aware this will return nil if it's neither result?
So, (apply nil args)
 
8:57 AM
I should probably raise an exception
 
Rule of thumb: end your cond with t
Shouldn't there be some indentation before the cond conditions?
 
Indentation got a bit screwy in chat, I'll pasta it elsewhere
I just roll with whatever indentation emacs dishes out
 
Yeah, that's fine
@Zirak be careful with emacs indentation, I did the same as you and ended up with mixed tabs and spaces
Emacs really screwed with me there
@Zirak I have to show you something nice... Emacs automatically replaces lambda with the Unicode lambda sign (only in appearance, not in the source code itself), it's nice
 
9:12 AM
In Emacs 25, I've seen that, really cool
 
@FlorianMargaine That's neat! (although, cringe, that's some copy pasta)
 
Yeah, my .emacs is Terrible™
@Zirak it's emacs 24.4 btw
(I think I don't have emacs 25... I'll have to double check)
Yup... Emacs25 isn't in Debian repo
 
Last I checked ubuntu still had emacs 23 ~_~
 
9:52 AM
emacs 23 xD
 
morning! anyone familiar with AST transformers and the jscodeshift API?
 
10:09 AM
@Zirak Debian unstable is usually fairly recent. Depending on packages, it can get new releases within a day or two
It's usually a week
 
anyone use flowtype?
might switch to it from typescript
 
crl
I use hipsterscript, more powerful :p
 
10:28 AM
@Loktar so, how is that Steam controller working out?
 
10:50 AM
@SuperUberDuper what operating system are you using?
Flowtype doesn't run on all operating systems.
 
then you can switch, assuming no one with windows will ever work on it.
 
ah, that would be a pain
 
@Loktar are you voting Trump?
 
btw, when did the john cena interrupting things start?
I've seen a lot of internet stuff joking about it, but I don't know what the original was
 
10:56 AM
@towc dude.
Enjoy your 10000
 
thanks :D
except I don't live in america
 
Neither do Benjamin nor I, but we're citizens of the internet.
 
@BenjaminGruenbaum it's sooo cruel XD
 
suppose my mongo document has many fields. What I really want is to add all the emails in the document to be added in an array so that I can send email to all of them in one go.
Yes, I am being lazy
 
So do that. No point telling us; just go for it.
 
11:11 AM
Pursue your dreams
 
Hi! I am looking for a way to create a ReactJS component to preload images (first show a blurry version and then, when the "big one" is loaded, show it instead). What can you tell me about this?
Something like
<ImagePreloader src="myimg.jpg" preloader="myblurry.jpg" />
 
And what problems did you encounter?
 
Well, I don't know where to start with preloading the image
I mean, I found some ways to do this, but I don't know how to manipulate the DOM of my React component to fade out the blurry image
 
You have tons of hooks, see facebook.github.io/react/docs/…
And you don't manipulate the DOM, you render things differently
 
Yeah, but that won't enable an animation
this is the problem I encounter
 
11:26 AM
Why not?
If you really want to be hacky, then save an img object in your component and do your deeds on it
But at that point just don't wrap it in a react component
 
sorry for "no indentation" thing :))
 
aw, bot seems to have problem with long messages...blegh
!!tell Victor format
 
@Zirak That didn't make much sense. Maybe you meant: tell, tel
@Victor Format your code - hit Ctrl+K before sending and see the faq
 
1 message moved to JS trash
 
var ImagePreloader = React.createClass({
  propTypes: {
    src: React.PropTypes.string.isRequired,
    preloader: React.PropTypes.string.isRequired
  },
  getInitialState: function() {
    return {
      loading: true,
      image: null
    };
  },
  componentDidMount: function() {
    var image = new Image();
    image.src = this.props.src;
    image.onload = function() {
      this.setState({
        loading: false,
        image: image
      });
    }.bind(this);
  },
  render: function() {
 
11:31 AM
How did you want to animate it?
 
I want fade out the blurry image and leave the actualy loaded image
 
Can you write it in "normal" js, without react? What will it look like?
 
so that it's not a js component?
 
Yeah, regular DOM stuff
 
ok, just a moment
 
11:41 AM
Can't you just return this.element (or something) and make your this.element the this.state.image/this.state.loader ?
And when the state change, adding a class to your current element to fade out with css?
 
But is that a good method? Isn't it hacky?
 
I don't really know React, so I don't know what is the normal way of doing things in it. But if I had to do it with pure DOM, I would have :
div
- img loader
- img real

with the div : position: relative; the images : position: absolute; top : 0; left: 0;
When the real images is loaded, fading the preloader
Because you don't want to have your layout with no image, so the real image must be in the dom when you fade the preloader
 
this is what I came up with so far, with pure dom
var PreloadImage = function(node, src, preload) {
  var blurryImg = $("<img/>");
  blurryImg.attr("src", preload);
  blurryImg.css({
    zIndex : 2,
    position: "absolute"
  });

  $(node).append(blurryImg);

  var image = new Image();
  image.src = src;
  image.onload = function() {
    $(image).css({
      zIndex: 1,
      position: "absolute"
    }).appendTo($(node));

    blurryImg.fadeOut(200);
  }
};
 
Else it will have a >pop> effect that is pretty bad to see
 
@Zirak, how about it?
 
11:47 AM
"pure dom" jQuery all the things xD
 
yeah sorry about that.
the fastest way
pure jQuery-DOM
 
That's exactly what I was saying, no?
 
I don't know much about animations and css, but won't you rather once it's loaded display both elements on top of each other, and then with css blur out the preloaded one?
 
yes. but I should do its job. it's not react though
 
React has built in stuff for transitions (facebook.github.io/react/docs/animation.html), and there's a hefty mixin as well github.com/elierotenberg/react-animate
 
11:49 AM
@Zirak that<s what he does here, except he append the last one when it is loaded, and then fade the blurry one.
 
@Zirak OMG I didn't know about that!
 
@dievardump Yeah that's what I meant
22 mins ago, by Zirak
But at that point just don't wrap it in a react component
 
@Zirak I am reading that documentation now, and I will try to use it and I will come back here after that!
 
12:15 PM
I can't render DOM elements in a React component. I get Invariant Violation: traverseAllChildren(...): Encountered an invalid child; DOM elements are not valid children of React components.
<div className="image">
  {this.state.image}
</div>
 
@Victor Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
I hit Ctrl+K, but I had also added other text that shouldn't be code and It failed with formatting
 
omg @ that room name ... made me smile
 
12:31 PM
What rroom name ?
@Victor WHAT ?
can u share more code ?
 
var ImagePreloader = React.createClass({
  getInitialState: function() {
    return {
      loading: true,
      image: null
    };
  },
  componentDidMount: function() {
    var image = new Image();
    image.src = this.props.src;
    image.onload = function() {
      this.setState({
        loading: false,
        image: image
      });
    }.bind(this);
  },
  render: function() {
    if(this.state.loading) {
      return (
        <div className="image">
          <img src={this.props.preloader} />
This is the code of my ImagePreloader component.
It shows the first image, but then I get the error I posted above
 
@MadaraUchiha Sorry?
 
12:48 PM
@Abhishrek JavaScript - Farm Animals of War
@Victor please don't think that we are ignoring you. The problem is that we all don't use React ... Some people may, but are they online/do they have time ?
if you have been here for a while, i suggest to create a question post instead. Maybe it leads to an answer more quickly
 
@KarelG Yeah, that's what I am going to do, but my problem is like a questions-chain :)) I will post a question
 

« first day (1827 days earlier)      last day (3122 days later) »