Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View cpojer's full-sized avatar

Christoph Nakazawa cpojer

View GitHub Profile
@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>;
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,
// 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');
/**
* @providesModule LJPEG
*/function c(a){throw a;}var k=void 0,m=!0,s=null,u=!1,v;v||(v=eval("(function() { try { return Module || {} } catch(e) { return {} } })()"));var aa={},w;for(w in v)v.hasOwnProperty(w)&&(aa[w]=v[w]);var ba="object"===typeof process&&"function"===typeof require,ca="object"===typeof window,da="function"===typeof importScripts,ea=!ca&&!ba&&!da;
if(ba){v.print=function(a){process.stdout.write(a+"\n")};v.printErr=function(a){process.stderr.write(a+"\n")};var fa=require.call(null, "fs"),ga=require.call(null, "path");v.read=function(a,b){var a=ga.normalize(a),d=fa.readFileSync(a);!d&&a!=ga.resolve(a)&&(a=path.join(__dirname,"..","src",a),d=fa.readFileSync(a));d&&!b&&(d=d.toString());return d};v.readBinary=function(a){return v.read(a,m)};v.load=function(a){ha(read(a))};v.arguments=process.argv.slice(2);module.exports=v}else ea?(v.print=print,"undefined"!=typeof printErr&&
(v.printErr=printErr),v.read="undefined"!=typeof read?read:function(){c("no read() available (jsc?)")},v.readBinary=f
@cpojer
cpojer / .gitignore
Last active January 2, 2019 12:27
GitHub RN Issue Parser
node_modules
comments.json
comments.md
<Link href={getURIBuilder(ProfileRoute).setString('id', user.id).getURI()}>
{user.name}
</Link>
@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>
@cpojer
cpojer / app.js
Last active February 8, 2016 02:40
import {Router, Route} from 'react-router';
import BrowserHistory from 'react-router/lib/BrowserHistory';
import App from './components/App';
import Widget from './components/Widget';
// A wrapper to create a Relay container
function createRelayContainer(Component, props) {
if (Relay.isContainer(Component)) {
// Construct the RelayQueryConfig from the route and the router props.