Skip to content

Instantly share code, notes, and snippets.

View joeysim's full-sized avatar

Joey Simhon joeysim

View GitHub Profile
@joeysim
joeysim / get_material_color.html
Created April 22, 2015 09:35
Consistently picks a specific material color for a given string key
<html>
<head>
<script type="text/javascript">
var materialColors = [
{
'name': 'red',
'niceName': 'Red',
'hues': {
@joeysim
joeysim / get_color.html
Created April 22, 2015 08:25
Get a consistent color for a string key
<html>
<head>
<script type="text/javascript">
var colors = ['#ec407a', '#ab47bc', '#26c6da', '#ffca28', '#29b6f6', '#e84e40', '#5c6bc0', '#ff7043', '#9ccc65'];
String.prototype.hashCode = function() {
for(var ret = 0, i = 0, len = this.length; i < len; i++) {
ret = (31 * ret + this.charCodeAt(i)) << 0;