« first day (2140 days earlier)      last day (2800 days later) » 

user406009
2:00 PM
@SomeGuy If you ban loops or recursion, the program trivially halts.
 
Oh. Right, right
 
random example
 
user406009
You can also do things where you limit loops and recursion so that they are guaranteed to halt.
 
@Luggage Yeah, yeah, I know
 
HAMMERZEIT!
 
2:00 PM
Not piddling around is what makes me free to actually code fun stuff
 
user406009
@SomeGuy I would recommend looking into Dafny if I was you.
 
user406009
It's a really cool example of these concepts in action.
 
all I do is update the state after 2 seconds, and as you see it adds a new list item
 
Will do! Thanks :)
 
user406009
You have to annotate all the recursive calls and loops to prove to the compiler that they will halt.
 
2:01 PM
HAMMERZEIT!
 
We need to have a transpilation intervention for @KendallFrey
 
that's the gist of react
 
user406009
rise4fun.com/Dafny/Ackermann is an example. (Note that they annotate that n is decreasing on line 2)
 
hi, is using return false to stop in a function, i should really be using break;?
 
man I'm struggling with Redux
 
2:02 PM
I've used build tools in the past. I know how cool they are. But this time I'm not putting time into the fancy until I have something that works.
 
about to throw it away and use mobx, or use something even simpler
 
I am using mobx, now, but I only have a few simple 'pages' in it, so far
 
Redux is too academic for my liking, reminds me of when I was using Angular
@Luggage how do you handle nested properties?
 
See.. I can't stand JS without transpilation.
 
@Lalaland I see
 
2:03 PM
That's the only thing I was struggling with a bit
 
user406009
@JoJo Returning is fine. Just be careful with skipping cleanup code.
 
or do you just flatten your structure?
 
So can I think of my Component classes as viewmodels?
 
@Lalaland thank you, I do not want to start any bad habits
 
@KendallFrey yea
 
2:04 PM
hmm, so how do I tell my component it's been updated?
 
@Loktar mm.. i'm not really dealing with them, yet, I guess..
 
ah alright, yeah that's one issue with mobx
not a real issue, but something you have to solve on your own
 
all the stuff is happening in my model object
 
it wont notify you of changes to nested properties
 
@KendallFrey if you want the component to update itself (like form an event), you change it's insternal state (.setState())
 
user406009
2:05 PM
@KendallFrey You call setState.
 
@Lalaland Yeah, but where do I call it from?
 
oterwise, the component will re-render any time new propertie are passed in from the outside
 
@KendallFrey where your changes happen :p
if they happen outside of the component, then pass down the data as properties to it
you can hydrate the components state in the constructor (oops)
and change the state in events
 
So in other words, React will nicely manage the DOM aspect of it for me, but I still need to handle notifying that the model has updated?
 
you can have nested observables in mobx, so i'm not sure what you have to solve on your own
 
2:06 PM
@Luggage how??
like for instance say I have {foo: {bar: 'baz'}}
 
user406009
 
if I update bar I don't get notified
 
@KendallFrey that.. looks like it sucks. Didn't we have Object.observe() for that?
 
user406009
Where you provide a callback this.handleChange to the model when the component is mounted.
 
@FlorianMargaine you can use something like mobx, which gets rid of using reacts state
 
2:07 PM
> In November 2015, it was announced on esdiscuss that the Object.observe() proposal is being withdrawn from TC39.
ugh.
 
user406009
Another approach is to simply store the model as an element within the component.
 
which is using an observable approach
 
user406009
@FlorianMargaine You can use defineProperty instead and get similar results.
 
@KendallFrey yes
 
// ESNext class example with decorators:
class Todo {
    id = Math.random();
    @observable title = "";
    @observable finished = false;
}
I like that.
 
2:08 PM
which is what mobx does, defineProperty
 
@Lalaland Yeah but the component won't notice when the model's properties have changed
 
god dang I can't type today.
 
@Loktar sure, just today.
 
fine, evergsdfday
 
just sittin on your lawn
grandpa
 
GET OFF MY LAWN
 
user406009
That's the reflux like approach.
 
