Skip to content

Instantly share code, notes, and snippets.

hello_world = lambda do |env|
[200, {"Content-Type" => "text/html"}, [ "<h1>Hello World!</h1>"]]
end
run hello_world
∴ rake test
(in /usr/local/lib/ruby/gems/1.9.1/gems/local_eval-0.2.6)
bacon -k /usr/local/lib/ruby/gems/1.9.1/gems/local_eval-0.2.6/test/test.rb
Testing LocalEval version 0.2.6...
With Remix version 0.4.9 and Object2module version 0.5.0
Ruby version 1.9.2
dyld: lazy symbol binding failed: Symbol not found: _rb_is_meta_singleton_of
Referenced from: /usr/local/lib/ruby/gems/1.9.1/gems/object2module-0.5.0/lib/object2module.bundle
Expected in: flat namespace
VALUE convert_embedded_to_iv_table( VALUE object ) {
len = ROBJECT_NUMIV( object );
newptr = ALLOC_N( VALUE, ROBJECT_EMBED_LEN_MAX );
MEMCPY( newptr, ptr, VALUE, len );
RBASIC( object )->flags &= ~ROBJECT_EMBED;
ROBJECT( object )->as.heap.ivptr = newptr;
return object;
}
require_relative '../lib/rpersist.rb'
require_relative './rpersist_mocks.rb'
# we have two types of persistence
# * explicit persistence (object.persist!)
# * implicit (atomic) persistence
# additionally, we have two types of atomic persistence
# * atomic accessors
# * atomic functions
#https://gist.github.com/709860
require 'benchmark'
# does Benchmark::bmbm have environments/setup like Test::Unit
# want some variables to be set per benchmark case - now have to dup them myself
# is is needed as the testcases have destructive operations, otherwise the testcases will be dependent on each other
def benchmark_setup(obj=TOP_SELF)
code = <<-CODE
#https://gist.github.com/709860
require 'benchmark'
# does Benchmark::bmbm have environments/setup like Test::Unit
# want some variables to be set per benchmark case - now have to dup them myself
# is is needed as the testcases have destructive operations, otherwise the testcases will be dependent on each other
larger_benchmark = Proc.new do |benchmark|
big = (1..95).to_a
Twines are singular encapsulations of methods with stateful context. They:
* function like methods from a high level perspective
* can have invisible private helper methods
* have a namespaced name, like modules (but probably should not share the class namespace)
* have ivars (which are stateful)
* have local vars (which are stateless)
* are aspect oriented
* allow the creation of "complex types" that look like variables but internally function like methods
* can be used transparently in classes like methods
array = [ :a, :b, :c]
num = rand( 100 )
if (0..60).include?( num )
num = 0
elsif (61..75).include?( num )
num = 1
elsif (76..100).include?( num )
num = 2
end
puts array[num]
/************
* each *
************/
VALUE rb_RPDB_DatabaseCursor_iterate( VALUE rb_database_cursor ) {
// If we don't have a block, we return an enumerator
R_ReturnEnumeratorIfNoBlock( rb_database_cursor,
0,
NULL );
# Rpersistence::Adapter::Rbdb
#
# Rpersistence Adapter for Oracle's Berkeley Database (BDB) accessed with Rbdb
class Rpersistence::Adapter::Rbdb
attr_accessor :home_directory
ObjectIDDatabase = 'Rpersistence_Database_GlobalObjectID'
ObjectIDSequence = 'Rpersistence_Sequence_GlobalObjectID'