« first day (1869 days earlier)      last day (3080 days later) » 

3:00 PM
:P
 
So console logging the result of the calculation goes from -5s to 9.5s
as I drag the slider from the very left to the very right
 
@Zirak oh yeah, I have to learn some perl for github.com/ralt/dh-quicklisp
 
or just use parens if you don't want to hang onto a dead language
 
Good evening, ladies and gentlemen!
 
j/k, nothing against lisp. just getting florian fired up.
 
crl
3:01 PM
!!how many ladies there?
 
@crl 10/10
 
looks like we're all ladies
 
i wonder why ladies don't come here
 
i don't
 
what are some common applications of closures? I'm trying to imagine a scenario where I'd need to use a closure
 
3:02 PM
or there are some hiding?
 
there are a small number of females here as room regulares, but our culture in the room, sadly, likely encourages some to stay silent.
 
@MoonOwl22 state without using "classes"
 
@MoonOwl22 any time you need a callback to use/modify values from the parent scope
 
Please pardon my ignorance. I have just started learning JS
 
@FlorianMargaine I have a basic example here now, if you actually load the full link that jQuery gets in a separate browser window, the beginning of the animation doesn't show up when in the jsfiddle. Basically, I need to change those numbers to start from the very beginning of the keyframes, and end at the end of them perfectly
 
crl
3:04 PM
I'd say when you don't want to pollute the global scope, well not sure myself too :s
 
(only works in Chrome, not safari)
 
@crl Ah!
 
function foo() {
    var timesClicked = 0;

    button1.addEventListener('click', function() { timesClicked = timesClicked + 1; });
    button2.addEventListener('click', function() { console.log('You clicked ' + timesClicked + ' times.'); });
}
That's a common use of a closure. state that spans callbacks.
 
That means with closures I can simulate human interaction
 
crl
@Luggage not sure it's a 'closure'
just an anonymous function
 
3:06 PM
I've read that anonymous functions are different from closures
 
it is now, @crl :)
 
crl
foo is the closure when you invoke it, ok
 
@FlorianMargaine For example, at the beginning of the proper animation (if you view it separately), the woman's face rotates in, then the text "product or service info" appears. But in my timeline draggy thing, it's not like that
 
what kind of culture says females to stay silent. females like to talk
:D
 
^ that one
 
3:07 PM
@MoonOwl22 do you know what "memoizing" is?
 
So with closures I can generate tree-like behaviours
@FlorianMargaine Nope
 
@Jimbo I'm on mobile, won't be able to help
 
Inexperienced programmer here
 
@Jimbo works fine in firefox
 
But let me read up on memoizing
 
3:07 PM
or i'm interpreting your comment incorrectly
 
@MoonOwl22 learn what it is, and try to implement a memoizer. A function that will return a function which will be used as a memoizer.
 
@KarelG Viewing the full animation, the exact beginning of the animation the woman's face rotates in, then the text appears. If you view the js fiddle and move the slider from the very left, the beginning doesn't have the woman's face rotate in
 
@FlorianMargaine Thanks. Just for quick clarity, are memoizing and hill-climbing related?
 
not at all.
 
Basically, the slider needs to be from the very beginning of the animation, and currently it's not, and that's where me trying to understand those numbers comes in. You can change the -5 and 12.5 to different effects, but I can never get it exact, and I need to understand what it's doing so I can get those numbers right
 
3:10 PM
Thanks. had to clear early confusion
 
I have an abstraction over a view that renders a handlebars template and its usefull for every view to have a .render() method. What are people's opinion on extending from a base "class" vs mixin it in?
 
@MoonOwl22 it's a pretty good exercise btw
 
It does seem interesting. I can imagine using it in interpreter optimisation for a low processor speed, high memory situation
Thank you, guys and girls for the clarification
 
Sha
Hi - I am trying to figure out how Google has implemented the "show/hide menu" functionality that appears when you resize the window here ga-dev-tools.appspot.com - I can see they have included very large js libraries of around 1mb in total
 
@Sha Welcome to the JavaScript chat! Please review the room pseudo-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.
 
3:19 PM
Morning
 
Sha
- wondered if anybody can help me figure out exactly what is going on.
Morning :)
 
@Sha Google operates at such a scale that trying to copy them will not be a good use of your time
 
crl
@Sha the responsive thing?
 
but what you likely want is called 'responsive design'
 
Sha
Yeah the responsive thing - it looks like some bootstrap thingy?
 
crl
3:20 PM
not specific to google, bootstrap makes that too
 
see: getbootstrap.com for a good pre-made css file that does responsive junk like that
 
