Skip to content

Instantly share code, notes, and snippets.

Try try try
@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 / refugee_quick_script.md
Created January 30, 2017 16:37
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
sansumbrella / TinyScene.cpp
Last active July 14, 2016 22:57
Tiny Cinder C++ Scene Graph
#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
sansumbrella / user-config.jam
Last active June 2, 2016 19:55
Expansion of Cinder's user-config for building libraries for tvos.
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/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/
;
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/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/
@sansumbrella
sansumbrella / serve-me-up.py
Last active December 20, 2015 23:29
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: http://stackoverflow.com/questions/4139170/bind-httserver-to-local-ipport-so-that-others-in-lan-can-see-it
# IP address: http://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib
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
sansumbrella / Facade.h
Created May 17, 2013 22:03
C++ facade for Objective-C class
// In your .h file:
#ifdef __OBJC__
@class ImplementationClass;
#else
class ImplementationClass;
#endif
class Facade
{
public:
@sansumbrella
sansumbrella / OrientationProjectApp.cpp
Last active December 12, 2015 05:09
Rotating UI elements while maintaining physical location. Compile as Objective-C++ against the AppRewrite branch of Cinder.
#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;
// 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
sansumbrella / UnixSignalHandlers.h
Last active December 7, 2015 22:33
SIGPIPE and SIGTERM handlers
/*
* Copyright (c) 2015 David Wicks, sansumbrella.com
* 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.