Skip to content

Instantly share code, notes, and snippets.

sansumbrella / Hosting Git repositories on DreamHost
Created May 7, 2009
Bash script to create and initialize a git repo on a dreamhost server
View Hosting Git repositories on DreamHost
#Based on:
YEAR=`eval date +%Y`
#set up on the server
ssh $DREAMGIT_DOMAIN 'mkdir -p '$GIT_DOMAIN'/'$YEAR'/'$1'.git && cd '$GIT_DOMAIN'/'$YEAR'/'$1'.git && git --bare init'
#set up locally
sansumbrella / jsonp.php
Created May 14, 2009
php to return JSON objects. Works with jQuery.
View jsonp.php
$JSON = '{events:[{title:"title", info:"info"},{title:"title", info:"info"},{title:"title", info:"info"}]}';
header("Content-type: application/json");
echo $_GET['callback']."($JSON);"
sansumbrella / EventDispatcher.cpp
Created Aug 3, 2009
C++ observer pattern for event handling.
View EventDispatcher.cpp
#include "EventDispatcher.h"
void EventDispatcher::addListener( Listener *l )
void EventDispatcher::removeListener( Listener *l )
mListeners.erase( std::remove( mListeners.begin(), mListeners.end(), l ), mListeners.end() );
sansumbrella / keyboard_save.pde
Created Aug 12, 2009
Processing saveFrame function.
View keyboard_save.pde
//this is part of why processing is awesome
void keyPressed()
if( key == 's')
sansumbrella / Build.php
Created Dec 19, 2009
php static page creation
View Build.php
$base_url = "http://localhost/~username";
$builder = new Build($base_url);
$source = "index.php?about";
$target = "about.html";
$builder->write_file($source, $target);
Class Build
public $url; //base url
sansumbrella / Website_screenshots.scpt
Created Feb 22, 2010
Batch website screenshots using Safari
View Website_screenshots.scpt
(* Navigates to each page and takes a screenshot *)
(* Combined a screenshot script -- -- with some javascript *)
set save_location to (choose folder with prompt "Choose where to save screenshots")
set base_url to ""
set first_page to 1
set last_page to 5
set filename to "screenshot-"
tell application "Safari"
sansumbrella / find.js
Created Apr 5, 2010
Find in Maps bookmarklet
View find.js
Find in Maps Bookmarklet
author: @sansumbrella
Enters the selected query into Google Maps.
Maps is generally location-aware, so it should pick out your city for use
(function() {
sansumbrella / CinderTileRender.cpp
Created May 7, 2010
Cinder Tile Render example
View CinderTileRender.cpp
void yourApp::renderTiles()
//the size here doesn't matter, but it will get distorted if it's not the same ratio as your window
gl::TileRender tr( getWindowWidth()*4, getWindowHeight()*4 );
//use the default cinder view to render from
tr.setMatricesWindow(getWindowWidth(), getWindowHeight());
while( tr.nextTile() ) {
sansumbrella / SampleApp.cpp
Created Jun 23, 2010
Sample WrittenImages TinderBox Output
View SampleApp.cpp
#include "cinder/app/AppBasic.h"
#include "cinder/params/Params.h"
#include "cinder/ImageIo.h"
#include "cinder/gl/TileRender.h"
#include "cinder/Utilities.h"
#include "cinder/Rand.h"
#include <vector>
using namespace ci;
using namespace ci::app;
View CopySurfaceApp.cpp
#include "cinder/app/AppBasic.h"
#include "cinder/ImageIo.h"
#include "cinder/Utilities.h"
#include <vector>
using namespace ci;
using namespace ci::app;
using std::vector;
class CopySurfaceApp : public AppBasic {