Skip to content

Instantly share code, notes, and snippets.

View mharris717's full-sized avatar

Mike Harris mharris717

View GitHub Profile
@mharris717
mharris717 / fetch.test.js
Last active March 21, 2019 15:06
Instance Fetch
/* global describe, it, beforeEach */
import expect from "expect";
import Identity from "../src/identity";
import { create } from "../src/microstates";
import { TodoMVC } from "./todomvc";
import Promise from "bluebird";
export default class FetchAttr {
1 Caligo Skin-Witch
1 Knight of Malice
1 Sporecrown Thallid
1 Yavimaya Sapherd
1 Baloth Gorger
1 Kwende, Pride of Femeref
2 Academy Journeymage
1 Cloudreader Sphinx
1 Muldrotha, the Gravetide
1 Fungal Infection
@mharris717
mharris717 / is_this_evil.rb
Created August 9, 2018 20:41
React Microstates Waaaaat
import React from "react";
import { Consumer } from "@microstates/react";
import { map } from "microstates";
export default class Blog extends React.Component {
render() {
return (
<Consumer>
{blog => {
return (
@mharris717
mharris717 / README.md
Created June 14, 2018 23:18
Variant Testing

I wrote an example of something I've been thinking about a lot. I have no idea if it's something or nothing, but I am compelled to share out of excitement that it actually runs.

I want to be able to specify tests, and specify "variants", and run the tests with a specified list of variants. The variants in my head are stuff like mock out the Foo service, use the real Foo service, login with an admin user, etc.

Testing.main do |t|
  t.context "Widget#price" do |c|
    c.let(:widget) do
      Widget.new(id: rand(1000))
    end
@mharris717
mharris717 / wowwwwwwwww.md
Created June 1, 2018 22:32
Microstates are the real Good News

Create immutable state from a Class and get the best parts of an ORM for free. When I started with Redux I googled "Redux ORM" and immediately recoiled in horror. I just wanted to automate the translation between my state primitive and real classes. This gets it as a freaking byproduct.

Common primitives available on anything in microstate with no boilerplate. Uniform expression of these primitives makes translation to other forms easy.

Set nested properties in a consistent way without feeling like you're splitting the atom each time you need to do it. All (most of?) the operations just continue to work within Arrays.

Composable!!! Chainable!!! Constants!!!

Computed properties and transitions just fall out so naturally from using classes that it doesn't even seem like you did anything. Transitions take the place of many action creators in an obvious way.

@mharris717
mharris717 / script.js
Created April 22, 2018 13:18
Draftaholics Rarity Script
var rarities = {"Plains":"Basic Land","Island":"Basic Land","Swamp":"Basic Land","Mountain":"Basic Land","Forest":"Basic Land","Serra Angel":"Uncommon","Llanowar Elves":"Common","Juggernaut":"Uncommon","Icy Manipulator":"Uncommon","Goblin Warchief":"Uncommon","Gaea's Blessing":"Uncommon","Verdant Force":"Rare","Skirk Prospector":"Common","Aesthir Glider":"Common","Siege-Gang Commander":"Rare","Gilded Lotus":"Rare","Divination":"Common","Fire Elemental":"Common","Opt":"Common","Tragic Poet":"Common","Rescue":"Common","Thorn Elemental":"Uncommon","Syncopate":"Common","Meandering River":"Common","Timber Gorge":"Common","Isolated Chapel":"Rare","Nature's Spiral":"Uncommon","Clifftop Retreat":"Rare","Hinterland Harbor":"Rare","Sulfur Falls":"Rare","Woodland Cemetery":"Rare","Skizzik":"Uncommon","Gideon's Reproach":"Common","Sage of Lat-Nam":"Uncommon","Karn, Scion of Urza":"Mythic Rare","Adamant Will":"Common","Aven Sentry":"Common","Baird, Steward of Argive":"Uncommon","Benalish Honor Guard":"Common","Benalish Ma
mharris717 Arvad the Cursed 2.5
m.lord977 Arvad the Cursed 2.0
da Arvad the Cursed 1795.0
jay.pare Arvad the Cursed 3.0
jake.coleman32 Arvad the Cursed 3.5
mharris717 Artificer’s Assistant 2.5
da Artificer’s Assistant 1342.0
jay.pare Artificer’s Assistant 2.0
jake.coleman32 Artificer’s Assistant 2.5
mharris717 Arcane Flight 3.0
@mharris717
mharris717 / ratings.txt
Last active January 7, 2018 22:39
Sex Haver's Convention
+-----+-----------------------------+------+-------+-------+---------+----------+----------+
| Num | Card | Mike | Jeeps | Crowd | MikeAct | JeepsAct | CrowdAct |
+-----+-----------------------------+------+-------+-------+---------+----------+----------+
| 1 | Merfolk Mistbinder | 4 | 63 | 30 | 4.5 | 2.5 | 1834.0 |
| 2 | Legion Lieutenant | 4 | 114 | 24 | 4.5 | 2.0 | 1855.0 |
| 3 | Rekindling Phoenix | 4 | 4 | 1 | 4.5 | 4.0 | 2171.0 |
| 4 | Ravenous Chupacabra | 4 | 4 | 4 | 4.5 | 4.0 | 2100.0 |
| 5 | Dire Fleet Poisoner | 4 | 26 | 9 | 4.5 | 3.0 | 2008.0 |
| 6 | Luminous Bonds | 4 | 26 | 25 | 4.5 | 3.0 | 1851.0 |
| 7 | Tetzimoc, Primal Death | 4 | 4 | 3 | 4.5 | 4.0 | 2128.0 |
@mharris717
mharris717 / reduce_ftw.go
Created March 30, 2017 14:27
I Shouldn't Exist
package gen
import "time"
type ActorDataSlice []actorData
func (m ActorDataSlice) Map_ActorDataSlice(cb func(actorData) bool) ActorDataSlice {
var res ActorDataSlice
for _, obj := range m {
if cb(obj) {
@mharris717
mharris717 / keybase.md
Created February 6, 2017 18:26
keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object: