Skip to content

Instantly share code, notes, and snippets.

View app.ts
// app.component.ts
import { Component } from "@angular/core";
interface Hero {
id: number;
name: string;
}
@Component({
selector: "app-root",
template: `
<div>{{ title }}</div>
@dan-auth0
dan-auth0 / permissions.middleware.ts
Created Mar 11, 2020
permissions.middleware.ts
View permissions.middleware.ts
/**
* Required External Modules
*/
import * as dotenv from "dotenv";
import { Request, Response, NextFunction } from "express";
import HttpException from "../common/http-exception";
dotenv.config();
View package.json
{
"name": "express-ts-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node dist/index",
"webpack": "webpack --config webpack.config.ts"
},
"keywords": [],
View auth-process.js
const {BrowserWindow} = require('electron');
const authService = require('../services/auth-service');
const createAppWindow = require('../main/app-process');
const {protocol} = require("electron");
let win = null;
function createAuthWindow() {
destroyAuthWin();
@dan-auth0
dan-auth0 / all.exception.ts
Created Dec 30, 2019
NestJS Authorization Middleware
View all.exception.ts
import {
ExceptionFilter,
Catch,
ArgumentsHost,
HttpException,
HttpStatus,
} from '@nestjs/common';
type CustomException = unknown & {
name?: string;
@dan-auth0
dan-auth0 / .gitignore
Created May 25, 2019
Node.js Cross Platform .gitignore to cover JetBrains and Visual Studio Code IDE's
View .gitignore
# Created by https://www.gitignore.io/api/node,linux,macos,windows,intellij,webstorm,jetbrains,visualstudio,visualstudiocode
# Edit at https://www.gitignore.io/?templates=node,linux,macos,windows,intellij,webstorm,jetbrains,visualstudio,visualstudiocode
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
View style.css
@import url("https://fonts.googleapis.com/css?family=Raleway:800|Merriweather+Sans|Share+Tech+Mono");
:root {
--logo-font: "Share Tech Mono", monospace;
--header-font: "Raleway", sans-serif;
--core-font: "Merriweather Sans", sans-serif;
--primary: #ffffff;
--secondary: #2a3747;
View users.js
const express = require("express");
const router = express.Router();
const { from, EMPTY } = require("rxjs");
const { map, mergeMap } = require("rxjs/operators");
const bcrypt = require("bcrypt");
const saltRounds = 12;
const mongo = require("mongodb");
View test.js
// index.js
// Main Thread
console.log("This is the Main Thread.");
const worker = new Worker("./worker.js");
worker.postMessage("hello");