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
<?php if ( $comments ) : ?> | |
<div id="comments"> | |
<h3>Comments</h3> | |
<?php wp_list_comments(); ?> | |
<div class="pagination"><?php paginate_comments_links(); ?></div> | |
</div><!-- comments --> | |
<?php endif; ?> | |
<?php if ( comments_open() || pings_open() ) : ?> | |
<?php comment_form( 'comment_notes_before=&comment_notes_after=' ); ?> | |
<?php elseif ( $comments ) : ?> |
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
# db/schema.rb | |
create_table "feed_items", :force => true do |t| | |
t.integer "user_id" | |
t.integer "post_id" | |
t.datetime "post_created_at" | |
end | |
add_index "feed_items", ["user_id", "post_created_at"], :name => "index_feed_items_on_user_id_and_post_created_at" |
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
$('.submittable').live('change', function() { | |
$(this).parents('form:first').submit(); | |
}); |
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
class Video < ActiveRecord::Base | |
before_validation :set_attrs_via_embedly, :on => :create | |
def set_attrs_via_embedly | |
# example url: http://www.youtube.com/watch?v=oHg5SJYRHA0 | |
attrs = Embedly.get_attrs url | |
errors[:base] << "is not a video" unless attrs['type'] == 'video' | |
self.attributes = attrs | |
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
# /1-rick-roll-d -- videos to_param always starts with a number | |
match '/:id' => 'videos#show', :constraints => {:id => /^\d/}, :as => :video | |
# /trevor -- usernames can't start with a number | |
match '/:id' => 'users#show', :as => :user |
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
ruby-1.8.7-p174 ~ > gem list | |
*** LOCAL GEMS *** | |
rack (1.1.0) | |
rake (0.8.7) | |
rdoc (2.5.8) | |
ruby-1.8.7-p174 ~ > gem install passenger | |
Building native extensions. This could take a while... | |
Building native extensions. This could take a while... |
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
From bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001 | |
From: Ilya Grigorik <ilya@igvita.com> | |
Date: Thu, 10 Jun 2010 00:46:48 -0400 | |
Subject: [PATCH] async rails3 | |
--- | |
Gemfile | 6 ++++++ | |
app/controllers/widgets_controller.rb | 6 ++++++ | |
app/models/widget.rb | 2 ++ | |
config.ru | 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 'test_helper' | |
class UsersTest < ActionController::IntegrationTest | |
setup do | |
reset! | |
@conn = Faraday::Connection.new do |b| | |
b.adapter :action_dispatch, @integration_session | |
b.response :rails_json | |
end | |
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
STDOUT.sync = true | |
require 'queue' | |
start_time = Time.now.to_i | |
msg = 0 | |
queue = Queue.new("testing") | |
queue.subscribe do |obj| | |
msg += 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 'rubygems' | |
require 'rest_client' | |
require 'json' | |
req = RestClient.get 'http://feeds.delicious.com/v2/json/trevorturk?count=100' | |
links = JSON.parse(req.body) | |
body = '' | |
links.each do |l| | |
body << "<p><a href=\"#{l['u']}\">#{l['d']}</a></p>\n" |