crl
but it's doable in 3 lines of css and 5 lines of js too, it will look less shiny maybe :)
 
no lines of js
 
Sha
I have tried to install bootstrap.min.js but again this seems excessive
 
just a media query in css is all you need.
 
3:21 PM
I want when the number of "notification" increases, then the space between "MyName" and "notification" increase too. In other word, I don't want to red-div cover "MyName" text never. how? jsfiddle.net/ws7x5j8z
 
Sha
@crl okay?
 
crl
well only css maybe (without aving to listen on resize in js)
try it yourself with media queries
 
Sha
OKay even better - I am trying to dev some web app, but 200kb-1mb of js is not good.
thanks everybody for quick reply and kind help :)(
:)
 
you can get a lighter bootstrap buy turning off the bits you don't want on the d/l page, or look at pure.css a lighter alternative.
or do it yourself, as others have said.
or even just rip out the parts of bootstrap you want and drop the rest
it's a good source of examples, if nothign else
 
crl
!!> "foo"[0]
 
3:32 PM
@crl "f"
 
crl
good way to get first char?
 
everyone should know that a string is an array of characters ...
 
crl
I mean vs charAt?
 
but some languages ( * ahem * java ) wraps it, that you can not use array accessors. So you have to use .charAt >.>
well, it's clear for me. But would it be clear for newbies ?
 
charAt(0)
 
3:34 PM
you can be consistent though. If you have used charAt for other chars, use it then
 
If someone understands arrays I think the leap to figuring out what "foo"[0] does is pretty small
 
yes, but sometimes people forgets that a string is an array of characters ...
 
Java Sucks Bawlz. I hate the arrogant Java programmers who think javascript can't work on server lol
 
crl
Java can't even work decently on a browser, well maybe because I haven't installed it :s
 
^--
 
3:37 PM
@crl Java in the browser is pretty much dead
Installing it wont do much
 
i had a consultancy task, of a client whom complains that their website is slow. He asked us to improve that. Quess what, it's with servlets and jsp stuff. Then database access occurs through JEE
that was a painful month of performance tuning because he doesn't want an other design/framework/platform
 
crl
what was the thing slowing up? usually it's db
 
It's not hard to make a shitty website in node either though
I don't think Java on the serverside is automatically "bad" just because it's Java. JEE on the other hand...
 
crl
what's the term again, for the element in a chain/flow that slows up everything?
 
Manager
 
crl
3:41 PM
no I mean, when you wait for several things to complete, and one is very long, you call it a .... ?
 
Must be bad coding practices coupled with hibernate. That's like bad meets evil :D
 
bottleneck, weak link
 
crl
^
 
Blocking process? Blocking I/O?
 
@ivarni I am moving away from Java and C#. I observed that their stuff is targeted towards IT departments in non-tech companies
But that's for web development only
 
crl
3:44 PM
Java/c# can be pretty fast servers, nothing specially wrong with it
 
Don't get me wrong, I prefer node myself but I know the JVM can be very performant
 
It's not about the speed of anything
For me, it's about the aura the surrounding technologies bring with them
 
@crl the jsp is surely not fast ....
if you compare that to PHP, then php still wins
i consider PHP as bad language, so ...
 
crl
ah ok
 
keh, people uses PHP because of lack of alternatives. If you don't count in ASP.NET or node, then you have other platforms which is certainly better but more complex
 
crl
3:48 PM
there are really good programmers in php, so I don't really have smething to say on it
 
they are
but some of them says PHP isn't good ;)
they're on the right tracks lately it seems (if you follow the updates)
 
crl
maybe newer versions are better
 
Sha
@Luggage thanks again - the pure.css option actually looks quite nice (for me, that means no bloat)
 
I use PureCSS as well. It works well. Can recommend using for most full blown websites.
 
useless page ... was searching for tips/tricks. Got empty page
;_;
 
crl
3:53 PM
I use vanilla.css
 
^--
 
Hi can can someone please kindly help me on this
http://stackoverflow.com/questions/33968503/order-by-and-click-is-not-working-in-ng-repeat-angualr-js/33969186?noredirect=1#comment55697086_33969186
 
^-- not clear ...
i mean. What's the problem ? What do you expect ? Without these bits, how would we able to give you a proper answer
it's like i'm stabbing someone in the dark
 
crl
sorry no xp in angualr js
I know a bit of anguillar.js tho, but that lib is fishy
moved to enchilada.js recently
 
it's visible because you have named it incorrectly twice times :p
 
4:10 PM
The problem is that the sorting is not working on code and trigger click is not working inside the angualr code
 
does anyone else think there should be a new syntax to create a Map/Set
 
