Skip to content

Instantly share code, notes, and snippets.

View zvictor's full-sized avatar
🐥

Victor Duarte zvictor

🐥
View GitHub Profile
@zvictor
zvictor / aggregation.js
Created August 6, 2013 17:08
Aggregation (distinct, aggregate and mapReduce) extension for Meteor's Smart-collection
var Future, path, _dummyCollection_, _futureWrapper;
path = Npm.require("path");
Future = Npm.require(path.join("fibers", "future"));
_dummyCollection_ = new Meteor.Collection('__dummy__');
_futureWrapper = function(collection, commandName, args) {
var col, collectionName, future, result,
_this = this;
col = (typeof collection) === "string" ? _dummyCollection_ : collection;
collectionName = (typeof collection) === "string" ? collection : collection._name;
@zvictor
zvictor / django-crossdomainxhr-middleware.py
Created June 10, 2012 20:50 — forked from vicalejuri/django-crossdomainxhr-middleware.py
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
@zvictor
zvictor / models.py
Created November 9, 2011 11:24
An example how to connect userena with django-social registration.
from socialregistration.signals import connect as profile_connect
from userena.managers import ASSIGNED_PERMISSIONS
@receiver(socialregistration_signals.connect, sender = FacebookProfile, dispatch_uid = 'facebook.connect')
def social_connect_callback(sender, user, profile, client, **kwargs):
"""
Create a profile for this user after connecting
"""
# Create a userena user.