This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
/** | |
* Convert a number into a 12-digit binary number string | |
*/ | |
const dots = num => { | |
const n = num.toString(2).padStart(12, 0).split('').slice(0, 12); | |
return `1${n.substr(0, 6)}11${n.substr(6)}1`; | |
}; | |
/** | |
* See generateShaperNumbers.js to see how this is generated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CURRENT_YEAR = new Date(new Date().getFullYear(), 0, 0, 0, 0, 0, 0); | |
const DAY = 1000 * 60 * 60 * 24; | |
const dates = ['Feb 22', 'Oct 30', 'Apr 13', 'Mar 16', 'Apr 28', 'July 11', 'Mar 15', 'Dec 5', 'Feb 9', 'Mar 29', 'Nov 2', 'Nov 24', 'Jan 7', 'Nov 23', 'Apr 23', 'Feb 12', 'Dec 29', 'Apr 27', 'Oct 4', 'Nov 19', 'Oct 5', 'Mar 18', 'Aug 20', 'Jan 29', 'Oct 27', 'Sep 15', 'Dec 28', 'Nov 2', 'July 4', 'Aug 10', 'Jan 30', 'May 8', 'Oct 14', 'May 29', 'Aug 27', 'Jan 9', 'July 14', 'Oct 1', 'Feb 6', 'June 12', 'Aug 19', 'July 6', 'Aug 4', 'June 14']; | |
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | |
const TAU = Math.PI * 2; | |
const getDayNum = d => { | |
let diff = +new Date(d) - CURRENT_YEAR; | |
return Math.floor(diff / DAY); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet"> | |
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> | |
</head> | |
<div class="page-header"> | |
<center> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const lzw = { | |
decode: str => { | |
var i, code, phrase, | |
dict = {}, | |
chr = str[0], | |
last = chr, | |
out = [chr], | |
next = 256; | |
for (i = 1; i < str.length; i++) { | |
code = str[i].charCodeAt(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
The idea here is that all changes to your new object can be observed | |
*/ | |
Ember.View.extend({ | |
model: Ember.StalkableObject.create(), | |
saveModel: Ember.observer(function () { | |
/** do some fancy stuff to save changes to your model */ | |
}, 'model.@properties') | |
}); |