crl
yea, with reversed {
let map = }1:2{, set = ]1,2,3[
 
@crl hahahahahahahaha, no.
 
4:30 PM
yeah no thanks lol
maybe a backtick
or double braces
though that wouldn't work for array/set
 
@Mosho that's reserved for template string literals :D
 
yeah
{{}} seems okay
for maps
{[]} for sets? :o
need moar brace types
maybe #{}
 
why not Map<Type1, Type2> ?
 
what does that even mean in this context
 
"new syntax to create a map/set"
but it doesn't work because js is dynamic type
 
4:35 PM
to create ES2015 Map/Set
 
@Mosho breaks BC
 
Anybody knows the use for that ?
 
@Mosho used in object literals already
 
not without a colon etc.
@Abhishrek calling shit as functions instead of static keywords
 
4:37 PM
@Mosho example
 
and a basket to put related things in, rather than in Object for example
arrayOfConstructors.map(Reflect.construct)
 
@Abhishrek escaping proxy objects from within proxy objects
 
also, safe methods
 
Can somebody give me a code block comparision ?
ES5 / ES 6 with and without Reflect ?
 
!!google mozilla hacks ES6 proxy
 
@Abhishrek ^ first link. Also no ES5 presence
 
nicely explained
didn't knew about that feature
 
Reading
Also reading blocks of english doesn't help me at-all
 
@Abhishrek don't tell me you haven't used proxies and reflection in Python
Heck, even PHP has them since like.. forever
 
youtube.com/watch?v=gA1s15sCi34 @AwalGarg @SomeGuy another Krauss Porn
and this one is 2015
 
crl
4:53 PM
!!urban proxy
 
@crl proxy A sort of "middle man" on the internet. Normally when you go to a website, you send your "request" packets straight to the site's server, and then the server sends "reply" packets back which is what you see as the website. With a proxy, you send your request packet to a server, which then sends a new request packet to the website's server, which then sends back a reply to the proxy's server, and the pro(snip)
 
@Abhishrek no
 
crl
great, a feminine presence (other than @Cap or @Badger)
well she left :s
!!sup?
 
@crl That didn't make much sense. Maybe you meant: sup
 
crl
!!I mean, sup?
 
4:56 PM
@crl That didn't make much sense. Maybe you meant: 3, d, y, ^, !, π, ?
 
crl
will have to check how the detection is done
 
!!> Class
 
@Abhishrek "ReferenceError: Class is not defined"
 
how do i check if a variable is a Class ?
 
crl
instanceof?
 
4:59 PM
@crl instanceof what ?
let k = class Foo{

}
k instanceof ?
 
crl
k instanceof Foo
 
@Abhishrek there is no extra type, it just gives us a function
 
@crl err its not an instance of Foo k is Foo !
@AwalGarg so the only probable way is going to be Foo.constructor or something ?
 
@Abhishrek There is a hack, but... why do you need this?
 
@AwalGarg checker for a class declaration ?
 
crl
5:01 PM
sorry, replace k by whatever shit you make a new with
 
@Abhishrek which is useful for what...?
 
@AwalGarg VIS CLasses ?
variables can be set to classes.
 
crl
!!> var Foo=function(){}, f=new Foo(); f instanceof Foo
 
@crl "true"
 
@Abhishrek Foo.toString().startsWith('class ') && typeof Foo === "function"
 
5:02 PM
@AwalGarg smart !
will it work in babel ?
 
no
 
crl
ah, checking the declaration itself.. weird usecase..
 
^--
 
@AwalGarg btw how about
	def('BaseValueNode', [
		Prop('value').ofType(Number, String, Boolean)
	]);

	def('RefNode', [
		Prop('ref').ofType(Function)
	]);
vs creating wrapper nodes for Number, String and Boolean
 
don't wrap if you don't need to
 
5:05 PM
dunno if i will
This looks reasonable enough to me
 
won't
 
Actually becasue of this
I am kinda tempted to write them 4 wherever I need em
for instance
Prop('condition').ofType(Number, Boolean, String)
over
Prop('condition').ofType(BaseValueNode);
 
crl
would be fun to have reversed regexes, /go{5}l/.generate() -> ['goooool']
 
...wait a minute, that... shouldn't work
@BenjaminGruenbaum here?
oh, fuck, ignore that ping :P (can't edit now)
 
crl
@Awal cancelled ping
 
5:14 PM
that didn't ping me, but highlights my name
@crl can repro?
 
crl
yea, crazy!
@copy, @BenjaminGruenbaum
 
hey there -- I have a question: how can I specify vendor specific values (not property names!) in javascript? I'm thinking of for example: cursor: grab; cursor: -moz-grab; cursor: -webkit-grab;. I mean, if I do element.style.cursor = 'grab' and then element.style.cursor = '-moz-grab' it will clearly overwrite the previously assigned value, won't it?
 
!!google lea verou CSS free
 
@PeterVaro ^ first link, if you can afford a lib. I hate CSS :P
 
5:21 PM
me too, and I can't :)
 
in that case injecting global classnames and stylesheets are your best bet, TMK. Someone might have some magical trick, though.
 
@AwalGarg btw prefixfree is a terrible idea IMO, using a CSS preprocessor for that purpose is way better :P (only in my case, this is not CSS related, but JS)
 
Indeed.
 
crl
you couldn't add a class?
 
@crl that's what I'm doing right now, though I was wondering if there is another trick that could solve this problem!
 
crl
5:27 PM
don't know
 
@PeterVaro oh dammit, I totally forgot, yes ofcourse you can. set one value, do getComputedStyle(el).propName and see if it is the one you set. If not, it didn't apply. So set another one. Repeat till done.
Another pro of this trick is that you can do this on pseudo elements as well, which the selector API can't even select
hmm, I should try doing that, actually
 
@SomeGuy 4pi/3 pi r^2
in the video haha
 
crl
unforgivable mistake, yea
 
@crl i laughed so hard
 
crl
@AwalGarg and that works for each different browser supporting the prefix?
nice trick
 
@crl sure
You can get slightly more bullet-proof-ness if you use getComputedStyle instead, but I am lazy :P
 
crl
Do you know if getComputedStyle is expensive, I'd maybe need it to check the top margin/padding of an element on hover, or if they are horizontal (like if it has display:inline-block or the parent has display:flex) or vertical in their containers during dragover?
or I could try to cache it..
 
@crl getComputedStyle won't help you there. It doesn't "resolve" anything.
 
crl
5:48 PM
I know but I need to access the element css properties
and decide things upon that
 
@crl why not just get them from element.style?
 
crl
because I'd have to check marginTop, margin, ....
and the things can be inherited < that mostly
like .parent > * { margin-top:5px}
if I'm on a children I'm not aware of this
or if the element has a class
 
well then not sure about the performance impact. I'd assume it is a bit expensive though since it returns a different object everytime
 
crl
and a big ass object :)
 
all of those are just getters, so it doesn't really matter. Accessing them would be expensive, yes.
 
crl
5:54 PM
ah right (I always wrongly think object properties access are O(1))
 
I have used getComputedStyle for environment detection previously on page loads, but not vigorously.
 
crl
also those properties (style/class of an element) can change later (can be edited by the user), so well I might call computedStyle at loading, store it, and refresh it at each edit update
 
@Luggage Not rreeeallyyy, but it's awesome none-the-less.
@FlorianMargaine That just returns the whole stream's data; reads until exhaustion.
 
crl
!!>Promise.all([new Promise(r=>setTimeout(_=>console.log(1), 200)), new Promise(r=>setTimeout(_=>console.log(2), 100))]).then(rs=>console.log(rs))
Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined} //c'mon Cap that should work
 
