Skip to content

Instantly share code, notes, and snippets.

View doxavore's full-sized avatar

Doug Mayer doxavore

View GitHub Profile
@doxavore
doxavore / gist:2661631
Created May 11, 2012 18:44 — forked from hipertracker/gist:214210
NGinx -> TorqueBox
/etc/hosts:
127.0.0.1 myhost jboss_server
NGINX:
server {
listen myhost:80;
server_name myhost;
location / {
proxy_set_header X-Real-IP $remote_addr;
@doxavore
doxavore / presenter.rb
Created April 19, 2012 16:00 — forked from ahoward/presenter.rb
worlds simplest presenter pattern. drop in replacement for ActiveRecord/Mongoid models in your controller
# the worlds lightest weight presenter pattern. to use simply
#
# file app/presenters/post_presenter.rb
#
# PostPresenter =
# Presenter.for(Post) do
# validates_presence_of :custom_field_for_this_form
#
# end
#
@doxavore
doxavore / Vagrantfile
Created April 15, 2012 20:16
Vagrant configuration
##################################
### Custom additions from Krux
##################################
### Extensive documentation here:
### http://vagrantup.com/docs/vagrantfile.html
require 'etc'
owner = ENV['KRUX_MY_USERNAME'] || Etc.getlogin
hosts = {
web:
static: public
context: /
ruby:
version: 1.9
@doxavore
doxavore / gist:1857419
Created February 18, 2012 04:33
Output after deploying app to local Torquebox
22:27:19,433 ERROR [org.torquebox.core.runtime] (Thread-114) Failed to initialize runtime: : org.jruby.exceptions.RaiseException: (LoadError) load error: org/torquebox/web/rails/boot -- java.lang.NullPointerException: null
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1047) [jruby.jar:]
at #<Class:0x2e13f822>.(root)(/Users/doug/projects/myapp/<torquebox-bootstrap>-boot.rb:3)Caused by: java.lang.NullPointerException
at org.yecht.ruby.RubyLoadHandler.handle(RubyLoadHandler.java:38) [jruby.jar:]
at org.yecht.Parser.addNode(Parser.java:300) [jruby.jar:]
at org.yecht.DefaultYAMLParser.yyparse(DefaultYAMLParser.java:676) [jruby.jar:]
at org.yecht.Parser.yechtparse(Parser.java:290) [jruby.jar:]
at org.yecht.Parser.parse(Parser.java:284) [jruby.jar:]
at org.yecht.ruby.YParser.load(YParser.java:152) [jruby.jar:]
at org.yecht.ruby.YParser$s$0$1$load.call(YParser$s$0$1$load.gen:65535)
@doxavore
doxavore / gist:1761475
Created February 7, 2012 19:44
Don't let Ember.js override setter
Person = Ember.Object.extend({
pets: (function (key, val) {
if (arguments.length > 1) {
// set value
}
else {
// return value
}
}).property('_pets')
});
resize: ->
elem = @$()
usableHeight = elem.height()
elem.children(':not(.si-fill-container)').each (idx, childEl) ->
usableHeight -= $(childEl).outerHeight()
@$('.si-fill-container').css('height', "#{usableHeight}px")
@doxavore
doxavore / gist:1676687
Created January 25, 2012 15:07 — forked from dx7/gist:1333785
Installing ruby-debug with ruby-1.9.3-p0
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1676687)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
guard 'rails', :port => 3000, :server => :thin, :debugger => true do
watch('Gemfile.lock')
watch(%r{^(config|lib)/.*})
# When caching classes, also restart when app is changed
cache_line = `cat config/environments/development.rb | grep "config\.cache_classes ="`
if cache_line =~ /=\s*(true|false)/ && $1 == 'true'
watch(%r{^app/.*})
end
end
@doxavore
doxavore / tmux.conf
Created November 13, 2011 15:47 — forked from bryanl/tmux.conf
I copied this from somewhere. It is a good start, though
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#