This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map.resources :settings | |
settings.namespace do |setting| | |
setting.resources :units | |
setting.resources :groups | |
end | |
end | |
class Settings::Units < SettingsController | |
end | |
class Settings::Groups < SettingsController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(__FILE__) + '/../../spec_helper' | |
describe Admin::BaseController do | |
subject do | |
Class.new(Admin::BaseController) do | |
def index; end | |
end.new | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var val1, val2, val3, str, obj; | |
str = "info.first_name"; | |
obj = { | |
info: { | |
first_name: "Bob" | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`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` |
OlderNewer