Skip to content

Instantly share code, notes, and snippets.

sansumbrella /
Created Jan 30, 2017
Quick script for opposing the executive order on refugees

I am calling in opposition to the executive order on refugees. It is harmful to victims of terrorism, keeping them in danger longer. It is harmful to our economy, preventing many people from traveling for work or returning to work in the US. And the unwelcoming message it sends is clear, making the United States appear like an international bully unworthy of respect, and thereby increasing hostile attitudes toward our country.

sansumbrella / TinyScene.cpp
Last active Jul 14, 2016
Tiny Cinder C++ Scene Graph
View TinyScene.cpp
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/Utilities.h"
#include "cinder/Log.h"
#include "cinder/Json.h"
using namespace ci;
using namespace ci::app;
using namespace std;
sansumbrella / user-config.jam
Last active Jun 2, 2016
Expansion of Cinder's user-config for building libraries for tvos.
View user-config.jam
using clang : osx
: xcrun clang -arch i386 -arch x86_64 -stdlib=libc++ -std=c++11 -mmacosx-version-min=10.8 -fvisibility-inlines-hidden
using clang : ios
: xcrun clang -arch armv7 -arch arm64 -stdlib=libc++ -std=c++11 -miphoneos-version-min=6.0 -fvisibility-inlines-hidden -isysroot /Applications/
using clang : ios_sim
: xcrun clang -arch i386 -arch x86_64 -stdlib=libc++ -std=c++11 -miphoneos-version-min=6.0 -fvisibility-inlines-hidden -isysroot /Applications/
sansumbrella / circular.cpp
Last active Dec 23, 2015
Sample showing use of forward declarations to handle circular dependencies. Also note the use of weak_ptr to break circular references (which would leak).
View circular.cpp
#include <iostream>
#include <memory>
using namespace std;
Demonstration of circular dependencies broken with forward declarations.
Compile like so:
clang++ -std=c++11 -stdlib=libc++ circular.cpp -o build/circular && build/circular
sansumbrella /
Last active Dec 20, 2015
Script to start a local server in the current directory. Basically a fancy SimpleHTTPServer, in that it's accessible by other devices on your LAN and it prints out the server address on startup.
#! /usr/bin/python
# Server config:
# IP address:
import socket
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
# Announce the IP address and port we will serve on
port = 8000
print("Serving on %s:%s") % (socket.gethostbyname(socket.getfqdn()), port)
sansumbrella / Facade.h
Created May 17, 2013
C++ facade for Objective-C class
View Facade.h
// In your .h file:
#ifdef __OBJC__
@class ImplementationClass;
class ImplementationClass;
class Facade
sansumbrella / OrientationProjectApp.cpp
Last active Dec 12, 2015
Rotating UI elements while maintaining physical location. Compile as Objective-C++ against the AppRewrite branch of Cinder.
View OrientationProjectApp.cpp
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder/Timeline.h"
#include "cinder/Rand.h"
#import <UIKit/UIView.h>
#import <UIKit/UIApplication.h>
using namespace ci;
using namespace ci::app;
using namespace std;
View debounce.js
// debounce a callback function with delay being the longest acceptable time before seeing an effect
function debounce (fn, delay) {
var timeout = null;
return function () {
if( timeout !== null ){ clearTimeout( timeout ); }
timeout = setTimeout( fn, delay );
// example use:
sansumbrella / UnixSignalHandlers.h
Last active Dec 7, 2015
SIGPIPE and SIGTERM handlers
View UnixSignalHandlers.h
* Copyright (c) 2015 David Wicks,
* All rights reserved.
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
sansumbrella /
Created Nov 26, 2012
Python simple server
python -m SimpleHTTPServer 8080