Skip to content

Instantly share code, notes, and snippets.

View fivethreeo's full-sized avatar

Øyvind Saltvik fivethreeo

  • Levanger, Norway
View GitHub Profile
@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
@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 / 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 / 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>
"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();
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(
// razzle.config.js
'use strict';
module.exports = {
modifyWebpackOptions({
options: {
webpackOptions, // the modified options that was used to configure webpack/ webpack loaders and plugins
}
}) {
webpackOptions.babelRule.include = webpackOptions.babelRule.include.concat([
/grommet/
<html><head><meta charset="utf-8"/><title>Examples Test Report</title><style type="text/css">html,
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 1rem;
margin: 0;
padding: 0;
color: #333;
}
body {
padding: 2rem 1rem;
tests for isomorphic examples
tests for the basic example
✓ should install packages (17243 ms)
✓ should build successfully (4276 ms)
✓ should start devserver and exit (3275 ms)
tests for the basic-spa example
✓ should install packages (17225 ms)
✓ should build successfully (3311 ms)
✓ should start devserver and exit (2690 ms)
tests for the with-custom-babel-config example
/**
* The passed list of environment variables will be removed from the nodejs
* instance of webpack.DefinePlugin, so they can be resolved dynamically at
* runtime.
* @example
* // Include this in the plugins array exported by razzle.config.js
* const nodeRuntimeVarsPlugin = createRazzlePluginNodeRuntimeVars('PORT', 'HOST');
* @param {String} ...nodeRuntimeVars
* @return {Function}