Skip to content

Instantly share code, notes, and snippets.

View shorwood's full-sized avatar
brb; Making myself some coffee

Stanley Horwood shorwood

brb; Making myself some coffee
  • Lyon, France
View GitHub Profile
@blaugold
blaugold / typescript-firebase-database-rules.ts
Last active August 10, 2023 07:11
Firebase Database Rules with TypeScript
// Use the TypeScript compiler to check your database rules.
// You'll get the most out of type checking if you define a database schema
// through interfaces and use it both in the web client and with the database rules.
// The compiler will catch misspellings and structural errors.
// It won't check for completeness since all properties are optional.
// Only works with TypeScript 2.1 and up because of mapped types being used.
interface DatabaseRuleSet {
'.read'?: string | boolean
'.write'?: string | boolean
@hmalphettes
hmalphettes / test-uuid-v5.js
Created July 20, 2014 08:27
Generate uuid-v5 in node
var expect = require('chai').expect;
var UUID = require('./uuid-v5');
describe('When generating a uuid v5', function() {
it('must generate the expected uuids from 3 examples on the web', function() {
var testUrl = UUID.v5(UUID.URL, 'www.example.org');
var testDns = UUID.v5(UUID.DNS, 'www.example.org');
var testDns2 = UUID.v5(UUID.DNS, 'php.net');
// see the examples here: http://jsfiddle.net/rexmac/F3pwA/
expect(testDns).to.equal('74738ff5-5367-5958-9aee-98fffdcd1876');
expect(testUrl).to.equal('abe19220-c90c-5288-b33a-58772250d428');