Skip to content

Instantly share code, notes, and snippets.

View mford22392's full-sized avatar

Madeline Ford Ryerson mford22392

View GitHub Profile
{
"options": {
"customScripts": {
"change_email": "function changeEmail(oldEmail, newEmail, emailVerified, callback) {var conString = configuration.DATABASE_URL || 'postgres://[email protected]:14391/guild_development';postgres(conString, function (err, client, done) {if (err) {console.log('could not connect to postgres db', err);return callback(err);}const query = 'UPDATE users SET email = $1 WHERE email = $2';client.query(query, [newEmail, oldEmail], function (err, result) {done();if (err) {console.log('error executing query', err);return callback(err);}if (result.rows.length === 0) {return callback(null);} else {var user = result.rows[0];callback(null, {id: user.uuid,email: user.email,given_name: user.first_name,family_name: user.last_name,phone_number: user.phone});}});});}",
"login": "function login(email, password, callback) {\n //this example uses the \"pg\" library\n //more info here: https://github.com/brianc/node-postgres\n\n // If you are in guild-dev, swit
import * as React from 'react';
import auth0 from 'auth0-js';
const webAuth = new auth0.WebAuth({
clientID: process.env.AUTH0_CLIENT_ID || '',
domain: 'auth.guildacceptance.com',
responseType: 'token id_token',
redirectUri: window.location.href.replace('input', 'success'),
});
@mford22392
mford22392 / disney-brainstorm.js
Created February 5, 2020 00:36
disney brainstorm
// eslint-disable-next-line no-unused-vars
function linkAccountsByDisneyIdAndMergeMetadata(user, context, callback) {
var request = require('[email protected]');
var async = require('[email protected]');
// This url is: https://<tenant>.auth0.com/api/v2/users
var userApiUrl = auth0.baseUrl + '/users';
// Only run this for DisneySAML users coming through the flow for the first time
// If merging is successful, identities.length will be 2+ the next time through
# Note: in the following sections, not every single combination of coach_recs, bookmarks and quiz_results is tested
# Essentially, coach recs, bookmarks and quiz results will always obey that order
# If one or more should not show, they just dont show, but the order of the others is unchanged
##############################
# User has no applications #
##############################
# 1. User answers 1-3 on influencer question
# 1a. No coach recs, bookmarks, or quiz results
{
"data": {
"portal_data": {
"first_name": "Madeline",
"last_name": "Ryerson",
"phone": "917-699-5885",
"email": "[email protected]",
"state": "Connecticut",
"prior_education_experience": "Earned a high school diploma",
"how_can_we_help_you": "I'd like to submit reimbursement costs for existing programs",
{
"data": {
"portal_data": {
"error": "Service unavailable."
},
"eligibility_data": {
"error": "Service unavailable",
"eligible": null,
"eligibilityCriteria": []
},
[
{
"key": "next_step",
"weight": 100,
"children": [
{
"key": "quiz",
"weight": 0,
"children": null
},
def reimbursement_weights(self):
return {
"reimbursement": 80,
"contact": 70,
"coach_recommendations": 60 if self.coach_recommendations else 0,
"bookmarks": 50 if self.bookmarks else 0,
"quiz_recommendations": 40 if self.quiz_results else 0,
"quiz": 0
}
# Note how you could easily make 50 the default, and have the elif statement return default
# while the else statement returns hard coded 40... it sort of makes "default" lose its meaning...
class ContactComponent(WeightedComponent):
def calculate_weight(self):
if seeking_reimbursement:
return 70
elif unsure:
return 50
else:
return self.default_weight # 40
from services.weighting_service import WeightingService
from tests.unit.test_utility import sort_keys, set_data
def test_default():
influencer_answer = "I want to go back to school, and I know what type of program, degree, or certificate I want to complete"
apps_to_finish = True
completed_apps = True
coach_recs = ["foo"]
bookmarks = ["foo"]
quiz_results = ["foo"]