At first glance, that seems reasonable
 
user406009
Or something. It's gotten to the point where I can't really tell the redux/reflex/acid reflux junk apart.
 
2:12 PM
It looks pretty similar to .NET's event model as well
I wonder if it would be a bad idea to make my model an eventtarget
 
note that foo could change out the whoel object, though..
and the bar observer would not notice
 
user406009
@Luggage It's been deprecated. As of 10 months ago.
 
what has?
 
user406009
Object.observe.
 
user406009
Oh wait, that's something different.
 
2:14 PM
how do you run a bin?
 
user406009
My bad.
 
ohh.. good thin I am not using that
 
friggin js bin
 
click run in the top right
 
@Loktar a lot easier than running a src
 
user406009
2:15 PM
@KendallFrey And easier than running a 5k :P
 
SO's documentation just makes me mad... I need to stop looking at it... stackoverflow.com/documentation/javascript/227/loops/19850/…
 
@BenjaminGruenbaum Feel free to make a counterproof
 
@ndugger and not downvote option for "just fucking wrong"
 
One more question: Is it correct to basically update the entire state every time a model property changes?
I'm not expecting it to be expensive
 
2:17 PM
setState() will merge in props (shallow), so you don't have to
 
@BenjaminGruenbaum You should be able to do this by using the semantics and premises introduced in the gist.
 
but yea.. it is reconsidering ALL state since it re-renders all
 
SOs documentation seems like a bad idea
fragments the community imo, but what do I know!
 
@Luggage when you say merge, you mean like a diff?
 
2:18 PM
if state is { foo: 1, bar: 2 } and you call .setState({bar: 3}) then state will be { foo: 1, bar: 3 })
 
ohhh
neat
 
@ndugger I mean, it's not completely wrong
 
Is it possible to remove properties?
Not that I need that, just asking
 
@BenFortune No, but it's non-standard, and not actually a javascript feature, so it's in the wrong place
 
jsut set to undefined, i guess..
 
2:19 PM
True
 
but never mutate this.state directly
 
makes sense
 
going through .setState() is what keeps react's lifecycle working
among other things
 
and setState is async
it can accept a callback function
so it's not "instant"
that's a gotcha I see a lot of people get confused by
 
mostly that doesn't matter.
well.. hasn't mattered to me
 
2:21 PM
lol that's the reason behind mobx + react
according to the author even
which cracks me up since it's not a hard concept to grasp
 
and if you are only reacting to state in your render() then you might not even notice
 
> Many devs don’t realize this initially, but setState is asynchronous. If you set some state, than take a look at it, you will still see the old state.This is the most tricky part of setState. setState calls don’t look asynchronous, and naively calling setState introduces very subtle bugs. The next gist demonstrates that nicely:
lol it's funny, because it's not actually tricky at all
Ryan Florence called him out on that
> Oh come on now … you can pass the next value to fireOnSelect and call up with that. Understanding setState is async and passing an arg seems like a pretty low cost endeavor compared to bringing in a state management dependency. Certainly there are a couple gotchas to working with MobX that would be equally as trivial to figure out.
 
yea. I'd say that mobx, as powerful as it is, introduces way MORE gotchas
 
mobx seems cool for sure, I just think his reasoning in that article was really weak
 
agree
 
2:25 PM
it seems to be gaining traction as well
I see it mentioned often lately
almost like the redux hype train is dying out
 
coming form knockout, a few things in mobx feel a bit backward, but I like it
 
@Loktar redux is slow as shit, so yes, I hope it dies fast
 
What's the best flux-like implementation to use these days?
 
none
 
npm install none --save
 
2:27 PM
The entire idea of stateless components is foolish and non-performant.
 
@ndugger oh come on, be a little subtle, otherwise they'll never believe you
 
not if there are smart stateful components at some layers
 
@ssube You can bitch and moan all you want about how much better you think stateless components are, but when you're building lists of 6000 items and have to update a single row, going through a store like redux that trickles changes down is slow as shit. What we've done recently is architect a plugin structure where plugins maintain their own state and update rows and cells rather than going through a terribly slow trickle-down state change
We've improved performance tenfold by breaking out of traditional thinking with react and global store bullshit
 
React gives you the tools to do that efficiently, but I don't know about redux
 
Redux can go die in a fire
 
2:32 PM
but it's much easier with a state system like mobx, wher it can trigger only a re-render on the one changes item, poetnetially
without having tons of shouldComponentUpdates
 
yeah, redux is a good concept, but too dumb of an implementation
 
maybe you can fix redux
reredux
 
retardux
 
@ndugger yeah dude I am implementing it here...
but it seems way overly complex
to me anyway idk.
 
@FlorianMargaine Heard of this before? en.wikipedia.org/wiki/Coreboot
 
2:37 PM
@ssube status.npmjs.org/incidents/dw8cr1lwxkcr :-( npm is silly....
 
every example I see uses like 5 packages that I have to then go and lookup
 
en.wikipedia.org/wiki/Coreboot#Initializing_DRAM specifically made me realize how we take so much for granted sometimes
 
> we should have deprecated the module instead of unpublishing it
 
@GNi33 ^
 
@Loktar Not only is it overcomplex, but it's ridiculously slow. If it's not too late, I'd change directions
 
2:38 PM
yeah it's easy to change directions, I JUST started this week haha
man, glad you feel the same way
I felt like an idiot because everyone seems to love it
I was just like, wtf am I missing about this being so great?
 
Nah, even my coworker, who loved it, sees the light now that we've proven how fast we can get without it
 
No no no no please don't do it like this. Why?? — Sterling Archer 8 secs ago
good god
 
> More detail: the "fs" package is a non-functional package. It simply logs the word "I am fs" and exits. There is no reason it should be included in any modules.
welp...
 
wat
 
yea, it should be unpublished and the name reserved
 
2:40 PM
@ndugger they go on to say "many packages probably wanted to use the built in fs module"
@Neal ^
 
Ah
 
whoever's package broke, they deserve it. :)
 
hey @Luggage, mind helping me out again?
 
2:41 PM
just ask, one of will help if we can / want to
I won't commit to anything up front
 
developers developers developers developers
 
Jesus christ, the net package is just
var net = require("net")
for(k in net)
	global[k] = net[k]
 
> 2,185 downloads in the last day
the eff
 
> Don't install this, child_process is a core package, you don't need to run npm install to use it
 
This agile training really isn't bad. It's 2 full days, but the guy is good at making you pay attention with group activities
 
2:42 PM
@SterlingArcher have you guys played "agile twister" yet?
 
sounds kinky
 
naked agile twister?
 
ok. so I went with your suggestions yesterday. Here is the original jsfiddle - jsfiddle.net/breezy/dqjpkus4 - I got the buttons to execute the functions by binding them but now the 'show more' and 'show less' is not working as expected. codepen.io/BryanBarrera/pen/OXZvgR?editors=1011 - @ anyone who can help. Thanks
 
agile twister? No that's a new one for me
We're doing planning poker right now but I'm already familiar with that so yeah
 
> the guy is good at making you pay attention with group activities
I think @SterlingArcher accidentally went to dog obedience school.
 
2:44 PM
!!afk back to it
 
I have four words for you...
 
@BryanBarrera you still are never setting numberOfItemsToDisplay again after reading it
you read it into a local variable, do math, then throw it away.
this.numberOfItemsToDisplay = numberOfItemsToDisplay;
or just reference this.numberOfItemsToDisplay always, and never copy it into another variable, to prevent confusion
 
@jAndy I have four for you! You lost the game.
 
I love this game! YEAAAAAAAAHHHHHH
it's so funny I can't hold it every time I see it.. Ballmer... thank your for life
 
@Luggage got it. i will see what i can come up with. thanks
 
@BryanBarrera and format your code. I have trouble following it due to formatting alone.
Though shalt not suffer random indentation
that pizza has been in the floor for weeks, but my code is perfectly indented.
mushrooms are growing in my shower, but never shall I mix tabs and spaces.
 
yeah i think it was due to copying from jsfiddle into codepen. I will format it @Luggage
 
it was unformatted back in jsfondle, too :)
 
