Skip to content

Instantly share code, notes, and snippets.

## spec_helper
Rspec.configure do |config|
config.include Devise::TestHelpers
config.before(:authenticate => :admin) do
#sign_in User.find_by_email("admin@example.com") If you uncomment this it crashes with the nil error
end
end
x = X(ittr, :)';
z = theta' * x;
@daicoden
daicoden / injectable.rb
Last active December 19, 2015 00:39
Minecart Injectable
module Minecart
module Injectable
module ClassMethods
# USAGE
# @param field
# The name of the instance variable to set with the injected value
# @param opts
# :with - a ruby java class i.e. (java.lang.String) which the config value can be cast into.
# :named - a string which will be used to retrieve an object annotated with the @Named convention.
# :annotated - a ruby java binding annotation which is used to retrieve the requested object
@daicoden
daicoden / gist:6586144
Created September 16, 2013 20:27
Patch that would be helpful to ethers if it gets into jruby 1.7.5.
JRuby 1.5 cleanup
# COMITTED UPSTREAM - But leaving here in case we need refernce.
# There was some implementation changed, and I didn't have tests to catch everything
# this is here until we can get it commited upstream
module JRuby
class JavaSignature
# FIXME: Can make this accept whole list too if that is actual contract
# FIXME: Can be literals too
def as_java_type(string)
@daicoden
daicoden / reliable.patch
Last active December 27, 2015 20:39
Patch for speeding up webrtc with the reliable shim.
From 4372eada0cb413d3834abb6a485f0fee5e72345e Mon Sep 17 00:00:00 2001
From: Matt Wilson <mattwilson@squareup.com>
Date: Sat, 9 Nov 2013 06:11:06 -0800
Subject: [PATCH] Booo Fuckin Ya.
---
assets/javascripts/vendor/peer.js | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/assets/javascripts/vendor/peer.js b/assets/javascripts/vendor/peer.js
@daicoden
daicoden / jruby_extensions.rb
Created November 17, 2013 19:55
Just some ideas for a couple more things I have run into
java_import com.foo.MyJavaClass
java_import com.foo.MyJavaInterface
java_import com.foo.TemplateClass
# Extending from generic superclass
# This is needed because a new type is created, and
# there is no way currently in JRuby to specify template classes
# because most template information is unavailable during runtime
class MyRuby < MyJavaClass(TemplateClass)
end