Skip to content

Instantly share code, notes, and snippets.

View jrodl3r's full-sized avatar

John Rodler jrodl3r

View GitHub Profile
@jrodl3r
jrodl3r / index.js
Created February 12, 2020 03:03
DynamoDB2ExcelMailer
'use strict'
var AWS = require('aws-sdk');
var S3 = new AWS.S3();
var SES = new AWS.SES({region: 'us-east-1'});
var nodemailer = require('nodemailer');
var excel = require('excel4node');
var workbook = new excel.Workbook();
var worksheet = workbook.addWorksheet('Sheet 1');
exports.handler = (event, context, callback) => {
@jrodl3r
jrodl3r / index.js
Created February 10, 2020 23:35
DynamoDB2Excel
'use strict'
var AWS = require('aws-sdk');
var S3 = new AWS.S3();
var excel = require('excel4node');
var workbook = new excel.Workbook();
var worksheet = workbook.addWorksheet('Sheet 1');
exports.handler = (event, context, callback) => {
var docClient = new AWS.DynamoDB.DocumentClient({ region: 'us-east-2' });
var params = { TableName: 'Users' };
@jrodl3r
jrodl3r / serviceAccountKey.json
Created November 1, 2019 22:59
ElasticSearch - Firebase Admin Tools Service Key
{
"type": "service_account",
"project_id": "project_id",
"private_key_id": "private_key_id",
"private_key": "private_key",
"client_email": "client_email",
"client_id": "client_id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
@jrodl3r
jrodl3r / seed.ts
Created November 1, 2019 20:56
ElasticSearch - Seed Firebase Data
const admin = require('firebase-admin');
const faker = require('faker');
const serviceAccount = require('../tmp/serviceAccountKey.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
const db = admin.firestore();
@jrodl3r
jrodl3r / index.ts
Last active November 1, 2019 20:21
ElasticSearch - Cloud Functions
import * as functions from 'firebase-functions';
import * as firebase from 'firebase-admin';
firebase.initializeApp();
const env = functions.config();
const auth = {
username: env.elasticsearch.username,
password: env.elasticsearch.password,
};
@jrodl3r
jrodl3r / search.component.scss
Last active November 1, 2019 19:04
ElasticSearch - Angular Search Styles
.searchbox {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
max-width: 480px;
margin: 0 auto;
padding: 15px;
input {
@jrodl3r
jrodl3r / search.component.html
Last active November 2, 2019 20:42
ElasticSearch - Angular Search Template
<div class="searchbox">
<input
#searchInput
type="text"
placeholder="Find a Person or Contact"
(keyup)="updateSearch.next($event)"
(focus)="showResults()">
<i
class="search-icon fa fa-search"
(click)="focusInput()"
@jrodl3r
jrodl3r / search.component.ts
Last active November 2, 2019 20:41
ElasticSearch - Angular Search Component
import { Component, OnDestroy, ViewChild, ElementRef } from '@angular/core';
import { Subscription, Subject, of } from 'rxjs';
import { debounceTime, delay, distinctUntilChanged, flatMap, map, tap } from 'rxjs/operators';
import { SearchService } from '../../services/search.service';
@Component({
selector: 'app-searchbox',
templateUrl: './searchbox.component.html',
styleUrls: ['./searchbox.component.scss']
@jrodl3r
jrodl3r / search.service.ts
Last active November 1, 2019 18:16
ElasticSearch - Angular Search Service
export class SearchService {
data: any;
results: IContact[];
isFetching = false;
constructor(private functions: AngularFireFunctions) { }
public getResults(query: string) {
const call = this.functions.httpsCallable('searchContacts');
this.isFetching = true;
⚡ nr build:ssr
> [email protected] build:ssr /app
> npm run build:bundles && npm run compile:server
> [email protected] build:bundles /app
> ng build --prod && ng run ng-fire-universal:server:production --bundleDependencies all