Skip to content

Instantly share code, notes, and snippets.

View krisleech's full-sized avatar

Kris Leech krisleech

View GitHub Profile
@krisleech
krisleech / gist:1133712
Created August 9, 2011 10:16
torquebox $JBOSS/app knob file
# http://torquebox.org/documentation/LATEST/deployment-descriptors.html
application:
root: /home/****/apps/green_tick/development/current/
env: development
web:
context: /
environment:
BUNDLE_WITHOUT: "development:test"
@krisleech
krisleech / htmlcleaner.rb
Created October 31, 2011 10:53
HTMLCleaner in JRuby
require 'java'
require 'stringio'
include Java
mydir = File.expand_path(File.dirname(__FILE__))
require File.join(mydir, 'htmlcleaner-2.2.jar')
import "org.htmlcleaner.HtmlCleaner"
@krisleech
krisleech / jsoup.rb
Created October 31, 2011 22:40
Using JSoup in JRuby
require 'java'
require 'stringio'
include Java
mydir = File.expand_path(File.dirname(__FILE__))
require File.join(mydir, 'jsoup-1.6.1.jar')
import "org.jsoup.Jsoup"
import "org.jsoup.safety.Whitelist"
@krisleech
krisleech / Gemfile
Created November 6, 2011 14:49
Gemfile
source 'http://rubygems.org'
gem 'bundler'
gem 'rails', '3.0.10'
gem 'ancestry'
gem 'acts_as_list', :git => 'git://github.com/swanandp/acts_as_list.git' # has default_scope fix
gem 'nested_set'
gem 'mechanize'
GIT
remote: git://github.com/krisleech/dragonfly.git
revision: f621fd8d059f649f8643584141f4748cd8435f76
branch: torquebox_fix
specs:
dragonfly (0.9.3)
rack
GIT
remote: git://github.com/swanandp/acts_as_list.git
@krisleech
krisleech / adapter.rb
Created November 14, 2011 16:25
Bug in arjdbc/mysql/adapter.rb
# undefined method `reverse' for nil:NilClass
# activerecord-jdbc-adapter (1.2.0) lib/arjdbc/mysql/adapter.rb:432:in `exec_insert'
# org/jruby/RubyString.java:2739:in `gsub'
# org/jruby/RubyString.java:2719:in `gsub'
# activerecord-jdbc-adapter (1.2.0) lib/arjdbc/mysql/adapter.rb:432:in `exec_insert'
# activerecord (3.1.1) lib/active_record/connection_adapters/abstract/database_statements.rb:96:in `update'
# activerecord (3.1.1) lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `update'
# /gems/activerecord-jdbc-adapter-1.2.0/lib/arjdbc/mysql
@krisleech
krisleech / Error
Created November 28, 2011 09:33
torquespec / capybara
Using running JBoss (try lazy=false if you get errors)
The signal QUIT is in use by the JVM and will not work correctly on this platform
SOCKET: SET COMM INACTIVITY UNIMPLEMENTED 30
java(2362,0x10d301000) malloc: *** error for object 0x102926070: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
@krisleech
krisleech / deployer.rb
Created December 6, 2011 15:57
KISS deployment of Torquebox 2.x
class Deployer
attr_reader :app_name, :environment, :root_dir, :deploy_dir, :current_dir, :shared_dir, :torquebox_dir, :torquebox_apps_dir, :server, :dry_run, :commands
def initialize(environment = 'staging', dry_run = false)
@app_name = 'my_app_name'
@environment = environment.to_s
@root_dir = '/home/XXXXX/apps'
@deploy_dir = File.join(root_dir, app_name, environment)
@current_dir = File.join(deploy_dir, 'current')
@shared_dir = File.join(deploy_dir, 'shared')
class RevisionRequest < ActiveRecord::Base
belongs_to :document
belongs_to :version
before_save :ensure_authentication_token
accepts_nested_attributes_for :document
devise :token_authenticatable, :trackable, :timeoutable
class Deployer
attr_reader :app_name, :environment, :root_dir, :deploy_dir, :current_dir, :shared_dir, :torquebox_dir, :torquebox_apps_dir, :server, :dry_run, :commands
def initialize(environment = 'staging', dry_run = false)
@app_name = 'green_tick'
@environment = environment.to_s
@root_dir = '/home/kris/apps'
@deploy_dir = File.join(root_dir, app_name, environment)
@current_dir = File.join(deploy_dir, 'current')
@shared_dir = File.join(deploy_dir, 'shared')