Skip to content

Instantly share code, notes, and snippets.

@brendandawes
brendandawes / grid.sublime-snippet
Last active May 31, 2016 18:15
Processing:Dawesome:gridLayout
<snippet>
<content><![CDATA[
gridLayout(${1:amount},${2:xStep},${3:yStep},${4:columns});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>grid</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.pde</scope>
</snippet>
@brendandawes
brendandawes / enable.sublime-snippet
Created June 1, 2016 09:15
Processing:Dawesome:enableLazySave
<snippet>
<content><![CDATA[
enableLazySave(${1:saveKey}, ${2:fileExtension});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>enable</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.pde</scope>
</snippet>
@brendandawes
brendandawes / circular.sublime-snippet
Created June 1, 2016 09:18
Processing:Dawesome:circularLayout
<snippet>
<content><![CDATA[
circularLayout(${1:amount}, ${2:radius});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>circular</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.pde</scope>
</snippet>
@brendandawes
brendandawes / spiral.sublime-snippet
Created June 1, 2016 09:18
Processing:Dawesome:spiralLayout
<snippet>
<content><![CDATA[
spiralLayout(${1:amount}, ${2:radius}, ${3:resolution}, ${4:spacing}, ${5:increment});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>spiral</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.pde</scope>
</snippet>
@brendandawes
brendandawes / vogel.sublime-snippet
Created June 1, 2016 09:19
Processing:Dawesome:vogelLayout
<snippet>
<content><![CDATA[
vogelLayout(${1:amount}, ${2:sizeOfNode});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>vogel</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.pde</scope>
</snippet>
@brendandawes
brendandawes / spectrum.sublime-snippet
Created June 1, 2016 09:19
Processing:Dawesome:colorSpectrum
<snippet>
<content><![CDATA[
colorSpectrum(${1:amount}, ${2:saturation}, ${3:brightness});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>spectrum</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.pde</scope>
</snippet>
@brendandawes
brendandawes / fibonacci.sublime-snippet
Created June 1, 2016 09:28
Processing:Dawesome:fibonacciSphereLayout
<snippet>
<content><![CDATA[
fibonacciSphereLayout(${1:amount}, ${2:radius});
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>fibonacci</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.pde</scope>
</snippet>
@brendandawes
brendandawes / Reasons.pde
Last active June 1, 2016 13:09
My little interpretation of the Reasons.to R
// Requires the DawesomeToolkit http://cloud.brendandawes.com/dawesometoolkit
import java.util.Collections;
import java.util.Random;
import dawesometoolkit.*;
import processing.pdf.*;
ArrayList<PVector> vectors;
DawesomeToolkit dawesome;
@brendandawes
brendandawes / alphaMaskToVectors.pde
Created June 1, 2016 13:44
Converts non-white pixels in a black & white image to an ArrayList of PVectors
ArrayList alphaMaskToVectors(String file){
PImage img = loadImage(file);
ArrayList vectors = new ArrayList();
for (int i=0; i < img.width; i++) {
for (int j=0; j < img.height; j++) {
color c = img.get(i,j);
if (red(c) != 255 && green(c) != 255 && blue(c) != 255) {
vectors.add(new PVector(i,j));
}
@brendandawes
brendandawes / Processing:Comparator Example
Created June 2, 2016 10:39
Using a Comparator to sort arrays for classes
import java.util.Comparator;
import java.util.Collections;
Collections.sort(keywords, new CustomComparator());
public class CustomComparator implements Comparator<Keyword> {
@Override
public int compare(Keyword o1, Keyword o2) {
Integer val1 = (Integer) o1.keywordColor;
Integer val2 = (Integer) o2.keywordColor;