« first day (2196 days earlier)      last day (2977 days later) » 

15:00
@tereško is it a get request? If so just leverage http caching.
@BenjaminGruenbaum exactly, therefore - fuck it
cv-pls stackoverflow.com/questions/40157968/… (too broad + using proxies to break other sites)
@ssube I just wanna learn how to do it, I won't use it... — Orad Elharar 47 secs ago
lol
> 'm working on bots for some game
> but I won't use them, promise
15:23
So I'm looking for a way to know if a an element (a menu) can potentially fit into another element on window resize. I do not know the width of the element in question (as in, it's not set by CSS). The solution I can come up with works fine if my first load happens to have the element fitting, because I store the initial width, but it doesn't work so well if the element doesn't fit (say at a reduced window size). So my question, how can I handle this upsizing?
@veksen Welcome to the JavaScript chat! Please review the room 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.
@rlemon I don't see any disclosure at all.
besides that, since when is "use this app" an acceptable answer
Are you sure that's the right link?
15:25
So, I know now IE7 can't make a cross origin XHR from disc, but can it make an old fashioned post request cross origin from disc to server?
@ssube how goes your JSX/React abuse?
@rlemon when "this app" is moment or bluebird or anything except jQuery :P
> use bluebird
would get flagged to high hell
user1596138
componentDidMount() {
  require('../component.css');
}
@Luggage well. I haven't run much yet, but it's creating all the right stuff.
user1596138
15:26
Does anyone actually do this
Since I want to keep the exact API, I'm able to inherit most of the interfaces out of react.
user1596138
You'd have the same styles duplicated every time you load one of those components, right?
You're using your own react-less code? Do you support the lifecycle?
@Jhawins a good module system will only load a module once, so.... no? hopefully
Is this open source or would you be willing to share some of it with me if you can (when/if you are ready)?
15:28
@Luggage yep, my own BlessedComponent that inherits from LifecycleEvents and most everything except Component itself (because render return a ReactElement).
@Luggage the whole project will be OS eventually, I can share that part early for sure.
dammit it's hard to google ie7 specs
ok, cool.
i hate this
it's part of my long-running "I want to make a vidja game" project, so nothing super secret.
IE7.. ouch.
15:29
Yeaup.
anywho, it should be able to do a non-ajax POST to another site, but then the page will laod from that site..
@SterlingArcher no it's not
is CORS stopping you or is IE7 nevr making the ajax request at all to another protocol?
@Luggage the only catch (and not even that big of a deal) is that you have to control the root node's lifecycle on your own. It has a node property that you need to attach to your screen and call willMount and willUnmount, mostly.
I thought so. I can host a server and have it open in this shitty browser implementation.. but I think that cuts off my capabilities to communicate
CORS is stopping me
15:30
Since the screen has to live longer than each component, even if it's the top level view, I wasn't sure of a good way around that.
@Luggage IE7 doesn't do CORS
So the initial lifecycle and rendering, you have to call. Props and events should be handled.
IE7 has a different object that's not an actual XMLHttpRequest.
It's probably better to just use jsonp if using IE7, tons of caveats.
Also, why IE7?
Really? I thought that originated in IE..
"why IE7?" He works for the Government (indirectly).
IE7 and 8 use XDomainRequest or something like that - XDR and not XHR for it.
@Luggage I might remotely understand IE6, but virtually no one uses IE7.
15:32
yea.. i know, but I assume it a reason like that.
I can't imagine it's @SterlingArcher 's first choice.
Just use jsonp and make sure you're not passing secure content - or even better just use the same domain and solve it on the server.
Or even better - don't support IE7 :P
Note: he's running on file:// protocol
Webkit source code -> Emscripten -> 5to3 -> just use chrome in IE7.
oh man that would be slow
also probably impossible.
user1596138
@ssube Well it's not magic, it's not keeping track of that.
user1596138
15:36
It's the standard ES6 modules require
@Luggage wait, what?
There is a very good reason not to be able to do cross domain requests on file://, I'm pretty sure you can't do those in Chrome either that'd be crazy.
@Jhawins which keeps track of that.
You need to run under --disable-web-security or something like that.
Otherwise a website can just read your whole filesystem.
require is magic
Yea, that's Why I mentioned file: since your suggestion might not be valid there.
user1596138
15:37
@ssube Does it? Pretty sure it just adds more and more
user1596138
If I put 5 of them back to back it should only happen once then?
@Jhawins it's up to the CSS loader, which could be breaking it, but require has behavior built in to only include a module once.
require('./someFile');
require('./someFile'); //somefile is executed ONCE in every implementation of require that i've encountered
After that, it will (per the spec) return the same reference.
Obviously that's per-process, but within a process, you're guaranteed to get the same thing back (which is critical for singletons and most IoC/DI type stuff).
then is caches the exports of that file under that filename for future require()s.
15:38
@Luggage challenge: make it require twice without modifying that code (only changes in someFile).
so if you are using something like style-loader, it'll only put it into the DOM once.
@ssube what spec?
@BenjaminGruenbaum node's "spec"
user1596138
Going to try it
@ssube so just the fact node happens to cache modules basically :P
15:39
@BenjaminGruenbaum require explicitly lays out that behavior, so anything replacing it has to be following that, or code will break
challenge accepted.. for a bit.. i do have some work i should do
and webpack definitely isn't stupid enough to break how modules work
@ssube that's hardly the same thing as specification. The module loader spec on the other hand...
you can try and argue which spec it is all you want, but they're all pretty specific and they all agree that you're gonna get the same ref back
@ssube right, it will return the same reference but it's not "per the spec". That's the only point I was making.
15:42
I assume screwing with the require cache is not what you are looking for?
I mean deleting from it or clearing it, specifically
@Luggage I hardly see another way than screwing with how module loading works.
Well, i was looking ofr a way to mangle the filename/path it gets cached as instead of clearing the cache
That would be as inelegant but would also leak on multiple requires :P
ohh, i just realized i used the same 'unique' name twice..
@ssube how would circular dependencies look like if module loading didn't cache?
15:49
ohh, require.cache is almost documented.. well, its presence is
anywho: delete require.cache[__filename]; works
@BenjaminGruenbaum RangeError: Maximum call stack size exceeded
@ssube what stack though if these are imports?
@Luggage that's what I had
@BenjaminGruenbaum the module loader's stack.
I'm pretty sure that was supposed to be a trick question.
@BenjaminGruenbaum lol working with a piece of software that has an internal browser implementation.. that has the standards of IE7
2
I kind of assumed it would be harder so went right for looking for a way of changing module.__filename ...
15:50
No console, no dev tools.. pure hell.
@ssube well, the point is you sort of have to cache
@BenjaminGruenbaum yep.
@SterlingArcher you've got to be shitting me
ahh, good ole webview.
get it.. OLE..
@BenjaminGruenbaum it's possibly the most tedious thing I've done to date
15:52
@SterlingArcher use bluebird, also - is it interesting?
I mean, kinda. I'm dynamically generating targets for sats
@SterlingArcher displaying or generating?
@Loktar looks like that switch thing is mobile and runs skyrim, sort of interesting.
Generating the scenario, and rendering it in said software
15:54
@SterlingArcher cool, not sure why that'd need to run on IE7 :P
because nobody in the history of browser implementation internally has ever said "We should keep up with web standards". 10/10 times it's "lol fuck developers"
System.Windows.Forms.WebBrowser ?
Like how steams embed a browser.. only much much much worse.
@SterlingArcher can't you make a solid argument for upgrading? Did they actually write a browser engine from scratch?
It's a 3rd party software unfortunately.. they've already heard my complaints lol
@BenjaminGruenbaum IE was/is available as a 'control' for other apps.
15:56
I'm not sure if they embedded or wrote it
anyways, i need food
Writing one is a lot more interesting and a lot crazier
@Luggage ah, I remember using that
had to write a tool that installed plugins and loaded up their readme files
@Luggage yeah, like WebKit is today in Android/iOS. I used IE as a control once in WebForms and felt clever for automating stuff.
yea.. same thing. some legacy app with an old IE engine embedded.
IE and Chromium can both be embedded pretty easily.
15:58
Probably seemed like a good idea at the time.
@SterlingArcher does it have to be file:? can you supply your own root url?
If so, you can do a local server, maybe.
or remote, even..
just write it all as an express app and run it from the IE7
0
Q: How do you convert this SASS into LESS?

Bryce SnyderI'm working with a project that is purely LESS based, and I found some Bootstrap 4 code that I really like. I'm trying to convert it over to LESS so I can utilize it, but not familiar eith all the LESS functionality, and can't really find much... This is the code: $spacer: 1rem !default; $sp...

what's a good close reason?
tb?
tb would be the only one that remotely fits it
OT, we don't translate code
16:03
tuberculosis is a reason?
"convert x to y plz"
user1596138
@rlemon lol...
when you're a developer, you can do anything, you can grab em by the prototype
6
And the compiler will accept it.
16:17
@rlemon Revert! Revert! rewind noises
@rlemon reddit.com/r/AskReddit/comments/58g6eu/… this is the 4th time I've seen this damn comment today
After you said it
seems safe
16:41
@SterlingArcher I wish I was original
Shit, didn't even realize we get paid today.
That tear cloth codepen someone posted is super sweet.
Anyone ever play Armadillo Run?
naw, never been down to bama
lemme see the codepen
@JayLane It's on the right, one of the stars/favorites.
ha, that's the same effect from bloodrayne
16:47
@Waxi thanks didn't have it expanded
It gives me hope that some day we might see some good physics based games in the browser.
we have those already
Good ones though?
I've looked obsessively for them and all I found was flash games from a decade ago.
@Waxi Damn, that was so long ago
now I want to play it again
16:52
@KendallFrey Awesome game right? It's like 10 years old now and still one of the best / most fun physics game ever. I would pay for someone to recreate it in a browser. Apparently the author of that game is making a new one, almost a sequel.
It's only worth it if the clone has the same weird physics
like the ball wrapped in cloth
Yeahhh, abusing the mechanics to beat the levels, so pro.
anyone good with node/express?
@JustinHarwood Welcome to the JavaScript chat! Please review the room 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.
most of us
16:58
just submitted this question: stackoverflow.com/questions/40160234/…
any ideas?
it's confusing that refresh doesn't trigger a fresh query
i want new inserts to be displayed instantly upon reload
var result;
var query = connection.query(blog_insert_query, function(err, result)
the parameter named result will hide the variable
@JustinHarwood after you fix that problem, then fix the fact that it's horribly insecure (SQL Injection).
@JustinHarwood that looks like a SQL injection just waiting to happen
ah, I got beat to it
17:05
yeah, i'm just trying to get the basics of mysql/js down
i wouldnt ship this in any capacity
i got rid of result in the .query callback. still the same outcome. no instant update.
should i include my mysql_test router?
does connection.connect have a callback you should be waiting for? I feel like it ought to
wrong: .query(sqlString, callback)
you definitely shouldn't be using a DB driver directly (that's not really what they're for)
the callback is only necessary if you want to recieve results
17:09
but it does look like connect is sync, so that's not the problem
he does... or at least wait for them
what do you mean @ssube? by not using DB driver directly
he means use something like knexjs.org
@JustinHarwood there are libraries like knex that wrap multiple database drivers, so you don't have to lock yourself into (or work with the incorrect syntax of) any one.
it also happens to give you a much cleaner (more standardized) API than just mysql
neat! thanks
17:10
which could actually help here (not just pushing libraries because they exist)
@BenjaminGruenbaum yeah I'm not impressed
I mean it looks ok, but meh idk
@JustinHarwood are you handling the errors? Try logging them.
I'm not 14 and traveling with my parents on long road trips anymore lol
i wonder if it has to do with my router? refreshing "/mysql_test" doesn't seem to initiate a fresh select
I mean personally impressed
17:11
@ssube I agree with you, but as a separate topic: How about really using a DB's specific features instead of going for lowest-common-denominator?
I know a lot of people will enjoy it
ok ssube. ill console.log some variables
materialized views, etc.
@Luggage that's a fun one, isn't it. There are only a few DBs where those features are actually worth using and I'd make a (wild) guess that if you need them, you're stuck on that DB already.
MySQL, for example, has absolutely 0 useful unique features.
I am referrring, of course, to postgres
17:13
Postgres has all their JSON and GIS stuff. IMO, I'd just have one or two classes that work outside of Knex and hit the driver directly.
i'm used to LAMP stack
<3 sql
so, ORM isn't the right term I am looking for.. but a library that exposes as many postgres features as JS structures as possible..
Still keep it contained, but if you gotta use the driver directly, that's what you do.
Also.. the ability to share some JS between server and DB (since postgres can use JS) would be awesome.
ehhhhhh I doubt it
we have something like that at a slightly higher level (one of our APIs stores and runs snippets of JS for incoming data) and it's not great
17:15
Then you are dead to me.
that sounds an awful lot like stored procedures and some of the other nasty things people try to use
Well, sorta. For example, I have some 'computed' values that I only have access to in my code, since they are done in JS.
I think there's an argument somewhere that if the database needs to see it, it should be stored in there.
I don't know.. the idea isn't fully fleshed out, but as much as I like "write once run on any DB", I think there is a place for "really use THIS DB"
You wouldn't expect a MD file to render itself into HTML as you read it from disk, and the database shouldn't do much work on its own.
17:19
lol i had an internship a year and a half ago where i exclusively wrote stored procs in sql server
@Luggage absolutely. There will always be times when you push the limits and have to drop out of the nice, friendly abstraction.
Yea. I'm against SP and triggers..
but those should be an exception and you should think very hard about them, because there's usually a better, simpler pattern that doesn't mean leaving the fence
but.. if they were generated and deployed automatically based on JS code to provide some form of 'isomorphic' features between the DB and server.. maybe. Again.. not fleshed out fully.
it's like design patterns
if you keep running into "exceptions" that don't fit the pattern, you're either using the wrong pattern or you don't fully understand it
exceptions are exceptional and should be scrutinized
17:21
I don't. 99% f my queries are just generated by knex and very straightforward. I have 0 SP and 0 triggers.
@Luggage IMO that's what the query is for, to do that "rendering" sort of stuff.
But some days.. a plain SQL query would be a lot easier to read. It's a DSL for that purpose after all
A well-written query will fetch the data in a useful structure and the DB doesn't need to worry about formatting it or computing things.
but, then I lose my JS-only virtual columns and such
if postgres wasn't so fast, I'd try to find a SQL database without all the fancy stuff, but it doesn't really matter
also NoSQL is so slow that nobody really cares anymore
17:23
well, depends which noSQL and for what purpose.
but yes.
using it as a database
right, the way most people start with mongo for no good reason.
> But mom, I don't waaaant to write a schema, that's haaaaard, can't I just give you the data and you can just figure it out?
I assume that someone out there has actual good reasons for using these things.
@Luggage with the more specialized databases, for sure. Mongo sits in that ugly "not good at any specific thing but easy to use" pool with PHP.
Once you get into graph databases and even Cassandra type stuff, there are real use cases.
17:25
I remember when I first discovered redis, I tried to use it as a 'database'. :)
There is a world outside PHP and MySQL? What is this nonsense?
Perhaps I can just adjust my data layer to persist all JS-calculated values for querying/indexing purposes.
I didn't have much trouble with redis, but only because we had been using memcached before.
they'll be redundant, but I'm ok with that.
Coming into key-value stores without knowing what they do is super confusing, though.
17:27
I didn't have 'trouble' with redis, I loved it from the beginning. I just tried to use it for something it's not really meant for.
@ssube also illegal in 49 states
It was a shiny new hammer and I was desperate to find a nail.
Yesterday at work I spent at least a good 4 hours trying to write some code in PHP before giving up and trying in JS, but that didn't go so well either. I went home, where I then found clarity in the silence, and knocked out the code in JS in like 15 minutes. The award winning code you ask?
    globalJobs.forEach(g => {
        function whereJob(l) { return l.job === g.job };
        var foundJob = localJobs.find(whereJob);
        if (foundJob && foundJob.due !== g.due){
            g.old = foundJob.due;
            jobsToUpdate.push(g);
        } else if (foundJob && foundJob.due === g.due) {
            // do nothing
        } else {
            jobsToAdd.push(g);
        };
    });
