Skip to content

Instantly share code, notes, and snippets.

@manuels
manuels / gist:1246383
Created September 27, 2011 22:01
log on disinherit-photos-version when receiving a photo-only post from the master-version
Started POST "/receive/users/88454cd3db1d8887/" for 127.0.0.1 at Wed Sep 28 00:41:20 +0200 2011 pid=28783 time=1317163280
SQL (0.2ms) BEGIN pid=28783 time=1317163281
SQL (0.1ms) COMMIT pid=28783 time=1317163281
Processing by PublicsController#receive as pid=28783 time=1317163283
Parameters: {"xml"=>"++++%3C%3Fxml+version%3D%271.0%27+encoding%3D%27UTF-8%27%3F%3E%0A++++%3Cdiaspora+xmlns%3D%22https%3A%2F%2Fjoindiaspora.com%2Fprotocol%22+xmlns%3Ame%3D%22http%3A%2F%2Fsalmon-protocol.org%2Fns%2Fmagic-env%22%3E%0A++++++++++++++%3Cencrypted_header%3E%0A++++++++++eyJjaXBoZXJ0ZXh0IjoiRmRnUFNsQ0VZV0lieDdwenVrRGFyeWJVRUN1YWJ2SjM1RU1DN0dXKzFyYXlGNVludXljSFc5UjJadnpBVFNXeFpWcVpUbVJnR01uTmkzWG9MdTFKSW1iTU9ESXptN3MvTS9Wdk5KNEJ3S1VUbXp3ME9zRmFJNWRJbW9YMUwwMStCSTh5Zjk4QnBjOXVJb21UdXRJVHhXSjBtNVNKMGJuNEdhYm5BV1NTUDNMcHNMMXNjUG14Ri9MTjNmTmI0aE02M2ZwTkI1aVM0OVhrZWdaQVJzZjZEYWVmTGZLVGpZRnlhc3l3MG5ueno5ZW9saW9XR3NkczhjalJYcU02QnJ3cnhaTXd3czh5QWV4aTRpNUFvdjE0Tmc9PSIsImFlc19rZXkiOiJsWUtNZ1RwdWNSenE0NmplV1o4UXpnUG5W
@manuels
manuels / gist:1246391
Created September 27, 2011 22:02
log on master-version when receiving a photo-only post from the disinherit-photos-version
Started POST "/receive/users/909b3184e114a37e/" for 127.0.0.1 at Mon Oct 10 21:46:10 +0200 2011 pid=32321 time=1318275970
SQL (0.2ms) BEGIN pid=32321 time=1318275971
SQL (0.2ms) COMMIT pid=32321 time=1318275971
Processing by PublicsController#receive as pid=32321 time=1318275971
Parameters: {"xml"=>"[FILTERED]", "guid"=>"909b3184e114a37e"} pid=32321 time=1318275971
SQL (1.1ms) SHOW TABLES pid=32321 time=1318275971
Person Load (0.2ms) SELECT `people`.* FROM `people` WHERE `people`.`guid` = '909b3184e114a37e' LIMIT 1 pid=32321 time=1318275972
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 LIMIT 1 pid=32321 time=1318275972
Rendered text template (0.0ms) pid=32321 time=1318275972
Completed 202 Accepted in 661ms (Views: 2.8ms | ActiveRecord: 2.0ms) pid=32321 time=1318275972
module M0
def foo
puts 'M2::foo'
end
end
module M1
include M0
def self.included(model)
class MovePhotosToTheirOwnTable < ActiveRecord::Migration
def self.up
# create new table to which we can move all records from 'posts' table with type=='Photo'
create_table "photos", :force => true do |t|
t.integer "author_id", :null => false
t.boolean "public", :default => false, :null => false
t.string "diaspora_handle"
t.string "guid", :null => false
t.boolean "pending", :default => false, :null => false
t.text "text"
class CommentAnything < ActiveRecord::Migration
def self.up
# before renaming the post_id column, we have to remove the corresponding indices and foreign keys
remove_foreign_key :comments, :posts
remove_index :comments, :post_id
# make comments able to refer to any table
# so the name post_id does not make sense anymore, since we could also refer to a different table
# call it commentable_id as a generic reference to a foreign key
# store the table that commentable_id refers to in commentable_type
class ShareAnything < ActiveRecord::Migration
def self.up
# remove indices and keys of post_id column, since we want to rename it
remove_foreign_key :aspect_visibilities, :posts
remove_index :aspect_visibilities, :post_id_and_aspect_id
remove_index :aspect_visibilities, :post_id
# rename post_id column to shareable_id since now everything can have
# a aspect_visibility not only posts
# store the table that the thing we reference in shareable_id in shareable_type
class MovePhotosToTheirOwnTable < ActiveRecord::Migration
def self.up
create_table "photos", :force => true do |t|
t.integer "tmp_old_id", :null => true
t.integer "author_id", :null => false
t.boolean "public", :default => false, :null => false
t.string "diaspora_handle"
t.string "guid", :null => false
t.boolean "pending", :default => false, :null => false
t.text "text"
diff --git a/public/javascripts/publisher.js b/public/javascripts/publisher.js
index baf4e0d..a63f58c 100644
--- a/public/javascripts/publisher.js
+++ b/public/javascripts/publisher.js
@@ -362,8 +362,11 @@ var Publisher = {
return false;
}
Publisher.hidePreview();
+ Publisher._pendingSubmit = true;
},
/var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/spec_set.rb:88:in `materialize': Could not find client_side_validations-3.1.0 in any of the sources (Bundler::GemNotFound)
from /var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `map!'
from /var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `materialize'
from /var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/definition.rb:90:in `specs'
from /var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/definition.rb:135:in `specs_for'
from /var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/definition.rb:124:in `requested_specs'
from /var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/environment.rb:23:in `requested_specs'
from /var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:11:in `setup'
from /var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup'
from /var/lib/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/setup.rb:17
@manuels
manuels / gist:1320677
Created October 27, 2011 19:53
oEmbed iframe check script
require 'rubygems'
require 'oembed'
urls =<<URLS
http://www.youtube.com/watch?v=2BYXBC8WQ5k
http://qik.com/video/49565
http://revision3.com/tekzilla/cali-lewis-onstar-review
http://www.hulu.com/watch/293814/the-morning-after-thu-oct-27-2011?promo=thumbnail
http://www.viddler.com/explore/cdevroe/videos/424/
URLS