« first day (1713 days earlier)      last day (3460 days later) » 

00:32
m.imgur.com/a/WxkZy new planters.
Those are adorable
@rlemon Why does one of them have a six-pack?
00:56
!!google turtle stomachs
after much time figuring out what problem i had (in this context only) it turns out i.e9 doesn't like the use of a certain function... i found a way around it but need a script to only run a bit of script if it is i.e9 like so ...
$('.fa-phone, .bg-darkPink').parent().on('click', function () {
      $('.submenu-ctn').fadeTo(0, 0);
      <<--IF I.E9 OR BELOW DO THIS THING--->>
$('#menu').multilevelpushmenu({
        Collapsed: true
    		});
      <<--END OF I.E9 OR BELOW THING ----->>
      $( '#menu' ).multilevelpushmenu( 'collapse' );
can someone help me out possibly ?
I am thinking from my google and SO research that i might be able to literally drop in this line outside the designated ie9 only script
<!--[if gte IE 9]><!-->the script  <!--<![endif]-->
will that even work ?
!!google js detect browser
01:04
yeah yeah i know how to detect browsers , can i put that shiz in the middle of code bits like in a script that is a sep .js file
all the articles i have seen point to it being before the header where it is i believe called a conditional statement
but i want it in the external js files i am calling
ideally in the way specifically i have described above
write a function
yeah i think that is a given , it's an if else surely but how would i drop that if gte ie9 shit in
@monners because he lifts bro
@havingagoatit there is no special syntax. just write code with conditional in it:
var ie9 = ....;
if (ie9) {
    $('#menu').multilevelpushmenu(...);
}
01:30
@FlorianMargaine Didn't wanna name him Batman?
@AwalGarg I was asleep :|
01:50
Guys why doesn't (i++)++ work? (i is some integer, say 0)
@uselesschien it does, it just happens once cause copies
If anyone is looking for a book recommendation; The Martian is really good. Great science and also pretty funny.
Of course, you all already knew this, because XKCD already recommended it, and Randall Munroe can do no wrong. But I thought it bore repeating, anyway.
@Retsam Neat, it's on my list
Currently reading Tangled Web
Oli
Oli
Hey guys, 2nd year CS student year starting to learn Javascript. I have a question about the asynchronous programming in NodeJS. I don't get how it's great that we create non-blocking function calls because we don't know when they finish.... Like in the middle of printing something in the main function, couldn't something random print to the screen because another function just finished reading a file? Of course, I'm sure there's more to this.
@ssube Nope.
I found it anyway
It doesn't work for the same reason `1++ doesn't work.
02:03
I really need to get better about reading serious things. Like programming books, and non-fiction. But sci-fi and fantasy are just so good...
@Oli the idea is that there isn't really a main function. You have your application running, and it responds to events and passes instructions to other asynchronous services.
the app itself shouldn't really do any work, that's what causes stuff to become 'blocking'
Oli
Oli
@phenomnomnominal Holy cow that's .... awesome...
It's a pretty powerful paradigm.
Oli
Oli
@phenomnomnominal mindblow.gif thank you. I can finally move forward with this asynchronous programming.
It's not a strict interrupt - just a list of things to do. If the event loop is doing something when your DB call returns, it'll add it to the queue
Also, welcome 'n stuff
02:07
Also, worth mentioning that it's still all single-threaded. Two pieces of code are never running at the same time, so there's no risk of something else printing to the screen while something runs.
Oli
Oli
@SomeKittens "Add it to the queue". Sorry for my lack of knowledge, but would a queue mean.. it's blocking?
@Oli yes. but just adding something to a queue doesn't block for long.
@Oli Think of it this way: You're pulling laundry out of the dryer when your roommate asks if you can turn the A/C on. You don't immediately drop the laundry, you finish filling the basket, then flip the A/C.
The new task was queued up - that is, you now have a mental note to do it when you finish the current task.
now, if this was all sync - you'd have to sit there and wait for the entire laundry cycle to finish before doing anything else
Oli
Oli
@SomeKittens I see. Thank you for your analogy
hope it helps.
02:21
@uselesschien 1++ cannot possibly ever do anything
it will always return 1
that's the beauty of post operators
03:03
font-size: 7px; - Thanks inDesign export!
!!> var foo = 1++; console.log(foo);
@monners "SyntaxError: invalid increment operand"
03:26
Can somebody please close stackoverflow.com/q/31040386/218196? (i commented with the duplicate)
Is it worth using react for things like filters, modals, etc or is it really only worth using react if you are making a big single page app?
@joshhunt: Personally I could not imagine writing any interactive UI without React anymore. But that's me...
But yeah, the benefits are bigger if the whole page is in React I think.
03:44
Right. Thanks for the info. Any other tips / info for getting into react?
The official docs are pretty comprehensive I think: facebook.github.io/react/docs/getting-started.html . The "Tips" section is quite interesting.facebook.github.io/react/docs/thinking-in-react.html is probably a good start.
Set up your build step properly so that everything gets recompiled automatically when you edit files.
I recommend to use Babel (babeljs.io) then you also get all the benefits of ES6
Do you recompile while developing or only for distribution?
Yeah I've been going through the docs and done the tutorial and make a couple of things just to see what it's like to use
Well, if you are going to use JSX, then you have to compile somehow, otherwise you cannot execute the code. Also, if you get in the habit of writing modules, then you need something to bundle them.
It's not the cleanest code I've written, but if you just want to get an idea of project structure and build chain, have a look at https://github.com/fkling/esprima_ast_explorer. It doesn't use Babel, but it make a big difference.
I usually use browserify and have a watch script in my package.json. I run "npm run watch" and it recompiles every time I save. There are even more advance techniques, but this one requires little setup.
*does not make a big difference
In the tutorial it was using "JSXTransformer.js" to interpret the JSX as you go, is this not what you do? (or am I mis-understanding it)
@joshhunt: That's only for quickly prototyping in the browser. Usually you want to compile your code before you send it to the client.
03:55
Right, wouldn't you compile at the end of developing rather than having to wait for the compile after every save?
browserify only recompiles what changed. It's super fast.
I think it would a bigger hassle to setup a page that includes JSXTransformer and does in browser compilation.
The way I do it, I don't need an extra HTML page, I simply switch out the single JS file that contains all JS code.
The only difference between prod and dev code is that prod is minified.
(in my case)
Of course that might not work for everybody... but it works in my case :)
ok thanks, its good to know how other people work.
I also try to stick with very simply build tools. npm + Browserify + Babel + some custom transform scripts usually suffice.
grunt and gulp can certainly be useful, but I would start simple and only add complexity to your build chain if there is no other way.
Just my personal opinion after using grunt and gulp for a while.

But again, every project is different and has different requirements / constraints.
makes sense
04:20
see the JSX / Babel / Webpack template linked on the side -->
05:04
devdocs on node seems like lot of work :( the core scraper is 10 lines, the angular and backbone plugins are thrice the number of lines. :(
@AwalGarg night
@argentum47 40 lines is still ok to write
@argentum47 morning :P
@argentum47 wait are you really sleeping now? o.O
@AwalGarg will show you when I get back home. but I am happy that its not working atleast I am busy. ow, no I am not sleeping, I already slept like 3 hours.. :D I have managed to get the sidebar half complete, I am still troubled with the actual content part.. angular was easier .. ;(
@argentum47 haha. also "3 hours" sounds too much eh? :P
@AwalGarg I also missed the gym .. :( that is what I regret
I wrote a jquery like nextAll prevAll and then in the end used jquery :( that took up most of the time
This is pretty interesting:
var fun = Object.defineProperties(()=>"foo", {
  valueOf: {value:()=>"bar"},
  toString: {value:()=>"baz"}
});

console.log(fun(), ''+fun, String(fun)); // foo bar baz
2
05:12
''+ uses valueOf???
This is terrifying
but also useful
how should i import twitter bootstrap css into requirebin?
@vamsiampolu find a CDN link and put it in the <head>
Hello all
valueOf: { value: function value() {
      return "bar";
    }
};
// why does it have to be value:
05:17
is it possible to find div which have no class and id
i have many divs which have class and id i want to get div which have no class and if through jquery
ok,head is not responding to my click
@MuneemHabib wow! something like $('.parent').children(':not(classname)') works?
So objects in javascript are mutable or immutable?
I believe they are immutable
google says the same
but still asking here
because of new ES6 and ES7
@argentum47 nops
05:23
@Mr_Green mutable
@MuneemHabib gimme the dom in jsfiddle maybe ..
were the objects already known as mutable? @AwalGarg
or from es6 or 7?
always
shit.. I know the concept but have no idea about the meaning of mutable or immutable
soo, you don't know the concept
05:25
mostly, units are immutable
i want to get item with no classname
I know the concept that objects are stored based on reference
so they are called "immutable" (but I got now that it is known as "mutable")
no?
if you can call any method on an object and change that object (not just return a new object), then it is mutable
05:27
@Mr_Green: var arr = []; arr.push(1);. arr was mutated and now contains the element 1. If arrays were immutable, arr.push(1) would return a new array and leave the old array untouched.
Primitive values are immutable. Any operation you perform on them result in a new value.
var a = { "name" : "hello"};
I can't resist bread.
var b = a;
b.name = "hey"
a.name // "hey"
scala does this actually
^ this is known as mutable right?
05:28
@Mr_Green javascript passes everything by reference copy.
when you add an item to an array, you're really creating a new array head that contains the new value and a pointer to the old array, so the old array doesn't change
Uh, not really. This is mixing that fact that objects are represented by references.
with mutable objects
Mutability is only about values, it is independent of variables or how values are passed.
technically we're always talking about pointers, so you could say they're "immutable" pointer references
But nobody thinks of it like that.. you're modifying the underlying data that the pointer points to
Again, primitives are immutable. Every operation on/with them produces a new value. Objects are mutable. Not every operation on them produces a new value, e.g. arr.push(...).
...mutates the array, it does not create a new array
In object-oriented and functional programming, an immutable object is an object whose state cannot be modified after it is created. This is in contrast to a mutable object, which can be modified after it is created. In some cases, an object is considered immutable even if some internally used attributes change but the object's state appears to be unchanging from an external point of view. For example, an object that uses memoization to cache the results of expensive computations could still be considered an immutable object. Immutable objects are often useful because they are inherently thread...
what is it called when functions which modify an object don't return anything, as to not have any methods with side effects?
is that called a "pure" function?
or maybe I'm confusing myself with a function that is deterministic
05:32
@Neil yep
my understanding was completely different. I think it will take time to erase my memory about this and re-read the docs
Thanks neil, felix and awal
deterministic means it will always return the same result, given the same inputs
I wrote a long analogy to help you but ok :P
right, so maybe a "pure" function means a function that is deterministic
05:33
@MuneemHabib jsfiddle.net/WDx3M/33 :(
@Neil: mutating an object inside a function sounds like a side effect to me...
@FelixKling it's not a side effect if that is its only purpose
function notDeterministicButStillPure (x) { return x + Math.random(); }
Yeah, that's why I'm not super convinced about what I'm saying ;)
then its pure if it doesn't change the state?
05:35
If it doesn't return anything then it is rather a "procedure"
In a mathematical sense a "function" produces the same output for the same input.
In computer programming, a function may be described as a pure function if both these statements about the function hold: The function always evaluates the same result value given the same argument value(s). The function result value cannot depend on any hidden information or state that may change as program execution proceeds or between different executions of the program, nor can it depend on any external input from I/O devices (usually—see below). Evaluation of the result does not cause any semantically observable side effect or output, such as mutation of mutable objects or output to I/O devices...
> Evaluation of the result does not cause any semantically observable side effect or output, such as mutation of mutable objects
of course, Wikipedia can be wrong too...
> then its pure if it doesn't change the state?

That sounds about right
@argentum47 thanks
it works
var str = "hello";
str[2] = "c";
str;   // "hello"
^ this is mutable right?
Did str change?
that's immutable
05:41
not change => not mutated => immutable
Strings are primitive values. Primitives are immutable.
ohh.. now I got to some level understanding:D
mutable = change, immutable = not change
Basically yes.
Mutable values can change, immutable values cannot
Arrays can change, you can add and remove elements
yes
so strings are immutable and objects are mutable
However you can also have an immutable version of arrays. Adding and removing elements would not change the array itself but create a new array.
(theoretically, JS does not have immutable arrays)
05:45
But libraries such as facebook.github.io/immutable-js provide implementations for immutable collections.
Most people don't talk about why you should even care if an object is immutable or not
.
!!> var a = [1, 2, 3, 4, 5]; var b = a.concat([4, 5, 6]); console.log(a); console.log(b);
@phenomnomnominal "undefined" Logged: [1,2,3,4,5],[1,2,3,4,5,4,5,6]
@FlorianMargaine Congrats! Pictures?
05:47
if an object is immutable you're guaranteed that your reference to that object will never change
That means you can cache it if you want
Immutable values make your application easier to reason about. Imagine I have

var arr = [42];
someThirdPartyFunction(arr);
console.log(arr);

Quiz: What is the content of the array?
Or you can pass it to someone using your library and not have to worry about them destroying the object or having to make a copy of it
@Neil: It doesn't have much to do with references, but yes to the second part.
@FelixKling it is the answer to everything
empty array?
05:48
The answer is that we don't know because someThirdPartyFunction could be adding or removing elements.
That's not a problem with immutable values
@FelixKling Well in a sense, "immutability" is the property that allows references to objects to be treated like primitives in that their value is unwavering
a reference to a mutable object must be treated differently than a primitive or immutable object, in general
I'm not convinced that it does, but I think I see your point.
In c++, they just used keyword const
I kind of miss that..
Add const to a function input parameter and you couldn't change it
var arr = [1, 2, 3];
function changeArr(arr){
    arr = [1,2];
}
changeArr(arr);
console.log(arr);
// [1, 2, 3]
you could only call functions and other members on that object that had const in its declaration
05:51
@Mr_Green: That has nothing to do with immutability. That's only related to how values are passed.
Pass-by-reference vs pass-by-value
@FelixKling but according to this.. I should still get [42] right?
In my example?
yeah
No
Imagine the function did
you have a pointer arr passed in.. the pointer lets you change what is passed in, but if you reassign it, then it simply points to something else
05:52
function changeArr(arr){
arr.push(21);
}
you haven't changed anything
Here changeArr pushes a new value to arr.
That works because arrays are mutable.
it isn't that arr is immutable in the function.. its that "arr" in the function is the parameter, not the variable arr outside the function
yeah it is changing
Since it is a pointer, you can change the data of arr, but you can also change where the pointer points
05:54
Again you have to differentiate between a variable and its value.
it helps to have a good understanding of how pointers work
Values can be mutable or immutable. Variables can writeable or readonly (const). Then the question is also how objects are represented (in JS as references).
though I imagine it can be quite confusing if it's never come up
all variables and parameters that aren't primitives are pointers
in C++, you had to access it using ->, but in languages like javascript, that's abstracted away for you
@Neil: That's the thing, how do we know that primitives are not represented as references as well?
We'd have to look into the engine how it's implemented
@FelixKling we don't know, you're right
Though technically all of it is script.. we're not seeing how it is implemented in the imperial language that actually executes it
05:58
@FelixKling thanks. though you explained it very well. It seems I am quite lack of basic knowledge on javascript. I need to first learn that. again thanks for your time and patience :)
in other words, if you do "var a = 'pluto';" then it may be checking in a hashmap for a variable named "a", and if it is there, it reassigns it to "pluto", otherwise it adds it
But all this is under the hood so to speak.. it isn't what you see, but it is what it is doing
in the imperial language in which javascript is implemented (I'm guessing C++), pointers are being used

« first day (1713 days earlier)      last day (3460 days later) »