Skip to content

Instantly share code, notes, and snippets.

View stefanpenner's full-sized avatar
🎯
Focusing

Stefan Penner stefanpenner

🎯
Focusing
View GitHub Profile
module StefansAssignment
def self.included(base)
base.class_eval do
extend ClassMethods
include InstanceMethods
end
end
module ClassMethods
def model_accesible(*models)
" ir_black color scheme
" More at: http://blog.infinitered.com/entries/show/8
" ********************************************************************************
" Standard colors used in all ir_black themes:
" Note, x:x:x are RGB values
"
" normal: #f6f3e8
"
require 'rubygems'
require 'wirble'
require 'fileutils'
# Colorize
Wirble.init
Wirble.colorize
# I use vim
alias q exit
test = "Delivered-To: twtbot@gmail.com
Received: by 10.114.155.8 with SMTP id c8cs261037wae;
Thu, 22 Jan 2009 18:13:17 -0800 (PST)
MIME-Version: 1.0
Sender: neufelry@gmail.com
Received: by 10.114.92.14 with SMTP id p14mr4207993wab.140.1232676797484; Thu,
22 Jan 2009 18:13:17 -0800 (PST)
Date: Thu, 22 Jan 2009 20:13:17 -0600
X-Google-Sender-Auth: ac619f32b7c737b4
Factory.define :role do |role|
role.name 'admin'
end
Factory.define :admin, :class => User do |user|
user.email { Factory.next :email }
user.password "password"
user.password_confirmation "password"
user.roles { |a| [a.associations(:role)] }
end
irb(main):001:0> require 'openssl'
=> true
irb(main):002:0> Digest
NameError: uninitialized constant Digest
from /opt/local/share/java/jruby/lib/ruby/1.8/irb/ruby-token.rb:102:in `const_missing'
from (irb):3:in `irb_binding'
Maybe IRB bug!!
[stefan@MBP ~] sudo jgem install glassfish --source http://gems.rubyforge.org/
Successfully installed glassfish-0.9.2-universal-java
1 gem installed
Installing ri documentation for glassfish-0.9.2-universal-java...
Installing RDoc documentation for glassfish-0.9.2-universal-java...
[stefan@MBP ~] ls
README app coverage.data doc log script tmp
Rakefile config db lib public test vendor
[stefan@MBP ~] glassfish -e jdevelopment
com/sun/enterprise/glassfish/bootstrap/ASMainStatic.java:46:in `run': java.lang.RuntimeException: java.lang.RuntimeException: the domain directory is not writable. (NativeException)
(1) [stefan@MBP ~] java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)
[stefan@MBP ~] sudo glassfish -e jdevelopment
Feb 2, 2009 12:16:18 PM com.sun.enterprise.glassfish.bootstrap.ASMainStatic findDerbyClient
INFO: Cannot find javadb client jar file, jdbc driver not available
Exception in thread "Static Framework Launcher" java.lang.TypeNotPresentException: Type javax.xml.stream.XMLInputFactory not present
at sun.reflect.annotation.TypeNotPresentExceptionProxy.generateException(TypeNotPresentExceptionProxy.java:27)
# Plist patch for Ruby 1.9.1
# Version: 3.0.0
# seems its just the change in case statement syntax
# broken
def self.element_type(item)
return case item
when String, Symbol: 'string'
when Fixnum, Bignum, Integer: 'integer'
when Float: 'real'
require 'scxml'
xml_string = %Q{
<?xml version="1.0" encoding="UTF-8"?>
<root>
<elements>
<element id="0">a</element>
<element id="1">b</element>
<element id="2">c</element>
</elements>