JSFiddle

  • Count visible characters in overflow'd div #72 is the latest revision

    No-Library (pure JS), HTML, CSS, JavaScript

    var div = document.getElementById('thediv');
    var numc = count_visible(div);
    
    // You can do something like this to hide partially visible characters ...
  • Count visible characters in overflow'd div

    No-Library (pure JS), HTML, CSS, JavaScript

    var div = document.getElementsByTagName('div')[0];
    var numc = count_visible(div);
    
    // You can do something like this to hide partially visible ...
  • Count visible characters in overflow'd div #2 is the latest revision

    No-Library (pure JS), HTML, CSS, JavaScript

    var div = document.getElementById('thediv');
    var numc = count_visible(div);
    
    // You can do something like this to hide partially visible characters ...
  • Lambda Calculus Factorial

    No-Library (pure JS), HTML, CSS, JavaScript

    // Convert from natural number to Church numeral
    function ntoc(n) {
        var c = function(f) {
            return function(x) {
                return x;
            }
        };
        for ...
  • Lambda Calculus Factorial

    No-Library (pure JS), HTML, CSS, JavaScript

    // Convert from natural number to Church numeral
    function ntoc(n) {
        var c = function(f) {
            return function(x) {
                return x;
            }
        };
        for ...
  • Lambda Calculus Factorial

    No-Library (pure JS), HTML, CSS, JavaScript

    // Convert from natural number to Church numeral
    function ntoc(n) {
        var c = function(f) {
            return function(x) {
                return x;
            }
        };
        for ...
  • Auto scrolling carousel

    No-Library (pure JS), HTML, CSS, JavaScript

    (function(){
        
        var s = document.getElementById('scroller');
        
        var i;
        var start = function(){
            i = setInterval(function(){
                // Remove non element nodes
                while(s ...
  • Auto scrolling carousel

    No-Library (pure JS), HTML, CSS, JavaScript

    (function(){
        
        var s = document.getElementById('scroller');
        
        var i;
        var start = function(){
            i = setInterval(function(){
                // Remove non element nodes
                while(s ...
  • Improved Vigenere

    No-Library (pure JS), HTML, CSS, JavaScript

    var alphabet = [];
    for(var i = 0; i < 26; i++)
        alphabet.push(i);
    
    // Random l between 3 and 8 inclusively.
    var l = Math.floor(Math.random()*6)+3;
    var keys = [];
    for(i = 0; i < l; i++)
        keys.push(shuffle(alphabet));
    
    var str = 'A wellorganized paragraph supports or develops a single controlling           idea, which is expressed in a sentence called the topic sentence. A  topic          sentence has several important functions: it  substantiates or supports          an essay’s thesis statement; it  unifies the content of a paragraph          and directs the order of the  sentences; and it advises the reader of the          subject to be  discussed and how the paragraph will discuss it. Readers           generally look to the first few sentences in a paragraph to determine           the subject and perspective of the paragraph. That\'s why it\'s           often best to put the topic sentence at the very beginning of the  paragraph.          In some cases, however, it\'s more effective to place  another sentence          before the topic sentence—for example, a  sentence linking the current          paragraph to the previous one, or  one providing background information.';
    
    str = str.toUpperCase().replace(/[^A-Z]/g, '');
    console.log(str);
    var strs = [];
    for(i = 0; i < str.length; i += l)
        strs.push(str.substring(i, i+l).split(''));
    
    for(i = 0; i < strs.length; i++)
        for(var j = 0; j < strs[i].length; j++){
            var char = strs[i][j].charCodeAt(0)-65;
            strs[i][j] = String.fromCharCode(keys[j][char]+65);
            console.log('New: '+strs[i][j]+'\n');
        }
    
    document.write('<div style="font-family: Courier; word-wrap: break-word;">Encrypted String:<br /><br />');
    for(i = 0; i < strs.length; i++)
        document.write(strs[i].join(''));
    
    document.write('<br /><br />Keys:<br /><br />');
    for(i = 0; i < keys.length; i++){
        for(j = 0; j < 26; j++)
            document.write(String.fromCharCode(keys[i][j]+65));
        document.write('<br />');
        for(var ...
  • Imporved Vigenere

    No-Library (pure JS), HTML, CSS, JavaScript

    var alphabet = 'abcdefghijklmnopqrstuvwxyz';
    document.write(alphabet);
    
    var str = 'A wellorganized paragraph supports or develops a single controlling           idea, which is ...