Skip to content

Instantly share code, notes, and snippets.

View emmenko's full-sized avatar

Nicola Molinari emmenko

View GitHub Profile
@emmenko
emmenko / gatsby-ssr.js
Last active January 7, 2021 15:37
Patch Emotion SSR for Lobotomized Owl selectors
import React from 'react';
import { renderToString } from 'react-dom/server';
import createEmotionServer from '@emotion/server/create-instance';
import { CacheProvider } from '@emotion/react';
import { createDocsCache, docsCacheKey } from './utils/create-emotion-cache';
const patchedLobotomizedOwlSelector = '> *:not(style) ~ *:not(style)';
const lobotomizedOwlSelectorRegex = />\s*\*\s*\+\s*\*/g;
export const replaceRenderer = ({
@emmenko
emmenko / README.md
Created June 14, 2015 09:30
React shallow rendering
npm i react babel mocha expect

NODE_ENV=test ./node_modules/.bin/mocha --compilers js:babel/register shallow-rendering.spec.js
@emmenko
emmenko / index.html
Created May 9, 2014 07:29
Animated typing terminal prompt
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Animated typing terminal prompt</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/stylesheets/main.css" media="screen">
</head>