Skip to content

Instantly share code, notes, and snippets.

View traviskroberts's full-sized avatar

Travis Roberts traviskroberts

View GitHub Profile
@traviskroberts
traviskroberts / gist:97
Created July 21, 2008 20:20
Generate Random Password
def generate_password(length=6)
chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ23456789'
password = ''
length.times { password << chars[rand(chars.length)] }
password
end
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1.2' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence those specified here
# Skip frameworks you're not going to use
# hello world method
def hello
puts "hello world"
end
Passenger spawn server: symbol lookup error: /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/ext/passenger/native_support.so: undefined symbol: RARRAY_LEN
*** Exception NoMethodError in spawn manager (undefined method `[]' for nil:NilClass) (process 1336):
from /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/lib/passenger/railz/framework_spawner.rb:89:in `start'
from /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/lib/passenger/spawn_manager.rb:218:in `spawn_rails_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/lib/passenger/spawn_manager.rb:213:in `synchronize'
from /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/lib/passenger/spawn_manager.rb:213:in `spawn_rails_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/lib/passenger/spawn_manager.rb:122:in `spawn_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/lib/passenger/spawn_manager.rb:247:in `handle_spawn_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/lib/passenger/abstract_server.rb:317:in `__send__'
fr
Trevr:sitedemo travis$ cap app:switch -p
Password:
triggering start callbacks for `app:switch'
triggering before callbacks for `require_recipes'
* executing `validate_required_variables'
* executing `require_recipes'
* executing `app:switch'
* executing "gem list | grep passenger || echo 'ERROR'"
servers: ["sitedemo.plexusweb.com"]
[sitedemo.plexusweb.com] executing command
# config.ru
require 'rubygems'
require 'merb-core'
Merb::Config.setup(:merb_root => ".",
:environment => ENV['RACK_ENV'])
Merb.environment = Merb::Config[:environment]
Merb.root = Merb::Config[:merb_root]
Merb::BootLoader.run
<VirtualHost *:80>
ServerName listode.local
DocumentRoot "/Users/travis/apacheprojects/listode/public"
RackEnv development
<directory "/Users/travis/apacheprojects/listode/public">
Order allow,deny
Allow from all
</directory>
// function to send the jQuery form object via AJAX
jQuery.fn.submitWithAjax = function() {
this.submit(function() {
// be sure to add the '.js' part so that it knows this is format:js
$.post(this.action + '.js', $(this).serialize(), null, "script");
return false;
})
return this;
};
def mark_as_complete(id)
provides :js
# do work, son
# set instance variable to indicate success/failure
if stuff_done
@complete = true
end
render
end
- if @complete
$("#div_name_#{@record.id}").html('complete');
$("#notes_#{@record.id}").replaceWith('<p>#{@record.notes}</p>');
- else
alert("An error occurred processing your request.");