I hereby claim:
- I am anantn on github.
- I am anant (https://keybase.io/anant) on keybase.
- I have the public key with fingerprint 42DD 4F90 7C5F 4576 D6F4 2202 C31C 2D8C 7B4B 6B02
To claim this, I am signing this object:
function go() { | |
var userId = prompt('Username?', 'Guest'); | |
checkIfUserExists(userId); | |
} | |
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users'; | |
function userExistsCallback(userId, exists) { | |
if (exists) { | |
alert('user ' + userId + ' exists!'); |
function go() { | |
var userId = prompt('Username?', 'Guest'); | |
var userData = { name: userId }; | |
tryCreateUser(userId, userData); | |
} | |
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users'; | |
function userCreated(userId, success) { | |
if (!success) { |
function go() { | |
var userId = prompt('Username?', 'Guest'); | |
// Consider adding '/<unique id>' if you have multiple games. | |
var gameRef = new Firebase(GAME_LOCATION); | |
assignPlayerNumberAndPlayGame(userId, gameRef); | |
}; | |
// The maximum number of players. If there are already | |
// NUM_PLAYERS assigned, users won't be able to join the game. | |
var NUM_PLAYERS = 4; |
<html> | |
<body> | |
<video id="v" width="300" height="300"></video> | |
<input id="b" type="button" disabled="true" value="Take Picture"></input> | |
<canvas id="c" style="display:none;" width="300" height="300"></canvas> | |
</body> | |
<script> | |
navigator.getUserMedia({video: true}, function(stream) { | |
var video = document.getElementById("v"); | |
var canvas = document.getElementById("c"); |
function getParent(snapshot) { | |
// You can get the reference (A Firebase object) from a snapshot | |
// using .ref(). | |
var ref = snapshot.ref(); | |
// Now simply find the parent and return the name. | |
return ref.parent().name(); | |
} | |
var testRef = new Firebase("https://example.firebaseIO-demo.com/foo/bar"); | |
testRef.once("value", function(snapshot) { |
function pushSomething(ref) { | |
// Let's push something. push() returns a reference that you can hold onto! | |
var justPushed = ref.push({test: "push"}); | |
// We return a reference, but you can also return the name of the newly | |
// created object with .name(). | |
return justPushed; | |
} | |
function removeItem(ref) { | |
// Now we can get back to that item we just pushed via .child(). |
<html> | |
<head> | |
<script src="https://cdn.firebase.com/v0/firebase.js"></script> | |
</head> | |
<body> | |
<ul id="chat-list"> | |
</ul> | |
<input type="text" id="msg"/> | |
<input type="button" id="send" value="Send"/> | |
<script> |
/** | |
* Assume we've connected a PeerConnection with a friend - usually with audio | |
* and/or video. For the time being, always at least include a 'fake' audio | |
* stream - this will be fixed soon. | |
* | |
* connectDataConnection is a temporary function that will soon disappear. | |
* The two sides need to use inverted copies of the two numbers (eg. 5000, 5001 | |
* on one side, 5001, 5000 on the other) | |
*/ | |
pc.connectDataConnection(5001, 5000); |
var Firebase = require("./firebase-node.js"); | |
function Queue(ref) { | |
this._ref = ref; | |
} | |
Queue.prototype.pop = function(cb) { | |
this._ref.startAt().limit(1).once("child_added", this._pop.bind(this, cb)); | |
} |
I hereby claim:
To claim this, I am signing this object: