Skip to content

Instantly share code, notes, and snippets.

View cpojer's full-sized avatar

Christoph Nakazawa cpojer

View GitHub Profile
import Breakpoints from './Breakpoints';
import { css, cx } from '@emotion/css';
import { HTMLAttributes, forwardRef } from 'react';
export type StackProps = {
adaptive?: true;
alignCenter?: true;
center?: true;
children?: React.ReactNode;
className?: string;
/* eslint-disable no-bitwise */
/**
* StackBlur - a fast almost Gaussian Blur For Canvas
*
* @copyright (c) 2010 Mario Klingemann
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
@cpojer
cpojer / index.ts
Last active April 9, 2024 21:23
When using `vite-node` with http servers, any HMR update will crash the process because the port is in use. This code can be inserted at the top-level of your script to gracefully stop the previous server instance before starting the new one.
#!/usr/bin/env node_modules/.bin/vite-node --watch
// `vite-node` HMR handler for servers.
type TeardownCallback = () => Promise<void>;
type Listener = () => TeardownCallback;
declare global {
// eslint-disable-next-line no-var
var __HMR__: {
listeners: ReadonlyArray<Listener>;
// Add memoization to two string helpers in jsdom that are called
// tens of thousands of times on the same strings and slow tests
// down by up to 3x.
//
// See https://github.com/jsdom/jsdom/commit/63d24a06d04a60279599782dc97899cde59d901d#diff-a29b6d0a417180220d299dde53ac3e1f820c3ade3daec396118f27c4270e1457R137
const {createRequire} = require('module');
const envRequire = createRequire(require.resolve('jest-environment-jsdom'));
const stringHelpers = envRequire('jsdom/lib/jsdom/living/helpers/strings.js');
@cpojer
cpojer / .gitignore
Last active January 2, 2019 12:27
GitHub RN Issue Parser
node_modules
comments.json
comments.md
@cpojer
cpojer / .gitignore
Created January 5, 2017 17:16
Perf test.
node_modules
exports[`App renders a welcome view 1`] = `
<div
className="App">
<div
className="App-header">
<img
alt="logo"
className="App-logo"
src="mock-image.png" />
<h2>
From 6b55e45d58eb98bb353fbf2087a5c0494e0110e4 Mon Sep 17 00:00:00 2001
From: cpojer <christoph.pojer@gmail.com>
Date: Fri, 23 Oct 2015 14:24:52 -0700
Subject: [PATCH] Fix tests.
---
package.json | 11 ++++++++---
src/components/Header/__tests__/Header-test.js | 2 --
src/mocks/css-stub.js | 7 +++++++
3 files changed, 15 insertions(+), 5 deletions(-)
From 6b55e45d58eb98bb353fbf2087a5c0494e0110e4 Mon Sep 17 00:00:00 2001
From: cpojer <christoph.pojer@gmail.com>
Date: Fri, 23 Oct 2015 14:24:52 -0700
Subject: [PATCH] Fix tests.
---
package.json | 11 ++++++++---
src/components/Header/__tests__/Header-test.js | 2 --
src/mocks/css-stub.js | 7 +++++++
3 files changed, 15 insertions(+), 5 deletions(-)
{"success":true,"startTime":1445389390738,"numTotalTests":15,"numPassedTests":15,"numFailedTests":0,"testResults":[{"name":"/data/users/cpojer/www-hg/scripts/third_party/jest/src/HasteModuleLoader/__tests__/HasteModuleLoader-currentTestPath-test.js","summary":"","message":"","status":"passed","startTime":1445389391540,"endTime":1445389391560,"coverage":{}},{"name":"/data/users/cpojer/www-hg/scripts/third_party/jest/src/lib/__tests__/moduleMocker-test.js","summary":"","message":"","status":"passed","startTime":1445389391522,"endTime":1445389391562,"coverage":{}},{"name":"/data/users/cpojer/www-hg/scripts/third_party/jest/src/lib/__tests__/promisify-test.js","summary":"","message":"","status":"passed","startTime":1445389391541,"endTime":1445389391603,"coverage":{}},{"name":"/data/users/cpojer/www-hg/scripts/third_party/jest/src/lib/__tests__/FakeTimers-test.js","summary":"","message":"","status":"passed","startTime":1445389391520,"endTime":1445389391671,"coverage":{}},{"name":"/data/users/cpojer/www-hg/scripts/