« first day (402 days earlier)      last day (4546 days later) » 

12:00 AM
addy osmani
 
user1385191
LOL
 
please, do tell ;)
 
user1385191
his page has 100 markup errors
 
:/
 
user1385191
I figured since there was an h1 inside of a p tag that something was wrong
 
12:00 AM
addy osmani is an interesting chap, hes pretty good
but god damn does he target the hurr durr jQUery crowd
@CaseyYee most patterns are bullshit
I say write modular code. EOF
 
can i probe you all for recommended reading? i've got Javascript Design Patterns by O'reilly and this is not unlike the links i've posted
 
user1385191
holy crap, he doesn't even know how to write nested lists
 
Also this hurr durr "MVC everywhere" bullshit
@CaseyYee the good parts.
Only book worth reading
 
@Raynos that's what i'm trying to aim for, i just don't have peers here to steer me in the right direction. so i have to kind of wing-it.
 
user1385191
12:02 AM
<ol>
	<ol>
		<ol>
			<li>Hey, I'm not very good with HTML, but I use the HTML 5 doctype since it's new and shiny</li>
		</ol>
	</ol>
</ol>
 
user1385191
seriously, that kind of crap is in the source code
 
@Raynos what about frameworks like backbone.js?
 
that is MVC'ish
 
@CaseyYee I'm in two minds about them
I say use them if you dont know what your doing
 
12:03 AM
lol @MattMcDonald
@ray
 
Once you know what your doing write modular code
 
@raynos i don't lol
 
However I can say in a pure manner, meh you dont need them
The thing about those libraries is that they give you structure.
If you dont know how to structure things yourself then use them
If You know how to structure things, i.e. write modular code then dont use them
 
i have a bad habit of writing spaghetti, so i was hoping to find some kind of guidance to clean the mess up
 
Id recommend spinejs over backbone though \o/
 
user1385191
12:05 AM
don't forget the key to solid web work: great HTML
 
My guidance is refactor
Really though you need a module loader
 
im confident in my HTML
 
something like requirejs or browserify
 
no so much in my JS
 
user1385191
@CaseyYee mind if I quiz you?
 
12:06 AM
yes, i have looked at other async loaders, but i figure thats the next step after i figure out the tangles of code i have
yes please @Matt
 
user1385191
why will that nested <ol> snippet throw markup errors?
 
because a ordered list requires list items? besides that, the text does not fit the definition of a list item
 
user1385191
former is correct
 
user1385191
when using nested lists, one must encapsulate the nested list in a list item
 
user1385191
next question
 
12:09 AM
:)
 
user1385191
why does this throw a markup error?
 
user1385191
<p>
	<h1>Title</h1>
</p>
 
heading does not fit into the definition of a paragraph
 
user1385191
this error transcends headings
 
h1 should only be used once in a document as well
im not sure that i follow @Matt
 
12:12 AM
@MattMcDonald most people dont know this
 
user1385191
why does a heading not fit into the definition of a "paragraph"?
 
user1385191
I only found it out a few weeks ago :)
 
p is a paragraph of text, so why would you put a heading into a paragraph of text? it makes sense that it would need to be outside of the paragraph somewhere
 
user1385191
you're close enough that I'll drop the answer
 
i think we are saying the same thing?
 
user1385191
12:13 AM
> The P element represents a paragraph. It cannot contain block-level elements (including P itself).
 
hehe, my definitions are not so good lol
 
gotcha
 
user1385191
I tried to wrap a blockquote in a p tag and wondered why I got an error
 
user1385191
then I read the spec and it all made sense
 
12:15 AM
@MattMcDonald why u link html4 :9
 
user1385191
you know why
 
Tell me why, also, next question ;)
i want to answer at least 1 fully correct for you
 
user1385191
oh, boy
 
user1385191
the design patterns page has multiple h1 tags
 
@MattMcDonald The block element vs. inline element distinction no longer exists in HTML5 if I can remember correctly
 
user1385191
12:17 AM
it still invalidated when I tested it against an HTML 5 doctype
 
