Skip to content

Instantly share code, notes, and snippets.

Avatar

Abe Pazos hamoid

View GitHub Profile
View EnergyGrid.pde
// JavaScript code by Sean Angley ported to Processing.
// Original: https://www.khanacademy.org/cs/energy-grid/5571983911682048
//click to energize the grid
float a = 0;
float b = 0;
int dens = 8; //density - ! numbers higher than 20 may slow down your browser !
float d; // must be initiazed after size();
float e = 180; //energy
@hamoid
hamoid / AnimatedBranchesAndLeaves.pde
Last active Aug 29, 2015
Response to code-comment on funprogramming.org (branches and leaves)
View AnimatedBranchesAndLeaves.pde
// http://funprogramming.org/76-Slowly-morphing-bezier-curves.html#comment-1520486548
PGraphics pg;
void setup() {
size(500, 400);
pg = createGraphics(width, height);
}
void draw() {
background(255);
pg.clear();
@hamoid
hamoid / watchRenames.sh
Last active Aug 29, 2015
Keep Markdown in sync when images are renamed
View watchRenames.sh
#!/bin/bash
# This scripts automatically updates text files when asset files are renamed
# Given page.md containing ![Image](/static/images/1234.jpg)
# if you rename the file 1234.jpg to awesome_jungle.jpg
# it will update page.md to ![Image](/static/images/awesome_jungle.jpg)
# Works on Linux (untested in Mac, where sed is slightly different).
# I place the script in my images/ folder and let it run while I rename images.
@hamoid
hamoid / youtubeCoveringPage.html
Last active Dec 16, 2015
A YouTube video below, a layer covering the whole page above
View youtubeCoveringPage.html
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Layer covering video</title>
<style type="text/css">
html, body {
padding: 0px;
margin:0px;
}
#overlay {
View tumblr_pjs.js
/*Swiped from https://github.com/annasob/processing-js
* This code searches for all the <script type="application/processing" target="canvasid">
* in your page and loads each script in the target canvas with the proper id.
* It is useful to smooth the process of adding Processing code in your page and starting
* the Processing.js engine.
*/
if (window.addEventListener) {
window.addEventListener("load", function() {
var scripts = document.getElementsByTagName("script");
var canvasArray = Array.prototype.slice.call(document.getElementsByTagName("canvas"));
@hamoid
hamoid / scdocs.css
Created Feb 6, 2016
Solarized (dark) css theme for the Supercollider IDE (scide). I added this to the bottom of scdocs.css.
View scdocs.css
body {
background-color: #002B36;
color: #839496;
}
a:link, a:visited, a:hover, .category a {
color: orange !important;
}
.subheader {
color: #AAA;
}
@hamoid
hamoid / ColourLover.pde
Created Feb 7, 2015
Processing function to get a random color set from ColourLovers
View ColourLover.pde
void setup() {
size(displayWidth, displayHeight);
int[] colors = getColorLove();
println(colors);
noStroke();
for(float x=0; x<width; x+=random(100)) {
fill(colors[(int)random(colors.length)]);
rect(x, 0, width, height);
}
}
@hamoid
hamoid / processingOnTumblr.html
Last active Jul 4, 2016
Code that allows you to post and run Processing sketches on Tumblr
View processingOnTumblr.html
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
// processing.js loader
// by Abe Pazos - 23.01.2014 - http://funprogramming.org
// Updated - 04.07.2016
// 1. Install this script:
// A. Your Tumblr html template should include jquery. If missing, paste
// the first line above to load jquery. If jQuery is already available
View lemonade-dream.scd
(
SynthDef(\lemonade_dream, {
arg gate = 1,
freq = 440,
f2 = 500,
spreadf = 222,
sustain = 1,
amp = 0.1,
mix = 0.1,
release = 0.1;
@hamoid
hamoid / generativeSpreadsheet.bas
Created Oct 23, 2017
Generative spreadsheet for LibreOffice
View generativeSpreadsheet.bas
REM ***** BASIC *****
Sub Main
Dim Doc As Object
Dim Sheet As Object
Dim Cell As Object
Dim s As String
Doc = ThisComponent
Sheet = Doc.Sheets(0)