Skip to content

Instantly share code, notes, and snippets.

@mathieuancelin
mathieuancelin / Lens.java
Last active March 7, 2023 02:23
Lenses with Java 8
package bar.foo.lenses;
import java.util.function.BiFunction;
import java.util.function.Function;
public class Lens<A, B> {
private final Function<A, B> getter;
private final BiFunction<A, B, A> setter;
@jamsesso
jamsesso / dev-server.js
Last active August 24, 2020 13:27
Webpack dev server with a better proxy (http-proxy-middleware)
var express = require('express');
var path = require('path');
var webpackConfig = require('./webpack.config');
var webpack = require('webpack');
var webpackDevMiddleware = require('webpack-dev-middleware');
var webpackHotMiddleware = require('webpack-hot-middleware');
var proxyMiddleware = require('http-proxy-middleware');
var devConfig = webpackConfig.devServer;
var app = express();
@sandor-nemeth
sandor-nemeth / PropertyLogger.java
Last active May 28, 2024 14:05
Spring Boot - Log all configuration properties on application startup
package io.github.sandornemeth.spring;
import java.util.Arrays;
import java.util.stream.StreamSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.env.AbstractEnvironment;
@bricksroo
bricksroo / App.vue
Last active February 7, 2024 13:03
Reveal.js in Vue
<template>
<div id="app">
<!-- <img src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/> -->
<div class="reveal">
<div class="slides">
<section>Single Horizontal Slide</section>
<section>
<section>Vertical Slide 1</section>
<section>Vertical Slide 2</section>
@1natsu172
1natsu172 / .eslintrc
Last active July 5, 2023 10:23
My airbnb based ESLint config for "typescript-eslint" with React & prettier
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"tsconfigRootDir": "."
},
"env": {
"browser": true,
"jest/globals": true
},
@shilman
shilman / storybook-docs-typescript-walkthrough.md
Last active May 28, 2024 17:42
Storybook Docs Typescript Walkthrough

Storybook Docs w/ CRA & TypeScript

This is a quick-and-dirty walkthrough to set up a fresh project with Storybook Docs, Create React App, and TypeScript. If you're looking for a tutorial, please see Design Systems for Developers, which goes into much more depth but does not use Typescript.

The purpose of this walkthrough is a streamlined Typescript / Docs setup that works out of the box, since there are countless permutations and variables which can influence docs features, such as source code display, docgen, and props tables.

Step 1: Initialize CRA w/ TS

npx create-react-app cra-ts --template typescript
@twhitbeck
twhitbeck / MSWExample.stories.tsx
Created October 14, 2022 10:07
An example of using `msw` with ladle
import { setupWorker, rest } from "msw";
export const ExampleStory = () => {
...
};
ExampleStory.decorators = [
(Story) => {
const [ready, setReady] = React.useState(false);