« first day (600 days earlier)      last day (4351 days later) » 

1:00 PM
@FlorianMargaine lol
It wasn't anything too complicated actually
the effect is pretty easy to pull off but looks so cool
 
which means you're awesome, ofc.
 
@Loktar was that you in reddit
 
@Esailija yeah
 
almost crashes my browser btw
 
was wondering if anyone from here would see it in the js subreddit
@FlorianMargaine yeah runs like crap here too.. runs awesome at home though
 
1:01 PM
@Loktar its slow, optimize it
 
why does this chat use 200mb of memory
@Loktar I check javascript reddit sometimes
 
@Esailija why does every chrome tab use 200mb of RAM
 
when I'm bored
@Raynos not even my media player uses 200mb with 16k songs loaded in it
 
it has like two dom elements however
 
javascript developers suck at memory management
 
1:02 PM
tbh I might be reading it wrong
 
mainly because they are noobs
 
^
 
we are all noobs. Welcome to noob land.
even @Loktar can't write a performant smooth demo :(
 
ultimate guide to memory management = don't use closures and unbind your events
 
even @Raynos can't write a blog that doesn't leak 1MB of RAM every request
 
1:03 PM
hmmm
 
haha
 
node.js memory management = use cluster and recycle the processes every few hours
 
In fairness it ran perfectly at home. Prob due to me having HW/accl on at home for canvas
 
recursive function ftw
who's up for "count the number of nodes in an html page"
 
1:03 PM
Now im determined to speed it up! :P
 
doooood it tottalllly izz awsomezz
 
LOL that sites hilrious
 
spedz up my websitez likk forty timezz
man it is so hard to talk like that
 
Im going to download 4 gigs right now!
 
@Esailija one shouldn't need to recycle
 
1:05 PM
you actually have to think of how you will screw up the word.
 
@Raynos true but it's the easy way out
 
@Esailija hell's yeah
 
in browser you actually have to know your shit
 
:o
 
@Loktar I love the
> * 4 GB ( 2 x 2 GB )
picture shows 4 sticks.
 
1:06 PM
:o
 
@rlemon obvouisly 2GB is the 2GB deal which is two sticks
so it means 2 x set of 2GB which is 2 x 2 x 1 GB
 
alright i m off to study .
cya
 
Since I downloaded more RAM, I immediately returned the RAM I bought just the other day from my local electronics store, John's Electronics. The customer service there was great and they did not give me a hard time at all! If I ever have to buy another piece of electronics equipment I am definitely going to John's Electronics. That's John's Electronics, for all your electronic needs.
- Anthony (John)
I love bored programmers with a sense of humour
 
if return error {
    retry operation with --force
}
 
"Now works with iPhone!"
 
1:11 PM
hey @rlemon, whats the solution to get window.onload = loadScript(); to work in IE8? I got this code to "async load gmaps"...
im getting a "Not Implemented" error
 
I get referenceerror, loadScript is not defined
 
lol
 
>_>
 
does $('*').length count the total number of nodes?
 
1:12 PM
shall i define it for you =P
 
that might help
 
total amount of elements
 
are you sure the error is onload and not the function
 
@FlorianMargaine -.- document.all.length why you no pro
 
yeah, elements
 
1:13 PM
window.onload = function() {
    loadScript();
};
 
oh, never think about document.all :D
 
`function loadScript() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '//maps.googleapis.com/maps/api/js?sensor=false&callback=init';
document.body.appendChild(script);
}
window.onload = loadScript();`
 
@rlemon or window.onload = loadScript;
 
wtf is with SO chat not parsing multiple lines as code >_>
 
document.getElementsByTagName('*'); ??
@Mike because you need to use fixed font
CTRL + K or the fixed font button that appears as soon as your message goes multi line
 
1:14 PM
function loadScript() {
    	var script = document.createElement('script');
    	script.type = 'text/javascript';
    	script.src = '//maps.googleapis.com/maps/api/js?sensor=false&callback=init';
    	document.body.appendChild(script);
    }
    window.onload = loadScript();
garble garble
thereee we go
 
google has around 300 elements
SO chat has around 3k
 
that is same as saying window.onload = undefined
 
lol, i need to find the site that provided that example then, and tell them to fix it.
 
you want window.onload = loadScript;
 
does that even provide "asynchronous loading".. the goal is to stop Gmaps from interrupting the flow of the DOM load.
 
1:16 PM
@Mike what does loadScript return?
 
