Kim's Workstation
(As shown in this tweet from September 8, 2020)
<!DOCTYPE HTML> | |
<html lang="en" ng-app="myApp"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dynamic Pagination w/ Filtering</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content=""> | |
<meta name="author" content="Kim Maida"> | |
<!-- JS Libraries --> |
function convertTimestamp(timestamp) { | |
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds | |
yyyy = d.getFullYear(), | |
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0. | |
dd = ('0' + d.getDate()).slice(-2), // Add leading 0. | |
hh = d.getHours(), | |
h = hh, | |
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0. | |
ampm = 'AM', | |
time; |
service cloud.firestore { | |
match /databases/{database}/documents { | |
match /<COLLECTION_NAME>/{document=**} { | |
allow read: if true; | |
allow create: if request.auth != null && request.auth.uid == request.resource.data.uid; | |
allow update, delete: if request.auth != null && request.auth.uid == resource.data.uid; | |
} | |
} | |
} |
(As shown in this tweet from September 8, 2020)
// MM/DD/YYYY, M/D/YYYY | |
const DATE_REGEX = new RegExp(/^(\d{2}|\d{1})\/(\d{2}|\d{1})\/\d{4}$/); | |
export { DATE_REGEX }; |
function slugify(text) { | |
const a = 'ãàáäâèéëêìíïîòóöôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;'; | |
const b = 'aaaaaeeeeiiiioooouuuuncsyoarsnpwgnmuxzh------'; | |
const p = new RegExp(a.split('').join('|'), 'g'); | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special chars | |
.replace(/&/g, '-and-') // Replace & with 'and' | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars |
/** | |
* Register Activities as a custom post type | |
*/ | |
function cpt_register_activities() { | |
$labels = array( | |
"name" => __( "Activities", "twentytwenty" ), | |
"singular_name" => __( "Activity", "twentytwenty" ), | |
"menu_name" => __( "Activities", "twentytwenty" ), | |
"all_items" => __( "All Activities", "twentytwenty" ), | |
"add_new" => __( "Add New Activity", "twentytwenty" ), |
// Username regex | |
// Starts with @ | |
// Can contain only numbers, lowercase letters, -, ., _ | |
// NOTE: this can be avoided by escaping characters (slash command settings) | |
const usernameRegex = /^@+[0-9a-z_\-.]*$/; | |
// Get all user ID mentions from a string | |
// <@UXXXX|user> (slash commands) | |
// <@UXXXX> (app mention text) | |
// Returns an array of user mentions |
myApp.filter('trustAsHTML', ['$sce', function($sce){ | |
return function(text) { | |
return $sce.trustAsHtml(text); | |
}; | |
}]); |
import { Injectable } from '@angular/core'; | |
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; | |
import { AuthService } from './../auth/auth.service'; | |
import { Observable } from 'rxjs/Observable'; | |
import { catchError } from 'rxjs/operators'; | |
import 'rxjs/add/observable/throw'; | |
import { ENV } from './env.config'; | |
import { EventModel } from './models/event.model'; | |
import { RsvpModel } from './models/rsvp.model'; |