This is a recreation (for the purpose of tinkering with an implementation in d3.js) of the example from the book SVG Essentials by J. David Eisenberg.
The <feColorMatrix> element allows to change color values in a following way.
| function FisherYatesShuffle (arr) { | |
| var randInt = function (min, max) { | |
| return Math.floor(Math.random() * (max - min + 1) + min); | |
| }; | |
| var swap = function (pos1, pos2) { | |
| var temp = arr [pos1]; | |
| arr [pos1] = arr [pos2]; | |
| arr [pos2] = temp; | |
| }; |
| #!/usr/bin/env bash | |
| apt-get update | |
| apt-get install -y nginx vim make g++ postgresql-9.1 curl libxslt-dev libxml2-dev libsqlite3-dev | |
| \curl -L https://get.rvm.io | bash -s stable | |
| source /usr/local/rvm/scripts/rvm | |
| rvm requirements | |
| rvm install ruby | |
| rvm use ruby --default | |
| rvm rubygems current | |
| gem install rails |
| /* | |
| * Curry takes a two argumented function and returns one func that returns a second func that each take one argument. | |
| */ | |
| function curry (func) { | |
| return function (x) { | |
| return function (y) { | |
| return func (x, y); | |
| }; | |
| }; |
This is a recreation (for the purpose of tinkering with an implementation in d3.js) of the example from the book SVG Essentials by J. David Eisenberg.
The <feColorMatrix> element allows to change color values in a following way.
| function permutate (arr) { | |
| var permutations = []; | |
| function helper (list, perm) { | |
| var currentLength = perm.length; | |
| if (perm.length === arr.length) { | |
| return permutations.push(perm); | |
| } | |
| else { | |
| for (var i = 0, len = list.length; i < len; i++) { |
| /* | |
| * Method Definition taken from Programming Challenges by Skiena and Revilla | |
| * Insert(x,p) — Insert item x into priority queue p. | |
| * Maximum(p) — Return the item with the largest key in priority queue p. | |
| * ExtractMax(p) — Return and remove the item with the largest key in p. | |
| */ | |
| function PriorityQueue (arr) { | |
| this.arr = arr || []; | |
| } |
| "use strict"; | |
| var BayesClassifier = function () { | |
| this.labels = {}; | |
| this.words = {}; | |
| this.docNum = 0; | |
| this.tokenize = function (doc) { | |
| var temp = doc.toLowerCase().replace('.','') | |
| .replace(',','') | |
| .replace('\'','') |
| FROM ubuntu:12.04 | |
| # Setup basic Instance | |
| RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list | |
| RUN apt-get update | |
| RUN apt-get upgrade -y | |
| RUN apt-get install -y python-software-properties python | |
| RUN apt-get install -y software-properties-common | |
| # Download Java |
| #!/bin/sh | |
| ## Apps | |
| brew tap caskroom/cask | |
| brew install brew-cask | |
| # Internet | |
| brew cask install google-chrome | |
| brew cask install firefox | |
| brew cask install silverlight |
| # encoding: utf-8 | |
| site 'http://community.opscode.com/api/v1' | |
| cookbook "apt" | |
| cookbook "ruby_build", {:github=>"fnichol/chef-ruby_build", :ref=>"v0.7.2"} | |
| cookbook "rbenv", {:github=>"fnichol/chef-rbenv"} | |
| cookbook "git", {} | |
| cookbook "redis", {:github=>"ctrabold/chef-redis"} | |
| cookbook "postgresql", {:github => 'phlipper/chef-postgresql'} |