Consider a list of strings you need to permanently assign a random color.
First you should turn the string into a hash.
var string = "string"
var hash = 0| /* | |
| Adapted from https://github.com/sindresorhus/github-markdown-css | |
| The MIT License (MIT) | |
| Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights |
| #!/bin/sh | |
| # This script should be saved in a git repo as a hook file, e.g. .git/hooks/pre-receive. | |
| # It looks for scripts in the .git/hooks/pre-receive.d directory and executes them in order, | |
| # passing along stdin. If any script exits with a non-zero status, this script exits. | |
| script_dir=$(dirname $0) | |
| hook_name=$(basename $0) | |
| hook_dir="$script_dir/$hook_name.d" |
This post has moved to my personal blog: http://maximilianschmitt.me/posts/compile-es6-command-line-apps/
| angular.module('qAllSettled', []).config(function($provide) { | |
| $provide.decorator('$q', function($delegate) { | |
| var $q = $delegate; | |
| $q.allSettled = function(promises) { | |
| return $q.all(promises.map(function(promise) { | |
| return promise.then(function(value) { | |
| return { state: 'fulfilled', value: value }; | |
| }, function(reason) { | |
| return { state: 'rejected', reason: reason }; | |
| }); |
| // Restify Server CheatSheet. | |
| // More about the API: http://mcavage.me/node-restify/#server-api | |
| // Install restify with npm install restify | |
| // 1.1. Creating a Server. | |
| // http://mcavage.me/node-restify/#Creating-a-Server | |
| var restify = require('restify'); |