Skip to content

Instantly share code, notes, and snippets.

View jacobedawson's full-sized avatar
🎯
JS Ecosystem Explorer

Jacob E. Dawson jacobedawson

🎯
JS Ecosystem Explorer
View GitHub Profile
/*
This middleware accesses the firebase id token in the request header.
Then we use the Firebase Admin SDK to verify the token.
If successful we pass the route on, otherwise we return an error
*/
const admin = require("firebase-admin");
const serviceAccount = require("../config/firebase-account.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
@jacobedawson
jacobedawson / example.js
Last active July 7, 2019 15:36
Using the process.env variable in Next.js
import axios from "axios";
Example.getInitialProps = async () => {
try {
const data = await axios.get(process.env.API);
// do something with data...
} catch (err) {
console.log(err):
}
}
@jacobedawson
jacobedawson / next.config.js
Last active July 7, 2019 15:37
Next Config for Environment Variables
// Create the next.config.js file in your root dir
module.exports = {
env: {
API:
process.env.NODE_ENV === "production"
? process.env.API_URL
: "http://localhost:8080/api"
}
};
body{background:#62374e}p{width:50px;height:50px;background:#fdc57b;position:absolute}#a,#b{top:34px}#c,#d{bottom:34px}#a,#c{left:50px}#b,#d{right:50px}
@jacobedawson
jacobedawson / cloudSettings
Last active April 30, 2020 05:04
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-04-30T05:04:28.824Z","extensionVersion":"v3.4.3"}
@jacobedawson
jacobedawson / angular-cli.json
Created November 16, 2017 11:06
Angular Material Example Angular CLI
"styles": [
"../node_modules/open-sans-fontface/open-sans.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
// THIS
"./sass/mytheme.scss",
"styles.scss"
],
@jacobedawson
jacobedawson / styles.scss
Created November 16, 2017 11:03
Angular Material Example Main Styles
/* You can add global styles to this file, and also import other style files */
@import "~@angular/material/prebuilt-themes/indigo-pink.css"; // import a base theme
// import your custom theme
@import './sass/mytheme.scss';
// include your custom theme with a class
.mytheme {
@include angular-material-theme($mytheme);
}
// example other global styles
body {
@jacobedawson
jacobedawson / mytheme.scss
Last active November 16, 2017 11:00
Angular Material Example - Custom Theme
@import '~@angular/material/theming';
// always include only once per project
@include mat-core();
$mytheme-primary: mat-palette($mat-green);
$mytheme-accent : mat-palette($mat-green, A100, A400, A700);
$mytheme-warn : mat-palette($mat-red);
$mytheme-theme: mat-light-theme($mytheme-primary, $mytheme-accent, $mytheme-warn);
@jacobedawson
jacobedawson / gulp-example.js
Created September 22, 2017 18:54
Example Gulp File
// import requirements
const gulp = require('gulp');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const minifycss = require('gulp-uglifycss'); // Minifies CSS files.
const combineMQ = require('gulp-combine-mq');
const sourceMaps = require('gulp-sourcemaps');
const babel = require('gulp-babel');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify');
@jacobedawson
jacobedawson / package.json
Last active October 3, 2017 10:54
Reddreader - package.json
{
"name": "reddreader",
"version": "1.0.0",
"license": "MIT",
"author": "Jacob E. Dawson",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "node server.js",
"preserve": "tsc -p server",