Skip to content

Instantly share code, notes, and snippets.

View davideast's full-sized avatar
💜
Working on Project IDX (and Firebase too)

David East davideast

💜
Working on Project IDX (and Firebase too)
View GitHub Profile
@mbbertino
mbbertino / 1intro.md
Last active August 29, 2015 14:06
Ember, Ember ClI, Emberfire, Firbase, Simple Login Example

#Hello!

##I wanted to throw out an example of using Ember, Ember CLI, Emberfire, Firebase, Firebase Simple Login to set up authenticiation, and redirecting.

A couple of setup tasks:

  1. Assuming you already have Ember CLI and have basic knowledge of Ember and Firebase
  2. npm install --save emberfire
  3. bower install --save emberfire
  4. bower install --save-dev firebase-simple-login
    And add "app.import('vendor/firebase-simple-login/firebase-simple-login.js'); " to your Brocfile.js
@sararob
sararob / hn-api-examples.md
Last active August 29, 2015 14:07
Apps & integrations built with the official HN API

Integrations

Apps

Angular

@jasonaden
jasonaden / webpack.config.js
Created October 12, 2017 17:22
Importing from 'rxjs/operators'
// Require the version of Rx you want to use (_esm5 or _esm2015)
const rxPaths = require('rxjs/_esm5/path-mapping');
var config = {
// Other config options...
resolve: {
extensions: [".ts", ".js"],
modules: [path.resolve('./src'), 'node_modules'],
// Use the "alias" key to resolve to an ESM distribution
function* zip(...iterables) {
let iterators = iterables.map(i => i[Symbol.iterator]());
while (true) {
let entries = iterators.map(i => i.next());
let done = entries.some(entry => entry.done);
if (done) break;
yield entries.map(e => e.value);
}
}
@katowulf
katowulf / extend.js
Created September 17, 2013 18:06
A simple extend function for JavaScript
function extend(base) {
var parts = Array.prototype.slice.call(arguments, 1);
parts.forEach(function (p) {
if (p && typeof (p) === 'object') {
for (var k in p) {
if (p.hasOwnProperty(k)) {
base[k] = p[k];
}
}
}
@anantn
anantn / firebase_snapshot_parent.js
Last active April 14, 2021 15:29
Firebase: Get the parent of a snapshot.
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) {
@justinfagnani
justinfagnani / README.md
Last active April 21, 2022 08:45
Inline JavaScript Modules Definitions

Inline JavaScript Module Definitions

Motivation

Domenic's blöcks proposal outlines a way to conveniently define functions that run in another worker/worklet as an inline, non-capturing scope, function body.

Blöcks as proposed have a few open questions and lack a few features that could generalize them to more use cases and with more practical ergonomics.

  • Blöcks don't allow static imports, which makes it harder for them to import neccessary library code. They must rely on dynamic import, which is somewhat more difficult to statically analyzer.
@rondevera
rondevera / css-to-select-range-of-children.html
Last active February 8, 2023 11:29
CSS selector for a range of children
<!DOCTYPE html>
<html>
<head>
<style>
/* How to select a range of children
* (Here, 3rd-7th children, inclusive):
*/
ul li:nth-child(n+3):nth-child(-n+7) {
outline: 1px solid #0f0;
}
@puf
puf / README.md
Last active March 28, 2023 16:37
Firebase Hosting Deploy Single File

This script may no longer work. Have a look at its (more official) replacement: https://github.com/firebase/firebase-tools/tree/master/scripts/examples/hosting/update-single-file

Firebase Hosting Deploy Single File

This utility script deploy a single local file to an existing Firebase Hosting site. Other files that are already deployed are left unmodified.

The difference with firebase deploy is that this script does not require you to have a local snapshot of all hosted files, you just need the one file that you want to add/update.

@katowulf
katowulf / 1_query_timestamp.js
Last active September 21, 2023 20:28
Get only new items from Firebase
// 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());
});