@ndugger thanks btw man
you are my excuse to drop redux :p
 
go mobx.
 
2:58 PM
> been talking to a group that has implemented, they are basically saying RUN
@Luggage yeah maybe idk
 
What do you use to manage state?
 
I don't like how it foregoes reacts state
 
a strong military
 
we use reflux currently
which works out well for us, it's dead simple as well
just not as popular as other libraries
 
@Neal what a garbage company
 
2:59 PM
Any reason you were changing it?
 
they are overstaffed.
 
@BenFortune I worry about reflux future
and it's a new project that I'm working on
 
anyone know what setting in babel allows you to get away with no {} in 1 line arrow fn's?
 
so I figured it was a good time to try something else
 
@SuperUberDuper that's part of arrow functions. what line are you having trouble with
 
3:00 PM
@SuperUberDuper that's not a babel thing. Read the spec/docs on how arrows work.
 
Ah. Are you going to create your own or just not bother with flux?
 
well, I can do
item=> {return item.getBoundingClientRect()}
but not
item=> return item.getBoundingClientRect()
 
no return when it's a single line
 
@SuperUberDuper have you read how arrow functions work?
 
Been meaning to get into React but never had a reason to.
 
3:02 PM
ah yes,thx @Luggage
I forgot
yes ss
 
I'm making some competition for react, it's state is completely immutable, so no re-renders. I call it Resist.
 
man such nice weather in Rochester NY today
so you guys still like react?
 
@SuperUberDuper no, jQuery is popular again.
 
I saw a big ember player move to it
 
3:03 PM
lolz
 
................
 
I use jQuery ironically.
 
Alex Jones lol wth
 
If thats true were doomed
 
@Loktar isn't he one of those dangerously nuts types?
 
3:04 PM
react is still popular in thie room. that's all I know
 
like, sovereign citizen, about to blow up the govt, fema chemtrail types?
 
@ssube idk if he is dangerous, but he is definitely good on putting on a show
 
my friends are ok in Kokomo indiana!)
 
Him and Glen Beck must be brothers
 
fema chemtrail type?
 
3:05 PM
TIL Scala developers use `====` operator. JS, your turn! https://github.com/tonsky/FiraCode/issues/229
 
they can turn on those fake tears
 
if he was actually dangerous, he would be out doing something, not sitting on the radio
ligatures are super cool
 
all I see are hieroglyphics
 
well, I've improved my short term memory by not doing as much programming
more variety
 
@Loktar their choice of symbols is pretty bad, IMO
 
3:09 PM
@ssube don't you think FEMA camps are a bit weird?
 
@SuperUberDuper please don't flamebait about conspiracy theories
 
mmmm, FEMA Smores..
 
@ssube is that.. == undefined or === undefined/
 
@littlepootis triple, it's got 3 lines
 
3:12 PM
=)
 
ah
that font is weird.
 
-4
Q: How to convert php to javascript?

LisaI want to convert this php code to javascript: <?php $page = file_get_contents("https://www.googleapis.com/books/v1/volumes?q=isbn:9780439023528"); $data = json_decode($page, true); echo "Title = " . $data['items'][0]['volumeInfo']['title']; ?>

classic
 
github.com/i-tu/Hasklig looks more traditional, but has the ligatures
 
> As Marc said, this is not the website to request other programmers to code for you. We help you troubleshoot and recommend courses of action. That being said, I recommend you look into jQuery.
jfc
 
@SomeGuy ya
 
3:19 PM
> the "fs" package is a non-functional package. It simply logs the word "I am fs" and exits. There is no reason it should be included in any modules. However, something like 1000 packages do mistakenly depend on "fs", probably because they were trying to use a built-in node module called "fs"
wow
 
Guys. I am facing a problem with this glorious diversity of JS.
I am making a project on react. I have three different react classes in three .jsx files. And I am using gulp to build.
In one jsx file I require another jsx file. But I can't get how to build that into one js file.
to transform react I'm using babel with react plugin. To resolve `requrie` I use browserify.
How do I set this pipeline to produce single js file of all my wonderful sources?
 
feed babel's output into browserify
 
use webpack
 
