Skip to content

Instantly share code, notes, and snippets.

View ads901119's full-sized avatar

Alan Sha ads901119

View GitHub Profile
@ads901119
ads901119 / gist:3394795
Created August 19, 2012 13:30 — forked from evildmp/gist:3094281
Set up Django, nginx and uwsgi

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

  • virtualenv
  • Django
  • nginx
  • uwsgi
@havvg
havvg / ajax-form.js
Created August 1, 2012 13:20
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@chrislkeller
chrislkeller / README.md
Last active December 18, 2020 08:12
SpreadSheet To Fusion Tables

Script to sync a Google SpreadSheet to a Fusion Table

Save for a few legacy projects that still use Fusion Tables I don't actively use this script anymore. This update hopefully solves the OAuth issue that cropped up once Google depcricated the Client Login method used by the prior version.

As always, your mileage may vary, and I welcome someone -- Google or otherwise -- to offer a long-term maintained solution.

The following is largely cribbed from a Google example here. I try to explain some of the API settings that must be enabled in the Developer's Console and elsewhere

Create your spr

@berinhard
berinhard / django-social-auth-basic.py
Created May 8, 2012 02:46
django-social-auth-plus
########################################
########## MEU_PIPELINE.PY #############
########################################
def populate_user_profile(*args, **kwargs):
response = kwargs['response']
user = kwargs['user']
month, day, year = [int(x) for x in response['birthday'].split('/')]
kwargs = {
'user': user,
'hometown': response['hometown']['name'],
@aheckmann
aheckmann / storeImgInMongoWithMongoose.js
Created April 17, 2012 19:14
store/display an image in mongodb using mongoose/express
/**
* Module dependencies
*/
var express = require('express');
var fs = require('fs');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// img path
@agramfort
agramfort / ranking.py
Created March 18, 2012 13:10 — forked from fabianp/ranking.py
Pairwise ranking using scikit-learn LinearSVC
"""
Implementation of pairwise ranking using scikit-learn LinearSVC
Reference: "Large Margin Rank Boundaries for Ordinal Regression", R. Herbrich,
T. Graepel, K. Obermayer.
Authors: Fabian Pedregosa <[email protected]>
Alexandre Gramfort <[email protected]>
"""
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
@pedroburon
pedroburon / form_bootstrap.html
Created January 24, 2012 14:59
bootstrap compatible template for forms in django
{% load i18n %}
<form method="post"
{% if action_url %}action="{{ action_url }}"{%endif %}
{% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
{% csrf_token %}
<fieldset>
{% if form_legend %}
<legend>{% trans form_legend noop %}</legend>
{% endif %}{# form_legend #}
@kousha789123
kousha789123 / profile_picture_django_social_auth
Created January 23, 2012 12:39
Extending User class to save profile picture in django-social-auth when registering
# This is models.py for a new user profile that you would like to create.
"""
this gist gets an id from django-social-auth and based on that saves the photo from social networks into your model. This is one of the best ways to extend User model because this way, you don't need to redefine a CustomUser as explained in the doc for django-social-auth. this is a new implementation based on https://gist.github.com/1248728
"""
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.db import models
@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.