-
-
Save chrisevans/1129125 to your computer and use it in GitHub Desktop.
Generates sparktweets from input arrays of data.
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
function ( | |
a, // argument array | |
b, s, l, r // variables | |
) { | |
l = ( // l is length of a | |
s = a.slice().sort() // s is copied and sored array of a | |
).length, | |
r = s[l - 1] - s[0]; // r is max(a) - min(a) | |
b = ''; // b is return value | |
while (l--) // loop l times | |
b = String.fromCharCode( // charcode: 9601 - 9608 | |
// (some browser could not render unicode 9604 and 9608 ...?) | |
9601 + ~~ 7 * (a[l] - s[0]) / r // use "~~" instead of Math.floor() | |
) + b; // concat forward | |
return b | |
} |
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
function(a,b,s,l,r){l=(s=a.slice().sort()).length,r=s[l-1]-s[0];b='';while(l--)b=String.fromCharCode(9601+~~7*(a[l]-s[0])/r)+b;return b} |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
0. You just DO WHAT THE FUCK YOU WANT TO. |
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
{ | |
"name": "sparktweet", | |
"description": "Generates sparktweets from input arrays of data.", | |
"keywords": [ | |
"sparktweet", | |
"plotting" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment