Skip to content

Instantly share code, notes, and snippets.

View beattyml1's full-sized avatar

Matthew Beatty beattyml1

View GitHub Profile
@beattyml1
beattyml1 / Async.ts
Created February 28, 2015 21:52
First Attempt on an asynchronous function array handling
module Async {
export function map<TIn, TOut>(input: Array<TIn>, processor: (item: TIn, after:(outputItem: TOut)=>void)=>void, returns: (output: Array<TOut>)=>void){
var results = [];
forEach(input, (item, index, checkIfDone)=>processor(item, function(outputItem){
results[index] = outputItem;
checkIfDone();
}), function(){
returns(results);
});
}
@beattyml1
beattyml1 / gist:5d05cfcfa87bb2ecdfee
Last active August 29, 2015 14:16
Functional First TypeScript Doodle
// really more a struct/interface
class DataStore {
store: (object: any) => string;
get: (key: string) => any;
}
class JsonDataStore: DataStore {
getRawJson: () => string;
static create(fileWriter: FileWriter): JsonDataStore {
var AJ = (function() {
var jsonRequest = function(verb, path) {
return function(data, callback) {
var req = new XMLHttpRequest();
req.open(verb, path, true);
req.onreadystatechange = callback;
req.send(JSON.stringify(data));
}
};
var queryString = function(data) {
@beattyml1
beattyml1 / Source
Last active August 29, 2015 14:23
AJ
var AJ = (function() {
var jsonRequest = function(verb, path) {
return function(data, callback) {
var req = new XMLHttpRequest();
req.open(verb, path, true);
req.onreadystatechange = callback;
req.send(JSON.stringify(data));
}
};
var queryString = function(data) {
namespace MicroGate
{
public class Route
{
public bool KeepResourceName { get; set; }
public string BaseUrl { get; set; }
public Func<string, string, HttpRequest, bool> Authenticate { get; set; }
public Func<string, string, HttpRequest, bool> Authorize { get; set; }
public IEnumerable<Func<string, string, bool>> AdditionalAllowFunctions { get; set; }
public Func<string, string, WebRequest, WebRequest> RequestTransfroms { get; set; }

Rules of layers

  • Every layer must provide significant/mearusable value
  • Every layer should for every method provide auto-implementing defaults off of the lower layer or should add significant logic to that method, or should be a completely new method built from business logic functions and lower layer functions
  • Every layer must have any dependencies (if any) passed in or injected
  • Every layer should try as much as possible to assemble logic from dependency free/fully indpendent business modules rather than including business logic in layers
  • Every component in a layer should be as small as possible favoring co-services to additional layers

Smells of bad layers

  • You write the same code over and over
  • You have layers where you repeatedly write a layer calling the lower layer with no addtional logic (and thus value) added
@beattyml1
beattyml1 / Interview Questions.md
Last active June 11, 2016 18:51
Interview Questions

Ethics and culture and Perks

  • How do you bias toward ethics and positive actors
  • How does your product improve the world or everyday peoples experience of the world
  • How do you balance giving everyone a voice and not bogging people down with non-relevant decisions/getting shit done
  • What is the roll of management in your org
    • Enable/facilitate/remove obstacles vs control/command
  • How flexible is the schedule? Why not more?
  • Is remote work possible? How often? Why not more?
  • What is average per year compensation increase?
  • How often does the team work overtime? How much does that usually look like? Do they usually take it easy afterwards to recover?
@beattyml1
beattyml1 / Technical Debt Metrics.md
Last active June 6, 2018 15:29
Technical Debt Metrics

Given

time_cost = person months spent on fix/refactor/project total including training and any temporary lost efficiency

total_improvement = specific to scenario

Then

@beattyml1
beattyml1 / Rest.ts
Last active January 24, 2018 02:37
import {Maybe, Nothing} from "CoreTypes";
export type IdTypes = string|number;
export type IdRequest<TId extends IdTypes> = { id?: Maybe<TId> };
export type QueryRequest<TQuery> = { query?: Maybe<TQuery> };
export type ActionRequest = { action?: Maybe<string>; };
export interface RestfulClient {
Get<TResult, TQuery, TId extends IdTypes>(
resourceUrl: string,
requestParams?: IdRequest<TId> & QueryRequest<TQuery> & ActionRequest): Promise<TResult>
@beattyml1
beattyml1 / Metatonic Custom Editor Example.ts
Created January 27, 2018 22:29
Metatonic Custom Editor Example
@editorFor("numeric", InputBoxLabelContainer, { isDefault: true })
export class NumericEditor extends BaseEditor<Numeric, NumericTypeInfo, BaseEditorModel<Numeric>, void> {
render() {
return (
<input type="number"
id={this.uniqueId()}
value={this.value().toEditorString()}
required={this.field().required}
max={this.props.field.max || undefined}
min={this.props.field.min || undefined}