Skip to content

Instantly share code, notes, and snippets.

View zdavatz's full-sized avatar
🎯
Focusing

Zeno R.R. Davatz zdavatz

🎯
Focusing
View GitHub Profile
@zdavatz
zdavatz / gist:818654
Created February 9, 2011 15:35
de.oddb.win.conf in C:\Apache2.2\conf\vhosts
NameVirtualHost *:80
<Directory C:\Users\zdavatz\de.oddb.org\doc>
Options ExecCGI
<Files "*">
SetHandler ruby-object
</Files>
AllowOverride None
Order allow,deny
Allow from all
@zdavatz
zdavatz / mod_ruby Linux config Apache
Created February 9, 2011 16:48
mod_ruby Linux config Apache
<VirtualHost *:80>
DocumentRoot /var/www/de.oddb.org/doc
ServerName de.oddb.org
DirectoryIndex index.rbx
RubyAddPath /var/www/de.oddb.org/lib
RubyRequire 'sbsm/trans_handler'
SetHandler ruby-object
RubyTransHandler SBSM::ZoneTransHandler.instance
SetEnv DEFAULT_FLAVOR oddb
SetEnv DRB_SERVER druby://localhost:11000
@zdavatz
zdavatz / gist:820138
Created February 10, 2011 08:31
mod_ruby.so vhosts.conf Windows Apache 2.2.17
NameVirtualHost *:80
<VirtualHost *:80>
ServerName de.oddb.win
DocumentRoot C:\Ruby-1.8.6-oniguruma\lib\ruby\gems\1.8\gems\de.oddb-2.0.0\doc
DirectoryIndex index.rbx
RubyAddPath 'C:/Ruby-1.8.6-oniguruma/lib/ruby/gems/1.8/gems/de.oddb-2.0.0/lib'
RubyRequire 'sbsm/trans_handler'
RubyTransHandler SBSM::ZoneTransHandler.instance
@zdavatz
zdavatz / gist:820139
Created February 10, 2011 08:33
mod_ruby vhosts.conf Linux
<Directory /var/www/de.oddb.org/doc>
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/de.oddb.org/var/images>
AllowOverride None
Order allow,deny
Allow from all
@zdavatz
zdavatz / mod_ruby.conf Windows 2.2.17 in C:\Aapche2.2\conf\extra\mod_ruby.conf
Created February 10, 2011 10:22
mod_ruby.conf Windows 2.2.17 in C:\Aapche2.2\conf\extra\mod_ruby.conf
LoadModule ruby_module modules/mod_ruby.so
<IfModule mod_ruby.c>
RubyRequire apache/ruby-run
<Location /ruby>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
Options ExecCGI
</Location>
@zdavatz
zdavatz / oddb.org Rakefile
Created February 13, 2011 19:39
oddb.org Rakefile
# -*- ruby -*-
require 'rubygems'
require 'hoe'
## To run 'rake git:manifest' you will need the 'hoe-git' gem.
Hoe.plugin :git
Hoe.plugins.delete :clean
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@zdavatz
zdavatz / odba - cache.rb
Created March 11, 2011 16:28
odba - cache.rb
# Returns all objects designated by _bulk_fetch_ids_ and registers
# _odba_caller_ for each of them. Objects which are not yet loaded are loaded
# from ODBA#storage.
def bulk_fetch(bulk_fetch_ids, odba_caller)
instances = []
loaded_ids = []
bulk_fetch_ids.each { |id|
if(entry = fetch_cache_entry(id))
entry.odba_add_reference(odba_caller)
@zdavatz
zdavatz / cache_entry.rb
Created March 14, 2011 08:10
cache_entry.rb - ODBA
def odba_cut_connections!
@accessed_by.each { |object_id, odba_id|
if((item = odba_id2ref(odba_id) || object_id2ref(object_id, odba_id)) \
&& item.respond_to?(:odba_cut_connection))
item.odba_cut_connection(_odba_object)
end
}
end
@zdavatz
zdavatz / ODBA - cache_entry.rb
Created March 14, 2011 09:51
cache_entry.rb
def odba_retire opts={}
# replace with stubs in accessed_by
instance = _odba_object
if opts[:force]
@accessed_by.each do |object_id, odba_id|
if item = odba_id2ref(odba_id)
item.odba_stubize instance, opts
elsif(item = object_id2ref(object_id, odba_id))
if item.is_a?(Persistable) && !item.is_a?(Stub)
item.odba_stubize instance, opts