« first day (3084 days earlier)      last day (1874 days later) » 

6:00 PM
but I feel like the second one makes more organizational sense
 
but JSX is pretty nice. you just have to first get over the hump that it looks like HTML
 
and I think there's a possibility of node_modules confusion with the first one
 
We use the former
 
@rlemon I guess, but I question why someone wouldn't "jive" with JSX considering it's basically just html and if you write html in your JS code, then it's the natural next step to make it readable
 
6:00 PM
src/
--/client
--/server
package
settings
et al
how I structure mine
 
go ahead and kill me for saying "it's basically just html"
 
@DavidKamer because for 25 years we were focused on not writing HTML in our JS
 
you're sharing a single package.json between both? interesting
 
JSX isn't HTML, so we still are not
but it feels like HTML
so some people don't jive with it
 
I mean it has to be written somewhere
 
6:02 PM
with React, no it doesn't
you're writing no HTML. you're writing JSX
 
focusing on "not doing" something is generally a sign that you're avoiding the inevitable lol
 
and it's being converted to JS calls
 
@DavidKamer no way
let's talk about GOTO
 
with(){}
 
@forresthopkinsa yep, you were all avoiding functional programming
 
6:03 PM
yea, not something that should be done
 
alright, I don't think I can hold this argument up
 
BUT looking at JSX as HTML is necessary TO SOME EXTENT
 
why?
 
and any part of you that will avoid that and still use React is just rebellious
 
6:04 PM
because they both are a tag syntax?
 
Yes you're right. JSX serves the function that HTML normally would, which is structure
 
because the DOM
 
but I'm not touching the DOM
React is
 
coldfusion is html
 
yeah, maybe more correct to say it's a DOM abstraction
 
6:05 PM
we normally want to keep structure out of JS but JSX turns that around
 
