Skip to content

Instantly share code, notes, and snippets.

// by gonzalo moiguer www.gonzamoiguer.com.ar
// p5.js sketch
// simulates patterns arising from a transport network
// Based on this 2010 paper by Jeff Jones "Characteristics of pattern formation and evolution in approximations of Physarum transport networks." http://eprints.uwe.ac.uk/15260/1/artl.2010.16.2.pdf
// Also helped by Sage Jenson breakdown and awesome GPU-powered work: https://sagejenson.com/physarum
var mapWidth = 500;
var mapHeight = 500;
var trailMap = [];
// Based on Shiffman's Reaction Diffusion Tut: https://youtu.be/Cl_Gjj80gPE
//
// Changed to simulate once, on startup
// Then draw the lines of the resulting chains
// Will need to update vector to Victor.js in order to use with plotter
var tree = [];
var walkers = [];
var maxWalkers = 40;
var iterations = 1000;
var totalHeight = 500;
var totalWidth = 1000;
var W = totalWidth;
var H = totalHeight;
var maxResolution = 5;
var branchLength, divergence, reduction, reductionOfReduction, line_width, start_points = [];
@gonzam88
gonzam88 / mini maze.js
Last active October 31, 2018 23:04
mini maze for Melt - Polarcontroller
var xoff = melt.PenPosition().x, yoff = melt.PenPosition().y;
var grid = 3;
var alto = 330, ancho = 490;
for(let i=0; i<ancho/grid; i++){
for(let j=0; j<alto/grid; j++){
PickOne()? LtR(i*grid, j*grid) : RtL(i*grid, j*grid);
}
}
@gonzam88
gonzam88 / AjaxTiffToPng.module
Last active June 28, 2018 00:24
Processwire module to allow tiff image upload
<?php
// Processwire module to allow tiff image upload
//
// You must create a 'imagen_tiff' file upload field, and another 'imagen_web' image field.
// This module hooks on InputfieldFile::fileAdded and creates a temporary .png image through Imagick
// It then adds this temp .png to the 'imagen_web' field
class AjaxTiffToPng extends WireData implements Module {
<?php
$paises = array("Afganistán","Albania","Alemania","Andorra","Angola","Antigua y Barbuda","Arabia Saudita","Argelia","Argentina","Armenia","Australia","Austria","Azerbaiyán","Bahamas","Bangladés","Barbados","Baréin","Bélgica","Belice","Benín","Bielorrusia","Birmania","Bolivia","Bosnia y Herzegovina","Botsuana","Brasil","Brunéi","Bulgaria","Burkina Faso","Burundi","Bután","Cabo Verde","Camboya","Camerún","Canadá","Catar","Chad","Chile","China","Chipre","Ciudad del Vaticano","Colombia","Comoras","Corea del Norte","Corea del Sur","Costa de Marfil","Costa Rica","Croacia","Cuba","Dinamarca","Dominica","Ecuador","Egipto","El Salvador","Emiratos Árabes Unidos","Eritrea","Eslovaquia","Eslovenia","España","Estados Unidos","Estonia","Etiopía","Filipinas","Finlandia","Fiyi","Francia","Gabón","Gambia","Georgia","Ghana","Granada","Grecia","Guatemala","Guyana","Guinea","Guinea ecuatorial","Guinea-Bisáu","Haití","Honduras","Hungría","India","Indonesia","Irak","Irán","Irlanda","Islandia","Islas Marshall","Islas Salomón