Results for "examples"


    • Kyle

      $id() - Shortened document.getElementById()

      Taken from "Saves repeatedly writing out document.getElementById('id'). Results are cached which speeds up repeat requests by 50%." I really like this one, credit to Mike Foskett @! 

      Tags: examples,, $id(), document.getElementById()

      • Kyle


        Taken from "This snippet is a little long but very useful, it will allow your site to store information on the viewer’s computer then read it at another point in time. This snipp...

        Tags: examples, cookies,

        • Kyle


          Taken from "...sometimes you don't get to plug into an event to signify a desired state -- if the event doesn't exist, you need to check for your desired state at intervals. Polling has long been useful on the web and wil...

          Tags: examples, polling,

          • Kyle

            Get absolute URL

            Taken from "Getting an absolute URL from a variable string isn't as easy as you think. There's the URL constructor but it can act up if you don't provide the required arguments (which sometimes you can't). Here...

            Tags: examples, URL,

            • Kyle

              Applying styles to selectors - insertRule()

              Taken from "...we can grab a NodeList from a selector (via document.querySelectorAll) and give each of them a style, but what's more efficient is setting that style to a selector (like you do in a stylesheet)... This is espec...

              Tags: examples, CSS,

              • Kyle


                Taken from "The debounce function can be a game-changer when it comes to event-fueled performance. If you aren't using a debouncing function with a scroll, resize, key* event, you're probably doing it wrong. Here's a ...

                Tags: examples, debounce,

                • Kyle

                  Run once

                  Taken from "There are times when you prefer a given functionality only happen once, similar to the way you'd use an onload event... ...The once function ensures a given function can only be called once, thus preventing duplic...

                  Tags: examples, runonce,