Skip to content

Instantly share code, notes, and snippets.

@CharlieHess
CharlieHess / use-shake-controller.ts
Created Jun 23, 2021
useShakeController—apply a shake effect to any Object3D
View use-shake-controller.ts
import { MutableRefObject, useEffect, useMemo, useRef, useState } from 'react';
import { Clock, Euler, MathUtils, Object3D, Vector3 } from 'three';
import { SimplexNoise } from 'three-stdlib';
import { ShakeController } from '@react-three/drei';
import { useFrame } from '@react-three/fiber';
export interface ShakeControllerParam {
max: number;
frequency: number;
View sample_crash.json
{
"environment": "production",
"extra": {
"crashed_process": "browser"
},
"release": "Slack@4.13.0-alpha1",
"user": {
"ip_address": "{{auto}}"
},
"tags": {
@CharlieHess
CharlieHess / main.js
Last active Oct 14, 2020
paintWhenInitiallyHidden
View main.js
const {app, BrowserWindow} = require('electron')
let mainWindow
function createWindow () {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
show: false,
paintWhenInitiallyHidden: false,
@CharlieHess
CharlieHess / index.html
Last active Sep 21, 2020
Missing separator at end of items list
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
@CharlieHess
CharlieHess / index.html
Last active Sep 2, 2020
Missing first focus event when focusing window with show: false
View index.html
<!-- Empty -->
@CharlieHess
CharlieHess / how-to-use-it.tsx
Last active Aug 27, 2020
Helpers to track OutlinePass selection
View how-to-use-it.tsx
function Scene() {
return (
<Canvas>
<OutlineItemsProvider>
<SomeMesh />
<SomeMesh />
<SomeMesh />
<Effects />
</OutlineItemsProvider>
</Canvas>
@CharlieHess
CharlieHess / prompt-to-update-epic.ts
Last active Nov 6, 2019
Example of prompting users when an update is available
View prompt-to-update-epic.ts
/**
* Shows a notification prompting users to restart when an update has been downloaded
* and we're ready to apply it.
*/
export const promptToUpdateEpic: Epic<Action<ReleaseChannel | UpdateStatus>, State> = (
action$,
store,
) => {
// Update status is redux state populated by autoUpdater events
const updateStatusChanged = action$.pipe(
@CharlieHess
CharlieHess / main.js
Created Oct 30, 2019
web-contents-created fired too early?
View main.js
const {app, BrowserWindow, webContents: WebContents} = require('electron')
const assert = require('assert')
let mainWindow
function createWindow () {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
@CharlieHess
CharlieHess / index.html
Created Oct 4, 2019
Electron Fiddle Gist
View index.html
<!-- Empty -->
@CharlieHess
CharlieHess / index.html
Created Oct 4, 2019
Electron Fiddle Gist
View index.html
<!-- Empty -->