Skip to content

Instantly share code, notes, and snippets.

@sansumbrella
sansumbrella / PolygonShapes.cpp
Created August 12, 2011 20:49
Basic Shapefile to Shape2d
/*
* PolygonShapes.cpp
* HereToThere
*
* Created by David Wicks on 2/23/11.
* Copyright 2011 David Wicks. All rights reserved.
*
*/
#include "PolygonShapes.h"
@sansumbrella
sansumbrella / com.sansumbrella.launchscript.plist
Created June 19, 2011 01:00
Sample launchctl plist. Put in ~/Library/LaunchAgents/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sansumbrella.scriptlauncher</string>
<key>Program</key>
<string>/usr/bin/python</string>
<key>ProgramArguments</key>
<array>
@sansumbrella
sansumbrella / gitconfig
Created June 16, 2011 00:06
Some git config settings
[user]
name = David Wicks
email = youcanprobablyfindit@sansumbrella.com
[color]
branch = auto
status = auto
diff = auto
[alias]
st = status -sb
co = checkout
@sansumbrella
sansumbrella / CvBlobsApp.cpp
Created May 25, 2011 19:29
libCinder demo showing openCV contour detection
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
#include "cinder/params/Params.h"
#include "cinder/ImageIo.h"
#include "cinder/Utilities.h"
#include "cinder/Capture.h"
#include "cinder/gl/Texture.h"
#include "CinderOpenCV.h"
@sansumbrella
sansumbrella / repeatingTexture.cpp
Created April 25, 2011 01:30
Draw a repeating image in openGL with Cinder types
void drawRepeatingTexture( const gl::Texture& tex, const Rectf& destRect, const Vec2f& textureBounds )
{
tex.enableAndBind();
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
GLfloat verts[8];
GLfloat texCoords[8];
glVertexPointer( 2, GL_FLOAT, 0, verts );
@sansumbrella
sansumbrella / ExampleUsage.cpp
Created April 24, 2011 06:09
Basic IOS Utilities for Cinder
// normal TextLayout code
TextLayout layout;
layout.clear( ColorA( CM_HSV, 0.0f, 0.0f, 0.0f, 0.0f ) );
layout.setFont( mDateFont );
layout.setColor( ColorA( CM_HSV, 0.0f, 0.0f, 1.0f, 1.0f ) );
layout.setLeadingOffset( 4.0f );
// write some
layout.addLine( "Some Text" );
layout.addLine( "Some more text." );
@sansumbrella
sansumbrella / DateUtils.cpp
Created April 24, 2011 05:35
A sane way to format dates from boost. Simple interface, no noodling with stringstreams and locales.
//
// DateUtils.cpp
// Created by David Wicks on 4/23/11.
#include "DateUtils.h"
#include <sstream>
using namespace boost::gregorian;
using namespace std;
@sansumbrella
sansumbrella / polymapping.html
Created April 15, 2011 00:02
Basic use of polymaps. Loads tiles generated by https://gist.github.com/915807
<html>
<head>
<title>Polymaps Learning</title>
<meta name="author" content="David Wicks"/>
<!-- Date: 2011-04-11 -->
<!-- Get polymaps for this to work: http://polymaps.org/ -->
<script type="text/javascript" src="lib/polymaps.min.js"></script>
<script type="text/javascript">
function run()
{
@sansumbrella
sansumbrella / TileMaker.pde
Created April 12, 2011 16:10
Quick and dirty map tile-generation
String imageName;
String outputPath;
boolean labelTiles = false;
int tileSize = 256;
PFont tileFont;
PImage startImage;
void setup()
{
@sansumbrella
sansumbrella / ImageTiler.py
Created February 24, 2011 21:38
Walks directory for image files and merges them into a large sheet at a fixed individual size.
#!/usr/bin/env python
# encoding: utf-8
import Image
import sys
import os
def main():
path = "where-images-may-live"