Skip to content

Instantly share code, notes, and snippets.

View lukekaalim's full-sized avatar
🌜
Stayin' up late

Luke Kaalim lukekaalim

🌜
Stayin' up late
  • New South Wales, Australia
View GitHub Profile
@lukekaalim
lukekaalim / Program.cs
Created January 11, 2020 16:51
MDK with Trim Unused Times removes both DissapearingClass declarations, even though one of them is used in the Main function
using Sandbox.ModAPI.Ingame;
namespace IngameScript
{
partial class Program : MyGridProgram
{
class DissapearingClass { }
class DissapearingClass<T> { }
@lukekaalim
lukekaalim / result.js
Created August 30, 2019 07:06
Result data type
// @flow strict
/*::
type Result<TSuccess, TFailure> =
| { type: 'success', success: TSuccess }
| { type: 'failure', failure: TFailure }
*/
const succeed = (success) => ({
type: 'success',
const middleWario = (sideEffectorConstructors) => (dispatch, getState) => {
const sideEffectors = sideEffectorConstructors.map(constructor => constructor(getState, dispatch));
return (next) => (action) => {
sideEffectors.forEach(effector => effector(action));
next(action);
};
};
const toResponse = async (fetchResult) => (
const response = await fetchResult;