« first day (2116 days earlier)      last day (2838 days later) » 

1:34 AM
What the hell is wrong with the person who wrote those "Get the code?" tests.
"See if you can decipher this mish-mash of garbage math and if statements and see where the program exits." Yeah that's definitely the core of language comprehension. Yup.
 
1:48 AM
I always thought I couldn't understand code...
 
These tests don't even require understanding of the language in any meaningful way. You just need to follow chains of logic.
 
I'm not talking about any test.. I just skim through code and say to myself I dont get it..
 
2:08 AM
That's one way to do it I guess :P
 
can someone help me, I can't figure out why this isnt working
files: function(files) {

	        		var obj = {};

	        		obj = {
	    			'<%= data.proj.folder %>/<%= data.proj.sass %>/testmain.scss':['<%= data.proj.folder %>/<%= data.proj.sass %>/nav.scss']
	        		};

	        		return obj;

      		}
basically i want the files property to be the result of the function call
 
files: (function(files) {
    ...
})()
 
@phenomnomnominal OMFG I LOVE YOU
I'm guessing the secret is in the () at the end?
 
but also, why not just
files: {
    '<%= data.proj.folder %>/<%= data.proj.sass %>/testmain.scss':['<%= data.proj.folder %>/<%= data.proj.sass %>/nav.scss']
}
 
2:19 AM
because I'm actually building the file list from a json file
it's for a grunt packages
 
then yep
 
1 message moved to Trash can
@Hybridwebdev Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
im guessing the former is an anonymous callback?
what's there difference between

files: (function(files) {
    ...
})()
and

files: function(files) {
    ...
}
 
it's an IIFE
an immediately invoked function expression
 
I dont understand the difference
 
2:29 AM
It's easy
Say, you've a function like this:
function mol() {
  return 42;
}

var meaning_of_life = mol();
What will meaning_of_life be set to? 42.
If we instead replace mol with the function definition..
var meaning_of_life = function mol() {
  return 42;
}(); // just replaced mol with the function def.
You can even remove the name and make it an anymous function
var meaning_of_life = (function () {
  return 42;
})(); // just wrapped in parenthesis for readability (and other issues).
 
