Skip to content

Instantly share code, notes, and snippets.

View djpeach's full-sized avatar
💻
Working

Daniel Peach djpeach

💻
Working
  • Greenlight Financial Technology
  • Indiana, United States
View GitHub Profile
##
# Prompt setup
##
PROMPT='%F{208}%n%f in %F{226}%~%f -> '
@djpeach
djpeach / ViewController.swift
Created October 4, 2019 14:49
Basic ViewController
//
// ViewController.swift
// YourAppName
//
// Created by Daniel Peach on 10/4/19.
// Copyright © 2019 Daniel Peach. All rights reserved.
//
import UIKit
@djpeach
djpeach / SceneDelegate.swift
Last active October 4, 2019 14:49
Basic SceneDelegate
//
// SceneDelegate.swift
// YourAppName
//
// Created by Daniel Peach on 10/4/19.
// Copyright © 2019 Daniel Peach. All rights reserved.
//
import UIKit
@djpeach
djpeach / app.js
Created October 3, 2019 21:58
Final app.js
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
const cors = require('cors')
const admin = require('firebase-admin')
const serviceAccount = require("./config/fbServiceAccountKey.json");
admin.initializeApp({
@djpeach
djpeach / app.js
Created October 3, 2019 21:54
fixing checkAuth()
function checkAuth(req, res, next) {
if (req.headers.authtoken) {
admin.auth().verifyIdToken(req.headers.authtoken)
.then(() => {
next()
}).catch(() => {
res.status(403).send('Unauthorized')
});
} else {
res.status(403).send('Unauthorized')
@djpeach
djpeach / HelloWorld.js
Last active October 3, 2019 21:49
Complete vue app
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p class="lead mt-2">{{ authStatus }}</p>
<div class="d-flex my-4 justify-content-center">
<button @click="signIn" class="btn btn-outline-primary mx-4">Sign In ></button>
<button @click="sendRequest" class="btn btn-outline-success mx-4">Send Request ></button>
<button @click="signOut" class="btn btn-outline-danger mx-4">Sign Out ></button>
</div>
<p class="lead">{{ response }}</p>
@djpeach
djpeach / HellowWorld.vue
Created October 3, 2019 20:43
"Final" HelloWorld.vue
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<button @click="sendRequest" class="btn btn-outline-success my-4">Send Request ></button>
<p class="lead">{{ response }}</p>
</div>
</template>
<script>
import axios from 'axios'
@djpeach
djpeach / HelloWorld.vue
Last active October 3, 2019 20:39
Add sendRequest method to Vue component
methods: {
sendRequest() {
client({
method: 'get',
url: '/'
}).then((res) => {
this.response = res.data.message
}).catch((error) => {
this.response = error
})
@djpeach
djpeach / HelloWorld.vue
Created October 3, 2019 20:33
Adding axios client
import axios from 'axios'
const client = axios.create({
baseURL: 'http://localhost:3000',
json: true
})
@djpeach
djpeach / Vue.js
Created October 3, 2019 20:27
adding data prop to Vue component
data: function() {
return {
response: 'No data yet...'
}
},