Skip to content

Instantly share code, notes, and snippets.

qtime::MovieGlRef loadMovie( const ci::gl::ContextRef &context, const ci::fs::path &path ) {
ci::ThreadSetup thread_setup;
try {
context->makeCurrent();
auto movie = qtime::MovieGl::create(path);
return movie;
}
catch( std::exception &exc ) {
CI_LOG_E( "Error loading texture: " << exc.what() );
return nullptr;
@sansumbrella
sansumbrella / gist:fae0ca475a5c965e6e06
Created January 26, 2015 18:22
Sublime Text 2 Keybindings Preferences
[
// match XCode switch file key binding
{ "keys": ["super+ctrl+up"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} }
, { "keys": ["super+ctrl+down"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} }
// move line like XCode
, { "keys": ["super+option+["], "command": "swap_line_up" }
, { "keys": ["super+option+]"], "command": "swap_line_down" }
]
@sansumbrella
sansumbrella / IntelJFC.md
Last active August 29, 2015 14:07
Letter to Intel

The reason I'm writing today is the decision, relayed by your customer support team, to pull advertising for Intel RealSense Technology from the online publication for game industry professionals, Gamasutra.com.

I am very disappointed in your response to important cultural criticism that is driving our field forward. It is especially dismaying that you would pull support from the site on the basis of a single article and the complaints of a small, bigoted group.

The writing of critics such as Leigh Alexander, Mattie Brice, Robert Yang, and Anita Sarkeesian is essential to the growth of the gaming and computing industry and vital to our wider cultural discourse. It is shameful that a major corporation would run away from this discourse, especially if it purports to be interested in developing the technologies of the future.

The technologies of the future are inherently bound up in the culture of the future. They do not exist apart from racism, sexism, and classism. By pretending that technology can be separ

@sansumbrella
sansumbrella / CameraTestApp.cpp
Created September 3, 2014 20:14
Roll/Pitch/Yaw weird
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder/Camera.h"
#include "cinder/params/Params.h"
using namespace ci;
using namespace ci::app;
using namespace std;
@sansumbrella
sansumbrella / ProjectSetup.md
Last active April 3, 2021 22:20
Brief instructions for project setup using submodules.

Instructions for project setup using submodules.

Initialization

# Add Cinder and Soso submodules, specifying the branches we want
git submodule add -b release --name Cinder git@github.com:sosolimited/Cinder.git lib/Cinder
git submodule add -b cinder --name Soso git@github.com:sosolimited/ofxSoso.git lib/ofxSoso
@sansumbrella
sansumbrella / circular.cpp
Last active December 19, 2021 19:20
Sample showing use of forward declarations to handle circular dependencies. Also note the use of weak_ptr to break circular references (which would leak).
#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
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: