Skip to content

Instantly share code, notes, and snippets.

var streamLib = require('activity-streams-mongoose')({
mongoUrl: app.siteConf.mongoUrl,
redis: app.siteConf.redisOptions,
defaultActor: defaultAvatar
});
var authentication = new require('./authentication.js')(streamLib, app.siteConf);
// Moved normalization to only be done on pre save
streamLib.types.UserSchema.pre('save', function (next) {
@ciberch
ciberch / redis.js
Created May 22, 2012 19:30
Publishing and Activity to Redis
var redis = require("redis");
var publisher = redis.createClient(options.redis.port, options.redis.host);
if(options.redis.pass) {
publisher.auth(options.redis.pass);
}
function publish(streamName, activity) {
activity.save(function(err) {
if (!_.isArray(activity.streams)) {
activity.streams = []
@ciberch
ciberch / mongoose-query.js
Created May 22, 2012 19:23
Activity Streams Mongoose Query
// https://github.com/ciberch/activity-streams-mongoose
Activity.find().sort('published', 'descending').limit(10).run(
function (err, docs) {
var activities = [];
if (!err && docs) {
activities = docs;
res.render('index', {activities: activities});
}
});
@ciberch
ciberch / mysql.js
Created May 22, 2012 18:20
Activity Query with Relational DB
User.hasMany("bugs", Bug, "creatorId");
Bug.belongsTo("user", User, "creatorId");
Project.hasMany("bugs", Bug, "projectId");
Bug.belongsTo("project", Project, "projectId");
User.hasMany("commits", Commit, "creatorId");
Commit.belongsTo("user", User, "creatorId");
Project.hasMany("commits", Commit, "projectId");
@ciberch
ciberch / SocialcasHomeStreamSample.xml
Created April 20, 2011 17:15
Example for how to create a Socialcast Home Stream Web part
<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
<Title>Home Stream </Title>
<FrameType>Default</FrameType>
<Description>The Socialcast Reach Web Part brings your Socialcast Community into SharePoint</Description>
<IsIncluded>true</IsIncluded>
<ZoneID>wpz</ZoneID>
<PartOrder>1</PartOrder>
<FrameState>Normal</FrameState>
<Height>500px</Height>
@ciberch
ciberch / JSONActivityStreamsExample
Created October 15, 2010 16:21
JSON Activity Streams Example
{"items": [
{
"verb": "post", // Id which maps to specification submitted to activity streams registrar
"postedTime": "2010-12-12T12:12:12Z",
"title": "Plain Text",
"summary": "Plain Text", // Have not decided on plain text only
"permalinkUrl": "...",
"to": [{"id" : "acct:john.doe@example.org"}], // We should use person constructs here
"cc": [{"id":"acct:jane.doe@example.org"}],
"bcc": [{"id":"acct:jean.deux@example.org"}],