Skip to content

Instantly share code, notes, and snippets.

View mharris717's full-sized avatar

Mike Harris mharris717

View GitHub Profile
@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:

@mharris717
mharris717 / messages.md
Last active August 23, 2017 18:26
A Conversation About OOP vs. FP Turns Constructive

Just tried to put this in a more readable format: https://github.com/svanderbleek/haskellandchill.com/blob/master/a-conversation-about-oop-vs-fp-turns-constructive.md

Person Time Message
sagar 10:47 why is that, why is OOP trash
katychuang 10:48 excellent question
katychuang 10:49 I've been told FP and OOP are different paradigms
katychuang 10:52 I'm going to butcher a quote from a talk by Evie so I'm going to paraphrase… She said something like when you work with OOP you create lots of objects and rules on how they should interact and yet somehow end up having to touch each other a lot and inappropriately
katychuang 10:53 On the other hand FP (especially Haskell) is like working with shapes, like that baby shape fitting toy where you focus more on fitting the type parameters correctly
katychuang 10:56 I think of programming as building a piping system. FP (especia
mharris717
sorry, this isn't gonna be dlr's game i think
APG
nice trashtalking dick eyes
APG
museum is so good against dlr...
APG
@mharris717
mharris717 / README.md
Last active March 28, 2016 14:38
Dynamo Helper

Helper to interact with Dynamo table

Setup

const fields = ['color','price'];
const tableName = "" + projectName + '-widgets-' + stage;
Widget = makeDynamoFuncs(tableName,fields);