« first day (3413 days earlier)      last day (1752 days later) » 
02:00 - 14:0014:00 - 23:00

02:32
am I the only one who thinks unit tests are way, way more useful than javadocs or similar documentation? So much that it eclipses the javadocs?
They serve completely different purposes
Yet I find the purpose of documentation better fulfilled by unit tests.
 
1 hour later…
03:52
@paul23 ^^
i'd disagree unit testing serves betters than docs
04:11
Hello
04:31
🚽
05:11
hello
@Todd 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.
I don't think I'd enjoy inheriting another developer's code who relied on unit tests to document it
it might be an interesting idea though, to have some sort of comment interpreter that can run comments as test cases.. and a scripting language that is intuitive and reads like code documentation.. then the test code could sit within the project code
 
2 hours later…
07:07
Hi All
i have three files like in below structure
admin.ts -- typescript file

const Users =  require('myPath/users.model.js');

user.ts -- typescript file

const Users =  require('myPath/users.model.js');

user.model.ts -- model file
const mongoose = require('mongoose')
var autoincrement = require('simple-mongoose-autoincrement')
const Users = mongoose.Schema({
			// my schema structure here
})

module.exports = mongoose.model('Users', Users)
but i get the below exception in admin.ts on the below line
const Users =  require('myPath/users.model.js');
Cannot redeclare block-scoped variable 'Users'.
but when i try to add the export{} tag at the top of admin.ts and user.ts then that issue goes.
Im not sure why an export again is needed when im already exporting the model file in user.model.ts
i dont find any reference of export{}, as to what its purpose is?
07:23
@SamSam export is a keyword meaning "make this the public entity of this module"
@Neil but why is that needed, as for the model class i already have an module.exports added, and the variables declared in admin.ts is within the scope of admin.ts
it's literally the first thing I found on google
just another way of declaring export
has more options than simply assigning module.exports
I think that was the old way it was done
ok, but still what im not clear about is the scope of a variable which is kinda local to a file.
im following the below thread, which is exactly my issue is
https://github.com/Microsoft/TypeScript/issues/18232
@SamSam that means you have no exports
@SamSam what you assign from an import is the export inside the module
in admin.ts i dont have any export, but to fix this issue i added export {} at the top of my file
07:31
that's still not exporting anything
hopefully you can see why
the concept of a module is that it gets called on like a library to do something.. it isn't supposed to be simply run and that's it
so what do you call on? the exports..
you its mandatory that i have at least one export in my file?
yes, and if you're adding one just to satisfy that requirement, you don't really understand the point of modules..
@Neil this is exactly how my admin.ts looks like
export {};
const Users = require('../../routes/models/users.model.js');