@crl "undefined" Logged: 2,1
@crl "undefined"
 
6:09 PM
@AwalGarg thank you very much -- I choose not use grab(bing)? cursor values, as it is a pain in teh arse to support them on IE/Edge, and on some Opera versions
but thanks for the headsup, very useful info!
 
@crl "undefined" Logged: 2,1
 
crl
fuck wrong one
well my point is Promise.all keeps order
 
@crl would be terrible if it didn't :P
 
crl
could map reduce the shit
 
Guys, can anyone please tell me in normal human words what the following means: var a = slider1 === slider ? 0 : 1, b = a ? 0 : 1;
 
@ЗахарJoe Welcome to the JavaScript chat! Please review the room pseudo-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.
 
@SomeGuy oh dear
 
6:45 PM
@3axap Joe google javascipt ternary operators
 
@kcbeard you can also do
!!tell 3axapJoe google "javascript ternary operators"
 
@Abhishrek Ok
@ЗахарJoe Not gonna lie, the whole assign different variable in the false statement is kinnda of annoying. Without knowing the code around it, seems like a good argument for separation of concerns. But it may logically make sense, depending on the logic.
 
So... if slider1 equals slider then 0, otherwise 1, assign that to a, if a is true then 0 else 1, assign that to b. Is that it?
 
crl
!!> true?0:1
 
6:53 PM
@crl 0
 
is nightwish the best e2e test runner out there?
 
crl
I don't know but bipbip is the best road runner out here (oh it's called differently in English fr.wikipedia.org/wiki/Bip_Bip_et_Coyote)
 
