Coder Social home page Coder Social logo

deadleaves's Introduction

deadleaves

Emojis and deadleaves.

  1. Clone this!
  2. cd deadleaves && npm install && bower install && pip install -r requirements.txt
  3. grunt
  4. Navigate here (localhost:3000)

deadleaves's People

Contributors

charlesfrye avatar dcjohnston avatar

Watchers

 avatar  avatar

deadleaves's Issues

Infrastructure

  • Set up hourly cron job to remove stale svgs that were left over due to failure.
  • Set up provisioning in code (probably using puppet-agent single node conf)
  • Set up reverse proxy w/ apache to serve static assets (also use minified deps).
  • Set up express.js cluster for multi-thread processing on a single AWS box.

UI Improvements

  • Add a timed update to rasterinzing messages (This may take up to 1 minute.)
  • Add color picker for background
  • Add social media integration (last, after infrastructure is ready)
  • Add common screen sizes as options.
  • Also make sure form inputs are full width on mobile. Is not currently stacking.
  • Disable submit button (fix hiding messages bug) [BUG]

Issue #1: Implement a power-law random number generator

yo @dcjohnston:

The scales of the emojis will be drawn from a power-law distribution. Because JS, AFAIK, does not provide support for sampling from this distribution ๐Ÿ˜ข, we need to implement it ourselves.

We can do this using the inverse of the cumulative density function (CDF) to map from probabilities to values. The cumulative density function at x records the probability that a random variable will take on a value less than or equal to x. For well-behaved distributions, this function is monotone increasing and bounded by 0 and 1, so it produces an invertible mapping between the set of possible values and the unit interval [0,1].

Therefore, we simply need to generate random values between 0 and 1 using Math.Random, then map them using the inverse CDF to generate our scales. ๐Ÿ‘

The following python code defines a (higher-order) function that returns inverse CDFs for power-laws with different exponents alpha. Roughly speaking, a higher power means that smaller values are produced. We also need to define a minimum value for the scale, here xmin, so that we don't find ourselves in the awkward position of rendering emoji of zero size! ๐Ÿ™…

def getInversePowerCDF(alpha,xmin):
    def inversePowerCDF(p):
        return alpha*xmin*p**(-1/(alpha+1))
    return inversePowerCDF

Once we've defined the function inversePowerCDF based on a user-provided alpha, we need to produce a list of scales:

scales = [] #initialize
for eachEmoji in range(numEmojis):
    p = Math.Random()
    scales.append(inversePowerCDF(p))

This might also be a convenient time to produce a list of x and y locations - tuples in [0,1] x [0,1] - using Math.Random as well. If there's an efficient vectorization procedure for RNGs in JS, we can cheaply produce the 3 by numEmojis array of random numbers all at once! ๐Ÿ’ฏ ๐Ÿ‘Œ ๐Ÿ‘ mmhmm

Gallery

Add a gallery page that stores (statically) 8 or so of our favorite emoji piles.

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.