Skip to content

Instantly share code, notes, and snippets.

View agibralter's full-sized avatar
:shipit:

Aaron Gibralter agibralter

:shipit:
View GitHub Profile
@agibralter
agibralter / gist:13416
Created September 28, 2008 06:09 — forked from retr0h/gist:9204
require 'singleton'
begin
require 'daemon_controller'
rescue LoadError
raise('FATAL: sudo gem install FooBarWidget-daemon_controller -s http://gems.github.com')
end
##
# sudo port install memcached
class DaemonMemcache
map.resources :settings
settings.namespace do |setting|
setting.resources :units
setting.resources :groups
end
end
class Settings::Units < SettingsController
end
class Settings::Groups < SettingsController
require File.dirname(__FILE__) + '/../../spec_helper'
describe Admin::BaseController do
subject do
Class.new(Admin::BaseController) do
def index; end
end.new
end
/opt/local/bin/ruby /opt/local/lib/ruby/gems/1.8/gems/rspec-1.2.2/bin/spec --autospec spec/controllers/password_resets_controller_spec.rb -O spec/spec.opts
F..
1)
NoMethodError in 'PasswordResetsController PUT /password_resets/update re-renders the 'edit' template'
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
/Users/jeff/development/urlagg/app/controllers/password_resets_controller.rb:27:in `update'
./spec/controllers/password_resets_controller_spec.rb:26:
# If we ever end up running God / Starling on other environments than production.
# we'll have to find a different way to set the values below.
STARLING_PORT = 15151
STARLING_HOST = '<my ip address>'
RAILS_ENV = 'production'
# Based on example from <http://railscasts.com/episodes/130-monitoring-with-god>
RAILS_ROOT = '/var/www/myapp'
#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'
# This is a bit hacky, but we don't have a clean way to hook into the parsed
# options, as Daemons is managing these internally.
number = 0
for i in 0..ARGV.length
if ARGV[i] == '--number'
number = ARGV[i + 1]
var val1, val2, val3, str, obj;
str = "info.first_name";
obj = {
info: {
first_name: "Bob"
}
};
@agibralter
agibralter / jammit-mustache.js
Created April 19, 2010 22:22 — forked from documentcloud/jammit-mustache.js
Mustache.js templating function for Jammit.
// Add a Mustache.js templating function to your JavaScript:
Mustache.template = function(templateString) {
return function () {
if (arguments.length < 1) {
// With no arguments, return the raw template -- useful for rendering
// partials.
return templateString;
} else {
return Mustache.to_html(templateString, arguments[0], arguments[1]);
@agibralter
agibralter / rails.rb
Created May 3, 2010 18:32 — forked from foca/rails.rb
Rails + Mustache
require "mustache"
ActiveSupport::Dependencies.load_paths << Rails.root.join("app", "views")
class Mustache::Rails < Mustache
include ActionController::UrlWriter
include ActionView::Helpers
attr_accessor :request, :response, :params, :controller
`brew install redis`
`sudo mate /Library/LaunchDaemons/org.redis.redis-server.plist`
...enter content...
`sudo launchctl load /Library/LaunchDaemons/org.redis.redis-server.plist`
`sudo launchctl start org.redis.redis-server`