Skip to content

Instantly share code, notes, and snippets.

View robksawyer's full-sized avatar
🎯
Focusing

Rob Sawyer robksawyer

🎯
Focusing
View GitHub Profile
@robksawyer
robksawyer / rotation-example-slerp.js
Last active August 15, 2022 11:16
An example of how to convert Euler to Quaternions and use slerp for rotation.
// Rotations
const step = 'q1';
const cameraRotations = {
q1: {
x: 0.75,
y: 0,
z: 0,
},
q2A: {
x: -0,
@dillonchanis
dillonchanis / example.css
Created September 20, 2020 14:44
Tailwind Utility for using gradients with text
@layer utilities {
.text-gradient {
background-clip: text;
-webkit-text-fill-color: transparent;
}
}
#!/bin/bash
# README: A more updated version is on the comments by (ashmna)[https://gist.github.com/ashmna]
# See at: https://gist.github.com/allangarcia/938b052a7d55d1652052e4259364260b?permalink_comment_id=4265898#gistcomment-4265898
# this is for tools required
brew update
brew install ninja
brew install cmake
@drenther
drenther / next.config.js
Last active December 23, 2021 11:22
Final next.config.js and postcss.config.js
const withCSS = require('@zeit/next-css');
const NextWorkboxPlugin = require('next-workbox-webpack-plugin');
const WebpackPwaManifest = require('webpack-pwa-manifest');
const path = require('path');
module.exports = withCSS({
webpack(config, { isServer, buildId, dev }) {
// Fixes npm packages that depend on `fs` module
config.node = {
fs: 'empty',
@companje
companje / map.glsl
Created January 23, 2018 22:46
map() function for GLSL known from Processing & openFrameworks
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
@oskarbraten
oskarbraten / custom_shader_example.js
Created November 21, 2017 18:48
A three.js custom shader example
"use strict";
class MyCustomMaterial extends THREE.ShaderMaterial {
// constructor takes appropriate parameters.
// Default values using object destructuring (ES6)
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Object_destructuring
constructor({
color = 0xffffff,
emissive = 0x000000,
@novascreen
novascreen / README.md
Last active November 18, 2021 08:11
How to mock next/router in Storybook

If you use Storybook with Next.js and have components using next/link you'll have to mock next/router the same you would for testing with Jest or others. Simply create a file with the mock router as shown below and import it in your Storybook config.

This is based on some information from an issue on Next.js:

vercel/next.js#1827

import express from 'express';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import App from './components/App';
import {flushServerSideRequires} from 'react-loadable';
let app = express();
let webpackStats = require('./output-webpack-stats.json');

This uses Chocolatey and Boxstarter to install a loadout for Sitecore/.NET development on a new computer. Click the link below to start a click-to-run that does all the things. It's that easy. Fork the gist and alter the link below to customize for your own usage!

Click here to start install

@Anthelmed
Anthelmed / Custom cannon js body
Last active November 9, 2022 00:05
Using v-hacd https://github.com/kmammou/v-hacd to create custom collider for cannon js
import THREE from 'three';
import CANNON from 'cannon';
export const generateThreeVertices = (rawVerts) => {
let verts = [];
for(let v = 0; v < rawVerts.length; v+=3){
verts.push(new THREE.Vector3(rawVerts[v],
rawVerts[v+1],
rawVerts[v+2]));