Skip to content

Instantly share code, notes, and snippets.

@chrisevans
Forked from sugyan/LICENSE.txt
Created August 6, 2011 07:18
Show Gist options
  • Save chrisevans/1129125 to your computer and use it in GitHub Desktop.
Save chrisevans/1129125 to your computer and use it in GitHub Desktop.
Generates sparktweets from input arrays of data.
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
}
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}
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.
{
"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