« first day (2721 days earlier)      last day (2219 days later) » 

2:00 PM
Have you eliminated the possibility that it's ignoring the axis completely, like somehow just always using the Z axis
 
Yea
Or not
I gotta be fucking up aomewhere
 
I'm gonna be fucking up this weekend also
xD
 
Oh my god I have tomorrow off
 
I have tomorrow and monday
I'm going to paris actually
 
Everyone in the office took monday off ._. I think I might be alone on monday
 
2:08 PM
in catalonia, friday and monday is festive
in madrid, today and tomorrow
 
@KendallFrey fixed
 
splain
 
as I thought
translateOnAxis was expecting an axis in object space
not world space
so this worked
 
that makes no sense
 
const forward = this.camera.worldToLocal(this.cameraTarget.position).normalize();
 
2:10 PM
directions shouldn't be "in space"
or you mean relative to the camera's orientation?
 
@KendallFrey I actually found it in the docs.
yea apparently
object space as in object reference frame
 
is that not just (0, 0, 1)?
 
so rotation would influence
and hence my camera is always rotating to look at the target
 
or is the camera not pointing at the target
 
changing its position changes its rotation
 
2:11 PM
wut
 
hopefully that will fix my arcball fuckery as well
 
@Cereal we only get Friday
 
@KamilSolecki please enlighten me, why is this.camera.worldToLocal(this.cameraTarget.position) not just the Z axis
 
@MadaraUchiha holy shit
 
it is the z axis, from the camera's reference frame
but there is no 3Dobject.forward in THREE.js
 
2:17 PM
@KamilSolecki so then why no just use (0, 0, 1) as the axis?
 
oh welp yeah now that I solved I can actually do that
:D
 
might be helpful
 
@KendallFrey see, this is why I need you in my life. You simplify things.
 
is that a proposal
 
maybe?
 
2:23 PM
das some sexy atlas v
 
@rlemon the ending lol
 
:)
well, this is new
 
I'm trying to start using async/await in my code. I have to admit it removes a lot of overhead from writing
I wrote something, but it just looks ugly
const checkBlockIntegrity = async (blockHash) => {
  if (!await checkBlockHash(blockHash)) {
    return false;
  }
 
what's the point of the arrow function there?
async function checkBlockIntegrity(blockHash) {

}
so much prettier
 
the if(!await something()) { ... } ... just looks sad
 
2:28 PM
Named function is different from fat-arrow
 
@OliverSalzburg I'm aware
 
which is why I asked. I see no reason for the arrow there.. but I don't see a lot of code.
 
I can extract that await into a constant above, and check for not that constant
 
@OliverSalzburg there's no use of this in the function so a lexical bind is redundant
 
2:29 PM
@towc that would be better.
 
Whatever!
 
@rlemon I started writing with promises in mind, that's probably the only reason
 
I only care for that block of hash
 
@towc why would promises change that tho?
 
I'd check it's integrity, if you know what I mean
 
2:30 PM
I think you'd compromise it
 
also, I think I don't want people to think it has anything to do with this
which it otherwise might
 
when I first started using arrow functions I used them everywhere, like destructuring.
 
but I came up with this after using the arrow functions
 
you come to terms with the over use eventually.
it doesn't make sense in every situation
 
towc, is that checblockash also a function returning a promise ?
 
2:30 PM
@KarelG it is now
 
@KarelG it's another async
 
then your named function there does not make any sense
 
@rlemon he prefers arrow functions anywhere instead of regular ones
 
@KamilSolecki yes and I'm trying to explain why I think that's wrong.
:P
 
more code for reference:
const fs = require('fs');
const { promisify } = require('util');
const hash = require('./hash');

const { dbs: dbsPath } = require('./paths');

const readFilePromise = promisify(fs.readFile);
const getDBFileContentsFromName = async name => readFilePromise(`${dbsPath}/${name}`, 'utf-8');

const getNodeContentsFromName = async name => getDBFileContentsFromName(`${name}.json`);

const getOriginHashFromFile = async () => getDBFileContentsFromName('origin-hash.txt');
const getLastHashFromFile = async () => getDBFileContentsFromName('last-hash.txt');
 
2:31 PM
I like my function keyword much more as well :D
 
omg
 
unless there is a reason to use arrows
 
eww
 
can I bin that?
 
@KamilSolecki bingo
 
2:32 PM
I'm open to code review
 
yes please
 
I get emails from another department, because I ended up on their mailing list somehow. Someone just got hired, and there was a welcome email.

One of the older management replied with "WOOT!"
 
@ssube because the code sucks, or because it's too big? or both
 
@towc you know better for large blocks. gist it
 
What year is it
 
2:32 PM
@towc because the way you abuse arrow functions should be a war crime
 
gist gud
 
@towc why would the async version of a function be named anything other than the sync version + Async?
 
nailed it
 
I forgot the word .. you know that means following a blog or something .. you do what it tells to.. halp?
 
@SterlingArcher congrats
 
2:33 PM
@cswl feeds?
 
@cswl RSS feed?
 
@cswl a sect?
 
instructions?
 
no i mean following the code in a blog post.. :|
 
direction?
tutorial
 
2:33 PM
you do what it says there
 
subscribe?
 
copy paste?
 
umm not quite :|
 
follow instructions?
 
@rlemon Y'know, it wouldn't need to be gisted if you could a) re-collapse the block afte rexpanding b) had a smaller preview in the first place and c) had syntax highlighting
 
2:33 PM
pretty sure you're describing a tutorial.
 
Does SO ever update chat?
 
@Cereal they dont give a single one
but they actually do sometimes
 
@Cereal few and far between
but yes.
 
mobile chat was... semi-recent
 
2:34 PM
Lame. Hopefully ikari's thing pans out
 
recently easy kicks on mobile were added
 
But rare
 
they fixed the scrolling issue
 
which makes me happy
 
@Neil I think the names would be too long. Thoughts?
 
2:34 PM
Uhh.. what do you google when you dont know what to google.. :|
 
Still can't upload pictures from mobile UI though
 
JS ain't java or C#
 
What's the best option for generating graphical charts on the web? Like bar and pie charts?
 
@cswl Come to chat and as vague questions
 
const getOriginHashFromFile = async () => getDBFileContentsFromName('origin-hash.txt');
 
2:34 PM
@cswl keywords, descriptions?
 
Also, I really want a upload button on mobile chat
 
@SterlingArcher imgur my bro
 
@towc Start with shorter names ?
 
what is the intent of this @towc ?
 
@KamilSolecki too much work
 
2:35 PM
opening up the desktop version to upload just a photo is dumb
 
if getDBFileContentsFromName already returns a promise, you've wrapped it again for no reason. you don't await anything
 
well, it gets the origin hash from the file that's the db file contents from name of the origin hash name db file contents
 
@Ikari link to your github?
 
async without try.. somebody doesnt give a fuck about error handling..
 
2:35 PM
 
Don't need error handling if it shouldn't error!
 
It's like charades
 
@towc I see a lot of redundancy in your code.
 
Crashing is expected behaviour!
 
like you just tossed async and arrows at everything
 
2:36 PM
@rlemon origin-hash.txt might easily change to another name in the future. That was my rationale. But I can use a config file instead, sure
 
sure.
so foo = () => bar('text');
 
I really wish there would be a better way to handle errors with async than try catch
 
you do not have to use those busswords to make your code "awesome". You cannot do that in a professional environment.
 
why are you marking it async ?
 
@rlemon trying to modularize as much as possible, mostly to see how the code would look like at the end
 
2:36 PM
Like retuning an Optional...
 
towc stop
 
HAMMERTIME!
 
@towc what?
 
making everything a function isn't modularizing
 
^
 
2:37 PM
marking everything async is just pointless.
 
@rlemon that's a good point
 
you're passing around promises already
 
wrapping promises in other promises is just backwards
 
@towc This gist has made me realize I hate functions defined with arrows
 
I also disagree that your use of arrow functions and redundant wrappers is helping make the code more modular.
 
2:38 PM
Don't make promises you can't keep, man
 
a friend told me about writing code with the intention of minimizing the time between reading and understanding. Wrapping everything into (testable) functions instead of using a lot of comments seems like a good way to do that
 
Also the word I was looking for just clicked...
And it's.....
walkthrough ..
 
Also if you give your gist an extension, it'll syntax highlight
 
@cswl walk-through and tutorial are synonyms
 
@towc that is the absolute opposite of what they said
 
2:38 PM
@towc I find that the "function" keyword minimizes time between reading and understanding
 
towc, it happens that I come up with a dirty code. but there are lines on that. You are way out of control. There is no point in what you are doing. That "trying to modularize as much possible" is a weak excuse. That only works if you want to work pure functionally. Javascript is not the place for that. Use Elm instead.
 
I skimmed right past all the one liners at the top because i thought they were variables
 