forget the markup, besides that, is the patterns at least good code?
 
@YiJiang I cant find that distinction myself
 
@MattMcDonald Yeah, of course, just that the definition is now different
 
as far as modularity is concerened
@Raynos thanks for the recommendation on the book, ill pick it up
 
user1385191
I have to leave work, so that's it for me
 
12:19 AM
@YiJiang >_<
 
Thanks @Matt
 
<p><div></div></p> might be a parser error
because <p> is allowed without a closing tag
 
user1385191
I'll just ask you what the difference between <pre> and <code> is
 
@CaseyYee the patterns are ok. Some of them are a bit over engineered
 
Hehe, here's an old one - what is the <address> tag used for :P
 
user1385191
12:21 AM
yeah, you're right about the parser I think
 
<code> is more semantic , <pre> is pre-formatted text
 
user1385191
but it throws for headings
 
@YiJiang email address? >_>
I see
thats a useful element to know
 
@Raynos, if its not patterns, what should i learn?
 
@CaseyYee you should be writing code
 
12:23 AM
@Raynos, i do, but its not good code.
 
Hey. What does this mean:
 
i know i can do better with some structure
 
Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
 
@CaseyYee then write structure :\
but patterns are useful to be honest
you should read them
 
@JoeyMorani <canvas> cannot take images from other domains
 
12:24 AM
@JoeyMorani, you cannot get cross origin image data unless they have a CORS policy that allows it
 
you should read a lot of things
and then practice
 
Ahhhh
Okay. Thanks peeps
 
Or rather, you can't get the data out from the canvas again if you 'taint' it with images from other domains
 
Hmm. I'm using a local image. "test.jpeg"
I'll try it online
 
@Raynos, Thanks. i just want to be smarter about how i learn thats all. i feel that i've gone through a lot of trial and error without much progress. It doesn't help that i'm essentially solo in learning this stuff
 
12:26 AM
A mentor would help
You know some code review would help you
 
i can get work done and deliver on everything, but i dont feel my code is as clean and organized as it should
Yes, i could really use a mentor
 
I was reading some html5 after seeing someone mention about block vs inline, and they are kind of correct w3.org/TR/2011/WD-html5-20110525/… ... plus I see what they mean by over-engineered.
 
i think i rather have over-engineered then different interpretations of the same thing
but on the other hand, i think that is why xhtml was never really a hit?
 
Ahh, okay. It works great online. Not getting that error.
Thanks again.
 
@craniumonempty whats overengineered?
 
12:32 AM
another way to say "well thought out" like it's a bad thing
 
No I mean
What is overengineered
 
oh, oh... html5
 
What are we talking about, that you think is over engineered
html5 is over engineered, how loeveling broad
 
I was agreeing with another comment that pasted by me on this page
I tend to read way more than I actually do
btw, I didn't know my speakers were on, and that scared the crap out of me
the @Raynos
thing
lol, what's the use of deleting, if it doesn't go away.. guess it's better to not delete in that case
 
1:05 AM
0
Q: Object map() / transmute() method

jAndyI'm somewhat curious on peoples opinion about such a method. I Actually didn't find anything similar in librarys I use on regulard bases so far. This is my implementation: Object.map = function _map( obj, transform ) { if( typeof obj === 'object' && typeof transform === 'function' )...

 
1:20 AM
is anyone here?
 
Sort of
 
By jove
can you please help me understand this?
I've tried everything and I just CANNOT get this Facebook login to work on my site
I had it earlier, but Chris recommended I use the Javascript SDK. At the time I was using the Graph API and it was working fine but there was one issue I had to work out
 
What, exactly, don't you understand about it?
 
The general concept
I'm including the SDK
and the login button shows up just fine
but after that I'm completely lost
here's what I need:
1. user authorizes app on first usage
2. when the user is logged in, access token and user id are used to retrieve user's events using graph api
3. events are stored in a javascript array
can you wrap your head around doing this based on the JS SDK docs?
i know of another way to do this, but i need a way to store access tokens after the first authorization
which, alas, I don't have
And sorry if I seem like I'm begging or something, I'm only 14 and trying to learn this stuff soon. :P
 
Hmm. Let me see.
 
1:39 AM
This is so exhausting
 
Well, I don't know if This will work, but it's worth a shot.
The documentation is actually pretty good. It literally describes the login process, as well as getting info from the Graph API via JavaScript.
That, of course, doesn't actually function, because I haven't included the API, and I haven't set up a "content page"
 
what do you mean content page?
 
Sorry, that should have been "channel file"
 
1:54 AM
i see
okay, let me define the hidden class here...
oh wait, i still need the FB.init don't I? :P
 
Yep :-)
 
