Skip to content

Instantly share code, notes, and snippets.

View phellipeandrade's full-sized avatar
🏡
Working from home

Phellipe Andrade phellipeandrade

🏡
Working from home
  • São Paulo - Brazil
View GitHub Profile
//The sum of 'weights' elements should be equal 1.
let weights = [0.1, 0.9]; // probabilities
//The possible results
let results = [0, 1]; // values to return
function getRandom () {
let num = Math.random(),
s = 0,
lastIndex = weights.length - 1;
@phellipeandrade
phellipeandrade / gist:bb2533e8033dc303dd5e6d75f9e47d27
Created November 7, 2016 12:53
Script de teste de cache.manifest
<script>
var cacheStatusValues = [];
cacheStatusValues[0] = 'uncached';
cacheStatusValues[1] = 'idle';
cacheStatusValues[2] = 'checking';
cacheStatusValues[3] = 'downloading';
cacheStatusValues[4] = 'updateready';
cacheStatusValues[5] = 'obsolete';
var cache = window.applicationCache;
cache.addEventListener('cached', logEvent, false);
@phellipeandrade
phellipeandrade / README.md
Created November 6, 2016 14:55 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage