Opinions are like assholes, every one has got one.
This one is mine.
Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.
| require 'terminal-table/import' | |
| class SubsetSumMatrix | |
| class << self | |
| def create_empty_for(array) | |
| matrix = [] | |
| header = [nil] + build_header_from(array) | |
| matrix << header | |
| array.each_with_index do |element,i| | |
| row = header.collect{|value| 'F'} |
| // First, let's define a widget/plugin called "foo" | |
| // Either using jQuery's $.fn plugin namespace, for simple stateless plugins... | |
| $.fn.foo = function(){ | |
| // In this scope, this refers to the element on which the plugin foo() was called | |
| // manipulate it and return this at the end, so it can be chainable | |
| }; |
| Some possible implementations of the Bresenham Algorithms in C. | |
| The Bresenham line algorithm is an algorithm which determines which points in an | |
| n-dimensional raster should be plotted in order to form a close approximation | |
| to a straight line between two given points. | |
| It is commonly used to draw lines on a computer screen, as it uses only integer | |
| addition, subtraction and bit shifting, all of which are very cheap operations | |
| in standard computer architectures. | |
| It is one of the earliest algorithms developed in the field of computer graphics. | |
| A minor extension to the original algorithm also deals with drawing circles. |
| // String utils | |
| // | |
| // resources: | |
| // -- mout, https://github.com/mout/mout/tree/master/src/string | |
| /** | |
| * "Safer" String.toLowerCase() | |
| */ | |
| function lowerCase(str) { | |
| return str.toLowerCase(); |
| // NOTICE 2020-04-18 | |
| // Please see the comments below about why this is not a great PRNG. | |
| // Read summary by @bryc here: | |
| // https://github.com/bryc/code/blob/master/jshash/PRNGs.md | |
| // Have a look at js-arbit which uses Alea: | |
| // https://github.com/blixt/js-arbit | |
| /** |
| var mutators = [ | |
| 'fill', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift' | |
| ] | |
| function ObservableArray(onChange){ | |
| var array = [] | |
| array.set = set | |
| array.onchange = onChange |
| public class Perlin { | |
| public int repeat; | |
| public Perlin(int repeat = -1) { | |
| this.repeat = repeat; | |
| } | |
| public double OctavePerlin(double x, double y, double z, int octaves, double persistence) { | |
| double total = 0; |
| var polygonFilling = function( vertices ) { | |
| // "global" variables | |
| var verticesCount = vertices.length, | |
| edgesEntered, | |
| // table cols | |
| yMax, yMin, xInt, invNegSlope; | |
| // ************************* |
here are the most useful pull streams modules
a library of simple functions that will be familiar functional programmers.