Skip to content

Instantly share code, notes, and snippets.

import { NextApiRequest, NextApiResponse } from "next";
import httpProxyMiddleware from "next-http-proxy-middleware";
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export default (req: NextApiRequest, res: NextApiResponse) =>
httpProxyMiddleware(req, res, {
target: process.env.API_HOST,
changeOrigin: true,
headers: {
Authorization: `Bearer ${process.env.API_TOKEN}`,
import Cors from 'cors'
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next'
const cors = Cors({
methods: ['POST'],
})
function runMiddleware(req, res, fn) {
return new Promise((resolve, reject) => {
fn(req, res, result => {
import React, { useState } from "react";
import PropTypes from "prop-types";
import Tab from "./Tab";
const Tabs = (props) => {
const [ activeTab, setActiveTab ] = useState(props.children[0].props.label);
return (
<div className="tabs">
<ol className="tab-list">
{props.children.map((child) => (
<html>
<head>
</head>
<body>
<script>
function loolister () {
// Make a lovely button
var button = document.createElement('button');
// label it
button.innerText = 'Find nearby loos';
@marxian
marxian / auto_transform_geometries.js
Created August 1, 2011 15:32
GeoJSON + OSM + OpenLayers
var geojson_format = new OpenLayers.Format.GeoJSON({
'internalProjection': new OpenLayers.Projection("EPSG:900913"),
'externalProjection': new OpenLayers.Projection("EPSG:4326")
});