This file contains 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 express from 'express'; | |
import * as cors from 'cors'; | |
import * as bodyParser from 'body-parser'; | |
import * as sentry from '@sentry/node'; | |
import * as admin from 'firebase-admin'; | |
import { APIResponse } from '@sredmond/apiresponse'; | |
import * as functions from 'firebase-functions'; | |
const app = express(); |
This file contains 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
rules_version = '2'; | |
service cloud.firestore { | |
match /databases/{database}/documents { | |
match /Users/{UserId} { | |
// Allow anyone to create an account | |
allow create: if true; | |
// UserId comes from {UserId} above | |
// the UserId will be auto-filled with the UserId | |
// of the user trying to access this record | |
allow read, update, delete: if isOwner(UserId); |
This file contains 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
rules_version = '2'; | |
service cloud.firestore { | |
match /databases/{database}/documents { | |
match /AdminStuff/{StuffId} { | |
allow read, write: if isAdmin(); | |
} | |
function isAdmin() { | |
return request.auth.token['isAdmin'] == true; | |
} |
This file contains 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
/** | |
* Create a simple function which returns | |
* a boolean value indicating if a given | |
* string is a palindrome. Punctuation should | |
* be ignored. | |
* | |
* palindrome: a word, phrase, or sequence | |
* that reads the same backward as forward, | |
* e.g., madam or nurses run. | |
*/ |
This file contains 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 routes: Routes = [ | |
/** | |
* When the path is '' it will know to redirect the user to the landing page. | |
* This is setting up the default route that the user will always land on at first. | |
*/ | |
{ path: '', redirectTo: '/landing', pathMatch: 'full' }, | |
{ | |
/** | |
* Landing will always be the first route we get to in order to bootstrap | |
* the virtual pages and make our lives a little easier in so far as routing |
This file contains 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 { NgModule } from '@angular/core'; | |
import { RouterModule, Routes } from '@angular/router'; | |
import { LandingRouteComponent } from './landing-route.component'; | |
/** | |
* Since this route is lazy loaded in the app-routing.module.ts we will declare a blank | |
* path here and give it the component we wish to load at the current route. | |
*/ | |
const routes: Routes = [{ path: '', component: LandingRouteComponent, children: [ | |
{ path: 'variation1', loadChildren: () => import('./variation-1/variation-1.module.ts').then((mod) => mod.Variation1Module) } |
This file contains 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
<script> | |
import Thing from './Thing.svelte'; | |
let user = { loggedIn: false }; | |
let things = [ | |
{ id: 1, name: 'apple' }, | |
{ id: 2, name: 'banana' }, | |
{ id: 3, name: 'carrot' }, | |
{ id: 4, name: 'doughnut' }, | |
{ id: 5, name: 'egg' }, |
This file contains 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 { NgModule } from '@angular/core'; | |
import { Routes, RouterModule } from '@angular/router'; | |
import { MainComponent } from './main/main.module'; | |
const routes: Routes = [ | |
{ path: '', redirectTo: '/main', pathMatch: 'full' }, | |
{ | |
path: 'main', | |
component: MainComponent | |
}, |
This file contains 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 { Store } from '@ngxs/store'; | |
import { AppModule } from 'src/app/app.module'; | |
import { AnalyticsActions } from 'src/app/state/analytics/analytics.actions'; | |
import { isFunction } from 'util'; | |
import { captureBreadcrumb } from '../utils'; | |
/** | |
* ***************************** WARNING ********************************** | |
* To use this decorator you must ensure that your component implements * | |
* both OnInit and OnDestroy. If it does not this will not work. * |
This file contains 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
// create a binary search function that takes in a non-sorted array and a target value | |
const binarySearch = (arr: number[], target: number) => { | |
// sort the array | |
arr.sort((a, b) => a - b); | |
// create a left and right pointer | |
let left = 0; | |
let right = arr.length - 1; | |
// loop while left is less than or equal to right |