Code Monkey home page Code Monkey logo

lafclient.github.io's People

Contributors

hiro527 avatar shaaaaaq avatar

Forkers

asger-finding

lafclient.github.io's Issues

cool background idea

Came up with an idea for the site background; have a scroll animation that shows all the client source code. Wrote a quick snippet for the general idea. It's possible but I won't work on it unless I get a green light for it.

const repo = 'LaFClient/LaF';

// Get all files in LaF repository
fetch(`https://api.github.com/repos/${ repo }/git/trees/master?recursive=1`)
.then(res => res.json())
.then(async (data) => {
    const tasks = [];

    data.tree.forEach(function(treefile) {
        const path = treefile.path;
        const size = treefile.size;
        const isFile = treefile.type === 'blob';

        // Is file in app folder and is it a js, svg, css or html file
        if (isFile && path.startsWith('app/') && /(js|svg|css|html)(\?.+)?$/.test(path)) {
            // Is the file reasonably small
            if (size > 0 && size < 30_000) {
                // Plaintext file url
                const url = `https://raw.githubusercontent.com/${ repo }/master/${ path }`;

                tasks.push(fetch(url)
                    .then(file => file.text())
                    .then(text => {
                        const name = url.split('/');
                        return {
                            file: name[name.length - 1].replace(/\?.+$/, ''),
                            text: text
                        };
                    })
                );
            }
        }
    });

    const docs = await Promise.all(tasks);
    // Create div with file title and contents, syntax highlight the item and have background scroll animation with them
});

Get the javascript, css, html and svg files in the app folder and make an opaque scrolling background with them. The snippet gets the file contents and file name, the rest should be a piece of cake :)

PS: I already have a super fast syntax highlighter for css, html and javascript.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.