so then
how do you pass a parameter into it
same as always ya
module.exports = function(grunt) {

	grunt.config('sass_import_compiler', {

		sass_import_compiler: {

		     options: {

		    	keepExtensions: true,

	    	},

		    files: (function(grunt) {

		    	var list =  grunt.file.readJSON('<%= data.proj.folder %>/<%= data.proj.sass_distro_list %>');

        		//console.log(list);
        		/*
        		list.each(function(index, value) {

        		});
        		*/
        		var obj = {};

        		obj = {
    			'<%= data.proj.folder %>/<%= data.proj.sass %>/testmain.scss':['<%= data.proj.folder %>/<%= data.proj.sass %>/nav.scss']
it throws an error because grunt isnt being passed in
 
@Hybridwebdev You don't need to pass grunt.
 
its throwing an error though, which makes me think its not getting passed the grunt object
 
2:50 AM
However, if you needed to pass values to an IIFE you could do it like this:

    var output = (function(str) {
        return str + 'bar';
    })('foo');
    console.log(output); // 'foobar'
 
@Nimphious Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
I did press Ctrl+K. Wut.
There. Extra double Ctrl+K for extra code.
Punches the text input box in the box
That being said, your IIFE should have access to any variables in the scope you called it in. So you shouldn't have to pass it grunt if you can touch grunt in the scope your IIFE is in.
var grunt = "Hurk!";

(function(){
console.log(grunt); // <-- Outputs "Hurk!"
})();
 
i wonder why im getting this error then hmm
 
Oops
One particular use case for passing arguments to an IIFE like that might be overwriting a global inside that IIFE but not affecting any other code. For example:
var sandbox = {
  close: function() {
    console.log('Closing the window is not allowed in this context.');
  }
};

(function(window){
window.close(); // Outputs our message above instead of closing the window.
})(sandbox);
People also use it in code golf to shorten stuff.
 
3:18 AM
(function ($) {
  // Also this
})(jQuery);
 
Yup.
 
 
3 hours later…
5:53 AM
morning people
 
o/
 
6:26 AM
sup
@Nimphious sorry to disturb, I read some questions on SO regarding the --harmony flag of node v6.3.1
I cannot find anything to help me with my issue
it seems to be totally ignored
 
Hmm?
 
node 6 has a harmony flag?
Apparently, it does.
 
@littlepootis yeah it does
and seems to be ignored
however I cannot get import working, it seems to be still in progress
 
6:43 AM
--harmony only enables staged features.. you need to transpile if you want import
 
6:56 AM
Node's had a harmony flag for ages.
What it does changes as the version of V8 they're using does.
 
guys, I am new to nodejs. are there any more modern ways of dispatching content than templates?
 
Dispatching? Templates?
You mean, "Are there any ways of serving web content that are more modern than template engines?"?
 
yeah, that's what I mean. sorry. haven't slept well :))
 
Also, modern != good, and everything depends on your use case, envivonment, etc.
What are you trying at the moment?
 
well I am using a jade file to render an index.html to render the #app div and add the bundled client script (since I am using React)
I am still in doubt if I should use client-side routers or the Express' server-side one, but that's another story
 
7:06 AM
@Victor Why not both?
 
@MadaraUchiha well, depends on how I should blend them, right? I could create a route for/ and then let react router do its job
 
@Victor Say you have an /about page
 
or I could create /shop, /user/:userid etc and have separate bundles
 
If you do it in a client-side router, you'll need to fetch the data twice.
Once to get React and the initial state, and another when React figures out you're on the /about page
Also, templates are not new, and there's no significantly better way of generating HTML at the moment.
 
@MadaraUchiha so I should use the server side router?
 
7:10 AM
@Victor Figure out what you want to do, and how it would look like
Keep performance and scalability in mind (but don't obsess over it)
 
look, here is my problem. thing is I come from php. so far, my app x uses multiple JavaScript entry points, each rendering a page composed of React components. the problem is every script i around 600kb compressed, 150kb with server gzip, but it has to be loaded on every page refresh and on every link that takes the user to another page. (this being a disadvantage of server-side routing, as I can see it)
 
...that's quite a beefy script.
Also, you know caching is a thing, right?
The script doesn't change for every page does it?
 
600kb compressed? wtf?
 
@Nimphious no it doesn't but I haven't managed to create such a cache setting so I can invalidate it on a new release of my app
@littlepootis 600kb uglified, I mean
 
That's a LOT of code.
 
7:19 AM
Are you storing images in the code as base64 or something?
Good lord.
 
> 100k lines
 
@littlepootis yeah, more than 100k lines
 
That's the minified measurement poots. I'd guess more like >400k
 
You're probably using something like webpack to package everything.
 
@littlepootis yeah, is that wrong?
 
7:20 AM
@Nimphious No, I'm talking about the loc of his codebase.
No, it isn't. But I'd use a CDN.
Instead of packaging every dependency.
 
Your server should know when to advise the client to use the cached version, if you're super worried you could version number your scripts and update them when you push a new version live.
 
@Nimphious What I found is a called ETag header, but I am not getting the thing with status 304, because the browser still downloads the entire script, right?
 
Your browser should send the version of the script it has in it's header when requesting the file from the server, and the server will either decide their cached version is fine, or just serve them the current one.
It shouldn't download it every time.
 
@Nimphious I will have to check that
I mean, read things
 
It should either use a hash of the contents, or the last modified date, and compare it to the server's version, whichever one it uses doesn't matter as long as your server supports it.
Make sure you're not doing something derpy like sending a header instruction to ignore cache.
Or setting the expiry date to some date in the past or something like that.
 
7:25 AM
Hello, is see that onmouseover is problem for mobile phones.. I want the mouseover for desktop.. What method do you advice for mobile version?
It's not practical for mobiles
 
There are touch events.
 
@GregoryCh touch events, yeah
@GregoryCh ontouchtap
 
What is ontouchtap?
Because there are only four afaik: ontouchstart, ontouchend, ontouchmove, ontouchcancel.
 
@littlepootis it's the react event for click and touch, because click event has some troubles github.com/zilverline/react-tap-event-plugin
 
Requires react, though.
 
7:31 AM
@littlepootis yeah. tbh, I actually thought that was a regular universally available DOM event. I've just found out it's only available in react
 
Ok, lets say that there are many images with link to my page and every page has hidden text.. how can I display the text for the specific image where I touch and link me to the new page with second touch?
 
States. But don't do it.
That's unintuitive.
 
What do you suggest?
 
@GregoryCh why not display that text by default?
I suppose it's some kind of caption, right?
or you're making a store?
 
it's store
 
7:34 AM
display it by default
 
I use simple CSS to display that on hover
to desktops
 
@GregoryCh I would look at popular stores to get some inspiration, look at B&H or Amazon
but B&H has a nicer UI in my opinion
 
Is there a merge tool available which would show me, at the same time, the remote version, the local version, their common ancestor and the merge result?
free would be nice
 
Is there any scroll action? e.g if scroll and image is in center of screen to do an action?
 
7:46 AM
@JanDvorak common ancestor when the branch was created or common ancestor when the file was the same in both branches?
 
Is it possible?
 
The same common ancestor GIT normally uses when launching a 3-way merge tool
 
@GregoryCh yes, albeit with a bit of fudgery
 
I have to go, guys. see you later, thank you!
 
@GregoryCh You probably want to re-think your UI for mobile. Hidden UI isn't good for desktop either. Especially not for your lead generating elements, very poor design.
If you have a store website that intends to make money off of you, and your user has to interact with something in some specific way for the interface for purchasing your product(s) the mechanism for you to make money to even appear in the first place, you've already lost a huge chunk of your potential customers.
 
7:56 AM
it's not exactly store
it's categories only
 
@Nimphious That reminds me of Amazon...
 
when you hover on image you can see the title of category
 
And Apple...
 
may I send a link of page?
 
That one right?
 
7:58 AM
yep
only in home page
 
Hmm. Why does it not brings me to the collection when I click on the big text at the center?
 
On a test mobile resolution, I have to scroll 6+ pages down to even see anything other than the images, like the social media and signup.
There's a shopping cart button, but nothing I can see to purchase so that's no good.
There's a store button, but it's hidden away in a menu two clicks away.
And that menu doesn't follow you down the page.
 
I'm using Meld, but it only shows three panels.
 
So if you're suddenly interested in one of the items on the screen, there's no way to immediately decide to pursue a sale.
Additionally there are resolutions in which the black bar covers the menu.
Why does the menu follow you down the page for desktop but not for mobile?
 
because I thought that the screen of mobile isn't large enough to have sticky the menu
 
8:04 AM
some pages have a menu that shows when you scroll up and hides when you scroll down
 
So I'd wager that 80%+ of the target audience for this website would be using mobile devices.
And that's a conservative estimate.
It's quite likely to be closer to 95%+
 
I ll think about this
At the moment what could I do to display the text when I scroll on image?
 
Remember to periodically put yourself in the customer's shoes and asess the first time viewing experience, and assume zero knowledge.
Doing it on scroll past an image makes no sense, because scrolling past an image is when you want to see the image, not have it obscured by a button or text.
You need to re-think your UI design for mobile in a big way.
 
I can't do big changes instantly. That's why I'm looking for a temporary solution for the text
 
Put it on the side then.
Or use a small button like you do for desktop, but have the click area large enough for mobile.
You don't want to fade in a vignette and a button over the photos when they come in to view, it defeats the whole point of having the photos there in the first place.
Also, having too many reactive elements on a mobile page is horrible for performance, especially alpha-blended elements.
 
8:15 AM
Temporary solutions are almost never completely effective nor temporary.
 
Hi, I have a not/attribute css selector which I want to combine with a first-child selector. It works up to the attribute selector, I can't get the child selectors to work with them. Is it possible?
 
@Jonathan I can't check your code because I am using a mobile phone. Are you adding spaces between selectors?
 
div:not([style*="display:none"]):not([style*="display: none"]):first-child
`<div style="display: none"></div>`
`<div></div>`
 
And it works "as expected" if you omit the :first-child?
 
Yes
 
8:22 AM
Also, I think there is a :visible
 
in jQ, but not in css afaik
 
True, just checked
I don't see anything wrong with that
Stupid test: try the selector with only div:first-child
 
Well, I tried it in Chrome, IE and FF but it doesn't work :(
 
What, div:first-child?
 
@Jonathan :first-child means the first child of its parent, not the first filtered element.
 
8:25 AM
In fact not an ideal selector
 
Ow... Just read in one of the comments that you can't combine :not and :first-child
So seems no one who upvoted actually tried that code
 
Just put on a class with display: inherit and search for first child of elements with that class
 
The second problem is valid too, I need the first visible elem, not the first child of the parent
 
@Jonathan You can combine them. It just doesn't do what you want it to.
 
So, JS it will be
 
8:32 AM
@Jonathan You can set them all look like first child then unsetting the css for following siblings, to do first element styling.
There may be some trick to get last filtered element styling too, but I forget how...
 
I'll just accept my defeat and go with JS ;)
Thanks for the help though
 
What is the difference between nth-child and nth-of-type?
 
Exactly what it sounds like. In <a/><b/> the b is the first of type but the second child altogether.
 
Well if I put a div in front of either rule, it behaves in the same way
Ah, maybe I understand now
 
8:54 AM
A big typhoon is heading our way. Pregnant moms can leave early. Yay!
 
MORNING ALL
@Sheepy Regarding last chat.. Nvm everything on the net.. and vaccinate* your baby..
 
vaccinate*
Don't vaccine your baby, please.
 
Aaaaaand we're back to this discussion
 
XDDDD
 
aand in India's dialect (languages) means Balls
 
9:01 AM
Thanks. I'm firmly in the vaccine camp. :)
 
I remember the fact that when my mother used to take me to Hospital I use to throw all kind of tantrums to save myself
used*
 
Nice.. that's my wife's suggestion btw.. And she talked a lot though I didn't listen to all of em.. But I know when she made her point.
Lol.. like "I am watching porn" tantrums?
 
Nah...I am sick, I don't feel like going.
kinda' tantrums
 
Admittedly, it is harder to see why you should support a hidden benefit over an obvious harm (albeit improbable)
 
@GandalftheWhite Dude.. that never worked on my mom..
 
9:04 AM
Story of everyone's life
 
Though vaccines are the right choice
 
It never worked on my mom either, she used to take me no matter what.
 
Luckily I got a good spy, my sister. And I stayed til afternoon at school to avoid it..
Next to my school was an internet cafe.. Yeah internet was expensive back then.. But still it was heaven..
 
I took my last vaccine when I was around 10 I guess
 
Btw, I know that kind of polio vaccine where they put drops in your mouth.. and tasted sooo gooodd..
I wish I had more of those drops..
 
9:05 AM
most embarrassing thing was they always wanted to give the shot in the butt cheeks
I took those drops till I was 11-12, I guess.
 
I heard the shot in the butt cheek is the most painful one..
Nvm got one before tho..
 
In India there was this campaign where government's representative used to come to your house to make sure you have had polio drops and... I always used to take a few drops.
 
Did it taste good? Do we actually have the same drops?
 
I am pretty sure we had the same drop.
I loved it and that is why I took it despite the fact that it wasn't needed.
 
Lol..
 
9:08 AM
after the age of 5 you don't need it, imagine, I took it even when I was 11
 
I only had 1 drop in my life, and I couldn't forget the taste of it..
 
Unlucky you.
 
:(
 
I recall these huge (or at least it seemed huge to me then as an 8-year-old) antibiotic pills that were yellow and tasted like banana.
 
That's a trap.. It might be actually a banana as pill..
Never heard that before..
 
9:16 AM
It also almost always made you burp shortly thereafter, and the resulting flavor coming from your mouth was some foul concoction of banana and ass
 
Eww..
Nope, never heard of it.. pretty sure it was a trick to have you eaten assed banana pill..
 
Never fooled me save the first time. .
I think if it had tasted like medicine, it would have been preferable
 
I'm looking for clever unmaintainable one-liners to left-pad with zeros to get a 2 digit number. Was thinking something like this could work, but it doesn't
('0' + ( 12..toString() )).substring( -2, 2 )
that should return 12, but it returns 01
it does work if the number is 0-9, but meh
 
@towc What did one cannibal eating a clown say to the other? "Does this taste funny to you?"
n > 9 ? '0' + n : n.toString ()
 
that uses states, assume I don't have that luxury
n = state
 
9:26 AM
What's wrong with that?
 
assume I can reference the number only once
 
It's your parameter
 
there can only be 1 n in the line
because it's a function response and I'm too lazy/it wouldn't fit in the style for me to assign it to a variable
( '0' + date.getHour() ).substring( 0, 3 )
I mean, I know it's possible
[ '00', '01', '02' ... ][ date.getHour() ]
 
> Too lazy to assign to a variable
 
@JanDvorak I mean, I'd have to fix the rest of the horrible oneliners
and I have many
 
9:29 AM
No, you wouldn't.
 
more than I'd like to admit
 
Just fix them as you get to them
 
well, having horrible oneliners is part of the style
I'd have to redefine the style if I fixed a single oneliner
 
@towc oh dear. Time to look for another job
 
I'd rather have incongruous styles in my codebase than be stuck with something broken.
Though..
 
9:31 AM
oh, they're not broken
but they're horrible
 
@towc That's surprisingly many spaces from someone who has coded in Haskell before.
 
so arguably they're broken
 
Haskell is great but it's old
 
@littlepootis still not going to put a space between function and ()
 
I would argue that a one-liner to pad zeroes is impossible in javascript without referencing the number more than once
 
9:32 AM
function( this, looks, weird, af ){}
@Neil Everything is possible in a JavaScript one-liner.
 
Unless you are cheating like using copies of the same param
 
5 mins ago, by towc
[ '00', '01', '02' ... ][ date.getHour() ]
when you left-pad you're always doing it to a finite amount of digits
 
!!>[1,6,12].map(x => ("0"+x).substr(-2))
 
@JanDvorak ["01","06","12"]
 
@towc this is for a limited amount
 
9:34 AM
Any questions?
 
@JanDvorak :D I was kind of on the right track
thanks
it's still stupid how substr and substring are not the same thing
 
@JanDvorak ooo, that's cool
 
@towc it could have been slice here...
 
was going to try that next, yeah
but thanks
you saved me 10s of keystrokes
in the meantime I had already de-horribilized most oneliners
:/
 
441
Q: What is the difference between substr and substring?

Difference EngineWhat is the difference between alert("abc".substr(0,2)); and alert("abc".substring(0,2)); They both seem to output “ab”.

 
9:37 AM
my only issue was with the naming
I thought I was using substr when I was using substring
 
I confuse them, too.
I'd suggest sticking to slice
 
I only use slice: problem solved
 
To state an unpopular opinion, I think they should have had just one of the two
 
"unpopular" ?
 
You can derive one from the other and imho it creates confusion
 
9:38 AM
Add a range class to javascript, and modify the [] operator to accept it. Problem solved.
"hello world"[3..6] #=> "lo w"
"hello world"[3, 6] #=> "lo wor"
 
@JanDvorak that would work
 
I think Haskell has the best solution. A string is just an array of characters.
 
A string should really just be an extension of an array of characters
 
characters or bytes ?
 
Characters
 
9:43 AM
Characters
Where characters form an enum
 
UTF8 stored ?
 
Characters?
 
storage is an implementation detail
 
range based operations on characters arrays are very expensive
 
Range based operations on Haskell lists in general are expensive, that's why you don't do that.
 
9:45 AM
In go for example range based operations are on bytes, but you have functions to do rune based manipulations
(note that the authors of UTF-8 are also authors of Go)
 
Pointers are always the same size
 
There are generalized string types in Haskell, at least some of which can do stuff like fast random access.
 
Though admittedly, a more performant solution should exist
 
What do you mean ? That the string is an array of pointers to characters ? That looks... inefficient...
!!afk eat with the family
 
btw, nice solutions to change the color of a background image (say all black with transparent background, a normal icon) in a few lines of css?
 
9:47 AM
@DenysSéguret depends entirely on how you store those characters in memory
 
am I forced to need to have multiple images?
 
Haskell lists are linked lists.
 
If you're careful, the implementation can represent any character type and still be efficient, provided that the character encoding can't change
 
IE doesn't give a damn about filters :/
 
@JanDvorak I have to give props to Haskell. It may not be the most efficient language, but it is elegant
 
9:50 AM
@towc Then don't give a damn about IE
You could also use a canvas :-D
 
heh, it's a project for microsoft
 
There's a syntax specifically for IE that doesn't work anywhere else. HF
 
@JanDvorak would be really hard for most people here reading my code to have any clue about what happened with that XD
svg seems like a fair compromise
 
You could just use two images, like in the olden IE7 days
 
5 mins ago, by towc
am I forced to need to have multiple images?
multiple images have that DRY issue
 
9:53 AM
ImageMagick :-D
 
meh
another thing to add to the stack of any developer trying to maintain this
 
FontAwesome
 
I've been growing to the shouts of dyslexics at pages that use icon fonts
svg is good
 
No screenreader ever would think that &#xf062; means anything else than an up arrow or anything at all unless told otherwise
 
it's not screen readers, dyslexic people replace fonts to something that helps them read
!!google dyslexic font
cap's down again? :/
 
9:58 AM
not again, still
 
since when? 0.o
 
well then, tell them to not replace fontAwesome fonts.
 
tell granny to stop using IE
same problem
 
any phonegap genius around here that could take a look at this link? stackoverflow.com/questions/38696062/…
 
it aint ie any more, it's EDGE now
:P
 
10:09 AM
@svarog same thing
 
i'st more EDGE'y now
 
@Neil as usual, inefficiency can be either on memory or on CPU
I don't think anybody today would like UTF-32
 
10:27 AM
Does someone has a solution for this: It's about to create a global variable inside a object with functions, that can be used in the object itself, so I don't need to create in each object a variable like var root = this; to refer to this object. Is it possible to declare just one time root and use it in each function without declaring root overtime? More info: stackoverflow.com/questions/38656918/…
 
11:02 AM
Gotta love real-life units: kWh/d
 
@DenysSéguret when you have to pick, memory is almost always a better pick
 
11:58 AM
how can I do something like this
width:100% - min-width for a column
atm when I do width:100%, it throws my element to next line
and now this element which is thrown away is crying, would anyone care ?
 

« first day (2116 days earlier)      last day (2838 days later) »