Skip to content

Instantly share code, notes, and snippets.

View neurosnap's full-sized avatar

Eric Bower neurosnap

View GitHub Profile
/**
* Features:
* - End-user has more granular control over what events to listen to -- if any
* - Responding to events happens within a while-loop
* - End-users are free to mutate variables all they want, they just need to ensure things get re-rendered properly
* - All events like prop, state changes, click/event handlers are all handled the same
* - `watch` will await for any events coming out of those `Stream`
* It also automatically watches for prop changes
*
* TODO:

saga-toolkit

The goal of this project is to enhance redux-saga core with opinionated ways to use the library.

features

  • helpers for making http requests (e.g. fetch effect)
  • helpers for setting up redux-saga
  • better types with yield delegate
/*
* This is an experimental view library that would compete with react, svelte, qwik.js, vue.js etc.
*
* Implementation reference: https://git.sr.ht/~erock/alpfx
*
* Features:
* - Instead of `view = func(state)` we have `view = func(event)`
* - This paradigm shift will:
* - make prop mgmt (e.g. when to update component) more manual
* - animations easier (events or transitions are sent to the component that the end-user
@neurosnap
neurosnap / emitter.ts
Last active September 27, 2022 13:53
const ee = emitter();
ee.on(function* clicker() {
while (true) {
const event = yield take('click');
console.log('click event!', event);
}
});
ee.on(function* once() {
const event = yield take('click');
console.log('on listen for event once!', event);
@neurosnap
neurosnap / phaser.ts
Created March 1, 2020 02:42
phaser collision
import Phaser from 'phaser';
class MainScene extends Phaser.Scene {
_player: Phaser.GameObjects.Sprite | null;
_cursors: Phaser.Types.Input.Keyboard.CursorKeys | null;
_layer: Phaser.Tilemaps.StaticTilemapLayer | null;
constructor() {
super({
key: 'MainScene',
@neurosnap
neurosnap / robodux.ts
Last active February 6, 2020 04:21
new robodux api experiment
import createTable from './slice-map';
import createIndexMany from './create-index';
import createPrimitive from './slice-assign';
import createLoaderTable from './slice-loading-map';
const createIndex = (p: any) => createTable<{ [key: string]: string }>(p);
interface User {
id: string;
email: string;
@neurosnap
neurosnap / monad.js
Last active September 21, 2018 21:04
const RESULT = "RESULT";
const isResult = obj => obj && obj.type === RESULT;
const Result = value => ({
type: RESULT,
value
});
const NOTHING = "NOTHING";
const isNothing = obj => obj && obj.type === NOTHING;
const Nothing = value => ({
import * as React from 'react';
import axios from 'axios';
import { connect } from 'react-redux';
import { getFormSubmitErrors } from 'redux-form';
+ import { push } from 'react-router-redux';
import { globals, GridContainer } from '@shared/atoms';
import styled from '@shared/ui';
import { buildFormData } from '@shared/lib/formatters';

Keybase proof

I hereby claim:

  • I am neurosnap on github.
  • I am neurosnap (https://keybase.io/neurosnap) on keybase.
  • I have a public key ASD15DIHe4ANJndK6jBxMLOtAD35MP78OGTKphHnJqByIQo

To claim this, I am signing this object:

const handler = {
get(target, name) {
return name;
},
};
const actionTypeCreator = new Proxy({}, handler);
const { ADD_SOMETHING, REMOVE_SOMETHING } = actionTypeCreator;