Skip to content

Instantly share code, notes, and snippets.

View maxwell's full-sized avatar
🦁
chillin

Maxwell Salzberg maxwell

🦁
chillin
View GitHub Profile

Diaspora

Build Status

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

TL;DR

Are you a user?

def person_href(person, opts={})
if opts[:absolute]
link = "href='/"
else
link = "href=#{AppConfig.pod_url}"
end
if person.local?
username = person.diaspora_handle.split('@')[0]
unless username.include?('.')
return link+"u/#{person.diaspora_handle.split('@')[0]}'"
require 'rubygems'
require 'faraday'
$conn = Faraday.new(:url => 'http://localhost:3000') do |builder|
builder.request :url_encoded
builder.request :json
builder.response :logger
builder.adapter :net_http
end
require 'rubygems'
require 'faraday'
$conn = Faraday.new(:url => 'http://localhost:3000') do |builder|
builder.request :url_encoded
builder.request :json
builder.response :logger
builder.adapter :net_http
end
@maxwell
maxwell / gist:1112309
Created July 28, 2011 19:19
message bus email interceptor wip
##register this class as an interceptor
##this should be in the message_bus_ruby_api gem, and needs to have configuration, and #map to action mailer in a less dumb way
#also, can we prevent action mailer from continuing to do its default config?
#no time to dig into it now.
require 'message_bus_ruby_api'
class MessageBusInterceptor
def self.delivering_email(message)
client = MessagebusRubyApi::Client.new(MESSAGE_BUS_API_KEY)
@maxwell
maxwell / webfinger.rb
Created June 5, 2011 00:15
using faraday magic for webfinger parsing. modified code from sporkmonger webfinger repo
#tons take from sporkmonger's webfinger github
require File.join(Rails.root, 'lib/webfinger/hcard')
require File.join(Rails.root, 'lib/webfinger/webfinger_profile')
require 'addressable/uri'
require 'addressable/template'
require 'xrd'
class Webfinger
def self.lookup(email)
setup_faraday
Number of Commits to Diaspora, per author:
1435 Raphael
1238 maxwell
914 danielvincent
585 ilya
535 MrZYX
449 zhitomirskiyi
377 Raphael Sofaer
335 Sarah Mei
249 Alec Leamas
require 'rake'
task :install do
puts "this currently is untested, prepare for tragedy"
BREW_INSTALLED = installed?('brew')
CURL_INSTALLED = installed?('curl')
MYSQL_INSTALLED = installed?('msql')
REDIS_INSTALLED = installed?('redis-server')
unless BREW_INSTALLED
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
@maxwell
maxwell / gist:912806
Created April 10, 2011 22:37
each puts is a run of httpmulti#perform
maxwell~/Sites/diaspora (master *)$ rake
(in /Users/maxwell/Sites/diaspora)
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Users/maxwell/Sites/diaspora/vendor/gems/jasmine/jasmine.gemspec:13
.
/Users/maxwell/.rvm/rubies/ree-1.8.7-2010.02/bin/ruby -S bundle exec rspec ./spec/config/config_spec.rb ./spec/controllers/admins_controller_spec.rb ./spec/controllers/apis_controller_spec.rb ./spec/controllers/application_controller_spec.rb ./spec/controllers/aspect_memberships_controller_spec.rb ./spec/controllers/aspects_controller_spec.rb ./spec/controllers/comments_controller_spec.rb ./spec/controllers/contacts_controller_spec.rb ./spec/controllers/conversation_visibilities_controller_spec.rb ./spec/controllers/conversations_controller_spec.rb ./spec/controllers/home_controller_spec.rb ./spec/controllers/invitations_controller_spec.rb ./spec/controllers/likes_controller_spec.rb ./spec/cont