0
Q: View_messages "class"

stack.user.0/** * View_message * Object Model */ var View_message = function(div) { this.div = document.getElementById(div); }; View_message.prototype.messages = { empty: 'Please complete all fields', empty_bm: 'Please enter both a title and url', name: 'Only letters or dashes ...

 
@RyanKinal: Still not working :(
Here's my page:
 
Move the code I gave you into the window.fbAsyncInit function
...
cookie     : true,
            xfbml      : true
          });

          // my code here
        };
Any progress?
 
2:11 AM
0
Q: How to scroll hex tiles?

Chris EvansI don't seem to be able to find an answer to this one. I have a map of hex tiles. I wish to implement scrolling. Code at present: drawTilemap = function() { actualX = Math.floor(viewportX / hexWidth); actualY = Math.floor(viewportY / hexHeight); offsetX = -(viewportX - (actualX * he...

 
@RyanKinal Sorry, I was at dinner. Should I include the (function(){ inside the window.async?
 
Nah, you can ditch that part, I think
 
What about $(document).ready()?
 
I HEARD THERE WAS A CHATROOM SO I CAME TO CHAT
 
@Purmou I think the fbAsyncInit takes care of that, but I'm not entirely sure.
@tipu SWEET I HRD U LEIK CAPS LCK
 
2:19 AM
those are baseless rumors, and i won't stand for them
 
hehe
 
@RyanKinal That also did nothing =/
The login button is still there
 
I clicked it. And gave permission to your app. And then I got an Object in the console. Looks like it worked to me.
 
hm
oh, wait
hidden class is undefined
heh
 
You may also want to set loginButton.className = 'hidden'; when the login succeeds. I neglected that bit.
 
2:25 AM
@RyanKinal You rock man! :D
Now I hate to ask you for one more favor, but I'm not too good at this part either
 
lol
 
Do you know how we could convert the events JSON object to a javascript array containing only the event titles, start/end times?
 
That's just going to be some iteration over response.data - I think you can figure that out.
 
eek, iteration--you mean a for loop? :P
all right, i'll try and figure that out myself
better that i learn it ayways :P
 
Yes. Yes it is.
 
2:29 AM
RT @w3c: From hypertext to hyperdevices http://ow.ly/1fLgqj
 
@RyanKinal How about I post a question, you answer it, and I upvote+accept it, cause you deserve that rep
 
Meh. Rep is overrated.
 
Haha
I like that :P
Thanks again man, you just saved a life XD
 
No problem
 
2:53 AM
0
Q: JavaScript: scroll position (Webkit engine)

JulienI'm currently trying to use JavaScript to find out how far down the page the user has scrolled; for Firefox 8.0, the keyword is pageYOffset. To say things mechanically: The page has a certain height. In Firefox, the useful object is document.documentElement.scrollHeight. The browser's visible ...

 
3:34 AM
I am writing Greasemonkey script for google plus. What event trigger can be used to know that new post is available in circle or stream? I tried to use document.addEventListener("DOMNodeInserted" ..) but its going in infinite loop.
 
Use setInterval to run a function that counts post numbers each time. if it's higher than last time, you know a new one has been added
well, first you'd count the posts on every page load
 
Thanks a lot. I will try it now.
 
Of course this won't detect immediately if there are new posts
 
If something gets added into the DOM during the event handler for DOMNodeInserted it can go into an infinite loop
 
But you can set it to go off every 5 seconds or so, in which case it will be ALMOST instantaneous
 
3:44 AM
How to set it off after particular interval?
And I added following setTimeout ( "addDecryptButtons()", 1000 );
but its not getting fired
 
setTimeout ( addDecryptButtons, 1000 );
 
hello
nquery is almost to 300 followers,woo
and i started on a new page
 
@vaichidrewar setInterval(); fires it multiple times
setInterval("getData()",5000); fires getData() every 5 seconds
 
Yeah
i wanted to know how to set off the DomNodeInserted listerner as u suggested
and
 
3:55 AM
who knows fullCalendar here?
 
Are 1 and 2 same? 1) setTimeout ( addDecryptButtons, 1000 ); 2) setTimeout ( "addDecryptButtons()", 1000 );
 