but you can use html elements (have to underneath everything) and it controls in the most direct way what html is rendered
almost a superset of html (I'll catch the stones you through at me)
 
yes, when I write <div> JSX converts it to a JS call that creates a div
but <div> in that context is still JSX
 
Hello, guys
 
all markup languages are not "HTML" tho.
 
@rlemon not quite a meaningless distinction... but pretty close if you already know that and you call JSX a type of html markup
 
6:07 PM
I need some help with node
 
@DavidKamer I think people just conflate all markup with "html"
 
Can someone help me?
 
!!welcome grrigore
 
maybe
 
@grrigore Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
6:07 PM
@rlemon you just barely beat me to it that time
 
@rlemon 100% agree, but when they compile from something that is html syntax to javascript that prints that exact same html, it's html markup at some level
 
is coffeescript JS?
 
is js valid in coffeescript?
 
not all of it iirc
 
@rlemon I don't know much about coffeescript tbh
 
6:08 PM
the answer is no :P
 
it's garbage
 
Angular uses directive templates that are written in HTML files
 
compile2lang !== the lang it compiles too, even if they are similar. I'm just being pedantic tho. JSX is not HTML. :D
 
and those HTML files do not ever get sent to the client
 
but I WOULD say that if it had the exact same syntax, added some capabilities, and compiled into something that printed out javascript that looked almost entirely the same as the coffeescript you wrote, that it was a superset of javascript. Maybe I'm wrong
 
6:11 PM
@DavidKamer all markup shares the same syntax..
that was the point I was making
 
idk lol, I just think it would be weird to write html and avoid JSX
 
not really
 
Angular templates are html but they get translated into Javascript DOM manipulation
 
some are more strict than others
 
but they syntax is mostly all the same.
 
6:12 PM
Vue does the same thing
 
it's xml
 
oh god back with XHTML
I was pretty young when that was a thing iirc, but wow
 
i never messed with xhtml
 
I spent a lot of time in dhtml
 
I wrote my own macro in rust for a custom markup language that was a marriage between xml and rust, and it was beautiful
 
6:14 PM
just had cfml, html, xml, and flex
 
actually I may have been taught xhtml at one point
 
@ndugger That sounds awful
 
flex, the xml -> flash "programming language"
 
nah, bruh, it was great
I'll see if I can dig up an example
 
I always joke that rustlang is the incel of programming languages
 
6:15 PM
I wrote a script to turn JSON strings describing the dom into html
that was fun
and completely pointless.
but fun
 
I still want to learn it though, but I'm afraid of what it will do to my mind
 
jquery does that
 
.
oof
    wml! {
        <FlexBox { direction: "vertical", justify: "center" }>
            <TabController { active: 0 }>
                <Tab { icon: "home", label: "Home" };>

                if { about_us_enabled } {
                    <Tab { icon: "about_us", label: "About Us" };>
                }

            <;TabController>
            <List { title: "Title Here" }>

                for { i in 0..10 } {
                    <ListItem { x: 0 };>
                }

            <;List>
        <;FlexBox>
I think the syntax was unfinished
 
[
    {
        "tagName": "div",
        "className": "foo",
        "id": "bar",
        "childNodes": [
            {
                "textContent": "Hello "
            },
            {
                "tagName": "span",
                "style": {
                    "font-weight": "bold"
                },
                "textContent": "World!"
            }
        ]
    }
]
 
so don't judge the if and for
yeah, I made one like that too, bob. That was one of my first js libraries
 
6:16 PM
pretty sure Dugger did something similar to this a couple years later too
 
this is an ungodly abomination
the XML I mean
it's unnatural
 
lol
It's beautiful
 
> 01d400c on 1 Apr 2012
damn
2012
the code is pretty abysmal
 
json.forEach
 
6:18 PM
:D
yea you have to wrap it in an array
 
If we have a contest on who has the worst code in their github, I think I'd win
 
please
I have php code in my github
 
bruh
one sec
trust me
 
all i have on my github, and it's just a fork
 
6:20 PM
it's bad
 
with a few fixes
i deleted all the jquery shit
 
that commit message
 
// Notes: This file is long and messy, because it does a lot.
 
> Update advancedorefinder
 
6:21 PM
function fragmentText(text, maxWidth) {
    var words = text.split(' '),
        lines = [],
        line = "";
    if (ctx.measureText(text).width < maxWidth) {
        return [text];
    }
    while (words.length > 0) {
        while (ctx.measureText(words[0]).width >= maxWidth) {
            var tmp = words[0];
            words[0] = tmp.slice(0, -1);
            if (words.length > 1) {
                words[1] = tmp.slice(-1) + words[1];
            } else {
                words.push(tmp.slice(-1));
 
Can you help me with a tutorial to a POST request? Using node js. I try to post some data to Firestore but I keep getting req.body is undefined :(
 
that took me hours to figure out
then I see now people on SO with like 5 line solutions that work better
 
I have an array of a couple hundred thousand objects, one of the properties of which is an integer. I also have an array of a thousand or so integers. What is the fastest way to return the subset of the object array, filtering to make sure that property is in the int array?
 
I'm trying to find this awful JS framework I came across that created this weird YML HTML amalgamation
 
@grrigore do you have a body parser?
 
6:22 PM
I do :(
 
@forresthopkinsa vue.js? runs away
 
Do I have to add something extra to the .post method?
 
not usually
 
router.post('/add_d_account/:username', (req, res) => {
    db.collection(donorAccountsCollection).doc(req.params.username).set(req.body)
        .then(function () {
            console.log('Create new donor account')
        });
    res.send('Create new donor account');
});
 
What's wrong with vue?
 
6:23 PM
$('<div>', {class: 'foo'})
 
this is my function
and I'm using postman to test it
 
and where do you set the body parser?
 
in the app.js file
 
show me
 
@FélixGagnon-Grenier yikes
 
6:24 PM
const express = require('express');
const bodyParser = require('body-parser');

//Load rutes
const users = require('./routes/users');

const app = express();

//Body parser
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

//Use Routes
app.use('/users', users);

const hostname = '127.0.0.1';
const port = 3000;

app.listen(port, hostname, () => {
    console.log(`Server running at http://${hostname}:${port}/`);
});
 
i miss computercraft, was such a simple mod
 
@Hypersapien er I actually like vue (from a distance, I haven't actually used it a lot) it was some kind of joke, you see
 
now days opencomputers is the one people use, and it's so much more complicated
 
and the post is being sent with application/json?
 
What do you mean? The header?
 
6:25 PM
Ah
 
@grrigore yes, set the content type
or are you trying to get :username?
 
Ok, I'll try that, it's text/html; charset=utf-8 right now
 
ohh nvm
 
No, I'm trying to write some data to firestore
 
I see you use that elsewhere. so you do know it's a param
just trying to cover common mistakes
 
6:26 PM
Yes, I need that as a param I think, because I'm using it at .doc()
 
@KevinB I haven't used that
ComputerCraft is still a thing
 
Hey folks, did you ever produce code so faulty it crashed with "cannot read property undefined of undefined"?
 
!!> undefined[undefined]
 
@rlemon "TypeError: undefined has no properties"
 
stupid FF
> Uncaught TypeError: Cannot read property 'undefined' of undefined
@baldrs it's impressive if you got that without actually using undefined for a computed property
 
6:30 PM
so this is my question
here is the code
var a = {
    "data": [{
        "id": 1,
        "street": "streetnumber1",
        "address": "streetaddress1",
        "zipcode": "zipcode1"
    },{
        "id": 2,
        "street": "streetnumber2",
        "address": "streetaddress2",
        "zipcode": "zipcode2"
    }]
};


for (b in a.data) {
    // console.log('a= ', a.data);
    b = a.data[b];
    console.log('b= ', b);
}
2 questions about b = in the for loop
why does b = a.data[b] need to be [b] and can't be a.data.b
 
@rlemon I tried that but now I get like a null value of req.body
 
because then it would look for .b and not the string contained in b
 
what exactly b = a.data[b] doing
 
i thought computercraft stopped being maintained
so it's only available in old stuff
 
const a = { b: 1, c: 3 };
const b = 'c';
console.log( a.b ); // 1
console.log( a[b] ); // 3
bracket notation evaluates the variable
 
6:33 PM
My req.body is empty :(
I'm using postman and I set the body but it seems it doesn't get the values
 
Sam
@rlemon that earlier tutorial was helpful
 
so this is an evalution of an array?
a[b] is a where the c value is listed
 
no. it evaluates b
 
I never did find that framework I was looking for
 
I did it
Hurray
 
6:38 PM
so a.b is looking for "property named b on variable a" a[b] is looking for "property named whatever the value of the variable b is, on variable a"
 
Thanks, @rlemon
 
What's weird is I know I participated in the discussion thread below the article and yet I can't find any trace of it in my email
 
@rlemon yes with is "c"
hence c: 3
 
yes, sorry, your wording confused me
but you get it now?
 
wait no I found it
anyone heard of Imba?
 
6:40 PM
Ruby inspired React?
 
looks like it
 
is def used in ruby and python?
ruby is just hipster python
 
I think it looks awful
 
Ruby is just hipster Python, change my mind
 
the fuck?
the fact that there's no closing tags fucks my brain
ew
 
6:42 PM
HTML5 doesn't require closing on a lot of tags
 
I think I ran into an npm package using it and posted it in here a month back like "wtf is this?"
 
syntactically-significant whitespace... in the jsx
 
XHTML does... that's why JSX is actually more like XHTML
 
important whitespace is a sin against high iq society and it needs to die
 
well... at least in that aspect
 
6:43 PM
python is not only hideous to look at, but it's slow as fuck
it serves no other purpose than to be bad
 
@ndugger lol, I love python though
 
Sam
@ndugger :O
 
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>blah</title>
</head>
<body>
<p>I'm the content
@ndugger this is completely valid HTML5
 
doesn't change that Ruby is just hipster Python
 
no 'browser fixes'. thats valid markup
 
6:43 PM
and it isn't as slow as what you might think
 
so @rlemon so all this is doing is setting a number to where in the array it is listing that information for the object
 
It's pretty easy to infer the ending of a document, though
 
it's only slow when it doesn't matter
 
that's not that surprising
 
it's simply json object array extraction
 
6:44 PM
@DavidKamer yes it is
python only becomes not-slow when it uses C libraries, which in that case is C and not slow shitty python
 
@ndugger paragraph and a few others now don't need closing and base it off the following content
 
@ndugger you have to use the right libraries if speed is an issue
 
again, the "right libraries" aren't even python
 
is that a good way to understand that
 
oh, yeah but those external libraries are used through python and I'd rather use python than c to bring a bunch of libraries together
if you want fast python like syntax, try julia
 
6:46 PM
nobody should want python-like syntax
 
would you say that it is confusing to use b as the variable in the loop. to me that is confusing
for (b in a.data) {
    console.log('b= ' + b);
    console.log('a= ' + a.data);
    b = a.data[b];
    console.log('b= ', b);
}
 
Lol. Someone on Reddit was asking why there was no "rails" for js
@ChristianMatthew yes it is. And it would fail a code review
And b leaks
 
should it be something like listofB = a.data[b];
or what is best practice
 
here is the article
 
because making things less accessible to most coders is job security
@ndugger I hear a lot of shit talk about python and nothing proving that ruby isn't just hipster python
 
6:49 PM
I guess that settles it then
 
lol, and rustlang.... no one should hate themselves enough to want to type that.
 
significant whitespace is cancer on any language
you're splitting grey hairs
no one wins
 
true
I'm not a fan of significant whitespace, but I do enjoy writing small apps in python
 
@rlemon do you have docoumentatino about that or best practice info... because so much code i read has this all through it and it is always confusing as hello to read
 
no, that's a weird bit of code that looks like it was trying to be 'clever'
other than 'dont be clever' I have no documentation to tell you why it was bad :/
@DavidKamer I don't mind python myself. I use it from time to time for arduino and rpi stuff.
has a better GPIO lib than the node libs
but I really get annoyed by significant whitespace.
 
6:52 PM
yeah, saves time and is a good scripting language. I don't think JavaScript, the way we use it now, is really a scripting language in the way I think of one
 
what? sure it is
 
@DavidKamer you can call ruby whatever you want; it's bad too
 
@forresthopkinsa how do you define a scripting language?
 
by all definitions JS is a scripting language.
 
rust's syntax is actually pretty good once you get used to it. I went to it after C++, so it felt pretty normal
 
6:53 PM
ehh a lightweight interpreted language that you can use for automation
 
probably, but I don't/wouldn't use it in a way that I would literally every other scripting language
 
js being interpreted depends entirely on the engine
 
@rlemon If only there was a language where you could choose between whitespace and symbols ;)
 
that's fine.
 
you don't need a public static void main(String[] args) {...} in JS
 
6:54 PM
@ndugger That depends entirely on how you're defining interpreted
 
forced-oop is really bad. It's one of my biggest gripes with java and c#
 
I really don't have a problem with it
 
I love oop
 
It just means you don't use those languages for small-scale stuff
 
I'd argue every programmer should know: JavaScript, some scripting language, a back-end language, and a system's programming language
 
6:55 PM
every programmer should know how to fucking google. past that, it's pretty much salary based :D
 
I love OOP too, but I don't need you to force me to use it. There are many instances within a single project where multiple patterns and paradigms work really well together
But in java, you end up with just a bunch of static classes simply because you can't have standalone functions
 
I haven't really faced that problem
I feel like most Java projects I've worked with have had pretty reasonable organization
 
I see it all the time
 
the only Java I have to care about is the shitty variants they use in PLCs
 
That's not to say that you don't have static util classes, just that I don't think they're redundant
 
6:57 PM
@rlemon lol i guess so but it's purpose is a good one in general... it lists out f an array of objects individually parsed objects. are you referring to the method of the function in general or the sytatic "cleverness"
 
while I have this soapbox, let me just add that DI is 0/10
 
I appreciate that you have to explicitly draw a line there
 
Java: only 5 dollars a seat now
 
@ChristianMatthew I mean the way the code was written. less code !== better code. clever code is often hard to read and maintain. we're only having this discussion because someone decided to save a local variable (which is basically free)
 
@ndugger Static classes mean something else.
You're thinking static methods
 
6:59 PM
yes
I just said static class, because all the methods on it are static, but yeah
 
I think it's mutually understood lol
 
@ndugger I've made that mistake too. But static class is actually its own concept
 

« first day (3084 days earlier)      last day (1874 days later) »