Skip to content

Instantly share code, notes, and snippets.

Mike Harris mharris717

Block or report user

Report or block mharris717

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mharris717
mharris717 / child_type.js
Created Apr 24, 2019
Change child type on parent data changes
View child_type.js
/* global describe, it, beforeEach */
import expect from "expect";
import { create } from "../src/microstates";
function isStateType(obj, T) {
return obj.constructor.name === `Microstate<${T}>`;
}
function withInitBehavior(T, f) {
@mharris717
mharris717 / fetch.test.js
Last active Mar 21, 2019
Instance Fetch
View fetch.test.js
/* 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 {
View gist:0538f20cbbb51aeb95d611a50aec9d1d
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 Aug 9, 2018
React Microstates Waaaaat
View is_this_evil.rb
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 Jun 14, 2018
Variant Testing
View README.md

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 Jun 1, 2018
Microstates are the real Good News
View wowwwwwwwww.md

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 Apr 22, 2018
Draftaholics Rarity Script
View script.js
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
View coolkids.csv
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 Jan 7, 2018
Sex Haver's Convention
View ratings.txt
+-----+-----------------------------+------+-------+-------+---------+----------+----------+
| 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 |
View reduce_ftw.go
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) {
You can’t perform that action at this time.