@towc meh, that's increasing complexity, not reducing it imho
 
@ssube well, the wrapping is my approach
 
don't try to blame it on your friend, then
 
2:39 PM
Well.. I was specifically looking for that word .. :|
 
like Karel said, you decided to come up with this and apply to to every single statement
 
@ssube I really hope he leaves here and takes our advice to argue with his irl friends. like he does here with their advice.
 
@ssube do you have a better approach?
 
let originHash;
const setOriginHashFromFile = async () => {
  originHash = await getOriginHashFromFile();
};
setOriginHashFromFile();
What does this.. do?
 
all you're telling me is that "it's bad". But why?
 
2:40 PM
@rlemon you mean intentionally misinterprets it and misrepresents us to them?
 
@towc no we listed quite a few reasons
 
Oh you're defining the function then immediately calling it
 
@towc because you've unnecessarily wrapped functions
 
or rather, how to do it better?
 
you've split logical units into multiple single-statement functions
 
2:41 PM
A function should never mutate the outside state.. :O
 
and you don't understand async
 
@towc do not wrap a gift box (promise) within another gift box (async func)
 
create a single constant loaded from a configuration indicating the name of the file
 
@KarelG unless you want russian nesting promises
 
@Cereal it will be exported later, so it can be part of an api, when the user modifies that file
 
2:41 PM
@towc get out of the mindset that tossing arrows at everything is a good idea
 
export the getDBContentsFromFile function
 
the origin-hash file, that is
 
that's it
 
@Neil that's the one function I thought I shouldn't export
 
I used to be a JS programmer, then I opened @towc's code and took and arrow to the knee.
2
 
2:42 PM
lol
 
If the module does more, then no.. but that seems to be all it's doing at the moment
 
you want a code review? take up farming
 
+1 for that skyrim ref
 
with just different function names
 
@ssube get off my lawn
 
2:42 PM
If you want a code reivew, don't argue with the review lol
 
hippity hoppity get off my property
 
*take up something other than corn farming
 
You should be asking for help because you recognize you need it, not for a defense
 
@Cereal I'm asking for how to do it better
so ok, I'll wrap things less
 
@towc it's not the end of the world tho. I think most of us when we found new features of the language abused them at first.
 
2:43 PM
nothing wrong with asking questions
 
I'll make sure I only use async when I should (I consider that a bug in my code, not a styling error)
anything else?
 
if he were in agreement with the changes, he'd already be doing them
 
I know I used arrow functions everywhere, and destructured what shouldn't have been destructured.
it's part of the 'discovery' phase
 
@Neil I don't completely understand them
 
I don't know how to javascript, but I feel like all of that nonsense can be cleared up wth a class
 
2:43 PM
@towc And you're asking, again, nothing wrong with this
 
That would give you clearly defined functions, a way to export, a way to initialize
 
@Cereal -1. Not enough jQuery.
 
user1596138
I asked this Amazon seller if they can just ship me a new cover (glass was shattered on arrival) and they responded with
 
user1596138
> resend the new one for you
 
user1596138
2:44 PM
But they don't have my info lmao
 
these new boilerplates are pretty nice tbh
better than the shit I got on codesandbox.io
@user1596138 pretty sure they have access to that from the first shipment
 
Nothing happens when I click the checkbox
 
user1596138
@rlemon I was only able to message them genericly so they don't even know which order I am I assume
 
user1596138
Either way I'm not sure if they're just shipping one now or what haha
 
2:46 PM
did you send the message from within amazon?
@cswl oh, lol. I didn't actually run it. just the examples themselves. codesandbox.io example apps are a mess imo
 
user1596138
Yea
 
user1596138
I just went to the seller page and sent a message tho. Nothing connected to my order.
 
@user1596138 I wouldn't be surprised if amazon attached your profile to that to try to cut out a middleman
 
in PHP, 49 mins ago, by Wes
https://twitter.com/angealbertini/status/979254093846859777 .
 
I still havent chosen a web framework to learn.. :|
 
user1596138
2:47 PM
Oh well I jus thought the message was well worded and thoroughly explained the resolve
 
user1596138
It came in a box that's like 1' by 8" but the item is the size of a quarter so I felt funny about dropping off the return haha
 
hmm that YT link. again that miner one advertisement. Because I did some research on block chain, google keeps spamming me with advertisement from minerone.io
gotcha search some duck pics
 
user1596138
@KarelG I googled minerone now I'll be getting ads too
 
user1596138
On top of me looking at GPU prices weekly. I get a lot of crypto ads
 