@vaichidrewar The second one evals the string you pass to it. Don't use that. Use the first version
 
1) passes a function reference while 2) passes javascript code to be evaluated in global context
So 2) is useless, slower and harder to write :)
 
4:13 AM
Thanks Yi and Esailija!
Permou suggested to set of DOMNodeInserted after particular interval to avoid the infinit loop. How can i do that?
 
Is there a way to write Javascript FROM a for loop?
this is my code:
var lengthcheck = response.data.length;
	var eventsarray = new Array(data:[for(i=0;i<lengthcheck;i++){
					 {'title':response.data[i].name,'start':response.data[i].start_time,'end':response.data[i].end_time},
	}]);
Probably a terrible approach, but can you guys tell what I'm trying to do?
I'm trying to write an array from a for loop
know what, i'll just ask a question
 
I cannot tell what you are trying to do, response.data is already an array?
 
yes, response.data has name, start_time, end_time
at least, those are three I want to pull from it
 
ok sec
 
and I also need to make them title, start, end
so name = title, start_time = start, end_time = end
and values for these stay the same
so if name = blah, start_time = 20101010, end_time = 20101011, then I want this:

new Array(data:[{'title':blah,'start':20101010,'end':20101011}]);
 
4:25 AM
if( lengthcheck ) {
var eventsarray = response.data.map(
function(v){
return {
title: v.name,
start: v.start_time,
end: v.end_time};
}
);
}
console.log( eventsarray );
omg I lost indendation
 
can you clean this? I want to see the output
 
see your console for the output
 
I LOVE YOU
 
some browsers dont have .map but there is code to provide it
 
does chrome have it?
well, obviously, because it worked for me
heh
 
4:33 AM
@Raynos a few indentation errors
 
well, all i need it to work on is chrome because this is for a chrome extension
 
