Skip to content

Instantly share code, notes, and snippets.

@heisters
heisters / jasmine.yml
Created January 28, 2012 21:31
Sinatra + Sprockets + Jasmine + Coffeescript
src_files:
- assets/javascripts/app.js.coffee
- assets/spec.js.coffee
# ...
stylesheets:
- assets/stylesheets/app.css
@heisters
heisters / hack.sh
Created April 11, 2012 15:57 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@heisters
heisters / bumper.sh
Created August 16, 2012 00:12
Using FFMPEG to splice a bumper onto an excerpt of a movie
#!/bin/bash
in="$1"
bumper_img="$2"
seek="$3" # "hh:mm:ss" or # of seconds
length="$4" # "hh:mm:ss" or # of seconds
ffmpeg \
-f image2pipe -vcodec ppm -i <(
ffmpeg \
@heisters
heisters / colorThreshold.cpp
Last active October 9, 2015 19:17
Function for elegantly performing range thresholding with arbitrary colors and ranges with OpenCV
// This code is modified from the working version to remove coupling with the original
// application, and hasn't been tested in its new form. So, it's enough to give you
// the basic idea, but may not entirely work ;)
//
// It assumes the src image is in HSV and the dst image is grayscale.
//
// CvScalar red = cvScalar(179, 255, 255);
// CvScalar lowOffset = cvScalar(-20, -150, -150); // find colors down to h = 159, s = 105, v = 105
// CvScalar highOffset = cvScalar(20, 0, 0); // find colors up to h = 19, s = 255, v = 255 (h wraps/is mod 179)
// colorThreshold(img, thresholded, red, lowOffset, highOffset);
@heisters
heisters / google-safe-browsing-lookup.rb
Last active December 13, 2015 17:28
Check all the links in a wordpress export (or really any text file) against Google Safe Browsing
# This is a version of https://github.com/juliensobrier/google-safe-browsing-lookup-ruby,
# modified to work against Ruby 1.9.2 and not blow up when malformed URLs are encountered.
#
# The library requires an API key from Google.
# Sign up for a free key a http://code.google.com/apis/safebrowsing/key_signup.html
#
# See README.rdoc for more information about Google Safe Browsing v2 API
# and this library.
#
# Author:: Julien Sobrier (mailto:julien@sobrier.net)
@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 / 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 / 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 / gem_logout.sh
Created March 16, 2011 18:41
Logout of rubygems.org. Hecka hacky.
ruby -e "Gem.configuration.rubygems_api_key = nil"