Thanks to @Luggage I've learned about the find() and using the function like I did above. Still trying to figure out how to take out the function outside the loop while still being able to pass the argument in that I need, but I'm getting there!
@KendallFrey reddit.com/r/aww/comments/58ggjd/… and here I am, pondering over some js.
just move it outside the loop and give it two arguments..
17:30
@Waxi i don't know the larger context of that code, but it looks like that could be written using filter and map?
might make it cleaner
> It travelled half a billion kilometres across the solar system, deployed its parachute flawlessly and survived a scorching descent through the Martian atmosphere, but the European Space Agency (ESA) has confirmed that its ExoMars lander was lost just one minute before it touched down on the surface of the red planet.
I've never seen function used without the () though, like it's being used inside that find(), so I gather that it automatically passes the current item into it without having to specify anything. I didn't think I could pass in the element while it was in the find(), but I can try.
@rlemon Yea, that's really depressing. It did such a great job getting there and suddenly...poof.
> Just kidding really. But, yeah, I've had far too many concussions to be an astronaut.
how does your life even get there
foo <- is the function
foo() <- calls the function, and you get the return.
foo(foo) <- calls foo, passing itself to itself.
17:33
I got another dumb javascript question. Does offsetWidth include transform? If not, how do you get the width including transform?
what is a legit use for foo(foo) ?
to break everything
@Luggage promise loops :(
lol. Got an offer from Warwick (a decent university). How it works here is that you apply, and they can choose to come back to you with an offer, which says that if you pass certain parameters in the final marks, you are sure to have a place there. Alongside the average mark and the maths mark condition, there was an "you must achieve at least a 50% score in english"
that's so funny
You should probably consider failing drunenomics while you're at it.
17:35
!!define drunenomics
@towc No definition found.
drunkenomics?
Sorry, shoulda been drunkenonomics
function oneByOne(promises) {
  const [head, ...rest] = promises;
  return head.then(oneByOne.bind(null, rest));
}
holy crap, @ssube stackoverflow.com/questions/40159288/… this was still open. I clicked on OP to see if they deleted and re-asked (sometimes...) was a little WOA when I noticed the location
das my location
17:37
It no open no more.
not for you
waaat do they work for your company?
no, there is two universities, a college, and like a half million people in kw
so I've never met this person, just.. you know.. small world and shit
that I close voted his Q
kw is a city?
equilibrium constant of water?
kilowatt?
@rlemon Google Music has Randy Savage's rap album. Surprisingly, it's pretty good.
17:40
@towc Kitchener-Waterloo
@Trasiva no thanks :D
@rlemon why did you let the french name things?
if Canada wants to be taken seriously, you need angry sounding city names, not french ones
Field Marshal Horatio Herbert Kitchener, 1st Earl Kitchener, KG, KP, GCB, OM, GCSI, GCMG, GCIE, PC (/ˈkɪtʃᵻnər/; 24 June 1850 – 5 June 1916) was a senior British Army officer and colonial administrator who won fame for his imperial campaigns and later played a central role in the early part of the First World War, although he died halfway through it. Kitchener won fame in 1898 for winning the Battle of Omdurman and securing control of the Sudan, after which he was given the title "Lord Kitchener of Khartoum"; as Chief of Staff (1900–02) in the Second Boer War he played a key role in Lord Roberts...
we were Berlin
then WW1 happened.
lolwut
Through the latter half of the 19th century and into the first decade of the 20th, the City of Berlin, Ontario, Canada, was a bustling industrial centre celebrating its German heritage. However, when World War I started, that heritage became the focus of considerable enmity from non-German residents within the city and throughout Waterloo County. == Overview == The fact that most of the original settlers of Berlin were not directly German but were Mennonites from Pennsylvania did not help, as their refusal to join the war effort (because of their pacifism) only increased tensions. The slow pace...
17:50
@rlemon I'd have voted Corona
where should i be putting my database logic in an express app?
i have my "select" in the the route
and the "insert" in app.js
> There is a local conspiracy theory in Kitchener that states the 118th Battalion is still around, making behind-the-scenes decisions in City Hall that affect the day-to-day lives of area residents
aww,
@rlemon care to comment?
@JustinHarwood are you familiar with the traditional model-service-view split?
17:54
you should have one group of classes for data, one for logic, and one for presentation
I would like to create a very very very 'basic' version of something like this: nieuwstecollectie.kleertjes.com/magazine-ss-2016#!/intro . . . What could be a starting point?
MVC falls within the presentation stuff, here
below that, you have the models (basic validation and storage) and the services (business logic)
you can put the database stuff in either one, tbh, although putting it with the model is more popular in my experience
when i sat an action on a form, why does it go looking for a .post in app.js?
i tried putting it at the top of my route initially but that didn't work
when i put an action**
because forms POST their data back to the server
i think my issue is that i'm not calling a function to render a "select" on every refresh.
i'm passing in a result set from a query placed above the router render part
like i put a Date.now above the render, then passed it in, and it was only refreshing every once in a while. i put a Date.now() directly in the router render and it updated every refresh.
17:59
For example, how do you create such thing to manage views in a window
Is it just a div with show and hide and some lazy loading stuff
-3
Q: JQUERY ROW CHILD

Jan Vargasgood afternoon, I would like to know what the structure to make a jquery row child. Thank you

-_-

« first day (2196 days earlier)      last day (2977 days later) »