This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SAFARY_BACKEND_ORIGIN=https://tag.safary.club | |
| npm_package_version=0.1.13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| May Challenge: https://gist.github.com/wovalle/a86a76bc20d8c886342040f54875f291 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // LeetCode May 2020 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const frm = document.querySelector('article form') | |
| const commentBox = frm.querySelector('textarea') | |
| const postButton = frm.querySelector('button') | |
| const comments = commentBox.value.split('\n').filter(c => c.length) | |
| const postComment = comment => { | |
| console.log('Commenting: ', comment) | |
| let lastValue = commentBox.value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Bands formed from 1990 onwards | |
| await bandRepository | |
| .whereGreaterOrEqualThan('formationYear', 1990) | |
| .find(); | |
| // Bands whose name is Porcupine Tree | |
| await bandRepository | |
| .whereEqualTo('name', 'Porcupine Tree') | |
| .find(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { BaseFirestoreRepository, CustomRepository } from 'fireorm'; | |
| import Band from './models/Band'; | |
| @CustomRepository(Band) | |
| class BandRepository extends BaseFirestoreRepository<Band> { | |
| async getProgressiveRockBands(): Promise<Band[]> { | |
| return this.whereArrayCointain('genres', 'progressive-rock').find(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { getRepository } from 'fireorm'; | |
| import Band from './models/Band'; | |
| const bandRepository = getRepository(Band); | |
| const band = await bandRepository.findById('red-hot-chili-peppers'); | |
| const albumsAfter2000 = await band.albums.whereGreaterOrEqualThan('year', 2000).find(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Collection, SubCollection, ISubCollection } from 'fireorm'; | |
| class Album { | |
| id: string; | |
| name: string; | |
| year: number; | |
| } | |
| @Collection() | |
| export class Band { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Band from './models/Band' | |
| import { getRepository } from 'fireorm' | |
| const bandRepository = getRepository(Band, firestore); | |
| // Create a band | |
| const band = new Band(); | |
| band.name = "A Perfect Circle"; | |
| band.formationYear = 1999; | |
| band.genres = ['alternative-rock', 'hard-rock'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as admin from 'firebase-admin'; | |
| const serviceAccount = require('../firestore.creds.json'); | |
| admin.initializeApp({ | |
| credential: admin.credential.cert(serviceAccount), | |
| databaseURL: `https://${serviceAccount.project_id}.firebaseio.com`, | |
| }); | |
| const firestore = admin.firestore(); |
NewerOlder