11
IRC #javascript chat snippets The wisdom of the really wise crowds.

IRC Chat snippets as presentations

Embed Size (px)

DESCRIPTION

Instead of going through multiple google searches and non-Google FAQs, you can use the IRC API for the #javascript channel and identify useful conversation snippets and make presentation slides of them so that it is code, from the best people on the web, in small scoops.

Citation preview

Page 1: IRC Chat snippets as presentations

IRC #javascript chat snippets

The wisdom of the really wise crowds.

Page 2: IRC Chat snippets as presentations

Privacy concerns • Only a sample, no code written.• Aim: To try to manage tons of useful info in IRC chats.

• Nothing logged yet for this, but do see "IRSeek"• Names replaced with random names (similar can be done for

timestamps, signatures, “away” messages).• Anyone should be allowed to opt out.

• “Chill effect”?• Knowing the possibility of logging might actually reduce junk on

the official channels• Newbies might get scared off initially seeing nicknames on

presentations - just till it becomes a routine - like Facebook and MySpace.

• If ops don't like it, it isn't going through anyway :-)

Page 3: IRC Chat snippets as presentations

IRC #javascript chat snippets

17:39    Bob    is there a method that creates a new stylesheet such as "document.createStyleSheet()"? i found all the methods for adding rules, but what if my pop up window doesn't have a stylesheet to begin with? 17:39    Bob    document.styleSheets is undefined 17:40    Jonny    Bob: var style = document.createElement('style'); style.type = 'text/css'; document.getElementsByTagName('head')[0].appendChild(style);

Page 4: IRC Chat snippets as presentations

IRC #javascript chat snippets

17:49    Alex    another newbie question: how do I find "that" element's parent's class? $('.someLink').click(function(){ var className = $(???????).attr("class") })

17:49    Karl    $(this).parent().attr("class")

17:50    Karl    that might give you multiple classes though of course

Page 5: IRC Chat snippets as presentations

IRC #javascript chat snippets

18:07   Bryan    how do I access all elements in a form at once? 18:07    Jonny    what do you mean? What are you trying to accomplish? 18:08    Bryan    i want to check if any of the form's elements are empty 18:08    Bryan    if at least one is empty, i want to abort the submit 18:09    Jonny    You have to loop through the form's elements collection 18:09    George    Then iterate over the ones you do want.

Page 6: IRC Chat snippets as presentations

IRC #javascript chat snippets

17:50    Bryan    hi, i am having problems accessing an html form and its object in JS :( 17:50    Jonny    `forms @Bryan 17:50    jsBot    Bryan: forms: Accessing form elements via JavaScript: Don't use document.forms[index].elementName or document.formName.elementName. Use document.forms['formName'].elements['elementName'] or document.getElementById('formID').elements['elementName'] or document.getElementById('elementID')

Page 7: IRC Chat snippets as presentations

IRC #javascript chat snippets

18:16    Larry    hello, does anyone know how i might iterate through all of the attr's of an element?  Karl    Larry: $("el")[0].attributes

Page 8: IRC Chat snippets as presentations

IRC #javascript chat snippets

18:27    Bryan    can i join an array now without delimiters? 18:27    Bryan    so it stays empty? 18:27    Jonny    arr.join('') 18:27    Jonny    In your case, that will only test against all fields being empty, tho 18:27    Bryan    oh yeah 18:29    Jonny    var pass = true; if (...elements['name'].value === '') { pass = false; } and so on for each of your fields. Then return pass

Page 9: IRC Chat snippets as presentations

jQuery UI draggable demo

Page 10: IRC Chat snippets as presentations

Was this useful as a tool to learn javascript?

FAQ 2.0?

Page 11: IRC Chat snippets as presentations

That is all, thank you!