Skip to content

Instantly share code, notes, and snippets.

View mjanssen's full-sized avatar
👏

Marnix Janssen mjanssen

👏
View GitHub Profile
@mjanssen
mjanssen / biome.json
Last active October 30, 2024 13:49
Sensible Biomejs config
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"lineWidth": 80,
"lineEnding": "lf"
},
import { useEffect, useState } from "react";
export default function Piano() {
const [key, setKey] = useState(null);
useEffect(() => {
function onKeyPress(e) {
e.preventDefault();
const key = e.key.toLowerCase();
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mjanssen
mjanssen / react-class-params.js
Last active March 31, 2020 11:11
Get data based on url params
import React, { Component } from 'react';
import dlv from 'dlv';
function getUrlQueryData() {
const queryData = window.location.search.replace(/^\?/, '').split('&');
const d = {};
if (queryData) {
queryData.forEach(k => {
const [key, value] = k.split('=');
d[key] = value;
@mjanssen
mjanssen / rollup.config.js
Created March 28, 2020 17:49
Rollup config
import babel from "rollup-plugin-babel";
import multiInput from "rollup-plugin-multi-input";
const extensions = [".ts", ".tsx"];
export default {
input: ["./src/components/**/*.tsx"],
external: ["react"],
@mjanssen
mjanssen / html.js
Created March 28, 2020 17:48
Output of rollup compiling
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var React = _interopDefault(require('react'));
function Html(_ref) {
var className = _ref.className,
children = _ref.children,
_ref$comp = _ref.comp,