Skip to content

Instantly share code, notes, and snippets.

@dnagir
dnagir / document.rb
Created December 12, 2011 05:25
Integrating neo4j with Dragonfly in Rails
class Document < Neo4j::Model
property :file_uid, :type => String
property :file_name, :type => String
file_accessor :file
end
@dnagir
dnagir / Gemfile
Created December 9, 2011 09:11
devise-neo4j
source 'http://rubygems.org'
gem "neo4j", "~> 1.3.0"
gem "devise-neo4j"
@dnagir
dnagir / shell.sh
Created December 8, 2011 01:37
JRuby can't run on thin and can't install unicorn
RAILS_ENV=production thin start
The signal QUIT is in use by the JVM and will not work correctly on this platform
>> Using rack adapter
JopensslService.java:66 warning: already initialized constant PKCS1_PADDING
JopensslService.java:66 warning: already initialized constant SSLV23_PADDING
JopensslService.java:66 warning: already initialized constant NO_PADDING
JopensslService.java:66 warning: already initialized constant PKCS1_OAEP_PADDING
JopensslService.java:66 warning: already initialized constant UNIVERSAL_TAG_NAME
JopensslService.java:66 warning: already initialized constant EOC
JopensslService.java:66 warning: already initialized constant BOOLEAN
@dnagir
dnagir / jruby-trinidad-non-threaded.sh
Created December 8, 2011 01:31
JRyby, MRI 1.9.3 and Rails 3.1 Benchmarks
FIRST REQUEST
Concurrency Level: 1
Time taken for tests: 0.670 seconds
Complete requests: 1
Failed requests: 0
Write errors: 0
Total transferred: 2956 bytes
HTML transferred: 2348 bytes
Requests per second: 1.49 [#/sec] (mean)
Time per request: 670.401 [ms] (mean)
@dnagir
dnagir / environment.sh
Created December 7, 2011 03:05
JRuby no stacktrace repro
> rvm info
jruby-1.6.5:
system:
uname: "Darwin dima-mac.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"
rvm:
@dnagir
dnagir / terminal.sh
Created December 7, 2011 02:03
No Stacktrace in JRuby
> rvm use jruby
Using /Users/dnagir/.rvm/gems/jruby-1.6.5
> bundle exec rspec spec/models/user_spec.rb --backtrace
NameError: uninitialized constant ActiveRecord
> rvm use 1.9.3
Using /Users/dnagir/.rvm/gems/ruby-1.9.3-p0
@dnagir
dnagir / specs-run.sh
Created December 2, 2011 13:44
JRuby vs Ruby 1.9.3
# | wall time | specs |
# JRuby | 69s | 34s |
# Ruby 1.9.3 | 28s | 16s |
# x faster | x2.5 | 2.1 |
> ruby -v
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
> time bundle exec rspec spec
Finished in 33.8 seconds
@dnagir
dnagir / spec-results
Created November 30, 2011 00:26
architect4r failing specs
......................***......FFFFFFFF.FFF.....F...*..............FFFFFFFFFF*.F...............**........F..FFFF.FF.....FFF.FFFFF...F.......F**
Pending:
Architect4r::Server execute_cypher should return an array of nodes
# No reason given
# ./spec/core/cypher_methods_spec.rb:9
Architect4r::Server execute_cypher should return an array of relationships
# No reason given
# ./spec/core/cypher_methods_spec.rb:15
Architect4r::Server execute_cypher should the data unprocessed
@dnagir
dnagir / sample_spec.rb
Created November 29, 2011 00:21
jRuby and RSpec shared examples issue
shared_examples_for "weird" do |options={}|
# Uncomment to make it work in jruby
#options = {} unless options.respond_to? :to_hash
it "should be a hash" do
options.should be_a Hash
end
end
@dnagir
dnagir / min.rb
Created November 8, 2011 04:01
Spine minimization sizes
require 'closure-compiler'
packages = {
bare: %w{spine.js},
core: %w{spine.js ajax.js route.js tmpl.js},
full: %w{ajax.js list.js local.js manager.js relation.js route.js spine.js tabs.js tmpl.js}
}
packages.each_pair do |package, files|
all = files.inject('') {|m, c| m + File.read("lib/#{c}") }