2:50 PM
@KendallFrey whoopsie fucksie thats a vewwy long train oho :p
 
i love bobs
 
I do too, Kendall. I do too.
 
I feel so loved
 
A discussion-y question guys
 
until another bob shows up, you get all the love
 
2:52 PM
We're making a new authentication system/scheme for a new project
 
@MadaraUchiha yes, you should get the pink one.
 
Our current implemention is... less than optimal, and we don't want to reuse it.
 
disclaimer: idk anything about await/async (so I left it out), or wtf require() is, but this does the same thing and is much more readable: @towc gist.github.com/HorizonShadow/812d94a1226f9ac8639b150b45cfec64
 
We're considering using JWT
As opposed to regular session cookies
The big advantage is that this enables the server to be completely stateless
There are a few downsides we'd like to resolve before we go through with it though
 
it can and that can be an advantage
that's not always a deciding factor, though
 
2:53 PM
@Cereal cept the one where you return from a promise.
which is where async/await would come into play
 
1. Migration: I need to be able to somehow accept old tokens and migrate them to a new one
 
@rlemon I figured since he knew await/async he could place them where they eneded to go
 
I could give a relatively short TTL, but then I can't have a "remember me" feature
 
@MadaraUchiha you can either log them all out or you can issue a new token when the log in
 
2:54 PM
@Cereal that's a pretty big assumption. you saw his first code.
 
@MadaraUchiha like, race conditions?
 
I have literally no idea what they are at all, so I didn't know what to do with them
 
however, if my company's efforts to move from custom auth to JWT are anything to go by, that takes a while
 
@Cereal they're promises.
but prettier
 
we've been forcing people to JWTs for almost a year and there are still a few thousand tokens used by people who never log out
 
2:55 PM
think promises but with flowers all over them
 
@tereško No, like let's say I changed the token's structure, instead of email: 'whatever' I now have username: 'whatever' because we no longer use emails as the identity claims
 
So instead of mahPromise.then(..), you'd do await mahPromise()?
and define mahPromise as async?
 
Now my server has to know to accept an email token, and migrate it to a username token
 
Too confusing for me, I'll learn it in a couple of years
 
@Cereal TS makes it more obvious what's going on. async functions always return a Promise of some sort
 
2:56 PM
@ssube Logging all of our users out every time this happens likely can't happen.
 
function foo() {
	return new Promise(resolve => setTimeout(resolve, 1000));
}

async function bar() { // async keyword makes the function bar return a promise, also allows you to await inside of it.
	foo().then(val => console.log(val));
	// is the same as
	const val = await foo();
	console.log(val);
	return 123;
}

bar().then(val => console.log(val)) // 123
 
@Cereal if something returns a promise, you can await it inside an async function. that way, it will literally await for it to resolve
or reject
 
Which leaves me with the second option, which means that my server now holds the knowledge of how to migrate any past token to the current one
 
@MadaraUchiha right, it wasn't an option for us either (tablets set up as "terminals" that are used to clock in)
 
@Cereal I always find an example helps with the understanding
 
2:57 PM
Ooooh. That's not how I thought it worked at all
 
@MadaraUchiha your server should know how to do that with most models it accepts from users, imo
 
So you can't use await outside of an async .. scope?
 
nope
 
once a token has been decrypted, it's just another (small, per-user) data model
 
2:58 PM
19
Q: Using await outside of an async function

Sterling ArcherI was attempting to chain two async functions together, because the first had a conditional return parameter that caused the second to either run, or exit the module. However, I've found odd behavior I can't find in the specs. async function isInLobby() { //promise.all([chained methods here]...

 
@ssube That means that I have to have tombstones in my code
Rarely used models that I have to maintain on the offshoot that someone with that structure comes along
 
@tereško hi
 
@MadaraUchiha how often do you do breaking migrations like that?
 
@ssube No idea, the product is finicky and full of changes.
 
you don't need a different model for an optional field, just the big changes
 
2:59 PM
@Linkgoron how often do you see this happening?
 
it's sort of a "you'll need it often if you want to need it often" situation
 
who the heck is linkgoron
 
but you probably shouldn't try to do major breaking migrations often
 
@SterlingArcher My team leader boss
 
@SterlingArcher coworker I assume
 
2:59 PM
So you have to use .then() in the main thread then
 
@SterlingArcher a horrible accident from zelda
 
or, that.
 
@SterlingArcher dirty hack: wrapper with callback
 

« first day (2721 days earlier)      last day (2219 days later) »