Skip to content

Instantly share code, notes, and snippets.

View dschinkel's full-sized avatar
💻

Dave Schinkel dschinkel

💻
View GitHub Profile
@dschinkel
dschinkel / Scorer.elm
Created September 11, 2018 22:49
miniMax Algorithm in Elm - Tests - next move wins - Implementation 3 - With Fold
module Scorer exposing (..)
import Array exposing (fromList, get, map, set)
import List exposing (foldl, map)
import Maybe exposing (withDefault)
markerX : Char
markerX =
'X'
@dschinkel
dschinkel / Scorer.elm
Created September 11, 2018 23:41
miniMax Algorithm in Elm - Tests - next move wins - Implementation 3 - Fold using List.all instead
module Scorer exposing (..)
import Array exposing (fromList, get, map, set, toList)
import List exposing (all, foldl, map)
import Maybe exposing (withDefault)
markerX : Char
markerX =
'X'
@dschinkel
dschinkel / ArrayCustomHelpers.elm
Last active September 16, 2018 02:47
Elm - Helper Functions I've Created
{--
Overview
- this only works with List or Array of Char. I'll change it to be generic soon.
- Example list sent in: [['X',' ',' '],['O','O',' '],['X',' ',' ']] : List (List Char)
- After Conversion it's type of Array.Array (Array.Array Char)
##### If you'd like to try this out in elm repl, run the following:#####
@dschinkel
dschinkel / PlayingWithElmDictionaries.elm
Last active September 20, 2018 05:27
Elm - Dictionaries
-- instead of using a 2D list or 2D array to represent a game node/board, lets use a Dict instead
-- with Dict unlike List or Array, it's much easier to insert, find, and update values
{--
repl:
make sure you have no trailing spaces after \. Also, might need to uses spaces not tab in Sublime text
import Dict
board = Dict.fromList \
[ \
@dschinkel
dschinkel / args.js
Created October 2, 2018 04:33 — forked from ericelliott/args.js
Polymorphic functions and multiple dispatch in JavaScript
var args = [].slice.call(arguments, 0);
@dschinkel
dschinkel / EditProjectQuestions-Part2.js
Last active February 7, 2019 03:16
Route Component TDD Example - Retrospective
// makes Part2 test pass & removed what we don't need
import * as React from "react";
import { RouteComponentProps } from "react-router";
import WithEditProjectQuestions from "containers/recruiter/WithEditProjectQuestions";
import ProjectQuestionsForm from "components/recruiter/ProjectQuestionsForm";
export class EditProjectQuestions extends React.Component {
public render() {
// we're passing it a dummy function that does nothing to satisfy the ProjectQuestionsForm contract just to get us by
@dschinkel
dschinkel / oh-my-zsh.commands.csv
Last active November 27, 2018 02:01
my favorite oh-my-zsh commands
alias for git command
ga . git add .
gcmsg git commit -m
gp git push
gp -f git push -f
gst git status
gb git branch
gb git branch
gco git checkout
gco -b git checkout -b
@dschinkel
dschinkel / company-detail-header-spec.js
Last active May 14, 2019 23:44
React Test Utilities Examples - Early Tests I Wrote for WeDoTDD.com in 2015
// source: https://github.com/dschinkel/we-do-tdd/commit/9e58e254b2c4fc70ebf54ff475079facd2c61d71
import {Component,Store} from 'reactivate';
import CompanyHeader from '../../client/components/companyDetail/CompanyHeader';
import {expect} from 'chai';
import {reactUtil} from '../helper';
const store = Store();
const {renderIntoDocument, find} = reactUtil;
describe('Company Detail - Header', () => {
@dschinkel
dschinkel / no-ddd.md
Last active January 4, 2019 06:01
There is no such thing as "Document Driven Development"

My repsonse to zsup/ddd.md in which he wrote:

Documentation-Driven Development

The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.

  • Document the feature first. Figure out how you're going to describe the feature to users; if it's not documented, it doesn't exist. Documentation is the best way to define a feature in a user's eyes.
  • Whenever possible, documentation should be reviewed by users (community or Spark Elite) before any development begins.
  • Once documentation has been written, development should commence, and test-driven development is preferred.
  • Unit tests should be written that test the features as described by the documentation. If the functionality ever comes out of alignment with the documentation, tests should fail.
  • When a feature is being modified, it should be modified
@dschinkel
dschinkel / EmailSweeper.java
Last active March 27, 2019 22:26
Pillar Bootcamp
package subscriptions;
import dependencies.User;
import dependencies.UserMailer;
import dependencies.UserRepository;
public class EmailSweeper {
UserMailer mailer;
UserRepository repository;
String unpaidMessage = "Please renew your subscription to Ferret Fancy!";