Skip to content

Instantly share code, notes, and snippets.

@tbrosman
tbrosman / fluentd-rspec-issue.md
Last active December 27, 2015 15:49
Issue running rspec for fluentd logger.

After cloning both the fluent-logger-ruby and fluentd vendor repos, I run bundle install followed by rspec and see the following:

vagrant@precise64:/vagrant/fluent-logger-ruby$ rspec
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- fluent/load (LoadError)
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /vagrant/fluent-logger-ruby/spec/fluent_logger_spec.rb:11:in `<top (required)>'
        from /var/lib/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load'
        from /var/lib/gems/1.9.1/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `block in load_spec_files
'
@tbrosman
tbrosman / vagrant-ruby-dev-env
Last active December 27, 2015 18:09
Vagrantfile for a clean Ruby dev environment with bundler, make, git, etc. and a port open for testing.
# -*- mode: ruby -*-
# vi: set ft=ruby :
$install_dev_tools = <<SCRIPT
apt-get update -y
apt-get install curl libcurl4-openssl-dev make git -y
# Install Ruby through apt, but bundler through gem to avoid Ruby version conflicts
apt-get install ruby1.9.3 -y
gem install bundler
@tbrosman
tbrosman / classify_points.rb
Last active December 30, 2015 02:59
Classify a set of points against a hyperplane formed using the mean and the largest principle component.
# Classify a set of points by:
# 1. Calculating largest principle component. This is the largest eigenvector of the covariance matrix for the distribution.
# 2. Defining the classification plane as the affine hyperplane passing through the mean with the previously calculated eigenvector as its normal.
# 3. Projecting onto the normal and adding each point to a "positive" or "negative" list depending on where the projection lies with respect to the normal.
require 'matrix'
class PointClassifier
def self.mean(points)
return (1.0 / points.length) * points.inject { |total, x| total + x }
@tbrosman
tbrosman / Vector2.hx
Created July 10, 2014 05:27
uppercase XY shape hack
package vtgmath;
typedef Vector2Shape =
{
#if use_uppercase_xy
public var X:Float;
public var Y:Float;
#else
public var x:Float;
public var y:Float;
@tbrosman
tbrosman / scalar_functors.hx
Created July 29, 2014 05:56
scalar functors for math structures
static function genericApply<T>(shape:T, count:Int, getter:T->Int->Float, setter:T->Int->Float->Float, f:Float->Float)
{
for (i in 0...count)
{
setter(shape, i, f(getter(shape, i)));
}
}
genericApply(v, 2, Vector2.getArrayElement, Vector2.setArrayElement, Math.floor);
@tbrosman
tbrosman / BaseFrame2.hx
Created August 13, 2014 05:55
BaseFrame2.hx
package hxmath.frames;
import hxmath.math.Matrix2x2;
import hxmath.math.Matrix3x2;
import hxmath.math.Vector2;
/**
* An abstract 2D affine frame that can be extended without carrying over all the variables of the full Frame2 class.
*/
class BaseFrame2
{
I/ActivityManager( 516): Start proc com.vacuumTubeGames.myGame for activity com.vacuumTubeGames.myGame/.MainActivity: pid=21304 uid=10070 gids={50070, 3003, 1028}
D/dalvikvm(21304): Trying to load lib /data/app-lib/com.vacuumTubeGames.myGame-1/libstd.so 0x41e7e0e0
D/dalvikvm(21304): Added shared lib /data/app-lib/com.vacuumTubeGames.myGame-1/libstd.so 0x41e7e0e0
D/dalvikvm(21304): No JNI_OnLoad found in /data/app-lib/com.vacuumTubeGames.myGame-1/libstd.so 0x41e7e0e0, skipping init
D/dalvikvm(21304): Trying to load lib /data/app-lib/com.vacuumTubeGames.myGame-1/libregexp.so 0x41e7e0e0
D/dalvikvm(21304): Added shared lib /data/app-lib/com.vacuumTubeGames.myGame-1/libregexp.so 0x41e7e0e0
D/dalvikvm(21304): No JNI_OnLoad found in /data/app-lib/com.vacuumTubeGames.myGame-1/libregexp.so 0x41e7e0e0, skipping init
D/dalvikvm(21304): Trying to load lib /data/app-lib/com.vacuumTubeGames.myGame-1/libzlib.so 0x41e7e0e0
D/dalvikvm(21304): Added shared lib /data/app-lib/com.vacuumTubeGames.myGame-1/libzlib.so 0x41e7e0e0
D
I/ActivityManager( 516): Start proc com.vacuumTubeGames.myGame for activity com.vacuumTubeGames.myGame/.MainActivity: pid=17678 uid=10070 gids={50070, 3003, 1028}
D/dalvikvm(17678): Trying to load lib /data/app-lib/com.vacuumTubeGames.myGame-1/libstd.so 0x41e79508
D/dalvikvm(17678): Added shared lib /data/app-lib/com.vacuumTubeGames.myGame-1/libstd.so 0x41e79508
D/dalvikvm(17678): No JNI_OnLoad found in /data/app-lib/com.vacuumTubeGames.myGame-1/libstd.so 0x41e79508, skipping init
D/dalvikvm(17678): Trying to load lib /data/app-lib/com.vacuumTubeGames.myGame-1/libregexp.so 0x41e79508
D/dalvikvm(17678): Added shared lib /data/app-lib/com.vacuumTubeGames.myGame-1/libregexp.so 0x41e79508
D/dalvikvm(17678): No JNI_OnLoad found in /data/app-lib/com.vacuumTubeGames.myGame-1/libregexp.so 0x41e79508, skipping init
D/dalvikvm(17678): Trying to load lib /data/app-lib/com.vacuumTubeGames.myGame-1/libzlib.so 0x41e79508
D/dalvikvm(17678): Added shared lib /data/app-lib/com.vacuumTubeGames.myGame-1/libzlib.so 0x41e79508
D
@tbrosman
tbrosman / lime_openfl_build_battleships.md
Last active August 29, 2015 14:22
Known good Lime/OpenFL combinations

Overview

My team and I (Vacuum Tube Games) are working on a game powered by Flixel + OpenFL + Haxe. In our efforts to upgrade to later versions we're keeping track of which builds worked for us. Until this point we've been using lime 0.9.7 + openfl 1.4.0 since they came out until now (May 2015).

Normally release builds work fine regardless of the version pair and usually on all platforms (which is awesome!). However, trying to find a stable version pair for our specific use case (debugging on android) has been not-so-awesome. Because of this we have started keeping track of which versions work for our particular game. Further we think this may be helpful to other developers as we are working with a very common stack. We hope that other developers can benefit from our work and save themselves a few hours of "misses" in their attempt to sink the perfect version set. If you have any comments, questions, improvements, or requests, don't hesitate to comment! This is very much a work-in-progress.

Baseline

@tbrosman
tbrosman / haxe gc crash debug version startup from OS
Created June 2, 2015 05:06
Crash in the hxcpp GC when starting a debug build from the Android OS (instead of from the command line). Versions used: lime 2.3.0 + openfl 2.1.8
I/ActivityManager( 516): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vacuumTubeGames.myGame/.MainActivity} from pid 866
D/audio_hw_primary( 181): start_output_stream: enter: usecase(1: low-latency-playback) devices(0x2)
D/audio_hw_primary( 181): select_devices: out_snd_device(3: speaker-reverse) in_snd_device(0: none)
D/audio_hw_primary( 181): enable_snd_device: sending audio calibration for snd_device(3) acdb_id(14)
D/ACDB-LOADER( 181): ACDB -> send_afe_cal
D/audio_hw_primary( 181): enable_snd_device: snd_device(3: speaker-reverse)
D/audio_hw_primary( 181): enable_audio_route: apply mixer path: low-latency-playback
D/audio_hw_primary( 181): start_output_stream: exit
D/dalvikvm( 516): GC_CONCURRENT freed 3069K, 32% free 22311K/32704K, paused 4ms+8ms, total 115ms
D/dalvikvm( 516): WAIT_FOR_CONCURRENT_GC blocked 111ms