Skip to content

Instantly share code, notes, and snippets.

View NickBolles's full-sized avatar

Nick Bolles NickBolles

View GitHub Profile
@NickBolles
NickBolles / auth-management-notifier.ts
Created December 6, 2018 19:14
Authentication-local-management notifier
import { Application } from "@feathersjs/feathers";
import { join } from "path";
import pug from "pug";
import sender from "./notifier";
import { isString, isFunction } from "util";
import { stringify } from "querystring";
const isProd = process.env.NODE_ENV === 'production'
const encodeOpt = { encodeURIComponent: (str) => str }
@NickBolles
NickBolles / onLoginMixin.ts
Created February 25, 2019 15:30
Nuxt On Login mixin
import { Component, Vue } from "vue-property-decorator";
const DEFAULT_REDIRECT = "home";
type redirectFn = () => string;
// You can declare a mixin as the same style as components.
@Component
export default class OnLoginMixin extends Vue {
protected redirect?: string | redirectFn = DEFAULT_REDIRECT;
protected watchLogin?: boolean = true;
/*
Ahoy Matey!
Welcome to the seven seas.
You are the captain of a pirate ship.
You are in battle against the royal navy.
You have cannons at the ready.... or are they?
export class ResolvablePromise<T = any> implements Promise<T> {
[Symbol.toStringTag]: string;
__promise: Promise<T>;
resolve!: (value: T) => void;
reject!: (reason: T) => void;
constructor() {
this.__promise = new Promise<T>((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;