Good morning all
 
and I mean return
 
it returns undefined
 
^ this
I'm trying to have you understanding why the code didn't work
 
right
because theres no return line or?
 
1:17 PM
exactly.
 
why doesn't @rlemon example break then @FlorianMargaine
is it because he left off the ();
 
window.onload = loadScript(); // i execute loadScript
window.onload = loadScript; // I am the variable (named function) containing the script you want to execute on load.
 
AHHHHHH
 
console.log(loadScript);// shows the code
console.log(loadScript());// shows the return of the function (undefined, you return nothing)
 
1:19 PM
#1, execute and set the returned value to window.onload? #2, just run the script onload. right?
 
explains it a bit better?
 
yeah it does
 
it's actually quite a common mistake to make (once then never again) :P
 
so in simple terms, if i want to set a var = the returend value of a function then use (); but if i just want to execute the function dont use ();
 
always remember (with a few subtle differences)
function foo() {

}

is just another way of writing
var foo = function() {

};
the difference:
foo(); // yo
function foo() {
   return "yo";
}
 
1:21 PM
String, this.str = "lo"; typed property
 
foo(); // error
var foo = function() {
  return "yo";
};
 
ahh
developers.google.com/maps/documentation/javascript/… looks like they did write it right.. i just re-wrote it wrong =P
 
1:39 PM
yeah, I don't think google gets this wrong
 
[] + {} // '[object Object]'
{} + [] // 0
Why?
 
why not
 
That's not how programming languages work, I think :)
 
@ŠimeVidas read the rules of the + operator
 
@Raynos It just calls ToPrimitive on both operands...
 
1:44 PM
{} + [] is an empty block and +[]
[] + {} is an array and object
 
Aha...
 
({} + []) is an object and array
if {} can be seen as block, it will be seen as block
{aids: true} is a syntax error
wait
 
Waiting...
 
it needs to have more items
since that can be treated as label
{aids: true, second: false}
that's a syntax error for sure
the first one was a block, label and true
 
Ah, JavaScript, I love you -.-
 
1:46 PM
the second one is syntax error
the third one is object literal ({aids: true, second: false})
 
Yup! I totally missed that it was interpreted as a block statement....
 
so you can only do object literal in an expression context
do you see how similar this is to (function(){})
where as function(){} naked is a syntax error
 
Funny how {} + [] doesn't throw because of ASI (which is another bad part)
Yes, expression statement cannot start with function or {. Common knowledge :P
 
where would it ASI anyway, after the [] ?
 
Right after {}, wouldn't it?
 
1:50 PM
this is the same reason why {}.toString.apply( arr ); doesn't work
@ŠimeVidas ASI inserts a semicolon after a line break
 
@ŠimeVidas It would not error because + works unary
 
@FlorianMargaine But {}+ is a syntax error...
 
!!> {};+[];
@Esailija 0
 
should it insert it when I do var s = {}.toString.apply( arr );
 
var s = expression
 
1:51 PM
@ŠimeVidas of course, so why should ASI insert a semicolon?
 
@FlorianMargaine No, that code's OK
 
you can do var s = function(){}()
 
ASI inserts a semicolon on line breaks
 
no need for the extra parentheses
 
@FlorianMargaine To prevent the error....
 
1:52 PM
people very often do var s = (function(){})()
where as var s = function(){}() is just as legit
 
where it breaks, is that sometimes it doesn't insert the semicolon
 
Oh, Jesus, are you going to make me read the ASI rules again... ? :P
 
example:

var s // no semicolon inserted, thus it takes the next line as an argument
(function() {}())
ASI's not there to prevent syntax errors, it's just there to keep you from adding semicolons
there are some edge cases though
 
@FlorianMargaine Here, a semi-colon is not inserted because that code doesn't throw in the first place
 
1:54 PM
edge cases: when the next line starts with: (, [...
var s // semicolon inserted.
!function() {}()
 
@FlorianMargaine {}+[] becomes {};+[] according to rule 1 of ASI
 
> "Omitting semicolons is not a good programming practice; you should get into the habit of inserting them." - Flanagan, David, JavaScript: The definitive Guide. p. 16.
 
The + is an offending token
Or is it not?
 
so var s = 1 + 3 becomes var s = 1; +3; ?
remember, ASI is all about line breaks
 
1:58 PM
But + is not an offending token in that case....
 

« first day (600 days earlier)      last day (4351 days later) »