Skip to content

Instantly share code, notes, and snippets.

View bebraw's full-sized avatar

Juho Vepsäläinen bebraw

View GitHub Profile
'use strict';
var express = require('express');
var webpack = require('webpack');
var webpackDevMiddleware = require('webpack-dev-middleware');
var config = require('./config/webpack.config');
main();
main();
function main() {
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext('2d');
animate(function(i) {
var matrix = generateMatrix(20, 20, function(x, y, xlen, ylen) {
var fac = fromBoundToBound(0, 1, i / 2000);
var a = 200000;
main();
function main() {
var canvas = document.getElementById("canvas");
latticeGradient(canvas, [
[[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1], [1, 0, 0, 1]],
[[0, 1, 0, 1], [0, 0, 1, 1], [1, 0, 0, 1], [0, 1, 0, 1]],
[[0, 0, 1, 1], [1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1]],
[[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 1], [1, 0, 0, 1]]
main();
function main() {
var canvas = document.getElementById('canvas');
quadGradient(canvas, {
topLeft: [1, 0, 1, 1],
topRight: [0, 0, 0, 1],
bottomLeft: [0, 1, 0, 1],
bottomRight: [0, 1, 1, 1]
@bebraw
bebraw / send.js
Last active August 29, 2015 13:57
#!/usr/bin/env node
'use strict';
var PORT = 9909;
var HOST = '172.18.12.2';
var LIGHTS = 36;
var dgram = require('dgram');
@bebraw
bebraw / js_shopping_carts.md
Created February 19, 2014 07:56
JavaScript shopping carts. If I'm missing some, please let me know.

Manifesto for Stiff Software Development

We are uncovering better ways of developing software by doing it and helping others do it. Through this work we have come to value:

  • Processes and tools over individuals and interactions
  • Comprehensive documentation over working software
  • Contract negotiation over customer collaboration
  • Following a plan over responding to change

That is, while there is value in the items on the right, we value the items on the left more.

@bebraw
bebraw / vec.js
Created October 25, 2013 17:40
Simple, generic Vector thinger for JS. Just basic ops.
var Vec = decorate({
add: function(a, b) {return a + b;},
sub: function(a, b) {return a - b;},
div: function(a, b) {return a / b;},
mul: function(a, b) {return a * b;}
}, function(op) {
return function() {
var pos = arguments[0].slice();
var i, len, arg;
@bebraw
bebraw / hermite.js
Last active December 26, 2015 02:59
Arbitrary hermite curve thingy for Canvas.
$(main);
function main() {
var $c = $('#demo');
var ctx = $c[0].getContext('2d');
ctx.translate(0, $c.height());
ctx.scale(1, -1);
var points = [[0, 0], [55, 43], [94, 226], [255, 255]];
drawCurve(ctx, hermite(points));