var Cat = pd.make(Animal, {
 
@Purmou in that case you don't need to provide it :P It's mostly older IE that don't have it
 
@Raynos this style looks improved though, i would almost use it
 
How to get the text from all the children text nodes in Javascript?
 
 
1 hour later…
6:04 AM
posted on November 22, 2011 by Vasilis

CSS box-shadow Can Slow Down Scrolling – Airbnb Engineering Interesting to see that performance can be of influence on design. In this case it seems like a good decision: a page becomes unusable on some devices because of a box-shadow. A smaller one resulted in better performance and a slightly different but satisfying design. Now, what I want to know is: is the scroll issue caused by t

 
6:31 AM
0
Q: Please review my web page

NickeHere is a screenshot of my web pages I generate with google app engine python 2.7 + Jinja2. Please tell me if you see anything strange with my material. The backend is: class NewAdHandler(BaseHandler, I18NHandler): def get(self, id, html): ad = Ad.get_by_id(long(id)) if ...

 
Ron
7:18 AM
I got two lines that use the same element

$('.rc-bot-i') ....
$('.rc-bot-i') ....

I cant join them to one line because in the end of the first line i use .not(':hover')... is there a way to do something like that:

$('.rc-bot-i').function(
{
$(this)....
$(this)....
});
 
Sam
7:43 AM
@vaichidrewar wt $(parent).text(); - this will give all the text concatenated without any of the HTML tag.
 
 
1 hour later…
9:08 AM
var foo = $('.rc-bot-i')
foo.bar() foo.moo()
 
Ron
will it be faster than $('.rc-bot-i').bar() $('.rc-bot-i').moo()?
 
it will be faster than that
 
@Ron , have you actually tried to learn javascript ?
 
Ron
not micro minify
 
noone is talking about minifying anything here
 
Ron
9:20 AM
I asked my question because I want to minify my code and to reduce functions processing time
 
you just seem unaware of what exactly is done when you execute $() , or hoe expensive the operation is
minification doe not reduce processing time
 
@tereško he's doing what you asked him about
 
@ThomasBlobaum huh ?
 
Ron
I know but when I keep the element in variable, I can use one-char-variable and it will minify my code. Thats why I asked what will be faster 2x $()... or 1 var 2x executes to reduce the proccessing time too.
and Apparently I am un aware of what exactly is done when I execute $(). never dwell on it
 
tell me , how large is jquery.min.js ?
 
Ron
9:24 AM
91.8kb
 
do you know that each time you execute $() , you create an object which contains all (or so close to "all" that it does not matter ) of that code ?
 
still not quite, but it does take some time
 
Ron
that surprises me, you say that document.getElementById() faster than $('#id')? I dont think so...
 
lol
test it
 
then you are trolling @Ron
 
9:27 AM
@ThomasBlobaum , do you remember the benchmarking page for javasript code ?
 
jsperf?
 
yeah , that one
@Ron , write a test : jsperf.com
 
yea, go be a programmer
 
f0x
9:40 AM
rofl, this place never ceases to amaze
 
yes, document.getElementById() is faster than $('#id')
 
Ron
yup, jquery is 80% slower. but what do you suggest? to start and build everything I need by myself?
 
you could start by reducing the instances when you create new jQuery objects
and in the future , do not use jquery , just because you need a dropdown menu
 
f0x
ie. var $object = $('#id'); $object.xyz(); instead of $('#id').xyz();
 
@f0x , do not create stuff in global scope =P
 
f0x
9:46 AM
hah :p
 
@Ron , usually you use jquery for 3 different tasks : selecting dom elements , making XHR request and creating animations
 
xhr is weak sauce
 
as you might already notice , jquery kinda suck at th first one
 
Ron
for example to change this
$('.button').hover(function()
{
$(this).toggleClass('button-over');
});

into this

<input type="submit" value="Search" class="button" onmouseover="newfuncover();" onmouseout="newfuncout();"/>
<input type="submit" value="Subscribe" class="button" onmouseover="newfuncover();" onmouseout="newfuncout();"/>

or to this?

function onMouseOverOut(class)
{
var elList = document.getElementsByClassName(class);
for (var i=0;i<elList.length;i++)
{
elList[i].onmouseover = function() { newfuncover(); };
 
XHR is minor thing and can be easily written by hand
 
Ron
9:49 AM
I use jquery for animations & ajax.
 
and animations .. well .. jquery actually suck at them too
 
for better animation mootools is best
 
.. or you could find something in microjs.com ( though mootools has the best animations from "big" frameworks)
 
for example to change this
$('.button').hover(function()
{
$(this).toggleClass('button-over');
}); instead of writing this you can do the samething in css
 
and , @Ron , read about event delegation
you should not attach event to each element
instead you attach it to the container , and catch the events as the "bubble up"
 
f0x
9:51 AM
say it with me ya'll delegate!
 
Ron
manny this is bad example, in other hover functions I use animations which I dont want to do in css.
 
css will 100% faster than your jquery code
ic
then you can go ahead
 
@ThomasBlobaum what style?
Ah pd
 
@Ron , additionally you can do event delegation in both raw javascript or in any major JS framework
@Ron , and you should never attach events inside the HTML
it is an extremely bad practice
 

« first day (402 days earlier)      last day (4546 days later) »