@kcbeard you mean b=a ? 0 : 1 thing?
 
does @chainable
make sense as a decorator ?
 
@ЗахарJoe yeah, just seems like it could have been separated. Its not very complicated, but nesting ternary operators just seems to me, and this is just for me. An additional step in the thought process that is not needed. Which makes it an additional step for the guy coming behind you.
 
crl
6:58 PM
!!> var _ = `` === `` ? _=>1 : _=> 0; _()
 
@crl 1
 
@ЗахарJoe but if it logically makes sense, than it is needed.
 
@kcbeard Well, I'm not sure if it logically makes sense or not, I grabbed that line from refreshless.com/nouislider/examples/#section-lock
 
6
Q: A somewhat painful triple-nested ternary operator

Elliot BonnevilleI went looking through Raphael.js's source code to find out how he converted RGB values to HSB. I found out the function he did it in and I was in the process of converting it to Python when I bumped into this nice triple-nested ternary operator: H = (C == 0 ? null : V == r ? (g - b) / C : ...

 
crl
H = (C == 0 ? null :
    V == r ? (g - b) / C :
    	V == g ? (b - r) / C + 2 :
             (r - g) / C + 4
    );
seems pretty clear to me, not kidding
 
7:01 PM
It looks crazy.
Why not use the if/else construct? It's easier to read and it doesn't make things slower.
 
crl
too long, nah jk
 
@crl yeah right
 
So.. saving space?
 
@crl But everyone is not you. And it can minimize productivity for those who may not see that like you.
 
crl
yeah, you have to read it in your head to put sense tho, and say the 'if' 'else if'
 
7:04 PM
@ЗахарJoe show off
 
lol
 
@crl Yeah it took me a minute to get it
 
@Abhishrek you're not serious, are you?
 
if else is more readable.
 
Hi Guys, this is my fiddle jsfiddle.net/xSU2G/6 - I want to have a delay between the first console log time and second console log time using Q.delay() - but nothing seems to be working. Can you please help
 
7:04 PM
@user2133404 Welcome to the JavaScript chat! Please review the room pseudo-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.
 
Trolls in the C room are much more funnier than the ones in this room :D
 
example?
 
crl
:)
 
I could have written the getBits part
 
@Abhishrek dear lord
 
7:06 PM
you get the point ?
 
To me it looks like pillowy mounds of mashed potatoes.
Not really.
 
@Abhishrek What was that, lol
 
@kcbeard an mp3 decoder i wrote 3 years ago purely in javascript
 
getBits?
@Abhishrek That sounds cool
 
more of mp3 header decoder
 
7:07 PM
makes sense
 
@kcbeard just read up the getBits method itself is an ugly block of code
 
@Abhishrek can you put that in a fiddle showing how it works? I am very intrigued now :D
 
@AwalGarg read file
and pipe it
var f1 = new mp3Reader();
f1.load('dah.mp3');
 
All 534 lines of nestation
 
Using javascript for that feels like rape.
 
7:09 PM
@Abhishrek and that should do what?
 
read dah.mp3
first parse the entire ID3v2 information
make apt files for thumbnails
 
Hope it supports unicode tags?
 
then visit each mp3 frame
and decode the header
 
@Abhishrek neat! this is, how I imagine, all code spitted by emscripten looks like :P
 
and you can re-enable the block
@AwalGarg I wrote it by hand
 
7:10 PM
I know
 
@Abhishrek Its actually pretty clean too for what u r doing
 
with a LOT of help from ESLiaja
gist.github.com/darkyen/4450502 I think this was the best version
 
Iam using this code to append a delete icon on an event inf
in fullcalendar
eventMouseover: function (event) {
    var layer = "<div id='events-layer' style='position:absolute; width:100%; height:100%; top:-1px; text-align:right; z-index:100'><a><span class='glyphicon glyphicon-remove' onclick='deleteEvent("+ event.id +")'></span></a></div>";
    $(this).append(layer);
},
then i start a new function with the name deleteEvent(id)
i keep getting this error Uncaught ReferenceError: deleteEvent is not defined
 
crl
!!> 0?1:0?2:0?3:-3:-2:-1
 
@crl "SyntaxError: missing ; before statement"
 
7:24 PM
am i missing something??
 
crl
yes, the error gives it
 
never mind i should declare the function outside the ready when i use onclick
 
crl
a function exists in its scope
when you're not using var f=function.. at least, but that would suck
 
8:31 PM
might be helpful
gets the actual rule form the stylesheet
not the computed style
 
crl
@rlemon interesting thanks
 

« first day (1869 days earlier)      last day (3080 days later) »