Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Unrolls a matrix into a string, clockwise
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
index.html
largeMatrix.rb

README.md

Description

This is a simple, standalone web page that contains a form which converts unrolls any matrix into a string, clockwise. For example:

[1,2] [3,4]

becomes

1,2,4,3

The Matrix input must have the following properties:

  • Length must be the same for every row
  • No nil inputs
  • Only integers accepted
  • Comma is the delimeter
  • No Empty Rows

The Javascript could easily be extracted into a plugin, here is example code of how to call the matrixToString function

    $("#base_form").on("submit", function(){
        "use strict";
        $.matrixToString({
            matrix: $('#matrix').val(),
            success: function(output){
                $('.error').hide();
                $('#output').text(output);
            },
            error: function(error){
                $('.error').text(error).show();
                $('#output').text("");
            }
        });
        return false;
    });

Additions

I have included a Ruby file which generated large matrices to file in the same directory for speed testing.

Something went wrong with that request. Please try again.