JSFiddle

  • Grid generator

    My own simple grid generator.

    // Fetch the elements
    var els = {
        width: $('width'),
        columns: $('columns'),
        margin: $('margin'),
        render: $('render'),
        result: $('result')
    };
    
    // Add the click event to ...
  • Noder #9 is the latest revision

    A tiny function that creates DOM elements from arguments.

    n = function() {
        // Initialise variables
        var els = [].slice.call(arguments),
            key,
            el,
            current,
            parent,
            props;
    
        // Loop over the elements
        while(el ...
  • Anything to bool

    A little JavaScript trick to convert something to true or false depending on if it is truthy or not.

    var truthy = { foo: 'bar' };
    var falsy = '';
    
    $$('ul').adopt(
        new Element('li', {
            text: !!truthy
        }),
        new Element('li', {
            text: !!falsy
        })
    );
    
  • Photon dev shell

    A shell running off the current live develop branch at: https://github.com/Wolfy87/Photon/tree/develop

    // Even though it is AMD it can be loaded from anywhere
    // This is loading from my develop branch on GitHub ...
  • A better prefixer #8 is the latest revision

    Just some tests. Might end up better than prefixfree.

    function getPrefixedStyle(style, target) {
        // Convert to camel case and create the variables
        var check = new RegExp('^[A-Z][a-z]*' + style.charAt ...
  • Drop shadow over children

    Example for reddit.

    
    
  • Photon dev shell #22 is the latest revision

    For quick testing of new Photon code.

    require.config({
        paths: {
            photon: 'http://localhost:8000/source'
        }
    });
    
    require(['photon/dom/Element', 'photon/dom/ElementList'], function(Element, ElementList) {
        var target ...
  • Type method testing

    Making sure it works everywhere.

    function type(item) {
        // Get the raw type string
        // Split by spaces and get the second part
        // Remove the last character ...
  • xtz example

    Example for reddit of xtz: https://github.com/Wolfy87/xtz

    // Basic
    var normal = new xtz.DateConverter();
    normal.run($$('.date-normal'));
    
    // Custom default date format
    var customDefault = new xtz.DateConverter(false, '-HH ...
  • Date conversion

    Just trying out converting dates to their local formats.

    // This is the original date from the server
    // Must be a valid date string
    // https://developer.mozilla.org/en/JavaScript ...