Tuesday, June 30, 2015

porch icons and github thoughts

I was kind of irritated with my past self for not socking away a Processing program to generate house icons (w/ identifiers for each location) someplace where my current self could find it and reuse it this year, so I had to make it from scratch.

It brought to mine how I'm a bit slow to use Github (or equivalent) for source control.  I guess I'm a bit of a cheapskate, and don't want to pay Github for private repositories, while being a little shy about airing my "dirty laundry" to the world. (Though I have a few projects with a more public face there already.) I guess bitbucket might provide some free private repositories, but even then I'm worried about conflicts with my use of Dropbox for more seamless synching.

When I mentioned my reticence on Facebook,  my buddy Kay Rhodes wrote
Stick it on GitHub, add a README that clearly states it's an unfinished work in progress (and what it is). Others can still benefit.
I guess that points to some of my skepticism about some types of code sharing in general... Github really feels more geared towards collaborative sharing on ongoing projects than for distribution and installation of mostly ready to go stuff. Even when a project is using it for the latter, it's even odds whether the README.md will actually provide a clear path to installation and use.

I was riding in a van of a friend whose kid is obsessed with Jurassic Park, so on the second or third playthrough I started thinking of how Github sites are kind of "just the DNA" repositories for software, but one of the reason cloning and software installation is so hard is that you need guidance on making the right environment for the stuff to grow. I've seen few Github repository homepages that were adequate substitutes for a standalone websites, but plenty of projects that assume they are. (Sometimes you just want a Download Now link...) Similarly, tech blogs and stackoverflow seem to be much more human ways of sharing code information in a way humans can understand. (And if people were REALLY reading code regularly, stuff like the heartbleed bug wouldn't have been able to hide away for years.)

Anyway, for what it's worth, here's a Processing program that will make batches of house shaped icons and pointers. It shows off a few techniques like generating transparent PNGs in Processing and drawing shapes. (I really should shift gears so my website uses a sprite sheet for these...)

ArrayList<Point> housePoints = new ArrayList<Point>();
color LITEORANGE = #FA8072;
color DARKORANGE = #804000;
color WHITE = #FFFFFF;
color BLACK = #000000;
color PURPLE =#9a88cd;
color GREEN = #BAD579;
color LITEGRAY = #c5c5c5;
color DARKGRAY = #5b5b5b;

int WIDTH = 28;
int HEIGHT = 28;

PFont myFont;

void setup() {
  size(WIDTH, HEIGHT);
  myFont = createFont("Arial-Black", 12);

void drawSetOfHouses(String badge){
  String postfix = "";
  if(badge != null) postfix = "_"+badge;
  drawHouses("icon_on"+postfix, false, true, badge);
  drawHouses("icon_off"+postfix, false, false, badge);
  drawHouses("pointer_on"+postfix, true, true, badge);
  drawHouses("pointer_off"+postfix, true, false, badge);  

void drawHouses(String folder, boolean pointer, boolean active, String badge ) {

  int h = HEIGHT;
  if (pointer) h = POINTERHEIGHT;
  PGraphics g = createGraphics(WIDTH, h);

  // g.smooth();
  for (int i = -1; i <= 99; i++) {
    String fileName = String.valueOf(i);
    String display = String.valueOf(i);
    if (i == -1) {
      fileName = "blank";
      display = "";

    color textColor;
    if (active) {
      textColor = DARKORANGE;
    else {
      textColor = DARKGRAY;
    for (Point p : housePoints) {
      g.vertex(p.x, p.y);

    g.textAlign(CENTER, CENTER);
    g.text(display, 14, 14);

    if(badge != null){

    image(g, 0, 0);

class Point {
  float x, y;
  Point(float px, float py) {
    x = px; 
    y = py;

void makeHousePoints() {
  addHousePoint(14, 2);
  addHousePoint(0, 13);
  addHousePoint(5, 13);
  addHousePoint(5, 24);
  addHousePoint(23, 24);
  addHousePoint(23, 13);
  addHousePoint(27, 13);

void addHousePoint(float x, float y) {
  housePoints.add(new Point(x, y));


  1. Totally understand your hesitation about github. I use bitbucket (like you mentioned) but for the longest time, I let projects sit in dropbox for too long before finally setting up a remote repo.

    I finally set up a "misc" repo in bitbucket for all my misc code, and that works well. Since it's already up to date on all my various computers, it's easy to throw code into it without the overhead of setting up a new repo.

    Now the problem is when I want to graduate code from "I'm keeping this private" to "Ok, the world can see it", I don't have a good workflow for that.

  2. Yeah, I think when/if I get around to upping my personal SC game, for many things a "misc" project would make more sense than a different repository for every fool thing