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
# recipe[dk4] is the one that doesn't run in a role's run_list, but runs if you spell out the recipes in a | |
# node's run_list | |
name "webhead_dev_test" | |
description "The development webhead role, for testing." | |
run_list "recipe[perl]", "recipe[memcached]", "recipe[start_pkgs]", "recipe[apache2]", "recipe[lighttpd]", "recipe[cpan_stuff]", "recipe[dk4_code]", "recipe[dk4]", "recipe[bzrtest]" | |
default_attributes "dk4" => { "git_branch" => "master", "deploy_type" => "development" }, "lighttpd" => { "extforward_headers" => [ "X-Cluster-Client-Ip", "X-Forwarded-For" ], "extforward_forwarders" => [ "::ffff:10.1.10.215", "10.1.10.215" ] } |
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
/* This should be a highly unusual circumstance, | |
* but apparently there's known issues with | |
* IE & 'deflate' - as in, IE claims that it can | |
* handle deflate, but doesn't actually handle | |
* it correctly. If we have content encoded with | |
* deflate and our user agent appears to be IE, | |
* it's probably safest to decompress it and | |
* let mod_deflate deal with it properly. This | |
* is along the lines of tossing it over the | |
* fence and letting Arby's deal with it. */ |
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
sub url_story { | |
my $req = shift; | |
my @path = @_; #shift; | |
my $p = {}; | |
my $len = scalar @path; | |
if ($len == 5){ | |
if ($path[$#path] =~ /^-/){ | |
$p->{id} = $path[3]; |
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
Backtrace: | |
# File Line Location | |
0 /home/jeremy/dk4-exper/vendor/rails/railties/lib/initializer.rb 270 in `rescue in require_frameworks' | |
1 /home/jeremy/dk4-exper/vendor/rails/railties/lib/initializer.rb 266 in `require_frameworks' | |
2 /home/jeremy/dk4-exper/vendor/rails/railties/lib/initializer.rb 131 in `process' | |
3 /home/jeremy/dk4-exper/vendor/rails/railties/lib/initializer.rb 110 in `run' | |
4 /home/jeremy/dk4-exper/config/environment.rb 9 in `' | |
5 /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb 267 in `require' | |
6 /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb 267 in `preload_application' | |
7 /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb 227 in `block in initialize_server' |
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
# the part of the story controller that does the saving and such | |
def edit | |
@story = Story.get(params[:id]) | |
@poll = @story.poll[0] | |
#@blogs = @story.user.blogadmins.map { |b| b.blog } | |
@blogs = @story.user.allowed_blogs | |
@taglist = params[:tags] || @story.tags.map { |t| t.tag }.join(", ") | |
if request.post? | |
if (params[:commit] == "Preview") |
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
# experiments with logging! | |
# Logging hook. | |
before :save, :story_log | |
# hmm? | |
before :save!, :story_log | |
# Logging goodies | |
def story_log |
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
# since you're curiuos.... | |
# inside the story view | |
<div id="comments"> | |
<ul class="cm i0"> | |
<% @n = 0 %> | |
<% @od = 0 %> | |
<% while @n < @comments.length do %> | |
<%= render :partial => 'comment/comment', :locals => { :comments => @comments, :depth_tree => @depth_tree } %> | |
<% 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
# works | |
# friends, followers | |
has n, :friended_users | |
has n, :friends, :through => :friended_users, :class_name => "User", :child_key => [:user_id], :mutable => true | |
has n, :followers, :through => :friended_users, :class_name => "User", :remote_name => :user, :child_key => [:friend_id], :mutable => true | |
# does not work | |
has n, :block_users | |
has n, :you_blockeds, :through => :block_users, :class_name => "User", :child_key => [:user_id], :mutable => true | |
has n, :blocked_yous, :through => :block_users, :class_name => "User", :child_key => [:blocked_id], :mutable => true |
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
# comment.rb | |
class Comment | |
include DataMapper::Resource | |
property :id, Integer, :serial => true | |
property :story_id, Integer | |
property :user_id, Integer | |
property :parent_id, Integer | |
property :time, DateTime |
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/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/property.rb:450:in `lazy_load' | |
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/property.rb:390:in `get' | |
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/property_set.rb:82:in `get' | |
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/relationship.rb:74:in `map' | |
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/property_set.rb:55:in `each' | |
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/property_set.rb:55:in `each' | |
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/property_set.rb:82:in `map' | |
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/property_set.rb:82:in `get' | |
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/relationship.rb:178:in `attach_parent' | |
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/associations/many_to_one.rb:55:in `replace' |