Skip to content

Instantly share code, notes, and snippets.

@sansumbrella
sansumbrella / recordTweets.php
Created January 6, 2011 23:37
Use SimplePie to write twitter rss search results to a file.
<?php
include( 'simplepie.php' );
$sourceURL = 'feed://search.twitter.com/search.atom?q=+%22i+am+here+now%22&lang=all&rpp=100';
$feed = new SimplePie();
$feed->set_feed_url($sourceURL);
$feed->set_timeout(10);
$feed->enable_cache(true);
$feed->init();
@sansumbrella
sansumbrella / patcher.py
Created February 4, 2011 04:44
Patches holes in tabular data. Good for cleaning up TSV and CSV files.
#!/usr/bin/env python
# encoding: utf-8
# David Wicks
"""
patcher.py
Fills holes in tabular data files (TSV)
basic usage: python patcher.py fileToPatch.tsv
more control: python patcher.py fileToPatch.csv outputfile.csv replacementValue ,
"""
@sansumbrella
sansumbrella / AnnihilateTime.js
Created February 9, 2011 00:51
Flash animation export script annihilates all non-essential frames
/**
AnnihilateTime.jsfl
Pre-processing script for exporting animation keyframes
Use before exporting an image sequence
Duplicates your keyframes to new layers for export
Original layers become guides so they aren't exported
David Wicks, http://sansumbrella.com/
*/
@sansumbrella
sansumbrella / PrecipitationDownloader.py
Created February 10, 2011 19:54
Downloads the current day's precipitation shapefile from NOAA.
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
import commands
from datetime import date
def main():
downloadDaysData( date.today() )
@sansumbrella
sansumbrella / SuperFormulaApp.cpp
Created February 19, 2011 08:42
Port of code from Form+Code by Chandler McWilliams and Casey Reas: http://formandcode.com/code-examples/visualize-superformula
#include "cinder/app/AppBasic.h"
#include "cinder/CinderMath.h"
#include "cinder/gl/gl.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class SuperFormulaApp : public AppBasic {
public:
@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"
@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 / 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 / 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 / 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." );