Skip to content

Instantly share code, notes, and snippets.

View fivethreeo's full-sized avatar

Øyvind Saltvik fivethreeo

  • Levanger, Norway
View GitHub Profile
module.exports = (rules, loaderName) => {
// i.e.: /eslint-loader/
const loaderRegex = new RegExp(`[/\\\\]${loaderName}[/\\\\]`);
return rules.reduce((info, rule, ruleIndex) => {
if (rule.use) {
// Checks if there is an object inside rule.use with loader matching loaderRegex, OR
// Checks another condition, if rule is not an object, but pure string (ex: "style-loader", etc)
const useIndex = (typeof rule.use === 'function' ? rule.use({}) : rule.use).findIndex(
"use strict";
// https://github.com/storybookjs/storybook/issues/14342
// https://webpack.js.org/contribute/plugin-patterns/#monitoring-the-watch-graph
/**
* Logs the last changed files during webpack rebuilds.
*/
class WebpackLastFilesLoggerPlugin {
constructor() {
this.startTime = Date.now();
@fivethreeo
fivethreeo / formikexample.js
Last active September 1, 2021 13:45
formikexample.js
import React from "react";
import { Formik } from "formik";
const BasicExample = () => {
const buttonRef = useRef();
return (
<div>
<h1>My Form</h1>
@fivethreeo
fivethreeo / try.js
Last active September 15, 2021 19:46
import React from 'react';
import logo from './react.svg';
import './Home.css';
import { Helmet} from 'react-helmet-async';
import axios from 'axios';
class Home extends React.Component {
my_title = 'sss'
constructor(props) {
@fivethreeo
fivethreeo / rustdeps.sh
Last active March 18, 2023 17:50
Get rust deps with all features from use statements (code by chatgpt)
cat << EOF | python3
import re
import requests
import json
# Regular expression to match Rust use statements
regex = r"use ([^;]+);"
# Rust source code as a multiline string
@fivethreeo
fivethreeo / export_bezier_threejs.py
Last active January 15, 2024 04:47
Script to export bezier curves from blender to three.js
import bpy
myCurve = bpy.data.curves[0] # here your curve
spline= myCurve.splines[0] # maybe you need a loop if more than 1 spline
scale = 200
curvepath_template = """
var curves = new THREE.CurvePath();
%s