This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Storage(name) { | |
this.name= name; | |
this.ready = (done)=> { | |
var request = window.indexedDB.open(name); | |
request.onupgradeneeded = e => { | |
this.db = e.target.result; | |
this.db.createObjectStore(name); | |
}; | |
request.onsuccess = e => { | |
this.db = e.target.result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as functions from "firebase-functions"; | |
import * as firebase from "firebase-admin"; | |
import {MD5} from "crypto-js"; | |
export const createUserDoc = functions.auth.user().onCreate(event => { | |
const firebaseUser = event.data; | |
// Use gravatar as default if photoUrl isn't specified in user data | |
const gravatarHash = MD5(firebaseUser.email).toString().toLowerCase(); | |
let photoURL = `https://www.gravatar.com/avatar/${gravatarHash}.jpg?s=1024&d=robohash`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getMedia(instaData, mediaCount, callback) { | |
var profileData = instaData.entry_data.ProfilePage[0]; | |
var userID = profileData.user.id; | |
var totalMedia = profileData.user.media.count; | |
var mediaCount = mediaCount > totalMedia ? totalMedia : mediaCount; | |
var csrf_token = instaData.config.csrf_token; | |
var xhrBody = "ig_user(" + userID + ") { media.after(0, " + mediaCount + ") {nodes {display_src }}}"; | |
var xhr = new XMLHttpRequest(); | |
xhr.open("POST", '/query/', true) |
