Please see: https://github.com/kevinSuttle/html-meta-tags, thanks for the idea @dandv!
Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/
| 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 makeList(ref) { | |
| var fruits = ["banana", "apple", "grape", "orange"]; | |
| for (var i = 0; i < fruits.length; i++) { | |
| ref.push(fruits[i]); | |
| } | |
| } | |
| function getFirstFromList(ref, cb) { | |
| ref.startAt().limit(1).once("child_added", function(snapshot) { | |
| cb(snapshot.val()); |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| // assumes you add a timestamp field to each record (see Firebase.ServerValue.TIMESTAMP) | |
| // pros: fast and done server-side (less bandwidth, faster response), simple | |
| // cons: a few bytes on each record for the timestamp | |
| var ref = new Firebase(...); | |
| ref.orderByChild('timestamp').startAt(Date.now()).on('child_added', function(snapshot) { | |
| console.log('new record', snap.key()); | |
| }); |
A Modified function of Paul Irish's StaticServer shell function, according to this gist You can run static servers for many languages.
$ staticServer <lang> <port> #port is optional, default is 8000| var __slice = [].slice; | |
| var __noop = function(){}; | |
| function typeOf(x) { | |
| return {}.toString.call(x).slice(8,-1); | |
| } | |
| function overload(fs) { | |
| return function() { | |
| var types = __slice.call(arguments).map(typeOf); |
| function Record (template) { | |
| if (Record.prototype.isPrototypeOf(this)) { | |
| var struct = this; | |
| Object.keys(template).forEach(function (key) { | |
| Object.defineProperty(struct, key, { | |
| enumerable: true, | |
| writable: true, | |
| value: template[key] | |
| }); |
| /* | |
| This example shows how you can use your data structure as a basis for | |
| your Firebase security rules to implement role-based security. We store | |
| each user by their Twitter uid, and use the following simplistic approach | |
| for user roles: | |
| 0 - GUEST | |
| 10 - USER | |
| 20 - MODERATOR |