Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Rob Sawyer robksawyer

🎯
Focusing
View GitHub Profile
View sendmatic.js
let Web3 = require("web3");
// Replace value of rpc with https://rpc-mumbai.matic.today for Mumbai
let rpc = "https://rpc-mainnet.matic.network";
const provider = new Web3.providers.HttpProvider(rpc);
const web3 = new Web3(provider);
// Add your private key
web3.eth.accounts.wallet.add("pvt-key");
View PolyhedronMaterial.frag
#define SHADER_NAME PolyhedronMaterial
precision highp float;
uniform sampler2D map;
uniform vec2 uvDisp;
uniform float time;
varying float smoothShading;
// varying vec3 viewPos;
varying vec2 vUV;
@robksawyer
robksawyer / effects.jsx
Last active Nov 30, 2020
react-three-fiber post-processing trial & errors
View effects.jsx
import React, { useEffect, useMemo } from 'react'
import { useFrame, useThree, extend, useLoader } from 'react-three-fiber'
import * as THREE from 'three'
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer'
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass'
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass'
// import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass'
import { FXAAShader } from 'three/examples/jsm/shaders/FXAAShader'
@robksawyer
robksawyer / excludedActivityTypes.swift
Last active Feb 24, 2022
A list of UIActivity.ActivityType for modern apps.
View excludedActivityTypes.swift
let excludedActivityTypes = [
UIActivity.ActivityType.print,
UIActivity.ActivityType.openInIBooks,
UIActivity.ActivityType.copyToPasteboard,
UIActivity.ActivityType.addToReadingList,
UIActivity.ActivityType.assignToContact,
UIActivity.ActivityType.copyToPasteboard,
UIActivity.ActivityType.mail,
UIActivity.ActivityType.markupAsPDF,
UIActivity.ActivityType.postToFacebook,
View NukePass.js
_this.pass = new NukePass("ExperienceOverlay", {
unique: "exp_overlay",
uOverlay: {
value: 0
},
tNormal: {
value: null,
getTexture: Utils3D.getRepeatTexture
},
uLightStr: {
@robksawyer
robksawyer / SoundIcon.js
Created Sep 25, 2020
Code for an animated audio toggle.
View SoundIcon.js
Class((function SoundIcon() {
Inherit(this, Element);
const _this = this,
$this = _this.element,
_bars = [];
var _audioCtrl, _analyser, _analyserArray;
const RANGE = [255, 100, 140];
function hover({
action: action
View GazeCamera.js
Class((function GazeCamera(_input, _group) {
Inherit(this, BaseCamera);
const _this = this;
var _strength = {
v: 1
},
_move = new Vector3,
_position = new Vector3,
_wobble = new Vector3,
_rotation = 0,
View initDebug.js
function initDebug() {(
_debug = new Mesh(
new BoxGeometry(.25, .25, .5, 1, 1, 5),
new Shader("DebugCamera", {
uColor: {
value: new Color,
transparent: !0,
depthTest: !1
}
})
View Curve3d.js
class Curve3D {
constructor() {
this.arcLengthDivisions = 200
}
getPointAt(u) {
let t = this.getUtoTmapping(u);
return this.getPoint(t)
}
getPoints(divisions = 5) {
let points = [];
View at_shaders.js
function initScene() {
_triangleGeometry = World.QUAD, _luminosityShader = _this.initClass(Shader, "UnrealBloomLuminosity", {
tDiffuse: {
value: null,
ignoreUIL: !0
},
luminosityThreshold: {
value: 1
},
smoothWidth: {