Skip to content

Instantly share code, notes, and snippets.

View maxwell's full-sized avatar
🦁
chillin

Maxwell Salzberg maxwell

🦁
chillin
View GitHub Profile
@maxwell
maxwell / gist:2353014
Created April 10, 2012 17:22
backtrace for translation
vendor/bundle/ruby/1.9.1/gems/i18n-0.6.0/lib/i18n/backend/pluralization.rb:37:in `pluralize'
vendor/bundle/ruby/1.9.1/gems/i18n-0.6.0/lib/i18n/backend/base.rb:40:in `translate'
vendor/bundle/ruby/1.9.1/gems/i18n-inflector-2.6.6/lib/i18n-inflector/backend.rb:74:in `translate'
lib/i18n_interpolation_fallbacks.rb:10:in `block in translate'
lib/i18n_interpolation_fallbacks.rb:8:in `each'
lib/i18n_interpolation_fallbacks.rb:8:in `translate'
vendor/bundle/ruby/1.9.1/gems/i18n-0.6.0/lib/i18n/backend/fallbacks.rb:44:in `block (2 levels) in translate'
vendor/bundle/ruby/1.9.1/gems/i18n-0.6.0/lib/i18n/backend/fallbacks.rb:43:in `catch'
vendor/bundle/ruby/1.9.1/gems/i18n-0.6.0/lib/i18n/backend/fallbacks.rb:43:in `block in translate'
vendor/bundle/ruby/1.9.1/gems/i18n-0.6.0/lib/i18n/backend/fallbacks.rb:42:in `each'
@maxwell
maxwell / gist:2312949
Created April 5, 2012 18:14
failures with gc patch in cucumber
...............................................................................................................................................................................................................................................................................................................................................................................................................................................................F----.................................................................................................................................................................. .................................................................................................................................................................................................P.................................................................................................................................................................................................F---------------------
@maxwell
maxwell / ugh.rb
Created March 31, 2012 17:28
a start on a migration rake task
# columns to drop from use
# invitation_token, invitation_sent_at, invitation_service, invitation_identifier, invitation_limit
#TLDR FLOW
# 1. Create LegacyInvitaions Table (migration)
# 2. Run this rake? task to create a boatload of data about all invitations in history of the system
# 3. Delete all users with nil usernames
# 4. Change code to use LegacyInvitations
# 5. Purge code of old Invitation model, DROP invitation table, and remove columns from user
@maxwell
maxwell / who_grant_sig.rb
Created March 11, 2012 09:15
WhoGrantSig...a really simple authenticated request system using public + private keys and webfinger for discovery
require 'rubygems'
require 'openssl'
require 'faraday'
#a fake user has a keypair and a email like idenitifier which responds
# to webfinger for discovery
class FakeUser
attr_accessor :key, :diaspora_handle
def initialize
#we dont have the enviroment, and it is not carring over from the migration
class Person < ActiveRecord::Base
belongs_to :owner, :class_name => 'User'
end
class User < ActiveRecord::Base
serialize :hidden_shareables, Hash
end
class Contact < ActiveRecord::Base
require File.join(File.dirname(__FILE__), '..', 'app', 'models', 'share_visibility')
require File.join(File.dirname(__FILE__), '..', 'app', 'models', 'contact')
require File.join(File.dirname(__FILE__), '..', 'app', 'models', 'user')
require File.join(File.dirname(__FILE__), '..', 'app', 'models', 'profile')
require File.join(File.dirname(__FILE__), '..', 'app', 'models', 'person')
class ShareVisibilityConverter
RECENT = 2 # number of weeks to do in the migration
def self.copy_hidden_share_visibilities_to_users(only_recent = false)
query = ShareVisibility.where(:hidden => true).includes(:contact => :user)
# WARNING: THIS MIGRATION REQUIRES SITE DOWNTIME!
#
# This migration is about moving the 'hidden' bit of a post into the User object.
# Doing this will pave the way to allow us to not have to create unnecessary share_visibilties for public posts, greatly reducing DB index size and RAM usage.
# The migration which will run is: 20120107220942_move_recently_hidden_posts_to_user.rb
#
# Since joindiaspora.com (and mostly likely other pods like diasp.org) have a fair amount of hidden posts, this migration happens in two parts
# First, in a table locking migration (**YOU MUST BE DOWN**, app servers, websockets, and resque workers to run this migration cleanly), we serialize the first
# batch of hidden posts into users. It will take a fair amount per user to do, on jd.com (about 1000 hidden posts per 5 mintues) so the strategy is to serialize the last
# two weeks of hidden hidden posts while the tables are locked.
@maxwell
maxwell / gist:1223136
Created September 16, 2011 20:59
error!
undefined method `save!' for #<RelayableRetraction:0x7810810>
lib/postzord/receiver/public.rb:48:in `save_object'
lib/postzord/receiver/public.rb:23:in `perform!'
app/models/jobs/receive_unencrypted_salmon.rb:14:in `perform'
[GEM_ROOT]/gems/resque-1.10.0/lib/resque/job.rb:146:in `perform'
[GEM_ROOT]/gems/resque-timeout-1.0.0/lib/resque/plugins/timeout.rb:25:in `around_perform_with_timeout'
/usr/local/rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/timeout.rb:62:in `timeout'
[GEM_ROOT]/gems/resque-timeout-1.0.0/lib/resque/plugins/timeout.rb:24:in `around_perform_with_timeout'
[GEM_ROOT]/gems/resque-1.10.0/lib/resque/job.rb:145:in `send'

Diaspora

Build Status

The privacy aware, personally controlled, do-it-all, open source social network.

TL;DR

Are you a user?

Diaspora

Build Status

The privacy aware, personally controlled, do-it-all, open source social network.

TL;DR

Are you a user?