Skip to content

Instantly share code, notes, and snippets.

View andrewnicols's full-sized avatar

Andrew Lyons andrewnicols

  • Moodle Pty Ltd
  • Perth, Australia
View GitHub Profile
@andrewnicols
andrewnicols / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
YUI.add('moodle-block_codex_about-toggler', function(Y) {
// Define a name space to call
M.block_codex_about = M.block_codex_about || {};
M.block_codex_about.toggler = {
init: function() {
// Delegate adds a single event listener rather than one per .codex_about_link
// There's no need to loop through and get the IDs and then pass them to the eventHandler as the targetted
// Node is available to the eventHandler in any case.
Y.delegate('click', this.toggleShow, Y.config.doc, '.codex_about_link', this);