Skip to content

Instantly share code, notes, and snippets.

@homerjam
homerjam / nuxt-auth-firebase-scheme.ts
Created June 4, 2020 12:39
Nuxt Auth Firebase Scheme
import type { SchemeOptions } from '@nuxtjs/auth-next/dist';
import BaseScheme from '@nuxtjs/auth-next/dist/schemes/_scheme';
import * as firebase from 'firebase/app';
import 'firebase/auth';
import jwt from 'jsonwebtoken';
import memoizer from 'lru-memoizer';
import fetch from 'node-fetch';
const DEFAULTS: SchemeOptions = {
name: 'firebase',
@homerjam
homerjam / authentication.js
Last active December 3, 2021 14:41
Nuxt/Feathers/Vuex SSR
const authentication = require('@feathersjs/authentication');
const jwt = require('@feathersjs/authentication-jwt');
const local = require('@feathersjs/authentication-local');
const oauth2 = require('@feathersjs/authentication-oauth2');
const session = require('express-session');
const Auth0Strategy = require('passport-auth0');
module.exports = function (app) {
const config = app.get('authentication');
@homerjam
homerjam / mc-section.js
Created April 12, 2018 14:21
mc-section: Mailchimp compatible MJML v4 component
import { BodyComponent } from 'mjml-core'
import { flow, identity, join, filter } from 'lodash/fp'
import widthParser from 'mjml-core/lib/helpers/widthParser'
const makeBackgroundString = flow(filter(identity), join(' '))
export default class McSection extends BodyComponent {
static allowedAttributes = {
'mc:hideable': 'boolean',
'mc:repeatable': 'string',
@homerjam
homerjam / mc-image.js
Last active April 12, 2018 14:21
mc-image: Mailchimp compatible MJML v4 component
import min from 'lodash/min'
import { BodyComponent } from 'mjml-core'
import widthParser from 'mjml-core/lib/helpers/widthParser'
export default class McImage extends BodyComponent {
static tagOmission = true
static allowedAttributes = {
@homerjam
homerjam / aframe-render-enabled.js
Created March 20, 2018 12:43
A-FRAME component to allow enabling/disabling/disposing of the renderer - useful for embedded scenes/spa's
const AFRAME = require('aframe');
if (!AFRAME.components['render-enabled']) {
AFRAME.registerComponent('render-enabled', {
schema: { type: 'boolean', default: true },
init() {
const _this = this;
this.renderEnabled = this.data;
this.el.render = function render() {
@homerjam
homerjam / vue-scrollwizardry.js
Created November 15, 2017 10:59
Vue plugin for scrollwizardy
/*
eslint no-underscore-dangle: 0, max-len: 0, prefer-destructuring: 0, no-nested-ternary: 0
*/
import TweenMax from 'gsap/TweenMax';
import TimelineMax from 'gsap/TimelineMax';
import * as ScrollWizardry from 'scrollwizardry';
// import * as ScrollWizardry from '../../scrollwizardry/src';
const { Controller, Scene } = ScrollWizardry;
@homerjam
homerjam / nuxt-axios-cache.js
Last active September 19, 2020 18:18
Simple plugin which decorates the community axios nuxt-module with an lru-cache
import hash from 'object-hash';
import sizeof from 'object-sizeof';
import lruCache from 'lru-cache';
const cacheEnabled = true;
const cacheMaxAge = 30 * 60 * 1000;
const cacheMaxSize = 128 * 1000 * 1000;
const getCacheKey = config => hash({
method: config.method,
@homerjam
homerjam / mc-image.js
Created January 11, 2017 12:58
Custom MJML component useful for MailChimp templates
import { MJMLElement } from 'mjml-core'
import merge from 'lodash/merge'
import min from 'lodash/min'
import React, { Component } from 'react'
const tagName = 'mc-image'
const parentTag = ['mj-column', 'mj-hero-content']
const defaultMJMLDefinition = {
attributes: {
'mc:edit': null,
@homerjam
homerjam / mc-section.js
Created January 11, 2017 12:57
Custom MJML component for use in MailChimp templates
import { MJMLElement, helpers } from 'mjml-core'
import cloneDeep from 'lodash/cloneDeep'
import merge from 'lodash/merge'
import React, { Component } from 'react'
const tagName = 'mc-section'
const parentTag = ['mj-container']
const defaultMJMLDefinition = {
attributes: {
'mc:hideable': null,
@homerjam
homerjam / uniforms.default.json
Last active July 29, 2016 13:52 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
{}