This file contains 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
#!/usr/bin/env ruby | |
# demos a problem between ruby-gnome2-0.19.0 and datamapper-0.10.0 (also 0.9.11) | |
# basically if a datamapper model is used, then created Gtk::Window objects will | |
# be drawn empty (i.e., the windows are blank looking). | |
require 'rubygems' | |
require "gtk2" | |
require 'dm-core' |
This file contains 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
def connect | |
if @ssh.nil? | |
# @password => {:password=>"..."} if a password is provided, otherwise => {} | |
options = @password.merge({ | |
:timeout=>2, | |
# :auth_methods => %w(publickey hostbased password, keyboard-interactive) | |
:auth_methods => %w(publickey hostbased password) | |
}) | |
options = @password.merge({:verbose=>Logger::DEBUG}) if @choices[:ssh_debug] | |
@logger.debug { "connect: @machine=>#{@machine}, @user=>#{@user}, options=>#{options.inspect}" } |
This file contains 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
royw-macbook:dm-core royw$ gem dependency merb -v 1.0.11 | |
Gem merb-1.0.11 | |
merb_datamapper (= 1.0.11, runtime) | |
merb-core (= 1.0.11, runtime) | |
merb-more (= 1.0.11, runtime) | |
dm-core (~> 0.9.11, runtime) | |
do_sqlite3 (~> 0.9.11, runtime) | |
dm-timestamps (~> 0.9.11, runtime) | |
dm-types (~> 0.9.11, runtime) | |
dm-aggregates (~> 0.9.11, runtime) |
This file contains 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
>> RestClient.post 'http://localhost:4000/commands', :command => {:process => 'Scan', :name => 'testing', :parameter => 'Movies'} | |
RestClient::ResourceNotFound: RestClient::ResourceNotFound | |
from ./bin/../lib/restclient/request.rb:187:in `process_result' | |
... | |
>> RestClient.get 'http://localhost:4000/commands/1' | |
=> "<command><id type='datamapper::types::serial'>1</id><parameter type='datamapper::types::text'>Movies</parameter><name>testing</name><finished_at type='datetime'>2009-05-27T19:57:41-05:00</finished_at><schedule type='datamapper::types::text'/><process>Scan</process><started_at type='datetime'>2009-05-27T19:57:41-05:00</started_at><watchdog_timeout type='integer'/><status type='datamapper::types::text'>Completed</status></command>" | |
And excerpts from the console log: | |
merb : worker (port 4000) ~ **** create **** |
This file contains 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
#!/usr/bin/env ruby | |
# quick hack to show all devices on the local lan | |
subnet = '192.168.80' | |
range = 1..254 | |
range.each do |i| | |
str = `host #{subnet}.#{i}` | |
unless str =~ /NXDOMAIN/ |
This file contains 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
# nvidia-settings: X configuration file generated by nvidia-settings | |
# nvidia-settings: version 1.0 (root@royw-gentoo) Mon Oct 13 11:25:18 CDT 2008 | |
# gentoo ~x86 | |
# ms Natural keyboard Pro | |
# Logitech MX-1000 mouse | |
# Gyration wireless mouse & keyboard & MCE remote | |
# ms IntelliMouse Explorer | |
Section "ServerLayout" |
This file contains 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
helpers/global_helpers.rb | |
# select_belongs_to('State', @address, :state_id, State, :name) | |
def select_belongs_to(title, base, base_attr_id, type, text_method) | |
selected = base.send(base_attr_id).to_s | |
# Merb.logger.info " selected => #{selected}" | |
select base_attr_id.to_sym, | |
:label => "#{title}: ", | |
:text_method => text_method.to_sym, | |
:value_method => :id, |
This file contains 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
module Merb::Template | |
class << self | |
# overwrite the load_template_io to look in app/views/templates if the | |
# given path is not found | |
def load_template_io(path) | |
io = super | |
Merb.logger.debug "Merb's load_template_io(#{path}) => #{io.inspect}" | |
if io.nil? | |
if path =~ %r((.*/app/views/).*(/[^/]+)$) | |
template_path = $1 + 'templates' + $2 |
This file contains 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
=week_layout | |
:margin 0 | |
:padding 0 | |
:width 700px | |
:border 2px solid #333 | |
:background-color #ddd | |
ol | |
li | |
:list-style none | |
:list-style-position inside |
This file contains 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
# divorce specs | |
# | |
# A divorce will dissolve the relationship between two objects, leaving | |
# the objects intact. Usage is symmetrical for all relationships | |
# | |
# Usage: | |
# | |
# 1:1 class Alpha belongs to Beta | |
# a.beta = b | |
# a.beta.divorce |