exports.firstFunction = (req: any, res: any){ // my logic }
exports.secondFunction = (req: any, res: any){ // my logic }
exports.thirdFunction = (req: any, res: any){ // my logic }
firstFunction, secondFunction these are just sample code.
you don't need export {}; at the top
I don't know what happens when you take an old way of doing exports and combine it with the new..
@Neil thats what, if i remove that i get the exception redeclare block scope variable issue
07:37
so try rearranging it to work with the new export..
in admin.ts?
function firstFunction(req: any, res:any) { // your logic }

export {firstFunction};
then i will have to pass an list you mean
export {firstrFunction, secondFunction, ...}
well yeah
though before going through all that trouble, I would just do the one method first
otherwise you waste time for nothing
07:50
Hey guys, anyone knows if FileSystem API can do resumable downloads after the browser is closed
@JoãoAiresdeMatos you meant Download API ?
yes it has
it's a simple .resume() 😃
but it's an extension AFAIK
not 100% sure
just talking from memory ^^
@KarelG .memory.flush();
I thought it was FileSystem API? The one used by MEGA
@KarelG haha, now you have to load everything from disk again!
08:00
hmm ... you're creating a doubt ... * nips from ☕ *
/checks
@Neil ok great, thanks
yup, it's from an extension
But can I do it?
yes. But you need to work with byte/octet streams and being able to modify the serverside code
@BenjaminGruenbaum is the right person for your question but I did not have seen him for a while.
the server has to track your download process
just be glad you don't have to work with ocelot streams
those things bite and not byte
08:11
nice xD
So, the filesystem api or any other api that is used by MEGA can't do out of the box resume?
ftp can resume downloads, I know that much
it's because the protocol supports it
I think http doesn't directly support it.. if you tell the server to start at position n, then you can download content from that position onwards and then you combine it yourself with the existing file
though maybe there is support for it, I don't know
 
1 hour later…
09:29
hmm the new github notification view is ... need to adapt it
I'm surprised they'd release something shoddy like that
> Clear out the clutter.
yeah ... on big screen like my current one is
whoosh
Obligatory 4:30am economic simulation, run in Javascript.
 
1 hour later…
10:54
Good morning
11:30
hi o/

i have a quick question which way is the best way to check for a certain property in JSON object ?
var x = {
  'name': 'Lao Lao',
  'title': 'President Office',
  'position': [-87.6297980, 41.8781140],
  'children': [
    { 'name': 'Bo Miao', 'title': 'Administration  Dept.', 'position': [-83.0457540, 42.3314270]},
        { 'name': 'Su Miao', 'title': 'R & D Dept.', 'position': [-81.6943610, 41.4993200]},
        { 'name': 'Yu Jie', 'title': 'Product Dept.', 'position': [-71.0588800, 42.3600820]},
        { 'name': 'Yu Li', 'title': 'Legal Dept.', 'position': [-74.0059410, 40.7127840]},
        { 'name': 'Hong Miao', 'title': 'Finance Dept.', 'position': [-80.8431270, 35.2270870]},
how check for example if "Su Miao" has children ?
Any oracledb users here? Is the service name analogus to a database, as in, postgresql?
@diamond Ask them
@diamond There are many ways...I usually do something like obj.children && obj.children.length
cool @deostroll thanks alot
@BenFortune sure i know its kinda dum but i've been on and off JS lately and it's always better to know if there is any newer method out there that i'm not aware of.
i was gonna do hasOwnProperty('children')
@diamond that only verifies that there exists a "children" value
that doesn't tell you if the value for "children" is an empty array
11:46
@Neil yeah its a boolean , better to use deostroll's method and check for undefined
either undefined or that length is present
so
function hasKids(person) {
  return foo.children && foo.children.length
}
@diamond well the emphasis was children.length..
doing obj.children or hasOwnProperty('children') amount to the same thing really
12:10
@KarelG thanks for clearing that out

@Neil , obj.children.length --> Cannot read property 'length' of undefined

obj.children --> object or undefined
hasOwnProperty('children') -- > true or false
obj.children would be the best for me :)
I just gave you a function you can use ...
@KarelG yeah i took it !
thanks a lot :) :)
i usually clear things out in chat as well because it might help someone else as well, who knows.
Morning rando calrissians of javascript... Yet another day in a far far away place... called... Commit Self No Breath Highschool, or CSNBHS
Hi Taylor
hi .u.
sigh I left my phone at home again, cant login to github, codepen, nothing
and yahoo is blocked
Im not only unable to install programs, but now I cant even code..
Big Sad Face
12:18
Done that a few times. Usually go home at lunchtime and get it
Sadly cant leave school
only get like a 30 min lunch
I live like 20 mins away lol
It'd take me that long to go home and return; no time for lunch
:P I dont have a care
These things teach us patience
car*
ffs
12:20
Oh, of course
Im planning to start the driver's ed thing next year
Hopefully
You'll get one soon enough
and my dad is also letting me drive his car
and his jeep.. like his WW2 Jeep
its a stick shift.. so difficult to drive
but he said that if I can master the jeep, the car part will be easy peasy
with the "auto" drive and such
Actually, if you learn stick, you'll have a skill most folks don't have. Plus it gets more power/gas mileage (correction: supposedly!)
Laughs in European
12:22
Its actually really fun
he built the jeep from just a WW2 Jeep Frame they found on the side of the road many many years ago
and hes probably spent upwards of 40k on it
Its like.. REALLY fun to drive, I cant go on the open road yet, obviously, but I can drive around our neighborhood... Kinda..
@BenFortune Europeans still got stick shifts? Or do they not have any..
I dont get the context
the majority of european cars are still by stick yes
Ok, that makes more sense
I think he may have laughed that folks in U.S. drive auto
Yes
however, automated ones becomes a trend. Many new models have it and people gets it
yet they still crash into deer every 5 minutes
12:25
IMO I rather prefer stick
Yeah, probably 95% of people here learn to drive manual
if you can drive then you cannot drive. The automated one lowers the level of difficulty, allowing more incapable people to go on roads
You should see the amount of car crashes I get in my tiny little town here
90% are teens
Youth think they'll live forever and are impervious
That moment when your so desperate to code, you make a new account in both github and codepen with your little kiddie school email
12:27
It's okay
You have a passion for this stuff
@Alex Until their body gets broken in 5 points while being wrapped around a tree
:P
You can take the license exam with an automated one. But that does not mean you can drive stick. So what my gov did is assigning the same driving license type but with a signage which is a code. That code means "owner is allowed to drive cars of this type but not if it is manual"
Yep, school of hard knocks
Kids here are less then 16, 15 and theyre complaining about money and cars and jobs
Idfk at this point
ALMOST 15
meaning I could technically get "a job"
But honestly, I just wanna learn tons more of JS and C#, then go around pretending to be 40 and get a good remote job
screw cars and walking
Work and money are good, but doing some volunteer work/service to the community is good too. Then it'll be something they'd want to do as adults too.... giving back to the world
12:32
The one thing Im worried about: going out to do physical work and volunteering is difficult, mainly because of my skin and bones
my kneecaps are floating, and the lower joint is malformed a little
Well, not volunteering as in lifting heavy stuff. But helping out in your neighborhood w/ young children, helping them w/ their homework
pretty much very very light pain constantly, I can walk and run, its just a little difficult.

Any kind of "surgery" to fix it permanently is expensive, and if I dont constantly stretch and do those things, the pain gets worse, and straightening my knees gets difficult
Or even picking up trash with other youth
Homework, babysitting, basic chores
yeah I can do those things
And other youth can do that
12:34
All I saying is, the more pressure I put on my body, and the more work I do, the worse any condition im in gets.

So doing work in general seems far fetched to me,

Hence why I have such a fascination with programming
Im sure when Im like 40 or 50, my knees will start to get to the point where Ill need a wheelchair, for now though, I can live with it
Yeah, programming is something sweet. I get a satisfaction when the db + server code + frontend all come together
I get that happy Euphoria when I build a big project, and it all comes together smoothly and works fine
it makes me feel like: "YES! I ACCOMPLISHED SOMETHING!"
Chronic neck pain for the last 18 yrs. Can't sit at meetings too long
Lol oml
Well, I can't stand meetings anyway
12:36
Ive heard Chronic pains like spinal injuries and chronic headaches actually drive people suicidal
You learn to adjust, block it out
My knees, if I really want the pain to leave, all I have to do is bend them and lay down
but a headache... oml yeah thatd drive me crazy
Yeah, same here. If the pain becomes too much, I lie down
Brother has severe headaches daily now. But he's as happy as can be
i know it doesnt sound right, but I kinda hope my condition stays how it is, if it gets worse, I wont be able to walk, if it gets better, Ill have to rework everything in my life.
It's how we respond to these things, I guess
12:38
Yeah..
It's okay. We humans are very adaptable
And our spirit can't be broken even if the body is
It doesnt help that I also have blindness and I'm light-skinned (dont remember the condition name)
lolrip
really nothing worse than being broken of spirit
12:41
No like, apparently my epidemi layer is very thin
the pain is sustainable, if you're optimistic about the future
I get like sunburn in 10 minutes
Hope is the most precious thing of all
Always have hope
Pain is temporary, as a TV Cartoon character once said
I dont even remember which cartoon, I just remember that quote
Whatever we experience is temporary
12:42
To quote the princess bride: "Life is pain, highness. Anyone who says differently is selling something."
Joy/pain. It'll last a day, a week, a month...
It all passes
The only constant: change
Now its just depressing lol
life is temporary and we are ALL empty
Gotta fight the existential crisis
2
Nah, we have joy in our work, family, life
We know these things and still have joy. That's the secret
It helps to also not ask too many questions about what if
they lead to dark places
12:46
Pretty much
Yeah, take life a day at a time
shower thoughts are killer
;3
for a long time, I woke up with this overwhelming sense of dread and how messed up my life is
funny thing is it would pass after the morning
I kind of just came to recognize that feeling
Eh, Ive delved for hours about meanings of life and why im here before.

Honestly its scary but I dont really mind it anymore
I just wanna enjoy it while I can
Some Nightwish to lighten the mood
12:49
Well, back to the programming mood, anyone else here just got a favorable liking for FiraCode
No, ligatures are dumb
LOL
I find it quite nice looking
Monospaced and everything
For Ligatures, it depends on the situation
I like em for JS
This always puts me in a good mood whenever I watch it. Never fails
There is no situation where they are useful or relevant
Might aswell replace them with fucking emojis
Wow, passionate hate against ligatures :3
This should be in a newspaper from 1999
12:54
"Ligatures are the work of the Devil, I tells ya"
Nah, I'm neutral on them
If they help visually, great
I like them ¯\_(ツ)_/¯
not that they're particularly useful, but still
@BenFortune ligatures are fine
Interesting: ツ is a Japanese Katakana unicode character
yeah
The "unicode" emoji thing sorta started in japan
Hence why most of them contain such characters
Is that at all related to the ã…‹ symbol?
they're not that different.. maybe one is used in the absence of the other?
13:09
Youd have to translate it
well it's the symbol used for "kek"
so like lol
.-.
rlly?
hey , i have a question that is probably more css related than js
https://dabeng.github.io/OrgChart.js/color-coded/
// lets say i want make
.orgchart .middle-level .title {
background-color: #006699;
width: 300%;
}
the node kept expanding in one direction only
i've just added width: 300%;
well yeah.. width is one dimension
transform: translate(-30%);
that worked but i dont know if it's the ideal way to do it
13:22
@BenFortune pale?
why set width to 300% and attempt to use another way to make it normal-sized?
@diamond what exactly are you trying to achieve
because it only expands in one direction , not sure why but yea i agree with u that doesnt seem right . dont know how to fix it though
Isnt that scenario XY?
"Expands in one direction" your setting the width to 300%, that means its going to expand 300% of its parent element in one direction
if your trying to move it in two directions, you have to center it
@TaylorS I'm trying to expand it but keep it in the center as its right now
13:36
you set the horizontal margins to auto
then when it increases in width, it stays centered
Or display it as inline block
and set parent text-align: center;
EzPz
@Neil that is what i did but it didnt work
I've added this in the expecting tool
margin-left: auto !important;
margin-right: auto !important;
it didnt work
@TaylorS could u try it with the inpectation tool of chrome , coz it didnt work for me ,
text-align: center !important;
@diamond guessing this is what you mean: https://codepen.io/TemporaryCoder/pen/WNvGeOj

That isnt the way to do it, just visualizing it
yea kinda
u dont need to
just try this link
It looks fine to me
13:44
yes
.orgchart .middle-level .title {
background-color: #006699;
width: 300%;
}
the node kept expanding in one direction only
//i've just added width: 300%;
@diamond Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
i know , try to increase the blue node's width
ok
I did, all the nodes seem to be functioning smooth and clean
like the look of it
im confused what the issue is
Do you mean THIS:
.orgchart .middle-level .title when i changed the width of this css
13:47
no not all of it.
.orgchart .middle-level .title*
only the blue class
.middle-level*
yuup
exactly
it only increases in 1 direction , its not centered anymore.
i'm looking for the best way to solve this
the only thing that kinda worked for me was adding transform: translate(-30%);
then use the translate -30%, seems to work well.
I tried using inline blocks and centering
caused whitespace issues
That transform hack is a one liner, id stick with it
probably the cleanest way to do it
yeah , it doesnt sound like the best way to do it but it would do it for now :)
thanks @TaylorS
13:56
Ultimately, if your going to make it responsive, maybe use screen-size tags.
and get specific measurements for major devices
02:00 - 14:0014:00 - 23:00

« first day (3413 days earlier)      last day (1752 days later) »