Skip to content

Instantly share code, notes, and snippets.

View concepts.md

Patterns

So because of the refactoring that you started, it's starting to expose patterns in both those functions and related functions.

I am an asshole and using List<Hex> as a stand in for HashSet<HexTile> because my fingers are lazy

One thing i noticed: A lot of the stuff in this reserves behavior looks like:

(List<Hex> starts) => List<Hex> dests
View survey.md

I focused on these methods that you changed with an eye towards how those refactorings expose other opportunities. I surveyed both their callers and their callees

GetRunMovesForReserveUnit(playerId, Unit, isVanguard)

What is calling it:

  • GetHexesForVanguard(Unit) -- GetRunMovesForReserveUnit(unit.owningPlayerId, unit, true)
  • GetActionableHexesForReserveUnit(PTD, Unit, HS x3) -- GetRunMovesForReserveUnit(unit.owningPlayerId, unit, false)
View one-level-up.cs
/*
# GetRunMovesForReserveUnit(playerId, Unit, isVanguard)
What is using it:
- GetHexesForVanguard(Unit)
-- GetRunMovesForReserveUnit(unit.owningPlayerId, unit, true)
- GetActionableHexesForReserveUnit(PTD, Unit, HS<HT> x3)
-- GetRunMovesForReserveUnit(unit.owningPlayerId, unit, false)
View ideas.cs
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
public class MoveTypeTargets {
public HashSet<HexTile> walk = new HashSet<HexTile>();
public HashSet<HexTile> run = new HashSet<HexTile>();
public HashSet<HexTile> jump = new HashSet<HexTile>();
// if you treat these as immutable data objects theres also this sexy:
View docs.md

deployment environments

There are two environments that we deploy to that have different combinations of code and backing data.

In general, anything committed to any of the three existing release/* branches will trigger an automatic deployment via Azure.

Once you commit, watch the #pm-dev-notify channel for automatic notifications from azure that your committed code has been deployed. Look for a message that says TODO: Which message confirms the deployment? Is there something cheap and cheerful we can do like, "put your slack name in your commit message to get pinged when deployment is complete?"

TODO: these links are to the admin login which is used for impersonation, should also include link to regular login

@sdebaun
sdebaun / serverless.yml
Created Mar 26, 2019
epic serverless.yml
View serverless.yml
service: ${env:SERVICE, "app-back"}
frameworkVersion: ">=1.21.0 <2.0.0"
provider:
name: aws
runtime: nodejs8.10
stage: ${self:custom.target}
region: ${self:custom.region}
versionFunctions: false
@sdebaun
sdebaun / flatten.test.ts
Created Jan 10, 2019
using jest, ts-jest
View flatten.test.ts
const flatten = (arr: Array<any>): Array<any> =>
arr.reduce((a, x) => a.concat(flattenOrArray(x)), [])
const flattenOrArray = (x: any) =>
Array.isArray(x) ? flatten(x) : [x]
test('no nesting', () => {
expect(flatten([1, 2, 3])).toEqual([1, 2, 3])
})
View resolver.ts
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
import {
Opp,
OppService,
Project,
ProjectService,
RequestService,
Request,
View togglOnTrello.user.js
// ==UserScript==
// @name Toggl on Trello
// @namespace http://tampermonkey.net/
// @version 0.4
// @description Shows toggl entries that match C### where ### is the card number.
// @author sdebaun@sparks.network
// @match https://trello.com/c/*/*
// @match https://trello.com/b/*/*
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_setValue
View parser.js
import {
split, pipe, converge, slice, unfold, pair, append, splitAt,
lte, ifElse, length, concat,
prop, over, lensProp,
F,
} from 'ramda'
import {_BOL, _EOL} from './util'
const toTokens = pipe(split(' '), append(_EOL), concat([_BOL, _BOL, _BOL]))