Skip to content

Instantly share code, notes, and snippets.

@heisters
heisters / UILogger.h
Created February 17, 2017 19:21
Custom Cinder logger for use with ImGui
#pragma once
#include "cinder/Log.h"
#include "CinderImGui.h"
namespace ImGui {
class Logger : public ci::log::Logger {
private:
ImGuiTextBuffer m_buffer;
ImGuiTextFilter m_filter;
@heisters
heisters / hash_manager.js
Created January 26, 2016 22:21
Simple window hash URL navigation
(function( exports ) {
var onDOMReady = function( fn ) {
if ( document.readyState !== 'loading' ) {
fn();
} else {
document.addEventListener( "DOMContentLoaded", fn );
}
};
exports.onDOMReady = onDOMReady;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@heisters
heisters / cv_median.cpp
Created June 18, 2015 22:38
Find the median of a single channel using OpenCv
namespace cv {
// calculates the median value of a single channel
// based on https://github.com/arnaudgelas/OpenCVExamples/blob/master/cvMat/Statistics/Median/Median.cpp
double median( cv::Mat channel )
{
double m = (channel.rows*channel.cols) / 2;
int bin = 0;
double med = -1.0;
int histSize = 256;
@heisters
heisters / pbhi.sh
Created May 26, 2015 18:25
Add syntax highlighting to the current pastebuffer
#!/bin/bash
# brew install highlight
pbpaste | highlight --syntax bash -k 'Andale Mono' -s molokai -O rtf | pbcopy
@heisters
heisters / DeferredRenderer.cpp
Last active November 14, 2017 08:18
Deferred Renderer for Cinder (glNext)
#include "DeferredRenderer.h"
#include "cinder/gl/gl.h"
#include "cinder/Log.h"
#include "cinder/Buffer.h"
#include "DeferredRendererShaders.h"
#include "DeferredRenderer_random_png.h"
using namespace ci;
using namespace std;
@heisters
heisters / gifify.sh
Created March 26, 2015 23:31
Convert videos to gifs
#!/bin/bash
in="$1"
out="$2"
fps=6
delay=$(printf "%0.f" $(echo "scale=2;100 / $fps" | bc))
mkdir gif
cd gif
ffmpeg -i $in -r $fps frame%05d.png
@heisters
heisters / three.orbitcontrols.js
Last active August 29, 2015 14:06
Orbit Controls for THREE.js
/**
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / https://github.com/WestLangley
*/
THREE.OrbitControls = function ( object, domElement ) {
THREE.EventDispatcher.prototype.apply( this );
@heisters
heisters / Config.cpp
Last active April 18, 2017 23:02
Cinder class for managing configuration with defaults, a UI, and persistence
#include "Config.h"
#include "cinder/app/App.h"
#include <boost/algorithm/string.hpp>
using namespace std;
using namespace ci;
Config::Config( const ci::fs::path &path ) :
mPath( path ),
mJson( app::loadAsset( path ) )
@heisters
heisters / BlurFilter.cpp
Last active July 10, 2020 10:56
Cinder blur filter
#include "BlurFilter.h"
#include "Resources.h"
using namespace std;
using namespace ci;
BlurFilter::BlurFilter( int w, int h ) :
mFboA( w, h ),
mFboB( w, h )