Skip to content

Instantly share code, notes, and snippets.

View ivoelbert's full-sized avatar
👨‍💻
taptaptaptap

Ivo Elbert ivoelbert

👨‍💻
taptaptaptap
View GitHub Profile
@ivoelbert
ivoelbert / renderPropsExample.tsx
Created May 15, 2020 19:52
Basic example of (needless) render props
interface IHaveTheLogicButNoUiProps {
render: (width: number) => JSX.Element;
}
function IHaveTheLogicButNoUi(props: IHaveTheLogicButNoUiProps): JSX.Element {
const windowWidth = useWindowWidth(); // Hook that tracks the window's width
return props.render(windowWidth);
}
interface PolyObject {
mesh: THREE.Object3D;
update?: () => void;
onCollide: (who: PolyObject) => void;
}
enum Groups {
asteroids,
ship,
shots,
@ivoelbert
ivoelbert / managerExample.ts
Created May 4, 2020 23:31
Vague example on Managers
// Main
class Polybius {
private asteroidManager: AsteroidManager;
constructor() {
this.asteroidManager = new AsteroidManager();
}
update = (): void => {
this.asteroidManager.update();

Keybase proof

I hereby claim:

  • I am ivoelbert on github.
  • I am ivoelbert1 (https://keybase.io/ivoelbert1) on keybase.
  • I have a public key ASBtrzfQ4gU2_2kfy4cx2wUgcLO1edgtvPoRd7a_cjV5ugo

To claim this, I am signing this object:

@ivoelbert
ivoelbert / .pde
Created July 4, 2017 14:32
Processing ascii pass
int _tiles;
int _tileSz;
int _cantTiles;
PFont _font;
void initAsciiPass(int t)
{
_tiles = t;
_tileSz = floor(width/_tiles);
_font = createFont("joystick.ttf", _tileSz);