Skip to content

Instantly share code, notes, and snippets.

View itirkaa's full-sized avatar
:octocat:
Focusing

Aakriti Sharma itirkaa

:octocat:
Focusing
View GitHub Profile
# Step 1 - Make a scatter plot with square markers, set column names as labels
def heatmap(x, y, size):
fig, ax = plt.subplots()
# Mapping from column names to integer coordinates
x_labels = [v for v in sorted(x.unique())]
y_labels = [v for v in sorted(y.unique())]
x_to_num = {p[1]:p[0] for p in enumerate(x_labels)}
y_to_num = {p[1]:p[0] for p in enumerate(y_labels)}
@revolunet
revolunet / social.py
Last active January 14, 2021 05:58
Sample custom pipeline for django-social-auth and Facebook backend. Goal is to ask more info to the user before creating the account and the related Customer model.
# settings.py
FACEBOOK_EXTENDED_PERMISSIONS = ['email', 'user_birthday', 'user_location']
SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.user.get_username',
'social_auth.backends.pipeline.misc.save_status_to_session',
'web.facebook.check_registered',
'social_auth.backends.pipeline.user.create_user',
'web.facebook.check_profile',
'social_auth.backends.pipeline.social.associate_user',