This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Rice's memory management works on these Allocation_Strategy-s. Define | |
* for a specific class to control if Rice takes care of allocation, deallocation, neither or both (default is both) | |
*/ | |
namespace Rice { | |
template<> | |
struct Default_Allocation_Strategy< BowlineWindow > { | |
static BowlineWindow * allocate() { return new BowlineWindow(); } | |
static void free(BowlineWindow * obj) { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0xdb43cdde is not id value | |
/usr/lib/ruby/gems/1.8/gems/chipmunk-ffi-0.2.2/lib/chipmunk-ffi/space.rb:137:in `_id2ref' | |
/usr/lib/ruby/gems/1.8/gems/chipmunk-ffi-0.2.2/lib/chipmunk-ffi/space.rb:137:in `add_collision_func_old' | |
/usr/lib/ruby/gems/1.8/gems/chipmunk-ffi-0.2.2/lib/chipmunk-ffi/space.rb:284:in `call' | |
/usr/lib/ruby/gems/1.8/gems/chipmunk-ffi-0.2.2/lib/chipmunk-ffi/space.rb:284:in `cpSpaceStep' | |
/usr/lib/ruby/gems/1.8/gems/chipmunk-ffi-0.2.2/lib/chipmunk-ffi/space.rb:284:in `step' | |
./src/../config/../../../lib/gamebox/physical_stage.rb:33:in `update_physics' | |
./src/../config/../../../lib/gamebox/physical_stage.rb:32:in `times' | |
./src/../config/../../../lib/gamebox/physical_stage.rb:32:in `update_physics' | |
./src/../config/../../../lib/gamebox/physical_stage.rb:47:in `update' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
roelofs@trillian [master]~/src/gosu/trunk $ gdb ruby | |
GNU gdb (GDB) 7.0-ubuntu | |
Copyright (C) 2009 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. Type "show copying" | |
and "show warranty" for details. | |
This GDB was configured as "i486-linux-gnu". | |
For bug reporting instructions, please see: | |
<http://www.gnu.org/software/gdb/bugs/>... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Basically, I want to throw a custom exception from C++. I'm kind of lost on how to do that :/ */ | |
// exceptions.hpp | |
class V8UnknownReturnValueException : public Rice::Exception { | |
}; | |
Rice::Object rb_eUnknownReturnValueException; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given a YAML file located in /config and an environment name, make any | |
# configuration settings available as the given symbol. | |
# | |
# class Example | |
# include LoadsYamlConfig | |
# loads :my_config, 'my_config.yml', 'development' | |
# end | |
# | |
module LoadsYamlConfig | |
def self.included(base) # :nodoc: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# From: http://d.hatena.ne.jp/falkenhagen/20090702/1246503899 | |
# | |
# Quick-n-dirty helper module method for testing the results of | |
# using #send_file in your controllers | |
## | |
module SendFileHelper | |
def file_body | |
output = StringIO.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int | |
genericCallback(cpArbiter *arb, cpSpace * space, | |
void * data, ID func) | |
{ | |
int arity = 3; | |
/* int arity = rb_obj_method_arity((VALUE) data, func); */ | |
/* XXX: this doesn't work. */ | |
VALUE arbiter = Qnil; | |
cpShape *a = NULL; | |
cpShape *b = NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require 'resque/tasks' | |
task "resque:setup" => :environment | |
rescue LoadError | |
$stderr.puts "*" * 40 | |
$stderr.puts "The resque gem is required to run it's tasks" | |
$stderr.puts "*" * 40 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent | |
def show_my_path(binding) | |
puts File.expand_path(File.dirname(eval("__FILE__", binding))) | |
end | |
end | |
class App < Parent | |
end | |
App.new.show_my_path(binding) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Finds all setter methods for the object, | |
# builds a new object with these methods set to an arbitrary value, | |
# checks if the given attrs are able to be mass assigned and all others are not, | |
# and finally returns true if there are no failures. | |
# | |
# (modified from: http://chrisconley.posterous.com/using-rspec-to-test-attraccessible) | |
Spec::Matchers.define :only_mass_assign_accessible_attributes do |*attrs| | |
match do |object| | |
@attrs = attrs | |
setters = object.methods.map{|m| m if m.match(/[a-z].*\=$/)}.compact |