tell browserify to output a single file
 
hello everyone
 
3:21 PM
Hello admittance
 
I have zero knowledge of Javascript and I come from c++ background. I am working on an open source project that uses js scripts. I would like to catch up with someone free and have some time just to walk me briefly on how the calls are working between c++ and the js scripts and how js are being executed and integrated with the application. I will appreciate the help
 
I would suggest switching over to webpack. In my experience it was a lot quicker with rebuilds after changing a file and simpler to configure. Something like this might help you get up and running. The other real bonus is webpack-dev-server is great to work with and can reload your browser as soon as the rebuild it complete
https://www.twilio.com/blog/2015/08/setting-up-react-for-es6-with-webpack-and-babel-2.html
 
I'll jump on that bandwagon. use gulp
(quick! now someone suggest another task runner!)
 
grunt
 
I use gulp-gulp
 
3:24 PM
i mean, clearly jquery is the best task runner
 
gulp.task('gulp', (gulp) => gulp.src('src/**/*').pipe(gulp))
 
you'll find no better
 
I don't usually gulp, but when I do I gulp gulp
 
gulp-grunt-msbuild-maven
 
believe me
 
3:25 PM
@KevinB pft, Zepto
:D
 
@Luggage 3 years later....... it's still loading
 
that's the maven doing that.
 
oh man, we used to run the closure compiler (jvm version) on stuff...
it would take 2-3 minutes to load and 45 to run on any decent sized script
 
i only used maven to make jira and confuence plugins
 
somebody asked me to make a jira plugin to read gitlab stuff the other day
 
3:30 PM
i'd be surprised if one doesn't exist
probably by that bob guy
 
meh, a guy on powster.com seems really keen on hiring me :D
 
@littlepootis that's amazing
fucker
 
you're ugly
 
@littlepootis Joke's on you, I blocked it.
 
3:32 PM
-1 kudos for wrong day
 
Oh, that thing had that too. lmao.
 
hey @luggage thanks a lot man for your suggestions. I'm still a noob but trying to get a hang of object literals. How does this look? codepen.io/BryanBarrera/pen/OXZvgR
 
got multi-touch to work --- pc crashes at the end of the calibration
noice.
!!afk these pretzels are making me thirsty!
 
can I use webpack without regexps in configs?
 
@BryanBarrera good. Now you can, if you want to, turn it into an object that you can spawn multiple instances of.
 
3:44 PM
Like **/*.js
 
isn't that globbing, not regexp
 
is that regex
 
but sure, you could not use them, but i'm not sure why you would do that.
 
That is the point **/*.js is not regexp. But webpack proposes to use test: /\.js$/,
 
you can import the glob library and use it, yeah
regex is usually easier
 
3:46 PM
Good afternoon. I've a if statement: if (a > b) { // Do something } a = 240, b = 300. This works because its true. There is also a variable c. By default it's undefined. What I want is when I declare a number to c like 400 I would like to fire the above if statement only when a is greater then b and is smaller then c c = 400.
 
Because I so much against regexp :3
 
thanks man @Luggage
 
@teivaz I understand entirely and was just looking that up the other day, found: github.com/webpack/webpack/issues/370
 
@ssube Thanks!
 
@rlemon I was using it as an empty package for things that required fs for frontend. I just switched to doing this instead: github.com/trentm/node-bunyan#webpack
 
3:51 PM
@Neal rlemon is afk: these pretzels are making me thirsty!
 
k
 
@Neal is that working right?
 
@ssube Yep :-) it is working great ^_^ Why? have you had issues?
 
it seems to be for me, so long as I never actually use the modules
 
@ssube Well you shouldn't on the frontend, you do need them in node
 
3:53 PM
Oops, a should be 300, b = 240.
 
right
 
@ssube def not left
 
And if c is declared and not undefined, a should be between b and c to do something.
 
@Caspert treat it like basic math, only instead of evaluating to a number, you're evaluating to a boolean.
 
@Oleander but I have proof using the actual semantics and it's called "The ECMAScript specification"
 
3:59 PM
 

« first day (2140 days earlier)      last day (2800 days later) »