Skip to content

Instantly share code, notes, and snippets.

@onceknown
Last active October 29, 2015 04:31
Show Gist options
  • Save onceknown/afd820f329c191dcb83b to your computer and use it in GitHub Desktop.
Save onceknown/afd820f329c191dcb83b to your computer and use it in GitHub Desktop.
Writing A Firebase
{
"rules": {
"indent": [
2,
2
],
"quotes": [
2,
"single"
],
"linebreak-style": [
2,
"unix"
],
"semi": [
2,
"always"
]
},
"env": {
"mocha": true,
"es6": true,
"browser": true,
"node": true
},
"ecmaFeatures": {
"modules": true
},
"extends": "eslint:recommended"
}
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
**/node_modules
.DS_Store
dist
'use strict';
import Firebase from 'firebase';
import memoize from 'lodash/function';
import {initialize as initializeSession} from './session';
import {initialize as initializeUsers} from './users';
export default memoize( ( firebaseUrl, logger ) => {
let fb = new Firebase( firebaseUrl );
let users = initializeUsers( fb, logger );
let session = initializeSession( fb, logger, users );
let service = {
users: users,
session: session
};
return service;
} );
'use strict';
import Events from 'ampersand-events';
export class Handle extends Events {
}
export class Refs {
constructor(fb, namespace) {
}
}
{
"name": "writing-a-firebase",
"version": "1.0.0",
"description": "Strategies for Encapsulating the Data Layer in Firebase Applications",
"main": "browser.js",
"scripts": {
"lint": "eslint *.js",
"test": "mochify --web-security=false --ignore-ssl-errors=true --transform [ babelify ] --reporter=spec tests.js",
"test-unit": "npm run test -- --invert --grep=#integration",
"test-integration": "npm run test -- --grep=#integration --timeout=5000",
"debug": "npm run test -- --debug",
"build": "mkdir -p dist && browserify -d -p [minifyify --map db.map.json --output ./dist/db.map.json] -t [ babelify --sourceMapRelative . ] -r ./browser.js:db > ./dist/db.js && gzip -9 -c ./dist/db.js > ./dist/db.js.gz"
},
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/afd820f329c191dcb83b.git"
},
"engines": {
"npm": "^2"
},
"keywords": [
"firebase",
"realtime"
],
"author": "Danny Davidson",
"license": "MIT",
"bugs": {
"url": "https://gist.github.com/afd820f329c191dcb83b"
},
"homepage": "https://gist.github.com/afd820f329c191dcb83b",
"devDependencies": {
"babelify": "^6.4.0",
"browserify": "^11.2.0",
"eslint": "^1.7.3",
"minifyify": "^7.1.0",
"mochify": "^2.13.0",
"watchify": "^3.4.0"
},
"dependencies": {
"ampersand-events": "^1.1.1",
"firebase": "^2.3.1",
"lodash": "^3.10.1"
}
}
'use strict';
export function initialize(fb, logger) {
return;
}
'use strict';
describe('users', () => {
describe('Service', () => {
it('does something servicy', () => {
debugger;
});
});
describe('UserHandle', () => {
it('does something handley', () => {
debugger;
});
});
describe('Database #integration', () => {
});
});
'use strict';
import {Handle, Refs} from './lib';
class UserHandle extends Handle {
}
class Users {
}
class UserRefs extends Refs {
}
export const NAMESPACE = 'users';
export function initialize(fb, logger) {
return new Users(fb, new UserRefs(fb, NAMESPACE), logger);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment