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:818519
Created February 9, 2011 14:00
httpd_vhosts.conf Apache 2.2.17 Windows mod_ruby in C:\Apache2.2\conf\extra
NameVirtualHost *:80
<VirtualHost *:80>
ServerName de.oddb.win
DocumentRoot C:\Users\zdavatz\de.oddb.org\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'
SetHandler ruby-object
RubyTransHandler SBSM::ZoneTransHandler.instance
@zdavatz
zdavatz / mod_ruby.conf Windows Apache 2.2.17
Created February 9, 2011 13:55
mod_ruby.conf Windows Apache 2.2.17 placed in C:\Apache2.2\conf\extra
# Note: /usr/local/apache/libexec/mod_ruby.so is just an example.
# You should specify the correct path to mod_ruby.so.
LoadModule ruby_module modules/mod_ruby.so
# # If ClearModuleList is used in your httpd.conf, you should use AddModule
# # to activate the ruby module.
# AddModule mod_ruby.c
# If the ruby module is installed, this will be enabled.
<IfModule mod_ruby.c>
@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