Skip to content

Instantly share code, notes, and snippets.

View doxavore's full-sized avatar

Doug Mayer doxavore

View GitHub Profile
package org.ruby_http_parser;
import org.jruby.Ruby;
import org.jruby.RubyArray;
import org.jruby.RubyClass;
import org.jruby.RubyHash;
import org.jruby.RubyModule;
import org.jruby.RubyNumeric;
import org.jruby.RubyObject;
import org.jruby.RubyString;
def initialize(appid=nil, secret=nil, securityalgorithm=nil,
force_delauth_nonprovisioned=nil,
policyurl=nil, returnurl=nil)
self.force_delauth_nonprovisioned = force_delauth_nonprovisioned
self.appid = appid if appid
self.secret = secret if secret
self.securityalgorithm = securityalgorithm if securityalgorithm
self.policyurl = policyurl if policyurl
self.returnurl = returnurl if returnurl
end
gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'
@doxavore
doxavore / TimeTextBox.js
Created February 12, 2013 19:32
setTimeout for the win. Thanks, Dojo!
// setTimeout() because the keystroke hasn't yet appeared in the <input>,
// so the get('displayedValue') call below won't give the result we want.
setTimeout(dojo.hitch(this, function(){
// set this.filterString to the filter to apply to the drop down list;
// it will be used in openDropDown()
var val = this.get('displayedValue');
this.filterString = (val && !this.parse(val, this.constraints)) ? val.toLowerCase() : "";
// close the drop down and reopen it, in order to filter the items shown in the list
// and also since the drop down may need to be repositioned if the number of list items has changed
create_table :users, id: false do |t|
t.uuid :id, primary: true, null: false
# ...
end
@doxavore
doxavore / tmpdir.rb
Created November 2, 2012 15:37
JRuby Dir.tmpdir
def Dir::tmpdir
tmp = '.'
if $SAFE > 0
tmp = @@systmpdir
else
# Search a directory which isn't world-writable first. In JRuby,
# FileUtils.remove_entry_secure(dir) crashes when a dir is under
# a world-writable directory because it tries to open directory.
# Opening directory is not allowed in Java.
dirs = [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp', tmp]
[INFO] --- jruby-maven-plugin:0.28.4:jruby (perform-assembly) @ torquebox-build-assembly ---
[INFO] TorqueBox.... 2.2.0-SNAPSHOT
[INFO] JBoss........ 7.1.x.incremental.129
[INFO] JRuby........ 1.7.0
[INFO] Polyglot..... 1.9.0-SNAPSHOT
[INFO] Stilts....... 0.1.28
[INFO] Maven repo: /Users/doug/.m2/repository
@doxavore
doxavore / dist_error.log
Created November 1, 2012 14:33
Failing TorqueBox local build
[INFO] ------------------------------------------------------------------------
[INFO] Building TorqueBox Build Distribution 2.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0-beta-1:enforce (enforce-java-version) @ torquebox-dist ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.0-beta-1:enforce (enforce-maven-version) @ torquebox-dist ---
[INFO]
[INFO] --- maven-source-plugin:2.1.2:jar-no-fork (attach-sources) @ torquebox-dist ---
[INFO]
@doxavore
doxavore / server.log
Created October 31, 2012 21:25
TorqueBox 2.1.2 not finding secret on redeploy
16:22:56,554 ERROR [stderr] (http-/10.8.1.32:8080-2)
16:22:56,555 ERROR [stderr] (http-/10.8.1.32:8080-2) ArgumentError (A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb):
16:22:56,555 ERROR [stderr] (http-/10.8.1.32:8080-2) /data/myapp/shared/bundle/jruby/1.9/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:320:in `ensure_secret_secure'
16:22:56,555 ERROR [stderr] (http-/10.8.1.32:8080-2) /data/myapp/shared/bundle/jruby/1.9/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:282:in `initialize'
16:22:56,555 ERROR [stderr] (http-/10.8.1.32:8080-2) /data/myapp/shared/bundle/jruby/1.9/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:229:in `signed'
16:22:56,555 ERROR [stderr] (http-/10.8.1.32:8080-2) /data/myapp/shared/bundle/jruby/1.9/gems/actionpack-3.2.8/lib/action_dispatch/middleware/session/cookie_store.rb:53:in `unpacke
@doxavore
doxavore / cruby_out.txt
Created October 19, 2012 21:00
Nokogiri 1.5.5: CRuby vs JRuby
<?xml version="1.0"?>
<D:multistatus xmlns:D="DAV:">
<D:response>
<D:href>some url one</D:href>
</D:response>
<D:response>
<D:href>some url two</D:href>
</D:response>
</D:multistatus>