Skip to content

Instantly share code, notes, and snippets.

@hedgehog1029
Created July 15, 2014 14:41
Show Gist options
  • Save hedgehog1029/e89cef2adb647779a24b to your computer and use it in GitHub Desktop.
Save hedgehog1029/e89cef2adb647779a24b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<script type='text/javascript' src='https://cdn.firebase.com/js/client/1.0.17/firebase.js'></script>
</head>
<body>
<img src="" id="profileimg"></img>
<p id="text"></p>
<input id="id" />
<input id="pass" type="password" />
<button id="submit">Create Account</button>
</body>
</html>
var base = "http://sociame.firebaseio.com/";
var userid = "JohnSmith"; //eventually, this will be got via php database auth
var userbase = base + "users/" + userid;
var feed = new Firebase(userbase + "/feed");
var planner = new Firebase(userbase + "/planner");
var profile = new Firebase(userbase + "/profile");
var profileData = new Firebase(base + "userlist/" + userid);
var friends = new Firebase(userbase + "/profile/friends");
var friendslist = new Array();
//get the profile picture for user
profileData.on("value", function(snapshot) {
document.getElementById("profileimg").src = snapshot.val().img;
});
//Get user's friends + store in an array
friends.on("child_added", function(snapshot) {
friendslist[friendslist.length] = snapshot.val().id;
});
//hi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment