Skip to content

Instantly share code, notes, and snippets.

View theivanfranco's full-sized avatar
🎯
Focusing

Ivan Franco theivanfranco

🎯
Focusing
View GitHub Profile
#!/usr/bin/env sh
set -e
export TEST_SQL="select user || ' connection to ' || (select current_database()) || ' ✅'"
### GET CONNECTION DETAILS AND TEST IT
echo "First please provide superuser credentials and endpoint"
@whoisryosuke
whoisryosuke / nextjs-hoc-authorization.js
Created June 26, 2018 22:24
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side