Skip to content

Instantly share code, notes, and snippets.

@dearfrankg
dearfrankg / css-grid.html
Last active November 10, 2018 20:07
css-grid example
const backgroundColor = "#eee";
export default () => (
<div className="hello">
<div className="wrapper">
<div className="item1">1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
@dearfrankg
dearfrankg / meta.js component
Created November 9, 2018 18:41
next.js font support
import NextHead from "next/head";
const Head = () => (
<div>
<NextHead>
<meta charSet="UTF-8" />
{/* <title>{props.title || ""}</title>
<meta name="description" content={props.description || ""} /> */}
<meta name="viewport" content="width=device-width, initial-scale=1" />
@dearfrankg
dearfrankg / .babelrc
Created November 9, 2018 18:37
styled-components
{
"presets": ["next/babel"]
}
@dearfrankg
dearfrankg / _document.js
Last active November 9, 2018 19:16
styled-components
import Document, { Head, Main, NextScript } from "next/document";
import { ServerStyleSheet } from "styled-components";
export default class MyDocument extends Document {
static getInitialProps({ renderPage }) {
const sheet = new ServerStyleSheet();
const page = renderPage(App => props =>
sheet.collectStyles(<App {...props} />)
);
const styleTags = sheet.getStyleElement();
@dearfrankg
dearfrankg / .babelrc
Created November 9, 2018 18:29
styled-jsx-plugin
{
"presets": [
[
"next/babel",
{
"styled-jsx": {
"plugins": [
"styled-jsx-plugin-sass"
]
}
@dearfrankg
dearfrankg / _document.js
Created November 9, 2018 18:14
evergreen-ui setup ssr
/* eslint-disable react/no-danger, import/no-unresolved */
import React from "react";
import Document, { Head, Main, NextScript } from "next/document";
import { extractStyles } from "evergreen-ui";
export default class MyDocument extends Document {
static async getInitialProps({ renderPage }) {
const page = renderPage();
// `css` is a string with css from both glamor and ui-box.
// No need to get the glamor css manually if you are using it elsewhere in your app.
@dearfrankg
dearfrankg / recursive.js
Last active August 19, 2018 11:10
recursive practice
// helper functions
const format = data => JSON.stringify(data);
const title = title => console.log(`\n${title}\n---------------------`);
const iterate = (fnName, fn) => {
[1, 2, 3, 4, 5].forEach(n => {
console.log(`${fnName}(${n}) = ${fn(n)}`);
});
};
@dearfrankg
dearfrankg / recursive.js
Created August 19, 2018 09:29
recursive
const util = require("util");
// RECURSIVE FUNCTIONS: pow, fibonaci, factorial, map, reverse
const pow = (b, n) => (n === 1 ? b : b * pow(b, n - 1));
const fibonaci = x => (x <= 1 ? 1 : fibonaci(x - 1) + fibonaci(x - 2));
const factorial = x => (x === 1 ? 1 : x * factorial(x - 1));
var app = require("../../../src/server/test-server.js");
var request = require("supertest");
var db = require("../../../src/server/models");
describe("PageBuilder API integration tests", () => {
describe("authentication", () => {
var token;
describe("Protected API endpoints without token", () => {
it("should deny access without a token", () => {
@dearfrankg
dearfrankg / readme.md
Last active August 8, 2017 18:28
How to configure electrode to use webpack's resolve alias

How to configure electrode to use webpack's resolve alias

ISSUE DESCRIPTION

The electrode docs currently show incorrect instructions on how to do this.

SOLUTION

OVERRIDE ELECTRODE WEBPACK CONFIG